drivers/video/fbdev/via/via_i2c.c
Source file repositories/reference/linux-study-clean/drivers/video/fbdev/via/via_i2c.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/video/fbdev/via/via_i2c.c- Extension
.c- Size
- 6577 bytes
- Lines
- 281
- Domain
- Driver Families
- Bucket
- drivers/video
- Inferred role
- Driver Families: exported/initcall integration point
- Status
- integration implementation candidate
Why This File Exists
Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Exports symbols or registers init work; inspect boot/module ordering and who consumes the exported contract.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/platform_device.hlinux/delay.hlinux/export.hlinux/spinlock.hlinux/module.hlinux/via-core.hlinux/via_i2c.h
Detected Declarations
function via_i2c_setsclfunction via_i2c_getsclfunction via_i2c_getsdafunction via_i2c_setsdafunction viafb_i2c_readbytefunction viafb_i2c_writebytefunction viafb_i2c_readbytesfunction create_i2c_busfunction viafb_i2c_probefunction viafb_i2c_removefunction viafb_i2c_initfunction viafb_i2c_exitexport viafb_find_i2c_adapter
Annotated Snippet
if (ret < 0) {
printk(KERN_ERR "viafb: cannot create i2c bus %u:%d\n",
i, ret);
continue; /* Still try to make the rest */
}
i2c_stuff->is_active = 1;
}
return 0;
}
static void viafb_i2c_remove(struct platform_device *platdev)
{
int i;
for (i = 0; i < VIAFB_NUM_PORTS; i++) {
struct via_i2c_stuff *i2c_stuff = &via_i2c_par[i];
/*
* Only remove those entries in the array that we've
* actually used (and thus initialized algo_data)
*/
if (i2c_stuff->is_active)
i2c_del_adapter(&i2c_stuff->adapter);
}
}
static struct platform_driver via_i2c_driver = {
.driver = {
.name = "viafb-i2c",
},
.probe = viafb_i2c_probe,
.remove = viafb_i2c_remove,
};
int viafb_i2c_init(void)
{
return platform_driver_register(&via_i2c_driver);
}
void viafb_i2c_exit(void)
{
platform_driver_unregister(&via_i2c_driver);
}
Annotation
- Immediate include surface: `linux/platform_device.h`, `linux/delay.h`, `linux/export.h`, `linux/spinlock.h`, `linux/module.h`, `linux/via-core.h`, `linux/via_i2c.h`.
- Detected declarations: `function via_i2c_setscl`, `function via_i2c_getscl`, `function via_i2c_getsda`, `function via_i2c_setsda`, `function viafb_i2c_readbyte`, `function viafb_i2c_writebyte`, `function viafb_i2c_readbytes`, `function create_i2c_bus`, `function viafb_i2c_probe`, `function viafb_i2c_remove`.
- Atlas domain: Driver Families / drivers/video.
- Implementation status: integration implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.