/drivers/i2c/busses/i2c-s3c2410.c:
static int s3c24xx_i2c_probe(struct platform_device *pdev)
{
struct s3c24xx_i2c *i2c; .....
strlcpy(i2c->adap.name, "s3c2410-i2c", sizeof(i2c->adap.name));
i2c->adap.owner = THIS_MODULE;
i2c->adap.algo = &
s3c24xx_i2c_algorithm;
//adapter的i2c_algorithm
i2c->adap.retries = 2;
i2c->adap.class = I2C_CLASS_HWMON | I2C_CLASS_SPD;
.....
i2c->adap.algo_data = i2c;
i2c->adap.dev.parent = &pdev->dev;
......
i2c->adap.nr = pdata->bus_num;
....
ret =
i2c_add_numbered_adapter(&i2c->adap);
//注冊i2c_adapter
.....
}
static struct platform_driver s3c24xx_i2c_driver = {
.probe = s3c24xx_i2c_probe,
.remove = s3c24xx_i2c_remove,
.id_table = s3c24xx_driver_ids,
.driver = {
.owner = THIS_MODULE,
.name = "
s3c-i2c",
.pm = S3C24XX_DEV_PM_OPS,
},
};
static int __init i2c_adap_s3c_init(void)
{
return
platform_driver_register(&
s3c24xx_i2c_driver);
}
subsys_initcall(i2c_adap_s3c_init);