Commit 8a994755 authored by Jean Delvare's avatar Jean Delvare Committed by Greg Kroah-Hartman
Browse files

[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: default avatarJean Delvare <khali@linux-fr.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent ff179c8c
......@@ -109,6 +109,9 @@ Technical changes:
there is a MODULE_LICENSE() line, at the bottom of the file
(after MODULE_AUTHOR() and MODULE_DESCRIPTION(), in this order).
* [Driver] The flags field of the i2c_driver structure is gone.
I2C_DF_NOTIFY is now the default behavior.
Coding policy:
* [Copyright] Use (C), not (c), for copyright.
......
......@@ -27,7 +27,6 @@ address.
static struct i2c_driver foo_driver = {
.owner = THIS_MODULE,
.name = "Foo version 2.3 driver",
.flags = I2C_DF_NOTIFY,
.attach_adapter = &foo_attach_adapter,
.detach_client = &foo_detach_client,
.command = &foo_command /* may be NULL */
......@@ -36,10 +35,6 @@ static struct i2c_driver foo_driver = {
The name field must match the driver name, including the case. It must not
contain spaces, and may be up to 31 characters long.
Don't worry about the flags field; just put I2C_DF_NOTIFY into it. This
means that your driver will be notified when new adapters are found.
This is almost always what you want.
All other fields are for call-back functions which will be explained
below.
......
......@@ -127,7 +127,6 @@ static struct i2c_driver max7310_i2c_driver = {
.owner = THIS_MODULE,
.name = "akita-max7310",
.id = I2C_DRIVERID_AKITAIOEXP,
.flags = I2C_DF_NOTIFY,
.attach_adapter = max7310_attach_adapter,
.detach_client = max7310_detach_client,
};
......
......@@ -259,7 +259,6 @@ pcf8583_command(struct i2c_client *client, unsigned int cmd, void *arg)
static struct i2c_driver pcf8583_driver = {
.name = "PCF8583",
.id = I2C_DRIVERID_PCF8583,
.flags = I2C_DF_NOTIFY,
.attach_adapter = pcf8583_probe,
.detach_client = pcf8583_detach,
.command = pcf8583_command
......
......@@ -129,7 +129,6 @@ static struct i2c_driver adm1021_driver = {
.owner = THIS_MODULE,
.name = "adm1021",
.id = I2C_DRIVERID_ADM1021,
.flags = I2C_DF_NOTIFY,
.attach_adapter = adm1021_attach_adapter,
.detach_client = adm1021_detach_client,
};
......
......@@ -121,7 +121,6 @@ static struct i2c_driver adm1025_driver = {
.owner = THIS_MODULE,
.name = "adm1025",
.id = I2C_DRIVERID_ADM1025,
.flags = I2C_DF_NOTIFY,
.attach_adapter = adm1025_attach_adapter,
.detach_client = adm1025_detach_client,
};
......
......@@ -310,7 +310,6 @@ static void adm1026_init_client(struct i2c_client *client);
static struct i2c_driver adm1026_driver = {
.owner = THIS_MODULE,
.name = "adm1026",
.flags = I2C_DF_NOTIFY,
.attach_adapter = adm1026_attach_adapter,
.detach_client = adm1026_detach_client,
};
......
......@@ -107,7 +107,6 @@ static struct adm1031_data *adm1031_update_device(struct device *dev);
static struct i2c_driver adm1031_driver = {
.owner = THIS_MODULE,
.name = "adm1031",
.flags = I2C_DF_NOTIFY,
.attach_adapter = adm1031_attach_adapter,
.detach_client = adm1031_detach_client,
};
......
......@@ -140,7 +140,6 @@ static struct i2c_driver adm9240_driver = {
.owner = THIS_MODULE,
.name = "adm9240",
.id = I2C_DRIVERID_ADM9240,
.flags = I2C_DF_NOTIFY,
.attach_adapter = adm9240_attach_adapter,
.detach_client = adm9240_detach_client,
};
......
......@@ -220,7 +220,6 @@ static struct i2c_driver asb100_driver = {
.owner = THIS_MODULE,
.name = "asb100",
.id = I2C_DRIVERID_ASB100,
.flags = I2C_DF_NOTIFY,
.attach_adapter = asb100_attach_adapter,
.detach_client = asb100_detach_client,
};
......
......@@ -52,7 +52,6 @@ static int atxp1_detect(struct i2c_adapter *adapter, int address, int kind);
static struct i2c_driver atxp1_driver = {
.owner = THIS_MODULE,
.name = "atxp1",
.flags = I2C_DF_NOTIFY,
.attach_adapter = atxp1_attach_adapter,
.detach_client = atxp1_detach_client,
};
......
......@@ -92,7 +92,6 @@ static struct i2c_driver ds1621_driver = {
.owner = THIS_MODULE,
.name = "ds1621",
.id = I2C_DRIVERID_DS1621,
.flags = I2C_DF_NOTIFY,
.attach_adapter = ds1621_attach_adapter,
.detach_client = ds1621_detach_client,
};
......
......@@ -121,7 +121,6 @@ static struct i2c_driver fscher_driver = {
.owner = THIS_MODULE,
.name = "fscher",
.id = I2C_DRIVERID_FSCHER,
.flags = I2C_DF_NOTIFY,
.attach_adapter = fscher_attach_adapter,
.detach_client = fscher_detach_client,
};
......
......@@ -103,7 +103,6 @@ static struct i2c_driver fscpos_driver = {
.owner = THIS_MODULE,
.name = "fscpos",
.id = I2C_DRIVERID_FSCPOS,
.flags = I2C_DF_NOTIFY,
.attach_adapter = fscpos_attach_adapter,
.detach_client = fscpos_detach_client,
};
......
......@@ -154,7 +154,6 @@ static struct i2c_driver gl518_driver = {
.owner = THIS_MODULE,
.name = "gl518sm",
.id = I2C_DRIVERID_GL518,
.flags = I2C_DF_NOTIFY,
.attach_adapter = gl518_attach_adapter,
.detach_client = gl518_detach_client,
};
......
......@@ -112,7 +112,6 @@ static struct i2c_driver gl520_driver = {
.owner = THIS_MODULE,
.name = "gl520sm",
.id = I2C_DRIVERID_GL520,
.flags = I2C_DF_NOTIFY,
.attach_adapter = gl520_attach_adapter,
.detach_client = gl520_detach_client,
};
......
......@@ -237,7 +237,6 @@ static struct i2c_driver it87_driver = {
.owner = THIS_MODULE,
.name = "it87",
.id = I2C_DRIVERID_IT87,
.flags = I2C_DF_NOTIFY,
.attach_adapter = it87_attach_adapter,
.detach_client = it87_detach_client,
};
......
......@@ -141,7 +141,6 @@ static void lm63_init_client(struct i2c_client *client);
static struct i2c_driver lm63_driver = {
.owner = THIS_MODULE,
.name = "lm63",
.flags = I2C_DF_NOTIFY,
.attach_adapter = lm63_attach_adapter,
.detach_client = lm63_detach_client,
};
......
......@@ -69,7 +69,6 @@ static struct i2c_driver lm75_driver = {
.owner = THIS_MODULE,
.name = "lm75",
.id = I2C_DRIVERID_LM75,
.flags = I2C_DF_NOTIFY,
.attach_adapter = lm75_attach_adapter,
.detach_client = lm75_detach_client,
};
......
......@@ -76,7 +76,6 @@ static struct lm77_data *lm77_update_device(struct device *dev);
static struct i2c_driver lm77_driver = {
.owner = THIS_MODULE,
.name = "lm77",
.flags = I2C_DF_NOTIFY,
.attach_adapter = lm77_attach_adapter,
.detach_client = lm77_detach_client,
};
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment