aboutsummaryrefslogtreecommitdiffstats
path: root/i2c
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@suse.de>2005-09-28 16:11:46 -0700
committerGreg Kroah-Hartman <gregkh@suse.de>2005-09-28 16:11:46 -0700
commita7f91659b58eb0db11a491e2fbb583f9595d850d (patch)
tree44ead8f7b6f98bc613c7ae6e2108beb78db9cb03 /i2c
parentec26580b1071b2113c7bbc2b32ef9bee3e13d2bf (diff)
downloadpatches-a7f91659b58eb0db11a491e2fbb583f9595d850d.tar.gz
rearange stuff
Diffstat (limited to 'i2c')
-rw-r--r--i2c/i2c-device-id.patch87
1 files changed, 87 insertions, 0 deletions
diff --git a/i2c/i2c-device-id.patch b/i2c/i2c-device-id.patch
new file mode 100644
index 0000000000000..5e798a95ce757
--- /dev/null
+++ b/i2c/i2c-device-id.patch
@@ -0,0 +1,87 @@
+From: Greg Kroah-Hartman <gregkh@suse.de>
+Subject: I2C: try to make I2C devices have proper modaliases
+
+This is the start of adding hotplug-like support for i2c devices.
+
+This is still only a test, and not ready for inclusion.
+
+
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+---
+ drivers/hwmon/lm75.c | 13 +++++++++++++
+ include/linux/i2c.h | 1 +
+ include/linux/mod_devicetable.h | 5 +++++
+ scripts/mod/file2alias.c | 10 ++++++++++
+ 4 files changed, 29 insertions(+)
+
+--- gregkh-2.6.orig/drivers/hwmon/lm75.c 2005-09-08 09:07:11.000000000 -0700
++++ gregkh-2.6/drivers/hwmon/lm75.c 2005-09-08 09:42:25.000000000 -0700
+@@ -32,6 +32,19 @@
+ static unsigned short normal_i2c[] = { 0x48, 0x49, 0x4a, 0x4b, 0x4c,
+ 0x4d, 0x4e, 0x4f, I2C_CLIENT_END };
+
++static struct i2c_device_id id[] = {
++ { 0x48 },
++ { 0x49 },
++ { 0x4a },
++ { 0x4b },
++ { 0x4c },
++ { 0x4d },
++ { 0x4e },
++ { 0x4f },
++ { },
++};
++MODULE_DEVICE_TABLE(i2c, id);
++
+ /* Insmod parameters */
+ I2C_CLIENT_INSMOD_1(lm75);
+
+--- gregkh-2.6.orig/include/linux/mod_devicetable.h 2005-09-08 09:07:29.000000000 -0700
++++ gregkh-2.6/include/linux/mod_devicetable.h 2005-09-08 09:42:25.000000000 -0700
+@@ -243,4 +243,9 @@ struct pcmcia_device_id {
+ #define PCMCIA_DEV_ID_MATCH_FAKE_CIS 0x0200
+ #define PCMCIA_DEV_ID_MATCH_ANONYMOUS 0x0400
+
++/* I2C */
++struct i2c_device_id {
++ __u16 id;
++};
++
+ #endif /* LINUX_MOD_DEVICETABLE_H */
+--- gregkh-2.6.orig/scripts/mod/file2alias.c 2005-09-08 09:07:39.000000000 -0700
++++ gregkh-2.6/scripts/mod/file2alias.c 2005-09-08 09:43:12.000000000 -0700
+@@ -357,6 +357,13 @@ static int do_vio_entry(const char *file
+ return 1;
+ }
+
++static int do_i2c_entry(const char *filename, struct i2c_device_id *i2c, char *alias)
++{
++ strcpy(alias, "i2c:");
++ ADD(alias, "id", 1, i2c->id);
++ return 1;
++}
++
+ /* Ignore any prefix, eg. v850 prepends _ */
+ static inline int sym_is(const char *symbol, const char *name)
+ {
+@@ -441,6 +448,9 @@ void handle_moddevtable(struct module *m
+ else if (sym_is(symname, "__mod_vio_device_table"))
+ do_table(symval, sym->st_size, sizeof(struct vio_device_id),
+ do_vio_entry, mod);
++ else if (sym_is(symname, "__mod_i2c_device_table"))
++ do_table(symval, sym->st_size, sizeof(struct i2c_device_id),
++ do_i2c_entry, mod);
+
+ }
+
+--- gregkh-2.6.orig/include/linux/i2c.h 2005-09-08 09:07:29.000000000 -0700
++++ gregkh-2.6/include/linux/i2c.h 2005-09-08 09:42:25.000000000 -0700
+@@ -31,6 +31,7 @@
+ #include <linux/module.h>
+ #include <linux/types.h>
+ #include <linux/i2c-id.h>
++#include <linux/mod_devicetable.h>
+ #include <linux/device.h> /* for struct device */
+ #include <asm/semaphore.h>
+