Skip to contentSkip to conversation

I2C updates for 2.4.29

PATCH New Jean Delvare 1 participant 4 messages Jan 29, 2005 I2C

lore
Share & tools
lore
#0 lore raw

Hi Marcelo, hi all,

I have a number of I2C updates for 2.4.29 waiting. All of them are rather small and independent, gathered during the 2.4.28 cycle and already applied to i2c CVS.

Individual patches follow, please apply.

Thanks.

Signature · 2 lines
Jean Delvare
http://khali.linux-fr.org/
#1 lore raw

PATCH 1/1 I2C updates for 2.4.29 (1/3)

Original reports and discussion:
http://archives.andrew.net.au/lm-sensors/msg28512.html
http://archives.andrew.net.au/lm-sensors/msg28581.html

Bottom line:
The "bit" and "pcf" i2c algorithms should declare themselves fully I2C capable, but do not.

Credits go to Ian Campbell for noticing and proposing patches.

This is a backport from Linux 2.6.11-rc1.

drivers/i2c/i2c-algo-bit.c renamed from drivers/i2c/i2c-algo-bit.c.orig +2 -2
@@ -522,8 +522,8 @@
 
 static u32 bit_func(struct i2c_adapter *adap)
 {
-	return I2C_FUNC_SMBUS_EMUL | I2C_FUNC_10BIT_ADDR | 
-	       I2C_FUNC_PROTOCOL_MANGLING;
+	return I2C_FUNC_I2C | I2C_FUNC_SMBUS_EMUL |
+	       I2C_FUNC_10BIT_ADDR | I2C_FUNC_PROTOCOL_MANGLING;
 }
 
 
drivers/i2c/i2c-algo-pcf.c renamed from drivers/i2c/i2c-algo-pcf.c.orig +2 -2
@@ -435,8 +435,8 @@
 
 static u32 pcf_func(struct i2c_adapter *adap)
 {
-	return I2C_FUNC_SMBUS_EMUL | I2C_FUNC_10BIT_ADDR | 
-	       I2C_FUNC_PROTOCOL_MANGLING; 
+	return I2C_FUNC_I2C | I2C_FUNC_SMBUS_EMUL |
+	       I2C_FUNC_10BIT_ADDR | I2C_FUNC_PROTOCOL_MANGLING;
 }
 
 /* -----exported algorithm data: -------------------------------------	*/
Signature · 2 lines
Jean Delvare
http://khali.linux-fr.org/
#2 lore raw

PATCH 1/1 I2C updates for 2.4.29 (2/3)

In reply to Jean Delvare

While editing i2c-algo-bit.c and i2c-algo-pcf.c (see 1/3 of this patch set), I noticed that both files include header files they do not need at all (namely linux/ioport.h and asm/uaccess.h). The following patch cleans this, additionally bringing the files in line with what we have in i2c CVS (thus the blank lines changes).

drivers/i2c/i2c-algo-bit.c renamed from drivers/i2c/i2c-algo-bit.c.orig +1 -3
@@ -28,14 +28,12 @@
 #include <linux/delay.h>
 #include <linux/slab.h>
 #include <linux/init.h>
-#include <asm/uaccess.h>
-#include <linux/ioport.h>
 #include <linux/errno.h>
 #include <linux/sched.h>
-
 #include <linux/i2c.h>
 #include <linux/i2c-algo-bit.h>
 
+
 /* ----- global defines ----------------------------------------------- */
 #define DEB(x) if (i2c_debug>=1) x;
 #define DEB2(x) if (i2c_debug>=2) x;
drivers/i2c/i2c-algo-pcf.c renamed from drivers/i2c/i2c-algo-pcf.c.orig +1 -3
@@ -32,15 +32,13 @@
 #include <linux/delay.h>
 #include <linux/slab.h>
 #include <linux/init.h>
-#include <asm/uaccess.h>
-#include <linux/ioport.h>
 #include <linux/errno.h>
 #include <linux/sched.h>
-
 #include <linux/i2c.h>
 #include <linux/i2c-algo-pcf.h>
 #include "i2c-pcf8584.h"
 
+
 /* ----- global defines ----------------------------------------------- */
 #define DEB(x) if (i2c_debug>=1) x
 #define DEB2(x) if (i2c_debug>=2) x
Signature · 2 lines
Jean Delvare
http://khali.linux-fr.org/
#3 lore raw

PATCH 1/1 I2C updates for 2.4.29 (3/3)

In reply to Jean Delvare

Original discussion:
http://archives.andrew.net.au/lm-sensors/msg29038.html
http://archives.andrew.net.au/lm-sensors/msg29041.html

Bottom line:
The "id" member of the i2c_client structure was discarded in Linux 2.6 due to a lack of consistent use and overall need. While we of course won't backport this to Linux 2.4 so as to not break compatibility with existing 2.4 drivers, it still seems wise to update the documentation so that new drivers written for Linux 2.4 today (*sigh*) do not rely on it.

Documentation/i2c/writing-clients renamed from Documentation/i2c/writing-clients.orig +0 -4
@@ -380,9 +380,6 @@
 
 For now, you can ignore the `flags' parameter. It is there for future use.
 
-  /* Unique ID allocation */
-  static int foo_id = 0;
-
   int foo_detect_client(struct i2c_adapter *adapter, int address, 
                         unsigned short flags, int kind)
   {
@@ -518,7 +515,6 @@
     data->type = kind;
     /* SENSORS ONLY END */
 
-    new_client->id = foo_id++; /* Automatically unique */
     data->valid = 0; /* Only if you use this field */
     init_MUTEX(&data->update_lock); /* Only if you use this field */
 
Signature · 2 lines
Jean Delvare
http://khali.linux-fr.org/