aboutsummaryrefslogtreecommitdiffstats
path: root/i2c
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@suse.de>2005-11-29 12:04:15 -0800
committerGreg Kroah-Hartman <gregkh@suse.de>2005-11-29 12:04:15 -0800
commit731e918a4a85c611ca2b7bca552c5f4ae10d1f53 (patch)
treec39cb1442ef9a4c4f7ae8bc2459e6a7e01557343 /i2c
parent5ee9d5564f1372dcf7cb6dcfa052bd7368657f40 (diff)
downloadpatches-731e918a4a85c611ca2b7bca552c5f4ae10d1f53.tar.gz
2.6.15-rc3 refresh and usb, driver core, and i2c patches
Diffstat (limited to 'i2c')
-rw-r--r--i2c/i2c-client-use-01-drop-multiple-use-flag.patch42
-rw-r--r--i2c/i2c-client-use-02-make-use-flag-default.patch387
-rw-r--r--i2c/i2c-client-use-03-allow-multiple-use.patch65
-rw-r--r--i2c/i2c-core-get-client-is-gone.patch39
-rw-r--r--i2c/i2c-doc-porting-clients-update.patch183
5 files changed, 716 insertions, 0 deletions
diff --git a/i2c/i2c-client-use-01-drop-multiple-use-flag.patch b/i2c/i2c-client-use-01-drop-multiple-use-flag.patch
new file mode 100644
index 0000000000000..5aa4ca22480ad
--- /dev/null
+++ b/i2c/i2c-client-use-01-drop-multiple-use-flag.patch
@@ -0,0 +1,42 @@
+From khali@linux-fr.org Sat Nov 26 19:24:56 2005
+Date: Sat, 26 Nov 2005 20:58:35 +0100
+From: Jean Delvare <khali@linux-fr.org>
+To: Greg KH <greg@kroah.com>
+Cc: Mauro Carvalho Chehab <mchehab@brturbo.com.br>
+Subject: [PATCH 21/25] i2c: Rework client usage count, 1 of 3
+Message-Id: <20051126205835.29f1b5e8.khali@linux-fr.org>
+Content-Disposition: inline; filename=i2c-client-use-01-drop-multiple-use-flag.patch
+
+No i2c client uses the I2C_CLIENT_ALLOW_MULTIPLE_USE flag, drop it.
+
+Signed-off-by: Jean Delvare <khali@linux-fr.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+---
+ drivers/i2c/i2c-core.c | 4 +---
+ include/linux/i2c.h | 2 --
+ 2 files changed, 1 insertion(+), 5 deletions(-)
+
+--- gregkh-2.6.orig/drivers/i2c/i2c-core.c
++++ gregkh-2.6/drivers/i2c/i2c-core.c
+@@ -500,9 +500,7 @@ int i2c_use_client(struct i2c_client *cl
+ 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++;
+--- gregkh-2.6.orig/include/linux/i2c.h
++++ gregkh-2.6/include/linux/i2c.h
+@@ -251,8 +251,6 @@ static inline void i2c_set_adapdata (str
+
+ /*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 */
diff --git a/i2c/i2c-client-use-02-make-use-flag-default.patch b/i2c/i2c-client-use-02-make-use-flag-default.patch
new file mode 100644
index 0000000000000..1c539ac09f7e1
--- /dev/null
+++ b/i2c/i2c-client-use-02-make-use-flag-default.patch
@@ -0,0 +1,387 @@
+From khali@linux-fr.org Sat Nov 26 19:30:07 2005
+Date: Sat, 26 Nov 2005 21:00:54 +0100
+From: Jean Delvare <khali@linux-fr.org>
+To: Greg KH <greg@kroah.com>
+Cc: Mauro Carvalho Chehab <mchehab@brturbo.com.br>, Richard Purdie <richard@openedhand.com>
+Subject: [PATCH 22/25] i2c: Rework client usage count, 2 of 3
+Message-Id: <20051126210054.631ac7f3.khali@linux-fr.org>
+Content-Disposition: inline; filename=i2c-client-use-02-make-use-flag-default.patch
+
+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 <khali@linux-fr.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+---
+ 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(-)
+
+--- gregkh-2.6.orig/arch/arm/mach-pxa/akita-ioexp.c
++++ gregkh-2.6/arch/arm/mach-pxa/akita-ioexp.c
+@@ -133,7 +133,6 @@ static struct i2c_driver max7310_i2c_dri
+
+ static struct i2c_client max7310_template = {
+ name: "akita-max7310",
+- flags: I2C_CLIENT_ALLOW_USE,
+ driver: &max7310_i2c_driver,
+ };
+
+--- gregkh-2.6.orig/drivers/i2c/chips/rtc8564.c
++++ gregkh-2.6/drivers/i2c/chips/rtc8564.c
+@@ -155,7 +155,6 @@ static int rtc8564_attach(struct i2c_ada
+
+ 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;
+--- gregkh-2.6.orig/drivers/i2c/i2c-core.c
++++ gregkh-2.6/drivers/i2c/i2c-core.c
+@@ -419,8 +419,7 @@ int i2c_attach_client(struct i2c_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
+ 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 *cl
+ 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 *cl
+
+ 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;
+--- gregkh-2.6.orig/drivers/media/video/adv7170.c
++++ gregkh-2.6/drivers/media/video/adv7170.c
+@@ -420,7 +420,6 @@ adv7170_detect_client (struct i2c_adapte
+ 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;
+--- gregkh-2.6.orig/drivers/media/video/adv7175.c
++++ gregkh-2.6/drivers/media/video/adv7175.c
+@@ -470,7 +470,6 @@ adv7175_detect_client (struct i2c_adapte
+ 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;
+--- gregkh-2.6.orig/drivers/media/video/bt819.c
++++ gregkh-2.6/drivers/media/video/bt819.c
+@@ -535,7 +535,6 @@ bt819_detect_client (struct i2c_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) {
+--- gregkh-2.6.orig/drivers/media/video/bt832.c
++++ gregkh-2.6/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,
+ };
+
+--- gregkh-2.6.orig/drivers/media/video/bt856.c
++++ gregkh-2.6/drivers/media/video/bt856.c
+@@ -323,7 +323,6 @@ bt856_detect_client (struct i2c_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);
+--- gregkh-2.6.orig/drivers/media/video/cs53l32a.c
++++ gregkh-2.6/drivers/media/video/cs53l32a.c
+@@ -154,7 +154,6 @@ static int cs53l32a_attach(struct i2c_ad
+ 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);
+--- gregkh-2.6.orig/drivers/media/video/cx25840/cx25840-core.c
++++ gregkh-2.6/drivers/media/video/cx25840/cx25840-core.c
+@@ -737,7 +737,6 @@ static int cx25840_detect_client(struct
+ 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);
+--- gregkh-2.6.orig/drivers/media/video/em28xx/em28xx-i2c.c
++++ gregkh-2.6/drivers/media/video/em28xx/em28xx-i2c.c
+@@ -497,7 +497,6 @@ static struct i2c_adapter em28xx_adap_te
+
+ static struct i2c_client em28xx_client_template = {
+ .name = "em28xx internal",
+- .flags = I2C_CLIENT_ALLOW_USE,
+ };
+
+ /* ----------------------------------------------------------- */
+--- gregkh-2.6.orig/drivers/media/video/msp3400.c
++++ gregkh-2.6/drivers/media/video/msp3400.c
+@@ -1572,7 +1572,6 @@ static struct i2c_driver driver = {
+ static struct i2c_client client_template =
+ {
+ .name = "(unset)",
+- .flags = I2C_CLIENT_ALLOW_USE,
+ .driver = &driver,
+ };
+
+--- gregkh-2.6.orig/drivers/media/video/saa6588.c
++++ gregkh-2.6/drivers/media/video/saa6588.c
+@@ -506,7 +506,6 @@ static struct i2c_driver driver = {
+
+ static struct i2c_client client_template = {
+ .name = "saa6588",
+- .flags = I2C_CLIENT_ALLOW_USE,
+ .driver = &driver,
+ };
+
+--- gregkh-2.6.orig/drivers/media/video/saa7110.c
++++ gregkh-2.6/drivers/media/video/saa7110.c
+@@ -501,7 +501,6 @@ saa7110_detect_client (struct i2c_adapte
+ 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);
+--- gregkh-2.6.orig/drivers/media/video/saa7111.c
++++ gregkh-2.6/drivers/media/video/saa7111.c
+@@ -518,7 +518,6 @@ saa7111_detect_client (struct i2c_adapte
+ 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);
+--- gregkh-2.6.orig/drivers/media/video/saa7114.c
++++ gregkh-2.6/drivers/media/video/saa7114.c
+@@ -859,7 +859,6 @@ saa7114_detect_client (struct i2c_adapte
+ 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);
+--- gregkh-2.6.orig/drivers/media/video/saa7115.c
++++ gregkh-2.6/drivers/media/video/saa7115.c
+@@ -1268,7 +1268,6 @@ static int saa7115_attach(struct i2c_ada
+ 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);
+--- gregkh-2.6.orig/drivers/media/video/saa711x.c
++++ gregkh-2.6/drivers/media/video/saa711x.c
+@@ -494,7 +494,6 @@ saa711x_detect_client (struct i2c_adapte
+ 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) {
+--- gregkh-2.6.orig/drivers/media/video/saa7127.c
++++ gregkh-2.6/drivers/media/video/saa7127.c
+@@ -719,7 +719,6 @@ static int saa7127_attach(struct i2c_ada
+ 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);
+--- gregkh-2.6.orig/drivers/media/video/saa7134/saa6752hs.c
++++ gregkh-2.6/drivers/media/video/saa7134/saa6752hs.c
+@@ -607,7 +607,6 @@ static struct i2c_driver driver = {
+ static struct i2c_client client_template =
+ {
+ .name = "saa6752hs",
+- .flags = I2C_CLIENT_ALLOW_USE,
+ .driver = &driver,
+ };
+
+--- gregkh-2.6.orig/drivers/media/video/saa7185.c
++++ gregkh-2.6/drivers/media/video/saa7185.c
+@@ -415,7 +415,6 @@ saa7185_detect_client (struct i2c_adapte
+ 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);
+--- gregkh-2.6.orig/drivers/media/video/tda9887.c
++++ gregkh-2.6/drivers/media/video/tda9887.c
+@@ -832,7 +832,6 @@ static struct i2c_driver driver = {
+ static struct i2c_client client_template =
+ {
+ .name = "tda9887",
+- .flags = I2C_CLIENT_ALLOW_USE,
+ .driver = &driver,
+ };
+
+--- gregkh-2.6.orig/drivers/media/video/tuner-core.c
++++ gregkh-2.6/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,
+ };
+
+--- gregkh-2.6.orig/drivers/media/video/tvaudio.c
++++ gregkh-2.6/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,
+ };
+
+--- gregkh-2.6.orig/drivers/media/video/tveeprom.c
++++ gregkh-2.6/drivers/media/video/tveeprom.c
+@@ -709,7 +709,6 @@ tveeprom_detect_client(struct i2c_adapte
+ 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);
+ return 0;
+--- gregkh-2.6.orig/drivers/media/video/tvp5150.c
++++ gregkh-2.6/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,
+ };
+
+--- gregkh-2.6.orig/drivers/media/video/vpx3220.c
++++ gregkh-2.6/drivers/media/video/vpx3220.c
+@@ -631,7 +631,6 @@ vpx3220_detect_client (struct i2c_adapte
+ 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) {
+--- gregkh-2.6.orig/drivers/media/video/wm8775.c
++++ gregkh-2.6/drivers/media/video/wm8775.c
+@@ -168,7 +168,6 @@ static int wm8775_attach(struct i2c_adap
+ 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);
+--- gregkh-2.6.orig/include/linux/i2c.h
++++ gregkh-2.6/include/linux/i2c.h
+@@ -250,7 +250,6 @@ static inline void i2c_set_adapdata (str
+ }
+
+ /*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 */
diff --git a/i2c/i2c-client-use-03-allow-multiple-use.patch b/i2c/i2c-client-use-03-allow-multiple-use.patch
new file mode 100644
index 0000000000000..60d2a302051ce
--- /dev/null
+++ b/i2c/i2c-client-use-03-allow-multiple-use.patch
@@ -0,0 +1,65 @@
+From khali@linux-fr.org Sat Nov 26 19:30:17 2005
+Date: Sat, 26 Nov 2005 21:03:41 +0100
+From: Jean Delvare <khali@linux-fr.org>
+To: Greg KH <greg@kroah.com>
+Cc: Mauro Carvalho Chehab <mchehab@brturbo.com.br>
+Subject: [PATCH 23/25] i2c: Rework client usage count, 3 of 3
+Message-Id: <20051126210341.60921e91.khali@linux-fr.org>
+Content-Disposition: inline; filename=i2c-client-use-03-allow-multiple-use.patch
+
+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 <khali@linux-fr.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+---
+ Documentation/i2c/porting-clients | 1 +
+ drivers/i2c/i2c-core.c | 5 -----
+ include/linux/i2c.h | 4 +---
+ 3 files changed, 2 insertions(+), 8 deletions(-)
+
+--- gregkh-2.6.orig/Documentation/i2c/porting-clients
++++ gregkh-2.6/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
+--- gregkh-2.6.orig/drivers/i2c/i2c-core.c
++++ gregkh-2.6/drivers/i2c/i2c-core.c
+@@ -497,14 +497,9 @@ int i2c_use_client(struct i2c_client *cl
+ 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)
+--- gregkh-2.6.orig/include/linux/i2c.h
++++ gregkh-2.6/include/linux/i2c.h
+@@ -307,9 +307,7 @@ extern struct i2c_client *i2c_get_client
+ 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 *);
+
diff --git a/i2c/i2c-core-get-client-is-gone.patch b/i2c/i2c-core-get-client-is-gone.patch
new file mode 100644
index 0000000000000..8ce9b98eaf96f
--- /dev/null
+++ b/i2c/i2c-core-get-client-is-gone.patch
@@ -0,0 +1,39 @@
+From khali@linux-fr.org Sat Nov 26 19:30:42 2005
+Date: Sat, 26 Nov 2005 21:06:08 +0100
+From: Jean Delvare <khali@linux-fr.org>
+To: Greg KH <greg@kroah.com>
+Subject: [PATCH 25/25] i2c: i2c_get_client is gone
+Message-Id: <20051126210608.5a9bd8c6.khali@linux-fr.org>
+Content-Disposition: inline; filename=i2c-core-get-client-is-gone.patch
+
+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 <khali@linux-fr.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+---
+ include/linux/i2c.h | 13 ++-----------
+ 1 file changed, 2 insertions(+), 11 deletions(-)
+
+--- gregkh-2.6.orig/include/linux/i2c.h
++++ gregkh-2.6/include/linux/i2c.h
+@@ -296,17 +296,8 @@ extern int i2c_del_driver(struct i2c_dri
+ 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 *);
diff --git a/i2c/i2c-doc-porting-clients-update.patch b/i2c/i2c-doc-porting-clients-update.patch
new file mode 100644
index 0000000000000..c4f904f66c027
--- /dev/null
+++ b/i2c/i2c-doc-porting-clients-update.patch
@@ -0,0 +1,183 @@
+From khali@linux-fr.org Sat Nov 26 19:30:27 2005
+Date: Sat, 26 Nov 2005 21:05:17 +0100
+From: Jean Delvare <khali@linux-fr.org>
+To: Greg KH <greg@kroah.com>
+Subject: [PATCH 24/25] i2c: Chip driver porting guide update
+Message-Id: <20051126210517.109c9adc.khali@linux-fr.org>
+Content-Disposition: inline; filename=i2c-doc-porting-clients-update.patch
+
+Update Documentation/i2c/porting-clients. Many recent changes to the i2c
+and hwmon subsystems were never reported there.
+
+Signed-off-by: Jean Delvare <khali@linux-fr.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+---
+ Documentation/i2c/porting-clients | 83 +++++++++++++++++++++-----------------
+ 1 file changed, 46 insertions(+), 37 deletions(-)
+
+--- gregkh-2.6.orig/Documentation/i2c/porting-clients
++++ gregkh-2.6/Documentation/i2c/porting-clients
+@@ -1,10 +1,13 @@
+-Revision 5, 2005-07-29
++Revision 6, 2005-11-20
+ Jean Delvare <khali@linux-fr.org>
+ Greg KH <greg@kroah.com>
+
+ 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 <linux/module.h>
+ #include <linux/init.h>
+ #include <linux/slab.h>
++ #include <linux/jiffies.h>
+ #include <linux/i2c.h>
++ #include <linux/i2c-isa.h> /* for ISA drivers */
+ #include <linux/hwmon.h> /* for hardware monitoring drivers */
+ #include <linux/hwmon-sysfs.h>
+ #include <linux/hwmon-vid.h> /* if you need VRM support */
++ #include <linux/err.h> /* for class registration */
+ #include <asm/io.h> /* 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_<n> becomes I2C_CLIENT_INSMOD_<n>.
+
+ * [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 <lm-sensors@lm-sensors.org> 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.
+-
+-* [Update] Don't access client->data directly, use
+- i2c_get_clientdata(client) instead.
+-
+-* [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).
++* [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] 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] 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),