diff options
author | Jean Delvare <khali@linux-fr.org> | 2005-11-26 20:28:06 +0100 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2006-01-05 22:16:21 -0800 |
commit | 8a9947552d43b0d20d5fa23ac0ba435d526be454 (patch) | |
tree | 086844a62f549e488ebeecc196e1d4726a1d4598 /drivers/i2c | |
parent | ff179c8cf5caa17bf3d407edbb5872aa2eee6900 (diff) |
[PATCH] i2c: Drop i2c_driver.flags, 2 of 3
Just about every i2c chip driver sets the I2C_DF_NOTIFY flag, so we
can simply make it the default and drop the flag. If any driver really
doesn't want to be notified when i2c adapters are added, that driver
can simply omit to set .attach_adapter. This approach is also more
robust as it prevents accidental NULL pointer dereferences.
Signed-off-by: Jean Delvare <khali@linux-fr.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/i2c')
-rw-r--r-- | drivers/i2c/chips/ds1337.c | 1 | ||||
-rw-r--r-- | drivers/i2c/chips/ds1374.c | 1 | ||||
-rw-r--r-- | drivers/i2c/chips/eeprom.c | 1 | ||||
-rw-r--r-- | drivers/i2c/chips/isp1301_omap.c | 1 | ||||
-rw-r--r-- | drivers/i2c/chips/m41t00.c | 1 | ||||
-rw-r--r-- | drivers/i2c/chips/max6875.c | 1 | ||||
-rw-r--r-- | drivers/i2c/chips/pca9539.c | 1 | ||||
-rw-r--r-- | drivers/i2c/chips/pcf8574.c | 1 | ||||
-rw-r--r-- | drivers/i2c/chips/pcf8591.c | 1 | ||||
-rw-r--r-- | drivers/i2c/chips/rtc8564.c | 1 | ||||
-rw-r--r-- | drivers/i2c/chips/tps65010.c | 1 | ||||
-rw-r--r-- | drivers/i2c/chips/x1205.c | 1 | ||||
-rw-r--r-- | drivers/i2c/i2c-core.c | 4 | ||||
-rw-r--r-- | drivers/i2c/i2c-dev.c | 1 |
14 files changed, 2 insertions, 15 deletions
diff --git a/drivers/i2c/chips/ds1337.c b/drivers/i2c/chips/ds1337.c index 18228957606..65146cbc839 100644 --- a/drivers/i2c/chips/ds1337.c +++ b/drivers/i2c/chips/ds1337.c @@ -54,7 +54,6 @@ static int ds1337_command(struct i2c_client *client, unsigned int cmd, static struct i2c_driver ds1337_driver = { .owner = THIS_MODULE, .name = "ds1337", - .flags = I2C_DF_NOTIFY, .attach_adapter = ds1337_attach_adapter, .detach_client = ds1337_detach_client, .command = ds1337_command, diff --git a/drivers/i2c/chips/ds1374.c b/drivers/i2c/chips/ds1374.c index da488b735ab..5a270d60b69 100644 --- a/drivers/i2c/chips/ds1374.c +++ b/drivers/i2c/chips/ds1374.c @@ -235,7 +235,6 @@ static struct i2c_driver ds1374_driver = { .owner = THIS_MODULE, .name = DS1374_DRV_NAME, .id = I2C_DRIVERID_DS1374, - .flags = I2C_DF_NOTIFY, .attach_adapter = ds1374_attach, .detach_client = ds1374_detach, }; diff --git a/drivers/i2c/chips/eeprom.c b/drivers/i2c/chips/eeprom.c index 4baf573fa04..9bb1f8b3f38 100644 --- a/drivers/i2c/chips/eeprom.c +++ b/drivers/i2c/chips/eeprom.c @@ -71,7 +71,6 @@ static struct i2c_driver eeprom_driver = { .owner = THIS_MODULE, .name = "eeprom", .id = I2C_DRIVERID_EEPROM, - .flags = I2C_DF_NOTIFY, .attach_adapter = eeprom_attach_adapter, .detach_client = eeprom_detach_client, }; diff --git a/drivers/i2c/chips/isp1301_omap.c b/drivers/i2c/chips/isp1301_omap.c index d2a100d7783..4f472ba66a0 100644 --- a/drivers/i2c/chips/isp1301_omap.c +++ b/drivers/i2c/chips/isp1301_omap.c @@ -1636,7 +1636,6 @@ static struct i2c_driver isp1301_driver = { .name = "isp1301_omap", .id = 1301, /* FIXME "official", i2c-ids.h */ .class = I2C_CLASS_HWMON, - .flags = I2C_DF_NOTIFY, .attach_adapter = isp1301_scan_bus, .detach_client = isp1301_detach_client, }; diff --git a/drivers/i2c/chips/m41t00.c b/drivers/i2c/chips/m41t00.c index 3df309ae44a..13e67836b34 100644 --- a/drivers/i2c/chips/m41t00.c +++ b/drivers/i2c/chips/m41t00.c @@ -214,7 +214,6 @@ static struct i2c_driver m41t00_driver = { .owner = THIS_MODULE, .name = M41T00_DRV_NAME, .id = I2C_DRIVERID_STM41T00, - .flags = I2C_DF_NOTIFY, .attach_adapter = m41t00_attach, .detach_client = m41t00_detach, }; diff --git a/drivers/i2c/chips/max6875.c b/drivers/i2c/chips/max6875.c index b376a006883..7e61019e72d 100644 --- a/drivers/i2c/chips/max6875.c +++ b/drivers/i2c/chips/max6875.c @@ -69,7 +69,6 @@ static int max6875_detach_client(struct i2c_client *client); static struct i2c_driver max6875_driver = { .owner = THIS_MODULE, .name = "max6875", - .flags = I2C_DF_NOTIFY, .attach_adapter = max6875_attach_adapter, .detach_client = max6875_detach_client, }; diff --git a/drivers/i2c/chips/pca9539.c b/drivers/i2c/chips/pca9539.c index 59a93034622..26feb7a4f94 100644 --- a/drivers/i2c/chips/pca9539.c +++ b/drivers/i2c/chips/pca9539.c @@ -40,7 +40,6 @@ static int pca9539_detach_client(struct i2c_client *client); static struct i2c_driver pca9539_driver = { .owner = THIS_MODULE, .name = "pca9539", - .flags = I2C_DF_NOTIFY, .attach_adapter = pca9539_attach_adapter, .detach_client = pca9539_detach_client, }; diff --git a/drivers/i2c/chips/pcf8574.c b/drivers/i2c/chips/pcf8574.c index c323c2de236..2fae640cf32 100644 --- a/drivers/i2c/chips/pcf8574.c +++ b/drivers/i2c/chips/pcf8574.c @@ -68,7 +68,6 @@ static struct i2c_driver pcf8574_driver = { .owner = THIS_MODULE, .name = "pcf8574", .id = I2C_DRIVERID_PCF8574, - .flags = I2C_DF_NOTIFY, .attach_adapter = pcf8574_attach_adapter, .detach_client = pcf8574_detach_client, }; diff --git a/drivers/i2c/chips/pcf8591.c b/drivers/i2c/chips/pcf8591.c index ce420a67560..8750f71278e 100644 --- a/drivers/i2c/chips/pcf8591.c +++ b/drivers/i2c/chips/pcf8591.c @@ -91,7 +91,6 @@ static struct i2c_driver pcf8591_driver = { .owner = THIS_MODULE, .name = "pcf8591", .id = I2C_DRIVERID_PCF8591, - .flags = I2C_DF_NOTIFY, .attach_adapter = pcf8591_attach_adapter, .detach_client = pcf8591_detach_client, }; diff --git a/drivers/i2c/chips/rtc8564.c b/drivers/i2c/chips/rtc8564.c index 26e498d921d..e586f75dd02 100644 --- a/drivers/i2c/chips/rtc8564.c +++ b/drivers/i2c/chips/rtc8564.c @@ -362,7 +362,6 @@ static struct i2c_driver rtc8564_driver = { .owner = THIS_MODULE, .name = "RTC8564", .id = I2C_DRIVERID_RTC8564, - .flags = I2C_DF_NOTIFY, .attach_adapter = rtc8564_probe, .detach_client = rtc8564_detach, .command = rtc8564_command diff --git a/drivers/i2c/chips/tps65010.c b/drivers/i2c/chips/tps65010.c index 280dd7a45db..439bf6ceb78 100644 --- a/drivers/i2c/chips/tps65010.c +++ b/drivers/i2c/chips/tps65010.c @@ -639,7 +639,6 @@ static int __init tps65010_scan_bus(struct i2c_adapter *bus) static struct i2c_driver tps65010_driver = { .owner = THIS_MODULE, .name = "tps65010", - .flags = I2C_DF_NOTIFY, .attach_adapter = tps65010_scan_bus, .detach_client = __exit_p(tps65010_detach_client), }; diff --git a/drivers/i2c/chips/x1205.c b/drivers/i2c/chips/x1205.c index 7da366cdc18..c5ff2cee15a 100644 --- a/drivers/i2c/chips/x1205.c +++ b/drivers/i2c/chips/x1205.c @@ -107,7 +107,6 @@ static int x1205_command(struct i2c_client *client, unsigned int cmd, static struct i2c_driver x1205_driver = { .owner = THIS_MODULE, .name = "x1205", - .flags = I2C_DF_NOTIFY, .attach_adapter = &x1205_attach, .detach_client = &x1205_detach, }; diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c index 82ea1b7ec91..ad68ac00d91 100644 --- a/drivers/i2c/i2c-core.c +++ b/drivers/i2c/i2c-core.c @@ -197,7 +197,7 @@ int i2c_add_adapter(struct i2c_adapter *adap) /* inform drivers of new adapters */ list_for_each(item,&drivers) { driver = list_entry(item, struct i2c_driver, list); - if (driver->flags & I2C_DF_NOTIFY) + if (driver->attach_adapter) /* We ignore the return code; if it fails, too bad */ driver->attach_adapter(adap); } @@ -309,7 +309,7 @@ int i2c_add_driver(struct i2c_driver *driver) pr_debug("i2c-core: driver [%s] registered\n", driver->name); /* now look for instances of driver on our adapters */ - if (driver->flags & I2C_DF_NOTIFY) { + if (driver->attach_adapter) { list_for_each(item,&adapters) { adapter = list_entry(item, struct i2c_adapter, list); driver->attach_adapter(adapter); diff --git a/drivers/i2c/i2c-dev.c b/drivers/i2c/i2c-dev.c index 8af0bd1424d..9da51eb37c0 100644 --- a/drivers/i2c/i2c-dev.c +++ b/drivers/i2c/i2c-dev.c @@ -484,7 +484,6 @@ static struct i2c_driver i2cdev_driver = { .owner = THIS_MODULE, .name = "dev_driver", .id = I2C_DRIVERID_I2CDEV, - .flags = I2C_DF_NOTIFY, .attach_adapter = i2cdev_attach_adapter, .detach_adapter = i2cdev_detach_adapter, .detach_client = i2cdev_detach_client, |