drivers/net/dsa/microchip/ksz9477_i2c.c
Source file repositories/reference/linux-study-clean/drivers/net/dsa/microchip/ksz9477_i2c.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/dsa/microchip/ksz9477_i2c.c- Extension
.c- Size
- 3244 bytes
- Lines
- 150
- Domain
- Driver Families
- Bucket
- drivers/net
- Inferred role
- Driver Families: implementation source
- Status
- source 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/i2c.hlinux/kernel.hlinux/module.hlinux/regmap.hksz_common.h
Detected Declarations
function ksz9477_i2c_probefunction ksz9477_i2c_removefunction ksz9477_i2c_shutdown
Annotated Snippet
if (IS_ERR(dev->regmap[i])) {
return dev_err_probe(&i2c->dev, PTR_ERR(dev->regmap[i]),
"Failed to initialize regmap%i\n",
ksz9477_regmap_config[i].val_bits);
}
}
if (i2c->dev.platform_data)
dev->pdata = i2c->dev.platform_data;
dev->irq = i2c->irq;
ret = ksz_switch_register(dev);
/* Main DSA driver may not be started yet. */
if (ret)
return ret;
i2c_set_clientdata(i2c, dev);
return 0;
}
static void ksz9477_i2c_remove(struct i2c_client *i2c)
{
struct ksz_device *dev = i2c_get_clientdata(i2c);
if (dev)
ksz_switch_remove(dev);
}
static void ksz9477_i2c_shutdown(struct i2c_client *i2c)
{
struct ksz_device *dev = i2c_get_clientdata(i2c);
if (!dev)
return;
ksz_switch_shutdown(dev);
i2c_set_clientdata(i2c, NULL);
}
static const struct i2c_device_id ksz9477_i2c_id[] = {
{ .name = "ksz9477-switch" },
{ }
};
MODULE_DEVICE_TABLE(i2c, ksz9477_i2c_id);
static const struct of_device_id ksz9477_dt_ids[] = {
{
.compatible = "microchip,ksz9477",
.data = &ksz_switch_chips[KSZ9477]
},
{
.compatible = "microchip,ksz9896",
.data = &ksz_switch_chips[KSZ9896]
},
{
.compatible = "microchip,ksz9897",
.data = &ksz_switch_chips[KSZ9897]
},
{
.compatible = "microchip,ksz9893",
.data = &ksz_switch_chips[KSZ9893]
},
{
.compatible = "microchip,ksz9563",
.data = &ksz_switch_chips[KSZ9563]
},
{
.compatible = "microchip,ksz8563",
.data = &ksz_switch_chips[KSZ8563]
},
{
.compatible = "microchip,ksz8567",
.data = &ksz_switch_chips[KSZ8567]
},
{
.compatible = "microchip,ksz9567",
.data = &ksz_switch_chips[KSZ9567]
},
{
.compatible = "microchip,lan9646",
.data = &ksz_switch_chips[LAN9646]
},
{},
};
MODULE_DEVICE_TABLE(of, ksz9477_dt_ids);
Annotation
- Immediate include surface: `linux/i2c.h`, `linux/kernel.h`, `linux/module.h`, `linux/regmap.h`, `ksz_common.h`.
- Detected declarations: `function ksz9477_i2c_probe`, `function ksz9477_i2c_remove`, `function ksz9477_i2c_shutdown`.
- Atlas domain: Driver Families / drivers/net.
- Implementation status: source implementation candidate.
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.