mirror of
https://github.com/lm-sensors/lm-sensors.git
synced 2026-11-20 19:41:47 +00:00
(Phil) Fixed a probing bug.
git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@282 7894878c-1315-0410-8ee3-d5d059ff63e0
This commit is contained in:
1 parent
bb8f03cea5
commit
812e77a817
1 file changed
+7
-5
@@ -24,6 +24,7 @@
|
|||||||
#include "smbus.h"
|
#include "smbus.h"
|
||||||
#include "sensors.h"
|
#include "sensors.h"
|
||||||
#include "i2c.h"
|
#include "i2c.h"
|
||||||
|
#include "i2c-isa.h"
|
||||||
#include "version.h"
|
#include "version.h"
|
||||||
|
|
||||||
/* adm1021 constants specified below */
|
/* adm1021 constants specified below */
|
||||||
@@ -150,7 +151,7 @@ static struct i2c_client *adm1021_list[MAX_adm1021_NR];
|
|||||||
|
|
||||||
int adm1021_attach_adapter(struct i2c_adapter *adapter)
|
int adm1021_attach_adapter(struct i2c_adapter *adapter)
|
||||||
{
|
{
|
||||||
int address,err,i;
|
int address,err,i,temp;
|
||||||
struct i2c_client *new_client;
|
struct i2c_client *new_client;
|
||||||
struct adm1021_data *data;
|
struct adm1021_data *data;
|
||||||
enum adm1021_type type;
|
enum adm1021_type type;
|
||||||
@@ -158,8 +159,8 @@ int adm1021_attach_adapter(struct i2c_adapter *adapter)
|
|||||||
const char *client_name;
|
const char *client_name;
|
||||||
|
|
||||||
err = 0;
|
err = 0;
|
||||||
|
/* Make sure we aren't probing the ISA bus!! */
|
||||||
/* OK, this is no detection. I know. It will do for now, though. */
|
if (i2c_is_isa_adapter(adapter)) return 0;
|
||||||
|
|
||||||
/* Set err only if a global error would make registering other clients
|
/* Set err only if a global error would make registering other clients
|
||||||
impossible too (like out-of-memory). */
|
impossible too (like out-of-memory). */
|
||||||
@@ -174,7 +175,9 @@ int adm1021_attach_adapter(struct i2c_adapter *adapter)
|
|||||||
/* Verify device is 1021 by checked special DEVICE_ID
|
/* Verify device is 1021 by checked special DEVICE_ID
|
||||||
register (I wish all SMBus chips had this..) */
|
register (I wish all SMBus chips had this..) */
|
||||||
/* The MAX1617 does not have it, regrettably. */
|
/* The MAX1617 does not have it, regrettably. */
|
||||||
if (smbus_read_byte_data(adapter,address,adm1021_REG_DEVICE_ID) == 0x41){
|
temp=smbus_read_byte_data(adapter,address,adm1021_REG_DEVICE_ID);
|
||||||
|
if (temp == -1) continue;
|
||||||
|
if (temp == 0x41){
|
||||||
type = adm1021;
|
type = adm1021;
|
||||||
type_name = "adm1021";
|
type_name = "adm1021";
|
||||||
client_name = "ADM1021 chip";
|
client_name = "ADM1021 chip";
|
||||||
@@ -183,7 +186,6 @@ int adm1021_attach_adapter(struct i2c_adapter *adapter)
|
|||||||
type_name = "max1617";
|
type_name = "max1617";
|
||||||
client_name = "MAX1617 chip";
|
client_name = "MAX1617 chip";
|
||||||
}
|
}
|
||||||
/* continue; */
|
|
||||||
|
|
||||||
/* Allocate space for a new client structure */
|
/* Allocate space for a new client structure */
|
||||||
if (! (new_client = kmalloc(sizeof(struct i2c_client) +
|
if (! (new_client = kmalloc(sizeof(struct i2c_client) +
|
||||||
|
|||||||
Reference in new issue
Block a user