mirror of
https://github.com/lm-sensors/lm-sensors.git
synced 2026-11-20 19:41:47 +00:00
Some small bug fixes
* Somehow, i2c-proc did not yet use the i2c_adapter_id call. This must have slipped through. * isa.o and smbus.o changes I made to make them less noisy had a small error (no return value), which caused strange device detections. * Added /proc/bus/i2c module-count monitoring - somehow, this slipped through, too. git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@68 7894878c-1315-0410-8ee3-d5d059ff63e0
This commit is contained in:
1 parent
ea315df1c3
commit
a8ee0243ad
6 files changed
+30
-24
No files matched your search
@@ -79,8 +79,8 @@ int isa_master_xfer (struct isa_adapter *adap, struct i2c_msg msgs[],
|
||||
printk("isa.o: isa_master_xfer called for adapter `%s' "
|
||||
"(no i2c level access possible!)\n",
|
||||
adap->name);
|
||||
return -1;
|
||||
#endif
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Algorithm slave_send call-back implementation. Can't do that... */
|
||||
@@ -90,8 +90,8 @@ int isa_slave_send (struct isa_adapter *adap, char *data, int len)
|
||||
printk("isa.o: isa_slave_send called for adapter `%s' "
|
||||
"(no i2c level access possible!)\n",
|
||||
adap->name);
|
||||
return -1;
|
||||
#endif
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Algorithm slave_recv call-back implementation. Can't do that... */
|
||||
@@ -101,8 +101,8 @@ int isa_slave_recv (struct isa_adapter *adap, char *data, int len)
|
||||
printk("isa.o: isa_slave_recv called for adapter `%s' "
|
||||
"(no i2c level access possible!)\n",
|
||||
adap->name);
|
||||
return -1;
|
||||
#endif
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Here we can put additional calls to modify the workings of the algorithm.
|
||||
|
||||
+9
-6
@@ -156,14 +156,16 @@ int i2cproc_init(void)
|
||||
return -ENOENT;
|
||||
}
|
||||
proc_bus_i2c = create_proc_entry("i2c",0,proc_bus);
|
||||
if (proc_bus_i2c)
|
||||
proc_bus_i2c->read_proc = &read_bus_i2c;
|
||||
else {
|
||||
if (!proc_bus_i2c) {
|
||||
printk("i2c-proc.o: Could not create /proc/bus/i2c, "
|
||||
"module not inserted.\n");
|
||||
i2cproc_cleanup();
|
||||
return -ENOENT;
|
||||
}
|
||||
proc_bus_i2c->read_proc = &read_bus_i2c;
|
||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,1,29))
|
||||
proc_bus_i2c->fill_inode = &monitor_bus_i2c;
|
||||
#endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(2,1,29)) */
|
||||
i2cproc_initialized += 2;
|
||||
#else /* (LINUX_VERSION_CODE < KERNEL_VERSION(2,1,29)) */
|
||||
/* In Linux 2.0.x, there is no /proc/bus! But I hope no other module
|
||||
@@ -252,7 +254,8 @@ int read_bus_i2c(char *buf, char **start, off_t offset, int len, int unused)
|
||||
len = 0;
|
||||
for (i = 0; i < I2C_ADAP_MAX; i++)
|
||||
if (i2cproc_adapters[i])
|
||||
len += sprintf(buf+len, "i2c-%d\t%s\t%-32s\t%-32s\n",i,
|
||||
len += sprintf(buf+len, "i2c-%d\t%s\t%-32s\t%-32s\n",
|
||||
i2c_adapter_id(i2cproc_adapters[i]),
|
||||
i2c_is_smbus_adapter(i2cproc_adapters[i])?"smbus":
|
||||
#ifdef DEBUG
|
||||
i2c_is_isa_adapter(i2cproc_adapters[i])?"isa":
|
||||
@@ -356,7 +359,7 @@ int i2cproc_attach_adapter(struct i2c_adapter *adapter)
|
||||
}
|
||||
i2cproc_adapters[i] = adapter;
|
||||
|
||||
sprintf(name,"i2c-%d",i);
|
||||
sprintf(name,"i2c-%d",i2c_adapter_id(adapter));
|
||||
|
||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,1,29))
|
||||
proc_entry = create_proc_entry(name,0,proc_bus);
|
||||
@@ -413,7 +416,7 @@ int i2cproc_detach_client(struct i2c_client *client)
|
||||
for (i = 0; i < I2C_ADAP_MAX; i++)
|
||||
if (client->adapter == i2cproc_adapters[i]) {
|
||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,1,29))
|
||||
sprintf(name,"i2c-%d",i);
|
||||
sprintf(name,"i2c-%d",i2c_adapter_id(i2cproc_adapters[i]));
|
||||
remove_proc_entry(name,proc_bus);
|
||||
#else /* (LINUX_VERSION_CODE < KERNEL_VERSION(2,1,29)) */
|
||||
if ((res = proc_unregister(&proc_bus_dir,
|
||||
|
||||
+3
-3
@@ -191,8 +191,8 @@ int smbus_master_xfer (struct smbus_adapter *adap, struct i2c_msg msgs[],
|
||||
printk("smbus.o: smbus_master_xfer called for adapter `%s' "
|
||||
"(no i2c level access possible!)\n",
|
||||
adap->name);
|
||||
return -1;
|
||||
#endif
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Algorithm slave_send call-back implementation. Can't do that... */
|
||||
@@ -202,8 +202,8 @@ int smbus_slave_send (struct smbus_adapter *adap, char *data, int len)
|
||||
printk("smbus.o: smbus_slave_send called for adapter `%s' "
|
||||
"(no i2c level access possible!)\n",
|
||||
adap->name);
|
||||
return -1;
|
||||
#endif
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Algorithm slave_recv call-back implementation. Can't do that... */
|
||||
@@ -213,8 +213,8 @@ int smbus_slave_recv (struct smbus_adapter *adap, char *data, int len)
|
||||
printk("smbus.o: smbus_slave_recv called for adapter `%s' "
|
||||
"(no i2c level access possible!)\n",
|
||||
adap->name);
|
||||
return -1;
|
||||
#endif
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Here we can put additional calls to modify the workings of the algorithm.
|
||||
|
||||
+9
-6
@@ -156,14 +156,16 @@ int i2cproc_init(void)
|
||||
return -ENOENT;
|
||||
}
|
||||
proc_bus_i2c = create_proc_entry("i2c",0,proc_bus);
|
||||
if (proc_bus_i2c)
|
||||
proc_bus_i2c->read_proc = &read_bus_i2c;
|
||||
else {
|
||||
if (!proc_bus_i2c) {
|
||||
printk("i2c-proc.o: Could not create /proc/bus/i2c, "
|
||||
"module not inserted.\n");
|
||||
i2cproc_cleanup();
|
||||
return -ENOENT;
|
||||
}
|
||||
proc_bus_i2c->read_proc = &read_bus_i2c;
|
||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,1,29))
|
||||
proc_bus_i2c->fill_inode = &monitor_bus_i2c;
|
||||
#endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(2,1,29)) */
|
||||
i2cproc_initialized += 2;
|
||||
#else /* (LINUX_VERSION_CODE < KERNEL_VERSION(2,1,29)) */
|
||||
/* In Linux 2.0.x, there is no /proc/bus! But I hope no other module
|
||||
@@ -252,7 +254,8 @@ int read_bus_i2c(char *buf, char **start, off_t offset, int len, int unused)
|
||||
len = 0;
|
||||
for (i = 0; i < I2C_ADAP_MAX; i++)
|
||||
if (i2cproc_adapters[i])
|
||||
len += sprintf(buf+len, "i2c-%d\t%s\t%-32s\t%-32s\n",i,
|
||||
len += sprintf(buf+len, "i2c-%d\t%s\t%-32s\t%-32s\n",
|
||||
i2c_adapter_id(i2cproc_adapters[i]),
|
||||
i2c_is_smbus_adapter(i2cproc_adapters[i])?"smbus":
|
||||
#ifdef DEBUG
|
||||
i2c_is_isa_adapter(i2cproc_adapters[i])?"isa":
|
||||
@@ -356,7 +359,7 @@ int i2cproc_attach_adapter(struct i2c_adapter *adapter)
|
||||
}
|
||||
i2cproc_adapters[i] = adapter;
|
||||
|
||||
sprintf(name,"i2c-%d",i);
|
||||
sprintf(name,"i2c-%d",i2c_adapter_id(adapter));
|
||||
|
||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,1,29))
|
||||
proc_entry = create_proc_entry(name,0,proc_bus);
|
||||
@@ -413,7 +416,7 @@ int i2cproc_detach_client(struct i2c_client *client)
|
||||
for (i = 0; i < I2C_ADAP_MAX; i++)
|
||||
if (client->adapter == i2cproc_adapters[i]) {
|
||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,1,29))
|
||||
sprintf(name,"i2c-%d",i);
|
||||
sprintf(name,"i2c-%d",i2c_adapter_id(i2cproc_adapters[i]));
|
||||
remove_proc_entry(name,proc_bus);
|
||||
#else /* (LINUX_VERSION_CODE < KERNEL_VERSION(2,1,29)) */
|
||||
if ((res = proc_unregister(&proc_bus_dir,
|
||||
|
||||
@@ -79,8 +79,8 @@ int isa_master_xfer (struct isa_adapter *adap, struct i2c_msg msgs[],
|
||||
printk("isa.o: isa_master_xfer called for adapter `%s' "
|
||||
"(no i2c level access possible!)\n",
|
||||
adap->name);
|
||||
return -1;
|
||||
#endif
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Algorithm slave_send call-back implementation. Can't do that... */
|
||||
@@ -90,8 +90,8 @@ int isa_slave_send (struct isa_adapter *adap, char *data, int len)
|
||||
printk("isa.o: isa_slave_send called for adapter `%s' "
|
||||
"(no i2c level access possible!)\n",
|
||||
adap->name);
|
||||
return -1;
|
||||
#endif
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Algorithm slave_recv call-back implementation. Can't do that... */
|
||||
@@ -101,8 +101,8 @@ int isa_slave_recv (struct isa_adapter *adap, char *data, int len)
|
||||
printk("isa.o: isa_slave_recv called for adapter `%s' "
|
||||
"(no i2c level access possible!)\n",
|
||||
adap->name);
|
||||
return -1;
|
||||
#endif
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Here we can put additional calls to modify the workings of the algorithm.
|
||||
|
||||
+3
-3
@@ -191,8 +191,8 @@ int smbus_master_xfer (struct smbus_adapter *adap, struct i2c_msg msgs[],
|
||||
printk("smbus.o: smbus_master_xfer called for adapter `%s' "
|
||||
"(no i2c level access possible!)\n",
|
||||
adap->name);
|
||||
return -1;
|
||||
#endif
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Algorithm slave_send call-back implementation. Can't do that... */
|
||||
@@ -202,8 +202,8 @@ int smbus_slave_send (struct smbus_adapter *adap, char *data, int len)
|
||||
printk("smbus.o: smbus_slave_send called for adapter `%s' "
|
||||
"(no i2c level access possible!)\n",
|
||||
adap->name);
|
||||
return -1;
|
||||
#endif
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Algorithm slave_recv call-back implementation. Can't do that... */
|
||||
@@ -213,8 +213,8 @@ int smbus_slave_recv (struct smbus_adapter *adap, char *data, int len)
|
||||
printk("smbus.o: smbus_slave_recv called for adapter `%s' "
|
||||
"(no i2c level access possible!)\n",
|
||||
adap->name);
|
||||
return -1;
|
||||
#endif
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Here we can put additional calls to modify the workings of the algorithm.
|
||||
|
||||
Reference in new issue
Block a user