From 2e3e13f8e9d9b2111404cdccaa4e1b988b70acce Mon Sep 17 00:00:00 2001 From: "Mark M. Hoffman" Date: Sun, 6 Nov 2005 23:04:51 +0100 Subject: [PATCH] i2c: i2c-i801 explicitly enables/disables PEC This patch tweaks i2c-i801.c so that the driver always sets the SMBAUXCTL register (which enables/disables PEC) explicitly before each transaction. Signed-off-by: Mark M. Hoffman Signed-off-by: Jean Delvare Signed-off-by: Greg Kroah-Hartman --- drivers/i2c/busses/i2c-i801.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/drivers/i2c/busses/i2c-i801.c b/drivers/i2c/busses/i2c-i801.c index ac3eafa..1c752dd 100644 --- a/drivers/i2c/busses/i2c-i801.c +++ b/drivers/i2c/busses/i2c-i801.c @@ -468,8 +468,7 @@ static s32 i801_access(struct i2c_adapter * adap, u16 addr, return -1; } - if (hwpec) - outb_p(1, SMBAUXCTL); /* enable hardware PEC */ + outb_p(hwpec, SMBAUXCTL); /* enable/disable hardware PEC */ if(block) ret = i801_block_transaction(data, read_write, size, hwpec); @@ -478,9 +477,6 @@ static s32 i801_access(struct i2c_adapter * adap, u16 addr, ret = i801_transaction(); } - if (hwpec) - outb_p(0, SMBAUXCTL); /* disable hardware PEC */ - if(block) return ret; if(ret) -- cgit v1.1 From f9e8957937ebf60d22732a5ca9130f48a7603f60 Mon Sep 17 00:00:00 2001 From: Michael Burian Date: Mon, 7 Nov 2005 22:30:14 +0100 Subject: [PATCH] i2c: Extend ds1337 initialization Add code to handle case where board firmware does not start the RTC. Signed-off-by: Jean Delvare CC: James Chapman Signed-off-by: Greg Kroah-Hartman --- drivers/i2c/chips/ds1337.c | 37 +++++++++++++++++++++++++++++++------ 1 file changed, 31 insertions(+), 6 deletions(-) diff --git a/drivers/i2c/chips/ds1337.c b/drivers/i2c/chips/ds1337.c index 02682fb..1822895 100644 --- a/drivers/i2c/chips/ds1337.c +++ b/drivers/i2c/chips/ds1337.c @@ -337,13 +337,38 @@ exit: static void ds1337_init_client(struct i2c_client *client) { - s32 val; + u8 status, control; - /* Ensure that device is set in 24-hour mode */ - val = i2c_smbus_read_byte_data(client, DS1337_REG_HOUR); - if ((val >= 0) && (val & (1 << 6))) - i2c_smbus_write_byte_data(client, DS1337_REG_HOUR, - val & 0x3f); + /* On some boards, the RTC isn't configured by boot firmware. + * Handle that case by starting/configuring the RTC now. + */ + status = i2c_smbus_read_byte_data(client, DS1337_REG_STATUS); + control = i2c_smbus_read_byte_data(client, DS1337_REG_CONTROL); + + if ((status & 0x80) || (control & 0x80)) { + /* RTC not running */ + u8 buf[16]; + struct i2c_msg msg[1]; + + dev_dbg(&client->dev, "%s: RTC not running!\n", __FUNCTION__); + + /* Initialize all, including STATUS and CONTROL to zero */ + memset(buf, 0, sizeof(buf)); + msg[0].addr = client->addr; + msg[0].flags = 0; + msg[0].len = sizeof(buf); + msg[0].buf = &buf[0]; + + i2c_transfer(client->adapter, msg, 1); + } else { + /* Running: ensure that device is set in 24-hour mode */ + s32 val; + + val = i2c_smbus_read_byte_data(client, DS1337_REG_HOUR); + if ((val >= 0) && (val & (1 << 6))) + i2c_smbus_write_byte_data(client, DS1337_REG_HOUR, + val & 0x3f); + } } static int ds1337_detach_client(struct i2c_client *client) -- cgit v1.1 From 07421cabdc62519d0f747149b7c9b425b4d746cd Mon Sep 17 00:00:00 2001 From: Grant Coady Date: Sun, 6 Nov 2005 23:13:06 +0100 Subject: [PATCH] hwmon: remove deprecated sysfs names of adm1025 and adm1026 drivers, hwmon, adm1025 and adm1026: remove deprecated sysfs names. these names have been listed for removal for six months, time for them to go Signed-off-by: Grant Coady Signed-off-by: Jean Delvare Signed-off-by: Greg Kroah-Hartman --- Documentation/feature-removal-schedule.txt | 9 --------- drivers/hwmon/adm1025.c | 4 ---- drivers/hwmon/adm1026.c | 4 ---- 3 files changed, 17 deletions(-) diff --git a/Documentation/feature-removal-schedule.txt b/Documentation/feature-removal-schedule.txt index 9b74319..cb13b96 100644 --- a/Documentation/feature-removal-schedule.txt +++ b/Documentation/feature-removal-schedule.txt @@ -82,15 +82,6 @@ Who: Mauro Carvalho Chehab --------------------------- -What: i2c sysfs name change: in1_ref, vid deprecated in favour of cpu0_vid -When: November 2005 -Files: drivers/i2c/chips/adm1025.c, drivers/i2c/chips/adm1026.c -Why: Match the other drivers' name for the same function, duplicate names - will be available until removal of old names. -Who: Grant Coady - ---------------------------- - What: remove EXPORT_SYMBOL(panic_timeout) When: April 2006 Files: kernel/panic.c diff --git a/drivers/hwmon/adm1025.c b/drivers/hwmon/adm1025.c index 3ec1242..bf67860 100644 --- a/drivers/hwmon/adm1025.c +++ b/drivers/hwmon/adm1025.c @@ -287,8 +287,6 @@ static ssize_t show_vid(struct device *dev, struct device_attribute *attr, char struct adm1025_data *data = adm1025_update_device(dev); return sprintf(buf, "%u\n", vid_from_reg(data->vid, data->vrm)); } -/* in1_ref is deprecated in favour of cpu0_vid, remove after 2005-11-11 */ -static DEVICE_ATTR(in1_ref, S_IRUGO, show_vid, NULL); static DEVICE_ATTR(cpu0_vid, S_IRUGO, show_vid, NULL); static ssize_t show_vrm(struct device *dev, struct device_attribute *attr, char *buf) @@ -444,8 +442,6 @@ static int adm1025_detect(struct i2c_adapter *adapter, int address, int kind) device_create_file(&new_client->dev, &dev_attr_temp1_max); device_create_file(&new_client->dev, &dev_attr_temp2_max); device_create_file(&new_client->dev, &dev_attr_alarms); - /* in1_ref is deprecated, remove after 2005-11-11 */ - device_create_file(&new_client->dev, &dev_attr_in1_ref); device_create_file(&new_client->dev, &dev_attr_cpu0_vid); device_create_file(&new_client->dev, &dev_attr_vrm); diff --git a/drivers/hwmon/adm1026.c b/drivers/hwmon/adm1026.c index e0f5654..5036b17 100644 --- a/drivers/hwmon/adm1026.c +++ b/drivers/hwmon/adm1026.c @@ -1227,8 +1227,6 @@ static ssize_t show_vid_reg(struct device *dev, struct device_attribute *attr, c struct adm1026_data *data = adm1026_update_device(dev); return sprintf(buf,"%d\n", vid_from_reg(data->vid & 0x3f, data->vrm)); } -/* vid deprecated in favour of cpu0_vid, remove after 2005-11-11 */ -static DEVICE_ATTR(vid, S_IRUGO, show_vid_reg, NULL); static DEVICE_ATTR(cpu0_vid, S_IRUGO, show_vid_reg, NULL); static ssize_t show_vrm_reg(struct device *dev, struct device_attribute *attr, char *buf) @@ -1673,8 +1671,6 @@ static int adm1026_detect(struct i2c_adapter *adapter, int address, device_create_file(&new_client->dev, &dev_attr_temp1_crit_enable); device_create_file(&new_client->dev, &dev_attr_temp2_crit_enable); device_create_file(&new_client->dev, &dev_attr_temp3_crit_enable); - /* vid deprecated in favour of cpu0_vid, remove after 2005-11-11 */ - device_create_file(&new_client->dev, &dev_attr_vid); device_create_file(&new_client->dev, &dev_attr_cpu0_vid); device_create_file(&new_client->dev, &dev_attr_vrm); device_create_file(&new_client->dev, &dev_attr_alarms); -- cgit v1.1 From 9c516ef496c857aa4b1b41dc313010f11d39c496 Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Sat, 26 Nov 2005 20:07:54 +0100 Subject: [PATCH] hwmon: Support the VRM 10 mode of the ADT7463 Support the VRM 10 mode of the ADT7463. Signed-off-by: Jean Delvare Signed-off-by: Greg Kroah-Hartman --- drivers/hwmon/lm85.c | 44 ++++++++++++++++++++++++++++++++++++-------- 1 file changed, 36 insertions(+), 8 deletions(-) diff --git a/drivers/hwmon/lm85.c b/drivers/hwmon/lm85.c index d1070ed..3f5544a 100644 --- a/drivers/hwmon/lm85.c +++ b/drivers/hwmon/lm85.c @@ -443,7 +443,17 @@ show_fan_offset(4); static ssize_t show_vid_reg(struct device *dev, struct device_attribute *attr, char *buf) { struct lm85_data *data = lm85_update_device(dev); - return sprintf(buf, "%ld\n", (long) vid_from_reg(data->vid, data->vrm)); + int vid; + + if (data->type == adt7463 && (data->vid & 0x80)) { + /* 6-pin VID (VRM 10) */ + vid = vid_from_reg(data->vid & 0x3f, data->vrm); + } else { + /* 5-pin VID (VRM 9) */ + vid = vid_from_reg(data->vid & 0x1f, data->vrm); + } + + return sprintf(buf, "%d\n", vid); } static DEVICE_ATTR(cpu0_vid, S_IRUGO, show_vid_reg, NULL); @@ -1176,17 +1186,14 @@ static int lm85_detect(struct i2c_adapter *adapter, int address, device_create_file(&new_client->dev, &dev_attr_in1_input); device_create_file(&new_client->dev, &dev_attr_in2_input); device_create_file(&new_client->dev, &dev_attr_in3_input); - device_create_file(&new_client->dev, &dev_attr_in4_input); device_create_file(&new_client->dev, &dev_attr_in0_min); device_create_file(&new_client->dev, &dev_attr_in1_min); device_create_file(&new_client->dev, &dev_attr_in2_min); device_create_file(&new_client->dev, &dev_attr_in3_min); - device_create_file(&new_client->dev, &dev_attr_in4_min); device_create_file(&new_client->dev, &dev_attr_in0_max); device_create_file(&new_client->dev, &dev_attr_in1_max); device_create_file(&new_client->dev, &dev_attr_in2_max); device_create_file(&new_client->dev, &dev_attr_in3_max); - device_create_file(&new_client->dev, &dev_attr_in4_max); device_create_file(&new_client->dev, &dev_attr_temp1_input); device_create_file(&new_client->dev, &dev_attr_temp2_input); device_create_file(&new_client->dev, &dev_attr_temp3_input); @@ -1224,6 +1231,15 @@ static int lm85_detect(struct i2c_adapter *adapter, int address, device_create_file(&new_client->dev, &dev_attr_temp2_auto_temp_crit); device_create_file(&new_client->dev, &dev_attr_temp3_auto_temp_crit); + /* The ADT7463 has an optional VRM 10 mode where pin 21 is used + as a sixth digital VID input rather than an analog input. */ + data->vid = lm85_read_value(new_client, LM85_REG_VID); + if (!(kind == adt7463 && (data->vid & 0x80))) { + device_create_file(&new_client->dev, &dev_attr_in4_input); + device_create_file(&new_client->dev, &dev_attr_in4_min); + device_create_file(&new_client->dev, &dev_attr_in4_max); + } + return 0; /* Error out and cleanup code */ @@ -1382,11 +1398,18 @@ static struct lm85_data *lm85_update_device(struct device *dev) irrelevant. So it is left in 4*/ data->adc_scale = (data->type == emc6d102 ) ? 16 : 4; - for (i = 0; i <= 4; ++i) { + data->vid = lm85_read_value(client, LM85_REG_VID); + + for (i = 0; i <= 3; ++i) { data->in[i] = lm85_read_value(client, LM85_REG_IN(i)); } + if (!(data->type == adt7463 && (data->vid & 0x80))) { + data->in[4] = lm85_read_value(client, + LM85_REG_IN(4)); + } + for (i = 0; i <= 3; ++i) { data->fan[i] = lm85_read_value(client, LM85_REG_FAN(i)); @@ -1450,13 +1473,20 @@ static struct lm85_data *lm85_update_device(struct device *dev) /* Things that don't change often */ dev_dbg(&client->dev, "Reading config values\n"); - for (i = 0; i <= 4; ++i) { + for (i = 0; i <= 3; ++i) { data->in_min[i] = lm85_read_value(client, LM85_REG_IN_MIN(i)); data->in_max[i] = lm85_read_value(client, LM85_REG_IN_MAX(i)); } + if (!(data->type == adt7463 && (data->vid & 0x80))) { + data->in_min[4] = lm85_read_value(client, + LM85_REG_IN_MIN(4)); + data->in_max[4] = lm85_read_value(client, + LM85_REG_IN_MAX(4)); + } + if ( data->type == emc6d100 ) { for (i = 5; i <= 7; ++i) { data->in_min[i] = @@ -1478,8 +1508,6 @@ static struct lm85_data *lm85_update_device(struct device *dev) lm85_read_value(client, LM85_REG_TEMP_MAX(i)); } - data->vid = lm85_read_value(client, LM85_REG_VID); - for (i = 0; i <= 2; ++i) { int val ; data->autofan[i].config = -- cgit v1.1 From dd149c52223cfb05cdefb0755d3c2793e8d33ede Mon Sep 17 00:00:00 2001 From: Yuan Mu Date: Sat, 26 Nov 2005 20:13:18 +0100 Subject: [PATCH] hwmon: W83627THF VID fixes This patch fixes the VID reading; no cpu0_vid and vrm files created if the chip is w83627thf and GPIO5 not enabled. Signed-off-by: Yuan Mu Signed-off-by: Jean Delvare Signed-off-by: Greg Kroah-Hartman --- drivers/hwmon/w83627hf.c | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/drivers/hwmon/w83627hf.c b/drivers/hwmon/w83627hf.c index bbb3dcd..27cfde1 100644 --- a/drivers/hwmon/w83627hf.c +++ b/drivers/hwmon/w83627hf.c @@ -1122,11 +1122,10 @@ static int w83627hf_detect(struct i2c_adapter *adapter) if (kind != w83697hf) device_create_file_temp(new_client, 3); - if (kind != w83697hf) + if (kind != w83697hf && data->vid != 0xff) { device_create_file_vid(new_client); - - if (kind != w83697hf) device_create_file_vrm(new_client); + } device_create_file_fan_div(new_client, 1); device_create_file_fan_div(new_client, 2); @@ -1232,7 +1231,7 @@ static int w83627thf_read_gpio5(struct i2c_client *client) /* Make sure the pins are configured for input There must be at least five (VRM 9), and possibly 6 (VRM 10) */ - sel = superio_inb(W83627THF_GPIO5_IOSR); + sel = superio_inb(W83627THF_GPIO5_IOSR) & 0x3f; if ((sel & 0x1f) != 0x1f) { dev_dbg(&client->dev, "GPIO5 not configured for VID " "function\n"); @@ -1323,19 +1322,18 @@ static void w83627hf_init_client(struct i2c_client *client) int hi = w83627hf_read_value(client, W83781D_REG_CHIPID); data->vid = (lo & 0x0f) | ((hi & 0x01) << 4); } else if (w83627thf == data->type) { - data->vid = w83627thf_read_gpio5(client) & 0x3f; + data->vid = w83627thf_read_gpio5(client); } /* Read VRM & OVT Config only once */ if (w83627thf == data->type || w83637hf == data->type) { data->vrm_ovt = w83627hf_read_value(client, W83627THF_REG_VRM_OVT_CFG); - data->vrm = (data->vrm_ovt & 0x01) ? 90 : 82; - } else { - /* Convert VID to voltage based on default VRM */ - data->vrm = vid_which_vrm(); } + /* Convert VID to voltage based on VRM */ + data->vrm = vid_which_vrm(); + tmp = w83627hf_read_value(client, W83781D_REG_SCFG1); for (i = 1; i <= 3; i++) { if (!(tmp & BIT_SCFG1[i - 1])) { -- cgit v1.1 From 5b319400f5e2cd31a82b38405856ff2b46a9bb83 Mon Sep 17 00:00:00 2001 From: "Mark M. Hoffman" Date: Sat, 26 Nov 2005 20:10:56 +0100 Subject: [PATCH] hwmon: Clarify the W83627THF VID documentation This patch clarifies the W83627THF VID documentation. Signed-off-by: Mark M. Hoffman Signed-off-by: Jean Delvare Signed-off-by: Greg Kroah-Hartman --- Documentation/hwmon/w83627hf | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/Documentation/hwmon/w83627hf b/Documentation/hwmon/w83627hf index 78f37c2..5d23776 100644 --- a/Documentation/hwmon/w83627hf +++ b/Documentation/hwmon/w83627hf @@ -54,13 +54,16 @@ If you really want i2c accesses for these Super I/O chips, use the w83781d driver. However this is not the preferred method now that this ISA driver has been developed. -Technically, the w83627thf does not support a VID reading. However, it's -possible or even likely that your mainboard maker has routed these signals -to a specific set of general purpose IO pins (the Asus P4C800-E is one such -board). The w83627thf driver now interprets these as VID. If the VID on -your board doesn't work, first see doc/vid in the lm_sensors package. If -that still doesn't help, email us at lm-sensors@lm-sensors.org. +The w83627_HF_ uses pins 110-106 as VID0-VID4. The w83627_THF_ uses the +same pins as GPIO[0:4]. Technically, the w83627_THF_ does not support a +VID reading. However the two chips have the identical 128 pin package. So, +it is possible or even likely for a w83627thf to have the VID signals routed +to these pins despite their not being labeled for that purpose. Therefore, +the w83627thf driver interprets these as VID. If the VID on your board +doesn't work, first see doc/vid in the lm_sensors package[1]. If that still +doesn't help, you may just ignore the bogus VID reading with no harm done. -For further information on this driver see the w83781d driver -documentation. +For further information on this driver see the w83781d driver documentation. + +[1] http://www2.lm-sensors.nu/~lm78/cvs/browse.cgi/lm_sensors2/doc/vid -- cgit v1.1 From 7e94436942a7517d08c0cd1a8831122a0fea289e Mon Sep 17 00:00:00 2001 From: Nicolas Kaiser Date: Sat, 26 Nov 2005 20:15:23 +0100 Subject: [PATCH] i2c: Remove duplicate rtc8564 BCD macros Remove duplicate of BCD macros. Signed-off-by: Nicolas Kaiser Signed-off-by: Jean Delvare Signed-off-by: Greg Kroah-Hartman --- drivers/i2c/chips/rtc8564.c | 36 +++++++++++++++++------------------- 1 file changed, 17 insertions(+), 19 deletions(-) diff --git a/drivers/i2c/chips/rtc8564.c b/drivers/i2c/chips/rtc8564.c index 916cdc1..26e498d 100644 --- a/drivers/i2c/chips/rtc8564.c +++ b/drivers/i2c/chips/rtc8564.c @@ -14,6 +14,7 @@ */ #include #include +#include #include #include #include @@ -52,9 +53,6 @@ static inline u8 _rtc8564_ctrl2(struct i2c_client *client) #define CTRL1(c) _rtc8564_ctrl1(c) #define CTRL2(c) _rtc8564_ctrl2(c) -#define BCD_TO_BIN(val) (((val)&15) + ((val)>>4)*10) -#define BIN_TO_BCD(val) ((((val)/10)<<4) + (val)%10) - static int debug;; module_param(debug, int, S_IRUGO | S_IWUSR); @@ -224,16 +222,16 @@ static int rtc8564_get_datetime(struct i2c_client *client, struct rtc_tm *dt) return ret; /* century stored in minute alarm reg */ - dt->year = BCD_TO_BIN(buf[RTC8564_REG_YEAR]); - dt->year += 100 * BCD_TO_BIN(buf[RTC8564_REG_AL_MIN] & 0x3f); - dt->mday = BCD_TO_BIN(buf[RTC8564_REG_DAY] & 0x3f); - dt->wday = BCD_TO_BIN(buf[RTC8564_REG_WDAY] & 7); - dt->mon = BCD_TO_BIN(buf[RTC8564_REG_MON_CENT] & 0x1f); + dt->year = BCD2BIN(buf[RTC8564_REG_YEAR]); + dt->year += 100 * BCD2BIN(buf[RTC8564_REG_AL_MIN] & 0x3f); + dt->mday = BCD2BIN(buf[RTC8564_REG_DAY] & 0x3f); + dt->wday = BCD2BIN(buf[RTC8564_REG_WDAY] & 7); + dt->mon = BCD2BIN(buf[RTC8564_REG_MON_CENT] & 0x1f); - dt->secs = BCD_TO_BIN(buf[RTC8564_REG_SEC] & 0x7f); + dt->secs = BCD2BIN(buf[RTC8564_REG_SEC] & 0x7f); dt->vl = (buf[RTC8564_REG_SEC] & 0x80) == 0x80; - dt->mins = BCD_TO_BIN(buf[RTC8564_REG_MIN] & 0x7f); - dt->hours = BCD_TO_BIN(buf[RTC8564_REG_HR] & 0x3f); + dt->mins = BCD2BIN(buf[RTC8564_REG_MIN] & 0x7f); + dt->hours = BCD2BIN(buf[RTC8564_REG_HR] & 0x3f); _DBGRTCTM(2, *dt); @@ -255,18 +253,18 @@ rtc8564_set_datetime(struct i2c_client *client, struct rtc_tm *dt, int datetoo) buf[RTC8564_REG_CTRL1] = CTRL1(client) | RTC8564_CTRL1_STOP; buf[RTC8564_REG_CTRL2] = CTRL2(client); - buf[RTC8564_REG_SEC] = BIN_TO_BCD(dt->secs); - buf[RTC8564_REG_MIN] = BIN_TO_BCD(dt->mins); - buf[RTC8564_REG_HR] = BIN_TO_BCD(dt->hours); + buf[RTC8564_REG_SEC] = BIN2BCD(dt->secs); + buf[RTC8564_REG_MIN] = BIN2BCD(dt->mins); + buf[RTC8564_REG_HR] = BIN2BCD(dt->hours); if (datetoo) { len += 5; - buf[RTC8564_REG_DAY] = BIN_TO_BCD(dt->mday); - buf[RTC8564_REG_WDAY] = BIN_TO_BCD(dt->wday); - buf[RTC8564_REG_MON_CENT] = BIN_TO_BCD(dt->mon) & 0x1f; + buf[RTC8564_REG_DAY] = BIN2BCD(dt->mday); + buf[RTC8564_REG_WDAY] = BIN2BCD(dt->wday); + buf[RTC8564_REG_MON_CENT] = BIN2BCD(dt->mon) & 0x1f; /* century stored in minute alarm reg */ - buf[RTC8564_REG_YEAR] = BIN_TO_BCD(dt->year % 100); - buf[RTC8564_REG_AL_MIN] = BIN_TO_BCD(dt->year / 100); + buf[RTC8564_REG_YEAR] = BIN2BCD(dt->year % 100); + buf[RTC8564_REG_AL_MIN] = BIN2BCD(dt->year / 100); } ret = rtc8564_write(client, 0, buf, len); -- cgit v1.1 From 1d26f455eb0db0bf4d4b7177547f4310b645a32a Mon Sep 17 00:00:00 2001 From: Peter Korsgaard Date: Sat, 26 Nov 2005 20:18:43 +0100 Subject: [PATCH] i2c: Add support for Barco LPT->DVI to i2c-parport The following patch adds support for the Barco LPT->DVI I2C adapter to the i2c-parport driver. Signed-off-by: Peter Korsgaard Signed-off-by: Jean Delvare Signed-off-by: Greg Kroah-Hartman --- Documentation/i2c/busses/i2c-parport | 1 + drivers/i2c/busses/i2c-parport.h | 12 +++++++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/Documentation/i2c/busses/i2c-parport b/Documentation/i2c/busses/i2c-parport index 9f1d008..d9f23c0 100644 --- a/Documentation/i2c/busses/i2c-parport +++ b/Documentation/i2c/busses/i2c-parport @@ -17,6 +17,7 @@ It currently supports the following devices: * Velleman K8000 adapter * ELV adapter * Analog Devices evaluation boards (ADM1025, ADM1030, ADM1031, ADM1032) + * Barco LPT->DVI (K5800236) adapter These devices use different pinout configurations, so you have to tell the driver what you have, using the type module parameter. There is no diff --git a/drivers/i2c/busses/i2c-parport.h b/drivers/i2c/busses/i2c-parport.h index f63a537..d702e5e 100644 --- a/drivers/i2c/busses/i2c-parport.h +++ b/drivers/i2c/busses/i2c-parport.h @@ -80,6 +80,14 @@ static struct adapter_parm adapter_parm[] = { .setscl = { 0x01, DATA, 1 }, .getsda = { 0x10, STAT, 1 }, }, + /* type 6: Barco LPT->DVI (K5800236) adapter */ + { + .setsda = { 0x02, DATA, 1 }, + .setscl = { 0x01, DATA, 1 }, + .getsda = { 0x20, STAT, 0 }, + .getscl = { 0x40, STAT, 0 }, + .init = { 0xfc, DATA, 0 }, + }, }; static int type; @@ -91,4 +99,6 @@ MODULE_PARM_DESC(type, " 2 = Velleman K8000 adapter\n" " 3 = ELV adapter\n" " 4 = ADM1032 evaluation board\n" - " 5 = ADM1025, ADM1030 and ADM1031 evaluation boards\n"); + " 5 = ADM1025, ADM1030 and ADM1031 evaluation boards\n" + " 6 = Barco LPT->DVI (K5800236) adapter\n" +); -- cgit v1.1 From 1de9e371b89e1cf4da123f0d92efa8eb134ca5e8 Mon Sep 17 00:00:00 2001 From: Roger Lucas Date: Sat, 26 Nov 2005 20:20:05 +0100 Subject: [PATCH] hwmon: New vt8231 driver Port the vt8231 hardware monitoring driver from lm_sensors CVS to Linux 2.6. Signed-off-by: Roger Lucas Signed-off-by: Jean Delvare Signed-off-by: Greg Kroah-Hartman --- MAINTAINERS | 6 + drivers/hwmon/Kconfig | 12 + drivers/hwmon/Makefile | 1 + drivers/hwmon/vt8231.c | 861 +++++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 880 insertions(+) create mode 100644 drivers/hwmon/vt8231.c diff --git a/MAINTAINERS b/MAINTAINERS index 6246b7f..16f3782 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -2902,6 +2902,12 @@ W: http://linuxtv.org T: git kernel.org:/pub/scm/linux/kernel/git/mchehab/v4l-dvb.git S: Maintained +VT8231 HARDWARE MONITOR DRIVER +P: Roger Lucas +M: roger@planbit.co.uk +L: lm-sensors@lm-sensors.org +S: Maintained + W1 DALLAS'S 1-WIRE BUS P: Evgeniy Polyakov M: johnpol@2ka.mipt.ru diff --git a/drivers/hwmon/Kconfig b/drivers/hwmon/Kconfig index db358cf..c582959 100644 --- a/drivers/hwmon/Kconfig +++ b/drivers/hwmon/Kconfig @@ -350,6 +350,18 @@ config SENSORS_VIA686A This driver can also be built as a module. If so, the module will be called via686a. +config SENSORS_VT8231 + tristate "VT8231" + depends on HWMON && I2C && PCI && EXPERIMENTAL + select HWMON_VID + select I2C_ISA + help + If you say yes here then you get support for the integrated sensors + in the VIA VT8231 device. + + This driver can also be built as a module. If so, the module + will be called vt8231. + config SENSORS_W83781D tristate "Winbond W83781D, W83782D, W83783S, W83627HF, Asus AS99127F" depends on HWMON && I2C diff --git a/drivers/hwmon/Makefile b/drivers/hwmon/Makefile index f7d6a2f..06d4a1d 100644 --- a/drivers/hwmon/Makefile +++ b/drivers/hwmon/Makefile @@ -40,6 +40,7 @@ obj-$(CONFIG_SENSORS_SIS5595) += sis5595.o obj-$(CONFIG_SENSORS_SMSC47B397)+= smsc47b397.o obj-$(CONFIG_SENSORS_SMSC47M1) += smsc47m1.o obj-$(CONFIG_SENSORS_VIA686A) += via686a.o +obj-$(CONFIG_SENSORS_VT8231) += vt8231.o obj-$(CONFIG_SENSORS_W83627EHF) += w83627ehf.o obj-$(CONFIG_SENSORS_W83L785TS) += w83l785ts.o diff --git a/drivers/hwmon/vt8231.c b/drivers/hwmon/vt8231.c new file mode 100644 index 0000000..c8556a72 --- /dev/null +++ b/drivers/hwmon/vt8231.c @@ -0,0 +1,861 @@ +/* + vt8231.c - Part of lm_sensors, Linux kernel modules + for hardware monitoring + + Copyright (c) 2005 Roger Lucas + Copyright (c) 2002 Mark D. Studebaker + Aaron M. Marsh + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +/* Supports VIA VT8231 South Bridge embedded sensors +*/ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +static int force_addr; +module_param(force_addr, int, 0); +MODULE_PARM_DESC(force_addr, "Initialize the base address of the sensors"); + +/* Device address + Note that we can't determine the ISA address until we have initialized + our module */ +static unsigned short isa_address; + +#define VT8231_EXTENT 0x80 +#define VT8231_BASE_REG 0x70 +#define VT8231_ENABLE_REG 0x74 + +/* The VT8231 registers + + The reset value for the input channel configuration is used (Reg 0x4A=0x07) + which sets the selected inputs marked with '*' below if multiple options are + possible: + + Voltage Mode Temperature Mode + Sensor Linux Id Linux Id VIA Id + -------- -------- -------- ------ + CPU Diode N/A temp1 0 + UIC1 in0 temp2 * 1 + UIC2 in1 * temp3 2 + UIC3 in2 * temp4 3 + UIC4 in3 * temp5 4 + UIC5 in4 * temp6 5 + 3.3V in5 N/A + + Note that the BIOS may set the configuration register to a different value + to match the motherboard configuration. +*/ + +/* fans numbered 0-1 */ +#define VT8231_REG_FAN_MIN(nr) (0x3b + (nr)) +#define VT8231_REG_FAN(nr) (0x29 + (nr)) + +/* Voltage inputs numbered 0-5 */ + +static const u8 regvolt[] = { 0x21, 0x22, 0x23, 0x24, 0x25, 0x26 }; +static const u8 regvoltmax[] = { 0x3d, 0x2b, 0x2d, 0x2f, 0x31, 0x33 }; +static const u8 regvoltmin[] = { 0x3e, 0x2c, 0x2e, 0x30, 0x32, 0x34 }; + +/* Temperatures are numbered 1-6 according to the Linux kernel specification. +** +** In the VIA datasheet, however, the temperatures are numbered from zero. +** Since it is important that this driver can easily be compared to the VIA +** datasheet, we will use the VIA numbering within this driver and map the +** kernel sysfs device name to the VIA number in the sysfs callback. +*/ + +#define VT8231_REG_TEMP_LOW01 0x49 +#define VT8231_REG_TEMP_LOW25 0x4d + +static const u8 regtemp[] = { 0x1f, 0x21, 0x22, 0x23, 0x24, 0x25 }; +static const u8 regtempmax[] = { 0x39, 0x3d, 0x2b, 0x2d, 0x2f, 0x31 }; +static const u8 regtempmin[] = { 0x3a, 0x3e, 0x2c, 0x2e, 0x30, 0x32 }; + +#define TEMP_FROM_REG(reg) (((253 * 4 - (reg)) * 550 + 105) / 210) +#define TEMP_MAXMIN_FROM_REG(reg) (((253 - (reg)) * 2200 + 105) / 210) +#define TEMP_MAXMIN_TO_REG(val) (253 - ((val) * 210 + 1100) / 2200) + +#define VT8231_REG_CONFIG 0x40 +#define VT8231_REG_ALARM1 0x41 +#define VT8231_REG_ALARM2 0x42 +#define VT8231_REG_FANDIV 0x47 +#define VT8231_REG_UCH_CONFIG 0x4a +#define VT8231_REG_TEMP1_CONFIG 0x4b +#define VT8231_REG_TEMP2_CONFIG 0x4c + +/* temps 0-5 as numbered in VIA datasheet - see later for mapping to Linux +** numbering +*/ +#define ISTEMP(i, ch_config) ((i) == 0 ? 1 : \ + ((ch_config) >> ((i)+1)) & 0x01) +/* voltages 0-5 */ +#define ISVOLT(i, ch_config) ((i) == 5 ? 1 : \ + !(((ch_config) >> ((i)+2)) & 0x01)) + +#define DIV_FROM_REG(val) (1 << (val)) + +/* NB The values returned here are NOT temperatures. The calibration curves +** for the thermistor curves are board-specific and must go in the +** sensors.conf file. Temperature sensors are actually ten bits, but the +** VIA datasheet only considers the 8 MSBs obtained from the regtemp[] +** register. The temperature value returned should have a magnitude of 3, +** so we use the VIA scaling as the "true" scaling and use the remaining 2 +** LSBs as fractional precision. +** +** All the on-chip hardware temperature comparisons for the alarms are only +** 8-bits wide, and compare against the 8 MSBs of the temperature. The bits +** in the registers VT8231_REG_TEMP_LOW01 and VT8231_REG_TEMP_LOW25 are +** ignored. +*/ + +/******** FAN RPM CONVERSIONS ******** +** This chip saturates back at 0, not at 255 like many the other chips. +** So, 0 means 0 RPM +*/ +static inline u8 FAN_TO_REG(long rpm, int div) +{ + if (rpm == 0) + return 0; + return SENSORS_LIMIT(1310720 / (rpm * div), 1, 255); +} + +#define FAN_FROM_REG(val, div) ((val) == 0 ? 0 : 1310720 / ((val) * (div))) + +struct vt8231_data { + struct i2c_client client; + struct semaphore update_lock; + struct class_device *class_dev; + char valid; /* !=0 if following fields are valid */ + unsigned long last_updated; /* In jiffies */ + + u8 in[6]; /* Register value */ + u8 in_max[6]; /* Register value */ + u8 in_min[6]; /* Register value */ + u16 temp[6]; /* Register value 10 bit, right aligned */ + u8 temp_max[6]; /* Register value */ + u8 temp_min[6]; /* Register value */ + u8 fan[2]; /* Register value */ + u8 fan_min[2]; /* Register value */ + u8 fan_div[2]; /* Register encoding, shifted right */ + u16 alarms; /* Register encoding */ + u8 uch_config; +}; + +static struct pci_dev *s_bridge; +static int vt8231_detect(struct i2c_adapter *adapter); +static int vt8231_detach_client(struct i2c_client *client); +static struct vt8231_data *vt8231_update_device(struct device *dev); +static void vt8231_init_client(struct i2c_client *client); + +static inline int vt8231_read_value(struct i2c_client *client, u8 reg) +{ + return inb_p(client->addr + reg); +} + +static inline void vt8231_write_value(struct i2c_client *client, u8 reg, + u8 value) +{ + outb_p(value, client->addr + reg); +} + +/* following are the sysfs callback functions */ +static ssize_t show_in(struct device *dev, struct device_attribute *attr, + char *buf) +{ + struct sensor_device_attribute *sensor_attr = to_sensor_dev_attr(attr); + int nr = sensor_attr->index; + struct vt8231_data *data = vt8231_update_device(dev); + + return sprintf(buf, "%d\n", ((data->in[nr] - 3) * 10000) / 958); +} + +static ssize_t show_in_min(struct device *dev, struct device_attribute *attr, + char *buf) +{ + struct sensor_device_attribute *sensor_attr = to_sensor_dev_attr(attr); + int nr = sensor_attr->index; + struct vt8231_data *data = vt8231_update_device(dev); + + return sprintf(buf, "%d\n", ((data->in_min[nr] - 3) * 10000) / 958); +} + +static ssize_t show_in_max(struct device *dev, struct device_attribute *attr, + char *buf) +{ + struct sensor_device_attribute *sensor_attr = to_sensor_dev_attr(attr); + int nr = sensor_attr->index; + struct vt8231_data *data = vt8231_update_device(dev); + + return sprintf(buf, "%d\n", (((data->in_max[nr] - 3) * 10000) / 958)); +} + +static ssize_t set_in_min(struct device *dev, struct device_attribute *attr, + const char *buf, size_t count) +{ + struct sensor_device_attribute *sensor_attr = to_sensor_dev_attr(attr); + int nr = sensor_attr->index; + struct i2c_client *client = to_i2c_client(dev); + struct vt8231_data *data = i2c_get_clientdata(client); + unsigned long val = simple_strtoul(buf, NULL, 10); + + down(&data->update_lock); + data->in_min[nr] = SENSORS_LIMIT(((val * 958) / 10000) + 3, 0, 255); + vt8231_write_value(client, regvoltmin[nr], data->in_min[nr]); + up(&data->update_lock); + return count; +} + +static ssize_t set_in_max(struct device *dev, struct device_attribute *attr, + const char *buf, size_t count) +{ + struct sensor_device_attribute *sensor_attr = to_sensor_dev_attr(attr); + int nr = sensor_attr->index; + struct i2c_client *client = to_i2c_client(dev); + struct vt8231_data *data = i2c_get_clientdata(client); + unsigned long val = simple_strtoul(buf, NULL, 10); + + down(&data->update_lock); + data->in_max[nr] = SENSORS_LIMIT(((val * 958) / 10000) + 3, 0, 255); + vt8231_write_value(client, regvoltmax[nr], data->in_max[nr]); + up(&data->update_lock); + return count; +} + +/* Special case for input 5 as this has 3.3V scaling built into the chip */ +static ssize_t show_in5(struct device *dev, struct device_attribute *attr, + char *buf) +{ + struct vt8231_data *data = vt8231_update_device(dev); + + return sprintf(buf, "%d\n", + (((data->in[5] - 3) * 10000 * 54) / (958 * 34))); +} + +static ssize_t show_in5_min(struct device *dev, struct device_attribute *attr, + char *buf) +{ + struct vt8231_data *data = vt8231_update_device(dev); + + return sprintf(buf, "%d\n", + (((data->in_min[5] - 3) * 10000 * 54) / (958 * 34))); +} + +static ssize_t show_in5_max(struct device *dev, struct device_attribute *attr, + char *buf) +{ + struct vt8231_data *data = vt8231_update_device(dev); + + return sprintf(buf, "%d\n", + (((data->in_max[5] - 3) * 10000 * 54) / (958 * 34))); +} + +static ssize_t set_in5_min(struct device *dev, struct device_attribute *attr, + const char *buf, size_t count) +{ + struct i2c_client *client = to_i2c_client(dev); + struct vt8231_data *data = i2c_get_clientdata(client); + unsigned long val = simple_strtoul(buf, NULL, 10); + + down(&data->update_lock); + data->in_min[5] = SENSORS_LIMIT(((val * 958 * 34) / (10000 * 54)) + 3, + 0, 255); + vt8231_write_value(client, regvoltmin[5], data->in_min[5]); + up(&data->update_lock); + return count; +} + +static ssize_t set_in5_max(struct device *dev, struct device_attribute *attr, + const char *buf, size_t count) +{ + struct i2c_client *client = to_i2c_client(dev); + struct vt8231_data *data = i2c_get_clientdata(client); + unsigned long val = simple_strtoul(buf, NULL, 10); + + down(&data->update_lock); + data->in_max[5] = SENSORS_LIMIT(((val * 958 * 34) / (10000 * 54)) + 3, + 0, 255); + vt8231_write_value(client, regvoltmax[5], data->in_max[5]); + up(&data->update_lock); + return count; +} + +#define define_voltage_sysfs(offset) \ +static SENSOR_DEVICE_ATTR(in##offset##_input, S_IRUGO, \ + show_in, NULL, offset); \ +static SENSOR_DEVICE_ATTR(in##offset##_min, S_IRUGO | S_IWUSR, \ + show_in_min, set_in_min, offset); \ +static SENSOR_DEVICE_ATTR(in##offset##_max, S_IRUGO | S_IWUSR, \ + show_in_max, set_in_max, offset) + +define_voltage_sysfs(0); +define_voltage_sysfs(1); +define_voltage_sysfs(2); +define_voltage_sysfs(3); +define_voltage_sysfs(4); + +static DEVICE_ATTR(in5_input, S_IRUGO, show_in5, NULL); +static DEVICE_ATTR(in5_min, S_IRUGO | S_IWUSR, show_in5_min, set_in5_min); +static DEVICE_ATTR(in5_max, S_IRUGO | S_IWUSR, show_in5_max, set_in5_max); + +/* Temperatures */ +static ssize_t show_temp0(struct device *dev, struct device_attribute *attr, + char *buf) +{ + struct vt8231_data *data = vt8231_update_device(dev); + return sprintf(buf, "%d\n", data->temp[0] * 250); +} + +static ssize_t show_temp0_max(struct device *dev, struct device_attribute *attr, + char *buf) +{ + struct vt8231_data *data = vt8231_update_device(dev); + return sprintf(buf, "%d\n", data->temp_max[0] * 1000); +} + +static ssize_t show_temp0_min(struct device *dev, struct device_attribute *attr, + char *buf) +{ + struct vt8231_data *data = vt8231_update_device(dev); + return sprintf(buf, "%d\n", data->temp_min[0] * 1000); +} + +static ssize_t set_temp0_max(struct device *dev, struct device_attribute *attr, + const char *buf, size_t count) +{ + struct i2c_client *client = to_i2c_client(dev); + struct vt8231_data *data = i2c_get_clientdata(client); + int val = simple_strtol(buf, NULL, 10); + + down(&data->update_lock); + data->temp_max[0] = SENSORS_LIMIT((val + 500) / 1000, 0, 255); + vt8231_write_value(client, regtempmax[0], data->temp_max[0]); + up(&data->update_lock); + return count; +} +static ssize_t set_temp0_min(struct device *dev, struct device_attribute *attr, + const char *buf, size_t count) +{ + struct i2c_client *client = to_i2c_client(dev); + struct vt8231_data *data = i2c_get_clientdata(client); + int val = simple_strtol(buf, NULL, 10); + + down(&data->update_lock); + data->temp_min[0] = SENSORS_LIMIT((val + 500) / 1000, 0, 255); + vt8231_write_value(client, regtempmin[0], data->temp_min[0]); + up(&data->update_lock); + return count; +} + +static ssize_t show_temp(struct device *dev, struct device_attribute *attr, + char *buf) +{ + struct sensor_device_attribute *sensor_attr = to_sensor_dev_attr(attr); + int nr = sensor_attr->index; + struct vt8231_data *data = vt8231_update_device(dev); + return sprintf(buf, "%d\n", TEMP_FROM_REG(data->temp[nr])); +} + +static ssize_t show_temp_max(struct device *dev, struct device_attribute *attr, + char *buf) +{ + struct sensor_device_attribute *sensor_attr = to_sensor_dev_attr(attr); + int nr = sensor_attr->index; + struct vt8231_data *data = vt8231_update_device(dev); + return sprintf(buf, "%d\n", TEMP_MAXMIN_FROM_REG(data->temp_max[nr])); +} + +static ssize_t show_temp_min(struct device *dev, struct device_attribute *attr, + char *buf) +{ + struct sensor_device_attribute *sensor_attr = to_sensor_dev_attr(attr); + int nr = sensor_attr->index; + struct vt8231_data *data = vt8231_update_device(dev); + return sprintf(buf, "%d\n", TEMP_MAXMIN_FROM_REG(data->temp_min[nr])); +} + +static ssize_t set_temp_max(struct device *dev, struct device_attribute *attr, + const char *buf, size_t count) +{ + struct sensor_device_attribute *sensor_attr = to_sensor_dev_attr(attr); + int nr = sensor_attr->index; + struct i2c_client *client = to_i2c_client(dev); + struct vt8231_data *data = i2c_get_clientdata(client); + int val = simple_strtol(buf, NULL, 10); + + down(&data->update_lock); + data->temp_max[nr] = SENSORS_LIMIT(TEMP_MAXMIN_TO_REG(val), 0, 255); + vt8231_write_value(client, regtempmax[nr], data->temp_max[nr]); + up(&data->update_lock); + return count; +} +static ssize_t set_temp_min(struct device *dev, struct device_attribute *attr, + const char *buf, size_t count) +{ + struct sensor_device_attribute *sensor_attr = to_sensor_dev_attr(attr); + int nr = sensor_attr->index; + struct i2c_client *client = to_i2c_client(dev); + struct vt8231_data *data = i2c_get_clientdata(client); + int val = simple_strtol(buf, NULL, 10); + + down(&data->update_lock); + data->temp_min[nr] = SENSORS_LIMIT(TEMP_MAXMIN_TO_REG(val), 0, 255); + vt8231_write_value(client, regtempmin[nr], data->temp_min[nr]); + up(&data->update_lock); + return count; +} + +/* Note that these map the Linux temperature sensor numbering (1-6) to the VIA +** temperature sensor numbering (0-5) +*/ +#define define_temperature_sysfs(offset) \ +static SENSOR_DEVICE_ATTR(temp##offset##_input, S_IRUGO, \ + show_temp, NULL, offset - 1); \ +static SENSOR_DEVICE_ATTR(temp##offset##_max, S_IRUGO | S_IWUSR, \ + show_temp_max, set_temp_max, offset - 1); \ +static SENSOR_DEVICE_ATTR(temp##offset##_min, S_IRUGO | S_IWUSR, \ + show_temp_min, set_temp_min, offset - 1) + +static DEVICE_ATTR(temp1_input, S_IRUGO, show_temp0, NULL); +static DEVICE_ATTR(temp1_max, S_IRUGO | S_IWUSR, show_temp0_max, set_temp0_max); +static DEVICE_ATTR(temp1_min, S_IRUGO | S_IWUSR, show_temp0_min, set_temp0_min); + +define_temperature_sysfs(2); +define_temperature_sysfs(3); +define_temperature_sysfs(4); +define_temperature_sysfs(5); +define_temperature_sysfs(6); + +#define CFG_INFO_TEMP(id) { &sensor_dev_attr_temp##id##_input.dev_attr, \ + &sensor_dev_attr_temp##id##_min.dev_attr, \ + &sensor_dev_attr_temp##id##_max.dev_attr } +#define CFG_INFO_VOLT(id) { &sensor_dev_attr_in##id##_input.dev_attr, \ + &sensor_dev_attr_in##id##_min.dev_attr, \ + &sensor_dev_attr_in##id##_max.dev_attr } + +struct str_device_attr_table { + struct device_attribute *input; + struct device_attribute *min; + struct device_attribute *max; +}; + +static struct str_device_attr_table cfg_info_temp[] = { + { &dev_attr_temp1_input, &dev_attr_temp1_min, &dev_attr_temp1_max }, + CFG_INFO_TEMP(2), + CFG_INFO_TEMP(3), + CFG_INFO_TEMP(4), + CFG_INFO_TEMP(5), + CFG_INFO_TEMP(6) +}; + +static struct str_device_attr_table cfg_info_volt[] = { + CFG_INFO_VOLT(0), + CFG_INFO_VOLT(1), + CFG_INFO_VOLT(2), + CFG_INFO_VOLT(3), + CFG_INFO_VOLT(4), + { &dev_attr_in5_input, &dev_attr_in5_min, &dev_attr_in5_max } +}; + +/* Fans */ +static ssize_t show_fan(struct device *dev, struct device_attribute *attr, + char *buf) +{ + struct sensor_device_attribute *sensor_attr = to_sensor_dev_attr(attr); + int nr = sensor_attr->index; + struct vt8231_data *data = vt8231_update_device(dev); + return sprintf(buf, "%d\n", FAN_FROM_REG(data->fan[nr], + DIV_FROM_REG(data->fan_div[nr]))); +} + +static ssize_t show_fan_min(struct device *dev, struct device_attribute *attr, + char *buf) +{ + struct sensor_device_attribute *sensor_attr = to_sensor_dev_attr(attr); + int nr = sensor_attr->index; + struct vt8231_data *data = vt8231_update_device(dev); + return sprintf(buf, "%d\n", FAN_FROM_REG(data->fan_min[nr], + DIV_FROM_REG(data->fan_div[nr]))); +} + +static ssize_t show_fan_div(struct device *dev, struct device_attribute *attr, + char *buf) +{ + struct sensor_device_attribute *sensor_attr = to_sensor_dev_attr(attr); + int nr = sensor_attr->index; + struct vt8231_data *data = vt8231_update_device(dev); + return sprintf(buf, "%d\n", DIV_FROM_REG(data->fan_div[nr])); +} + +static ssize_t set_fan_min(struct device *dev, struct device_attribute *attr, + const char *buf, size_t count) +{ + struct sensor_device_attribute *sensor_attr = to_sensor_dev_attr(attr); + int nr = sensor_attr->index; + struct i2c_client *client = to_i2c_client(dev); + struct vt8231_data *data = i2c_get_clientdata(client); + int val = simple_strtoul(buf, NULL, 10); + + down(&data->update_lock); + data->fan_min[nr] = FAN_TO_REG(val, DIV_FROM_REG(data->fan_div[nr])); + vt8231_write_value(client, VT8231_REG_FAN_MIN(nr), data->fan_min[nr]); + up(&data->update_lock); + return count; +} + +static ssize_t set_fan_div(struct device *dev, struct device_attribute *attr, + const char *buf, size_t count) +{ + struct i2c_client *client = to_i2c_client(dev); + struct vt8231_data *data = i2c_get_clientdata(client); + struct sensor_device_attribute *sensor_attr = to_sensor_dev_attr(attr); + unsigned long val = simple_strtoul(buf, NULL, 10); + int nr = sensor_attr->index; + int old = vt8231_read_value(client, VT8231_REG_FANDIV); + long min = FAN_FROM_REG(data->fan_min[nr], + DIV_FROM_REG(data->fan_div[nr])); + + down(&data->update_lock); + switch (val) { + case 1: data->fan_div[nr] = 0; break; + case 2: data->fan_div[nr] = 1; break; + case 4: data->fan_div[nr] = 2; break; + case 8: data->fan_div[nr] = 3; break; + default: + dev_err(&client->dev, "fan_div value %ld not supported." + "Choose one of 1, 2, 4 or 8!\n", val); + up(&data->update_lock); + return -EINVAL; + } + + /* Correct the fan minimum speed */ + data->fan_min[nr] = FAN_TO_REG(min, DIV_FROM_REG(data->fan_div[nr])); + vt8231_write_value(client, VT8231_REG_FAN_MIN(nr), data->fan_min[nr]); + + old = (old & 0x0f) | (data->fan_div[1] << 6) | (data->fan_div[0] << 4); + vt8231_write_value(client, VT8231_REG_FANDIV, old); + up(&data->update_lock); + return count; +} + + +#define define_fan_sysfs(offset) \ +static SENSOR_DEVICE_ATTR(fan##offset##_input, S_IRUGO, \ + show_fan, NULL, offset - 1); \ +static SENSOR_DEVICE_ATTR(fan##offset##_div, S_IRUGO | S_IWUSR, \ + show_fan_div, set_fan_div, offset - 1); \ +static SENSOR_DEVICE_ATTR(fan##offset##_min, S_IRUGO | S_IWUSR, \ + show_fan_min, set_fan_min, offset - 1) + +define_fan_sysfs(1); +define_fan_sysfs(2); + +/* Alarms */ +static ssize_t show_alarms(struct device *dev, struct device_attribute *attr, + char *buf) +{ + struct vt8231_data *data = vt8231_update_device(dev); + return sprintf(buf, "%d\n", data->alarms); +} + +static DEVICE_ATTR(alarms, S_IRUGO, show_alarms, NULL); + +static struct i2c_driver vt8231_driver = { + .owner = THIS_MODULE, + .name = "vt8231", + .attach_adapter = vt8231_detect, + .detach_client = vt8231_detach_client, +}; + +static struct pci_device_id vt8231_pci_ids[] = { + { PCI_DEVICE(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_8231_4) }, + { 0, } +}; + +MODULE_DEVICE_TABLE(pci, vt8231_pci_ids); + +static int __devinit vt8231_pci_probe(struct pci_dev *dev, + const struct pci_device_id *id); + +static struct pci_driver vt8231_pci_driver = { + .name = "vt8231", + .id_table = vt8231_pci_ids, + .probe = vt8231_pci_probe, +}; + +int vt8231_detect(struct i2c_adapter *adapter) +{ + struct i2c_client *client; + struct vt8231_data *data; + int err = 0, i; + u16 val; + + /* 8231 requires multiple of 256 */ + if (force_addr) { + isa_address = force_addr & 0xFF00; + dev_warn(&adapter->dev, "forcing ISA address 0x%04X\n", + isa_address); + if (PCIBIOS_SUCCESSFUL != pci_write_config_word(s_bridge, + VT8231_BASE_REG, isa_address)) + return -ENODEV; + } + + if (PCIBIOS_SUCCESSFUL != + pci_read_config_word(s_bridge, VT8231_ENABLE_REG, &val)) + return -ENODEV; + + if (!(val & 0x0001)) { + dev_warn(&adapter->dev, "enabling sensors\n"); + if (PCIBIOS_SUCCESSFUL != + pci_write_config_word(s_bridge, VT8231_ENABLE_REG, + val | 0x0001)) + return -ENODEV; + } + + /* Reserve the ISA region */ + if (!request_region(isa_address, VT8231_EXTENT, + vt8231_pci_driver.name)) { + dev_err(&adapter->dev, "region 0x%x already in use!\n", + isa_address); + return -ENODEV; + } + + if (!(data = kzalloc(sizeof(struct vt8231_data), GFP_KERNEL))) { + err = -ENOMEM; + goto exit_release; + } + + client = &data->client; + i2c_set_clientdata(client, data); + client->addr = isa_address; + client->adapter = adapter; + client->driver = &vt8231_driver; + client->dev.parent = &adapter->dev; + + /* Fill in the remaining client fields and put into the global list */ + strlcpy(client->name, "vt8231", I2C_NAME_SIZE); + + init_MUTEX(&data->update_lock); + + /* Tell the I2C layer a new client has arrived */ + if ((err = i2c_attach_client(client))) + goto exit_free; + + vt8231_init_client(client); + + /* Register sysfs hooks */ + data->class_dev = hwmon_device_register(&client->dev); + if (IS_ERR(data->class_dev)) { + err = PTR_ERR(data->class_dev); + goto exit_detach; + } + + /* Must update device information to find out the config field */ + data->uch_config = vt8231_read_value(client, VT8231_REG_UCH_CONFIG); + + for (i = 0; i < ARRAY_SIZE(cfg_info_temp); i++) { + if (ISTEMP(i, data->uch_config)) { + device_create_file(&client->dev, + cfg_info_temp[i].input); + device_create_file(&client->dev, cfg_info_temp[i].max); + device_create_file(&client->dev, cfg_info_temp[i].min); + } + } + + for (i = 0; i < ARRAY_SIZE(cfg_info_volt); i++) { + if (ISVOLT(i, data->uch_config)) { + device_create_file(&client->dev, + cfg_info_volt[i].input); + device_create_file(&client->dev, cfg_info_volt[i].max); + device_create_file(&client->dev, cfg_info_volt[i].min); + } + } + + device_create_file(&client->dev, &sensor_dev_attr_fan1_input.dev_attr); + device_create_file(&client->dev, &sensor_dev_attr_fan2_input.dev_attr); + device_create_file(&client->dev, &sensor_dev_attr_fan1_min.dev_attr); + device_create_file(&client->dev, &sensor_dev_attr_fan2_min.dev_attr); + device_create_file(&client->dev, &sensor_dev_attr_fan1_div.dev_attr); + device_create_file(&client->dev, &sensor_dev_attr_fan2_div.dev_attr); + + device_create_file(&client->dev, &dev_attr_alarms); + return 0; + +exit_detach: + i2c_detach_client(client); +exit_free: + kfree(data); +exit_release: + release_region(isa_address, VT8231_EXTENT); + return err; +} + +static int vt8231_detach_client(struct i2c_client *client) +{ + struct vt8231_data *data = i2c_get_clientdata(client); + int err; + + hwmon_device_unregister(data->class_dev); + + if ((err = i2c_detach_client(client))) { + return err; + } + + release_region(client->addr, VT8231_EXTENT); + kfree(data); + + return 0; +} + +static void vt8231_init_client(struct i2c_client *client) +{ + vt8231_write_value(client, VT8231_REG_TEMP1_CONFIG, 0); + vt8231_write_value(client, VT8231_REG_TEMP2_CONFIG, 0); +} + +static struct vt8231_data *vt8231_update_device(struct device *dev) +{ + struct i2c_client *client = to_i2c_client(dev); + struct vt8231_data *data = i2c_get_clientdata(client); + int i; + u16 low; + + down(&data->update_lock); + + if (time_after(jiffies, data->last_updated + HZ + HZ / 2) + || !data->valid) { + for (i = 0; i < 6; i++) { + if (ISVOLT(i, data->uch_config)) { + data->in[i] = vt8231_read_value(client, + regvolt[i]); + data->in_min[i] = vt8231_read_value(client, + regvoltmin[i]); + data->in_max[i] = vt8231_read_value(client, + regvoltmax[i]); + } + } + for (i = 0; i < 2; i++) { + data->fan[i] = vt8231_read_value(client, + VT8231_REG_FAN(i)); + data->fan_min[i] = vt8231_read_value(client, + VT8231_REG_FAN_MIN(i)); + } + + low = vt8231_read_value(client, VT8231_REG_TEMP_LOW01); + low = (low >> 6) | ((low & 0x30) >> 2) + | (vt8231_read_value(client, VT8231_REG_TEMP_LOW25) << 4); + for (i = 0; i < 6; i++) { + if (ISTEMP(i, data->uch_config)) { + data->temp[i] = (vt8231_read_value(client, + regtemp[i]) << 2) + | ((low >> (2 * i)) & 0x03); + data->temp_max[i] = vt8231_read_value(client, + regtempmax[i]); + data->temp_min[i] = vt8231_read_value(client, + regtempmin[i]); + } + } + + i = vt8231_read_value(client, VT8231_REG_FANDIV); + data->fan_div[0] = (i >> 4) & 0x03; + data->fan_div[1] = i >> 6; + data->alarms = vt8231_read_value(client, VT8231_REG_ALARM1) | + (vt8231_read_value(client, VT8231_REG_ALARM2) << 8); + + /* Set alarm flags correctly */ + if (!data->fan[0] && data->fan_min[0]) { + data->alarms |= 0x40; + } else if (data->fan[0] && !data->fan_min[0]) { + data->alarms &= ~0x40; + } + + if (!data->fan[1] && data->fan_min[1]) { + data->alarms |= 0x80; + } else if (data->fan[1] && !data->fan_min[1]) { + data->alarms &= ~0x80; + } + + data->last_updated = jiffies; + data->valid = 1; + } + + up(&data->update_lock); + + return data; +} + +static int __devinit vt8231_pci_probe(struct pci_dev *dev, + const struct pci_device_id *id) +{ + u16 val; + + if (PCIBIOS_SUCCESSFUL != pci_read_config_word(dev, VT8231_BASE_REG, + &val)) + return -ENODEV; + + isa_address = val & ~(VT8231_EXTENT - 1); + if (isa_address == 0 && force_addr == 0) { + dev_err(&dev->dev, "base address not set -\ + upgrade BIOS or use force_addr=0xaddr\n"); + return -ENODEV; + } + + s_bridge = pci_dev_get(dev); + + if (i2c_isa_add_driver(&vt8231_driver)) { + pci_dev_put(s_bridge); + s_bridge = NULL; + } + + /* Always return failure here. This is to allow other drivers to bind + * to this pci device. We don't really want to have control over the + * pci device, we only wanted to read as few register values from it. + */ + return -ENODEV; +} + +static int __init sm_vt8231_init(void) +{ + return pci_module_init(&vt8231_pci_driver); +} + +static void __exit sm_vt8231_exit(void) +{ + pci_unregister_driver(&vt8231_pci_driver); + if (s_bridge != NULL) { + i2c_isa_del_driver(&vt8231_driver); + pci_dev_put(s_bridge); + s_bridge = NULL; + } +} + +MODULE_AUTHOR("Roger Lucas "); +MODULE_DESCRIPTION("VT8231 sensors"); +MODULE_LICENSE("GPL"); + +module_init(sm_vt8231_init); +module_exit(sm_vt8231_exit); -- cgit v1.1 From ff179c8cf5caa17bf3d407edbb5872aa2eee6900 Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Sat, 26 Nov 2005 20:24:59 +0100 Subject: [PATCH] i2c: Drop i2c_driver.flags, 1 of 3 The I2C_DF_DUMMY flag is gone since 2.5.70, it's about time to drop all ifdef'd out references thereto. Signed-off-by: Jean Delvare Signed-off-by: Greg Kroah-Hartman --- drivers/media/video/tvmixer.c | 4 ---- include/linux/i2c.h | 5 ----- 2 files changed, 9 deletions(-) diff --git a/drivers/media/video/tvmixer.c b/drivers/media/video/tvmixer.c index 8318bd1..5897e5d 100644 --- a/drivers/media/video/tvmixer.c +++ b/drivers/media/video/tvmixer.c @@ -232,12 +232,8 @@ static struct i2c_driver driver = { #endif .name = "tv card mixer driver", .id = I2C_DRIVERID_TVMIXER, -#ifdef I2C_DF_DUMMY - .flags = I2C_DF_DUMMY, -#else .flags = I2C_DF_NOTIFY, .detach_adapter = tvmixer_adapters, -#endif .attach_adapter = tvmixer_adapters, .detach_client = tvmixer_clients, }; diff --git a/include/linux/i2c.h b/include/linux/i2c.h index 5e19a7b..0316ba1 100644 --- a/include/linux/i2c.h +++ b/include/linux/i2c.h @@ -252,11 +252,6 @@ static inline void i2c_set_adapdata (struct i2c_adapter *dev, void *data) /*flags for the driver struct: */ #define I2C_DF_NOTIFY 0x01 /* notify on bus (de/a)ttaches */ -#if 0 -/* this flag is gone -- there is a (optional) driver->detach_adapter - * callback now which can be used instead */ -# define I2C_DF_DUMMY 0x02 -#endif /*flags for the client struct: */ #define I2C_CLIENT_ALLOW_USE 0x01 /* Client allows access */ -- cgit v1.1 From 8a9947552d43b0d20d5fa23ac0ba435d526be454 Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Sat, 26 Nov 2005 20:28:06 +0100 Subject: [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 Signed-off-by: Greg Kroah-Hartman --- Documentation/i2c/porting-clients | 3 +++ Documentation/i2c/writing-clients | 5 ----- arch/arm/mach-pxa/akita-ioexp.c | 1 - drivers/acorn/char/pcf8583.c | 1 - drivers/hwmon/adm1021.c | 1 - drivers/hwmon/adm1025.c | 1 - drivers/hwmon/adm1026.c | 1 - drivers/hwmon/adm1031.c | 1 - drivers/hwmon/adm9240.c | 1 - drivers/hwmon/asb100.c | 1 - drivers/hwmon/atxp1.c | 1 - drivers/hwmon/ds1621.c | 1 - drivers/hwmon/fscher.c | 1 - drivers/hwmon/fscpos.c | 1 - drivers/hwmon/gl518sm.c | 1 - drivers/hwmon/gl520sm.c | 1 - drivers/hwmon/it87.c | 1 - drivers/hwmon/lm63.c | 1 - drivers/hwmon/lm75.c | 1 - drivers/hwmon/lm77.c | 1 - drivers/hwmon/lm78.c | 1 - drivers/hwmon/lm80.c | 1 - drivers/hwmon/lm83.c | 1 - drivers/hwmon/lm85.c | 1 - drivers/hwmon/lm87.c | 1 - drivers/hwmon/lm90.c | 1 - drivers/hwmon/lm92.c | 1 - drivers/hwmon/max1619.c | 1 - drivers/hwmon/w83781d.c | 1 - drivers/hwmon/w83792d.c | 1 - drivers/hwmon/w83l785ts.c | 1 - drivers/i2c/chips/ds1337.c | 1 - drivers/i2c/chips/ds1374.c | 1 - drivers/i2c/chips/eeprom.c | 1 - drivers/i2c/chips/isp1301_omap.c | 1 - drivers/i2c/chips/m41t00.c | 1 - drivers/i2c/chips/max6875.c | 1 - drivers/i2c/chips/pca9539.c | 1 - drivers/i2c/chips/pcf8574.c | 1 - drivers/i2c/chips/pcf8591.c | 1 - drivers/i2c/chips/rtc8564.c | 1 - drivers/i2c/chips/tps65010.c | 1 - drivers/i2c/chips/x1205.c | 1 - drivers/i2c/i2c-core.c | 4 ++-- drivers/i2c/i2c-dev.c | 1 - drivers/macintosh/therm_adt746x.c | 1 - drivers/macintosh/therm_pm72.c | 1 - drivers/macintosh/therm_windtunnel.c | 1 - drivers/macintosh/windfarm_lm75_sensor.c | 1 - drivers/media/video/adv7170.c | 1 - drivers/media/video/adv7175.c | 1 - drivers/media/video/bt819.c | 1 - drivers/media/video/bt832.c | 1 - drivers/media/video/bt856.c | 1 - drivers/media/video/cs53l32a.c | 1 - drivers/media/video/cx25840/cx25840-core.c | 1 - drivers/media/video/indycam.c | 1 - drivers/media/video/ir-kbd-i2c.c | 1 - drivers/media/video/msp3400.c | 1 - drivers/media/video/ovcamchip/ovcamchip_core.c | 1 - drivers/media/video/saa5246a.c | 1 - drivers/media/video/saa5249.c | 1 - drivers/media/video/saa6588.c | 1 - drivers/media/video/saa7110.c | 1 - drivers/media/video/saa7111.c | 1 - drivers/media/video/saa7114.c | 1 - drivers/media/video/saa7115.c | 1 - drivers/media/video/saa711x.c | 1 - drivers/media/video/saa7127.c | 1 - drivers/media/video/saa7134/saa6752hs.c | 1 - drivers/media/video/saa7185.c | 1 - drivers/media/video/saa7191.c | 1 - drivers/media/video/tda7432.c | 1 - drivers/media/video/tda9840.c | 1 - drivers/media/video/tda9875.c | 1 - drivers/media/video/tda9887.c | 1 - drivers/media/video/tea6415c.c | 1 - drivers/media/video/tea6420.c | 1 - drivers/media/video/tuner-3036.c | 1 - drivers/media/video/tuner-core.c | 1 - drivers/media/video/tvaudio.c | 1 - drivers/media/video/tveeprom.c | 1 - drivers/media/video/tvmixer.c | 1 - drivers/media/video/tvp5150.c | 1 - drivers/media/video/vpx3220.c | 1 - drivers/media/video/wm8775.c | 1 - drivers/video/matrox/matroxfb_maven.c | 1 - include/linux/i2c.h | 1 - sound/oss/dmasound/dac3550a.c | 1 - sound/oss/dmasound/tas_common.c | 1 - sound/ppc/keywest.c | 1 - 91 files changed, 5 insertions(+), 95 deletions(-) diff --git a/Documentation/i2c/porting-clients b/Documentation/i2c/porting-clients index 184fac2..64c610b 100644 --- a/Documentation/i2c/porting-clients +++ b/Documentation/i2c/porting-clients @@ -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. diff --git a/Documentation/i2c/writing-clients b/Documentation/i2c/writing-clients index d19993c..59d2c16 100644 --- a/Documentation/i2c/writing-clients +++ b/Documentation/i2c/writing-clients @@ -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. diff --git a/arch/arm/mach-pxa/akita-ioexp.c b/arch/arm/mach-pxa/akita-ioexp.c index f6d73cc..440ebb3 100644 --- a/arch/arm/mach-pxa/akita-ioexp.c +++ b/arch/arm/mach-pxa/akita-ioexp.c @@ -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, }; diff --git a/drivers/acorn/char/pcf8583.c b/drivers/acorn/char/pcf8583.c index e26f007..befc946 100644 --- a/drivers/acorn/char/pcf8583.c +++ b/drivers/acorn/char/pcf8583.c @@ -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 diff --git a/drivers/hwmon/adm1021.c b/drivers/hwmon/adm1021.c index 8102876..5e6df4b 100644 --- a/drivers/hwmon/adm1021.c +++ b/drivers/hwmon/adm1021.c @@ -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, }; diff --git a/drivers/hwmon/adm1025.c b/drivers/hwmon/adm1025.c index bf67860..2be48a7 100644 --- a/drivers/hwmon/adm1025.c +++ b/drivers/hwmon/adm1025.c @@ -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, }; diff --git a/drivers/hwmon/adm1026.c b/drivers/hwmon/adm1026.c index 5036b17..5416db8 100644 --- a/drivers/hwmon/adm1026.c +++ b/drivers/hwmon/adm1026.c @@ -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, }; diff --git a/drivers/hwmon/adm1031.c b/drivers/hwmon/adm1031.c index 7c545d5..1e244280 100644 --- a/drivers/hwmon/adm1031.c +++ b/drivers/hwmon/adm1031.c @@ -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, }; diff --git a/drivers/hwmon/adm9240.c b/drivers/hwmon/adm9240.c index 11dc95f..287733f 100644 --- a/drivers/hwmon/adm9240.c +++ b/drivers/hwmon/adm9240.c @@ -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, }; diff --git a/drivers/hwmon/asb100.c b/drivers/hwmon/asb100.c index 52c4697..7227f80 100644 --- a/drivers/hwmon/asb100.c +++ b/drivers/hwmon/asb100.c @@ -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, }; diff --git a/drivers/hwmon/atxp1.c b/drivers/hwmon/atxp1.c index 53324f5..a60a9f2 100644 --- a/drivers/hwmon/atxp1.c +++ b/drivers/hwmon/atxp1.c @@ -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, }; diff --git a/drivers/hwmon/ds1621.c b/drivers/hwmon/ds1621.c index 34f71b7..0096eb3 100644 --- a/drivers/hwmon/ds1621.c +++ b/drivers/hwmon/ds1621.c @@ -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, }; diff --git a/drivers/hwmon/fscher.c b/drivers/hwmon/fscher.c index a02e1c3..f56ca06 100644 --- a/drivers/hwmon/fscher.c +++ b/drivers/hwmon/fscher.c @@ -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, }; diff --git a/drivers/hwmon/fscpos.c b/drivers/hwmon/fscpos.c index 64e4edc..701dffc 100644 --- a/drivers/hwmon/fscpos.c +++ b/drivers/hwmon/fscpos.c @@ -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, }; diff --git a/drivers/hwmon/gl518sm.c b/drivers/hwmon/gl518sm.c index 2f178db..5788bbb 100644 --- a/drivers/hwmon/gl518sm.c +++ b/drivers/hwmon/gl518sm.c @@ -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, }; diff --git a/drivers/hwmon/gl520sm.c b/drivers/hwmon/gl520sm.c index c39ba12..b399816 100644 --- a/drivers/hwmon/gl520sm.c +++ b/drivers/hwmon/gl520sm.c @@ -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, }; diff --git a/drivers/hwmon/it87.c b/drivers/hwmon/it87.c index a61f5d0..d5f0d92 100644 --- a/drivers/hwmon/it87.c +++ b/drivers/hwmon/it87.c @@ -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, }; diff --git a/drivers/hwmon/lm63.c b/drivers/hwmon/lm63.c index 954ec24..c2dd4ac 100644 --- a/drivers/hwmon/lm63.c +++ b/drivers/hwmon/lm63.c @@ -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, }; diff --git a/drivers/hwmon/lm75.c b/drivers/hwmon/lm75.c index d70f4c8..0bcbd65 100644 --- a/drivers/hwmon/lm75.c +++ b/drivers/hwmon/lm75.c @@ -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, }; diff --git a/drivers/hwmon/lm77.c b/drivers/hwmon/lm77.c index 9380fda..6a524e9 100644 --- a/drivers/hwmon/lm77.c +++ b/drivers/hwmon/lm77.c @@ -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, }; diff --git a/drivers/hwmon/lm78.c b/drivers/hwmon/lm78.c index 78cdd50..18448f8 100644 --- a/drivers/hwmon/lm78.c +++ b/drivers/hwmon/lm78.c @@ -167,7 +167,6 @@ static struct i2c_driver lm78_driver = { .owner = THIS_MODULE, .name = "lm78", .id = I2C_DRIVERID_LM78, - .flags = I2C_DF_NOTIFY, .attach_adapter = lm78_attach_adapter, .detach_client = lm78_detach_client, }; diff --git a/drivers/hwmon/lm80.c b/drivers/hwmon/lm80.c index c359fde..02303fa 100644 --- a/drivers/hwmon/lm80.c +++ b/drivers/hwmon/lm80.c @@ -146,7 +146,6 @@ static struct i2c_driver lm80_driver = { .owner = THIS_MODULE, .name = "lm80", .id = I2C_DRIVERID_LM80, - .flags = I2C_DF_NOTIFY, .attach_adapter = lm80_attach_adapter, .detach_client = lm80_detach_client, }; diff --git a/drivers/hwmon/lm83.c b/drivers/hwmon/lm83.c index 9a70611..96cb34e 100644 --- a/drivers/hwmon/lm83.c +++ b/drivers/hwmon/lm83.c @@ -127,7 +127,6 @@ static struct i2c_driver lm83_driver = { .owner = THIS_MODULE, .name = "lm83", .id = I2C_DRIVERID_LM83, - .flags = I2C_DF_NOTIFY, .attach_adapter = lm83_attach_adapter, .detach_client = lm83_detach_client, }; diff --git a/drivers/hwmon/lm85.c b/drivers/hwmon/lm85.c index 3f5544a..131ecab 100644 --- a/drivers/hwmon/lm85.c +++ b/drivers/hwmon/lm85.c @@ -383,7 +383,6 @@ static struct i2c_driver lm85_driver = { .owner = THIS_MODULE, .name = "lm85", .id = I2C_DRIVERID_LM85, - .flags = I2C_DF_NOTIFY, .attach_adapter = lm85_attach_adapter, .detach_client = lm85_detach_client, }; diff --git a/drivers/hwmon/lm87.c b/drivers/hwmon/lm87.c index eeec1817..26fd0b3 100644 --- a/drivers/hwmon/lm87.c +++ b/drivers/hwmon/lm87.c @@ -164,7 +164,6 @@ static struct i2c_driver lm87_driver = { .owner = THIS_MODULE, .name = "lm87", .id = I2C_DRIVERID_LM87, - .flags = I2C_DF_NOTIFY, .attach_adapter = lm87_attach_adapter, .detach_client = lm87_detach_client, }; diff --git a/drivers/hwmon/lm90.c b/drivers/hwmon/lm90.c index 83cf2e1..011923b 100644 --- a/drivers/hwmon/lm90.c +++ b/drivers/hwmon/lm90.c @@ -189,7 +189,6 @@ static struct i2c_driver lm90_driver = { .owner = THIS_MODULE, .name = "lm90", .id = I2C_DRIVERID_LM90, - .flags = I2C_DF_NOTIFY, .attach_adapter = lm90_attach_adapter, .detach_client = lm90_detach_client, }; diff --git a/drivers/hwmon/lm92.c b/drivers/hwmon/lm92.c index 7a4b3701..2005a9e 100644 --- a/drivers/hwmon/lm92.c +++ b/drivers/hwmon/lm92.c @@ -413,7 +413,6 @@ static struct i2c_driver lm92_driver = { .owner = THIS_MODULE, .name = "lm92", .id = I2C_DRIVERID_LM92, - .flags = I2C_DF_NOTIFY, .attach_adapter = lm92_attach_adapter, .detach_client = lm92_detach_client, }; diff --git a/drivers/hwmon/max1619.c b/drivers/hwmon/max1619.c index 69e7e12..d5aebef 100644 --- a/drivers/hwmon/max1619.c +++ b/drivers/hwmon/max1619.c @@ -92,7 +92,6 @@ static struct max1619_data *max1619_update_device(struct device *dev); static struct i2c_driver max1619_driver = { .owner = THIS_MODULE, .name = "max1619", - .flags = I2C_DF_NOTIFY, .attach_adapter = max1619_attach_adapter, .detach_client = max1619_detach_client, }; diff --git a/drivers/hwmon/w83781d.c b/drivers/hwmon/w83781d.c index ffdb3a0..a78929f 100644 --- a/drivers/hwmon/w83781d.c +++ b/drivers/hwmon/w83781d.c @@ -272,7 +272,6 @@ static struct i2c_driver w83781d_driver = { .owner = THIS_MODULE, .name = "w83781d", .id = I2C_DRIVERID_W83781D, - .flags = I2C_DF_NOTIFY, .attach_adapter = w83781d_attach_adapter, .detach_client = w83781d_detach_client, }; diff --git a/drivers/hwmon/w83792d.c b/drivers/hwmon/w83792d.c index 1ba0726..6824243 100644 --- a/drivers/hwmon/w83792d.c +++ b/drivers/hwmon/w83792d.c @@ -319,7 +319,6 @@ static void w83792d_init_client(struct i2c_client *client); static struct i2c_driver w83792d_driver = { .owner = THIS_MODULE, .name = "w83792d", - .flags = I2C_DF_NOTIFY, .attach_adapter = w83792d_attach_adapter, .detach_client = w83792d_detach_client, }; diff --git a/drivers/hwmon/w83l785ts.c b/drivers/hwmon/w83l785ts.c index f495b63..35172fb 100644 --- a/drivers/hwmon/w83l785ts.c +++ b/drivers/hwmon/w83l785ts.c @@ -95,7 +95,6 @@ static struct i2c_driver w83l785ts_driver = { .owner = THIS_MODULE, .name = "w83l785ts", .id = I2C_DRIVERID_W83L785TS, - .flags = I2C_DF_NOTIFY, .attach_adapter = w83l785ts_attach_adapter, .detach_client = w83l785ts_detach_client, }; diff --git a/drivers/i2c/chips/ds1337.c b/drivers/i2c/chips/ds1337.c index 1822895..65146cb 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 da488b7..5a270d6 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 4baf573..9bb1f8b 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 d2a100d..4f472ba 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 3df309a..13e6783 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 b376a00..7e61019 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 59a9303..26feb7a 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 c323c2d..2fae640 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 ce420a6..8750f71 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 26e498d..e586f75 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 280dd7a..439bf6c 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 7da366c..c5ff2ce 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 82ea1b7..ad68ac0 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 8af0bd1..9da51eb 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, diff --git a/drivers/macintosh/therm_adt746x.c b/drivers/macintosh/therm_adt746x.c index f386966..f62c16f 100644 --- a/drivers/macintosh/therm_adt746x.c +++ b/drivers/macintosh/therm_adt746x.c @@ -173,7 +173,6 @@ detach_thermostat(struct i2c_adapter *adapter) static struct i2c_driver thermostat_driver = { .owner = THIS_MODULE, .name = "therm_adt746x", - .flags = I2C_DF_NOTIFY, .attach_adapter = attach_thermostat, .detach_adapter = detach_thermostat, }; diff --git a/drivers/macintosh/therm_pm72.c b/drivers/macintosh/therm_pm72.c index 190878e..df00c96 100644 --- a/drivers/macintosh/therm_pm72.c +++ b/drivers/macintosh/therm_pm72.c @@ -285,7 +285,6 @@ static struct i2c_driver therm_pm72_driver = { .owner = THIS_MODULE, .name = "therm_pm72", - .flags = I2C_DF_NOTIFY, .attach_adapter = therm_pm72_attach, .detach_adapter = therm_pm72_detach, }; diff --git a/drivers/macintosh/therm_windtunnel.c b/drivers/macintosh/therm_windtunnel.c index 6aaa1df..f3bae0d 100644 --- a/drivers/macintosh/therm_windtunnel.c +++ b/drivers/macintosh/therm_windtunnel.c @@ -357,7 +357,6 @@ static struct i2c_driver g4fan_driver = { .owner = THIS_MODULE, .name = "therm_windtunnel", .id = I2C_DRIVERID_G4FAN, - .flags = I2C_DF_NOTIFY, .attach_adapter = do_attach, .detach_client = do_detach, }; diff --git a/drivers/macintosh/windfarm_lm75_sensor.c b/drivers/macintosh/windfarm_lm75_sensor.c index a0a41ad..2392789 100644 --- a/drivers/macintosh/windfarm_lm75_sensor.c +++ b/drivers/macintosh/windfarm_lm75_sensor.c @@ -49,7 +49,6 @@ static int wf_lm75_detach(struct i2c_client *client); static struct i2c_driver wf_lm75_driver = { .owner = THIS_MODULE, .name = "wf_lm75", - .flags = I2C_DF_NOTIFY, .attach_adapter = wf_lm75_attach, .detach_client = wf_lm75_detach, }; diff --git a/drivers/media/video/adv7170.c b/drivers/media/video/adv7170.c index 1ca2b67..c4f2265 100644 --- a/drivers/media/video/adv7170.c +++ b/drivers/media/video/adv7170.c @@ -502,7 +502,6 @@ static struct i2c_driver i2c_driver_adv7170 = { .name = "adv7170", /* name */ .id = I2C_DRIVERID_ADV7170, - .flags = I2C_DF_NOTIFY, .attach_adapter = adv7170_attach_adapter, .detach_client = adv7170_detach_client, diff --git a/drivers/media/video/adv7175.c b/drivers/media/video/adv7175.c index 173bca1..4fc08b1 100644 --- a/drivers/media/video/adv7175.c +++ b/drivers/media/video/adv7175.c @@ -552,7 +552,6 @@ static struct i2c_driver i2c_driver_adv7175 = { .name = "adv7175", /* name */ .id = I2C_DRIVERID_ADV7175, - .flags = I2C_DF_NOTIFY, .attach_adapter = adv7175_attach_adapter, .detach_client = adv7175_detach_client, diff --git a/drivers/media/video/bt819.c b/drivers/media/video/bt819.c index 3ee0afc..7bba697 100644 --- a/drivers/media/video/bt819.c +++ b/drivers/media/video/bt819.c @@ -627,7 +627,6 @@ static struct i2c_driver i2c_driver_bt819 = { .name = "bt819", .id = I2C_DRIVERID_BT819, - .flags = I2C_DF_NOTIFY, .attach_adapter = bt819_attach_adapter, .detach_client = bt819_detach_client, diff --git a/drivers/media/video/bt832.c b/drivers/media/video/bt832.c index 3ca1d76..0ba8652 100644 --- a/drivers/media/video/bt832.c +++ b/drivers/media/video/bt832.c @@ -233,7 +233,6 @@ static struct i2c_driver driver = { .owner = THIS_MODULE, .name = "i2c bt832 driver", .id = -1, /* FIXME */ - .flags = I2C_DF_NOTIFY, .attach_adapter = bt832_probe, .detach_client = bt832_detach, .command = bt832_command, diff --git a/drivers/media/video/bt856.c b/drivers/media/video/bt856.c index 8eb871d..4c9acd1 100644 --- a/drivers/media/video/bt856.c +++ b/drivers/media/video/bt856.c @@ -409,7 +409,6 @@ static struct i2c_driver i2c_driver_bt856 = { .name = "bt856", .id = I2C_DRIVERID_BT856, - .flags = I2C_DF_NOTIFY, .attach_adapter = bt856_attach_adapter, .detach_client = bt856_detach_client, diff --git a/drivers/media/video/cs53l32a.c b/drivers/media/video/cs53l32a.c index 780b352..fce5d89 100644 --- a/drivers/media/video/cs53l32a.c +++ b/drivers/media/video/cs53l32a.c @@ -218,7 +218,6 @@ static int cs53l32a_detach(struct i2c_client *client) static struct i2c_driver i2c_driver = { .name = "cs53l32a", .id = I2C_DRIVERID_CS53L32A, - .flags = I2C_DF_NOTIFY, .attach_adapter = cs53l32a_probe, .detach_client = cs53l32a_detach, .command = cs53l32a_command, diff --git a/drivers/media/video/cx25840/cx25840-core.c b/drivers/media/video/cx25840/cx25840-core.c index 5b93723..c66bc14 100644 --- a/drivers/media/video/cx25840/cx25840-core.c +++ b/drivers/media/video/cx25840/cx25840-core.c @@ -847,7 +847,6 @@ static struct i2c_driver i2c_driver_cx25840 = { .name = "cx25840", .id = I2C_DRIVERID_CX25840, - .flags = I2C_DF_NOTIFY, .attach_adapter = cx25840_attach_adapter, .detach_client = cx25840_detach_client, diff --git a/drivers/media/video/indycam.c b/drivers/media/video/indycam.c index deeef12..3eba514 100644 --- a/drivers/media/video/indycam.c +++ b/drivers/media/video/indycam.c @@ -454,7 +454,6 @@ static struct i2c_driver i2c_driver_indycam = { .owner = THIS_MODULE, .name = "indycam", .id = I2C_DRIVERID_INDYCAM, - .flags = I2C_DF_NOTIFY, .attach_adapter = indycam_probe, .detach_client = indycam_detach, .command = indycam_command, diff --git a/drivers/media/video/ir-kbd-i2c.c b/drivers/media/video/ir-kbd-i2c.c index 740e543..2e2f78a 100644 --- a/drivers/media/video/ir-kbd-i2c.c +++ b/drivers/media/video/ir-kbd-i2c.c @@ -280,7 +280,6 @@ static int ir_probe(struct i2c_adapter *adap); static struct i2c_driver driver = { .name = "ir remote kbd driver", .id = I2C_DRIVERID_INFRARED, - .flags = I2C_DF_NOTIFY, .attach_adapter = ir_probe, .detach_client = ir_detach, }; diff --git a/drivers/media/video/msp3400.c b/drivers/media/video/msp3400.c index d86f8e9..46328fb 100644 --- a/drivers/media/video/msp3400.c +++ b/drivers/media/video/msp3400.c @@ -1564,7 +1564,6 @@ static struct i2c_driver driver = { .owner = THIS_MODULE, .name = "msp3400", .id = I2C_DRIVERID_MSP3400, - .flags = I2C_DF_NOTIFY, .attach_adapter = msp_probe, .detach_client = msp_detach, .command = msp_command, diff --git a/drivers/media/video/ovcamchip/ovcamchip_core.c b/drivers/media/video/ovcamchip/ovcamchip_core.c index 2de34eb..390d0d6 100644 --- a/drivers/media/video/ovcamchip/ovcamchip_core.c +++ b/drivers/media/video/ovcamchip/ovcamchip_core.c @@ -414,7 +414,6 @@ static struct i2c_driver driver = { .name = "ovcamchip", .id = I2C_DRIVERID_OVCAMCHIP, .class = I2C_CLASS_CAM_DIGITAL, - .flags = I2C_DF_NOTIFY, .attach_adapter = ovcamchip_attach, .detach_client = ovcamchip_detach, .command = ovcamchip_command, diff --git a/drivers/media/video/saa5246a.c b/drivers/media/video/saa5246a.c index b8054da..9bf6869 100644 --- a/drivers/media/video/saa5246a.c +++ b/drivers/media/video/saa5246a.c @@ -166,7 +166,6 @@ static struct i2c_driver i2c_driver_videotext = .owner = THIS_MODULE, .name = IF_NAME, /* name */ .id = I2C_DRIVERID_SAA5249, /* in i2c.h */ - .flags = I2C_DF_NOTIFY, .attach_adapter = saa5246a_probe, .detach_client = saa5246a_detach, .command = saa5246a_command diff --git a/drivers/media/video/saa5249.c b/drivers/media/video/saa5249.c index 7ffa2e9..811e863 100644 --- a/drivers/media/video/saa5249.c +++ b/drivers/media/video/saa5249.c @@ -239,7 +239,6 @@ static struct i2c_driver i2c_driver_videotext = .owner = THIS_MODULE, .name = IF_NAME, /* name */ .id = I2C_DRIVERID_SAA5249, /* in i2c.h */ - .flags = I2C_DF_NOTIFY, .attach_adapter = saa5249_probe, .detach_client = saa5249_detach, .command = saa5249_command diff --git a/drivers/media/video/saa6588.c b/drivers/media/video/saa6588.c index 9233225..18a0b71 100644 --- a/drivers/media/video/saa6588.c +++ b/drivers/media/video/saa6588.c @@ -498,7 +498,6 @@ static struct i2c_driver driver = { .owner = THIS_MODULE, .name = "i2c saa6588 driver", .id = -1, /* FIXME */ - .flags = I2C_DF_NOTIFY, .attach_adapter = saa6588_probe, .detach_client = saa6588_detach, .command = saa6588_command, diff --git a/drivers/media/video/saa7110.c b/drivers/media/video/saa7110.c index e116bdb..f266b35 100644 --- a/drivers/media/video/saa7110.c +++ b/drivers/media/video/saa7110.c @@ -591,7 +591,6 @@ static struct i2c_driver i2c_driver_saa7110 = { .name = "saa7110", .id = I2C_DRIVERID_SAA7110, - .flags = I2C_DF_NOTIFY, .attach_adapter = saa7110_attach_adapter, .detach_client = saa7110_detach_client, diff --git a/drivers/media/video/saa7111.c b/drivers/media/video/saa7111.c index fe8a5e4..687beaf 100644 --- a/drivers/media/video/saa7111.c +++ b/drivers/media/video/saa7111.c @@ -594,7 +594,6 @@ static struct i2c_driver i2c_driver_saa7111 = { .name = "saa7111", .id = I2C_DRIVERID_SAA7111A, - .flags = I2C_DF_NOTIFY, .attach_adapter = saa7111_attach_adapter, .detach_client = saa7111_detach_client, diff --git a/drivers/media/video/saa7114.c b/drivers/media/video/saa7114.c index d9f50e2..4748cf0 100644 --- a/drivers/media/video/saa7114.c +++ b/drivers/media/video/saa7114.c @@ -1208,7 +1208,6 @@ static struct i2c_driver i2c_driver_saa7114 = { .name = "saa7114", .id = I2C_DRIVERID_SAA7114, - .flags = I2C_DF_NOTIFY, .attach_adapter = saa7114_attach_adapter, .detach_client = saa7114_detach_client, diff --git a/drivers/media/video/saa7115.c b/drivers/media/video/saa7115.c index e717e30..b1079de 100644 --- a/drivers/media/video/saa7115.c +++ b/drivers/media/video/saa7115.c @@ -1356,7 +1356,6 @@ static int saa7115_detach(struct i2c_client *client) static struct i2c_driver i2c_driver_saa7115 = { .name = "saa7115", .id = I2C_DRIVERID_SAA711X, - .flags = I2C_DF_NOTIFY, .attach_adapter = saa7115_probe, .detach_client = saa7115_detach, .command = saa7115_command, diff --git a/drivers/media/video/saa711x.c b/drivers/media/video/saa711x.c index 31f7b95..734a709 100644 --- a/drivers/media/video/saa711x.c +++ b/drivers/media/video/saa711x.c @@ -569,7 +569,6 @@ static struct i2c_driver i2c_driver_saa711x = { .name = "saa711x", .id = I2C_DRIVERID_SAA711X, - .flags = I2C_DF_NOTIFY, .attach_adapter = saa711x_attach_adapter, .detach_client = saa711x_detach_client, diff --git a/drivers/media/video/saa7127.c b/drivers/media/video/saa7127.c index c36f014..a2fab98 100644 --- a/drivers/media/video/saa7127.c +++ b/drivers/media/video/saa7127.c @@ -821,7 +821,6 @@ static int saa7127_detach(struct i2c_client *client) static struct i2c_driver i2c_driver_saa7127 = { .name = "saa7127", .id = I2C_DRIVERID_SAA7127, - .flags = I2C_DF_NOTIFY, .attach_adapter = saa7127_probe, .detach_client = saa7127_detach, .command = saa7127_command, diff --git a/drivers/media/video/saa7134/saa6752hs.c b/drivers/media/video/saa7134/saa6752hs.c index a61d24f..6fc298e 100644 --- a/drivers/media/video/saa7134/saa6752hs.c +++ b/drivers/media/video/saa7134/saa6752hs.c @@ -600,7 +600,6 @@ static struct i2c_driver driver = { .owner = THIS_MODULE, .name = "i2c saa6752hs MPEG encoder", .id = I2C_DRIVERID_SAA6752HS, - .flags = I2C_DF_NOTIFY, .attach_adapter = saa6752hs_probe, .detach_client = saa6752hs_detach, .command = saa6752hs_command, diff --git a/drivers/media/video/saa7185.c b/drivers/media/video/saa7185.c index 132aa79..e24aa16 100644 --- a/drivers/media/video/saa7185.c +++ b/drivers/media/video/saa7185.c @@ -491,7 +491,6 @@ static struct i2c_driver i2c_driver_saa7185 = { .name = "saa7185", /* name */ .id = I2C_DRIVERID_SAA7185B, - .flags = I2C_DF_NOTIFY, .attach_adapter = saa7185_attach_adapter, .detach_client = saa7185_detach_client, diff --git a/drivers/media/video/saa7191.c b/drivers/media/video/saa7191.c index cbca896..6be98fc 100644 --- a/drivers/media/video/saa7191.c +++ b/drivers/media/video/saa7191.c @@ -791,7 +791,6 @@ static struct i2c_driver i2c_driver_saa7191 = { .owner = THIS_MODULE, .name = "saa7191", .id = I2C_DRIVERID_SAA7191, - .flags = I2C_DF_NOTIFY, .attach_adapter = saa7191_probe, .detach_client = saa7191_detach, .command = saa7191_command diff --git a/drivers/media/video/tda7432.c b/drivers/media/video/tda7432.c index d32737d..239a586 100644 --- a/drivers/media/video/tda7432.c +++ b/drivers/media/video/tda7432.c @@ -504,7 +504,6 @@ static struct i2c_driver driver = { .owner = THIS_MODULE, .name = "i2c tda7432 driver", .id = I2C_DRIVERID_TDA7432, - .flags = I2C_DF_NOTIFY, .attach_adapter = tda7432_probe, .detach_client = tda7432_detach, .command = tda7432_command, diff --git a/drivers/media/video/tda9840.c b/drivers/media/video/tda9840.c index 1794686..f29fb50 100644 --- a/drivers/media/video/tda9840.c +++ b/drivers/media/video/tda9840.c @@ -224,7 +224,6 @@ static struct i2c_driver driver = { .owner = THIS_MODULE, .name = "tda9840", .id = I2C_DRIVERID_TDA9840, - .flags = I2C_DF_NOTIFY, .attach_adapter = attach, .detach_client = detach, .command = command, diff --git a/drivers/media/video/tda9875.c b/drivers/media/video/tda9875.c index a5e37dc..d053b64 100644 --- a/drivers/media/video/tda9875.c +++ b/drivers/media/video/tda9875.c @@ -375,7 +375,6 @@ static struct i2c_driver driver = { .owner = THIS_MODULE, .name = "i2c tda9875 driver", .id = I2C_DRIVERID_TDA9875, - .flags = I2C_DF_NOTIFY, .attach_adapter = tda9875_probe, .detach_client = tda9875_detach, .command = tda9875_command, diff --git a/drivers/media/video/tda9887.c b/drivers/media/video/tda9887.c index 2f2414e..049b44e 100644 --- a/drivers/media/video/tda9887.c +++ b/drivers/media/video/tda9887.c @@ -822,7 +822,6 @@ static struct i2c_driver driver = { .owner = THIS_MODULE, .name = "i2c tda9887 driver", .id = -1, /* FIXME */ - .flags = I2C_DF_NOTIFY, .attach_adapter = tda9887_probe, .detach_client = tda9887_detach, .command = tda9887_command, diff --git a/drivers/media/video/tea6415c.c b/drivers/media/video/tea6415c.c index ee36883..96d88ce 100644 --- a/drivers/media/video/tea6415c.c +++ b/drivers/media/video/tea6415c.c @@ -193,7 +193,6 @@ static struct i2c_driver driver = { .owner = THIS_MODULE, .name = "tea6415c", .id = I2C_DRIVERID_TEA6415C, - .flags = I2C_DF_NOTIFY, .attach_adapter = attach, .detach_client = detach, .command = command, diff --git a/drivers/media/video/tea6420.c b/drivers/media/video/tea6420.c index 17975c1..fd417de 100644 --- a/drivers/media/video/tea6420.c +++ b/drivers/media/video/tea6420.c @@ -170,7 +170,6 @@ static struct i2c_driver driver = { .owner = THIS_MODULE, .name = "tea6420", .id = I2C_DRIVERID_TEA6420, - .flags = I2C_DF_NOTIFY, .attach_adapter = attach, .detach_client = detach, .command = command, diff --git a/drivers/media/video/tuner-3036.c b/drivers/media/video/tuner-3036.c index 7920359..3505cec2 100644 --- a/drivers/media/video/tuner-3036.c +++ b/drivers/media/video/tuner-3036.c @@ -178,7 +178,6 @@ i2c_driver_tuner = .owner = THIS_MODULE, .name = "sab3036", .id = I2C_DRIVERID_SAB3036, - .flags = I2C_DF_NOTIFY, .attach_adapter = tuner_probe, .detach_client = tuner_detach, .command = tuner_command diff --git a/drivers/media/video/tuner-core.c b/drivers/media/video/tuner-core.c index e58abdf..3c75121 100644 --- a/drivers/media/video/tuner-core.c +++ b/drivers/media/video/tuner-core.c @@ -745,7 +745,6 @@ static struct i2c_driver driver = { .owner = THIS_MODULE, .name = "tuner", .id = I2C_DRIVERID_TUNER, - .flags = I2C_DF_NOTIFY, .attach_adapter = tuner_probe, .detach_client = tuner_detach, .command = tuner_command, diff --git a/drivers/media/video/tvaudio.c b/drivers/media/video/tvaudio.c index 5b20e81..3565f35 100644 --- a/drivers/media/video/tvaudio.c +++ b/drivers/media/video/tvaudio.c @@ -1705,7 +1705,6 @@ static struct i2c_driver driver = { .owner = THIS_MODULE, .name = "generic i2c audio driver", .id = I2C_DRIVERID_TVAUDIO, - .flags = I2C_DF_NOTIFY, .attach_adapter = chip_probe, .detach_client = chip_detach, .command = chip_command, diff --git a/drivers/media/video/tveeprom.c b/drivers/media/video/tveeprom.c index 5ac2353..195bc51 100644 --- a/drivers/media/video/tveeprom.c +++ b/drivers/media/video/tveeprom.c @@ -782,7 +782,6 @@ static struct i2c_driver i2c_driver_tveeprom = { .owner = THIS_MODULE, .name = "tveeprom", .id = I2C_DRIVERID_TVEEPROM, - .flags = I2C_DF_NOTIFY, .attach_adapter = tveeprom_attach_adapter, .detach_client = tveeprom_detach_client, .command = tveeprom_command, diff --git a/drivers/media/video/tvmixer.c b/drivers/media/video/tvmixer.c index 5897e5d..936e01d 100644 --- a/drivers/media/video/tvmixer.c +++ b/drivers/media/video/tvmixer.c @@ -232,7 +232,6 @@ static struct i2c_driver driver = { #endif .name = "tv card mixer driver", .id = I2C_DRIVERID_TVMIXER, - .flags = I2C_DF_NOTIFY, .detach_adapter = tvmixer_adapters, .attach_adapter = tvmixer_adapters, .detach_client = tvmixer_clients, diff --git a/drivers/media/video/tvp5150.c b/drivers/media/video/tvp5150.c index 97431e2..4f3ee20 100644 --- a/drivers/media/video/tvp5150.c +++ b/drivers/media/video/tvp5150.c @@ -806,7 +806,6 @@ static struct i2c_driver driver = { /* FIXME */ .id = I2C_DRIVERID_SAA7110, - .flags = I2C_DF_NOTIFY, .attach_adapter = tvp5150_attach_adapter, .detach_client = tvp5150_detach_client, diff --git a/drivers/media/video/vpx3220.c b/drivers/media/video/vpx3220.c index 137b58f..c66d285 100644 --- a/drivers/media/video/vpx3220.c +++ b/drivers/media/video/vpx3220.c @@ -726,7 +726,6 @@ static struct i2c_driver vpx3220_i2c_driver = { .name = "vpx3220", .id = I2C_DRIVERID_VPX3220, - .flags = I2C_DF_NOTIFY, .attach_adapter = vpx3220_attach_adapter, .detach_client = vpx3220_detach_client, diff --git a/drivers/media/video/wm8775.c b/drivers/media/video/wm8775.c index a6936ad..7b07717 100644 --- a/drivers/media/video/wm8775.c +++ b/drivers/media/video/wm8775.c @@ -236,7 +236,6 @@ static struct i2c_driver i2c_driver = { .name = "wm8775", .id = I2C_DRIVERID_WM8775, - .flags = I2C_DF_NOTIFY, .attach_adapter = wm8775_probe, .detach_client = wm8775_detach, diff --git a/drivers/video/matrox/matroxfb_maven.c b/drivers/video/matrox/matroxfb_maven.c index ad60bbb..78994c5 100644 --- a/drivers/video/matrox/matroxfb_maven.c +++ b/drivers/video/matrox/matroxfb_maven.c @@ -1296,7 +1296,6 @@ static struct i2c_driver maven_driver={ .owner = THIS_MODULE, .name = "maven", .id = I2C_DRIVERID_MGATVO, - .flags = I2C_DF_NOTIFY, .attach_adapter = maven_attach_adapter, .detach_client = maven_detach_client, .command = maven_command, diff --git a/include/linux/i2c.h b/include/linux/i2c.h index 0316ba1..99399fa 100644 --- a/include/linux/i2c.h +++ b/include/linux/i2c.h @@ -251,7 +251,6 @@ static inline void i2c_set_adapdata (struct i2c_adapter *dev, void *data) } /*flags for the driver struct: */ -#define I2C_DF_NOTIFY 0x01 /* notify on bus (de/a)ttaches */ /*flags for the client struct: */ #define I2C_CLIENT_ALLOW_USE 0x01 /* Client allows access */ diff --git a/sound/oss/dmasound/dac3550a.c b/sound/oss/dmasound/dac3550a.c index 533895e..3402a66 100644 --- a/sound/oss/dmasound/dac3550a.c +++ b/sound/oss/dmasound/dac3550a.c @@ -44,7 +44,6 @@ struct i2c_driver daca_driver = { .owner = THIS_MODULE, .name = "DAC3550A driver V " DACA_VERSION, .id = I2C_DRIVERID_DACA, - .flags = I2C_DF_NOTIFY, .attach_adapter = daca_attach_adapter, .detach_client = daca_detach_client, }; diff --git a/sound/oss/dmasound/tas_common.c b/sound/oss/dmasound/tas_common.c index d36a1fe..7e3d517 100644 --- a/sound/oss/dmasound/tas_common.c +++ b/sound/oss/dmasound/tas_common.c @@ -49,7 +49,6 @@ static int tas_detach_client(struct i2c_client *); struct i2c_driver tas_driver = { .owner = THIS_MODULE, .name = "tas", - .flags = I2C_DF_NOTIFY, .attach_adapter = tas_attach_adapter, .detach_client = tas_detach_client, }; diff --git a/sound/ppc/keywest.c b/sound/ppc/keywest.c index 097fbcf..fd8e2e6 100644 --- a/sound/ppc/keywest.c +++ b/sound/ppc/keywest.c @@ -43,7 +43,6 @@ static int keywest_detach_client(struct i2c_client *client); struct i2c_driver keywest_driver = { .name = "PMac Keywest Audio", .id = I2C_DRIVERID_KEYWEST, - .flags = I2C_DF_NOTIFY, .attach_adapter = &keywest_attach_adapter, .detach_client = &keywest_detach_client, }; -- cgit v1.1 From 5d7b851dcced3611e4a4432308618b1ed1a9fc31 Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Sun, 27 Nov 2005 08:57:10 +0100 Subject: [PATCH] i2c: Drop i2c_driver.flags, 3 of 3 The flags member of the i2c_driver structure is no more used. Drop it. Signed-off-by: Jean Delvare Signed-off-by: Greg Kroah-Hartman --- include/linux/i2c.h | 3 --- 1 file changed, 3 deletions(-) diff --git a/include/linux/i2c.h b/include/linux/i2c.h index 99399fa..3c16a8f 100644 --- a/include/linux/i2c.h +++ b/include/linux/i2c.h @@ -112,7 +112,6 @@ struct i2c_driver { char name[32]; int id; unsigned int class; - unsigned int flags; /* div., see below */ /* Notifies the driver that a new bus has appeared. This routine * can be used by the driver to test if the bus meets its conditions @@ -250,8 +249,6 @@ static inline void i2c_set_adapdata (struct i2c_adapter *dev, void *data) dev_set_drvdata (&dev->dev, data); } -/*flags for the driver struct: */ - /*flags for the client struct: */ #define I2C_CLIENT_ALLOW_USE 0x01 /* Client allows access */ #define I2C_CLIENT_ALLOW_MULTIPLE_USE 0x02 /* Allow multiple access-locks */ -- cgit v1.1 From cb748fb20186d4b345c68a7f580429f379fdd268 Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Sat, 26 Nov 2005 20:58:35 +0100 Subject: [PATCH] i2c: Rework client usage count, 1 of 3 No i2c client uses the I2C_CLIENT_ALLOW_MULTIPLE_USE flag, drop it. Signed-off-by: Jean Delvare Signed-off-by: Greg Kroah-Hartman --- drivers/i2c/i2c-core.c | 4 +--- include/linux/i2c.h | 2 -- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c index ad68ac0..2f0bc95 100644 --- a/drivers/i2c/i2c-core.c +++ b/drivers/i2c/i2c-core.c @@ -500,9 +500,7 @@ int i2c_use_client(struct i2c_client *client) return ret; if (client->flags & I2C_CLIENT_ALLOW_USE) { - if (client->flags & I2C_CLIENT_ALLOW_MULTIPLE_USE) - client->usage_count++; - else if (client->usage_count > 0) + if (client->usage_count > 0) goto busy; else client->usage_count++; diff --git a/include/linux/i2c.h b/include/linux/i2c.h index 3c16a8f..4487c51 100644 --- a/include/linux/i2c.h +++ b/include/linux/i2c.h @@ -251,8 +251,6 @@ static inline void i2c_set_adapdata (struct i2c_adapter *dev, void *data) /*flags for the client struct: */ #define I2C_CLIENT_ALLOW_USE 0x01 /* Client allows access */ -#define I2C_CLIENT_ALLOW_MULTIPLE_USE 0x02 /* Allow multiple access-locks */ - /* on an i2c_client */ #define I2C_CLIENT_PEC 0x04 /* Use Packet Error Checking */ #define I2C_CLIENT_TEN 0x10 /* we have a ten bit chip address */ /* Must equal I2C_M_TEN below */ -- cgit v1.1 From cde7859bda0d1124392b44e50aa11df99707e1d9 Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Sat, 26 Nov 2005 21:00:54 +0100 Subject: [PATCH] i2c: Rework client usage count, 2 of 3 Make I2C_CLIENT_ALLOW_USE the default for all i2c clients. It doesn't hurt if the usage count is actually never used for any given driver, and allows for nice code simplifications in i2c-core. Signed-off-by: Jean Delvare Signed-off-by: Greg Kroah-Hartman --- arch/arm/mach-pxa/akita-ioexp.c | 1 - drivers/i2c/chips/rtc8564.c | 1 - drivers/i2c/i2c-core.c | 28 ++++++++++------------------ drivers/media/video/adv7170.c | 1 - drivers/media/video/adv7175.c | 1 - drivers/media/video/bt819.c | 1 - drivers/media/video/bt832.c | 1 - drivers/media/video/bt856.c | 1 - drivers/media/video/cs53l32a.c | 1 - drivers/media/video/cx25840/cx25840-core.c | 1 - drivers/media/video/em28xx/em28xx-i2c.c | 1 - drivers/media/video/msp3400.c | 1 - drivers/media/video/saa6588.c | 1 - drivers/media/video/saa7110.c | 1 - drivers/media/video/saa7111.c | 1 - drivers/media/video/saa7114.c | 1 - drivers/media/video/saa7115.c | 1 - drivers/media/video/saa711x.c | 1 - drivers/media/video/saa7127.c | 1 - drivers/media/video/saa7134/saa6752hs.c | 1 - drivers/media/video/saa7185.c | 1 - drivers/media/video/tda9887.c | 1 - drivers/media/video/tuner-core.c | 1 - drivers/media/video/tvaudio.c | 1 - drivers/media/video/tveeprom.c | 1 - drivers/media/video/tvp5150.c | 1 - drivers/media/video/vpx3220.c | 1 - drivers/media/video/wm8775.c | 1 - include/linux/i2c.h | 1 - 29 files changed, 10 insertions(+), 46 deletions(-) diff --git a/arch/arm/mach-pxa/akita-ioexp.c b/arch/arm/mach-pxa/akita-ioexp.c index 440ebb3..b6bff55 100644 --- a/arch/arm/mach-pxa/akita-ioexp.c +++ b/arch/arm/mach-pxa/akita-ioexp.c @@ -133,7 +133,6 @@ static struct i2c_driver max7310_i2c_driver = { static struct i2c_client max7310_template = { name: "akita-max7310", - flags: I2C_CLIENT_ALLOW_USE, driver: &max7310_i2c_driver, }; diff --git a/drivers/i2c/chips/rtc8564.c b/drivers/i2c/chips/rtc8564.c index e586f75..07494d3 100644 --- a/drivers/i2c/chips/rtc8564.c +++ b/drivers/i2c/chips/rtc8564.c @@ -155,7 +155,6 @@ static int rtc8564_attach(struct i2c_adapter *adap, int addr, int kind) strlcpy(new_client->name, "RTC8564", I2C_NAME_SIZE); i2c_set_clientdata(new_client, d); - new_client->flags = I2C_CLIENT_ALLOW_USE; new_client->addr = addr; new_client->adapter = adap; new_client->driver = &rtc8564_driver; diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c index 2f0bc95..d16b499 100644 --- a/drivers/i2c/i2c-core.c +++ b/drivers/i2c/i2c-core.c @@ -419,8 +419,7 @@ int i2c_attach_client(struct i2c_client *client) } } - if (client->flags & I2C_CLIENT_ALLOW_USE) - client->usage_count = 0; + client->usage_count = 0; client->dev.parent = &client->adapter->dev; client->dev.driver = &client->driver->driver; @@ -443,8 +442,7 @@ int i2c_detach_client(struct i2c_client *client) struct i2c_adapter *adapter = client->adapter; int res = 0; - if ((client->flags & I2C_CLIENT_ALLOW_USE) - && (client->usage_count > 0)) { + if (client->usage_count > 0) { dev_warn(&client->dev, "Client [%s] still busy, " "can't detach\n", client->name); return -EBUSY; @@ -499,12 +497,9 @@ int i2c_use_client(struct i2c_client *client) if (ret) return ret; - if (client->flags & I2C_CLIENT_ALLOW_USE) { - if (client->usage_count > 0) - goto busy; - else - client->usage_count++; - } + if (client->usage_count > 0) + goto busy; + client->usage_count++; return 0; busy: @@ -514,16 +509,13 @@ int i2c_use_client(struct i2c_client *client) int i2c_release_client(struct i2c_client *client) { - if(client->flags & I2C_CLIENT_ALLOW_USE) { - if(client->usage_count>0) - client->usage_count--; - else { - pr_debug("i2c-core: %s used one too many times\n", - __FUNCTION__); - return -EPERM; - } + if (!client->usage_count) { + pr_debug("i2c-core: %s used one too many times\n", + __FUNCTION__); + return -EPERM; } + client->usage_count--; i2c_dec_use_client(client); return 0; diff --git a/drivers/media/video/adv7170.c b/drivers/media/video/adv7170.c index c4f2265..622b161 100644 --- a/drivers/media/video/adv7170.c +++ b/drivers/media/video/adv7170.c @@ -420,7 +420,6 @@ adv7170_detect_client (struct i2c_adapter *adapter, client->addr = address; client->adapter = adapter; client->driver = &i2c_driver_adv7170; - client->flags = I2C_CLIENT_ALLOW_USE; if ((client->addr == I2C_ADV7170 >> 1) || (client->addr == (I2C_ADV7170 >> 1) + 1)) { dname = adv7170_name; diff --git a/drivers/media/video/adv7175.c b/drivers/media/video/adv7175.c index 4fc08b1..d4859b4 100644 --- a/drivers/media/video/adv7175.c +++ b/drivers/media/video/adv7175.c @@ -470,7 +470,6 @@ adv7175_detect_client (struct i2c_adapter *adapter, client->addr = address; client->adapter = adapter; client->driver = &i2c_driver_adv7175; - client->flags = I2C_CLIENT_ALLOW_USE; if ((client->addr == I2C_ADV7175 >> 1) || (client->addr == (I2C_ADV7175 >> 1) + 1)) { dname = adv7175_name; diff --git a/drivers/media/video/bt819.c b/drivers/media/video/bt819.c index 7bba697..741e59a 100644 --- a/drivers/media/video/bt819.c +++ b/drivers/media/video/bt819.c @@ -535,7 +535,6 @@ bt819_detect_client (struct i2c_adapter *adapter, client->addr = address; client->adapter = adapter; client->driver = &i2c_driver_bt819; - client->flags = I2C_CLIENT_ALLOW_USE; decoder = kmalloc(sizeof(struct bt819), GFP_KERNEL); if (decoder == NULL) { diff --git a/drivers/media/video/bt832.c b/drivers/media/video/bt832.c index 0ba8652..4ed13860 100644 --- a/drivers/media/video/bt832.c +++ b/drivers/media/video/bt832.c @@ -240,7 +240,6 @@ static struct i2c_driver driver = { static struct i2c_client client_template = { .name = "bt832", - .flags = I2C_CLIENT_ALLOW_USE, .driver = &driver, }; diff --git a/drivers/media/video/bt856.c b/drivers/media/video/bt856.c index 4c9acd1..d4bba8e 100644 --- a/drivers/media/video/bt856.c +++ b/drivers/media/video/bt856.c @@ -323,7 +323,6 @@ bt856_detect_client (struct i2c_adapter *adapter, client->addr = address; client->adapter = adapter; client->driver = &i2c_driver_bt856; - client->flags = I2C_CLIENT_ALLOW_USE; strlcpy(I2C_NAME(client), "bt856", sizeof(I2C_NAME(client))); encoder = kmalloc(sizeof(struct bt856), GFP_KERNEL); diff --git a/drivers/media/video/cs53l32a.c b/drivers/media/video/cs53l32a.c index fce5d89..f442ce3 100644 --- a/drivers/media/video/cs53l32a.c +++ b/drivers/media/video/cs53l32a.c @@ -154,7 +154,6 @@ static int cs53l32a_attach(struct i2c_adapter *adapter, int address, int kind) client->addr = address; client->adapter = adapter; client->driver = &i2c_driver; - client->flags = I2C_CLIENT_ALLOW_USE; snprintf(client->name, sizeof(client->name) - 1, "cs53l32a"); cs53l32a_info("chip found @ 0x%x (%s)\n", address << 1, adapter->name); diff --git a/drivers/media/video/cx25840/cx25840-core.c b/drivers/media/video/cx25840/cx25840-core.c index c66bc14..0b278ab 100644 --- a/drivers/media/video/cx25840/cx25840-core.c +++ b/drivers/media/video/cx25840/cx25840-core.c @@ -773,7 +773,6 @@ static int cx25840_detect_client(struct i2c_adapter *adapter, int address, client->addr = address; client->adapter = adapter; client->driver = &i2c_driver_cx25840; - client->flags = I2C_CLIENT_ALLOW_USE; snprintf(client->name, sizeof(client->name) - 1, "cx25840"); cx25840_dbg("detecting cx25840 client on address 0x%x\n", address << 1); diff --git a/drivers/media/video/em28xx/em28xx-i2c.c b/drivers/media/video/em28xx/em28xx-i2c.c index 7f56030..d14bcf4 100644 --- a/drivers/media/video/em28xx/em28xx-i2c.c +++ b/drivers/media/video/em28xx/em28xx-i2c.c @@ -497,7 +497,6 @@ static struct i2c_adapter em28xx_adap_template = { static struct i2c_client em28xx_client_template = { .name = "em28xx internal", - .flags = I2C_CLIENT_ALLOW_USE, }; /* ----------------------------------------------------------- */ diff --git a/drivers/media/video/msp3400.c b/drivers/media/video/msp3400.c index 46328fb..c5e8ad3 100644 --- a/drivers/media/video/msp3400.c +++ b/drivers/media/video/msp3400.c @@ -1576,7 +1576,6 @@ static struct i2c_driver driver = { static struct i2c_client client_template = { .name = "(unset)", - .flags = I2C_CLIENT_ALLOW_USE, .driver = &driver, }; diff --git a/drivers/media/video/saa6588.c b/drivers/media/video/saa6588.c index 18a0b71..3d4076c 100644 --- a/drivers/media/video/saa6588.c +++ b/drivers/media/video/saa6588.c @@ -505,7 +505,6 @@ static struct i2c_driver driver = { static struct i2c_client client_template = { .name = "saa6588", - .flags = I2C_CLIENT_ALLOW_USE, .driver = &driver, }; diff --git a/drivers/media/video/saa7110.c b/drivers/media/video/saa7110.c index f266b35..8affa63 100644 --- a/drivers/media/video/saa7110.c +++ b/drivers/media/video/saa7110.c @@ -501,7 +501,6 @@ saa7110_detect_client (struct i2c_adapter *adapter, client->addr = address; client->adapter = adapter; client->driver = &i2c_driver_saa7110; - client->flags = I2C_CLIENT_ALLOW_USE; strlcpy(I2C_NAME(client), "saa7110", sizeof(I2C_NAME(client))); decoder = kmalloc(sizeof(struct saa7110), GFP_KERNEL); diff --git a/drivers/media/video/saa7111.c b/drivers/media/video/saa7111.c index 687beaf..2b22045 100644 --- a/drivers/media/video/saa7111.c +++ b/drivers/media/video/saa7111.c @@ -518,7 +518,6 @@ saa7111_detect_client (struct i2c_adapter *adapter, client->addr = address; client->adapter = adapter; client->driver = &i2c_driver_saa7111; - client->flags = I2C_CLIENT_ALLOW_USE; strlcpy(I2C_NAME(client), "saa7111", sizeof(I2C_NAME(client))); decoder = kmalloc(sizeof(struct saa7111), GFP_KERNEL); diff --git a/drivers/media/video/saa7114.c b/drivers/media/video/saa7114.c index 4748cf0..285f6c7 100644 --- a/drivers/media/video/saa7114.c +++ b/drivers/media/video/saa7114.c @@ -859,7 +859,6 @@ saa7114_detect_client (struct i2c_adapter *adapter, client->addr = address; client->adapter = adapter; client->driver = &i2c_driver_saa7114; - client->flags = I2C_CLIENT_ALLOW_USE; strlcpy(I2C_NAME(client), "saa7114", sizeof(I2C_NAME(client))); decoder = kmalloc(sizeof(struct saa7114), GFP_KERNEL); diff --git a/drivers/media/video/saa7115.c b/drivers/media/video/saa7115.c index b1079de..79aadd2 100644 --- a/drivers/media/video/saa7115.c +++ b/drivers/media/video/saa7115.c @@ -1270,7 +1270,6 @@ static int saa7115_attach(struct i2c_adapter *adapter, int address, int kind) client->addr = address; client->adapter = adapter; client->driver = &i2c_driver_saa7115; - client->flags = I2C_CLIENT_ALLOW_USE; snprintf(client->name, sizeof(client->name) - 1, "saa7115"); saa7115_dbg("detecting saa7115 client on address 0x%x\n", address << 1); diff --git a/drivers/media/video/saa711x.c b/drivers/media/video/saa711x.c index 734a709..44bfc04 100644 --- a/drivers/media/video/saa711x.c +++ b/drivers/media/video/saa711x.c @@ -494,7 +494,6 @@ saa711x_detect_client (struct i2c_adapter *adapter, client->addr = address; client->adapter = adapter; client->driver = &i2c_driver_saa711x; - client->flags = I2C_CLIENT_ALLOW_USE; strlcpy(I2C_NAME(client), "saa711x", sizeof(I2C_NAME(client))); decoder = kmalloc(sizeof(struct saa711x), GFP_KERNEL); if (decoder == NULL) { diff --git a/drivers/media/video/saa7127.c b/drivers/media/video/saa7127.c index a2fab98..1f4b415 100644 --- a/drivers/media/video/saa7127.c +++ b/drivers/media/video/saa7127.c @@ -719,7 +719,6 @@ static int saa7127_attach(struct i2c_adapter *adapter, int address, int kind) client->addr = address; client->adapter = adapter; client->driver = &i2c_driver_saa7127; - client->flags = I2C_CLIENT_ALLOW_USE; snprintf(client->name, sizeof(client->name) - 1, "saa7127"); saa7127_dbg("detecting saa7127 client on address 0x%x\n", address << 1); diff --git a/drivers/media/video/saa7134/saa6752hs.c b/drivers/media/video/saa7134/saa6752hs.c index 6fc298e..6820606 100644 --- a/drivers/media/video/saa7134/saa6752hs.c +++ b/drivers/media/video/saa7134/saa6752hs.c @@ -608,7 +608,6 @@ static struct i2c_driver driver = { static struct i2c_client client_template = { .name = "saa6752hs", - .flags = I2C_CLIENT_ALLOW_USE, .driver = &driver, }; diff --git a/drivers/media/video/saa7185.c b/drivers/media/video/saa7185.c index e24aa16..9f37585 100644 --- a/drivers/media/video/saa7185.c +++ b/drivers/media/video/saa7185.c @@ -415,7 +415,6 @@ saa7185_detect_client (struct i2c_adapter *adapter, client->addr = address; client->adapter = adapter; client->driver = &i2c_driver_saa7185; - client->flags = I2C_CLIENT_ALLOW_USE; strlcpy(I2C_NAME(client), "saa7185", sizeof(I2C_NAME(client))); encoder = kmalloc(sizeof(struct saa7185), GFP_KERNEL); diff --git a/drivers/media/video/tda9887.c b/drivers/media/video/tda9887.c index 049b44e..324f61b 100644 --- a/drivers/media/video/tda9887.c +++ b/drivers/media/video/tda9887.c @@ -833,7 +833,6 @@ static struct i2c_driver driver = { static struct i2c_client client_template = { .name = "tda9887", - .flags = I2C_CLIENT_ALLOW_USE, .driver = &driver, }; diff --git a/drivers/media/video/tuner-core.c b/drivers/media/video/tuner-core.c index 3c75121..6328f09 100644 --- a/drivers/media/video/tuner-core.c +++ b/drivers/media/video/tuner-core.c @@ -755,7 +755,6 @@ static struct i2c_driver driver = { }; static struct i2c_client client_template = { .name = "(tuner unset)", - .flags = I2C_CLIENT_ALLOW_USE, .driver = &driver, }; diff --git a/drivers/media/video/tvaudio.c b/drivers/media/video/tvaudio.c index 3565f35..4f1f339 100644 --- a/drivers/media/video/tvaudio.c +++ b/drivers/media/video/tvaudio.c @@ -1713,7 +1713,6 @@ static struct i2c_driver driver = { static struct i2c_client client_template = { .name = "(unset)", - .flags = I2C_CLIENT_ALLOW_USE, .driver = &driver, }; diff --git a/drivers/media/video/tveeprom.c b/drivers/media/video/tveeprom.c index 195bc51..d833b65 100644 --- a/drivers/media/video/tveeprom.c +++ b/drivers/media/video/tveeprom.c @@ -751,7 +751,6 @@ tveeprom_detect_client(struct i2c_adapter *adapter, client->addr = address; client->adapter = adapter; client->driver = &i2c_driver_tveeprom; - client->flags = I2C_CLIENT_ALLOW_USE; snprintf(client->name, sizeof(client->name), "tveeprom"); i2c_attach_client(client); diff --git a/drivers/media/video/tvp5150.c b/drivers/media/video/tvp5150.c index 4f3ee20..3734554 100644 --- a/drivers/media/video/tvp5150.c +++ b/drivers/media/video/tvp5150.c @@ -714,7 +714,6 @@ static struct i2c_driver driver; static struct i2c_client client_template = { .name = "(unset)", - .flags = I2C_CLIENT_ALLOW_USE, .driver = &driver, }; diff --git a/drivers/media/video/vpx3220.c b/drivers/media/video/vpx3220.c index c66d285..54bc888 100644 --- a/drivers/media/video/vpx3220.c +++ b/drivers/media/video/vpx3220.c @@ -631,7 +631,6 @@ vpx3220_detect_client (struct i2c_adapter *adapter, client->addr = address; client->adapter = adapter; client->driver = &vpx3220_i2c_driver; - client->flags = I2C_CLIENT_ALLOW_USE; /* Check for manufacture ID and part number */ if (kind < 0) { diff --git a/drivers/media/video/wm8775.c b/drivers/media/video/wm8775.c index 7b07717..527c2591 100644 --- a/drivers/media/video/wm8775.c +++ b/drivers/media/video/wm8775.c @@ -168,7 +168,6 @@ static int wm8775_attach(struct i2c_adapter *adapter, int address, int kind) client->addr = address; client->adapter = adapter; client->driver = &i2c_driver; - client->flags = I2C_CLIENT_ALLOW_USE; snprintf(client->name, sizeof(client->name) - 1, "wm8775"); wm8775_info("chip found @ 0x%x (%s)\n", address << 1, adapter->name); diff --git a/include/linux/i2c.h b/include/linux/i2c.h index 4487c51..8b4d469 100644 --- a/include/linux/i2c.h +++ b/include/linux/i2c.h @@ -250,7 +250,6 @@ static inline void i2c_set_adapdata (struct i2c_adapter *dev, void *data) } /*flags for the client struct: */ -#define I2C_CLIENT_ALLOW_USE 0x01 /* Client allows access */ #define I2C_CLIENT_PEC 0x04 /* Use Packet Error Checking */ #define I2C_CLIENT_TEN 0x10 /* we have a ten bit chip address */ /* Must equal I2C_M_TEN below */ -- cgit v1.1 From cf02df770228350254251fde520007a2709db785 Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Sat, 26 Nov 2005 21:03:41 +0100 Subject: [PATCH] i2c: Rework client usage count, 3 of 3 Do not limit the usage count of i2c clients to 1. In other words, change the client usage count behavior from the old I2C_CLIENT_ALLOW_USE to the old I2C_CLIENT_ALLOW_MULTIPLE_USE. The rationale is that no driver actually needs the limiting behavior, and the unlimiting behavior is slightly easier to implement. Update the documentation to reflect this change. Signed-off-by: Jean Delvare Signed-off-by: Greg Kroah-Hartman --- Documentation/i2c/porting-clients | 1 + drivers/i2c/i2c-core.c | 5 ----- include/linux/i2c.h | 4 +--- 3 files changed, 2 insertions(+), 8 deletions(-) diff --git a/Documentation/i2c/porting-clients b/Documentation/i2c/porting-clients index 64c610b..6b07f23 100644 --- a/Documentation/i2c/porting-clients +++ b/Documentation/i2c/porting-clients @@ -92,6 +92,7 @@ Technical changes: Drop client->id. Drop any 24RF08 corruption prevention you find, as this is now done at the i2c-core level, and doing it twice voids it. + Don't add I2C_CLIENT_ALLOW_USE to client->flags, it's the default now. * [Init] Limits must not be set by the driver (can be done later in user-space). Chip should not be reset default (although a module diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c index d16b499..a1c5dff 100644 --- a/drivers/i2c/i2c-core.c +++ b/drivers/i2c/i2c-core.c @@ -497,14 +497,9 @@ int i2c_use_client(struct i2c_client *client) if (ret) return ret; - if (client->usage_count > 0) - goto busy; client->usage_count++; return 0; - busy: - i2c_dec_use_client(client); - return -EBUSY; } int i2c_release_client(struct i2c_client *client) diff --git a/include/linux/i2c.h b/include/linux/i2c.h index 8b4d469..85c517a 100644 --- a/include/linux/i2c.h +++ b/include/linux/i2c.h @@ -307,9 +307,7 @@ extern struct i2c_client *i2c_get_client(int driver_id, int adapter_id, extern struct i2c_client *i2c_get_client(int,int,struct i2c_client *); to make sure that client-struct is valid and that it is okay to access the i2c-client. - returns -EACCES if client doesn't allow use (default) - returns -EBUSY if client doesn't allow multiple use (default) and - usage_count >0 */ + returns -ENODEV if client has gone in the meantime */ extern int i2c_use_client(struct i2c_client *); extern int i2c_release_client(struct i2c_client *); -- cgit v1.1 From 92b429461228f0f06a994dd3d4ccf1c9ff7596bd Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Sat, 26 Nov 2005 21:05:17 +0100 Subject: [PATCH] i2c: Chip driver porting guide update Update Documentation/i2c/porting-clients. Many recent changes to the i2c and hwmon subsystems were never reported there. Signed-off-by: Jean Delvare Signed-off-by: Greg Kroah-Hartman --- Documentation/i2c/porting-clients | 79 ++++++++++++++++++++++----------------- 1 file changed, 44 insertions(+), 35 deletions(-) diff --git a/Documentation/i2c/porting-clients b/Documentation/i2c/porting-clients index 6b07f23..856274f 100644 --- a/Documentation/i2c/porting-clients +++ b/Documentation/i2c/porting-clients @@ -1,10 +1,13 @@ -Revision 5, 2005-07-29 +Revision 6, 2005-11-20 Jean Delvare Greg KH This is a guide on how to convert I2C chip drivers from Linux 2.4 to Linux 2.6. I have been using existing drivers (lm75, lm78) as examples. Then I converted a driver myself (lm83) and updated this document. +Note that this guide is strongly oriented towards hardware monitoring +drivers. Many points are still valid for other type of drivers, but +others may be irrelevant. There are two sets of points below. The first set concerns technical changes. The second set concerns coding policy. Both are mandatory. @@ -22,16 +25,20 @@ Technical changes: #include #include #include + #include #include + #include /* for ISA drivers */ #include /* for hardware monitoring drivers */ #include #include /* if you need VRM support */ + #include /* for class registration */ #include /* if you have I/O operations */ Please respect this inclusion order. Some extra headers may be required for a given driver (e.g. "lm75.h"). * [Addresses] SENSORS_I2C_END becomes I2C_CLIENT_END, ISA addresses - are no more handled by the i2c core. + are no more handled by the i2c core. Address ranges are no more + supported either, define each individual address separately. SENSORS_INSMOD_ becomes I2C_CLIENT_INSMOD_. * [Client data] Get rid of sysctl_id. Try using standard names for @@ -48,23 +55,23 @@ Technical changes: int kind); static void lm75_init_client(struct i2c_client *client); static int lm75_detach_client(struct i2c_client *client); - static void lm75_update_client(struct i2c_client *client); + static struct lm75_data lm75_update_device(struct device *dev); * [Sysctl] All sysctl stuff is of course gone (defines, ctl_table and functions). Instead, you have to define show and set functions for each sysfs file. Only define set for writable values. Take a look at an - existing 2.6 driver for details (lm78 for example). Don't forget + existing 2.6 driver for details (it87 for example). Don't forget to define the attributes for each file (this is that step that links callback functions). Use the file names specified in - Documentation/i2c/sysfs-interface for the individual files. Also + Documentation/hwmon/sysfs-interface for the individual files. Also convert the units these files read and write to the specified ones. If you need to add a new type of file, please discuss it on the sensors mailing list by providing a - patch to the Documentation/i2c/sysfs-interface file. + patch to the Documentation/hwmon/sysfs-interface file. * [Attach] For I2C drivers, the attach function should make sure - that the adapter's class has I2C_CLASS_HWMON, using the - following construct: + that the adapter's class has I2C_CLASS_HWMON (or whatever class is + suitable for your driver), using the following construct: if (!(adapter->class & I2C_CLASS_HWMON)) return 0; ISA-only drivers of course don't need this. @@ -72,23 +79,23 @@ Technical changes: * [Detect] As mentioned earlier, the flags parameter is gone. The type_name and client_name strings are replaced by a single - name string, which will be filled with a lowercase, short string - (typically the driver name, e.g. "lm75"). + name string, which will be filled with a lowercase, short string. In i2c-only drivers, drop the i2c_is_isa_adapter check, it's useless. Same for isa-only drivers, as the test would always be true. Only hybrid drivers (which are quite rare) still need it. - The errorN labels are reduced to the number needed. If that number - is 2 (i2c-only drivers), it is advised that the labels are named - exit and exit_free. For i2c+isa drivers, labels should be named - ERROR0, ERROR1 and ERROR2. Don't forget to properly set err before + The labels used for error paths are reduced to the number needed. + It is advised that the labels are given descriptive names such as + exit and exit_free. Don't forget to properly set err before jumping to error labels. By the way, labels should be left-aligned. Use kzalloc instead of kmalloc. Use i2c_set_clientdata to set the client data (as opposed to a direct access to client->data). - Use strlcpy instead of strcpy to copy the client name. + Use strlcpy instead of strcpy or snprintf to copy the client name. Replace the sysctl directory registration by calls to device_create_file. Move the driver initialization before any sysfs file creation. + Register the client with the hwmon class (using hwmon_device_register) + if applicable. Drop client->id. Drop any 24RF08 corruption prevention you find, as this is now done at the i2c-core level, and doing it twice voids it. @@ -96,19 +103,25 @@ Technical changes: * [Init] Limits must not be set by the driver (can be done later in user-space). Chip should not be reset default (although a module - parameter may be used to force is), and initialization should be + parameter may be used to force it), and initialization should be limited to the strictly necessary steps. -* [Detach] Get rid of data, remove the call to - i2c_deregister_entry. Do not log an error message if - i2c_detach_client fails, as i2c-core will now do it for you. +* [Detach] Remove the call to i2c_deregister_entry. Do not log an + error message if i2c_detach_client fails, as i2c-core will now do + it for you. + Unregister from the hwmon class if applicable. -* [Update] Don't access client->data directly, use - i2c_get_clientdata(client) instead. +* [Update] The function prototype changed, it is now + passed a device structure, which you have to convert to a client + using to_i2c_client(dev). The update function should return a + pointer to the client data. + Don't access client->data directly, use i2c_get_clientdata(client) + instead. + Use time_after() instead of direct jiffies comparison. -* [Interface] Init function should not print anything. Make sure - there is a MODULE_LICENSE() line, at the bottom of the file - (after MODULE_AUTHOR() and MODULE_DESCRIPTION(), in this order). +* [Interface] Make sure 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. @@ -118,21 +131,17 @@ Coding policy: * [Copyright] Use (C), not (c), for copyright. * [Debug/log] Get rid of #ifdef DEBUG/#endif constructs whenever you - can. Calls to printk/pr_debug for debugging purposes are replaced - by calls to dev_dbg. Here is an example on how to call it (taken - from lm75_detect): + can. Calls to printk for debugging purposes are replaced by calls to + dev_dbg where possible, else to pr_debug. Here is an example of how + to call it (taken from lm75_detect): dev_dbg(&client->dev, "Starting lm75 update\n"); Replace other printk calls with the dev_info, dev_err or dev_warn function, as appropriate. -* [Constants] Constants defines (registers, conversions, initial - values) should be aligned. This greatly improves readability. - Same goes for variables declarations. Alignments are achieved by the - means of tabs, not spaces. Remember that tabs are set to 8 in the - Linux kernel code. - -* [Structure definition] The name field should be standardized. All - lowercase and as simple as the driver name itself (e.g. "lm75"). +* [Constants] Constants defines (registers, conversions) should be + aligned. This greatly improves readability. + Alignments are achieved by the means of tabs, not spaces. Remember + that tabs are set to 8 in the Linux kernel code. * [Layout] Avoid extra empty lines between comments and what they comment. Respect the coding style (see Documentation/CodingStyle), -- cgit v1.1 From 482c788ded0aa9710722eaf9cf60886d3b923218 Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Sat, 26 Nov 2005 21:06:08 +0100 Subject: [PATCH] i2c: i2c_get_client is gone The i2c_get_client function doesn't exist anymore, so we shouldn't have a definition for it in i2c.h. Signed-off-by: Jean Delvare Signed-off-by: Greg Kroah-Hartman --- include/linux/i2c.h | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/include/linux/i2c.h b/include/linux/i2c.h index 85c517a..a9cea62 100644 --- a/include/linux/i2c.h +++ b/include/linux/i2c.h @@ -296,17 +296,8 @@ extern int i2c_del_driver(struct i2c_driver *); extern int i2c_attach_client(struct i2c_client *); extern int i2c_detach_client(struct i2c_client *); -/* New function: This is to get an i2c_client-struct for controlling the - client either by using i2c_control-function or having the - client-module export functions that can be used with the i2c_client - -struct. */ -extern struct i2c_client *i2c_get_client(int driver_id, int adapter_id, - struct i2c_client *prev); - -/* Should be used with new function - extern struct i2c_client *i2c_get_client(int,int,struct i2c_client *); - to make sure that client-struct is valid and that it is okay to access - the i2c-client. +/* Should be used to make sure that client-struct is valid and that it + is okay to access the i2c-client. returns -ENODEV if client has gone in the meantime */ extern int i2c_use_client(struct i2c_client *); extern int i2c_release_client(struct i2c_client *); -- cgit v1.1 From 35d8b2e6b8e86b0d5126f36613b5202d4eb978b6 Mon Sep 17 00:00:00 2001 From: Laurent Riffard Date: Sat, 26 Nov 2005 20:34:05 +0100 Subject: [PATCH] i2c: Drop i2c_driver.{owner,name}, 1 of 11 We should use the i2c_driver.driver's .name and .owner fields instead of the i2c_driver's ones. This patch updates the core of the i2c drivers: it removes .name and .owner fields from the struct i2c_device and modify various functions to use struct device fields instead. Signed-off-by: Laurent Riffard Signed-off-by: Jean Delvare Signed-off-by: Greg Kroah-Hartman --- drivers/i2c/busses/i2c-isa.c | 4 +--- drivers/i2c/i2c-core.c | 22 +++++++++++----------- drivers/i2c/i2c-dev.c | 6 ++++-- include/linux/i2c.h | 5 +++-- 4 files changed, 19 insertions(+), 18 deletions(-) diff --git a/drivers/i2c/busses/i2c-isa.c b/drivers/i2c/busses/i2c-isa.c index 03672c9..9f93fb8 100644 --- a/drivers/i2c/busses/i2c-isa.c +++ b/drivers/i2c/busses/i2c-isa.c @@ -92,8 +92,6 @@ int i2c_isa_add_driver(struct i2c_driver *driver) int res; /* Add the driver to the list of i2c drivers in the driver core */ - driver->driver.name = driver->name; - driver->driver.owner = driver->owner; driver->driver.bus = &i2c_bus_type; driver->driver.probe = i2c_isa_device_probe; driver->driver.remove = i2c_isa_device_remove; @@ -124,7 +122,7 @@ int i2c_isa_del_driver(struct i2c_driver *driver) if ((res = driver->detach_client(client))) { dev_err(&isa_adapter.dev, "Failed, driver " "%s not unregistered!\n", - driver->name); + driver->driver.name); return res; } } diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c index a1c5dff..4ce5f0f 100644 --- a/drivers/i2c/i2c-core.c +++ b/drivers/i2c/i2c-core.c @@ -235,7 +235,8 @@ int i2c_del_adapter(struct i2c_adapter *adap) if (driver->detach_adapter) if ((res = driver->detach_adapter(adap))) { dev_err(&adap->dev, "detach_adapter failed " - "for driver [%s]\n", driver->name); + "for driver [%s]\n", + driver->driver.name); goto out_unlock; } } @@ -295,8 +296,6 @@ int i2c_add_driver(struct i2c_driver *driver) down(&core_lists); /* add the driver to the list of i2c drivers in the driver core */ - driver->driver.owner = driver->owner; - driver->driver.name = driver->name; driver->driver.bus = &i2c_bus_type; driver->driver.probe = i2c_device_probe; driver->driver.remove = i2c_device_remove; @@ -306,7 +305,7 @@ int i2c_add_driver(struct i2c_driver *driver) goto out_unlock; list_add_tail(&driver->list,&drivers); - pr_debug("i2c-core: driver [%s] registered\n", driver->name); + pr_debug("i2c-core: driver [%s] registered\n", driver->driver.name); /* now look for instances of driver on our adapters */ if (driver->attach_adapter) { @@ -344,7 +343,8 @@ int i2c_del_driver(struct i2c_driver *driver) if (driver->detach_adapter) { if ((res = driver->detach_adapter(adap))) { dev_err(&adap->dev, "detach_adapter failed " - "for driver [%s]\n", driver->name); + "for driver [%s]\n", + driver->driver.name); goto out_unlock; } } else { @@ -368,7 +368,7 @@ int i2c_del_driver(struct i2c_driver *driver) driver_unregister(&driver->driver); list_del(&driver->list); - pr_debug("i2c-core: driver [%s] unregistered\n", driver->name); + pr_debug("i2c-core: driver [%s] unregistered\n", driver->driver.name); out_unlock: up(&core_lists); @@ -473,10 +473,10 @@ int i2c_detach_client(struct i2c_client *client) static int i2c_inc_use_client(struct i2c_client *client) { - if (!try_module_get(client->driver->owner)) + if (!try_module_get(client->driver->driver.owner)) return -ENODEV; if (!try_module_get(client->adapter->owner)) { - module_put(client->driver->owner); + module_put(client->driver->driver.owner); return -ENODEV; } @@ -485,7 +485,7 @@ static int i2c_inc_use_client(struct i2c_client *client) static void i2c_dec_use_client(struct i2c_client *client) { - module_put(client->driver->owner); + module_put(client->driver->driver.owner); module_put(client->adapter->owner); } @@ -524,14 +524,14 @@ void i2c_clients_command(struct i2c_adapter *adap, unsigned int cmd, void *arg) down(&adap->clist_lock); list_for_each(item,&adap->clients) { client = list_entry(item, struct i2c_client, list); - if (!try_module_get(client->driver->owner)) + if (!try_module_get(client->driver->driver.owner)) continue; if (NULL != client->driver->command) { up(&adap->clist_lock); client->driver->command(client,cmd,arg); down(&adap->clist_lock); } - module_put(client->driver->owner); + module_put(client->driver->driver.owner); } up(&adap->clist_lock); } diff --git a/drivers/i2c/i2c-dev.c b/drivers/i2c/i2c-dev.c index 9da51eb..9715217 100644 --- a/drivers/i2c/i2c-dev.c +++ b/drivers/i2c/i2c-dev.c @@ -481,8 +481,10 @@ static int i2cdev_command(struct i2c_client *client, unsigned int cmd, } static struct i2c_driver i2cdev_driver = { - .owner = THIS_MODULE, - .name = "dev_driver", + .driver = { + .owner = THIS_MODULE, + .name = "dev_driver", + }, .id = I2C_DRIVERID_I2CDEV, .attach_adapter = i2cdev_attach_adapter, .detach_adapter = i2cdev_detach_adapter, diff --git a/include/linux/i2c.h b/include/linux/i2c.h index a9cea62..75aa18e 100644 --- a/include/linux/i2c.h +++ b/include/linux/i2c.h @@ -105,11 +105,12 @@ extern s32 i2c_smbus_read_i2c_block_data(struct i2c_client * client, * A driver is capable of handling one or more physical devices present on * I2C adapters. This information is used to inform the driver of adapter * events. + * + * The driver.owner field should be set to the module owner of this driver. + * The driver.name field should be set to the name of this driver. */ struct i2c_driver { - struct module *owner; - char name[32]; int id; unsigned int class; -- cgit v1.1 From a9718b0c1154dcbd955be6aaee47a314cde6a25a Mon Sep 17 00:00:00 2001 From: Laurent Riffard Date: Sat, 26 Nov 2005 20:36:00 +0100 Subject: [PATCH] i2c: Drop i2c_driver.{owner,name}, 2 of 11 We should use the i2c_driver.driver's .name and .owner fields instead of the i2c_driver's ones. This patch updates the miscellaneaous i2c chip drivers. Signed-off-by: Laurent Riffard Signed-off-by: Jean Delvare Signed-off-by: Greg Kroah-Hartman --- drivers/i2c/chips/ds1337.c | 6 ++++-- drivers/i2c/chips/ds1374.c | 6 ++++-- drivers/i2c/chips/eeprom.c | 6 ++++-- drivers/i2c/chips/isp1301_omap.c | 6 ++++-- drivers/i2c/chips/m41t00.c | 6 ++++-- drivers/i2c/chips/max6875.c | 6 ++++-- drivers/i2c/chips/pca9539.c | 6 ++++-- drivers/i2c/chips/pcf8574.c | 6 ++++-- drivers/i2c/chips/pcf8591.c | 6 ++++-- drivers/i2c/chips/rtc8564.c | 6 ++++-- drivers/i2c/chips/tps65010.c | 6 ++++-- drivers/i2c/chips/x1205.c | 6 ++++-- 12 files changed, 48 insertions(+), 24 deletions(-) diff --git a/drivers/i2c/chips/ds1337.c b/drivers/i2c/chips/ds1337.c index 65146cb..a9d4ac7 100644 --- a/drivers/i2c/chips/ds1337.c +++ b/drivers/i2c/chips/ds1337.c @@ -52,8 +52,10 @@ static int ds1337_command(struct i2c_client *client, unsigned int cmd, * Driver data (common to all clients) */ static struct i2c_driver ds1337_driver = { - .owner = THIS_MODULE, - .name = "ds1337", + .driver = { + .owner = THIS_MODULE, + .name = "ds1337", + }, .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 5a270d6..3e3ebd8 100644 --- a/drivers/i2c/chips/ds1374.c +++ b/drivers/i2c/chips/ds1374.c @@ -232,8 +232,10 @@ static int ds1374_detach(struct i2c_client *client) } static struct i2c_driver ds1374_driver = { - .owner = THIS_MODULE, - .name = DS1374_DRV_NAME, + .driver = { + .owner = THIS_MODULE, + .name = DS1374_DRV_NAME, + }, .id = I2C_DRIVERID_DS1374, .attach_adapter = ds1374_attach, .detach_client = ds1374_detach, diff --git a/drivers/i2c/chips/eeprom.c b/drivers/i2c/chips/eeprom.c index 9bb1f8b..d0c9f29 100644 --- a/drivers/i2c/chips/eeprom.c +++ b/drivers/i2c/chips/eeprom.c @@ -68,8 +68,10 @@ static int eeprom_detach_client(struct i2c_client *client); /* This is the driver that will be inserted */ static struct i2c_driver eeprom_driver = { - .owner = THIS_MODULE, - .name = "eeprom", + .driver = { + .owner = THIS_MODULE, + .name = "eeprom", + }, .id = I2C_DRIVERID_EEPROM, .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 4f472ba..9f1ec03 100644 --- a/drivers/i2c/chips/isp1301_omap.c +++ b/drivers/i2c/chips/isp1301_omap.c @@ -1632,8 +1632,10 @@ static int isp1301_scan_bus(struct i2c_adapter *bus) } static struct i2c_driver isp1301_driver = { - .owner = THIS_MODULE, - .name = "isp1301_omap", + .driver = { + .owner = THIS_MODULE, + .name = "isp1301_omap", + }, .id = 1301, /* FIXME "official", i2c-ids.h */ .class = I2C_CLASS_HWMON, .attach_adapter = isp1301_scan_bus, diff --git a/drivers/i2c/chips/m41t00.c b/drivers/i2c/chips/m41t00.c index 13e6783..92759b2 100644 --- a/drivers/i2c/chips/m41t00.c +++ b/drivers/i2c/chips/m41t00.c @@ -211,8 +211,10 @@ m41t00_detach(struct i2c_client *client) } static struct i2c_driver m41t00_driver = { - .owner = THIS_MODULE, - .name = M41T00_DRV_NAME, + .driver = { + .owner = THIS_MODULE, + .name = M41T00_DRV_NAME, + }, .id = I2C_DRIVERID_STM41T00, .attach_adapter = m41t00_attach, .detach_client = m41t00_detach, diff --git a/drivers/i2c/chips/max6875.c b/drivers/i2c/chips/max6875.c index 7e61019..3705117 100644 --- a/drivers/i2c/chips/max6875.c +++ b/drivers/i2c/chips/max6875.c @@ -67,8 +67,10 @@ static int max6875_detach_client(struct i2c_client *client); /* This is the driver that will be inserted */ static struct i2c_driver max6875_driver = { - .owner = THIS_MODULE, - .name = "max6875", + .driver = { + .owner = THIS_MODULE, + .name = "max6875", + }, .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 26feb7a..bb57faa 100644 --- a/drivers/i2c/chips/pca9539.c +++ b/drivers/i2c/chips/pca9539.c @@ -38,8 +38,10 @@ static int pca9539_detach_client(struct i2c_client *client); /* This is the driver that will be inserted */ static struct i2c_driver pca9539_driver = { - .owner = THIS_MODULE, - .name = "pca9539", + .driver = { + .owner = THIS_MODULE, + .name = "pca9539", + }, .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 2fae640..3d4d4d6 100644 --- a/drivers/i2c/chips/pcf8574.c +++ b/drivers/i2c/chips/pcf8574.c @@ -65,8 +65,10 @@ static void pcf8574_init_client(struct i2c_client *client); /* This is the driver that will be inserted */ static struct i2c_driver pcf8574_driver = { - .owner = THIS_MODULE, - .name = "pcf8574", + .driver = { + .owner = THIS_MODULE, + .name = "pcf8574", + }, .id = I2C_DRIVERID_PCF8574, .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 8750f71..8f41bb3 100644 --- a/drivers/i2c/chips/pcf8591.c +++ b/drivers/i2c/chips/pcf8591.c @@ -88,8 +88,10 @@ static int pcf8591_read_channel(struct device *dev, int channel); /* This is the driver that will be inserted */ static struct i2c_driver pcf8591_driver = { - .owner = THIS_MODULE, - .name = "pcf8591", + .driver = { + .owner = THIS_MODULE, + .name = "pcf8591", + }, .id = I2C_DRIVERID_PCF8591, .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 07494d3..6f567e2 100644 --- a/drivers/i2c/chips/rtc8564.c +++ b/drivers/i2c/chips/rtc8564.c @@ -358,8 +358,10 @@ rtc8564_command(struct i2c_client *client, unsigned int cmd, void *arg) } static struct i2c_driver rtc8564_driver = { - .owner = THIS_MODULE, - .name = "RTC8564", + .driver = { + .owner = THIS_MODULE, + .name = "RTC8564", + }, .id = I2C_DRIVERID_RTC8564, .attach_adapter = rtc8564_probe, .detach_client = rtc8564_detach, diff --git a/drivers/i2c/chips/tps65010.c b/drivers/i2c/chips/tps65010.c index 439bf6c..92947a6 100644 --- a/drivers/i2c/chips/tps65010.c +++ b/drivers/i2c/chips/tps65010.c @@ -637,8 +637,10 @@ static int __init tps65010_scan_bus(struct i2c_adapter *bus) } static struct i2c_driver tps65010_driver = { - .owner = THIS_MODULE, - .name = "tps65010", + .driver = { + .owner = THIS_MODULE, + .name = "tps65010", + }, .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 c5ff2ce..6880eab 100644 --- a/drivers/i2c/chips/x1205.c +++ b/drivers/i2c/chips/x1205.c @@ -105,8 +105,10 @@ static int x1205_command(struct i2c_client *client, unsigned int cmd, void *arg); static struct i2c_driver x1205_driver = { - .owner = THIS_MODULE, - .name = "x1205", + .driver = { + .owner = THIS_MODULE, + .name = "x1205", + }, .attach_adapter = &x1205_attach, .detach_client = &x1205_detach, }; -- cgit v1.1 From cdaf79349c7d24e1d33acb6497849c9e956a33ea Mon Sep 17 00:00:00 2001 From: Laurent Riffard Date: Sat, 26 Nov 2005 20:37:41 +0100 Subject: [PATCH] i2c: Drop i2c_driver.{owner,name}, 3 of 11 We should use the i2c_driver.driver's .name and .owner fields instead of the i2c_driver's ones. This patch updates the hwmon drivers. Signed-off-by: Laurent Riffard Signed-off-by: Jean Delvare Signed-off-by: Greg Kroah-Hartman --- drivers/hwmon/adm1021.c | 6 ++++-- drivers/hwmon/adm1025.c | 6 ++++-- drivers/hwmon/adm1026.c | 6 ++++-- drivers/hwmon/adm1031.c | 6 ++++-- drivers/hwmon/adm9240.c | 6 ++++-- drivers/hwmon/asb100.c | 6 ++++-- drivers/hwmon/atxp1.c | 6 ++++-- drivers/hwmon/ds1621.c | 6 ++++-- drivers/hwmon/fscher.c | 6 ++++-- drivers/hwmon/fscpos.c | 6 ++++-- drivers/hwmon/gl518sm.c | 6 ++++-- drivers/hwmon/gl520sm.c | 6 ++++-- drivers/hwmon/it87.c | 15 ++++++++++----- drivers/hwmon/lm63.c | 6 ++++-- drivers/hwmon/lm75.c | 6 ++++-- drivers/hwmon/lm77.c | 6 ++++-- drivers/hwmon/lm78.c | 14 +++++++++----- drivers/hwmon/lm80.c | 6 ++++-- drivers/hwmon/lm83.c | 6 ++++-- drivers/hwmon/lm85.c | 6 ++++-- drivers/hwmon/lm87.c | 6 ++++-- drivers/hwmon/lm90.c | 6 ++++-- drivers/hwmon/lm92.c | 6 ++++-- drivers/hwmon/max1619.c | 6 ++++-- drivers/hwmon/pc87360.c | 8 +++++--- drivers/hwmon/sis5595.c | 9 ++++++--- drivers/hwmon/smsc47b397.c | 9 ++++++--- drivers/hwmon/smsc47m1.c | 8 +++++--- drivers/hwmon/via686a.c | 9 ++++++--- drivers/hwmon/vt8231.c | 6 ++++-- drivers/hwmon/w83627ehf.c | 8 +++++--- drivers/hwmon/w83627hf.c | 8 +++++--- drivers/hwmon/w83781d.c | 14 +++++++++----- drivers/hwmon/w83792d.c | 6 ++++-- drivers/hwmon/w83l785ts.c | 6 ++++-- 35 files changed, 166 insertions(+), 86 deletions(-) diff --git a/drivers/hwmon/adm1021.c b/drivers/hwmon/adm1021.c index 5e6df4b..679cb92 100644 --- a/drivers/hwmon/adm1021.c +++ b/drivers/hwmon/adm1021.c @@ -126,8 +126,10 @@ static int read_only; /* This is the driver that will be inserted */ static struct i2c_driver adm1021_driver = { - .owner = THIS_MODULE, - .name = "adm1021", + .driver = { + .owner = THIS_MODULE, + .name = "adm1021", + }, .id = I2C_DRIVERID_ADM1021, .attach_adapter = adm1021_attach_adapter, .detach_client = adm1021_detach_client, diff --git a/drivers/hwmon/adm1025.c b/drivers/hwmon/adm1025.c index 2be48a7..3c70622 100644 --- a/drivers/hwmon/adm1025.c +++ b/drivers/hwmon/adm1025.c @@ -118,8 +118,10 @@ static struct adm1025_data *adm1025_update_device(struct device *dev); */ static struct i2c_driver adm1025_driver = { - .owner = THIS_MODULE, - .name = "adm1025", + .driver = { + .owner = THIS_MODULE, + .name = "adm1025", + }, .id = I2C_DRIVERID_ADM1025, .attach_adapter = adm1025_attach_adapter, .detach_client = adm1025_detach_client, diff --git a/drivers/hwmon/adm1026.c b/drivers/hwmon/adm1026.c index 5416db8..92fac34 100644 --- a/drivers/hwmon/adm1026.c +++ b/drivers/hwmon/adm1026.c @@ -308,8 +308,10 @@ static void adm1026_init_client(struct i2c_client *client); static struct i2c_driver adm1026_driver = { - .owner = THIS_MODULE, - .name = "adm1026", + .driver = { + .owner = THIS_MODULE, + .name = "adm1026", + }, .attach_adapter = adm1026_attach_adapter, .detach_client = adm1026_detach_client, }; diff --git a/drivers/hwmon/adm1031.c b/drivers/hwmon/adm1031.c index 1e244280..e42d75e 100644 --- a/drivers/hwmon/adm1031.c +++ b/drivers/hwmon/adm1031.c @@ -105,8 +105,10 @@ static struct adm1031_data *adm1031_update_device(struct device *dev); /* This is the driver that will be inserted */ static struct i2c_driver adm1031_driver = { - .owner = THIS_MODULE, - .name = "adm1031", + .driver = { + .owner = THIS_MODULE, + .name = "adm1031", + }, .attach_adapter = adm1031_attach_adapter, .detach_client = adm1031_detach_client, }; diff --git a/drivers/hwmon/adm9240.c b/drivers/hwmon/adm9240.c index 287733f..e60309e 100644 --- a/drivers/hwmon/adm9240.c +++ b/drivers/hwmon/adm9240.c @@ -137,8 +137,10 @@ static struct adm9240_data *adm9240_update_device(struct device *dev); /* driver data */ static struct i2c_driver adm9240_driver = { - .owner = THIS_MODULE, - .name = "adm9240", + .driver = { + .owner = THIS_MODULE, + .name = "adm9240", + }, .id = I2C_DRIVERID_ADM9240, .attach_adapter = adm9240_attach_adapter, .detach_client = adm9240_detach_client, diff --git a/drivers/hwmon/asb100.c b/drivers/hwmon/asb100.c index 7227f80..3068de0 100644 --- a/drivers/hwmon/asb100.c +++ b/drivers/hwmon/asb100.c @@ -217,8 +217,10 @@ static struct asb100_data *asb100_update_device(struct device *dev); static void asb100_init_client(struct i2c_client *client); static struct i2c_driver asb100_driver = { - .owner = THIS_MODULE, - .name = "asb100", + .driver = { + .owner = THIS_MODULE, + .name = "asb100", + }, .id = I2C_DRIVERID_ASB100, .attach_adapter = asb100_attach_adapter, .detach_client = asb100_detach_client, diff --git a/drivers/hwmon/atxp1.c b/drivers/hwmon/atxp1.c index a60a9f2..ed152d9 100644 --- a/drivers/hwmon/atxp1.c +++ b/drivers/hwmon/atxp1.c @@ -50,8 +50,10 @@ static struct atxp1_data * atxp1_update_device(struct device *dev); static int atxp1_detect(struct i2c_adapter *adapter, int address, int kind); static struct i2c_driver atxp1_driver = { - .owner = THIS_MODULE, - .name = "atxp1", + .driver = { + .owner = THIS_MODULE, + .name = "atxp1", + }, .attach_adapter = atxp1_attach_adapter, .detach_client = atxp1_detach_client, }; diff --git a/drivers/hwmon/ds1621.c b/drivers/hwmon/ds1621.c index 0096eb3..8600940 100644 --- a/drivers/hwmon/ds1621.c +++ b/drivers/hwmon/ds1621.c @@ -89,8 +89,10 @@ static struct ds1621_data *ds1621_update_client(struct device *dev); /* This is the driver that will be inserted */ static struct i2c_driver ds1621_driver = { - .owner = THIS_MODULE, - .name = "ds1621", + .driver = { + .owner = THIS_MODULE, + .name = "ds1621", + }, .id = I2C_DRIVERID_DS1621, .attach_adapter = ds1621_attach_adapter, .detach_client = ds1621_detach_client, diff --git a/drivers/hwmon/fscher.c b/drivers/hwmon/fscher.c index f56ca06..982fff4 100644 --- a/drivers/hwmon/fscher.c +++ b/drivers/hwmon/fscher.c @@ -118,8 +118,10 @@ static int fscher_write_value(struct i2c_client *client, u8 reg, u8 value); */ static struct i2c_driver fscher_driver = { - .owner = THIS_MODULE, - .name = "fscher", + .driver = { + .owner = THIS_MODULE, + .name = "fscher", + }, .id = I2C_DRIVERID_FSCHER, .attach_adapter = fscher_attach_adapter, .detach_client = fscher_detach_client, diff --git a/drivers/hwmon/fscpos.c b/drivers/hwmon/fscpos.c index 701dffc..971146b 100644 --- a/drivers/hwmon/fscpos.c +++ b/drivers/hwmon/fscpos.c @@ -100,8 +100,10 @@ static void reset_fan_alarm(struct i2c_client *client, int nr); * Driver data (common to all clients) */ static struct i2c_driver fscpos_driver = { - .owner = THIS_MODULE, - .name = "fscpos", + .driver = { + .owner = THIS_MODULE, + .name = "fscpos", + }, .id = I2C_DRIVERID_FSCPOS, .attach_adapter = fscpos_attach_adapter, .detach_client = fscpos_detach_client, diff --git a/drivers/hwmon/gl518sm.c b/drivers/hwmon/gl518sm.c index 5788bbb..9c5ca1f 100644 --- a/drivers/hwmon/gl518sm.c +++ b/drivers/hwmon/gl518sm.c @@ -151,8 +151,10 @@ static struct gl518_data *gl518_update_device(struct device *dev); /* This is the driver that will be inserted */ static struct i2c_driver gl518_driver = { - .owner = THIS_MODULE, - .name = "gl518sm", + .driver = { + .owner = THIS_MODULE, + .name = "gl518sm", + }, .id = I2C_DRIVERID_GL518, .attach_adapter = gl518_attach_adapter, .detach_client = gl518_detach_client, diff --git a/drivers/hwmon/gl520sm.c b/drivers/hwmon/gl520sm.c index b399816..a9a724a 100644 --- a/drivers/hwmon/gl520sm.c +++ b/drivers/hwmon/gl520sm.c @@ -109,8 +109,10 @@ static struct gl520_data *gl520_update_device(struct device *dev); /* Driver data */ static struct i2c_driver gl520_driver = { - .owner = THIS_MODULE, - .name = "gl520sm", + .driver = { + .owner = THIS_MODULE, + .name = "gl520sm", + }, .id = I2C_DRIVERID_GL520, .attach_adapter = gl520_attach_adapter, .detach_client = gl520_detach_client, diff --git a/drivers/hwmon/it87.c b/drivers/hwmon/it87.c index d5f0d92..24d520b 100644 --- a/drivers/hwmon/it87.c +++ b/drivers/hwmon/it87.c @@ -234,16 +234,20 @@ static void it87_init_client(struct i2c_client *client, struct it87_data *data); static struct i2c_driver it87_driver = { - .owner = THIS_MODULE, - .name = "it87", + .driver = { + .owner = THIS_MODULE, + .name = "it87", + }, .id = I2C_DRIVERID_IT87, .attach_adapter = it87_attach_adapter, .detach_client = it87_detach_client, }; static struct i2c_driver it87_isa_driver = { - .owner = THIS_MODULE, - .name = "it87-isa", + .driver = { + .owner = THIS_MODULE, + .name = "it87-isa", + }, .attach_adapter = it87_isa_attach_adapter, .detach_client = it87_detach_client, }; @@ -760,7 +764,8 @@ static int it87_detect(struct i2c_adapter *adapter, int address, int kind) /* Reserve the ISA region */ if (is_isa) - if (!request_region(address, IT87_EXTENT, it87_isa_driver.name)) + if (!request_region(address, IT87_EXTENT, + it87_isa_driver.driver.name)) goto ERROR0; /* For now, we presume we have a valid client. We create the diff --git a/drivers/hwmon/lm63.c b/drivers/hwmon/lm63.c index c2dd4ac..35baae7 100644 --- a/drivers/hwmon/lm63.c +++ b/drivers/hwmon/lm63.c @@ -139,8 +139,10 @@ static void lm63_init_client(struct i2c_client *client); */ static struct i2c_driver lm63_driver = { - .owner = THIS_MODULE, - .name = "lm63", + .driver = { + .owner = THIS_MODULE, + .name = "lm63", + }, .attach_adapter = lm63_attach_adapter, .detach_client = lm63_detach_client, }; diff --git a/drivers/hwmon/lm75.c b/drivers/hwmon/lm75.c index 0bcbd65..db35fbf 100644 --- a/drivers/hwmon/lm75.c +++ b/drivers/hwmon/lm75.c @@ -66,8 +66,10 @@ static struct lm75_data *lm75_update_device(struct device *dev); /* This is the driver that will be inserted */ static struct i2c_driver lm75_driver = { - .owner = THIS_MODULE, - .name = "lm75", + .driver = { + .owner = THIS_MODULE, + .name = "lm75", + }, .id = I2C_DRIVERID_LM75, .attach_adapter = lm75_attach_adapter, .detach_client = lm75_detach_client, diff --git a/drivers/hwmon/lm77.c b/drivers/hwmon/lm77.c index 6a524e9..1770720 100644 --- a/drivers/hwmon/lm77.c +++ b/drivers/hwmon/lm77.c @@ -74,8 +74,10 @@ static struct lm77_data *lm77_update_device(struct device *dev); /* This is the driver that will be inserted */ static struct i2c_driver lm77_driver = { - .owner = THIS_MODULE, - .name = "lm77", + .driver = { + .owner = THIS_MODULE, + .name = "lm77", + }, .attach_adapter = lm77_attach_adapter, .detach_client = lm77_detach_client, }; diff --git a/drivers/hwmon/lm78.c b/drivers/hwmon/lm78.c index 18448f8..3af5b06 100644 --- a/drivers/hwmon/lm78.c +++ b/drivers/hwmon/lm78.c @@ -164,16 +164,20 @@ static void lm78_init_client(struct i2c_client *client); static struct i2c_driver lm78_driver = { - .owner = THIS_MODULE, - .name = "lm78", + .driver = { + .owner = THIS_MODULE, + .name = "lm78", + }, .id = I2C_DRIVERID_LM78, .attach_adapter = lm78_attach_adapter, .detach_client = lm78_detach_client, }; static struct i2c_driver lm78_isa_driver = { - .owner = THIS_MODULE, - .name = "lm78-isa", + .driver = { + .owner = THIS_MODULE, + .name = "lm78-isa", + }, .attach_adapter = lm78_isa_attach_adapter, .detach_client = lm78_detach_client, }; @@ -496,7 +500,7 @@ static int lm78_detect(struct i2c_adapter *adapter, int address, int kind) /* Reserve the ISA region */ if (is_isa) if (!request_region(address, LM78_EXTENT, - lm78_isa_driver.name)) { + lm78_isa_driver.driver.name)) { err = -EBUSY; goto ERROR0; } diff --git a/drivers/hwmon/lm80.c b/drivers/hwmon/lm80.c index 02303fa..1dc118f 100644 --- a/drivers/hwmon/lm80.c +++ b/drivers/hwmon/lm80.c @@ -143,8 +143,10 @@ static int lm80_write_value(struct i2c_client *client, u8 reg, u8 value); */ static struct i2c_driver lm80_driver = { - .owner = THIS_MODULE, - .name = "lm80", + .driver = { + .owner = THIS_MODULE, + .name = "lm80", + }, .id = I2C_DRIVERID_LM80, .attach_adapter = lm80_attach_adapter, .detach_client = lm80_detach_client, diff --git a/drivers/hwmon/lm83.c b/drivers/hwmon/lm83.c index 96cb34e..1c1744f 100644 --- a/drivers/hwmon/lm83.c +++ b/drivers/hwmon/lm83.c @@ -124,8 +124,10 @@ static struct lm83_data *lm83_update_device(struct device *dev); */ static struct i2c_driver lm83_driver = { - .owner = THIS_MODULE, - .name = "lm83", + .driver = { + .owner = THIS_MODULE, + .name = "lm83", + }, .id = I2C_DRIVERID_LM83, .attach_adapter = lm83_attach_adapter, .detach_client = lm83_detach_client, diff --git a/drivers/hwmon/lm85.c b/drivers/hwmon/lm85.c index 131ecab..b537c18 100644 --- a/drivers/hwmon/lm85.c +++ b/drivers/hwmon/lm85.c @@ -380,8 +380,10 @@ static void lm85_init_client(struct i2c_client *client); static struct i2c_driver lm85_driver = { - .owner = THIS_MODULE, - .name = "lm85", + .driver = { + .owner = THIS_MODULE, + .name = "lm85", + }, .id = I2C_DRIVERID_LM85, .attach_adapter = lm85_attach_adapter, .detach_client = lm85_detach_client, diff --git a/drivers/hwmon/lm87.c b/drivers/hwmon/lm87.c index 26fd0b3..3152c00 100644 --- a/drivers/hwmon/lm87.c +++ b/drivers/hwmon/lm87.c @@ -161,8 +161,10 @@ static struct lm87_data *lm87_update_device(struct device *dev); */ static struct i2c_driver lm87_driver = { - .owner = THIS_MODULE, - .name = "lm87", + .driver = { + .owner = THIS_MODULE, + .name = "lm87", + }, .id = I2C_DRIVERID_LM87, .attach_adapter = lm87_attach_adapter, .detach_client = lm87_detach_client, diff --git a/drivers/hwmon/lm90.c b/drivers/hwmon/lm90.c index 011923b..ff7ba1e 100644 --- a/drivers/hwmon/lm90.c +++ b/drivers/hwmon/lm90.c @@ -186,8 +186,10 @@ static struct lm90_data *lm90_update_device(struct device *dev); */ static struct i2c_driver lm90_driver = { - .owner = THIS_MODULE, - .name = "lm90", + .driver = { + .owner = THIS_MODULE, + .name = "lm90", + }, .id = I2C_DRIVERID_LM90, .attach_adapter = lm90_attach_adapter, .detach_client = lm90_detach_client, diff --git a/drivers/hwmon/lm92.c b/drivers/hwmon/lm92.c index 2005a9e..b4e4a84 100644 --- a/drivers/hwmon/lm92.c +++ b/drivers/hwmon/lm92.c @@ -410,8 +410,10 @@ static int lm92_detach_client(struct i2c_client *client) */ static struct i2c_driver lm92_driver = { - .owner = THIS_MODULE, - .name = "lm92", + .driver = { + .owner = THIS_MODULE, + .name = "lm92", + }, .id = I2C_DRIVERID_LM92, .attach_adapter = lm92_attach_adapter, .detach_client = lm92_detach_client, diff --git a/drivers/hwmon/max1619.c b/drivers/hwmon/max1619.c index d5aebef..1a50b13 100644 --- a/drivers/hwmon/max1619.c +++ b/drivers/hwmon/max1619.c @@ -90,8 +90,10 @@ static struct max1619_data *max1619_update_device(struct device *dev); */ static struct i2c_driver max1619_driver = { - .owner = THIS_MODULE, - .name = "max1619", + .driver = { + .owner = THIS_MODULE, + .name = "max1619", + }, .attach_adapter = max1619_attach_adapter, .detach_client = max1619_detach_client, }; diff --git a/drivers/hwmon/pc87360.c b/drivers/hwmon/pc87360.c index 17f745a..5469489 100644 --- a/drivers/hwmon/pc87360.c +++ b/drivers/hwmon/pc87360.c @@ -236,8 +236,10 @@ static struct pc87360_data *pc87360_update_device(struct device *dev); */ static struct i2c_driver pc87360_driver = { - .owner = THIS_MODULE, - .name = "pc87360", + .driver = { + .owner = THIS_MODULE, + .name = "pc87360", + }, .attach_adapter = pc87360_detect, .detach_client = pc87360_detach_client, }; @@ -798,7 +800,7 @@ static int pc87360_detect(struct i2c_adapter *adapter) for (i = 0; i < 3; i++) { if (((data->address[i] = extra_isa[i])) && !request_region(extra_isa[i], PC87360_EXTENT, - pc87360_driver.name)) { + pc87360_driver.driver.name)) { dev_err(&new_client->dev, "Region 0x%x-0x%x already " "in use!\n", extra_isa[i], extra_isa[i]+PC87360_EXTENT-1); diff --git a/drivers/hwmon/sis5595.c b/drivers/hwmon/sis5595.c index 9c6cade..9f44b93 100644 --- a/drivers/hwmon/sis5595.c +++ b/drivers/hwmon/sis5595.c @@ -198,8 +198,10 @@ static struct sis5595_data *sis5595_update_device(struct device *dev); static void sis5595_init_client(struct i2c_client *client); static struct i2c_driver sis5595_driver = { - .owner = THIS_MODULE, - .name = "sis5595", + .driver = { + .owner = THIS_MODULE, + .name = "sis5595", + }, .attach_adapter = sis5595_detect, .detach_client = sis5595_detach_client, }; @@ -484,7 +486,8 @@ static int sis5595_detect(struct i2c_adapter *adapter) if (force_addr) address = force_addr & ~(SIS5595_EXTENT - 1); /* Reserve the ISA region */ - if (!request_region(address, SIS5595_EXTENT, sis5595_driver.name)) { + if (!request_region(address, SIS5595_EXTENT, + sis5595_driver.driver.name)) { err = -EBUSY; goto exit; } diff --git a/drivers/hwmon/smsc47b397.c b/drivers/hwmon/smsc47b397.c index 2a3e21b..02e5d55 100644 --- a/drivers/hwmon/smsc47b397.c +++ b/drivers/hwmon/smsc47b397.c @@ -226,8 +226,10 @@ static int smsc47b397_detach_client(struct i2c_client *client) static int smsc47b397_detect(struct i2c_adapter *adapter); static struct i2c_driver smsc47b397_driver = { - .owner = THIS_MODULE, - .name = "smsc47b397", + .driver = { + .owner = THIS_MODULE, + .name = "smsc47b397", + }, .attach_adapter = smsc47b397_detect, .detach_client = smsc47b397_detach_client, }; @@ -238,7 +240,8 @@ static int smsc47b397_detect(struct i2c_adapter *adapter) struct smsc47b397_data *data; int err = 0; - if (!request_region(address, SMSC_EXTENT, smsc47b397_driver.name)) { + if (!request_region(address, SMSC_EXTENT, + smsc47b397_driver.driver.name)) { dev_err(&adapter->dev, "Region 0x%x already in use!\n", address); return -EBUSY; diff --git a/drivers/hwmon/smsc47m1.c b/drivers/hwmon/smsc47m1.c index 5905c1a..b3051ad 100644 --- a/drivers/hwmon/smsc47m1.c +++ b/drivers/hwmon/smsc47m1.c @@ -126,8 +126,10 @@ static struct smsc47m1_data *smsc47m1_update_device(struct device *dev, static struct i2c_driver smsc47m1_driver = { - .owner = THIS_MODULE, - .name = "smsc47m1", + .driver = { + .owner = THIS_MODULE, + .name = "smsc47m1", + }, .attach_adapter = smsc47m1_detect, .detach_client = smsc47m1_detach_client, }; @@ -394,7 +396,7 @@ static int smsc47m1_detect(struct i2c_adapter *adapter) int err = 0; int fan1, fan2, pwm1, pwm2; - if (!request_region(address, SMSC_EXTENT, smsc47m1_driver.name)) { + if (!request_region(address, SMSC_EXTENT, smsc47m1_driver.driver.name)) { dev_err(&adapter->dev, "Region 0x%x already in use!\n", address); return -EBUSY; } diff --git a/drivers/hwmon/via686a.c b/drivers/hwmon/via686a.c index 6f696f8..db75fbc 100644 --- a/drivers/hwmon/via686a.c +++ b/drivers/hwmon/via686a.c @@ -572,8 +572,10 @@ static DEVICE_ATTR(alarms, S_IRUGO, show_alarms, NULL); /* The driver. I choose to use type i2c_driver, as at is identical to both smbus_driver and isa_driver, and clients could be of either kind */ static struct i2c_driver via686a_driver = { - .owner = THIS_MODULE, - .name = "via686a", + .driver = { + .owner = THIS_MODULE, + .name = "via686a", + }, .attach_adapter = via686a_detect, .detach_client = via686a_detach_client, }; @@ -615,7 +617,8 @@ static int via686a_detect(struct i2c_adapter *adapter) } /* Reserve the ISA region */ - if (!request_region(address, VIA686A_EXTENT, via686a_driver.name)) { + if (!request_region(address, VIA686A_EXTENT, + via686a_driver.driver.name)) { dev_err(&adapter->dev, "region 0x%x already in use!\n", address); return -ENODEV; diff --git a/drivers/hwmon/vt8231.c b/drivers/hwmon/vt8231.c index c8556a72..c2eb54b 100644 --- a/drivers/hwmon/vt8231.c +++ b/drivers/hwmon/vt8231.c @@ -585,8 +585,10 @@ static ssize_t show_alarms(struct device *dev, struct device_attribute *attr, static DEVICE_ATTR(alarms, S_IRUGO, show_alarms, NULL); static struct i2c_driver vt8231_driver = { - .owner = THIS_MODULE, - .name = "vt8231", + .driver = { + .owner = THIS_MODULE, + .name = "vt8231", + }, .attach_adapter = vt8231_detect, .detach_client = vt8231_detach_client, }; diff --git a/drivers/hwmon/w83627ehf.c b/drivers/hwmon/w83627ehf.c index eee22a5..94538fb 100644 --- a/drivers/hwmon/w83627ehf.c +++ b/drivers/hwmon/w83627ehf.c @@ -676,7 +676,7 @@ static int w83627ehf_detect(struct i2c_adapter *adapter) int i, err = 0; if (!request_region(address + REGION_OFFSET, REGION_LENGTH, - w83627ehf_driver.name)) { + w83627ehf_driver.driver.name)) { err = -EBUSY; goto exit; } @@ -785,8 +785,10 @@ static int w83627ehf_detach_client(struct i2c_client *client) } static struct i2c_driver w83627ehf_driver = { - .owner = THIS_MODULE, - .name = "w83627ehf", + .driver = { + .owner = THIS_MODULE, + .name = "w83627ehf", + }, .attach_adapter = w83627ehf_detect, .detach_client = w83627ehf_detach_client, }; diff --git a/drivers/hwmon/w83627hf.c b/drivers/hwmon/w83627hf.c index 27cfde1..2ffb84f 100644 --- a/drivers/hwmon/w83627hf.c +++ b/drivers/hwmon/w83627hf.c @@ -332,8 +332,10 @@ static struct w83627hf_data *w83627hf_update_device(struct device *dev); static void w83627hf_init_client(struct i2c_client *client); static struct i2c_driver w83627hf_driver = { - .owner = THIS_MODULE, - .name = "w83627hf", + .driver = { + .owner = THIS_MODULE, + .name = "w83627hf", + }, .attach_adapter = w83627hf_detect, .detach_client = w83627hf_detach_client, }; @@ -1009,7 +1011,7 @@ static int w83627hf_detect(struct i2c_adapter *adapter) address = force_addr & WINB_ALIGNMENT; if (!request_region(address + WINB_REGION_OFFSET, WINB_REGION_SIZE, - w83627hf_driver.name)) { + w83627hf_driver.driver.name)) { err = -EBUSY; goto ERROR0; } diff --git a/drivers/hwmon/w83781d.c b/drivers/hwmon/w83781d.c index a78929f..fd1a59c 100644 --- a/drivers/hwmon/w83781d.c +++ b/drivers/hwmon/w83781d.c @@ -269,16 +269,20 @@ static struct w83781d_data *w83781d_update_device(struct device *dev); static void w83781d_init_client(struct i2c_client *client); static struct i2c_driver w83781d_driver = { - .owner = THIS_MODULE, - .name = "w83781d", + .driver = { + .owner = THIS_MODULE, + .name = "w83781d", + }, .id = I2C_DRIVERID_W83781D, .attach_adapter = w83781d_attach_adapter, .detach_client = w83781d_detach_client, }; static struct i2c_driver w83781d_isa_driver = { - .owner = THIS_MODULE, - .name = "w83781d-isa", + .driver = { + .owner = THIS_MODULE, + .name = "w83781d-isa", + }, .attach_adapter = w83781d_isa_attach_adapter, .detach_client = w83781d_detach_client, }; @@ -1011,7 +1015,7 @@ w83781d_detect(struct i2c_adapter *adapter, int address, int kind) if (is_isa) if (!request_region(address, W83781D_EXTENT, - w83781d_isa_driver.name)) { + w83781d_isa_driver.driver.name)) { dev_dbg(&adapter->dev, "Request of region " "0x%x-0x%x for w83781d failed\n", address, address + W83781D_EXTENT - 1); diff --git a/drivers/hwmon/w83792d.c b/drivers/hwmon/w83792d.c index 6824243..9018445 100644 --- a/drivers/hwmon/w83792d.c +++ b/drivers/hwmon/w83792d.c @@ -317,8 +317,10 @@ static void w83792d_print_debug(struct w83792d_data *data, struct device *dev); static void w83792d_init_client(struct i2c_client *client); static struct i2c_driver w83792d_driver = { - .owner = THIS_MODULE, - .name = "w83792d", + .driver = { + .owner = THIS_MODULE, + .name = "w83792d", + }, .attach_adapter = w83792d_attach_adapter, .detach_client = w83792d_detach_client, }; diff --git a/drivers/hwmon/w83l785ts.c b/drivers/hwmon/w83l785ts.c index 35172fb..fc9f202 100644 --- a/drivers/hwmon/w83l785ts.c +++ b/drivers/hwmon/w83l785ts.c @@ -92,8 +92,10 @@ static struct w83l785ts_data *w83l785ts_update_device(struct device *dev); */ static struct i2c_driver w83l785ts_driver = { - .owner = THIS_MODULE, - .name = "w83l785ts", + .driver = { + .owner = THIS_MODULE, + .name = "w83l785ts", + }, .id = I2C_DRIVERID_W83L785TS, .attach_adapter = w83l785ts_attach_adapter, .detach_client = w83l785ts_detach_client, -- cgit v1.1 From a33ca23231a37e28d15da9546b1f3e83dc48284b Mon Sep 17 00:00:00 2001 From: Laurent Riffard Date: Sat, 26 Nov 2005 20:40:34 +0100 Subject: [PATCH] i2c: Drop i2c_driver.{owner,name}, 4 of 11 We should use the i2c_driver.driver's .name and .owner fields instead of the i2c_driver's ones. This patch updates the drivers for macintosh. Signed-off-by: Laurent Riffard Signed-off-by: Jean Delvare Acked-by: Benjamin Herrenschmidt Signed-off-by: Greg Kroah-Hartman --- drivers/macintosh/therm_adt746x.c | 6 ++++-- drivers/macintosh/therm_pm72.c | 6 ++++-- drivers/macintosh/therm_windtunnel.c | 6 ++++-- drivers/macintosh/windfarm_lm75_sensor.c | 6 ++++-- 4 files changed, 16 insertions(+), 8 deletions(-) diff --git a/drivers/macintosh/therm_adt746x.c b/drivers/macintosh/therm_adt746x.c index f62c16f..8bb1d85 100644 --- a/drivers/macintosh/therm_adt746x.c +++ b/drivers/macintosh/therm_adt746x.c @@ -171,8 +171,10 @@ detach_thermostat(struct i2c_adapter *adapter) } static struct i2c_driver thermostat_driver = { - .owner = THIS_MODULE, - .name = "therm_adt746x", + .driver = { + .owner = THIS_MODULE, + .name = "therm_adt746x", + }, .attach_adapter = attach_thermostat, .detach_adapter = detach_thermostat, }; diff --git a/drivers/macintosh/therm_pm72.c b/drivers/macintosh/therm_pm72.c index df00c96..97807be 100644 --- a/drivers/macintosh/therm_pm72.c +++ b/drivers/macintosh/therm_pm72.c @@ -283,8 +283,10 @@ static int therm_pm72_detach(struct i2c_adapter *adapter); static struct i2c_driver therm_pm72_driver = { - .owner = THIS_MODULE, - .name = "therm_pm72", + .driver = { + .owner = THIS_MODULE, + .name = "therm_pm72", + }, .attach_adapter = therm_pm72_attach, .detach_adapter = therm_pm72_detach, }; diff --git a/drivers/macintosh/therm_windtunnel.c b/drivers/macintosh/therm_windtunnel.c index f3bae0d..259f19d 100644 --- a/drivers/macintosh/therm_windtunnel.c +++ b/drivers/macintosh/therm_windtunnel.c @@ -354,8 +354,10 @@ do_detach( struct i2c_client *client ) } static struct i2c_driver g4fan_driver = { - .owner = THIS_MODULE, - .name = "therm_windtunnel", + .driver = { + .owner = THIS_MODULE, + .name = "therm_windtunnel", + }, .id = I2C_DRIVERID_G4FAN, .attach_adapter = do_attach, .detach_client = do_detach, diff --git a/drivers/macintosh/windfarm_lm75_sensor.c b/drivers/macintosh/windfarm_lm75_sensor.c index 2392789..555d0e4 100644 --- a/drivers/macintosh/windfarm_lm75_sensor.c +++ b/drivers/macintosh/windfarm_lm75_sensor.c @@ -47,8 +47,10 @@ static int wf_lm75_attach(struct i2c_adapter *adapter); static int wf_lm75_detach(struct i2c_client *client); static struct i2c_driver wf_lm75_driver = { - .owner = THIS_MODULE, - .name = "wf_lm75", + .driver = { + .owner = THIS_MODULE, + .name = "wf_lm75", + }, .attach_adapter = wf_lm75_attach, .detach_client = wf_lm75_detach, }; -- cgit v1.1 From 604f28e2b8d34cbaf08f0351374645f161335a82 Mon Sep 17 00:00:00 2001 From: Laurent Riffard Date: Sat, 26 Nov 2005 20:43:39 +0100 Subject: [PATCH] i2c: Drop i2c_driver.{owner,name}, 5 of 11 We should use the i2c_driver.driver's .name and .owner fields instead of the i2c_driver's ones. This patch updates the drivers/media/video and usb/media drivers. Signed-off-by: Laurent Riffard Signed-off-by: Jean Delvare Signed-off-by: Greg Kroah-Hartman --- drivers/media/video/adv7170.c | 6 ++++-- drivers/media/video/adv7175.c | 6 ++++-- drivers/media/video/bt819.c | 6 ++++-- drivers/media/video/bt832.c | 6 ++++-- drivers/media/video/bt856.c | 6 ++++-- drivers/media/video/bttv-i2c.c | 2 +- drivers/media/video/cs53l32a.c | 13 ++++++++----- drivers/media/video/cx25840/cx25840-core.c | 6 ++++-- drivers/media/video/cx25840/cx25840.h | 7 ++++--- drivers/media/video/cx88/cx88-i2c.c | 2 +- drivers/media/video/indycam.c | 6 ++++-- drivers/media/video/ir-kbd-i2c.c | 5 ++++- drivers/media/video/msp3400.c | 19 +++++++++++-------- drivers/media/video/ovcamchip/ovcamchip_core.c | 6 ++++-- drivers/media/video/saa5246a.c | 6 ++++-- drivers/media/video/saa5249.c | 6 ++++-- drivers/media/video/saa6588.c | 6 ++++-- drivers/media/video/saa7110.c | 6 ++++-- drivers/media/video/saa7111.c | 6 ++++-- drivers/media/video/saa7114.c | 6 ++++-- drivers/media/video/saa7115.c | 13 ++++++++----- drivers/media/video/saa711x.c | 6 ++++-- drivers/media/video/saa7127.c | 16 ++++++++++------ drivers/media/video/saa7134/saa6752hs.c | 6 ++++-- drivers/media/video/saa7134/saa7134-i2c.c | 4 ++-- drivers/media/video/saa7185.c | 6 ++++-- drivers/media/video/saa7191.c | 6 ++++-- drivers/media/video/tda7432.c | 6 ++++-- drivers/media/video/tda9840.c | 6 ++++-- drivers/media/video/tda9875.c | 6 ++++-- drivers/media/video/tda9887.c | 4 ++-- drivers/media/video/tea6415c.c | 6 ++++-- drivers/media/video/tea6420.c | 6 ++++-- drivers/media/video/tuner-3036.c | 6 ++++-- drivers/media/video/tuner-core.c | 6 +++--- drivers/media/video/tvaudio.c | 6 ++++-- drivers/media/video/tveeprom.c | 6 ++++-- drivers/media/video/tvmixer.c | 8 ++++++-- drivers/media/video/tvp5150.c | 6 ++++-- drivers/media/video/vpx3220.c | 6 ++++-- drivers/media/video/wm8775.c | 10 ++++++---- drivers/media/video/zoran_driver.c | 14 +++++++------- drivers/usb/media/w9968cf.c | 4 ++-- include/media/tuner.h | 7 ++++--- 44 files changed, 191 insertions(+), 111 deletions(-) diff --git a/drivers/media/video/adv7170.c b/drivers/media/video/adv7170.c index 622b161..c5f1c6b 100644 --- a/drivers/media/video/adv7170.c +++ b/drivers/media/video/adv7170.c @@ -497,8 +497,10 @@ adv7170_detach_client (struct i2c_client *client) /* ----------------------------------------------------------------------- */ static struct i2c_driver i2c_driver_adv7170 = { - .owner = THIS_MODULE, - .name = "adv7170", /* name */ + .driver = { + .owner = THIS_MODULE, + .name = "adv7170", /* name */ + }, .id = I2C_DRIVERID_ADV7170, diff --git a/drivers/media/video/adv7175.c b/drivers/media/video/adv7175.c index d4859b4..33158aa 100644 --- a/drivers/media/video/adv7175.c +++ b/drivers/media/video/adv7175.c @@ -547,8 +547,10 @@ adv7175_detach_client (struct i2c_client *client) /* ----------------------------------------------------------------------- */ static struct i2c_driver i2c_driver_adv7175 = { - .owner = THIS_MODULE, - .name = "adv7175", /* name */ + .driver = { + .owner = THIS_MODULE, + .name = "adv7175", /* name */ + }, .id = I2C_DRIVERID_ADV7175, diff --git a/drivers/media/video/bt819.c b/drivers/media/video/bt819.c index 741e59a..5868bbb 100644 --- a/drivers/media/video/bt819.c +++ b/drivers/media/video/bt819.c @@ -622,8 +622,10 @@ bt819_detach_client (struct i2c_client *client) /* ----------------------------------------------------------------------- */ static struct i2c_driver i2c_driver_bt819 = { - .owner = THIS_MODULE, - .name = "bt819", + .driver = { + .owner = THIS_MODULE, + .name = "bt819", + }, .id = I2C_DRIVERID_BT819, diff --git a/drivers/media/video/bt832.c b/drivers/media/video/bt832.c index 4ed13860..347eb71 100644 --- a/drivers/media/video/bt832.c +++ b/drivers/media/video/bt832.c @@ -230,8 +230,10 @@ bt832_command(struct i2c_client *client, unsigned int cmd, void *arg) /* ----------------------------------------------------------------------- */ static struct i2c_driver driver = { - .owner = THIS_MODULE, - .name = "i2c bt832 driver", + .driver = { + .owner = THIS_MODULE, + .name = "i2c bt832 driver", + }, .id = -1, /* FIXME */ .attach_adapter = bt832_probe, .detach_client = bt832_detach, diff --git a/drivers/media/video/bt856.c b/drivers/media/video/bt856.c index d4bba8e..207525a 100644 --- a/drivers/media/video/bt856.c +++ b/drivers/media/video/bt856.c @@ -404,8 +404,10 @@ bt856_detach_client (struct i2c_client *client) /* ----------------------------------------------------------------------- */ static struct i2c_driver i2c_driver_bt856 = { - .owner = THIS_MODULE, - .name = "bt856", + .driver = { + .owner = THIS_MODULE, + .name = "bt856", + }, .id = I2C_DRIVERID_BT856, diff --git a/drivers/media/video/bttv-i2c.c b/drivers/media/video/bttv-i2c.c index 77619eb..d6418c0 100644 --- a/drivers/media/video/bttv-i2c.c +++ b/drivers/media/video/bttv-i2c.c @@ -300,7 +300,7 @@ static int attach_inform(struct i2c_client *client) if (bttv_debug) printk(KERN_DEBUG "bttv%d: %s i2c attach [addr=0x%x,client=%s]\n", - btv->c.nr,client->driver->name,client->addr, + btv->c.nr, client->driver->driver.name, client->addr, client->name); if (!client->driver->command) return 0; diff --git a/drivers/media/video/cs53l32a.c b/drivers/media/video/cs53l32a.c index f442ce3..60484f9 100644 --- a/drivers/media/video/cs53l32a.c +++ b/drivers/media/video/cs53l32a.c @@ -42,15 +42,16 @@ MODULE_PARM_DESC(debug, "Debugging messages\n\t\t\t0=Off (default), 1=On"); #define cs53l32a_dbg(fmt, arg...) \ do { \ if (debug) \ - printk(KERN_INFO "%s debug %d-%04x: " fmt, client->driver->name, \ + printk(KERN_INFO "%s debug %d-%04x: " fmt, \ + client->driver->driver.name, \ i2c_adapter_id(client->adapter), client->addr , ## arg); \ } while (0) #define cs53l32a_err(fmt, arg...) do { \ - printk(KERN_ERR "%s %d-%04x: " fmt, client->driver->name, \ + printk(KERN_ERR "%s %d-%04x: " fmt, client->driver->driver.name, \ i2c_adapter_id(client->adapter), client->addr , ## arg); } while (0) #define cs53l32a_info(fmt, arg...) do { \ - printk(KERN_INFO "%s %d-%04x: " fmt, client->driver->name, \ + printk(KERN_INFO "%s %d-%04x: " fmt, client->driver->driver.name, \ i2c_adapter_id(client->adapter), client->addr , ## arg); } while (0) static unsigned short normal_i2c[] = { 0x22 >> 1, I2C_CLIENT_END }; @@ -215,12 +216,14 @@ static int cs53l32a_detach(struct i2c_client *client) /* i2c implementation */ static struct i2c_driver i2c_driver = { - .name = "cs53l32a", + .driver = { + .owner = THIS_MODULE, + .name = "cs53l32a", + }, .id = I2C_DRIVERID_CS53L32A, .attach_adapter = cs53l32a_probe, .detach_client = cs53l32a_detach, .command = cs53l32a_command, - .owner = THIS_MODULE, }; diff --git a/drivers/media/video/cx25840/cx25840-core.c b/drivers/media/video/cx25840/cx25840-core.c index 0b278ab..830d519 100644 --- a/drivers/media/video/cx25840/cx25840-core.c +++ b/drivers/media/video/cx25840/cx25840-core.c @@ -843,14 +843,16 @@ static int cx25840_detach_client(struct i2c_client *client) /* ----------------------------------------------------------------------- */ static struct i2c_driver i2c_driver_cx25840 = { - .name = "cx25840", + .driver = { + .owner = THIS_MODULE, + .name = "cx25840", + }, .id = I2C_DRIVERID_CX25840, .attach_adapter = cx25840_attach_adapter, .detach_client = cx25840_detach_client, .command = cx25840_command, - .owner = THIS_MODULE, }; diff --git a/drivers/media/video/cx25840/cx25840.h b/drivers/media/video/cx25840/cx25840.h index 4932ed1..40aa59f 100644 --- a/drivers/media/video/cx25840/cx25840.h +++ b/drivers/media/video/cx25840/cx25840.h @@ -27,15 +27,16 @@ extern int cx25840_debug; #define cx25840_dbg(fmt, arg...) do { if (cx25840_debug) \ - printk(KERN_INFO "%s debug %d-%04x: " fmt, client->driver->name, \ + printk(KERN_INFO "%s debug %d-%04x: " fmt, \ + client->driver->driver.name, \ i2c_adapter_id(client->adapter), client->addr , ## arg); } while (0) #define cx25840_err(fmt, arg...) do { \ - printk(KERN_ERR "%s %d-%04x: " fmt, client->driver->name, \ + printk(KERN_ERR "%s %d-%04x: " fmt, client->driver->driver.name, \ i2c_adapter_id(client->adapter), client->addr , ## arg); } while (0) #define cx25840_info(fmt, arg...) do { \ - printk(KERN_INFO "%s %d-%04x: " fmt, client->driver->name, \ + printk(KERN_INFO "%s %d-%04x: " fmt, client->driver->driver.name, \ i2c_adapter_id(client->adapter), client->addr , ## arg); } while (0) #define CX25840_CID_CARDTYPE (V4L2_CID_PRIVATE_BASE+0) diff --git a/drivers/media/video/cx88/cx88-i2c.c b/drivers/media/video/cx88/cx88-i2c.c index 9790d41..4a8fb16 100644 --- a/drivers/media/video/cx88/cx88-i2c.c +++ b/drivers/media/video/cx88/cx88-i2c.c @@ -94,7 +94,7 @@ static int attach_inform(struct i2c_client *client) struct cx88_core *core = i2c_get_adapdata(client->adapter); dprintk(1, "%s i2c attach [addr=0x%x,client=%s]\n", - client->driver->name, client->addr, client->name); + client->driver->driver.name, client->addr, client->name); if (!client->driver->command) return 0; diff --git a/drivers/media/video/indycam.c b/drivers/media/video/indycam.c index 3eba514..96a808e 100644 --- a/drivers/media/video/indycam.c +++ b/drivers/media/video/indycam.c @@ -451,8 +451,10 @@ static int indycam_command(struct i2c_client *client, unsigned int cmd, } static struct i2c_driver i2c_driver_indycam = { - .owner = THIS_MODULE, - .name = "indycam", + .driver = { + .owner = THIS_MODULE, + .name = "indycam", + }, .id = I2C_DRIVERID_INDYCAM, .attach_adapter = indycam_probe, .detach_client = indycam_detach, diff --git a/drivers/media/video/ir-kbd-i2c.c b/drivers/media/video/ir-kbd-i2c.c index 2e2f78a..82c7f50 100644 --- a/drivers/media/video/ir-kbd-i2c.c +++ b/drivers/media/video/ir-kbd-i2c.c @@ -278,7 +278,10 @@ static int ir_detach(struct i2c_client *client); static int ir_probe(struct i2c_adapter *adap); static struct i2c_driver driver = { - .name = "ir remote kbd driver", + .driver = { + .owner = THIS_MODULE, + .name = "ir remote kbd driver", + }, .id = I2C_DRIVERID_INFRARED, .attach_adapter = ir_probe, .detach_client = ir_detach, diff --git a/drivers/media/video/msp3400.c b/drivers/media/video/msp3400.c index c5e8ad3..3847d89 100644 --- a/drivers/media/video/msp3400.c +++ b/drivers/media/video/msp3400.c @@ -59,7 +59,8 @@ #define msp3400_dbg(fmt, arg...) \ do { \ if (debug) \ - printk(KERN_INFO "%s debug %d-%04x: " fmt, client->driver->name, \ + printk(KERN_INFO "%s debug %d-%04x: " fmt, \ + client->driver->driver.name, \ i2c_adapter_id(client->adapter), client->addr , ## arg); \ } while (0) @@ -67,7 +68,8 @@ #define msp3400_dbg_mediumvol(fmt, arg...) \ do { \ if (debug >= 2) \ - printk(KERN_INFO "%s debug %d-%04x: " fmt, client->driver->name, \ + printk(KERN_INFO "%s debug %d-%04x: " fmt, \ + client->driver->driver.name, \ i2c_adapter_id(client->adapter), client->addr , ## arg); \ } while (0) @@ -75,18 +77,19 @@ #define msp3400_dbg_highvol(fmt, arg...) \ do { \ if (debug >= 16) \ - printk(KERN_INFO "%s debug %d-%04x: " fmt, client->driver->name, \ + printk(KERN_INFO "%s debug %d-%04x: " fmt, \ + client->driver->driver.name, \ i2c_adapter_id(client->adapter), client->addr , ## arg); \ } while (0) #define msp3400_err(fmt, arg...) do { \ - printk(KERN_ERR "%s %d-%04x: " fmt, client->driver->name, \ + printk(KERN_ERR "%s %d-%04x: " fmt, client->driver->driver.name, \ i2c_adapter_id(client->adapter), client->addr , ## arg); } while (0) #define msp3400_warn(fmt, arg...) do { \ - printk(KERN_WARNING "%s %d-%04x: " fmt, client->driver->name, \ + printk(KERN_WARNING "%s %d-%04x: " fmt, client->driver->driver.name, \ i2c_adapter_id(client->adapter), client->addr , ## arg); } while (0) #define msp3400_info(fmt, arg...) do { \ - printk(KERN_INFO "%s %d-%04x: " fmt, client->driver->name, \ + printk(KERN_INFO "%s %d-%04x: " fmt, client->driver->driver.name, \ i2c_adapter_id(client->adapter), client->addr , ## arg); } while (0) #define OPMODE_AUTO -1 @@ -1561,13 +1564,13 @@ static int msp_resume(struct device * dev); static void msp_wake_thread(struct i2c_client *client); static struct i2c_driver driver = { - .owner = THIS_MODULE, - .name = "msp3400", .id = I2C_DRIVERID_MSP3400, .attach_adapter = msp_probe, .detach_client = msp_detach, .command = msp_command, .driver = { + .owner = THIS_MODULE, + .name = "i2c msp3400 driver", .suspend = msp_suspend, .resume = msp_resume, }, diff --git a/drivers/media/video/ovcamchip/ovcamchip_core.c b/drivers/media/video/ovcamchip/ovcamchip_core.c index 390d0d6..9ac398b 100644 --- a/drivers/media/video/ovcamchip/ovcamchip_core.c +++ b/drivers/media/video/ovcamchip/ovcamchip_core.c @@ -410,8 +410,10 @@ static int ovcamchip_command(struct i2c_client *c, unsigned int cmd, void *arg) /* ----------------------------------------------------------------------- */ static struct i2c_driver driver = { - .owner = THIS_MODULE, - .name = "ovcamchip", + .driver = { + .owner = THIS_MODULE, + .name = "ovcamchip", + }, .id = I2C_DRIVERID_OVCAMCHIP, .class = I2C_CLASS_CAM_DIGITAL, .attach_adapter = ovcamchip_attach, diff --git a/drivers/media/video/saa5246a.c b/drivers/media/video/saa5246a.c index 9bf6869..8c99edb 100644 --- a/drivers/media/video/saa5246a.c +++ b/drivers/media/video/saa5246a.c @@ -163,8 +163,10 @@ static int saa5246a_command(struct i2c_client *device, unsigned int cmd, static struct i2c_driver i2c_driver_videotext = { - .owner = THIS_MODULE, - .name = IF_NAME, /* name */ + .driver = { + .owner = THIS_MODULE, + .name = IF_NAME, /* name */ + }, .id = I2C_DRIVERID_SAA5249, /* in i2c.h */ .attach_adapter = saa5246a_probe, .detach_client = saa5246a_detach, diff --git a/drivers/media/video/saa5249.c b/drivers/media/video/saa5249.c index 811e863..5b346bd 100644 --- a/drivers/media/video/saa5249.c +++ b/drivers/media/video/saa5249.c @@ -236,8 +236,10 @@ static int saa5249_command(struct i2c_client *device, static struct i2c_driver i2c_driver_videotext = { - .owner = THIS_MODULE, - .name = IF_NAME, /* name */ + .driver = { + .owner = THIS_MODULE, + .name = IF_NAME, /* name */ + }, .id = I2C_DRIVERID_SAA5249, /* in i2c.h */ .attach_adapter = saa5249_probe, .detach_client = saa5249_detach, diff --git a/drivers/media/video/saa6588.c b/drivers/media/video/saa6588.c index 3d4076c..5ea36ee 100644 --- a/drivers/media/video/saa6588.c +++ b/drivers/media/video/saa6588.c @@ -495,8 +495,10 @@ static int saa6588_command(struct i2c_client *client, unsigned int cmd, /* ----------------------------------------------------------------------- */ static struct i2c_driver driver = { - .owner = THIS_MODULE, - .name = "i2c saa6588 driver", + .driver = { + .owner = THIS_MODULE, + .name = "i2c saa6588 driver", + }, .id = -1, /* FIXME */ .attach_adapter = saa6588_probe, .detach_client = saa6588_detach, diff --git a/drivers/media/video/saa7110.c b/drivers/media/video/saa7110.c index 8affa63..58f60ba 100644 --- a/drivers/media/video/saa7110.c +++ b/drivers/media/video/saa7110.c @@ -586,8 +586,10 @@ saa7110_detach_client (struct i2c_client *client) /* ----------------------------------------------------------------------- */ static struct i2c_driver i2c_driver_saa7110 = { - .owner = THIS_MODULE, - .name = "saa7110", + .driver = { + .owner = THIS_MODULE, + .name = "saa7110", + }, .id = I2C_DRIVERID_SAA7110, diff --git a/drivers/media/video/saa7111.c b/drivers/media/video/saa7111.c index 2b22045..946eb74 100644 --- a/drivers/media/video/saa7111.c +++ b/drivers/media/video/saa7111.c @@ -589,8 +589,10 @@ saa7111_detach_client (struct i2c_client *client) /* ----------------------------------------------------------------------- */ static struct i2c_driver i2c_driver_saa7111 = { - .owner = THIS_MODULE, - .name = "saa7111", + .driver = { + .owner = THIS_MODULE, + .name = "saa7111", + }, .id = I2C_DRIVERID_SAA7111A, diff --git a/drivers/media/video/saa7114.c b/drivers/media/video/saa7114.c index 285f6c7..df53b58 100644 --- a/drivers/media/video/saa7114.c +++ b/drivers/media/video/saa7114.c @@ -1203,8 +1203,10 @@ saa7114_detach_client (struct i2c_client *client) /* ----------------------------------------------------------------------- */ static struct i2c_driver i2c_driver_saa7114 = { - .owner = THIS_MODULE, - .name = "saa7114", + .driver = { + .owner = THIS_MODULE, + .name = "saa7114", + }, .id = I2C_DRIVERID_SAA7114, diff --git a/drivers/media/video/saa7115.c b/drivers/media/video/saa7115.c index 79aadd2..6ac1ab4 100644 --- a/drivers/media/video/saa7115.c +++ b/drivers/media/video/saa7115.c @@ -52,15 +52,16 @@ MODULE_PARM_DESC(debug, "Debug level (0-1)"); #define saa7115_dbg(fmt,arg...) \ do { \ if (debug) \ - printk(KERN_INFO "%s debug %d-%04x: " fmt, client->driver->name, \ + printk(KERN_INFO "%s debug %d-%04x: " fmt, \ + client->driver->driver.name, \ i2c_adapter_id(client->adapter), client->addr , ## arg); \ } while (0) #define saa7115_err(fmt, arg...) do { \ - printk(KERN_ERR "%s %d-%04x: " fmt, client->driver->name, \ + printk(KERN_ERR "%s %d-%04x: " fmt, client->driver->driver.name, \ i2c_adapter_id(client->adapter), client->addr , ## arg); } while (0) #define saa7115_info(fmt, arg...) do { \ - printk(KERN_INFO "%s %d-%04x: " fmt, client->driver->name, \ + printk(KERN_INFO "%s %d-%04x: " fmt, client->driver->driver.name, \ i2c_adapter_id(client->adapter), client->addr , ## arg); } while (0) static unsigned short normal_i2c[] = { 0x42 >> 1, 0x40 >> 1, I2C_CLIENT_END }; @@ -1353,12 +1354,14 @@ static int saa7115_detach(struct i2c_client *client) /* i2c implementation */ static struct i2c_driver i2c_driver_saa7115 = { - .name = "saa7115", + .driver = { + .owner = THIS_MODULE, + .name = "saa7115", + }, .id = I2C_DRIVERID_SAA711X, .attach_adapter = saa7115_probe, .detach_client = saa7115_detach, .command = saa7115_command, - .owner = THIS_MODULE, }; diff --git a/drivers/media/video/saa711x.c b/drivers/media/video/saa711x.c index 44bfc04..3f7cfb7 100644 --- a/drivers/media/video/saa711x.c +++ b/drivers/media/video/saa711x.c @@ -564,8 +564,10 @@ saa711x_detach_client (struct i2c_client *client) /* ----------------------------------------------------------------------- */ static struct i2c_driver i2c_driver_saa711x = { - .owner = THIS_MODULE, - .name = "saa711x", + .driver = { + .owner = THIS_MODULE, + .name = "saa711x", + }, .id = I2C_DRIVERID_SAA711X, diff --git a/drivers/media/video/saa7127.c b/drivers/media/video/saa7127.c index 1f4b415..659cb8a 100644 --- a/drivers/media/video/saa7127.c +++ b/drivers/media/video/saa7127.c @@ -69,7 +69,8 @@ MODULE_PARM_DESC(test_image, "test_image (0-1)"); #define saa7127_dbg(fmt, arg...) \ do { \ if (debug >= 1) \ - printk(KERN_INFO "%s debug %d-%04x: " fmt, client->driver->name, \ + printk(KERN_INFO "%s debug %d-%04x: " fmt, \ + client->driver->driver.name, \ i2c_adapter_id(client->adapter), client->addr , ## arg); \ } while (0) @@ -77,15 +78,16 @@ MODULE_PARM_DESC(test_image, "test_image (0-1)"); #define saa7127_dbg_highvol(fmt, arg...) \ do { \ if (debug == 2) \ - printk(KERN_INFO "%s debug %d-%04x: " fmt, client->driver->name, \ + printk(KERN_INFO "%s debug %d-%04x: " fmt, \ + client->driver->driver.name, \ i2c_adapter_id(client->adapter), client->addr , ## arg); \ } while (0) #define saa7127_err(fmt, arg...) do { \ - printk(KERN_ERR "%s %d-%04x: " fmt, client->driver->name, \ + printk(KERN_ERR "%s %d-%04x: " fmt, client->driver->driver.name, \ i2c_adapter_id(client->adapter), client->addr , ## arg); } while (0) #define saa7127_info(fmt, arg...) do { \ - printk(KERN_INFO "%s %d-%04x: " fmt, client->driver->name, \ + printk(KERN_INFO "%s %d-%04x: " fmt, client->driver->driver.name, \ i2c_adapter_id(client->adapter), client->addr , ## arg); } while (0) static unsigned short normal_i2c[] = { 0x88 >> 1, I2C_CLIENT_END }; @@ -818,12 +820,14 @@ static int saa7127_detach(struct i2c_client *client) /* ----------------------------------------------------------------------- */ static struct i2c_driver i2c_driver_saa7127 = { - .name = "saa7127", + .driver = { + .owner = THIS_MODULE, + .name = "saa7127", + }, .id = I2C_DRIVERID_SAA7127, .attach_adapter = saa7127_probe, .detach_client = saa7127_detach, .command = saa7127_command, - .owner = THIS_MODULE, }; diff --git a/drivers/media/video/saa7134/saa6752hs.c b/drivers/media/video/saa7134/saa6752hs.c index 6820606..0e8c9ed 100644 --- a/drivers/media/video/saa7134/saa6752hs.c +++ b/drivers/media/video/saa7134/saa6752hs.c @@ -597,8 +597,10 @@ saa6752hs_command(struct i2c_client *client, unsigned int cmd, void *arg) /* ----------------------------------------------------------------------- */ static struct i2c_driver driver = { - .owner = THIS_MODULE, - .name = "i2c saa6752hs MPEG encoder", + .driver = { + .owner = THIS_MODULE, + .name = "i2c saa6752hs MPEG encoder", + }, .id = I2C_DRIVERID_SAA6752HS, .attach_adapter = saa6752hs_probe, .detach_client = saa6752hs_detach, diff --git a/drivers/media/video/saa7134/saa7134-i2c.c b/drivers/media/video/saa7134/saa7134-i2c.c index df9dd36..1792d03 100644 --- a/drivers/media/video/saa7134/saa7134-i2c.c +++ b/drivers/media/video/saa7134/saa7134-i2c.c @@ -333,7 +333,7 @@ static int attach_inform(struct i2c_client *client) struct tuner_setup tun_setup; d1printk( "%s i2c attach [addr=0x%x,client=%s]\n", - client->driver->name, client->addr, client->name); + client->driver->driver.name, client->addr, client->name); /* Am I an i2c remote control? */ @@ -343,7 +343,7 @@ static int attach_inform(struct i2c_client *client) { struct IR_i2c *ir = i2c_get_clientdata(client); d1printk("%s i2c IR detected (%s).\n", - client->driver->name,ir->phys); + client->driver->driver.name, ir->phys); saa7134_set_i2c_ir(dev,ir); break; } diff --git a/drivers/media/video/saa7185.c b/drivers/media/video/saa7185.c index 9f37585..64047d77 100644 --- a/drivers/media/video/saa7185.c +++ b/drivers/media/video/saa7185.c @@ -486,8 +486,10 @@ saa7185_detach_client (struct i2c_client *client) /* ----------------------------------------------------------------------- */ static struct i2c_driver i2c_driver_saa7185 = { - .owner = THIS_MODULE, - .name = "saa7185", /* name */ + .driver = { + .owner = THIS_MODULE, + .name = "saa7185", /* name */ + }, .id = I2C_DRIVERID_SAA7185B, diff --git a/drivers/media/video/saa7191.c b/drivers/media/video/saa7191.c index 6be98fc..a0f8eaf 100644 --- a/drivers/media/video/saa7191.c +++ b/drivers/media/video/saa7191.c @@ -788,8 +788,10 @@ static int saa7191_command(struct i2c_client *client, unsigned int cmd, } static struct i2c_driver i2c_driver_saa7191 = { - .owner = THIS_MODULE, - .name = "saa7191", + .driver = { + .owner = THIS_MODULE, + .name = "saa7191", + }, .id = I2C_DRIVERID_SAA7191, .attach_adapter = saa7191_probe, .detach_client = saa7191_detach, diff --git a/drivers/media/video/tda7432.c b/drivers/media/video/tda7432.c index 239a586..59674d9 100644 --- a/drivers/media/video/tda7432.c +++ b/drivers/media/video/tda7432.c @@ -501,8 +501,10 @@ static int tda7432_command(struct i2c_client *client, } static struct i2c_driver driver = { - .owner = THIS_MODULE, - .name = "i2c tda7432 driver", + .driver = { + .owner = THIS_MODULE, + .name = "i2c tda7432 driver", + }, .id = I2C_DRIVERID_TDA7432, .attach_adapter = tda7432_probe, .detach_client = tda7432_detach, diff --git a/drivers/media/video/tda9840.c b/drivers/media/video/tda9840.c index f29fb50..8efc726 100644 --- a/drivers/media/video/tda9840.c +++ b/drivers/media/video/tda9840.c @@ -221,8 +221,10 @@ static int detach(struct i2c_client *client) } static struct i2c_driver driver = { - .owner = THIS_MODULE, - .name = "tda9840", + .driver = { + .owner = THIS_MODULE, + .name = "tda9840", + }, .id = I2C_DRIVERID_TDA9840, .attach_adapter = attach, .detach_client = detach, diff --git a/drivers/media/video/tda9875.c b/drivers/media/video/tda9875.c index d053b64..de89616 100644 --- a/drivers/media/video/tda9875.c +++ b/drivers/media/video/tda9875.c @@ -372,8 +372,10 @@ static int tda9875_command(struct i2c_client *client, static struct i2c_driver driver = { - .owner = THIS_MODULE, - .name = "i2c tda9875 driver", + .driver = { + .owner = THIS_MODULE, + .name = "i2c tda9875 driver", + }, .id = I2C_DRIVERID_TDA9875, .attach_adapter = tda9875_probe, .detach_client = tda9875_detach, diff --git a/drivers/media/video/tda9887.c b/drivers/media/video/tda9887.c index 324f61b..081f478 100644 --- a/drivers/media/video/tda9887.c +++ b/drivers/media/video/tda9887.c @@ -819,13 +819,13 @@ static int tda9887_resume(struct device * dev) /* ----------------------------------------------------------------------- */ static struct i2c_driver driver = { - .owner = THIS_MODULE, - .name = "i2c tda9887 driver", .id = -1, /* FIXME */ .attach_adapter = tda9887_probe, .detach_client = tda9887_detach, .command = tda9887_command, .driver = { + .owner = THIS_MODULE, + .name = "i2c tda9887 driver", .suspend = tda9887_suspend, .resume = tda9887_resume, }, diff --git a/drivers/media/video/tea6415c.c b/drivers/media/video/tea6415c.c index 96d88ce..e7e2213 100644 --- a/drivers/media/video/tea6415c.c +++ b/drivers/media/video/tea6415c.c @@ -190,8 +190,10 @@ static int command(struct i2c_client *client, unsigned int cmd, void *arg) } static struct i2c_driver driver = { - .owner = THIS_MODULE, - .name = "tea6415c", + .driver = { + .owner = THIS_MODULE, + .name = "tea6415c", + }, .id = I2C_DRIVERID_TEA6415C, .attach_adapter = attach, .detach_client = detach, diff --git a/drivers/media/video/tea6420.c b/drivers/media/video/tea6420.c index fd417de..74cc25f 100644 --- a/drivers/media/video/tea6420.c +++ b/drivers/media/video/tea6420.c @@ -167,8 +167,10 @@ static int command(struct i2c_client *client, unsigned int cmd, void *arg) } static struct i2c_driver driver = { - .owner = THIS_MODULE, - .name = "tea6420", + .driver = { + .owner = THIS_MODULE, + .name = "tea6420", + }, .id = I2C_DRIVERID_TEA6420, .attach_adapter = attach, .detach_client = detach, diff --git a/drivers/media/video/tuner-3036.c b/drivers/media/video/tuner-3036.c index 3505cec2..83257af 100644 --- a/drivers/media/video/tuner-3036.c +++ b/drivers/media/video/tuner-3036.c @@ -175,8 +175,10 @@ tuner_probe(struct i2c_adapter *adap) static struct i2c_driver i2c_driver_tuner = { - .owner = THIS_MODULE, - .name = "sab3036", + .driver = { + .owner = THIS_MODULE, + .name = "sab3036", + }, .id = I2C_DRIVERID_SAB3036, .attach_adapter = tuner_probe, .detach_client = tuner_detach, diff --git a/drivers/media/video/tuner-core.c b/drivers/media/video/tuner-core.c index 6328f09..e8c8549 100644 --- a/drivers/media/video/tuner-core.c +++ b/drivers/media/video/tuner-core.c @@ -206,7 +206,7 @@ static void set_type(struct i2c_client *c, unsigned int type, set_freq(c, t->freq); tuner_dbg("%s %s I2C addr 0x%02x with type %d used for 0x%02x\n", - c->adapter->name, c->driver->name, c->addr << 1, type, + c->adapter->name, c->driver->driver.name, c->addr << 1, type, t->mode_mask); } @@ -742,13 +742,13 @@ static int tuner_resume(struct device *dev) /* ----------------------------------------------------------------------- */ static struct i2c_driver driver = { - .owner = THIS_MODULE, - .name = "tuner", .id = I2C_DRIVERID_TUNER, .attach_adapter = tuner_probe, .detach_client = tuner_detach, .command = tuner_command, .driver = { + .owner = THIS_MODULE, + .name = "tuner", .suspend = tuner_suspend, .resume = tuner_resume, }, diff --git a/drivers/media/video/tvaudio.c b/drivers/media/video/tvaudio.c index 4f1f339..30bb2a3 100644 --- a/drivers/media/video/tvaudio.c +++ b/drivers/media/video/tvaudio.c @@ -1702,8 +1702,10 @@ static int chip_command(struct i2c_client *client, static struct i2c_driver driver = { - .owner = THIS_MODULE, - .name = "generic i2c audio driver", + .driver = { + .owner = THIS_MODULE, + .name = "generic i2c audio driver", + }, .id = I2C_DRIVERID_TVAUDIO, .attach_adapter = chip_probe, .detach_client = chip_detach, diff --git a/drivers/media/video/tveeprom.c b/drivers/media/video/tveeprom.c index d833b65..d8b5a17 100644 --- a/drivers/media/video/tveeprom.c +++ b/drivers/media/video/tveeprom.c @@ -778,8 +778,10 @@ tveeprom_detach_client (struct i2c_client *client) } static struct i2c_driver i2c_driver_tveeprom = { - .owner = THIS_MODULE, - .name = "tveeprom", + .driver = { + .owner = THIS_MODULE, + .name = "tveeprom", + }, .id = I2C_DRIVERID_TVEEPROM, .attach_adapter = tveeprom_attach_adapter, .detach_client = tveeprom_detach_client, diff --git a/drivers/media/video/tvmixer.c b/drivers/media/video/tvmixer.c index 936e01d..5f4d0185 100644 --- a/drivers/media/video/tvmixer.c +++ b/drivers/media/video/tvmixer.c @@ -228,9 +228,13 @@ static int tvmixer_release(struct inode *inode, struct file *file) static struct i2c_driver driver = { #ifdef I2C_PEC - .owner = THIS_MODULE, -#endif + .driver = { + .owner = THIS_MODULE, + .name = "tv card mixer driver", + }, +#else .name = "tv card mixer driver", +#endif .id = I2C_DRIVERID_TVMIXER, .detach_adapter = tvmixer_adapters, .attach_adapter = tvmixer_adapters, diff --git a/drivers/media/video/tvp5150.c b/drivers/media/video/tvp5150.c index 3734554..5eca71f 100644 --- a/drivers/media/video/tvp5150.c +++ b/drivers/media/video/tvp5150.c @@ -800,8 +800,10 @@ static int tvp5150_detach_client(struct i2c_client *client) /* ----------------------------------------------------------------------- */ static struct i2c_driver driver = { - .owner = THIS_MODULE, - .name = "tvp5150", + .driver = { + .owner = THIS_MODULE, + .name = "tvp5150", + }, /* FIXME */ .id = I2C_DRIVERID_SAA7110, diff --git a/drivers/media/video/vpx3220.c b/drivers/media/video/vpx3220.c index 54bc888..b85b598 100644 --- a/drivers/media/video/vpx3220.c +++ b/drivers/media/video/vpx3220.c @@ -721,8 +721,10 @@ vpx3220_attach_adapter (struct i2c_adapter *adapter) */ static struct i2c_driver vpx3220_i2c_driver = { - .owner = THIS_MODULE, - .name = "vpx3220", + .driver = { + .owner = THIS_MODULE, + .name = "vpx3220", + }, .id = I2C_DRIVERID_VPX3220, diff --git a/drivers/media/video/wm8775.c b/drivers/media/video/wm8775.c index 527c2591..22875f1 100644 --- a/drivers/media/video/wm8775.c +++ b/drivers/media/video/wm8775.c @@ -40,10 +40,10 @@ MODULE_AUTHOR("Ulf Eklund, Hans Verkuil"); MODULE_LICENSE("GPL"); #define wm8775_err(fmt, arg...) do { \ - printk(KERN_ERR "%s %d-%04x: " fmt, client->driver->name, \ + printk(KERN_ERR "%s %d-%04x: " fmt, client->driver->driver.name, \ i2c_adapter_id(client->adapter), client->addr , ## arg); } while (0) #define wm8775_info(fmt, arg...) do { \ - printk(KERN_INFO "%s %d-%04x: " fmt, client->driver->name, \ + printk(KERN_INFO "%s %d-%04x: " fmt, client->driver->driver.name, \ i2c_adapter_id(client->adapter), client->addr , ## arg); } while (0) @@ -232,14 +232,16 @@ static int wm8775_detach(struct i2c_client *client) /* i2c implementation */ static struct i2c_driver i2c_driver = { - .name = "wm8775", + .driver = { + .owner = THIS_MODULE, + .name = "wm8775", + }, .id = I2C_DRIVERID_WM8775, .attach_adapter = wm8775_probe, .detach_client = wm8775_detach, .command = wm8775_command, - .owner = THIS_MODULE, }; diff --git a/drivers/media/video/zoran_driver.c b/drivers/media/video/zoran_driver.c index 07bde9a..4034f1b 100644 --- a/drivers/media/video/zoran_driver.c +++ b/drivers/media/video/zoran_driver.c @@ -1311,7 +1311,7 @@ zoran_open (struct inode *inode, res = -ENODEV; goto open_unlock_and_return; } - if (!try_module_get(zr->decoder->driver->owner)) { + if (!try_module_get(zr->decoder->driver->driver.owner)) { dprintk(1, KERN_ERR "%s: failed to grab ownership of i2c decoder\n", @@ -1321,13 +1321,13 @@ zoran_open (struct inode *inode, goto open_unlock_and_return; } if (zr->encoder && - !try_module_get(zr->encoder->driver->owner)) { + !try_module_get(zr->encoder->driver->driver.owner)) { dprintk(1, KERN_ERR "%s: failed to grab ownership of i2c encoder\n", ZR_DEVNAME(zr)); res = -EIO; - module_put(zr->decoder->driver->owner); + module_put(zr->decoder->driver->driver.owner); module_put(THIS_MODULE); goto open_unlock_and_return; } @@ -1393,9 +1393,9 @@ zoran_open (struct inode *inode, open_unlock_and_return: /* if we grabbed locks, release them accordingly */ if (have_module_locks) { - module_put(zr->decoder->driver->owner); + module_put(zr->decoder->driver->driver.owner); if (zr->encoder) { - module_put(zr->encoder->driver->owner); + module_put(zr->encoder->driver->driver.owner); } module_put(THIS_MODULE); } @@ -1461,9 +1461,9 @@ zoran_close (struct inode *inode, kfree(fh); /* release locks on the i2c modules */ - module_put(zr->decoder->driver->owner); + module_put(zr->decoder->driver->driver.owner); if (zr->encoder) { - module_put(zr->encoder->driver->owner); + module_put(zr->encoder->driver->driver.owner); } module_put(THIS_MODULE); diff --git a/drivers/usb/media/w9968cf.c b/drivers/usb/media/w9968cf.c index 04d6933..3605a6f 100644 --- a/drivers/usb/media/w9968cf.c +++ b/drivers/usb/media/w9968cf.c @@ -1533,12 +1533,12 @@ static int w9968cf_i2c_attach_inform(struct i2c_client* client) } } else { DBG(4, "Rejected client [%s] with driver [%s]", - client->name, client->driver->name) + client->name, client->driver->driver.name) return -EINVAL; } DBG(5, "I2C attach client [%s] with driver [%s]", - client->name, client->driver->name) + client->name, client->driver->driver.name) return 0; } diff --git a/include/media/tuner.h b/include/media/tuner.h index faa0f8e..b37cde6 100644 --- a/include/media/tuner.h +++ b/include/media/tuner.h @@ -218,14 +218,15 @@ extern int default_tuner_init(struct i2c_client *c); extern int tea5767_autodetection(struct i2c_client *c); #define tuner_warn(fmt, arg...) do {\ - printk(KERN_WARNING "%s %d-%04x: " fmt, t->i2c.driver->name, \ + printk(KERN_WARNING "%s %d-%04x: " fmt, t->i2c.driver->driver.name, \ t->i2c.adapter->nr, t->i2c.addr , ##arg); } while (0) #define tuner_info(fmt, arg...) do {\ - printk(KERN_INFO "%s %d-%04x: " fmt, t->i2c.driver->name, \ + printk(KERN_INFO "%s %d-%04x: " fmt, t->i2c.driver->driver.name, \ t->i2c.adapter->nr, t->i2c.addr , ##arg); } while (0) #define tuner_dbg(fmt, arg...) do {\ if (tuner_debug) \ - printk(KERN_DEBUG "%s %d-%04x: " fmt, t->i2c.driver->name, \ + printk(KERN_DEBUG "%s %d-%04x: " fmt, \ + t->i2c.driver->driver.name, \ t->i2c.adapter->nr, t->i2c.addr , ##arg); } while (0) #endif /* __KERNEL__ */ -- cgit v1.1 From d74cdab1cad1e5895d8928eeeb2ac469f8410d2e Mon Sep 17 00:00:00 2001 From: Laurent Riffard Date: Sat, 26 Nov 2005 20:46:32 +0100 Subject: [PATCH] i2c: Drop i2c_driver.{owner,name}, 6 of 11 We should use the i2c_driver.driver's .name and .owner fields instead of the i2c_driver's ones. This patch updates the OSS drivers. Signed-off-by: Laurent Riffard Signed-off-by: Jean Delvare Signed-off-by: Greg Kroah-Hartman --- sound/oss/dmasound/dac3550a.c | 6 ++++-- sound/oss/dmasound/tas_common.c | 6 ++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/sound/oss/dmasound/dac3550a.c b/sound/oss/dmasound/dac3550a.c index 3402a66..835e0cf 100644 --- a/sound/oss/dmasound/dac3550a.c +++ b/sound/oss/dmasound/dac3550a.c @@ -41,8 +41,10 @@ static int daca_detect_client(struct i2c_adapter *adapter, int address); static int daca_detach_client(struct i2c_client *client); struct i2c_driver daca_driver = { - .owner = THIS_MODULE, - .name = "DAC3550A driver V " DACA_VERSION, + .driver = { + .owner = THIS_MODULE, + .name = "DAC3550A driver V " DACA_VERSION, + }, .id = I2C_DRIVERID_DACA, .attach_adapter = daca_attach_adapter, .detach_client = daca_detach_client, diff --git a/sound/oss/dmasound/tas_common.c b/sound/oss/dmasound/tas_common.c index 7e3d517..bd6910a 100644 --- a/sound/oss/dmasound/tas_common.c +++ b/sound/oss/dmasound/tas_common.c @@ -47,8 +47,10 @@ static int tas_attach_adapter(struct i2c_adapter *); static int tas_detach_client(struct i2c_client *); struct i2c_driver tas_driver = { - .owner = THIS_MODULE, - .name = "tas", + .driver = { + .owner = THIS_MODULE, + .name = "tas", + }, .attach_adapter = tas_attach_adapter, .detach_client = tas_detach_client, }; -- cgit v1.1 From e100fe103e679372b3d1d6e9d32fd3ab57484be2 Mon Sep 17 00:00:00 2001 From: Laurent Riffard Date: Sat, 26 Nov 2005 20:48:35 +0100 Subject: [PATCH] i2c: Drop i2c_driver.{owner,name}, 7 of 11 We should use the i2c_driver.driver's .name and .owner fields instead of the i2c_driver's ones. This patch updates the drivers for ppc arch. Signed-off-by: Laurent Riffard Signed-off-by: Jean Delvare Signed-off-by: Greg Kroah-Hartman --- sound/ppc/keywest.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/sound/ppc/keywest.c b/sound/ppc/keywest.c index fd8e2e6..d532924 100644 --- a/sound/ppc/keywest.c +++ b/sound/ppc/keywest.c @@ -41,7 +41,10 @@ static int keywest_attach_adapter(struct i2c_adapter *adapter); static int keywest_detach_client(struct i2c_client *client); struct i2c_driver keywest_driver = { - .name = "PMac Keywest Audio", + .driver = { + .owner = THIS_MODULE, + .name = "PMac Keywest Audio", + }, .id = I2C_DRIVERID_KEYWEST, .attach_adapter = &keywest_attach_adapter, .detach_client = &keywest_detach_client, -- cgit v1.1 From e533449d291b5a28ce9527539750a0cb88146f6e Mon Sep 17 00:00:00 2001 From: Laurent Riffard Date: Sat, 26 Nov 2005 20:51:06 +0100 Subject: [PATCH] i2c: Drop i2c_driver.{owner,name}, 8 of 11 We should use the i2c_driver.driver's .name and .owner fields instead of the i2c_driver's ones. This patch updates the drivers for acorn arch. Signed-off-by: Laurent Riffard Signed-off-by: Jean Delvare Acked-by: Russell King Signed-off-by: Greg Kroah-Hartman --- drivers/acorn/char/pcf8583.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/acorn/char/pcf8583.c b/drivers/acorn/char/pcf8583.c index befc946..5fc5940 100644 --- a/drivers/acorn/char/pcf8583.c +++ b/drivers/acorn/char/pcf8583.c @@ -257,7 +257,10 @@ pcf8583_command(struct i2c_client *client, unsigned int cmd, void *arg) } static struct i2c_driver pcf8583_driver = { - .name = "PCF8583", + .driver = { + .owner = THIS_MODULE, + .name = "PCF8583", + }, .id = I2C_DRIVERID_PCF8583, .attach_adapter = pcf8583_probe, .detach_client = pcf8583_detach, -- cgit v1.1 From 1a7edcdca618d25564690c2df27c2c5c6e9f6316 Mon Sep 17 00:00:00 2001 From: Laurent Riffard Date: Sat, 26 Nov 2005 20:52:34 +0100 Subject: [PATCH] i2c: Drop i2c_driver.{owner,name}, 9 of 11 We should use the i2c_driver.driver's .name and .owner fields instead of the i2c_driver's ones. This patch updates the matroxfb driver. Signed-off-by: Laurent Riffard Signed-off-by: Jean Delvare Acked-by: Petr Vandrovec Signed-off-by: Greg Kroah-Hartman --- drivers/video/matrox/matroxfb_maven.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/video/matrox/matroxfb_maven.c b/drivers/video/matrox/matroxfb_maven.c index 78994c5..f6fdb69 100644 --- a/drivers/video/matrox/matroxfb_maven.c +++ b/drivers/video/matrox/matroxfb_maven.c @@ -1293,8 +1293,10 @@ static int maven_command(struct i2c_client* client, unsigned int cmd, void* arg) } static struct i2c_driver maven_driver={ - .owner = THIS_MODULE, - .name = "maven", + .driver = { + .owner = THIS_MODULE, + .name = "maven", + }, .id = I2C_DRIVERID_MGATVO, .attach_adapter = maven_attach_adapter, .detach_client = maven_detach_client, -- cgit v1.1 From b33a665dba55c83f08cdd62aba1cd2672bccdd80 Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Sat, 26 Nov 2005 20:54:10 +0100 Subject: [PATCH] i2c: Drop i2c_driver.{owner,name}, 10 of 11 We should use the i2c_driver.driver's .name and .owner fields instead of the i2c_driver's ones. This patch updates the drivers for arm arch. Signed-off-by: Jean Delvare CC: Laurent Riffard Signed-off-by: Greg Kroah-Hartman --- arch/arm/mach-pxa/akita-ioexp.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/arch/arm/mach-pxa/akita-ioexp.c b/arch/arm/mach-pxa/akita-ioexp.c index b6bff55..6f7b965 100644 --- a/arch/arm/mach-pxa/akita-ioexp.c +++ b/arch/arm/mach-pxa/akita-ioexp.c @@ -124,8 +124,10 @@ static int max7310_detach_client(struct i2c_client *client) } static struct i2c_driver max7310_i2c_driver = { - .owner = THIS_MODULE, - .name = "akita-max7310", + .driver = { + .owner = THIS_MODULE, + .name = "akita-max7310", + }, .id = I2C_DRIVERID_AKITAIOEXP, .attach_adapter = max7310_attach_adapter, .detach_client = max7310_detach_client, -- cgit v1.1 From d45d204f0c3daa01a393dfe81415573f9459506a Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Sat, 26 Nov 2005 20:55:35 +0100 Subject: [PATCH] i2c: Drop i2c_driver.{owner,name}, 11 of 11 Document the drop of the owner and name fields of the i2c_driver structure. Signed-off-by: Jean Delvare CC: Laurent Riffard Signed-off-by: Greg Kroah-Hartman --- Documentation/i2c/porting-clients | 4 ++++ Documentation/i2c/writing-clients | 6 ++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/Documentation/i2c/porting-clients b/Documentation/i2c/porting-clients index 856274f..f997c72 100644 --- a/Documentation/i2c/porting-clients +++ b/Documentation/i2c/porting-clients @@ -125,6 +125,10 @@ Technical changes: * [Driver] The flags field of the i2c_driver structure is gone. I2C_DF_NOTIFY is now the default behavior. + The i2c_driver structure has a driver member, which is itself a + structure, those owner and name members should be initialized to + THIS_MODULE and a driver name string, respectively. i2c_driver + itself has no name member anymore. Coding policy: diff --git a/Documentation/i2c/writing-clients b/Documentation/i2c/writing-clients index 59d2c16..95eed2b 100644 --- a/Documentation/i2c/writing-clients +++ b/Documentation/i2c/writing-clients @@ -25,8 +25,10 @@ routines, a client structure specific information like the actual I2C address. static struct i2c_driver foo_driver = { - .owner = THIS_MODULE, - .name = "Foo version 2.3 driver", + .driver = { + .owner = THIS_MODULE, + .name = "foo", + }, .attach_adapter = &foo_attach_adapter, .detach_client = &foo_detach_client, .command = &foo_command /* may be NULL */ -- cgit v1.1 From e1c489b0e4fbb1687f8227fe78b4769c123768c1 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Wed, 30 Nov 2005 16:35:09 -0800 Subject: [PATCH] I2C: Fix up debug build error for previous i2c structure changes Signed-off-by: Greg Kroah-Hartman Signed-off-by: Jean Delvare --- drivers/i2c/busses/i2c-isa.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/i2c/busses/i2c-isa.c b/drivers/i2c/busses/i2c-isa.c index 9f93fb8..9f2ffef 100644 --- a/drivers/i2c/busses/i2c-isa.c +++ b/drivers/i2c/busses/i2c-isa.c @@ -98,7 +98,7 @@ int i2c_isa_add_driver(struct i2c_driver *driver) res = driver_register(&driver->driver); if (res) return res; - dev_dbg(&isa_adapter.dev, "Driver %s registered\n", driver->name); + dev_dbg(&isa_adapter.dev, "Driver %s registered\n", driver->driver.name); /* Now look for clients */ driver->attach_adapter(&isa_adapter); @@ -129,7 +129,7 @@ int i2c_isa_del_driver(struct i2c_driver *driver) /* Get the driver off the core list */ driver_unregister(&driver->driver); - dev_dbg(&isa_adapter.dev, "Driver %s unregistered\n", driver->name); + dev_dbg(&isa_adapter.dev, "Driver %s unregistered\n", driver->driver.name); return 0; } @@ -174,7 +174,7 @@ static void __exit i2c_isa_exit(void) list_for_each_safe(item, _n, &isa_adapter.clients) { client = list_entry(item, struct i2c_client, list); dev_err(&isa_adapter.dev, "Driver %s still has an active " - "ISA client at 0x%x\n", client->driver->name, + "ISA client at 0x%x\n", client->driver->driver.name, client->addr); } if (client != NULL) -- cgit v1.1 From de59cf9ed44f64991e52a9de6094729537f0420c Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Tue, 6 Dec 2005 15:33:15 -0800 Subject: [PATCH] I2C: Make i2c_add_driver automatically set the proper module owner This prevents i2c drivers from messing up and forgetting to set the module owner of their driver. It also reduces the size of their drivers by one line :) Signed-off-by: Greg Kroah-Hartman Cc: Jean Delvare --- drivers/i2c/i2c-core.c | 5 +++-- include/linux/i2c.h | 7 ++++++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c index 4ce5f0f..c23443e 100644 --- a/drivers/i2c/i2c-core.c +++ b/drivers/i2c/i2c-core.c @@ -287,7 +287,7 @@ int i2c_del_adapter(struct i2c_adapter *adap) * chips. */ -int i2c_add_driver(struct i2c_driver *driver) +int i2c_register_driver(struct module *owner, struct i2c_driver *driver) { struct list_head *item; struct i2c_adapter *adapter; @@ -296,6 +296,7 @@ int i2c_add_driver(struct i2c_driver *driver) down(&core_lists); /* add the driver to the list of i2c drivers in the driver core */ + driver->driver.owner = owner; driver->driver.bus = &i2c_bus_type; driver->driver.probe = i2c_device_probe; driver->driver.remove = i2c_device_remove; @@ -319,6 +320,7 @@ int i2c_add_driver(struct i2c_driver *driver) up(&core_lists); return res; } +EXPORT_SYMBOL(i2c_register_driver); int i2c_del_driver(struct i2c_driver *driver) { @@ -1132,7 +1134,6 @@ EXPORT_SYMBOL_GPL(i2c_bus_type); EXPORT_SYMBOL(i2c_add_adapter); EXPORT_SYMBOL(i2c_del_adapter); -EXPORT_SYMBOL(i2c_add_driver); EXPORT_SYMBOL(i2c_del_driver); EXPORT_SYMBOL(i2c_attach_client); EXPORT_SYMBOL(i2c_detach_client); diff --git a/include/linux/i2c.h b/include/linux/i2c.h index 75aa18e..7863a59 100644 --- a/include/linux/i2c.h +++ b/include/linux/i2c.h @@ -291,9 +291,14 @@ struct i2c_client_address_data { extern int i2c_add_adapter(struct i2c_adapter *); extern int i2c_del_adapter(struct i2c_adapter *); -extern int i2c_add_driver(struct i2c_driver *); +extern int i2c_register_driver(struct module *, struct i2c_driver *); extern int i2c_del_driver(struct i2c_driver *); +static inline int i2c_add_driver(struct i2c_driver *driver) +{ + return i2c_register_driver(THIS_MODULE, driver); +} + extern int i2c_attach_client(struct i2c_client *); extern int i2c_detach_client(struct i2c_client *); -- cgit v1.1 From 2b48716d1d2f2edb1e7cbc5ecf1cb2cb39373e33 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Tue, 6 Dec 2005 15:33:15 -0800 Subject: [PATCH] I2C: Remove .owner setting from i2c_driver as it's no longer needed Now that i2c_add_driver() doesn't need the module owner to be set by hand, we can delete it from the drivers. This patch catches all of the drivers that I found in the current tree (if a driver sets the .owner by hand, it's not a problem, just not needed.) Signed-off-by: Greg Kroah-Hartman Cc: Jean Delvare --- arch/arm/mach-pxa/akita-ioexp.c | 1 - drivers/acorn/char/pcf8583.c | 1 - drivers/hwmon/adm1021.c | 1 - drivers/hwmon/adm1025.c | 1 - drivers/hwmon/adm1026.c | 1 - drivers/hwmon/adm1031.c | 1 - drivers/hwmon/adm9240.c | 1 - drivers/hwmon/asb100.c | 1 - drivers/hwmon/atxp1.c | 1 - drivers/hwmon/ds1621.c | 1 - drivers/hwmon/fscher.c | 1 - drivers/hwmon/fscpos.c | 1 - drivers/hwmon/gl518sm.c | 1 - drivers/hwmon/gl520sm.c | 1 - drivers/hwmon/it87.c | 2 -- drivers/hwmon/lm63.c | 1 - drivers/hwmon/lm75.c | 1 - drivers/hwmon/lm77.c | 1 - drivers/hwmon/lm78.c | 2 -- drivers/hwmon/lm80.c | 1 - drivers/hwmon/lm83.c | 1 - drivers/hwmon/lm85.c | 1 - drivers/hwmon/lm87.c | 1 - drivers/hwmon/lm90.c | 1 - drivers/hwmon/lm92.c | 1 - drivers/hwmon/max1619.c | 1 - drivers/hwmon/pc87360.c | 1 - drivers/hwmon/sis5595.c | 1 - drivers/hwmon/smsc47b397.c | 1 - drivers/hwmon/smsc47m1.c | 1 - drivers/hwmon/via686a.c | 1 - drivers/hwmon/vt8231.c | 1 - drivers/hwmon/w83627ehf.c | 1 - drivers/hwmon/w83627hf.c | 1 - drivers/hwmon/w83781d.c | 2 -- drivers/hwmon/w83792d.c | 1 - drivers/hwmon/w83l785ts.c | 1 - drivers/i2c/chips/ds1337.c | 1 - drivers/i2c/chips/ds1374.c | 1 - drivers/i2c/chips/eeprom.c | 1 - drivers/i2c/chips/isp1301_omap.c | 1 - drivers/i2c/chips/m41t00.c | 1 - drivers/i2c/chips/max6875.c | 1 - drivers/i2c/chips/pca9539.c | 1 - drivers/i2c/chips/pcf8574.c | 1 - drivers/i2c/chips/pcf8591.c | 1 - drivers/i2c/chips/rtc8564.c | 1 - drivers/i2c/chips/tps65010.c | 1 - drivers/i2c/chips/x1205.c | 1 - drivers/i2c/i2c-dev.c | 1 - drivers/macintosh/therm_adt746x.c | 1 - drivers/macintosh/therm_pm72.c | 1 - drivers/macintosh/therm_windtunnel.c | 1 - drivers/macintosh/windfarm_lm75_sensor.c | 1 - drivers/media/video/adv7170.c | 1 - drivers/media/video/adv7175.c | 1 - drivers/media/video/bt819.c | 1 - drivers/media/video/bt832.c | 1 - drivers/media/video/bt856.c | 1 - drivers/media/video/cs53l32a.c | 1 - drivers/media/video/cx25840/cx25840-core.c | 1 - drivers/media/video/indycam.c | 1 - drivers/media/video/ir-kbd-i2c.c | 1 - drivers/media/video/msp3400.c | 1 - drivers/media/video/ovcamchip/ovcamchip_core.c | 1 - drivers/media/video/saa5246a.c | 1 - drivers/media/video/saa5249.c | 1 - drivers/media/video/saa6588.c | 1 - drivers/media/video/saa7110.c | 1 - drivers/media/video/saa7111.c | 1 - drivers/media/video/saa7114.c | 1 - drivers/media/video/saa7115.c | 1 - drivers/media/video/saa711x.c | 1 - drivers/media/video/saa7127.c | 1 - drivers/media/video/saa7134/saa6752hs.c | 1 - drivers/media/video/saa7185.c | 1 - drivers/media/video/saa7191.c | 1 - drivers/media/video/tda7432.c | 1 - drivers/media/video/tda9840.c | 1 - drivers/media/video/tda9875.c | 1 - drivers/media/video/tda9887.c | 1 - drivers/media/video/tea6415c.c | 1 - drivers/media/video/tea6420.c | 1 - drivers/media/video/tuner-3036.c | 1 - drivers/media/video/tuner-core.c | 1 - drivers/media/video/tvaudio.c | 1 - drivers/media/video/tveeprom.c | 1 - drivers/media/video/tvmixer.c | 1 - drivers/media/video/tvp5150.c | 1 - drivers/media/video/vpx3220.c | 1 - drivers/media/video/wm8775.c | 1 - drivers/video/matrox/matroxfb_maven.c | 1 - sound/oss/dmasound/dac3550a.c | 1 - sound/oss/dmasound/tas_common.c | 1 - sound/ppc/keywest.c | 1 - 95 files changed, 98 deletions(-) diff --git a/arch/arm/mach-pxa/akita-ioexp.c b/arch/arm/mach-pxa/akita-ioexp.c index 6f7b965..1b39874 100644 --- a/arch/arm/mach-pxa/akita-ioexp.c +++ b/arch/arm/mach-pxa/akita-ioexp.c @@ -125,7 +125,6 @@ static int max7310_detach_client(struct i2c_client *client) static struct i2c_driver max7310_i2c_driver = { .driver = { - .owner = THIS_MODULE, .name = "akita-max7310", }, .id = I2C_DRIVERID_AKITAIOEXP, diff --git a/drivers/acorn/char/pcf8583.c b/drivers/acorn/char/pcf8583.c index 5fc5940..9b49f31 100644 --- a/drivers/acorn/char/pcf8583.c +++ b/drivers/acorn/char/pcf8583.c @@ -258,7 +258,6 @@ pcf8583_command(struct i2c_client *client, unsigned int cmd, void *arg) static struct i2c_driver pcf8583_driver = { .driver = { - .owner = THIS_MODULE, .name = "PCF8583", }, .id = I2C_DRIVERID_PCF8583, diff --git a/drivers/hwmon/adm1021.c b/drivers/hwmon/adm1021.c index 679cb92..6656127 100644 --- a/drivers/hwmon/adm1021.c +++ b/drivers/hwmon/adm1021.c @@ -127,7 +127,6 @@ static int read_only; /* This is the driver that will be inserted */ static struct i2c_driver adm1021_driver = { .driver = { - .owner = THIS_MODULE, .name = "adm1021", }, .id = I2C_DRIVERID_ADM1021, diff --git a/drivers/hwmon/adm1025.c b/drivers/hwmon/adm1025.c index 3c70622..9331c56 100644 --- a/drivers/hwmon/adm1025.c +++ b/drivers/hwmon/adm1025.c @@ -119,7 +119,6 @@ static struct adm1025_data *adm1025_update_device(struct device *dev); static struct i2c_driver adm1025_driver = { .driver = { - .owner = THIS_MODULE, .name = "adm1025", }, .id = I2C_DRIVERID_ADM1025, diff --git a/drivers/hwmon/adm1026.c b/drivers/hwmon/adm1026.c index 92fac34..fefe6e7 100644 --- a/drivers/hwmon/adm1026.c +++ b/drivers/hwmon/adm1026.c @@ -309,7 +309,6 @@ static void adm1026_init_client(struct i2c_client *client); static struct i2c_driver adm1026_driver = { .driver = { - .owner = THIS_MODULE, .name = "adm1026", }, .attach_adapter = adm1026_attach_adapter, diff --git a/drivers/hwmon/adm1031.c b/drivers/hwmon/adm1031.c index e42d75e..d063979 100644 --- a/drivers/hwmon/adm1031.c +++ b/drivers/hwmon/adm1031.c @@ -106,7 +106,6 @@ static struct adm1031_data *adm1031_update_device(struct device *dev); /* This is the driver that will be inserted */ static struct i2c_driver adm1031_driver = { .driver = { - .owner = THIS_MODULE, .name = "adm1031", }, .attach_adapter = adm1031_attach_adapter, diff --git a/drivers/hwmon/adm9240.c b/drivers/hwmon/adm9240.c index e60309e..5ddc22f 100644 --- a/drivers/hwmon/adm9240.c +++ b/drivers/hwmon/adm9240.c @@ -138,7 +138,6 @@ static struct adm9240_data *adm9240_update_device(struct device *dev); /* driver data */ static struct i2c_driver adm9240_driver = { .driver = { - .owner = THIS_MODULE, .name = "adm9240", }, .id = I2C_DRIVERID_ADM9240, diff --git a/drivers/hwmon/asb100.c b/drivers/hwmon/asb100.c index 3068de0..ae9de63 100644 --- a/drivers/hwmon/asb100.c +++ b/drivers/hwmon/asb100.c @@ -218,7 +218,6 @@ static void asb100_init_client(struct i2c_client *client); static struct i2c_driver asb100_driver = { .driver = { - .owner = THIS_MODULE, .name = "asb100", }, .id = I2C_DRIVERID_ASB100, diff --git a/drivers/hwmon/atxp1.c b/drivers/hwmon/atxp1.c index ed152d9..b0c4900 100644 --- a/drivers/hwmon/atxp1.c +++ b/drivers/hwmon/atxp1.c @@ -51,7 +51,6 @@ static int atxp1_detect(struct i2c_adapter *adapter, int address, int kind); static struct i2c_driver atxp1_driver = { .driver = { - .owner = THIS_MODULE, .name = "atxp1", }, .attach_adapter = atxp1_attach_adapter, diff --git a/drivers/hwmon/ds1621.c b/drivers/hwmon/ds1621.c index 8600940..203f9c7 100644 --- a/drivers/hwmon/ds1621.c +++ b/drivers/hwmon/ds1621.c @@ -90,7 +90,6 @@ static struct ds1621_data *ds1621_update_client(struct device *dev); /* This is the driver that will be inserted */ static struct i2c_driver ds1621_driver = { .driver = { - .owner = THIS_MODULE, .name = "ds1621", }, .id = I2C_DRIVERID_DS1621, diff --git a/drivers/hwmon/fscher.c b/drivers/hwmon/fscher.c index 982fff4..2540918 100644 --- a/drivers/hwmon/fscher.c +++ b/drivers/hwmon/fscher.c @@ -119,7 +119,6 @@ static int fscher_write_value(struct i2c_client *client, u8 reg, u8 value); static struct i2c_driver fscher_driver = { .driver = { - .owner = THIS_MODULE, .name = "fscher", }, .id = I2C_DRIVERID_FSCHER, diff --git a/drivers/hwmon/fscpos.c b/drivers/hwmon/fscpos.c index 971146b..6d0146b 100644 --- a/drivers/hwmon/fscpos.c +++ b/drivers/hwmon/fscpos.c @@ -101,7 +101,6 @@ static void reset_fan_alarm(struct i2c_client *client, int nr); */ static struct i2c_driver fscpos_driver = { .driver = { - .owner = THIS_MODULE, .name = "fscpos", }, .id = I2C_DRIVERID_FSCPOS, diff --git a/drivers/hwmon/gl518sm.c b/drivers/hwmon/gl518sm.c index 9c5ca1f..9e685e3 100644 --- a/drivers/hwmon/gl518sm.c +++ b/drivers/hwmon/gl518sm.c @@ -152,7 +152,6 @@ static struct gl518_data *gl518_update_device(struct device *dev); /* This is the driver that will be inserted */ static struct i2c_driver gl518_driver = { .driver = { - .owner = THIS_MODULE, .name = "gl518sm", }, .id = I2C_DRIVERID_GL518, diff --git a/drivers/hwmon/gl520sm.c b/drivers/hwmon/gl520sm.c index a9a724a..baee60e 100644 --- a/drivers/hwmon/gl520sm.c +++ b/drivers/hwmon/gl520sm.c @@ -110,7 +110,6 @@ static struct gl520_data *gl520_update_device(struct device *dev); /* Driver data */ static struct i2c_driver gl520_driver = { .driver = { - .owner = THIS_MODULE, .name = "gl520sm", }, .id = I2C_DRIVERID_GL520, diff --git a/drivers/hwmon/it87.c b/drivers/hwmon/it87.c index 24d520b..29b74a8 100644 --- a/drivers/hwmon/it87.c +++ b/drivers/hwmon/it87.c @@ -235,7 +235,6 @@ static void it87_init_client(struct i2c_client *client, struct it87_data *data); static struct i2c_driver it87_driver = { .driver = { - .owner = THIS_MODULE, .name = "it87", }, .id = I2C_DRIVERID_IT87, @@ -245,7 +244,6 @@ static struct i2c_driver it87_driver = { static struct i2c_driver it87_isa_driver = { .driver = { - .owner = THIS_MODULE, .name = "it87-isa", }, .attach_adapter = it87_isa_attach_adapter, diff --git a/drivers/hwmon/lm63.c b/drivers/hwmon/lm63.c index 35baae7..6b1aa7e 100644 --- a/drivers/hwmon/lm63.c +++ b/drivers/hwmon/lm63.c @@ -140,7 +140,6 @@ static void lm63_init_client(struct i2c_client *client); static struct i2c_driver lm63_driver = { .driver = { - .owner = THIS_MODULE, .name = "lm63", }, .attach_adapter = lm63_attach_adapter, diff --git a/drivers/hwmon/lm75.c b/drivers/hwmon/lm75.c index db35fbf..74ca2c8 100644 --- a/drivers/hwmon/lm75.c +++ b/drivers/hwmon/lm75.c @@ -67,7 +67,6 @@ static struct lm75_data *lm75_update_device(struct device *dev); /* This is the driver that will be inserted */ static struct i2c_driver lm75_driver = { .driver = { - .owner = THIS_MODULE, .name = "lm75", }, .id = I2C_DRIVERID_LM75, diff --git a/drivers/hwmon/lm77.c b/drivers/hwmon/lm77.c index 1770720..a2f420d 100644 --- a/drivers/hwmon/lm77.c +++ b/drivers/hwmon/lm77.c @@ -75,7 +75,6 @@ static struct lm77_data *lm77_update_device(struct device *dev); /* This is the driver that will be inserted */ static struct i2c_driver lm77_driver = { .driver = { - .owner = THIS_MODULE, .name = "lm77", }, .attach_adapter = lm77_attach_adapter, diff --git a/drivers/hwmon/lm78.c b/drivers/hwmon/lm78.c index 3af5b06..e404001 100644 --- a/drivers/hwmon/lm78.c +++ b/drivers/hwmon/lm78.c @@ -165,7 +165,6 @@ static void lm78_init_client(struct i2c_client *client); static struct i2c_driver lm78_driver = { .driver = { - .owner = THIS_MODULE, .name = "lm78", }, .id = I2C_DRIVERID_LM78, @@ -175,7 +174,6 @@ static struct i2c_driver lm78_driver = { static struct i2c_driver lm78_isa_driver = { .driver = { - .owner = THIS_MODULE, .name = "lm78-isa", }, .attach_adapter = lm78_isa_attach_adapter, diff --git a/drivers/hwmon/lm80.c b/drivers/hwmon/lm80.c index 1dc118f..c9a7cde 100644 --- a/drivers/hwmon/lm80.c +++ b/drivers/hwmon/lm80.c @@ -144,7 +144,6 @@ static int lm80_write_value(struct i2c_client *client, u8 reg, u8 value); static struct i2c_driver lm80_driver = { .driver = { - .owner = THIS_MODULE, .name = "lm80", }, .id = I2C_DRIVERID_LM80, diff --git a/drivers/hwmon/lm83.c b/drivers/hwmon/lm83.c index 1c1744f..26dfa9e 100644 --- a/drivers/hwmon/lm83.c +++ b/drivers/hwmon/lm83.c @@ -125,7 +125,6 @@ static struct lm83_data *lm83_update_device(struct device *dev); static struct i2c_driver lm83_driver = { .driver = { - .owner = THIS_MODULE, .name = "lm83", }, .id = I2C_DRIVERID_LM83, diff --git a/drivers/hwmon/lm85.c b/drivers/hwmon/lm85.c index b537c18..7389a01 100644 --- a/drivers/hwmon/lm85.c +++ b/drivers/hwmon/lm85.c @@ -381,7 +381,6 @@ static void lm85_init_client(struct i2c_client *client); static struct i2c_driver lm85_driver = { .driver = { - .owner = THIS_MODULE, .name = "lm85", }, .id = I2C_DRIVERID_LM85, diff --git a/drivers/hwmon/lm87.c b/drivers/hwmon/lm87.c index 3152c00..6ba34c3 100644 --- a/drivers/hwmon/lm87.c +++ b/drivers/hwmon/lm87.c @@ -162,7 +162,6 @@ static struct lm87_data *lm87_update_device(struct device *dev); static struct i2c_driver lm87_driver = { .driver = { - .owner = THIS_MODULE, .name = "lm87", }, .id = I2C_DRIVERID_LM87, diff --git a/drivers/hwmon/lm90.c b/drivers/hwmon/lm90.c index ff7ba1e..56794644 100644 --- a/drivers/hwmon/lm90.c +++ b/drivers/hwmon/lm90.c @@ -187,7 +187,6 @@ static struct lm90_data *lm90_update_device(struct device *dev); static struct i2c_driver lm90_driver = { .driver = { - .owner = THIS_MODULE, .name = "lm90", }, .id = I2C_DRIVERID_LM90, diff --git a/drivers/hwmon/lm92.c b/drivers/hwmon/lm92.c index b4e4a84..b0c4cb7 100644 --- a/drivers/hwmon/lm92.c +++ b/drivers/hwmon/lm92.c @@ -411,7 +411,6 @@ static int lm92_detach_client(struct i2c_client *client) static struct i2c_driver lm92_driver = { .driver = { - .owner = THIS_MODULE, .name = "lm92", }, .id = I2C_DRIVERID_LM92, diff --git a/drivers/hwmon/max1619.c b/drivers/hwmon/max1619.c index 1a50b13..3abe330 100644 --- a/drivers/hwmon/max1619.c +++ b/drivers/hwmon/max1619.c @@ -91,7 +91,6 @@ static struct max1619_data *max1619_update_device(struct device *dev); static struct i2c_driver max1619_driver = { .driver = { - .owner = THIS_MODULE, .name = "max1619", }, .attach_adapter = max1619_attach_adapter, diff --git a/drivers/hwmon/pc87360.c b/drivers/hwmon/pc87360.c index 5469489..f161e88 100644 --- a/drivers/hwmon/pc87360.c +++ b/drivers/hwmon/pc87360.c @@ -237,7 +237,6 @@ static struct pc87360_data *pc87360_update_device(struct device *dev); static struct i2c_driver pc87360_driver = { .driver = { - .owner = THIS_MODULE, .name = "pc87360", }, .attach_adapter = pc87360_detect, diff --git a/drivers/hwmon/sis5595.c b/drivers/hwmon/sis5595.c index 9f44b93..8be5189 100644 --- a/drivers/hwmon/sis5595.c +++ b/drivers/hwmon/sis5595.c @@ -199,7 +199,6 @@ static void sis5595_init_client(struct i2c_client *client); static struct i2c_driver sis5595_driver = { .driver = { - .owner = THIS_MODULE, .name = "sis5595", }, .attach_adapter = sis5595_detect, diff --git a/drivers/hwmon/smsc47b397.c b/drivers/hwmon/smsc47b397.c index 02e5d55..8663bbb 100644 --- a/drivers/hwmon/smsc47b397.c +++ b/drivers/hwmon/smsc47b397.c @@ -227,7 +227,6 @@ static int smsc47b397_detect(struct i2c_adapter *adapter); static struct i2c_driver smsc47b397_driver = { .driver = { - .owner = THIS_MODULE, .name = "smsc47b397", }, .attach_adapter = smsc47b397_detect, diff --git a/drivers/hwmon/smsc47m1.c b/drivers/hwmon/smsc47m1.c index b3051ad..d1e3ec0 100644 --- a/drivers/hwmon/smsc47m1.c +++ b/drivers/hwmon/smsc47m1.c @@ -127,7 +127,6 @@ static struct smsc47m1_data *smsc47m1_update_device(struct device *dev, static struct i2c_driver smsc47m1_driver = { .driver = { - .owner = THIS_MODULE, .name = "smsc47m1", }, .attach_adapter = smsc47m1_detect, diff --git a/drivers/hwmon/via686a.c b/drivers/hwmon/via686a.c index db75fbc..cb01848 100644 --- a/drivers/hwmon/via686a.c +++ b/drivers/hwmon/via686a.c @@ -573,7 +573,6 @@ static DEVICE_ATTR(alarms, S_IRUGO, show_alarms, NULL); smbus_driver and isa_driver, and clients could be of either kind */ static struct i2c_driver via686a_driver = { .driver = { - .owner = THIS_MODULE, .name = "via686a", }, .attach_adapter = via686a_detect, diff --git a/drivers/hwmon/vt8231.c b/drivers/hwmon/vt8231.c index c2eb54b..d00a726 100644 --- a/drivers/hwmon/vt8231.c +++ b/drivers/hwmon/vt8231.c @@ -586,7 +586,6 @@ static DEVICE_ATTR(alarms, S_IRUGO, show_alarms, NULL); static struct i2c_driver vt8231_driver = { .driver = { - .owner = THIS_MODULE, .name = "vt8231", }, .attach_adapter = vt8231_detect, diff --git a/drivers/hwmon/w83627ehf.c b/drivers/hwmon/w83627ehf.c index 94538fb..12d79f5 100644 --- a/drivers/hwmon/w83627ehf.c +++ b/drivers/hwmon/w83627ehf.c @@ -786,7 +786,6 @@ static int w83627ehf_detach_client(struct i2c_client *client) static struct i2c_driver w83627ehf_driver = { .driver = { - .owner = THIS_MODULE, .name = "w83627ehf", }, .attach_adapter = w83627ehf_detect, diff --git a/drivers/hwmon/w83627hf.c b/drivers/hwmon/w83627hf.c index 2ffb84f..7ea441d4 100644 --- a/drivers/hwmon/w83627hf.c +++ b/drivers/hwmon/w83627hf.c @@ -333,7 +333,6 @@ static void w83627hf_init_client(struct i2c_client *client); static struct i2c_driver w83627hf_driver = { .driver = { - .owner = THIS_MODULE, .name = "w83627hf", }, .attach_adapter = w83627hf_detect, diff --git a/drivers/hwmon/w83781d.c b/drivers/hwmon/w83781d.c index fd1a59c..5571148 100644 --- a/drivers/hwmon/w83781d.c +++ b/drivers/hwmon/w83781d.c @@ -270,7 +270,6 @@ static void w83781d_init_client(struct i2c_client *client); static struct i2c_driver w83781d_driver = { .driver = { - .owner = THIS_MODULE, .name = "w83781d", }, .id = I2C_DRIVERID_W83781D, @@ -280,7 +279,6 @@ static struct i2c_driver w83781d_driver = { static struct i2c_driver w83781d_isa_driver = { .driver = { - .owner = THIS_MODULE, .name = "w83781d-isa", }, .attach_adapter = w83781d_isa_attach_adapter, diff --git a/drivers/hwmon/w83792d.c b/drivers/hwmon/w83792d.c index 9018445..ff1c9f0 100644 --- a/drivers/hwmon/w83792d.c +++ b/drivers/hwmon/w83792d.c @@ -318,7 +318,6 @@ static void w83792d_init_client(struct i2c_client *client); static struct i2c_driver w83792d_driver = { .driver = { - .owner = THIS_MODULE, .name = "w83792d", }, .attach_adapter = w83792d_attach_adapter, diff --git a/drivers/hwmon/w83l785ts.c b/drivers/hwmon/w83l785ts.c index fc9f202..f66c0cf 100644 --- a/drivers/hwmon/w83l785ts.c +++ b/drivers/hwmon/w83l785ts.c @@ -93,7 +93,6 @@ static struct w83l785ts_data *w83l785ts_update_device(struct device *dev); static struct i2c_driver w83l785ts_driver = { .driver = { - .owner = THIS_MODULE, .name = "w83l785ts", }, .id = I2C_DRIVERID_W83L785TS, diff --git a/drivers/i2c/chips/ds1337.c b/drivers/i2c/chips/ds1337.c index a9d4ac7..93d483b 100644 --- a/drivers/i2c/chips/ds1337.c +++ b/drivers/i2c/chips/ds1337.c @@ -53,7 +53,6 @@ static int ds1337_command(struct i2c_client *client, unsigned int cmd, */ static struct i2c_driver ds1337_driver = { .driver = { - .owner = THIS_MODULE, .name = "ds1337", }, .attach_adapter = ds1337_attach_adapter, diff --git a/drivers/i2c/chips/ds1374.c b/drivers/i2c/chips/ds1374.c index 3e3ebd8..0710b9d 100644 --- a/drivers/i2c/chips/ds1374.c +++ b/drivers/i2c/chips/ds1374.c @@ -233,7 +233,6 @@ static int ds1374_detach(struct i2c_client *client) static struct i2c_driver ds1374_driver = { .driver = { - .owner = THIS_MODULE, .name = DS1374_DRV_NAME, }, .id = I2C_DRIVERID_DS1374, diff --git a/drivers/i2c/chips/eeprom.c b/drivers/i2c/chips/eeprom.c index d0c9f29..41116b7 100644 --- a/drivers/i2c/chips/eeprom.c +++ b/drivers/i2c/chips/eeprom.c @@ -69,7 +69,6 @@ static int eeprom_detach_client(struct i2c_client *client); /* This is the driver that will be inserted */ static struct i2c_driver eeprom_driver = { .driver = { - .owner = THIS_MODULE, .name = "eeprom", }, .id = I2C_DRIVERID_EEPROM, diff --git a/drivers/i2c/chips/isp1301_omap.c b/drivers/i2c/chips/isp1301_omap.c index 9f1ec03..1251c7f 100644 --- a/drivers/i2c/chips/isp1301_omap.c +++ b/drivers/i2c/chips/isp1301_omap.c @@ -1633,7 +1633,6 @@ static int isp1301_scan_bus(struct i2c_adapter *bus) static struct i2c_driver isp1301_driver = { .driver = { - .owner = THIS_MODULE, .name = "isp1301_omap", }, .id = 1301, /* FIXME "official", i2c-ids.h */ diff --git a/drivers/i2c/chips/m41t00.c b/drivers/i2c/chips/m41t00.c index 92759b2..2dc3d48 100644 --- a/drivers/i2c/chips/m41t00.c +++ b/drivers/i2c/chips/m41t00.c @@ -212,7 +212,6 @@ m41t00_detach(struct i2c_client *client) static struct i2c_driver m41t00_driver = { .driver = { - .owner = THIS_MODULE, .name = M41T00_DRV_NAME, }, .id = I2C_DRIVERID_STM41T00, diff --git a/drivers/i2c/chips/max6875.c b/drivers/i2c/chips/max6875.c index 3705117..6d3ff58 100644 --- a/drivers/i2c/chips/max6875.c +++ b/drivers/i2c/chips/max6875.c @@ -68,7 +68,6 @@ static int max6875_detach_client(struct i2c_client *client); /* This is the driver that will be inserted */ static struct i2c_driver max6875_driver = { .driver = { - .owner = THIS_MODULE, .name = "max6875", }, .attach_adapter = max6875_attach_adapter, diff --git a/drivers/i2c/chips/pca9539.c b/drivers/i2c/chips/pca9539.c index bb57faa..54b6e6a 100644 --- a/drivers/i2c/chips/pca9539.c +++ b/drivers/i2c/chips/pca9539.c @@ -39,7 +39,6 @@ static int pca9539_detach_client(struct i2c_client *client); /* This is the driver that will be inserted */ static struct i2c_driver pca9539_driver = { .driver = { - .owner = THIS_MODULE, .name = "pca9539", }, .attach_adapter = pca9539_attach_adapter, diff --git a/drivers/i2c/chips/pcf8574.c b/drivers/i2c/chips/pcf8574.c index 3d4d4d6..c3e6449 100644 --- a/drivers/i2c/chips/pcf8574.c +++ b/drivers/i2c/chips/pcf8574.c @@ -66,7 +66,6 @@ static void pcf8574_init_client(struct i2c_client *client); /* This is the driver that will be inserted */ static struct i2c_driver pcf8574_driver = { .driver = { - .owner = THIS_MODULE, .name = "pcf8574", }, .id = I2C_DRIVERID_PCF8574, diff --git a/drivers/i2c/chips/pcf8591.c b/drivers/i2c/chips/pcf8591.c index 8f41bb3..36cff09 100644 --- a/drivers/i2c/chips/pcf8591.c +++ b/drivers/i2c/chips/pcf8591.c @@ -89,7 +89,6 @@ static int pcf8591_read_channel(struct device *dev, int channel); /* This is the driver that will be inserted */ static struct i2c_driver pcf8591_driver = { .driver = { - .owner = THIS_MODULE, .name = "pcf8591", }, .id = I2C_DRIVERID_PCF8591, diff --git a/drivers/i2c/chips/rtc8564.c b/drivers/i2c/chips/rtc8564.c index 6f567e2..ceaa6b0 100644 --- a/drivers/i2c/chips/rtc8564.c +++ b/drivers/i2c/chips/rtc8564.c @@ -359,7 +359,6 @@ rtc8564_command(struct i2c_client *client, unsigned int cmd, void *arg) static struct i2c_driver rtc8564_driver = { .driver = { - .owner = THIS_MODULE, .name = "RTC8564", }, .id = I2C_DRIVERID_RTC8564, diff --git a/drivers/i2c/chips/tps65010.c b/drivers/i2c/chips/tps65010.c index 92947a6..e70b3db 100644 --- a/drivers/i2c/chips/tps65010.c +++ b/drivers/i2c/chips/tps65010.c @@ -638,7 +638,6 @@ static int __init tps65010_scan_bus(struct i2c_adapter *bus) static struct i2c_driver tps65010_driver = { .driver = { - .owner = THIS_MODULE, .name = "tps65010", }, .attach_adapter = tps65010_scan_bus, diff --git a/drivers/i2c/chips/x1205.c b/drivers/i2c/chips/x1205.c index 6880eab..245fffa 100644 --- a/drivers/i2c/chips/x1205.c +++ b/drivers/i2c/chips/x1205.c @@ -106,7 +106,6 @@ static int x1205_command(struct i2c_client *client, unsigned int cmd, static struct i2c_driver x1205_driver = { .driver = { - .owner = THIS_MODULE, .name = "x1205", }, .attach_adapter = &x1205_attach, diff --git a/drivers/i2c/i2c-dev.c b/drivers/i2c/i2c-dev.c index 9715217..e140dd7 100644 --- a/drivers/i2c/i2c-dev.c +++ b/drivers/i2c/i2c-dev.c @@ -482,7 +482,6 @@ static int i2cdev_command(struct i2c_client *client, unsigned int cmd, static struct i2c_driver i2cdev_driver = { .driver = { - .owner = THIS_MODULE, .name = "dev_driver", }, .id = I2C_DRIVERID_I2CDEV, diff --git a/drivers/macintosh/therm_adt746x.c b/drivers/macintosh/therm_adt746x.c index 8bb1d85..02a3117 100644 --- a/drivers/macintosh/therm_adt746x.c +++ b/drivers/macintosh/therm_adt746x.c @@ -172,7 +172,6 @@ detach_thermostat(struct i2c_adapter *adapter) static struct i2c_driver thermostat_driver = { .driver = { - .owner = THIS_MODULE, .name = "therm_adt746x", }, .attach_adapter = attach_thermostat, diff --git a/drivers/macintosh/therm_pm72.c b/drivers/macintosh/therm_pm72.c index 97807be..cf72b78 100644 --- a/drivers/macintosh/therm_pm72.c +++ b/drivers/macintosh/therm_pm72.c @@ -284,7 +284,6 @@ static int therm_pm72_detach(struct i2c_adapter *adapter); static struct i2c_driver therm_pm72_driver = { .driver = { - .owner = THIS_MODULE, .name = "therm_pm72", }, .attach_adapter = therm_pm72_attach, diff --git a/drivers/macintosh/therm_windtunnel.c b/drivers/macintosh/therm_windtunnel.c index 259f19d..3d9dd2e 100644 --- a/drivers/macintosh/therm_windtunnel.c +++ b/drivers/macintosh/therm_windtunnel.c @@ -355,7 +355,6 @@ do_detach( struct i2c_client *client ) static struct i2c_driver g4fan_driver = { .driver = { - .owner = THIS_MODULE, .name = "therm_windtunnel", }, .id = I2C_DRIVERID_G4FAN, diff --git a/drivers/macintosh/windfarm_lm75_sensor.c b/drivers/macintosh/windfarm_lm75_sensor.c index 555d0e4..fd16642 100644 --- a/drivers/macintosh/windfarm_lm75_sensor.c +++ b/drivers/macintosh/windfarm_lm75_sensor.c @@ -48,7 +48,6 @@ static int wf_lm75_detach(struct i2c_client *client); static struct i2c_driver wf_lm75_driver = { .driver = { - .owner = THIS_MODULE, .name = "wf_lm75", }, .attach_adapter = wf_lm75_attach, diff --git a/drivers/media/video/adv7170.c b/drivers/media/video/adv7170.c index c5f1c6b..e61003d 100644 --- a/drivers/media/video/adv7170.c +++ b/drivers/media/video/adv7170.c @@ -498,7 +498,6 @@ adv7170_detach_client (struct i2c_client *client) static struct i2c_driver i2c_driver_adv7170 = { .driver = { - .owner = THIS_MODULE, .name = "adv7170", /* name */ }, diff --git a/drivers/media/video/adv7175.c b/drivers/media/video/adv7175.c index 33158aa..6d9536a 100644 --- a/drivers/media/video/adv7175.c +++ b/drivers/media/video/adv7175.c @@ -548,7 +548,6 @@ adv7175_detach_client (struct i2c_client *client) static struct i2c_driver i2c_driver_adv7175 = { .driver = { - .owner = THIS_MODULE, .name = "adv7175", /* name */ }, diff --git a/drivers/media/video/bt819.c b/drivers/media/video/bt819.c index 5868bbb..560b998 100644 --- a/drivers/media/video/bt819.c +++ b/drivers/media/video/bt819.c @@ -623,7 +623,6 @@ bt819_detach_client (struct i2c_client *client) static struct i2c_driver i2c_driver_bt819 = { .driver = { - .owner = THIS_MODULE, .name = "bt819", }, diff --git a/drivers/media/video/bt832.c b/drivers/media/video/bt832.c index 347eb71..1c3ff5f 100644 --- a/drivers/media/video/bt832.c +++ b/drivers/media/video/bt832.c @@ -231,7 +231,6 @@ bt832_command(struct i2c_client *client, unsigned int cmd, void *arg) static struct i2c_driver driver = { .driver = { - .owner = THIS_MODULE, .name = "i2c bt832 driver", }, .id = -1, /* FIXME */ diff --git a/drivers/media/video/bt856.c b/drivers/media/video/bt856.c index 207525a..6050806 100644 --- a/drivers/media/video/bt856.c +++ b/drivers/media/video/bt856.c @@ -405,7 +405,6 @@ bt856_detach_client (struct i2c_client *client) static struct i2c_driver i2c_driver_bt856 = { .driver = { - .owner = THIS_MODULE, .name = "bt856", }, diff --git a/drivers/media/video/cs53l32a.c b/drivers/media/video/cs53l32a.c index 60484f9..643ead1 100644 --- a/drivers/media/video/cs53l32a.c +++ b/drivers/media/video/cs53l32a.c @@ -217,7 +217,6 @@ static int cs53l32a_detach(struct i2c_client *client) /* i2c implementation */ static struct i2c_driver i2c_driver = { .driver = { - .owner = THIS_MODULE, .name = "cs53l32a", }, .id = I2C_DRIVERID_CS53L32A, diff --git a/drivers/media/video/cx25840/cx25840-core.c b/drivers/media/video/cx25840/cx25840-core.c index 830d519..3b09f46 100644 --- a/drivers/media/video/cx25840/cx25840-core.c +++ b/drivers/media/video/cx25840/cx25840-core.c @@ -844,7 +844,6 @@ static int cx25840_detach_client(struct i2c_client *client) static struct i2c_driver i2c_driver_cx25840 = { .driver = { - .owner = THIS_MODULE, .name = "cx25840", }, diff --git a/drivers/media/video/indycam.c b/drivers/media/video/indycam.c index 96a808e..bb5cbec 100644 --- a/drivers/media/video/indycam.c +++ b/drivers/media/video/indycam.c @@ -452,7 +452,6 @@ static int indycam_command(struct i2c_client *client, unsigned int cmd, static struct i2c_driver i2c_driver_indycam = { .driver = { - .owner = THIS_MODULE, .name = "indycam", }, .id = I2C_DRIVERID_INDYCAM, diff --git a/drivers/media/video/ir-kbd-i2c.c b/drivers/media/video/ir-kbd-i2c.c index 82c7f50..3cc1d6a 100644 --- a/drivers/media/video/ir-kbd-i2c.c +++ b/drivers/media/video/ir-kbd-i2c.c @@ -279,7 +279,6 @@ static int ir_probe(struct i2c_adapter *adap); static struct i2c_driver driver = { .driver = { - .owner = THIS_MODULE, .name = "ir remote kbd driver", }, .id = I2C_DRIVERID_INFRARED, diff --git a/drivers/media/video/msp3400.c b/drivers/media/video/msp3400.c index 3847d89..183253e 100644 --- a/drivers/media/video/msp3400.c +++ b/drivers/media/video/msp3400.c @@ -1569,7 +1569,6 @@ static struct i2c_driver driver = { .detach_client = msp_detach, .command = msp_command, .driver = { - .owner = THIS_MODULE, .name = "i2c msp3400 driver", .suspend = msp_suspend, .resume = msp_resume, diff --git a/drivers/media/video/ovcamchip/ovcamchip_core.c b/drivers/media/video/ovcamchip/ovcamchip_core.c index 9ac398b..428f1bb 100644 --- a/drivers/media/video/ovcamchip/ovcamchip_core.c +++ b/drivers/media/video/ovcamchip/ovcamchip_core.c @@ -411,7 +411,6 @@ static int ovcamchip_command(struct i2c_client *c, unsigned int cmd, void *arg) static struct i2c_driver driver = { .driver = { - .owner = THIS_MODULE, .name = "ovcamchip", }, .id = I2C_DRIVERID_OVCAMCHIP, diff --git a/drivers/media/video/saa5246a.c b/drivers/media/video/saa5246a.c index 8c99edb..135c214 100644 --- a/drivers/media/video/saa5246a.c +++ b/drivers/media/video/saa5246a.c @@ -164,7 +164,6 @@ static int saa5246a_command(struct i2c_client *device, unsigned int cmd, static struct i2c_driver i2c_driver_videotext = { .driver = { - .owner = THIS_MODULE, .name = IF_NAME, /* name */ }, .id = I2C_DRIVERID_SAA5249, /* in i2c.h */ diff --git a/drivers/media/video/saa5249.c b/drivers/media/video/saa5249.c index 5b346bd..d7c4e33 100644 --- a/drivers/media/video/saa5249.c +++ b/drivers/media/video/saa5249.c @@ -237,7 +237,6 @@ static int saa5249_command(struct i2c_client *device, static struct i2c_driver i2c_driver_videotext = { .driver = { - .owner = THIS_MODULE, .name = IF_NAME, /* name */ }, .id = I2C_DRIVERID_SAA5249, /* in i2c.h */ diff --git a/drivers/media/video/saa6588.c b/drivers/media/video/saa6588.c index 5ea36ee..d60a783 100644 --- a/drivers/media/video/saa6588.c +++ b/drivers/media/video/saa6588.c @@ -496,7 +496,6 @@ static int saa6588_command(struct i2c_client *client, unsigned int cmd, static struct i2c_driver driver = { .driver = { - .owner = THIS_MODULE, .name = "i2c saa6588 driver", }, .id = -1, /* FIXME */ diff --git a/drivers/media/video/saa7110.c b/drivers/media/video/saa7110.c index 58f60ba..619ff0b 100644 --- a/drivers/media/video/saa7110.c +++ b/drivers/media/video/saa7110.c @@ -587,7 +587,6 @@ saa7110_detach_client (struct i2c_client *client) static struct i2c_driver i2c_driver_saa7110 = { .driver = { - .owner = THIS_MODULE, .name = "saa7110", }, diff --git a/drivers/media/video/saa7111.c b/drivers/media/video/saa7111.c index 946eb74..acaeee5 100644 --- a/drivers/media/video/saa7111.c +++ b/drivers/media/video/saa7111.c @@ -590,7 +590,6 @@ saa7111_detach_client (struct i2c_client *client) static struct i2c_driver i2c_driver_saa7111 = { .driver = { - .owner = THIS_MODULE, .name = "saa7111", }, diff --git a/drivers/media/video/saa7114.c b/drivers/media/video/saa7114.c index df53b58..b7ac012 100644 --- a/drivers/media/video/saa7114.c +++ b/drivers/media/video/saa7114.c @@ -1204,7 +1204,6 @@ saa7114_detach_client (struct i2c_client *client) static struct i2c_driver i2c_driver_saa7114 = { .driver = { - .owner = THIS_MODULE, .name = "saa7114", }, diff --git a/drivers/media/video/saa7115.c b/drivers/media/video/saa7115.c index 6ac1ab4..29e28c7 100644 --- a/drivers/media/video/saa7115.c +++ b/drivers/media/video/saa7115.c @@ -1355,7 +1355,6 @@ static int saa7115_detach(struct i2c_client *client) /* i2c implementation */ static struct i2c_driver i2c_driver_saa7115 = { .driver = { - .owner = THIS_MODULE, .name = "saa7115", }, .id = I2C_DRIVERID_SAA711X, diff --git a/drivers/media/video/saa711x.c b/drivers/media/video/saa711x.c index 3f7cfb7..8008537 100644 --- a/drivers/media/video/saa711x.c +++ b/drivers/media/video/saa711x.c @@ -565,7 +565,6 @@ saa711x_detach_client (struct i2c_client *client) static struct i2c_driver i2c_driver_saa711x = { .driver = { - .owner = THIS_MODULE, .name = "saa711x", }, diff --git a/drivers/media/video/saa7127.c b/drivers/media/video/saa7127.c index 659cb8a..bca6ed0 100644 --- a/drivers/media/video/saa7127.c +++ b/drivers/media/video/saa7127.c @@ -821,7 +821,6 @@ static int saa7127_detach(struct i2c_client *client) static struct i2c_driver i2c_driver_saa7127 = { .driver = { - .owner = THIS_MODULE, .name = "saa7127", }, .id = I2C_DRIVERID_SAA7127, diff --git a/drivers/media/video/saa7134/saa6752hs.c b/drivers/media/video/saa7134/saa6752hs.c index 0e8c9ed..4615a98 100644 --- a/drivers/media/video/saa7134/saa6752hs.c +++ b/drivers/media/video/saa7134/saa6752hs.c @@ -598,7 +598,6 @@ saa6752hs_command(struct i2c_client *client, unsigned int cmd, void *arg) static struct i2c_driver driver = { .driver = { - .owner = THIS_MODULE, .name = "i2c saa6752hs MPEG encoder", }, .id = I2C_DRIVERID_SAA6752HS, diff --git a/drivers/media/video/saa7185.c b/drivers/media/video/saa7185.c index 64047d77..f72a9f7 100644 --- a/drivers/media/video/saa7185.c +++ b/drivers/media/video/saa7185.c @@ -487,7 +487,6 @@ saa7185_detach_client (struct i2c_client *client) static struct i2c_driver i2c_driver_saa7185 = { .driver = { - .owner = THIS_MODULE, .name = "saa7185", /* name */ }, diff --git a/drivers/media/video/saa7191.c b/drivers/media/video/saa7191.c index a0f8eaf..41f6f05 100644 --- a/drivers/media/video/saa7191.c +++ b/drivers/media/video/saa7191.c @@ -789,7 +789,6 @@ static int saa7191_command(struct i2c_client *client, unsigned int cmd, static struct i2c_driver i2c_driver_saa7191 = { .driver = { - .owner = THIS_MODULE, .name = "saa7191", }, .id = I2C_DRIVERID_SAA7191, diff --git a/drivers/media/video/tda7432.c b/drivers/media/video/tda7432.c index 59674d9..549c992 100644 --- a/drivers/media/video/tda7432.c +++ b/drivers/media/video/tda7432.c @@ -502,7 +502,6 @@ static int tda7432_command(struct i2c_client *client, static struct i2c_driver driver = { .driver = { - .owner = THIS_MODULE, .name = "i2c tda7432 driver", }, .id = I2C_DRIVERID_TDA7432, diff --git a/drivers/media/video/tda9840.c b/drivers/media/video/tda9840.c index 8efc726..2a353d2 100644 --- a/drivers/media/video/tda9840.c +++ b/drivers/media/video/tda9840.c @@ -222,7 +222,6 @@ static int detach(struct i2c_client *client) static struct i2c_driver driver = { .driver = { - .owner = THIS_MODULE, .name = "tda9840", }, .id = I2C_DRIVERID_TDA9840, diff --git a/drivers/media/video/tda9875.c b/drivers/media/video/tda9875.c index de89616..9c3ecf7 100644 --- a/drivers/media/video/tda9875.c +++ b/drivers/media/video/tda9875.c @@ -373,7 +373,6 @@ static int tda9875_command(struct i2c_client *client, static struct i2c_driver driver = { .driver = { - .owner = THIS_MODULE, .name = "i2c tda9875 driver", }, .id = I2C_DRIVERID_TDA9875, diff --git a/drivers/media/video/tda9887.c b/drivers/media/video/tda9887.c index 081f478..7165a1b 100644 --- a/drivers/media/video/tda9887.c +++ b/drivers/media/video/tda9887.c @@ -824,7 +824,6 @@ static struct i2c_driver driver = { .detach_client = tda9887_detach, .command = tda9887_command, .driver = { - .owner = THIS_MODULE, .name = "i2c tda9887 driver", .suspend = tda9887_suspend, .resume = tda9887_resume, diff --git a/drivers/media/video/tea6415c.c b/drivers/media/video/tea6415c.c index e7e2213..17046d9 100644 --- a/drivers/media/video/tea6415c.c +++ b/drivers/media/video/tea6415c.c @@ -191,7 +191,6 @@ static int command(struct i2c_client *client, unsigned int cmd, void *arg) static struct i2c_driver driver = { .driver = { - .owner = THIS_MODULE, .name = "tea6415c", }, .id = I2C_DRIVERID_TEA6415C, diff --git a/drivers/media/video/tea6420.c b/drivers/media/video/tea6420.c index 74cc25f..3dc89d9 100644 --- a/drivers/media/video/tea6420.c +++ b/drivers/media/video/tea6420.c @@ -168,7 +168,6 @@ static int command(struct i2c_client *client, unsigned int cmd, void *arg) static struct i2c_driver driver = { .driver = { - .owner = THIS_MODULE, .name = "tea6420", }, .id = I2C_DRIVERID_TEA6420, diff --git a/drivers/media/video/tuner-3036.c b/drivers/media/video/tuner-3036.c index 83257af..d97f668 100644 --- a/drivers/media/video/tuner-3036.c +++ b/drivers/media/video/tuner-3036.c @@ -176,7 +176,6 @@ static struct i2c_driver i2c_driver_tuner = { .driver = { - .owner = THIS_MODULE, .name = "sab3036", }, .id = I2C_DRIVERID_SAB3036, diff --git a/drivers/media/video/tuner-core.c b/drivers/media/video/tuner-core.c index e8c8549..c13c7b9 100644 --- a/drivers/media/video/tuner-core.c +++ b/drivers/media/video/tuner-core.c @@ -747,7 +747,6 @@ static struct i2c_driver driver = { .detach_client = tuner_detach, .command = tuner_command, .driver = { - .owner = THIS_MODULE, .name = "tuner", .suspend = tuner_suspend, .resume = tuner_resume, diff --git a/drivers/media/video/tvaudio.c b/drivers/media/video/tvaudio.c index 30bb2a3..0292c5a 100644 --- a/drivers/media/video/tvaudio.c +++ b/drivers/media/video/tvaudio.c @@ -1703,7 +1703,6 @@ static int chip_command(struct i2c_client *client, static struct i2c_driver driver = { .driver = { - .owner = THIS_MODULE, .name = "generic i2c audio driver", }, .id = I2C_DRIVERID_TVAUDIO, diff --git a/drivers/media/video/tveeprom.c b/drivers/media/video/tveeprom.c index d8b5a17..8ac4cb8 100644 --- a/drivers/media/video/tveeprom.c +++ b/drivers/media/video/tveeprom.c @@ -779,7 +779,6 @@ tveeprom_detach_client (struct i2c_client *client) static struct i2c_driver i2c_driver_tveeprom = { .driver = { - .owner = THIS_MODULE, .name = "tveeprom", }, .id = I2C_DRIVERID_TVEEPROM, diff --git a/drivers/media/video/tvmixer.c b/drivers/media/video/tvmixer.c index 5f4d0185..e837f9f 100644 --- a/drivers/media/video/tvmixer.c +++ b/drivers/media/video/tvmixer.c @@ -229,7 +229,6 @@ static int tvmixer_release(struct inode *inode, struct file *file) static struct i2c_driver driver = { #ifdef I2C_PEC .driver = { - .owner = THIS_MODULE, .name = "tv card mixer driver", }, #else diff --git a/drivers/media/video/tvp5150.c b/drivers/media/video/tvp5150.c index 5eca71f..a60442e 100644 --- a/drivers/media/video/tvp5150.c +++ b/drivers/media/video/tvp5150.c @@ -801,7 +801,6 @@ static int tvp5150_detach_client(struct i2c_client *client) static struct i2c_driver driver = { .driver = { - .owner = THIS_MODULE, .name = "tvp5150", }, diff --git a/drivers/media/video/vpx3220.c b/drivers/media/video/vpx3220.c index b85b598..8dcee8b 100644 --- a/drivers/media/video/vpx3220.c +++ b/drivers/media/video/vpx3220.c @@ -722,7 +722,6 @@ vpx3220_attach_adapter (struct i2c_adapter *adapter) static struct i2c_driver vpx3220_i2c_driver = { .driver = { - .owner = THIS_MODULE, .name = "vpx3220", }, diff --git a/drivers/media/video/wm8775.c b/drivers/media/video/wm8775.c index 22875f1..bbfd55c 100644 --- a/drivers/media/video/wm8775.c +++ b/drivers/media/video/wm8775.c @@ -233,7 +233,6 @@ static int wm8775_detach(struct i2c_client *client) /* i2c implementation */ static struct i2c_driver i2c_driver = { .driver = { - .owner = THIS_MODULE, .name = "wm8775", }, diff --git a/drivers/video/matrox/matroxfb_maven.c b/drivers/video/matrox/matroxfb_maven.c index f6fdb69..2558753 100644 --- a/drivers/video/matrox/matroxfb_maven.c +++ b/drivers/video/matrox/matroxfb_maven.c @@ -1294,7 +1294,6 @@ static int maven_command(struct i2c_client* client, unsigned int cmd, void* arg) static struct i2c_driver maven_driver={ .driver = { - .owner = THIS_MODULE, .name = "maven", }, .id = I2C_DRIVERID_MGATVO, diff --git a/sound/oss/dmasound/dac3550a.c b/sound/oss/dmasound/dac3550a.c index 835e0cf..7360d89 100644 --- a/sound/oss/dmasound/dac3550a.c +++ b/sound/oss/dmasound/dac3550a.c @@ -42,7 +42,6 @@ static int daca_detach_client(struct i2c_client *client); struct i2c_driver daca_driver = { .driver = { - .owner = THIS_MODULE, .name = "DAC3550A driver V " DACA_VERSION, }, .id = I2C_DRIVERID_DACA, diff --git a/sound/oss/dmasound/tas_common.c b/sound/oss/dmasound/tas_common.c index bd6910a..8131599 100644 --- a/sound/oss/dmasound/tas_common.c +++ b/sound/oss/dmasound/tas_common.c @@ -48,7 +48,6 @@ static int tas_detach_client(struct i2c_client *); struct i2c_driver tas_driver = { .driver = { - .owner = THIS_MODULE, .name = "tas", }, .attach_adapter = tas_attach_adapter, diff --git a/sound/ppc/keywest.c b/sound/ppc/keywest.c index d532924..6058c2d 100644 --- a/sound/ppc/keywest.c +++ b/sound/ppc/keywest.c @@ -42,7 +42,6 @@ static int keywest_detach_client(struct i2c_client *client); struct i2c_driver keywest_driver = { .driver = { - .owner = THIS_MODULE, .name = "PMac Keywest Audio", }, .id = I2C_DRIVERID_KEYWEST, -- cgit v1.1 From d82c0bf88fa97c1993ea9d6051488e7cb012b440 Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Wed, 7 Dec 2005 21:54:26 +0100 Subject: [PATCH] i2c: Documentation update Update the i2c documentation to reflect the recent change to i2c_add_driver. Signed-off-by: Jean Delvare Signed-off-by: Greg Kroah-Hartman --- Documentation/i2c/porting-clients | 5 ++--- Documentation/i2c/writing-clients | 1 - 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/Documentation/i2c/porting-clients b/Documentation/i2c/porting-clients index f997c72..f03c2a0 100644 --- a/Documentation/i2c/porting-clients +++ b/Documentation/i2c/porting-clients @@ -126,9 +126,8 @@ Technical changes: * [Driver] The flags field of the i2c_driver structure is gone. I2C_DF_NOTIFY is now the default behavior. The i2c_driver structure has a driver member, which is itself a - structure, those owner and name members should be initialized to - THIS_MODULE and a driver name string, respectively. i2c_driver - itself has no name member anymore. + structure, those name member should be initialized to a driver name + string. i2c_driver itself has no name member anymore. Coding policy: diff --git a/Documentation/i2c/writing-clients b/Documentation/i2c/writing-clients index 95eed2b..27c425a 100644 --- a/Documentation/i2c/writing-clients +++ b/Documentation/i2c/writing-clients @@ -26,7 +26,6 @@ address. static struct i2c_driver foo_driver = { .driver = { - .owner = THIS_MODULE, .name = "foo", }, .attach_adapter = &foo_attach_adapter, -- cgit v1.1 From 79472132f555ae1e912699e116e5c82f338872f6 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Tue, 6 Dec 2005 15:33:15 -0800 Subject: [PATCH] I2C: move i2c-dev to use dynamic class devices i2c-dev doesn't use the reference counting logic of struct class_device so move it to the dynamic method. This makes the code paths simpler and the driver smaller. Signed-off-by: Greg Kroah-Hartman Cc: Jean Delvare --- drivers/i2c/i2c-dev.c | 50 ++++++++++++++++++++------------------------------ 1 file changed, 20 insertions(+), 30 deletions(-) diff --git a/drivers/i2c/i2c-dev.c b/drivers/i2c/i2c-dev.c index e140dd7..ad6e04f 100644 --- a/drivers/i2c/i2c-dev.c +++ b/drivers/i2c/i2c-dev.c @@ -42,8 +42,7 @@ static struct i2c_client i2cdev_client_template; struct i2c_dev { int minor; struct i2c_adapter *adap; - struct class_device class_dev; - struct completion released; /* FIXME, we need a class_device_unregister() */ + struct class_device *class_dev; }; #define to_i2c_dev(d) container_of(d, struct i2c_dev, class_dev) @@ -105,7 +104,10 @@ static void return_i2c_dev(struct i2c_dev *i2c_dev) static ssize_t show_adapter_name(struct class_device *class_dev, char *buf) { - struct i2c_dev *i2c_dev = to_i2c_dev(class_dev); + struct i2c_dev *i2c_dev = i2c_dev_get_by_minor(MINOR(class_dev->devt)); + + if (!i2c_dev) + return -ENODEV; return sprintf(buf, "%s\n", i2c_dev->adap->name); } static CLASS_DEVICE_ATTR(name, S_IRUGO, show_adapter_name, NULL); @@ -408,21 +410,12 @@ static struct file_operations i2cdev_fops = { .release = i2cdev_release, }; -static void release_i2c_dev(struct class_device *dev) -{ - struct i2c_dev *i2c_dev = to_i2c_dev(dev); - complete(&i2c_dev->released); -} - -static struct class i2c_dev_class = { - .name = "i2c-dev", - .release = &release_i2c_dev, -}; +static struct class *i2c_dev_class; static int i2cdev_attach_adapter(struct i2c_adapter *adap) { struct i2c_dev *i2c_dev; - int retval; + struct device *dev; i2c_dev = get_free_i2c_dev(adap); if (IS_ERR(i2c_dev)) @@ -434,21 +427,20 @@ static int i2cdev_attach_adapter(struct i2c_adapter *adap) /* register this i2c device with the driver core */ i2c_dev->adap = adap; if (adap->dev.parent == &platform_bus) - i2c_dev->class_dev.dev = &adap->dev; + dev = &adap->dev; else - i2c_dev->class_dev.dev = adap->dev.parent; - i2c_dev->class_dev.class = &i2c_dev_class; - i2c_dev->class_dev.devt = MKDEV(I2C_MAJOR, i2c_dev->minor); - snprintf(i2c_dev->class_dev.class_id, BUS_ID_SIZE, "i2c-%d", i2c_dev->minor); - retval = class_device_register(&i2c_dev->class_dev); - if (retval) + dev = adap->dev.parent; + i2c_dev->class_dev = class_device_create(i2c_dev_class, NULL, + MKDEV(I2C_MAJOR, i2c_dev->minor), + dev, "i2c-%d", i2c_dev->minor); + if (!i2c_dev->class_dev) goto error; - class_device_create_file(&i2c_dev->class_dev, &class_device_attr_name); + class_device_create_file(i2c_dev->class_dev, &class_device_attr_name); return 0; error: return_i2c_dev(i2c_dev); kfree(i2c_dev); - return retval; + return -ENODEV; } static int i2cdev_detach_adapter(struct i2c_adapter *adap) @@ -459,10 +451,8 @@ static int i2cdev_detach_adapter(struct i2c_adapter *adap) if (!i2c_dev) return -ENODEV; - init_completion(&i2c_dev->released); return_i2c_dev(i2c_dev); - class_device_unregister(&i2c_dev->class_dev); - wait_for_completion(&i2c_dev->released); + class_device_destroy(i2c_dev_class, MKDEV(I2C_MAJOR, i2c_dev->minor)); kfree(i2c_dev); pr_debug("i2c-dev: adapter [%s] unregistered\n", adap->name); @@ -507,8 +497,8 @@ static int __init i2c_dev_init(void) if (res) goto out; - res = class_register(&i2c_dev_class); - if (res) + i2c_dev_class = class_create(THIS_MODULE, "i2c-dev"); + if (IS_ERR(i2c_dev_class)) goto out_unreg_chrdev; res = i2c_add_driver(&i2cdev_driver); @@ -518,7 +508,7 @@ static int __init i2c_dev_init(void) return 0; out_unreg_class: - class_unregister(&i2c_dev_class); + class_destroy(i2c_dev_class); out_unreg_chrdev: unregister_chrdev(I2C_MAJOR, "i2c"); out: @@ -529,7 +519,7 @@ out: static void __exit i2c_dev_exit(void) { i2c_del_driver(&i2cdev_driver); - class_unregister(&i2c_dev_class); + class_destroy(i2c_dev_class); unregister_chrdev(I2C_MAJOR,"i2c"); } -- cgit v1.1 From c9152deaa635cab09cb43c17cf80130b9e6ee29d Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Sun, 18 Dec 2005 16:29:40 +0100 Subject: [PATCH] hwmon: w83792d misc cleanups Cleanup the w83792d driver a bit: * Discard unused lock and irrelevant comments inherited from the w83781d driver. * Simplify w83792d_{read,write}_value functions. * Drop useless address test during detection. * Drop useless bitmasking. Signed-off-by: Jean Delvare Acked-by: Yuan Mu Signed-off-by: Greg Kroah-Hartman --- drivers/hwmon/w83792d.c | 29 +++++++++-------------------- 1 file changed, 9 insertions(+), 20 deletions(-) diff --git a/drivers/hwmon/w83792d.c b/drivers/hwmon/w83792d.c index ff1c9f0..0ad1ae5 100644 --- a/drivers/hwmon/w83792d.c +++ b/drivers/hwmon/w83792d.c @@ -269,7 +269,6 @@ DIV_TO_REG(long val) struct w83792d_data { struct i2c_client client; struct class_device *class_dev; - struct semaphore lock; enum chips type; struct semaphore update_lock; @@ -1192,7 +1191,6 @@ w83792d_detect(struct i2c_adapter *adapter, int address, int kind) new_client = &data->client; i2c_set_clientdata(new_client, data); new_client->addr = address; - init_MUTEX(&data->lock); new_client->adapter = adapter; new_client->driver = &w83792d_driver; new_client->flags = 0; @@ -1243,7 +1241,7 @@ w83792d_detect(struct i2c_adapter *adapter, int address, int kind) goto ERROR1; } val1 = w83792d_read_value(new_client, W83792D_REG_WCHIPID); - if (val1 == 0x7a && address >= 0x2c) { + if (val1 == 0x7a) { kind = w83792d; } else { if (kind == 0) @@ -1416,26 +1414,17 @@ w83792d_detach_client(struct i2c_client *client) return 0; } -/* The SMBus locks itself, usually, but nothing may access the Winbond between - bank switches. ISA access must always be locked explicitly! - We ignore the W83792D BUSY flag at this moment - it could lead to deadlocks, - would slow down the W83792D access and should not be necessary. - There are some ugly typecasts here, but the good news is - they should - nowhere else be necessary! */ -static int -w83792d_read_value(struct i2c_client *client, u8 reg) +/* The SMBus locks itself. The Winbond W83792D chip has a bank register, + but the driver only accesses registers in bank 0, so we don't have + to switch banks and lock access between switches. */ +static int w83792d_read_value(struct i2c_client *client, u8 reg) { - int res=0; - res = i2c_smbus_read_byte_data(client, reg); - - return res; + return i2c_smbus_read_byte_data(client, reg); } -static int -w83792d_write_value(struct i2c_client *client, u8 reg, u8 value) +static int w83792d_write_value(struct i2c_client *client, u8 reg, u8 value) { - i2c_smbus_write_byte_data(client, reg, value); - return 0; + return i2c_smbus_write_byte_data(client, reg, value); } static void @@ -1506,7 +1495,7 @@ static struct w83792d_data *w83792d_update_device(struct device *dev) pwm_array_tmp[i] = w83792d_read_value(client, W83792D_REG_PWM[i]); data->pwm[i] = pwm_array_tmp[i] & 0x0f; - data->pwm_mode[i] = (pwm_array_tmp[i] >> 7) & 0x01; + data->pwm_mode[i] = pwm_array_tmp[i] >> 7; } reg_tmp = w83792d_read_value(client, W83792D_REG_FAN_CFG); -- cgit v1.1 From 99d855602c1d7968ca6b6cc99b773b0b47909690 Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Sun, 18 Dec 2005 16:34:28 +0100 Subject: [PATCH] hwmon: w83792d simplify in low bits handling Simplify the way the w83792d driver handles the extra resolution bits of voltage input channels. Signed-off-by: Jean Delvare Acked-by: Yuan Mu Signed-off-by: Greg Kroah-Hartman --- drivers/hwmon/w83792d.c | 48 ++++++++++-------------------------------------- 1 file changed, 10 insertions(+), 38 deletions(-) diff --git a/drivers/hwmon/w83792d.c b/drivers/hwmon/w83792d.c index 0ad1ae5..b176bf0 100644 --- a/drivers/hwmon/w83792d.c +++ b/drivers/hwmon/w83792d.c @@ -281,7 +281,7 @@ struct w83792d_data { u8 in[9]; /* Register value */ u8 in_max[9]; /* Register value */ u8 in_min[9]; /* Register value */ - u8 low_bits[2]; /* Additional resolution to voltage in0-6 */ + u16 low_bits; /* Additional resolution to voltage in6-0 */ u8 fan[7]; /* Register value */ u8 fan_min[7]; /* Register value */ u8 temp1[3]; /* current, over, thyst */ @@ -323,38 +323,10 @@ static struct i2c_driver w83792d_driver = { .detach_client = w83792d_detach_client, }; -static long in_count_from_reg(int nr, struct w83792d_data *data) +static inline long in_count_from_reg(int nr, struct w83792d_data *data) { - u16 vol_count = data->in[nr]; - u16 low_bits = 0; - vol_count = (vol_count << 2); - switch (nr) - { - case 0: /* vin0 */ - low_bits = (data->low_bits[0]) & 0x03; - break; - case 1: /* vin1 */ - low_bits = ((data->low_bits[0]) & 0x0c) >> 2; - break; - case 2: /* vin2 */ - low_bits = ((data->low_bits[0]) & 0x30) >> 4; - break; - case 3: /* vin3 */ - low_bits = ((data->low_bits[0]) & 0xc0) >> 6; - break; - case 4: /* vin4 */ - low_bits = (data->low_bits[1]) & 0x03; - break; - case 5: /* vin5 */ - low_bits = ((data->low_bits[1]) & 0x0c) >> 2; - break; - case 6: /* vin6 */ - low_bits = ((data->low_bits[1]) & 0x30) >> 4; - default: - break; - } - vol_count = vol_count | low_bits; - return vol_count; + /* in7 and in8 do not have low bits, but the formula still works */ + return ((data->in[nr] << 2) | ((data->low_bits >> (2 * nr)) & 0x03)); } /* following are the sysfs callback functions */ @@ -1481,10 +1453,10 @@ static struct w83792d_data *w83792d_update_device(struct device *dev) data->in_min[i] = w83792d_read_value(client, W83792D_REG_IN_MIN[i]); } - data->low_bits[0] = w83792d_read_value(client, - W83792D_REG_LOW_BITS1); - data->low_bits[1] = w83792d_read_value(client, - W83792D_REG_LOW_BITS2); + data->low_bits = w83792d_read_value(client, + W83792D_REG_LOW_BITS1) + + (w83792d_read_value(client, + W83792D_REG_LOW_BITS2) << 8); for (i = 0; i < 7; i++) { /* Update the Fan measured value and limits */ data->fan[i] = w83792d_read_value(client, @@ -1596,8 +1568,8 @@ static void w83792d_print_debug(struct w83792d_data *data, struct device *dev) dev_dbg(dev, "vin[%d] max is: 0x%x\n", i, data->in_max[i]); dev_dbg(dev, "vin[%d] min is: 0x%x\n", i, data->in_min[i]); } - dev_dbg(dev, "Low Bit1 is: 0x%x\n", data->low_bits[0]); - dev_dbg(dev, "Low Bit2 is: 0x%x\n", data->low_bits[1]); + dev_dbg(dev, "Low Bit1 is: 0x%x\n", data->low_bits & 0xff); + dev_dbg(dev, "Low Bit2 is: 0x%x\n", data->low_bits >> 8); dev_dbg(dev, "7 set of Fan Counts and Duty Cycles: =====>\n"); for (i=0; i<7; i++) { dev_dbg(dev, "fan[%d] is: 0x%x\n", i, data->fan[i]); -- cgit v1.1 From 734a12a36676ad3b9418fa5a829c518afec02b8a Mon Sep 17 00:00:00 2001 From: Rudolf Marek Date: Sun, 18 Dec 2005 16:36:52 +0100 Subject: [PATCH] hwmon: add VRM/VID support for some VIA CPUs This patch adds the VIA CENTAUR CPUs to detection table. Table was updated to treat future Intel x86 CPUs as VRD10. Stepping field was added, because some VIA CPUs have different VRM specs across stepping. I changed the vrm type to u8 because all drivers use u8 anyway. Signed-off-by: Rudolf Marek Signed-off-by: Jean Delvare Signed-off-by: Greg Kroah-Hartman --- drivers/hwmon/hwmon-vid.c | 69 ++++++++++++++++++++++++++++------------------- include/linux/hwmon-vid.h | 6 ++--- 2 files changed, 45 insertions(+), 30 deletions(-) diff --git a/drivers/hwmon/hwmon-vid.c b/drivers/hwmon/hwmon-vid.c index 312769a..e497274 100644 --- a/drivers/hwmon/hwmon-vid.c +++ b/drivers/hwmon/hwmon-vid.c @@ -49,20 +49,22 @@ . . . . 11110 = 0.800 V 11111 = 0.000 V (off) + + The 17 specification is in fact Intel Mobile Voltage Positioning - + (IMVP-II). You can find more information in the datasheet of Max1718 + http://www.maxim-ic.com/quick_view2.cfm/qv_pk/2452 + */ /* vrm is the VRM/VRD document version multiplied by 10. val is the 4-, 5- or 6-bit VID code. Returned value is in mV to avoid floating point in the kernel. */ -int vid_from_reg(int val, int vrm) +int vid_from_reg(int val, u8 vrm) { int vid; switch(vrm) { - case 0: - return 0; - case 100: /* VRD 10.0 */ if((val & 0x1f) == 0x1f) return 0; @@ -91,10 +93,16 @@ int vid_from_reg(int val, int vrm) case 84: /* VRM 8.4 */ val &= 0x0f; /* fall through */ - default: /* VRM 8.2 */ + case 82: /* VRM 8.2 */ return(val == 0x1f ? 0 : val & 0x10 ? 5100 - (val) * 100 : 2050 - (val) * 50); + case 17: /* Intel IMVP-II */ + return(val & 0x10 ? 975 - (val & 0xF) * 25 : + 1750 - val * 50); + default: /* report 0 for unknown */ + printk(KERN_INFO "hwmon-vid: requested unknown VRM version\n"); + return 0; } } @@ -108,30 +116,36 @@ struct vrm_model { u8 vendor; u8 eff_family; u8 eff_model; - int vrm_type; + u8 eff_stepping; + u8 vrm_type; }; #define ANY 0xFF #ifdef CONFIG_X86 +/* the stepping parameter is highest acceptable stepping for current line */ + static struct vrm_model vrm_models[] = { - {X86_VENDOR_AMD, 0x6, ANY, 90}, /* Athlon Duron etc */ - {X86_VENDOR_AMD, 0xF, ANY, 24}, /* Athlon 64, Opteron */ - {X86_VENDOR_INTEL, 0x6, 0x9, 85}, /* 0.13um too */ - {X86_VENDOR_INTEL, 0x6, 0xB, 85}, /* Tualatin */ - {X86_VENDOR_INTEL, 0x6, ANY, 82}, /* any P6 */ - {X86_VENDOR_INTEL, 0x7, ANY, 0}, /* Itanium */ - {X86_VENDOR_INTEL, 0xF, 0x0, 90}, /* P4 */ - {X86_VENDOR_INTEL, 0xF, 0x1, 90}, /* P4 Willamette */ - {X86_VENDOR_INTEL, 0xF, 0x2, 90}, /* P4 Northwood */ - {X86_VENDOR_INTEL, 0xF, 0x3, 100}, /* P4 Prescott */ - {X86_VENDOR_INTEL, 0xF, 0x4, 100}, /* P4 Prescott */ - {X86_VENDOR_INTEL, 0x10,ANY, 0}, /* Itanium 2 */ - {X86_VENDOR_UNKNOWN, ANY, ANY, 0} /* stop here */ + {X86_VENDOR_AMD, 0x6, ANY, ANY, 90}, /* Athlon Duron etc */ + {X86_VENDOR_AMD, 0xF, ANY, ANY, 24}, /* Athlon 64, Opteron and above VRM 24 */ + {X86_VENDOR_INTEL, 0x6, 0x9, ANY, 85}, /* 0.13um too */ + {X86_VENDOR_INTEL, 0x6, 0xB, ANY, 85}, /* Tualatin */ + {X86_VENDOR_INTEL, 0x6, ANY, ANY, 82}, /* any P6 */ + {X86_VENDOR_INTEL, 0x7, ANY, ANY, 0}, /* Itanium */ + {X86_VENDOR_INTEL, 0xF, 0x0, ANY, 90}, /* P4 */ + {X86_VENDOR_INTEL, 0xF, 0x1, ANY, 90}, /* P4 Willamette */ + {X86_VENDOR_INTEL, 0xF, 0x2, ANY, 90}, /* P4 Northwood */ + {X86_VENDOR_INTEL, 0xF, ANY, ANY, 100}, /* Prescott and above assume VRD 10 */ + {X86_VENDOR_INTEL, 0x10, ANY, ANY, 0}, /* Itanium 2 */ + {X86_VENDOR_CENTAUR, 0x6, 0x7, ANY, 85}, /* Eden ESP/Ezra */ + {X86_VENDOR_CENTAUR, 0x6, 0x8, 0x7, 85}, /* Ezra T */ + {X86_VENDOR_CENTAUR, 0x6, 0x9, 0x7, 85}, /* Nemiah */ + {X86_VENDOR_CENTAUR, 0x6, 0x9, ANY, 17}, /* C3-M */ + {X86_VENDOR_UNKNOWN, ANY, ANY, ANY, 0} /* stop here */ }; -static int find_vrm(u8 eff_family, u8 eff_model, u8 vendor) +static u8 find_vrm(u8 eff_family, u8 eff_model, u8 eff_stepping, u8 vendor) { int i = 0; @@ -139,7 +153,8 @@ static int find_vrm(u8 eff_family, u8 eff_model, u8 vendor) if (vrm_models[i].vendor==vendor) if ((vrm_models[i].eff_family==eff_family) && ((vrm_models[i].eff_model==eff_model) || - (vrm_models[i].eff_model==ANY))) + (vrm_models[i].eff_model==ANY)) && + (eff_stepping <= vrm_models[i].eff_stepping)) return vrm_models[i].vrm_type; i++; } @@ -147,12 +162,11 @@ static int find_vrm(u8 eff_family, u8 eff_model, u8 vendor) return 0; } -int vid_which_vrm(void) +u8 vid_which_vrm(void) { struct cpuinfo_x86 *c = cpu_data; u32 eax; - u8 eff_family, eff_model; - int vrm_ret; + u8 eff_family, eff_model, eff_stepping, vrm_ret; if (c->x86 < 6) /* Any CPU with family lower than 6 */ return 0; /* doesn't have VID and/or CPUID */ @@ -160,20 +174,21 @@ int vid_which_vrm(void) eax = cpuid_eax(1); eff_family = ((eax & 0x00000F00)>>8); eff_model = ((eax & 0x000000F0)>>4); + eff_stepping = eax & 0xF; if (eff_family == 0xF) { /* use extended model & family */ eff_family += ((eax & 0x00F00000)>>20); eff_model += ((eax & 0x000F0000)>>16)<<4; } - vrm_ret = find_vrm(eff_family,eff_model,c->x86_vendor); + vrm_ret = find_vrm(eff_family, eff_model, eff_stepping, c->x86_vendor); if (vrm_ret == 0) printk(KERN_INFO "hwmon-vid: Unknown VRM version of your " "x86 CPU\n"); return vrm_ret; } -/* and now something completely different for the non-x86 world */ +/* and now for something completely different for the non-x86 world */ #else -int vid_which_vrm(void) +u8 vid_which_vrm(void) { printk(KERN_INFO "hwmon-vid: Unknown VRM version of your CPU\n"); return 0; diff --git a/include/linux/hwmon-vid.h b/include/linux/hwmon-vid.h index cd4b7a0..f346e4d 100644 --- a/include/linux/hwmon-vid.h +++ b/include/linux/hwmon-vid.h @@ -23,14 +23,14 @@ #ifndef _LINUX_HWMON_VID_H #define _LINUX_HWMON_VID_H -int vid_from_reg(int val, int vrm); -int vid_which_vrm(void); +int vid_from_reg(int val, u8 vrm); +u8 vid_which_vrm(void); /* vrm is the VRM/VRD document version multiplied by 10. val is in mV to avoid floating point in the kernel. Returned value is the 4-, 5- or 6-bit VID code. Note that only VRM 9.x is supported for now. */ -static inline int vid_to_reg(int val, int vrm) +static inline int vid_to_reg(int val, u8 vrm) { switch (vrm) { case 91: /* VRM 9.1 */ -- cgit v1.1 From a7be58a126d4cd9f0588df23f58796ed996c1835 Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Sun, 18 Dec 2005 16:40:14 +0100 Subject: [PATCH] hwmon: it87 use u8 for vrm VRM values fit in u8 by design now. Signed-off-by: Jean Delvare Signed-off-by: Greg Kroah-Hartman --- drivers/hwmon/it87.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/hwmon/it87.c b/drivers/hwmon/it87.c index 29b74a8..0da7c9c 100644 --- a/drivers/hwmon/it87.c +++ b/drivers/hwmon/it87.c @@ -213,7 +213,7 @@ struct it87_data { u8 sensor; /* Register value */ u8 fan_div[3]; /* Register encoding, shifted right */ u8 vid; /* Register encoding, combined */ - int vrm; + u8 vrm; u32 alarms; /* Register encoding, combined */ u8 fan_main_ctrl; /* Register value */ u8 manual_pwm_ctl[3]; /* manual PWM value set by user */ @@ -669,7 +669,7 @@ static ssize_t show_vrm_reg(struct device *dev, struct device_attribute *attr, char *buf) { struct it87_data *data = it87_update_device(dev); - return sprintf(buf, "%ld\n", (long) data->vrm); + return sprintf(buf, "%u\n", data->vrm); } static ssize_t store_vrm_reg(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) -- cgit v1.1 From 04b4b8434a92b9ef127985113c0bd961957778b7 Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Sun, 18 Dec 2005 16:42:35 +0100 Subject: [PATCH] i2c: driver ID list cleanups Cleanups to i2c driver ID list: * Remove mostly bogus comments about driver ID ranges. * Drop experimental driver IDs, as the concept is pretty broken. * Drop now unused IDs of non-I2C (ISA) drivers. * Drop a few more IDs which are no more used. Signed-off-by: Jean Delvare Signed-off-by: Greg Kroah-Hartman --- include/linux/i2c-id.h | 20 -------------------- 1 file changed, 20 deletions(-) diff --git a/include/linux/i2c-id.h b/include/linux/i2c-id.h index 006c81e..fb46f8d 100644 --- a/include/linux/i2c-id.h +++ b/include/linux/i2c-id.h @@ -25,12 +25,6 @@ /* * ---- Driver types ----------------------------------------------------- - * device id name + number function description, i2c address(es) - * - * Range 1000-1999 range is defined in sensors/sensors.h - * Range 0x100 - 0x1ff is for V4L2 Common Components - * Range 0xf000 - 0xffff is reserved for local experimentation, and should - * never be used in official drivers */ #define I2C_DRIVERID_MSP3400 1 @@ -110,13 +104,7 @@ #define I2C_DRIVERID_AKITAIOEXP 74 /* IO Expander on Sharp SL-C1000 */ #define I2C_DRIVERID_INFRARED 75 /* I2C InfraRed on Video boards */ -#define I2C_DRIVERID_EXP0 0xF0 /* experimental use id's */ -#define I2C_DRIVERID_EXP1 0xF1 -#define I2C_DRIVERID_EXP2 0xF2 -#define I2C_DRIVERID_EXP3 0xF3 - #define I2C_DRIVERID_I2CDEV 900 -#define I2C_DRIVERID_I2CPROC 901 #define I2C_DRIVERID_ARP 902 /* SMBus ARP Client */ #define I2C_DRIVERID_ALERT 903 /* SMBus Alert Responder Client */ @@ -131,15 +119,12 @@ #define I2C_DRIVERID_ADM1021 1008 #define I2C_DRIVERID_ADM9240 1009 #define I2C_DRIVERID_LTC1710 1010 -#define I2C_DRIVERID_SIS5595 1011 #define I2C_DRIVERID_ICSPLL 1012 #define I2C_DRIVERID_BT869 1013 #define I2C_DRIVERID_MAXILIFE 1014 #define I2C_DRIVERID_MATORB 1015 #define I2C_DRIVERID_GL520 1016 #define I2C_DRIVERID_THMC50 1017 -#define I2C_DRIVERID_DDCMON 1018 -#define I2C_DRIVERID_VIA686A 1019 #define I2C_DRIVERID_ADM1025 1020 #define I2C_DRIVERID_LM87 1021 #define I2C_DRIVERID_PCF8574 1022 @@ -151,21 +136,16 @@ #define I2C_DRIVERID_FSCPOS 1028 #define I2C_DRIVERID_FSCSCY 1029 #define I2C_DRIVERID_PCF8591 1030 -#define I2C_DRIVERID_SMSC47M1 1031 -#define I2C_DRIVERID_VT1211 1032 #define I2C_DRIVERID_LM92 1033 -#define I2C_DRIVERID_VT8231 1034 #define I2C_DRIVERID_SMARTBATT 1035 #define I2C_DRIVERID_BMCSENSORS 1036 #define I2C_DRIVERID_FS451 1037 -#define I2C_DRIVERID_W83627HF 1038 #define I2C_DRIVERID_LM85 1039 #define I2C_DRIVERID_LM83 1040 #define I2C_DRIVERID_LM90 1042 #define I2C_DRIVERID_ASB100 1043 #define I2C_DRIVERID_FSCHER 1046 #define I2C_DRIVERID_W83L785TS 1047 -#define I2C_DRIVERID_SMSC47B397 1050 /* * ---- Adapter types ---------------------------------------------------- -- cgit v1.1 From d564baee2984098c73fd0e55bc5c8a890878ef3b Mon Sep 17 00:00:00 2001 From: Laurent Riffard Date: Sun, 18 Dec 2005 16:49:30 +0100 Subject: [PATCH] i2c: drop empty i2c_driver.command implementations Given that implementing i2c_driver.command is optional, there is no point in an empty implementation thereof. Signed-off-by: Laurent Riffard Signed-off-by: Jean Delvare Cc: Michael Geng Cc: Petr Vandrovec Signed-off-by: Greg Kroah-Hartman --- drivers/i2c/i2c-dev.c | 7 ------- drivers/media/video/saa5246a.c | 7 ------- drivers/media/video/saa5249.c | 7 ------- drivers/video/matrox/matroxfb_maven.c | 5 ----- 4 files changed, 26 deletions(-) diff --git a/drivers/i2c/i2c-dev.c b/drivers/i2c/i2c-dev.c index ad6e04f..ed7eed3 100644 --- a/drivers/i2c/i2c-dev.c +++ b/drivers/i2c/i2c-dev.c @@ -464,12 +464,6 @@ static int i2cdev_detach_client(struct i2c_client *client) return 0; } -static int i2cdev_command(struct i2c_client *client, unsigned int cmd, - void *arg) -{ - return -1; -} - static struct i2c_driver i2cdev_driver = { .driver = { .name = "dev_driver", @@ -478,7 +472,6 @@ static struct i2c_driver i2cdev_driver = { .attach_adapter = i2cdev_attach_adapter, .detach_adapter = i2cdev_detach_adapter, .detach_client = i2cdev_detach_client, - .command = i2cdev_command, }; static struct i2c_client i2cdev_client_template = { diff --git a/drivers/media/video/saa5246a.c b/drivers/media/video/saa5246a.c index 135c214..0aa9e72 100644 --- a/drivers/media/video/saa5246a.c +++ b/drivers/media/video/saa5246a.c @@ -151,12 +151,6 @@ static int saa5246a_detach(struct i2c_client *client) return 0; } -static int saa5246a_command(struct i2c_client *device, unsigned int cmd, - void *arg) -{ - return -EINVAL; -} - /* * I2C interfaces */ @@ -169,7 +163,6 @@ static struct i2c_driver i2c_driver_videotext = .id = I2C_DRIVERID_SAA5249, /* in i2c.h */ .attach_adapter = saa5246a_probe, .detach_client = saa5246a_detach, - .command = saa5246a_command }; static struct i2c_client client_template = { diff --git a/drivers/media/video/saa5249.c b/drivers/media/video/saa5249.c index d7c4e33..a51c7bd 100644 --- a/drivers/media/video/saa5249.c +++ b/drivers/media/video/saa5249.c @@ -226,12 +226,6 @@ static int saa5249_detach(struct i2c_client *client) return 0; } -static int saa5249_command(struct i2c_client *device, - unsigned int cmd, void *arg) -{ - return -EINVAL; -} - /* new I2C driver support */ static struct i2c_driver i2c_driver_videotext = @@ -242,7 +236,6 @@ static struct i2c_driver i2c_driver_videotext = .id = I2C_DRIVERID_SAA5249, /* in i2c.h */ .attach_adapter = saa5249_probe, .detach_client = saa5249_detach, - .command = saa5249_command }; static struct i2c_client client_template = { diff --git a/drivers/video/matrox/matroxfb_maven.c b/drivers/video/matrox/matroxfb_maven.c index 2558753..a1f2c5e 100644 --- a/drivers/video/matrox/matroxfb_maven.c +++ b/drivers/video/matrox/matroxfb_maven.c @@ -1288,10 +1288,6 @@ static int maven_detach_client(struct i2c_client* client) { return 0; } -static int maven_command(struct i2c_client* client, unsigned int cmd, void* arg) { - return -ENOIOCTLCMD; /* or -EINVAL, depends on who will call this */ -} - static struct i2c_driver maven_driver={ .driver = { .name = "maven", @@ -1299,7 +1295,6 @@ static struct i2c_driver maven_driver={ .id = I2C_DRIVERID_MGATVO, .attach_adapter = maven_attach_adapter, .detach_client = maven_detach_client, - .command = maven_command, }; /* ************************** */ -- cgit v1.1 From fb687d73fa7685ffeed1a6b24fadb5f4db817783 Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Sun, 18 Dec 2005 16:51:55 +0100 Subject: [PATCH] i2c: update i2c_driver.command documentation Document i2c_driver.command as being deprecated, and don't suggest an empty implementation of this callback as it doesn't make any sense. Signed-off-by: Jean Delvare Signed-off-by: Greg Kroah-Hartman --- Documentation/i2c/writing-clients | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/Documentation/i2c/writing-clients b/Documentation/i2c/writing-clients index 27c425a..3a057c8 100644 --- a/Documentation/i2c/writing-clients +++ b/Documentation/i2c/writing-clients @@ -492,17 +492,13 @@ Note that some functions are marked by `__init', and some data structures by `__init_data'. Hose functions and structures can be removed after kernel booting (or module loading) is completed. + Command function ================ A generic ioctl-like function call back is supported. You will seldom -need this. You may even set it to NULL. - - /* No commands defined */ - int foo_command(struct i2c_client *client, unsigned int cmd, void *arg) - { - return 0; - } +need this, and its use is deprecated anyway, so newer design should not +use it. Set it to NULL. Sending and receiving -- cgit v1.1 From 3fb81a3df63e1900a7b3f496806a3f8d2b4295dd Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Sun, 18 Dec 2005 17:11:51 +0100 Subject: [PATCH] i2c: I2C_DF_NOTIFY removal comment cleanups The removal of I2C_DF_NOTIFY left some out of date comments in the code. Drop them. Signed-off-by: Jean Delvare Signed-off-by: Greg Kroah-Hartman --- drivers/i2c/i2c-core.c | 8 -------- 1 file changed, 8 deletions(-) diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c index c23443e..52b7747 100644 --- a/drivers/i2c/i2c-core.c +++ b/drivers/i2c/i2c-core.c @@ -246,10 +246,6 @@ int i2c_del_adapter(struct i2c_adapter *adap) list_for_each_safe(item, _n, &adap->clients) { client = list_entry(item, struct i2c_client, list); - /* detaching devices is unconditional of the set notify - * flag, as _all_ clients that reside on the adapter - * must be deleted, as this would cause invalid states. - */ if ((res=client->driver->detach_client(client))) { dev_err(&adap->dev, "detach_client failed for client " "[%s] at address 0x%02x\n", client->name, @@ -335,10 +331,6 @@ int i2c_del_driver(struct i2c_driver *driver) /* Have a look at each adapter, if clients of this driver are still * attached. If so, detach them to be able to kill the driver * afterwards. - * - * Removing clients does not depend on the notify flag, else - * invalid operation might (will!) result, when using stale client - * pointers. */ list_for_each(item1,&adapters) { adap = list_entry(item1, struct i2c_adapter, list); -- cgit v1.1 From a4787c0d232e16e727b37205dc647337b8974f35 Mon Sep 17 00:00:00 2001 From: Martin Hicks Date: Sun, 18 Dec 2005 17:18:01 +0100 Subject: [PATCH] i2c: i2c-ibm_iic add I2C_CLASS_HWMON Add the ibm_iic driver to the HWMON class so it will scan the bus for connected hardware monitor sensors. Signed-off-by: Martin Hicks Signed-off-by: Jean Delvare Signed-off-by: Greg Kroah-Hartman --- drivers/i2c/busses/i2c-ibm_iic.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/i2c/busses/i2c-ibm_iic.c b/drivers/i2c/busses/i2c-ibm_iic.c index 1a58725..87fae93 100644 --- a/drivers/i2c/busses/i2c-ibm_iic.c +++ b/drivers/i2c/busses/i2c-ibm_iic.c @@ -725,6 +725,7 @@ static int __devinit iic_probe(struct ocp_device *ocp){ strcpy(adap->name, "IBM IIC"); i2c_set_adapdata(adap, dev); adap->id = I2C_HW_OCP; + adap->class = I2C_CLASS_HWMON; adap->algo = &iic_algo; adap->client_register = NULL; adap->client_unregister = NULL; -- cgit v1.1 From 7c72ccf09b6debe55b8e049377ad3183ed4f4cb3 Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Sun, 18 Dec 2005 17:25:18 +0100 Subject: [PATCH] i2c: i2c-nforce2 add nforce4 MCP-04 device ID One more supported PCI ID for the i2c-nforce2 driver. Signed-off-by: Jean Delvare Signed-off-by: Greg Kroah-Hartman --- Documentation/i2c/busses/i2c-nforce2 | 3 ++- drivers/i2c/busses/i2c-nforce2.c | 2 ++ include/linux/pci_ids.h | 1 + 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/Documentation/i2c/busses/i2c-nforce2 b/Documentation/i2c/busses/i2c-nforce2 index e379e18..d751282 100644 --- a/Documentation/i2c/busses/i2c-nforce2 +++ b/Documentation/i2c/busses/i2c-nforce2 @@ -5,7 +5,8 @@ Supported adapters: * nForce2 Ultra 400 MCP 10de:0084 * nForce3 Pro150 MCP 10de:00D4 * nForce3 250Gb MCP 10de:00E4 - * nForce4 MCP 10de:0052 + * nForce4 MCP 10de:0052 + * nForce4 MCP-04 10de:0034 Datasheet: not publically available, but seems to be similar to the AMD-8111 SMBus 2.0 adapter. diff --git a/drivers/i2c/busses/i2c-nforce2.c b/drivers/i2c/busses/i2c-nforce2.c index 4d18e6e5..2d80eb2 100644 --- a/drivers/i2c/busses/i2c-nforce2.c +++ b/drivers/i2c/busses/i2c-nforce2.c @@ -30,6 +30,7 @@ nForce3 Pro150 MCP 00D4 nForce3 250Gb MCP 00E4 nForce4 MCP 0052 + nForce4 MCP-04 0034 This driver supports the 2 SMBuses that are included in the MCP of the nForce2/3/4 chipsets. @@ -257,6 +258,7 @@ static struct pci_device_id nforce2_ids[] = { { PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE3_SMBUS) }, { PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE3S_SMBUS) }, { PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE4_SMBUS) }, + { PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE_MCP04_SMBUS) }, { 0 } }; diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h index 4f01710..96a0403 100644 --- a/include/linux/pci_ids.h +++ b/include/linux/pci_ids.h @@ -976,6 +976,7 @@ #define PCI_DEVICE_ID_NVIDIA_TNT_UNKNOWN 0x002a #define PCI_DEVICE_ID_NVIDIA_VTNT2 0x002C #define PCI_DEVICE_ID_NVIDIA_UVTNT2 0x002D +#define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP04_SMBUS 0x0034 #define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP04_IDE 0x0035 #define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP04_SATA 0x0036 #define PCI_DEVICE_ID_NVIDIA_NVENET_10 0x0037 -- cgit v1.1 From e91c021c487110386a07facd0396e6c3b7cf9c1f Mon Sep 17 00:00:00 2001 From: "Mark A. Greer" Date: Sun, 18 Dec 2005 17:22:01 +0100 Subject: [PATCH] i2c: i2c-mv64xxx fix transaction abortion When the i2c-mv64xxx i2c driver is signalled to abort a transaction, it aborts it immediately by issuing a stop condition on the bus. This violates the i2c protocol and can cause what appears to be an i2c bus hang. This patch delays issuing the stop condition until the i2c device can reasonably expect a stop condition. Also includes a minor fixup. Signed-off-by: Mark A. Greer Signed-off-by: Jean Delvare --- drivers/i2c/busses/i2c-mv64xxx.c | 33 +++++++++++++++------------------ 1 file changed, 15 insertions(+), 18 deletions(-) diff --git a/drivers/i2c/busses/i2c-mv64xxx.c b/drivers/i2c/busses/i2c-mv64xxx.c index 81031eb..22781d8 100644 --- a/drivers/i2c/busses/i2c-mv64xxx.c +++ b/drivers/i2c/busses/i2c-mv64xxx.c @@ -1,6 +1,4 @@ /* - * drivers/i2c/busses/i2c-mv64xxx.c - * * Driver for the i2c controller on the Marvell line of host bridges for MIPS * and PPC (e.g, gt642[46]0, mv643[46]0, mv644[46]0). * @@ -65,7 +63,6 @@ enum { MV64XXX_I2C_STATE_WAITING_FOR_ADDR_2_ACK, MV64XXX_I2C_STATE_WAITING_FOR_SLAVE_ACK, MV64XXX_I2C_STATE_WAITING_FOR_SLAVE_DATA, - MV64XXX_I2C_STATE_ABORTING, }; /* Driver actions */ @@ -85,6 +82,7 @@ struct mv64xxx_i2c_data { int irq; u32 state; u32 action; + u32 aborting; u32 cntl_bits; void __iomem *reg_base; u32 reg_base_p; @@ -122,12 +120,6 @@ mv64xxx_i2c_fsm(struct mv64xxx_i2c_data *drv_data, u32 status) return; } - if (drv_data->state == MV64XXX_I2C_STATE_ABORTING) { - drv_data->action = MV64XXX_I2C_ACTION_SEND_STOP; - drv_data->state = MV64XXX_I2C_STATE_IDLE; - return; - } - /* The status from the ctlr [mostly] tells us what to do next */ switch (status) { /* Start condition interrupt */ @@ -148,14 +140,16 @@ mv64xxx_i2c_fsm(struct mv64xxx_i2c_data *drv_data, u32 status) /* FALLTHRU */ case MV64XXX_I2C_STATUS_MAST_WR_ADDR_2_ACK: /* 0xd0 */ case MV64XXX_I2C_STATUS_MAST_WR_ACK: /* 0x28 */ - if (drv_data->bytes_left > 0) { + if ((drv_data->bytes_left == 0) + || (drv_data->aborting + && (drv_data->byte_posn != 0))) { + drv_data->action = MV64XXX_I2C_ACTION_SEND_STOP; + drv_data->state = MV64XXX_I2C_STATE_IDLE; + } else { drv_data->action = MV64XXX_I2C_ACTION_SEND_DATA; drv_data->state = MV64XXX_I2C_STATE_WAITING_FOR_SLAVE_ACK; drv_data->bytes_left--; - } else { - drv_data->action = MV64XXX_I2C_ACTION_SEND_STOP; - drv_data->state = MV64XXX_I2C_STATE_IDLE; } break; @@ -184,7 +178,7 @@ mv64xxx_i2c_fsm(struct mv64xxx_i2c_data *drv_data, u32 status) } drv_data->state = MV64XXX_I2C_STATE_WAITING_FOR_SLAVE_DATA; - if (drv_data->bytes_left == 1) + if ((drv_data->bytes_left == 1) || drv_data->aborting) drv_data->cntl_bits &= ~MV64XXX_I2C_REG_CONTROL_ACK; break; @@ -320,6 +314,7 @@ mv64xxx_i2c_prepare_for_io(struct mv64xxx_i2c_data *drv_data, drv_data->msg = msg; drv_data->byte_posn = 0; drv_data->bytes_left = msg->len; + drv_data->aborting = 0; drv_data->rc = 0; drv_data->cntl_bits = MV64XXX_I2C_REG_CONTROL_ACK | MV64XXX_I2C_REG_CONTROL_INTEN | MV64XXX_I2C_REG_CONTROL_TWSIEN; @@ -359,17 +354,19 @@ mv64xxx_i2c_wait_for_completion(struct mv64xxx_i2c_data *drv_data) } if (abort && drv_data->block) { - drv_data->state = MV64XXX_I2C_STATE_ABORTING; + drv_data->aborting = 1; spin_unlock_irqrestore(&drv_data->lock, flags); time_left = wait_event_timeout(drv_data->waitq, !drv_data->block, msecs_to_jiffies(drv_data->adapter.timeout)); - if (time_left <= 0) { + if ((time_left <= 0) && drv_data->block) { drv_data->state = MV64XXX_I2C_STATE_IDLE; dev_err(&drv_data->adapter.dev, - "mv64xxx: I2C bus locked\n"); + "mv64xxx: I2C bus locked, block: %d, " + "time_left: %d\n", drv_data->block, + (int)time_left); } } else spin_unlock_irqrestore(&drv_data->lock, flags); @@ -510,7 +507,7 @@ mv64xxx_i2c_probe(struct platform_device *pd) goto exit_kfree; } - strncpy(drv_data->adapter.name, MV64XXX_I2C_CTLR_NAME " adapter", + strlcpy(drv_data->adapter.name, MV64XXX_I2C_CTLR_NAME " adapter", I2C_NAME_SIZE); init_waitqueue_head(&drv_data->waitq); -- cgit v1.1