More i2c driver changes for 2.5.65
Subsystems (3)
PATCH 1/1 More i2c driver changes for 2.5.65
Hi,
Here are some more i2c driver changes for 2.5.65. These include changes that now hook up the i2c devices to the driver core. This results in a sysfs tree that looks like the following on one of my boxes:
/sys/bus/i2c/
|-- devices
| `-- i2c_dev_0 -> ../../../devices/pci0/00:1f.3/i2c-0/i2c_dev_0
`-- drivers
`-- LM75 sensor
`-- i2c_dev_0 -> ../../../../devices/pci0/00:1f.3/i2c-0/i2c_dev_0Now the fun work of starting to rip out the i2c sysctl and proc code can begin :)
These changesets also include the patch from Petr Vandrovec that fixes an oops on booting with i2c built into the kernel, and some more minor cleanups to some of the i2c core code.
I'll try to post a document later this weekend on lkml and kernel-janitors-discuss that explains how the i2c drivers will need to be converted, and how people can help out now that the infrastructure is finished.
Please pull from: bk://kernel.bkbits.net/gregkh/linux/i2c-2.5
thanks,
greg k-h
drivers/i2c/busses/i2c-ali15x3.c | 8 + drivers/i2c/busses/i2c-amd756.c | 6 - drivers/i2c/busses/i2c-amd8111.c | 4 drivers/i2c/busses/i2c-i801.c | 8 + drivers/i2c/busses/i2c-isa.c | 4 drivers/i2c/busses/i2c-piix4.c | 8 + drivers/i2c/chips/adm1021.c | 21 ++-- drivers/i2c/chips/lm75.c | 14 +-- drivers/i2c/i2c-algo-bit.c | 13 +- drivers/i2c/i2c-algo-pcf.c | 19 +--- drivers/i2c/i2c-core.c | 99 ++++++++++----------- drivers/i2c/i2c-dev.c | 21 ++-- drivers/i2c/i2c-elektor.c | 10 +- drivers/i2c/i2c-elv.c | 6 - drivers/i2c/i2c-philips-par.c | 4 drivers/i2c/i2c-proc.c | 180 ++++++++++----------------------------- drivers/i2c/i2c-velleman.c | 4 drivers/i2c/scx200_acb.c | 32 +++--- include/linux/i2c.h | 33 ++++--- 19 files changed, 218 insertions(+), 276 deletions(-)
-----
Short log:
-----
Greg Kroah-Hartman <[email protected]>:
o i2c: ugh, clean up lindent mess in i2c-proc.c::i2c_detect()
o i2c: fix up the chip driver names to play nice with sysfs
o i2c: actually register the i2c client device with the driver core
o i2c: Removed the name variable from i2c_client as the dev one should be used instead
o i2c: remove the data field from struct i2c_client
o i2c: add struct device to i2c_client structure
o i2c: remove *data from i2c_adapter, as dev->data should be used instead
o i2c: remove i2c_adapter->name and use dev->name instead
Petr Vandrovec <[email protected]>:
o Fix kobject_get oopses triggered by i2c in 2.5.65-bk
-----
Long log:
-----
[email protected], 2003-03-21 16:45:59-08:00, [email protected]
i2c: ugh, clean up lindent mess in i2c-proc.c::i2c_detect()
Yes, this function now goes beyond 80 columns, but it's almost readable, while the previous version was not.
Also removed some #ifdefs
drivers/i2c/i2c-proc.c | 180 ++++++++++++------------------------------------- 1 files changed, 47 insertions(+), 133 deletions(-)
------
[email protected], 2003-03-21 16:39:04-08:00, [email protected]
[PATCH] i2c: fix up the chip driver names to play nice with sysfs
drivers/i2c/chips/adm1021.c | 2 +- drivers/i2c/chips/lm75.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
------
[email protected], 2003-03-21 16:26:04-08:00, [email protected]
i2c: actually register the i2c client device with the driver core.
We have to initialize the client structure with 0 to keep the driver core from oopsing.
Now everything is hooked up enough to start removing the i2c sysctl and proc crud.
drivers/i2c/chips/adm1021.c | 2 ++ drivers/i2c/chips/lm75.c | 2 ++ drivers/i2c/i2c-core.c | 10 ++++++++++ 3 files changed, 14 insertions(+)
------
[email protected], 2003-03-21 16:16:01-08:00, [email protected]
i2c: Removed the name variable from i2c_client as the dev one should be used instead.
drivers/i2c/chips/adm1021.c | 2 +- drivers/i2c/chips/lm75.c | 2 +- drivers/i2c/i2c-core.c | 14 +++++++------- drivers/i2c/i2c-dev.c | 4 +++- include/linux/i2c.h | 1 - 5 files changed, 12 insertions(+), 11 deletions(-)
------
[email protected], 2003-03-21 16:07:30-08:00, [email protected]
[PATCH] i2c: remove the data field from struct i2c_client
It's no longer needed, as the struct device should be used instead.
Created i2c_get_clientdata() and i2c_set_clientdata() to access the data.
drivers/i2c/chips/adm1021.c | 15 +++++++-------- drivers/i2c/chips/lm75.c | 8 ++++---- include/linux/i2c.h | 11 ++++++++++- 3 files changed, 21 insertions(+), 13 deletions(-)
------
[email protected], 2003-03-21 16:00:39-08:00, [email protected]
i2c: add struct device to i2c_client structure
Not quite ready to hook it up to the driver core yet.
include/linux/i2c.h | 3 ++- 1 files changed, 2 insertions(+), 1 deletion(-)
------
[email protected], 2003-03-21 14:38:21-08:00, [email protected]
[PATCH] i2c: remove *data from i2c_adapter, as dev->data should be used instead.
drivers/i2c/i2c-elv.c | 2 +- drivers/i2c/scx200_acb.c | 4 ++-- include/linux/i2c.h | 17 +++++++++++------ 3 files changed, 14 insertions(+), 9 deletions(-)
------
[email protected], 2003-03-21 12:45:28-08:00, [email protected]
i2c: remove i2c_adapter->name and use dev->name instead.
drivers/i2c/busses/i2c-ali15x3.c | 8 ++-- drivers/i2c/busses/i2c-amd756.c | 6 ++- drivers/i2c/busses/i2c-amd8111.c | 4 +- drivers/i2c/busses/i2c-i801.c | 8 ++-- drivers/i2c/busses/i2c-isa.c | 4 +- drivers/i2c/busses/i2c-piix4.c | 8 ++-- drivers/i2c/i2c-algo-bit.c | 13 +++--- drivers/i2c/i2c-algo-pcf.c | 19 ++++------ drivers/i2c/i2c-core.c | 73 ++++++++++++++++----------------------- drivers/i2c/i2c-dev.c | 17 +++------ drivers/i2c/i2c-elektor.c | 10 +++-- drivers/i2c/i2c-elv.c | 4 +- drivers/i2c/i2c-philips-par.c | 4 +- drivers/i2c/i2c-velleman.c | 4 +- drivers/i2c/scx200_acb.c | 28 ++++++-------- include/linux/i2c.h | 1 16 files changed, 105 insertions(+), 106 deletions(-)
------
[email protected], 2003-03-21 12:29:44-08:00, [email protected]
[PATCH] Fix kobject_get oopses triggered by i2c in 2.5.65-bk
i2c initialization must not use module_init now, when it was converted to the kobject interface. There are dozens of users which need it working much sooner. i2c is subsystem after all, isn't it?
Fixes kernel oopses in kobject_get during system init which were happening to me.
Push file://home/greg/linux/BK/i2c-2.5 -> file://home/greg/linux/BK/bleed-2.5
drivers/i2c/i2c-core.c | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-)
------
PATCH 1/1 More i2c driver changes for 2.5.65
ChangeSet 1.1188, 2003/03/21 12:29:44-08:00, [email protected]
[PATCH] Fix kobject_get oopses triggered by i2c in 2.5.65-bk
i2c initialization must not use module_init now, when it was converted to the kobject interface. There are dozens of users which need it working much sooner. i2c is subsystem after all, isn't it?
Fixes kernel oopses in kobject_get during system init which were happening to me.
drivers/i2c/i2c-core.c | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-)
drivers/i2c/i2c-core.c +1 -1
@@ -675,7 +675,7 @@bus_unregister (&i2c_bus_type); } -module_init (i2c_init); +subsys_initcall (i2c_init);module_exit (i2c_exit);/* ----------------------------------------------------
ChangeSet 1.1189, 2003/03/21 12:45:28-08:00, [email protected]
i2c: remove i2c_adapter->name and use dev->name instead.
drivers/i2c/busses/i2c-ali15x3.c | 8 ++-- drivers/i2c/busses/i2c-amd756.c | 6 ++- drivers/i2c/busses/i2c-amd8111.c | 4 +- drivers/i2c/busses/i2c-i801.c | 8 ++-- drivers/i2c/busses/i2c-isa.c | 4 +- drivers/i2c/busses/i2c-piix4.c | 8 ++-- drivers/i2c/i2c-algo-bit.c | 13 +++--- drivers/i2c/i2c-algo-pcf.c | 19 ++++------ drivers/i2c/i2c-core.c | 73 ++++++++++++++++----------------------- drivers/i2c/i2c-dev.c | 17 +++------ drivers/i2c/i2c-elektor.c | 10 +++-- drivers/i2c/i2c-elv.c | 4 +- drivers/i2c/i2c-philips-par.c | 4 +- drivers/i2c/i2c-velleman.c | 4 +- drivers/i2c/scx200_acb.c | 28 ++++++-------- include/linux/i2c.h | 1 16 files changed, 105 insertions(+), 106 deletions(-)
drivers/i2c/busses/i2c-ali15x3.c +5 -3
@@ -474,9 +474,11 @@static struct i2c_adapter ali15x3_adapter = { .owner =THIS_MODULE , - .name ="unset" , .id =I2C_ALGO_SMBUS |I2C_HW_SMBUS_ALI15X3 , .algo = &smbus_algorithm, + .dev = { + .name ="unset" , + }, };static struct pci_device_id ali15x3_ids[]__devinitdata = {
@@ -500,8 +502,8 @@/* set up the driverfs linkage to our parent device */ ali15x3_adapter.dev.parent = &dev->dev; -sprintf (ali15x3_adapter.name,"SMBus ALI15X3 adapter at %04x" , - ali15x3_smba); +snprintf (ali15x3_adapter.dev.name,DEVICE_NAME_SIZE , +"SMBus ALI15X3 adapter at %04x" , ali15x3_smba);return i2c_add_adapter (&ali15x3_adapter); }
drivers/i2c/busses/i2c-amd756.c +4 -2
@@ -312,9 +312,11 @@static struct i2c_adapter amd756_adapter = { .owner =THIS_MODULE , - .name ="unset" , .id =I2C_ALGO_SMBUS |I2C_HW_SMBUS_AMD756 , .algo = &smbus_algorithm, + .dev = { + .name ="unset" , + }, };enum chiptype {AMD756 ,AMD766 ,AMD768 ,NFORCE };
@@ -376,7 +378,7 @@/* set up the driverfs linkage to our parent device */ amd756_adapter.dev.parent = &pdev->dev; -sprintf (amd756_adapter.name, +snprintf (amd756_adapter.dev.name,DEVICE_NAME_SIZE ,"SMBus AMD75x adapter at %04x" , amd756_ioport); error =i2c_add_adapter (&amd756_adapter);
drivers/i2c/busses/i2c-amd8111.c +2 -2
@@ -357,8 +357,8 @@ goto out_kfree; smbus->adapter.owner =THIS_MODULE ; -sprintf (smbus->adapter.name, -"SMBus2 AMD8111 adapter at %04x" , smbus->base); +snprintf (smbus->adapter.dev.name,DEVICE_NAME_SIZE , +"SMBus2 AMD8111 adapter at %04x" , smbus->base); smbus->adapter.id =I2C_ALGO_SMBUS |I2C_HW_SMBUS_AMD8111 ; smbus->adapter.algo = &smbus_algorithm; smbus->adapter.algo_data = smbus;
drivers/i2c/busses/i2c-i801.c +5 -3
@@ -546,9 +546,11 @@static struct i2c_adapter i801_adapter = { .owner =THIS_MODULE , - .name ="unset" , .id =I2C_ALGO_SMBUS |I2C_HW_SMBUS_I801 , .algo = &smbus_algorithm, + .dev = { + .name ="unset" , + }, };static struct pci_device_id i801_ids[]__devinitdata = {
@@ -597,8 +599,8 @@/* set up the driverfs linkage to our parent device */ i801_adapter.dev.parent = &dev->dev; -sprintf (i801_adapter.name,"SMBus I801 adapter at %04x" , - i801_smba); +snprintf (i801_adapter.dev.name,DEVICE_NAME_SIZE , +"SMBus I801 adapter at %04x" , i801_smba);return i2c_add_adapter (&i801_adapter); }
drivers/i2c/busses/i2c-isa.c +3 -1
@@ -39,9 +39,11 @@/* There can only be one... */ static struct i2c_adapter isa_adapter = { .owner =THIS_MODULE , - .name ="ISA main adapter" , .id =I2C_ALGO_ISA |I2C_HW_ISA , .algo = &isa_algorithm, + .dev = { + .name ="ISA main adapter" , + }, };static int __init i2c_isa_init (void )
drivers/i2c/busses/i2c-piix4.c +5 -3
@@ -394,9 +394,11 @@static struct i2c_adapter piix4_adapter = { .owner =THIS_MODULE , - .name ="unset" , .id =I2C_ALGO_SMBUS |I2C_HW_SMBUS_PIIX4 , .algo = &smbus_algorithm, + .dev = { + .name ="unset" , + }, };static struct pci_device_id piix4_ids[]__devinitdata = {
@@ -449,8 +451,8 @@/* set up the driverfs linkage to our parent device */ piix4_adapter.dev.parent = &dev->dev; -sprintf (piix4_adapter.name,"SMBus PIIX4 adapter at %04x" , - piix4_smba); +snprintf (piix4_adapter.dev.name,DEVICE_NAME_SIZE , +"SMBus PIIX4 adapter at %04x" , piix4_smba); retval =i2c_add_adapter (&piix4_adapter);
drivers/i2c/i2c-algo-bit.c +6 -7
@@ -23,6 +23,8 @@/* $Id: i2c-algo-bit.c,v 1.44 2003/01/21 08:08:16 kmalkki Exp $ */ +/* #define DEBUG 1 */ +#include <linux/kernel.h> #include <linux/module.h> #include <linux/delay.h>
@@ -338,16 +340,14 @@while (count >0 ) { c = *temp; -DEB2 (printk (KERN_DEBUG "i2c-algo-bit.o: %s sendbytes: writing %2.2X\n" , - i2c_adap->name, c&0xff )); +DEB2 (dev_dbg (&i2c_adap->dev,"sendbytes: writing %2.2X\n" , c&0xff )); retval =i2c_outb (i2c_adap,c);if ((retval>0 ) || (nak_ok && (retval==0 ))) {/* ok or ignored NAK */ count--; temp++; wrcount++; }else {/* arbitration or no acknowledge */ -printk (KERN_ERR "i2c-algo-bit.o: %s sendbytes: error - bailout.\n" , - i2c_adap->name); +dev_err (&i2c_adap->dev,"sendbytes: error - bailout.\n" );i2c_stop (adap);return (retval<0 )? retval : -EFAULT ;/* got a better one ?? */
@@ -527,13 +527,12 @@struct i2c_algo_bit_data *bit_adap = adap->algo_data;if (bit_test) { -int ret =test_bus (bit_adap, adap->name); +int ret =test_bus (bit_adap, adap->dev.name);if (ret<0 )return -ENODEV ; } -DEB2 (printk (KERN_DEBUG "i2c-algo-bit.o: hw routines for %s registered.\n" , - adap->name)); +DEB2 (dev_dbg (&adap->dev,"hw routines registered.\n" ));/* register new adapter to i2c module... */
drivers/i2c/i2c-algo-pcf.c +9 -10
@@ -27,6 +27,8 @@messages, proper stop/repstart signaling during receive, added detect code */ +/* #define DEBUG 1 */ /* to pick up dev_dbg calls */ +#include <linux/kernel.h> #include <linux/module.h> #include <linux/delay.h>
@@ -222,21 +224,19 @@int wrcount, status, timeout;for (wrcount=0 ; wrcount<count; ++wrcount) { -DEB2 (printk (KERN_DEBUG "i2c-algo-pcf.o: %s i2c_write: writing %2.2X\n" , - i2c_adap->name, buf[wrcount]&0xff )); +DEB2 (dev_dbg (&i2c_adap->dev,"i2c_write: writing %2.2X\n" , + buf[wrcount]&0xff ));i2c_outb (adap, buf[wrcount]); timeout =wait_for_pin (adap, &status);if (timeout) {i2c_stop (adap); -printk (KERN_ERR "i2c-algo-pcf.o: %s i2c_write: " -"error - timeout.\n" , i2c_adap->name); +dev_err (&i2c_adap->dev,"i2c_write: error - timeout.\n" );return -EREMOTEIO ;/* got a better one ?? */ }#ifndef STUB_I2C if (status &I2C_PCF_LRB ) {i2c_stop (adap); -printk (KERN_ERR "i2c-algo-pcf.o: %s i2c_write: " -"error - no ack.\n" , i2c_adap->name); +dev_err (&i2c_adap->dev,"i2c_write: error - no ack.\n" );return -EREMOTEIO ;/* got a better one ?? */ }#endif
@@ -263,14 +263,14 @@if (wait_for_pin (adap, &status)) {i2c_stop (adap); -printk (KERN_ERR "i2c-algo-pcf.o: pcf_readbytes timed out.\n" ); +dev_err (&i2c_adap->dev,"pcf_readbytes timed out.\n" );return (-1 ); }#ifndef STUB_I2C if ((status &I2C_PCF_LRB ) && (i != count)) {i2c_stop (adap); -printk (KERN_ERR "i2c-algo-pcf.o: i2c_read: i2c_inb, No ack.\n" ); +dev_err (&i2c_adap->dev,"i2c_read: i2c_inb, No ack.\n" );return (-1 ); }#endif
@@ -445,8 +445,7 @@struct i2c_algo_pcf_data *pcf_adap = adap->algo_data;int rval; -DEB2 (printk (KERN_DEBUG "i2c-algo-pcf.o: hw routines for %s registered.\n" , - adap->name)); +DEB2 (dev_dbg (&adap->dev,"hw routines registered.\n" ));/* register new adapter to i2c module... */
drivers/i2c/i2c-core.c +31 -42
188 lines not on this page · raw message
drivers/i2c/i2c-dev.c +7 -10
@@ -30,6 +30,9 @@/* $Id: i2c-dev.c,v 1.53 2003/01/21 08:08:16 kmalkki Exp $ */ +/* If you want debugging uncomment: */ +/* #define DEBUG 1 */ +#include <linux/kernel.h> #include <linux/module.h> #include <linux/fs.h>
@@ -41,10 +44,6 @@#include <linux/i2c-dev.h> #include <asm/uaccess.h> -/* If you want debugging uncomment: */ -/* #define DEBUG */ - -/* struct file_operations changed too often in the 2.1 series for nice code */ static ssize_t i2cdev_read (struct file *file, char *buf, size_t count,
@@ -386,11 +385,11 @@char name[12 ];if ((i =i2c_adapter_id (adap)) <0 ) { -printk (KERN_DEBUG "i2c-dev.o: Unknown adapter ?!?\n" ); +dev_dbg (&adap->dev,"Unknown adapter ?!?\n" );return -ENODEV ; }if (i >=I2CDEV_ADAPS_MAX ) { -printk (KERN_DEBUG "i2c-dev.o: Adapter number too large?!? (%d)\n" ,i); +dev_dbg (&adap->dev,"Adapter number too large?!? (%d)\n" ,i);return -ENODEV ; }
@@ -401,14 +400,12 @@DEVFS_FL_DEFAULT ,I2C_MAJOR , i,S_IFCHR |S_IRUSR |S_IWUSR , &i2cdev_fops, NULL); -printk (KERN_DEBUG "i2c-dev.o: Registered '%s' as minor %d\n" ,adap->name,i); +dev_dbg (&adap->dev,"Registered as minor %d\n" , i); }else {/* This is actually a detach_adapter call! */ devfs_remove ("i2c/%d" , i); i2cdev_adaps[i] =NULL ; -#ifdef DEBUG -printk (KERN_DEBUG "i2c-dev.o: Adapter unregistered: %s\n" ,adap->name); -#endif +dev_dbg (&adap->dev,"Adapter unregistered\n" ); }return 0 ;
drivers/i2c/i2c-elektor.c +6 -4
@@ -174,10 +174,12 @@ };static struct i2c_adapter pcf_isa_ops = { - .owner =THIS_MODULE , - .name ="PCF8584 ISA adapter" , - .id =I2C_HW_P_ELEK , - .algo_data = &pcf_isa_data, + .owner =THIS_MODULE , + .id =I2C_HW_P_ELEK , + .algo_data = &pcf_isa_data, + .dev = { + .name ="PCF8584 ISA adapter" , + }, };static int __init i2c_pcfisa_init (void )
drivers/i2c/i2c-elv.c +3 -1
@@ -129,9 +129,11 @@static struct i2c_adapter bit_elv_ops = { .owner =THIS_MODULE , - .name ="ELV Parallel port adaptor" , .id =I2C_HW_B_ELV , .algo_data = &bit_elv_data, + .dev = { + .name ="ELV Parallel port adaptor" , + }, };static int __init i2c_bitelv_init (void )
drivers/i2c/i2c-philips-par.c +3 -1
@@ -151,8 +151,10 @@static struct i2c_adapter bit_lp_ops = { .owner =THIS_MODULE , - .name ="Philips Parallel port adapter" , .id =I2C_HW_B_LP , + .dev = { + .name ="Philips Parallel port adapter" , + }, };static void i2c_parport_attach (struct parport *port)
drivers/i2c/i2c-velleman.c +3 -1
@@ -114,9 +114,11 @@static struct i2c_adapter bit_velle_ops = { .owner =THIS_MODULE , - .name ="Velleman K8000" , .id =I2C_HW_B_VELLE , .algo_data = &bit_velle_data, + .dev = { + .name ="Velleman K8000" , + }, };static int __init i2c_bitvelle_init (void )
drivers/i2c/scx200_acb.c +13 -15
@@ -140,8 +140,7 @@switch (iface->state) {case state_idle: - printk(KERN_WARNING NAME ": %s, interrupt in idle state\n", - iface->adapter.name); + dev_warn(&iface->adapter.dev, "interrupt in idle state\n",);break ;case state_address:
@@ -226,8 +225,8 @@return ; error: - printk(KERN_ERR NAME ": %s, %s in state %s\n", iface->adapter.name, - errmsg, scx200_acb_state_name[iface->state]); +dev_err (&iface->adapter.dev,"%s in state %s\n" , errmsg, + scx200_acb_state_name[iface->state]); iface->state = state_idle; iface->result = -EIO ;
@@ -236,8 +235,8 @@static void scx200_acb_timeout (struct scx200_acb_iface *iface) { - printk(KERN_ERR NAME ": %s, timeout in state %s\n", - iface->adapter.name, scx200_acb_state_name[iface->state]); +dev_err (&iface->adapter.dev,"timeout in state %s\n" , + scx200_acb_state_name[iface->state]); iface->state = state_idle; iface->result = -EIO ;
@@ -331,13 +330,12 @@ size, address, command, len, rw == I2C_SMBUS_READ);if (!len && rw ==I2C_SMBUS_READ ) { - printk(KERN_WARNING NAME ": %s, zero length read\n", - adapter->name); +dev_warn (&adapter->dev,"zero length read\n" );return -EINVAL ; }if (len && !buffer) { - printk(KERN_WARNING NAME ": %s, nonzero length but no buffer\n", adapter->name); +dev_warn (&adapter->dev,"nonzero length but no buffer\n" );return -EFAULT ; }
@@ -458,17 +456,17 @@memset (iface,0 ,sizeof (*iface)); adapter = &iface->adapter; adapter->data = iface; -sprintf (adapter->name,"SCx200 ACB%d" , index); +snprintf (adapter->dev.name,DEVICE_NAME_SIZE ,"SCx200 ACB%d" , index); adapter->owner =THIS_MODULE ; adapter->id =I2C_ALGO_SMBUS ; adapter->algo = &scx200_acb_algorithm;init_MUTEX (&iface->sem); -sprintf (description,"NatSemi SCx200 ACCESS.bus [%s]" , adapter->name); +snprintf (description,sizeof (description),"NatSemi SCx200 ACCESS.bus [%s]" , adapter->dev.name);if (request_region (base,8 , description) ==0 ) { - printk(KERN_ERR NAME ": %s, can't allocate io 0x%x-0x%x\n", - adapter->name, base, base + 8-1); +dev_err (&adapter->dev,"can't allocate io 0x%x-0x%x\n" , + base, base +8 -1 ); rc = -EBUSY ; goto errout; }
@@ -476,14 +474,14 @@ rc =scx200_acb_probe (iface);if (rc) { - printk(KERN_WARNING NAME ": %s, probe failed\n", adapter->name); +dev_warn (&adapter->dev,"probe failed\n" ); goto errout; }scx200_acb_reset (iface);if (i2c_add_adapter (adapter) <0 ) { - printk(KERN_ERR NAME ": %s, failed to register\n", adapter->name); +dev_err (&adapter->dev,"failed to register\n" ); rc = -ENODEV ; goto errout; }
include/linux/i2c.h +0 -1
@@ -210,7 +210,6 @@*/ struct i2c_adapter {struct module *owner; -char name[32 ];/* some useful name to identify the adapter */ unsigned int id;/* == is algo->id | hwdep.struct->id, */ /* for registered values see below */ struct i2c_algorithm *algo;/* the algorithm to access the bus */
ChangeSet 1.1190, 2003/03/21 14:38:21-08:00, [email protected]
[PATCH] i2c: remove *data from i2c_adapter, as dev->data should be used instead.
drivers/i2c/i2c-elv.c | 2 +- drivers/i2c/scx200_acb.c | 4 ++-- include/linux/i2c.h | 17 +++++++++++------ 3 files changed, 14 insertions(+), 9 deletions(-)
drivers/i2c/i2c-elv.c +1 -1
@@ -150,7 +150,7 @@return -ENODEV ; } }else { - bit_elv_ops.data=(void *)base; +i2c_set_adapdata (&bit_elv_ops, (void *)base);if (bit_elv_init ()==0 ) {if (i2c_bit_add_bus (&bit_elv_ops) <0 )return -ENODEV ;
drivers/i2c/scx200_acb.c +2 -2
@@ -289,7 +289,7 @@ char rw, u8 command, int size, union i2c_smbus_data *data) { - struct scx200_acb_iface *iface = adapter->data; + struct scx200_acb_iface *iface = i2c_get_adapdata(adapter);int len;u8 *buffer;u16 cur_word;
@@ -455,7 +455,7 @@memset (iface,0 ,sizeof (*iface)); adapter = &iface->adapter; - adapter->data = iface; +i2c_set_adapdata (adapter, iface);snprintf (adapter->dev.name,DEVICE_NAME_SIZE ,"SCx200 ACB%d" , index); adapter->owner =THIS_MODULE ; adapter->id =I2C_ALGO_SMBUS ;
include/linux/i2c.h +11 -6
@@ -219,12 +219,7 @@int (*client_register)(struct i2c_client *);int (*client_unregister)(struct i2c_client *); -void *data;/* private data for the adapter */ -/* some data fields that are used by all types */ -/* these data fields are readonly to the public */ -/* and can be set via the i2c_ioctl call */ - -/* data fields that are valid for all devices */ +/* data fields that are valid for all devices */ struct semaphore bus;struct semaphore list;unsigned int flags;/* flags specifying div. data */
@@ -241,6 +236,16 @@#endif /* def CONFIG_PROC_FS */ };#define to_i2c_adapter (d) container_of(d, struct i2c_adapter, dev) + +static inline void *i2c_get_adapdata (struct i2c_adapter *dev) +{ +return dev_get_drvdata (&dev->dev); +} + +static inline void i2c_set_adapdata (struct i2c_adapter *dev,void *data) +{ +return dev_set_drvdata (&dev->dev, data); +}/*flags for the driver struct: */ #define I2C_DF_NOTIFY 0x01/* notify on bus (de/a)ttaches */
ChangeSet 1.1191, 2003/03/21 16:00:39-08:00, [email protected]
i2c: add struct device to i2c_client structure
Not quite ready to hook it up to the driver core yet.
include/linux/i2c.h | 3 ++- 1 files changed, 2 insertions(+), 1 deletion(-)
include/linux/i2c.h +2 -1
@@ -170,8 +170,9 @@void *data;/* for the clients */ int usage_count;/* How many accesses currently */ /* to the client */ +struct device dev;/* the device structure */ }; - +#define to_i2c_client (d) container_of(d, struct i2c_client, dev)/* * The following structs are for those who like to implement new bus drivers:
ChangeSet 1.1192, 2003/03/21 16:07:30-08:00, [email protected]
[PATCH] i2c: remove the data field from struct i2c_client
It's no longer needed, as the struct device should be used instead.
Created i2c_get_clientdata() and i2c_set_clientdata() to access the data.
drivers/i2c/chips/adm1021.c | 15 +++++++-------- drivers/i2c/chips/lm75.c | 8 ++++---- include/linux/i2c.h | 11 ++++++++++- 3 files changed, 21 insertions(+), 13 deletions(-)
drivers/i2c/chips/adm1021.c +7 -8
@@ -223,8 +223,8 @@ } data = (struct adm1021_data *) (new_client +1 ); +i2c_set_clientdata (new_client, data); new_client->addr = address; - new_client->data = data; new_client->adapter = adapter; new_client->driver = &adm1021_driver; new_client->flags =0 ;
@@ -354,8 +354,7 @@int err; -i2c_deregister_entry (((struct adm1021_data *) (client->data))-> - sysctl_id); +i2c_deregister_entry (((struct adm1021_data *) (i2c_get_clientdata (client)))->sysctl_id);if ((err =i2c_detach_client (client))) { printk
@@ -384,7 +383,7 @@static void adm1021_update_client (struct i2c_client *client) { -struct adm1021_data *data = client->data; +struct adm1021_data *data =i2c_get_clientdata (client);down (&data->update_lock);
@@ -435,7 +434,7 @@static void adm1021_temp (struct i2c_client *client,int operation,int ctl_name,int *nrels_mag,long *results) { -struct adm1021_data *data = client->data; +struct adm1021_data *data =i2c_get_clientdata (client);if (operation ==SENSORS_PROC_REAL_INFO ) *nrels_mag =0 ;
@@ -462,7 +461,7 @@static void adm1021_remote_temp (struct i2c_client *client,int operation,int ctl_name,int *nrels_mag,long *results) { -struct adm1021_data *data = client->data; +struct adm1021_data *data =i2c_get_clientdata (client);int prec =0 ;if (operation ==SENSORS_PROC_REAL_INFO )
@@ -535,7 +534,7 @@static void adm1021_die_code (struct i2c_client *client,int operation,int ctl_name,int *nrels_mag,long *results) { -struct adm1021_data *data = client->data; +struct adm1021_data *data =i2c_get_clientdata (client);if (operation ==SENSORS_PROC_REAL_INFO ) *nrels_mag =0 ;
@@ -551,7 +550,7 @@static void adm1021_alarms (struct i2c_client *client,int operation,int ctl_name,int *nrels_mag,long *results) { -struct adm1021_data *data = client->data; +struct adm1021_data *data =i2c_get_clientdata (client);if (operation ==SENSORS_PROC_REAL_INFO ) *nrels_mag =0 ;else if (operation ==SENSORS_PROC_REAL_READ ) {
drivers/i2c/chips/lm75.c +4 -4
@@ -142,8 +142,8 @@ } data = (struct lm75_data *) (new_client +1 ); +i2c_set_clientdata (new_client, data); new_client->addr = address; - new_client->data = data; new_client->adapter = adapter; new_client->driver = &lm75_driver; new_client->flags =0 ;
@@ -215,7 +215,7 @@static int lm75_detach_client (struct i2c_client *client) { -struct lm75_data *data = client->data; +struct lm75_data *data =i2c_get_clientdata (client);i2c_deregister_entry (data->sysctl_id);i2c_detach_client (client);
@@ -263,7 +263,7 @@static void lm75_update_client (struct i2c_client *client) { -struct lm75_data *data = client->data; +struct lm75_data *data =i2c_get_clientdata (client);down (&data->update_lock);
@@ -286,7 +286,7 @@static void lm75_temp (struct i2c_client *client,int operation,int ctl_name,int *nrels_mag,long *results) { -struct lm75_data *data = client->data; +struct lm75_data *data =i2c_get_clientdata (client);if (operation ==SENSORS_PROC_REAL_INFO ) *nrels_mag =1 ;else if (operation ==SENSORS_PROC_REAL_READ ) {
include/linux/i2c.h +10 -1
@@ -167,12 +167,21 @@alignment considerations */ struct i2c_adapter *adapter;/* the adapter we sit on */ struct i2c_driver *driver;/* and our access routines */ -void *data;/* for the clients */ int usage_count;/* How many accesses currently */ /* to the client */ struct device dev;/* the device structure */ };#define to_i2c_client (d) container_of(d, struct i2c_client, dev) + +static inline void *i2c_get_clientdata (struct i2c_client *dev) +{ +return dev_get_drvdata (&dev->dev); +} + +static inline void i2c_set_clientdata (struct i2c_client *dev,void *data) +{ +return dev_set_drvdata (&dev->dev, data); +}/* * The following structs are for those who like to implement new bus drivers:
ChangeSet 1.1193, 2003/03/21 16:16:01-08:00, [email protected]
i2c: Removed the name variable from i2c_client as the dev one should be used instead.
drivers/i2c/chips/adm1021.c | 2 +- drivers/i2c/chips/lm75.c | 2 +- drivers/i2c/i2c-core.c | 14 +++++++------- drivers/i2c/i2c-dev.c | 4 +++- include/linux/i2c.h | 1 - 5 files changed, 12 insertions(+), 11 deletions(-)
drivers/i2c/chips/adm1021.c +1 -1
@@ -299,7 +299,7 @@ }/* Fill in the remaining client fields and put it into the global list */ -strcpy (new_client->name, client_name); +strncpy (new_client->dev.name, client_name,DEVICE_NAME_SIZE ); data->type = kind; new_client->id = adm1021_id++;
drivers/i2c/chips/lm75.c +1 -1
@@ -180,7 +180,7 @@ }/* Fill in the remaining client fields and put it into the global list */ -strcpy (new_client->name, client_name); +strncpy (new_client->dev.name, client_name,DEVICE_NAME_SIZE ); new_client->id = lm75_id++; data->valid =0 ;
drivers/i2c/i2c-core.c +7 -7
@@ -291,9 +291,9 @@ client->driver == driver) {DEB2 (printk (KERN_DEBUG "i2c-core.o: " "detaching client %s:\n" , - client->name)); + client->dev.name));if ((res = driver->detach_client (client))) { -dev_err (&adap->dev,"while " +dev_err (&adap->dev,"while " "unregistering driver " "`%s', the client at " "address %02x of "
@@ -355,7 +355,7 @@printk (KERN_WARNING " i2c-core.o: attach_client(%s) - enlarge I2C_CLIENT_MAX.\n" , - client->name); + client->dev.name); out_unlock_list:up (&adapter->list);
@@ -374,7 +374,7 @@ }DEB (dev_dbg (&adapter->dev,"client [%s] registered to adapter " -"(pos. %d).\n" , client->name, i)); +"(pos. %d).\n" , client->dev.name, i));if (client->flags &I2C_CLIENT_ALLOW_USE ) client->usage_count =0 ;
@@ -395,7 +395,7 @@if (res) {printk (KERN_ERR "i2c-core.o: client_unregister [%s] failed, " -"client not detached" , client->name); +"client not detached" , client->dev.name); goto out; } }
@@ -410,7 +410,7 @@printk (KERN_WARNING " i2c-core.o: unregister_client [%s] not found\n" , - client->name); + client->dev.name); res = -ENODEV ; out_unlock:
@@ -522,7 +522,7 @@ client = adapters[i]->clients[order[j]]; len +=sprintf (kbuf+len,"%02x\t%-32s\t%-32s\n" , client->addr, - client->name, + client->dev.name, client->driver->name); } len = len - file->f_pos;
drivers/i2c/i2c-dev.c +3 -1
@@ -86,7 +86,9 @@ };static struct i2c_client i2cdev_client_template = { - .name ="I2C /dev entry" , + .dev = { + .name ="I2C /dev entry" , + }, .id =1 , .addr =-1 , .driver = &i2cdev_driver,
include/linux/i2c.h +0 -1
@@ -156,7 +156,6 @@* function is mainly used for lookup & other admin. functions. */ struct i2c_client { -char name[32 ];int id;unsigned int flags;/* div., see below */ unsigned int addr;/* chip address - NOTE: 7bit */
ChangeSet 1.1194, 2003/03/21 16:26:04-08:00, [email protected]
i2c: actually register the i2c client device with the driver core.
We have to initialize the client structure with 0 to keep the driver core from oopsing.
Now everything is hooked up enough to start removing the i2c sysctl and proc crud.
drivers/i2c/chips/adm1021.c | 2 ++ drivers/i2c/chips/lm75.c | 2 ++ drivers/i2c/i2c-core.c | 10 ++++++++++ 3 files changed, 14 insertions(+)
drivers/i2c/chips/adm1021.c +2 -0
@@ -221,6 +221,8 @@ err = -ENOMEM ; goto error0; } +memset (new_client,0x00 ,sizeof (struct i2c_client ) + +sizeof (struct adm1021_data )); data = (struct adm1021_data *) (new_client +1 );i2c_set_clientdata (new_client, data);
drivers/i2c/chips/lm75.c +2 -0
@@ -140,6 +140,8 @@ err = -ENOMEM ; goto error0; } +memset (new_client,0x00 ,sizeof (struct i2c_client ) + +sizeof (struct lm75_data )); data = (struct lm75_data *) (new_client +1 );i2c_set_clientdata (new_client, data);
drivers/i2c/i2c-core.c +10 -0
@@ -378,6 +378,15 @@if (client->flags &I2C_CLIENT_ALLOW_USE ) client->usage_count =0 ; + + client->dev.parent = &client->adapter->dev; + client->dev.driver = &client->driver->driver; + client->dev.bus = &i2c_bus_type; + +snprintf (&client->dev.bus_id[0 ],sizeof (client->dev.bus_id),"i2c_dev_%d" , i); +printk ("registering %s\n" , client->dev.bus_id); +device_register (&client->dev); +return 0 ; }
@@ -414,6 +423,7 @@ res = -ENODEV ; out_unlock: +device_unregister (&client->dev);up (&adapter->list); out:return res;
ChangeSet 1.1195, 2003/03/21 16:39:04-08:00, [email protected]
[PATCH] i2c: fix up the chip driver names to play nice with sysfs
drivers/i2c/chips/adm1021.c | 2 +- drivers/i2c/chips/lm75.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/i2c/chips/adm1021.c +1 -1
@@ -144,7 +144,7 @@/* This is the driver that will be inserted */ static struct i2c_driver adm1021_driver = { .owner =THIS_MODULE , - .name ="ADM1021, MAX1617 sensor driver" , + .name ="ADM1021-MAX1617" , .id =I2C_DRIVERID_ADM1021 , .flags =I2C_DF_NOTIFY , .attach_adapter = adm1021_attach_adapter,
drivers/i2c/chips/lm75.c +1 -1
@@ -82,7 +82,7 @@/* This is the driver that will be inserted */ static struct i2c_driver lm75_driver = { .owner =THIS_MODULE , - .name ="LM75 sensor chip driver" , + .name ="LM75 sensor" , .id =I2C_DRIVERID_LM75 , .flags =I2C_DF_NOTIFY , .attach_adapter = lm75_attach_adapter,
ChangeSet 1.1196, 2003/03/21 16:45:59-08:00, [email protected]
i2c: ugh, clean up lindent mess in i2c-proc.c::i2c_detect()
Yes, this function now goes beyond 80 columns, but it's almost readable, while the previous version was not.
Also removed some #ifdefs
drivers/i2c/i2c-proc.c | 180 ++++++++++++------------------------------------- 1 files changed, 47 insertions(+), 133 deletions(-)
drivers/i2c/i2c-proc.c +47 -133
@@ -23,6 +23,8 @@This driver puts entries in /proc/sys/dev/sensors for each I2C device */ +/* #define DEBUG 1 */ +#include <linux/module.h> #include <linux/kernel.h> #include <linux/slab.h>
@@ -581,9 +583,9 @@ is_isa ?SENSORS_ISA_BUS :i2c_adapter_id (adapter);/* Forget it if we can't probe using SMBUS_QUICK */ -if ((!is_isa) - && !i2c_check_functionality (adapter, -I2C_FUNC_SMBUS_QUICK ))return -1 ; +if ((!is_isa) && + !i2c_check_functionality (adapter,I2C_FUNC_SMBUS_QUICK )) +return -1 ;for (addr =0x00 ; addr <= (is_isa ?0xffff :0x7f ); addr++) {/* XXX: WTF is going on here??? */
@@ -594,31 +596,14 @@/* If it is in one of the force entries, we don't do any detection at all */ found =0 ; -for (i =0 ; - !found - && (this_force = - address_data->forces + i, this_force->force); i++) { -for (j =0 ; - !found - && (this_force->force[j] !=SENSORS_I2C_END ); - j +=2 ) { -if ( - ((adapter_id == this_force->force[j]) - || - ((this_force-> - force[j] ==SENSORS_ANY_I2C_BUS ) - && !is_isa)) - && (addr == this_force->force[j +1 ])) { -#ifdef DEBUG -printk - (KERN_DEBUG "i2c-proc.o: found force parameter for adapter %d, addr %04x\n" , - adapter_id, addr); -#endif -if ( - (err = -found_proc (adapter, addr,0 , - this_force-> - kind)))return err; +for (i =0 ; !found && (this_force = address_data->forces + i, this_force->force); i++) { +for (j =0 ; !found && (this_force->force[j] !=SENSORS_I2C_END ); j +=2 ) { +if ( ((adapter_id == this_force->force[j]) || + ((this_force->force[j] ==SENSORS_ANY_I2C_BUS ) && !is_isa)) && + (addr == this_force->force[j +1 ]) ) { +dev_dbg (&adapter->dev,"found force parameter for adapter %d, addr %04x\n" , adapter_id, addr); +if ((err =found_proc (adapter, addr,0 , this_force->kind))) +return err; found =1 ; } }
@@ -628,42 +613,22 @@/* If this address is in one of the ignores, we can forget about it right now */ -for (i =0 ; - !found - && (address_data->ignore[i] !=SENSORS_I2C_END ); - i +=2 ) { -if ( - ((adapter_id == address_data->ignore[i]) - || - ((address_data-> - ignore[i] ==SENSORS_ANY_I2C_BUS ) - && !is_isa)) - && (addr == address_data->ignore[i +1 ])) { -#ifdef DEBUG -printk - (KERN_DEBUG "i2c-proc.o: found ignore parameter for adapter %d, " -"addr %04x\n" , adapter_id, addr); -#endif +for (i =0 ; !found && (address_data->ignore[i] !=SENSORS_I2C_END ); i +=2 ) { +if ( ((adapter_id == address_data->ignore[i]) || + ((address_data->ignore[i] ==SENSORS_ANY_I2C_BUS ) && + !is_isa)) && + (addr == address_data->ignore[i +1 ])) { +dev_dbg (&adapter->dev,"found ignore parameter for adapter %d, addr %04x\n" , adapter_id, addr); found =1 ; } } -for (i =0 ; - !found - && (address_data->ignore_range[i] !=SENSORS_I2C_END ); - i +=3 ) { -if ( - ((adapter_id == address_data->ignore_range[i]) - || - ((address_data-> - ignore_range[i] == -SENSORS_ANY_I2C_BUS ) & !is_isa)) - && (addr >= address_data->ignore_range[i +1 ]) - && (addr <= address_data->ignore_range[i +2 ])) { -#ifdef DEBUG -printk - (KERN_DEBUG "i2c-proc.o: found ignore_range parameter for adapter %d, " -"addr %04x\n" , adapter_id, addr); -#endif +for (i =0 ; !found && (address_data->ignore_range[i] !=SENSORS_I2C_END ); i +=3 ) { +if ( ((adapter_id == address_data->ignore_range[i]) || + ((address_data-> ignore_range[i] ==SENSORS_ANY_I2C_BUS ) & + !is_isa)) && + (addr >= address_data->ignore_range[i +1 ]) && + (addr <= address_data->ignore_range[i +2 ])) { +dev_dbg (&adapter->dev,"found ignore_range parameter for adapter %d, addr %04x\n" , adapter_id, addr); found =1 ; } }
@@ -673,68 +638,31 @@/* Now, we will do a detection, but only if it is in the normal or probe entries */ if (is_isa) { -for (i =0 ; - !found - && (address_data->normal_isa[i] != -SENSORS_ISA_END ); i +=1 ) { +for (i =0 ; !found && (address_data->normal_isa[i] !=SENSORS_ISA_END ); i +=1 ) {if (addr == address_data->normal_isa[i]) { -#ifdef DEBUG -printk - (KERN_DEBUG "i2c-proc.o: found normal isa entry for adapter %d, " -"addr %04x\n" , adapter_id, - addr); -#endif +dev_dbg (&adapter->dev,"found normal isa entry for adapter %d, addr %04x\n" , adapter_id, addr); found =1 ; } } -for (i =0 ; - !found - && (address_data->normal_isa_range[i] != -SENSORS_ISA_END ); i +=3 ) { -if ((addr >= - address_data->normal_isa_range[i]) - && (addr <= - address_data->normal_isa_range[i +1 ]) - && - ((addr - - address_data->normal_isa_range[i]) % - address_data->normal_isa_range[i +2 ] == -0 )) { -#ifdef DEBUG -printk - (KERN_DEBUG "i2c-proc.o: found normal isa_range entry for adapter %d, " -"addr %04x" , adapter_id, addr); -#endif +for (i =0 ; !found && (address_data->normal_isa_range[i] !=SENSORS_ISA_END ); i +=3 ) { +if ((addr >= address_data->normal_isa_range[i]) && + (addr <= address_data->normal_isa_range[i +1 ]) && + ((addr - address_data->normal_isa_range[i]) % address_data->normal_isa_range[i +2 ] ==0 )) { +dev_dbg (&adapter->dev,"found normal isa_range entry for adapter %d, addr %04x" , adapter_id, addr); found =1 ; } } }else { -for (i =0 ; - !found && (address_data->normal_i2c[i] != -SENSORS_I2C_END ); i +=1 ) { +for (i =0 ; !found && (address_data->normal_i2c[i] !=SENSORS_I2C_END ); i +=1 ) {if (addr == address_data->normal_i2c[i]) { found =1 ; -#ifdef DEBUG -printk - (KERN_DEBUG "i2c-proc.o: found normal i2c entry for adapter %d, " -"addr %02x" , adapter_id, addr); -#endif +dev_dbg (&adapter->dev,"found normal i2c entry for adapter %d, addr %02x" , adapter_id, addr); } } -for (i =0 ; - !found - && (address_data->normal_i2c_range[i] != -SENSORS_I2C_END ); i +=2 ) { -if ((addr >= - address_data->normal_i2c_range[i]) - && (addr <= - address_data->normal_i2c_range[i +1 ])) - { -#ifdef DEBUG -printk - (KERN_DEBUG "i2c-proc.o: found normal i2c_range entry for adapter %d, " -"addr %04x\n" , adapter_id, addr); -#endif +for (i =0 ; !found && (address_data->normal_i2c_range[i] !=SENSORS_I2C_END ); i +=2 ) { +if ((addr >= address_data->normal_i2c_range[i]) && + (addr <= address_data->normal_i2c_range[i +1 ])) { +dev_dbg (&adapter->dev,"found normal i2c_range entry for adapter %d, addr %04x\n" , adapter_id, addr); found =1 ; } }
@@ -747,30 +675,17 @@ ((address_data-> probe[i] == SENSORS_ANY_I2C_BUS) & !is_isa)) && (addr == address_data->probe[i + 1])) { -#ifdef DEBUG -printk - (KERN_DEBUG "i2c-proc.o: found probe parameter for adapter %d, " -"addr %04x\n" , adapter_id, addr); -#endif +dev_dbg (&adapter->dev,"found probe parameter for adapter %d, addr %04x\n" , adapter_id, addr); found =1 ; } } -for (i =0 ; !found && - (address_data->probe_range[i] !=SENSORS_I2C_END ); - i +=3 ) { -if ( - ((adapter_id == address_data->probe_range[i]) - || - ((address_data->probe_range[i] == -SENSORS_ANY_I2C_BUS ) & !is_isa)) - && (addr >= address_data->probe_range[i +1 ]) - && (addr <= address_data->probe_range[i +2 ])) { +for (i =0 ; !found && (address_data->probe_range[i] !=SENSORS_I2C_END ); i +=3 ) { +if ( ((adapter_id == address_data->probe_range[i]) || + ((address_data->probe_range[i] ==SENSORS_ANY_I2C_BUS ) & !is_isa)) && + (addr >= address_data->probe_range[i +1 ]) && + (addr <= address_data->probe_range[i +2 ])) { found =1 ; -#ifdef DEBUG -printk - (KERN_DEBUG "i2c-proc.o: found probe_range parameter for adapter %d, " -"addr %04x\n" , adapter_id, addr); -#endif +dev_dbg (&adapter->dev,"found probe_range parameter for adapter %d, addr %04x\n" , adapter_id, addr); } }if (!found)
@@ -779,8 +694,7 @@/* OK, so we really should examine this address. First check whether there is some client here at all! */ if (is_isa || - (i2c_smbus_xfer - (adapter, addr,0 ,0 ,0 ,I2C_SMBUS_QUICK ,NULL ) >=0 )) + (i2c_smbus_xfer (adapter, addr,0 ,0 ,0 ,I2C_SMBUS_QUICK ,NULL ) >=0 ))if ((err =found_proc (adapter, addr,0 ,-1 )))return err; }
Hi!
drivers/i2c/chips/adm1021.c line 147
Quoted 1 line
drivers/i2c/chips/adm1021.c +1
-0+ .name = "ADM1021-MAX1617",
Why dash here
drivers/i2c/chips/lm75.c line 85
Quoted 1 line
drivers/i2c/chips/lm75.c +1
-0+ .name = "LM75 sensor",
And space here? Also you should have
either 2x "sensor" or none at all.
Signature · 2 lines
Pavel Written on sharp zaurus, because my Velo1 broke. If you have Velo you don't need...
Quoted 10 lines · Pavel Machek
Hi!
drivers/i2c/chips/adm1021.c line 147
Quoted 1 line
drivers/i2c/chips/adm1021.c +1
-0+ .name = "ADM1021-MAX1617",Why dash here
drivers/i2c/chips/lm75.c line 85
Quoted 1 line
drivers/i2c/chips/lm75.c +1
-0+ .name = "LM75 sensor",And space here? Also you should have
either 2x "sensor" or none at all.
What do you mwan "2x"? I just shortened that name up to fit within the 16 characters that we are allowed for driver names. If you can come up with some better ones, please let me know.
thanks,
greg k-h
Quoted 6 lines · Greg KH
Quoted 5 lines
drivers/i2c/chips/adm1021.c line 147
Quoted 1 line
drivers/i2c/chips/adm1021.c +1
-0+ .name = "ADM1021-MAX1617",Why dash here
drivers/i2c/chips/lm75.c line 85
Quoted 1 line
drivers/i2c/chips/lm75.c +1
-0+ .name = "LM75 sensor",And space here? Also you should have
either 2x "sensor" or none at all.What do you mwan "2x"?
The way I parsed it, either have..
.name = "ADM1021-MAX1617 sensor",
.name = "LM75 sensor",
or
.name = "ADM1021-MAX1617",
.name = "LM75",
ie, both, or all. Personally the latter looks better to me. Especially given the 16 char limit. Aren't these going to be in a sysfs heirarchy where its obvious they are sensors anyway ? like i2c/sensors/lm75 ?
Dave
Quoted 13 lines · Dave Jones
Quoted 6 lines · Greg KH
Quoted 5 lines
drivers/i2c/chips/adm1021.c line 147
Quoted 1 line
drivers/i2c/chips/adm1021.c +1
-0+ .name = "ADM1021-MAX1617",Why dash here
drivers/i2c/chips/lm75.c line 85
Quoted 1 line
drivers/i2c/chips/lm75.c +1
-0+ .name = "LM75 sensor",And space here? Also you should have
either 2x "sensor" or none at all.What do you mwan "2x"?
The way I parsed it, either have..
.name = "ADM1021-MAX1617 sensor",
.name = "LM75 sensor",
Quoted 6 lines
or
.name = "ADM1021-MAX1617",
.name = "LM75",ie, both, or all. Personally the latter looks better to me.
Ah, yes, that makes more sense now.
Yes, we shouldn't have the "sensor" in the name.
Quoted 3 lines
Especially given the 16 char limit. Aren't these going to be in a sysfs heirarchy where its obvious they are sensors anyway ? like i2c/sensors/lm75 ?
Yes, they show up as bus/i2c/drivers/
thanks,
greg k-h
PATCH 1/1 More i2c driver changes for 2.5.66
In reply to Greg KHQuoted 1 line · Albert Cranford
Linux kenel mail list removed on purpose.
Why?
Quoted 2 lines
Whoa! I just saw the patches submitted to linux kernel and not to sensors list. Come on Greg this is not proper.
All of these patches, with the lone exception of the renaming i2c-proc.c to i2c-sensor.c and the removal of the unused proc functions were posted to both the sensors and linux kernel mailing lists in the past. I and others said that it would be good to rename the file, as it doesn't make any sense anymore.
And I just posted a question asking if that lone function that is now in i2c-sensors.c is even needed anymore.
Or do you mean that this series of patches specifically were not sent to the sensors list? They were, it looks like the sensors list dropped them for somereason. Look at the email header of the messages on lkml for proof of that.
Quoted 1 line
Whats this config item
CONFIG_SENSOR?
It's CONFIG_I2C_SENSOR which replaces I2C_PROC. It's used to determine if we need to build i2c-sensor.o or not.
Quoted 1 line
This is the wrong way to register sensors to sysfs.
Why? What did I do different that was wrong, or not previously posted to this list?
Quoted 2 lines
New sensors can never be tested before included in the kernel with this philosophy.
Yes they can, just like I tested, and others are currently testing. I am getting patches for this conversion :)
Quoted 3 lines
Whats wrong with the opposite philosophy of creating a sysfs interface and in the sensor driver just make the sysfs call?
The callbacks do not match up at all from the "old" proc file interface with the sysfs interface. And we moved to one value per file. Both of those changes would have been very cludgy to fit into the current api, so they were changed. This was shown in the many patches on this list before I sent my changes off to Linus.
I don't want to be seen as breaking things without a good reason. These are good changes. They reduced the amount of kernel code, and have moved the i2c chips into the sysfs heirachy, which will allow them to be seen by userspace tools that get entire system information (people are currently working on libsysfs to make userspace interaction with the sysfs tree simpler, although find and cat and echo work good for me :)
thanks,
greg k-h
PATCH 1/1 More i2c driver changes for 2.5.66
In reply to Greg KHQuoted 4 lines · Greg KH
Or do you mean that this series of patches specifically were not sent to the sensors list? They were, it looks like the sensors list dropped them for somereason. Look at the email header of the messages on lkml for proof of that.
I noticed that the sensors list spam marker tagged a bunch of your (Greg's) messages... IIRC something about "numerically obscured URL" (likely referring to the BK URLs). I don't know what to suggest except... subscribers can't rely on that tag alone.
Regards,
Signature · 2 lines
Mark M. Hoffman [email protected]
PATCH 1/1 More i2c driver changes for 2.5.66
In reply to Greg KHLinux kenel mail list removed on purpose.
Whoa! I just saw the patches submitted to linux kernel and not to sensors list. Come on Greg this is not proper.
Whats this config item CONFIG_SENSOR ?
This is the wrong way to register sensors to sysfs. New sensors can never be tested before included in the kernel with this philosophy.
Whats wrong with the opposite philosophy of creating a sysfs interface and in the sensor driver just make the sysfs call?
Albert
PATCH 1/1 More i2c driver changes for 2.5.69
In reply to Greg KHQuoted 8 lines · Greg KH
ChangeSet 1.1083.2.5, 2003/05/09 14:54:25-07:00, [email protected]
[PATCH] I2C: And another it87 patch.
And lastly, when changing the fan count divisor, fix up the min setting to still be roughly the same. (Previously the meaning of the value in the register changed, but not the value itself, resulting in, undesired surprises.)
Hmmm... I don't think any of the other drives make this adjustment.
I think the expectation would be that fan divisors and minimums would be set using 'sensors -s' but I could see that this could create an order dependancy.
If the minmum was set before the divisor, and the divisor was changing, then
you'd get the wrong result.
So this is probably a good idea, but we'll need to watch for this in the other drivers either for 2.7.1 or as they are converted to the new CVS...
:v)
Quoted 14 lines · Greg KH
ChangeSet 1.1189, 2003/03/21 12:45:28-08:00, [email protected]
i2c: remove
i2c_adapter->nameand usedev->nameinstead.drivers/i2c/busses/i2c-ali15x3.c | 8 ++-- drivers/i2c/busses/i2c-amd756.c | 6 ++- drivers/i2c/busses/i2c-amd8111.c | 4 +- drivers/i2c/busses/i2c-i801.c | 8 ++-- drivers/i2c/busses/i2c-isa.c | 4 +- drivers/i2c/busses/i2c-piix4.c | 8 ++-- drivers/i2c/i2c-algo-bit.c | 13 +++--- drivers/i2c/i2c-algo-pcf.c | 19 ++++------ drivers/i2c/i2c-core.c | 73 ++++++++++++++++-----------------------
Quoted 8 lines
drivers/i2c/i2c-dev.c | 17 +++------ drivers/i2c/i2c-elektor.c | 10 +++-- drivers/i2c/i2c-elv.c | 4 +- drivers/i2c/i2c-philips-par.c | 4 +- drivers/i2c/i2c-velleman.c | 4 +- drivers/i2c/scx200_acb.c | 28 ++++++-------- include/linux/i2c.h | 1 16 files changed, 105 insertions(+), 106 deletions(-)
Although you'll not break matroxfb more than it is currently, can you also update drivers/video/matrox/{i2c-matroxfb,matroxfb_maven}.* in your updates? Or I'll send you patch after this change hits Linus kernel...
Only problem is that there are apps which search DDC channel by looking for i2c bus named "DDC:fbX #Y on i2c-matroxfb", and this looks too long for generic driver infrastructure. But "DDC:fbX #Y" looks acceptable...
Thanks,
Petr Vandrovec [email protected]
Quoted 4 lines · Petr Vandrovec
Although you'll not break matroxfb more than it is currently, can you also update
drivers/video/matrox/{i2c-matroxfb,matroxfb_maven}.*in your updates? Or I'll send you patch after this change hits Linus kernel...
Yeah, that stuff doesn't compile at all :)
I added a patch for the i2c related stuff to my tree that I just sent out.
thanks for pointing it out.
greg k-h