hwmon: Fix debug messages in w83781d

Fix debug messages in w83781d at detection time. We can't use dev_dbg()
on an i2c client's device before calling i2c_attach_client() on that
client.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
This commit is contained in:
Jean Delvare 2006-10-13 17:03:42 +02:00 committed by Greg Kroah-Hartman
parent e693810ce8
commit bd452e6f17
1 changed files with 10 additions and 8 deletions

View File

@ -1099,7 +1099,8 @@ w83781d_detect(struct i2c_adapter *adapter, int address, int kind)
bank. */ bank. */
if (kind < 0) { if (kind < 0) {
if (w83781d_read_value(client, W83781D_REG_CONFIG) & 0x80) { if (w83781d_read_value(client, W83781D_REG_CONFIG) & 0x80) {
dev_dbg(dev, "Detection failed at step 3\n"); dev_dbg(&adapter->dev, "Detection of w83781d chip "
"failed at step 3\n");
err = -ENODEV; err = -ENODEV;
goto ERROR2; goto ERROR2;
} }
@ -1109,7 +1110,8 @@ w83781d_detect(struct i2c_adapter *adapter, int address, int kind)
if ((!(val1 & 0x07)) && if ((!(val1 & 0x07)) &&
(((!(val1 & 0x80)) && (val2 != 0xa3) && (val2 != 0xc3)) (((!(val1 & 0x80)) && (val2 != 0xa3) && (val2 != 0xc3))
|| ((val1 & 0x80) && (val2 != 0x5c) && (val2 != 0x12)))) { || ((val1 & 0x80) && (val2 != 0x5c) && (val2 != 0x12)))) {
dev_dbg(dev, "Detection failed at step 4\n"); dev_dbg(&adapter->dev, "Detection of w83781d chip "
"failed at step 4\n");
err = -ENODEV; err = -ENODEV;
goto ERROR2; goto ERROR2;
} }
@ -1119,7 +1121,8 @@ w83781d_detect(struct i2c_adapter *adapter, int address, int kind)
((val1 & 0x80) && (val2 == 0x5c)))) { ((val1 & 0x80) && (val2 == 0x5c)))) {
if (w83781d_read_value if (w83781d_read_value
(client, W83781D_REG_I2C_ADDR) != address) { (client, W83781D_REG_I2C_ADDR) != address) {
dev_dbg(dev, "Detection failed at step 5\n"); dev_dbg(&adapter->dev, "Detection of w83781d "
"chip failed at step 5\n");
err = -ENODEV; err = -ENODEV;
goto ERROR2; goto ERROR2;
} }
@ -1141,8 +1144,8 @@ w83781d_detect(struct i2c_adapter *adapter, int address, int kind)
else if (val2 == 0x12) else if (val2 == 0x12)
vendid = asus; vendid = asus;
else { else {
dev_dbg(dev, "Chip was made by neither " dev_dbg(&adapter->dev, "w83781d chip vendor is "
"Winbond nor Asus?\n"); "neither Winbond nor Asus\n");
err = -ENODEV; err = -ENODEV;
goto ERROR2; goto ERROR2;
} }
@ -1161,10 +1164,9 @@ w83781d_detect(struct i2c_adapter *adapter, int address, int kind)
kind = as99127f; kind = as99127f;
else { else {
if (kind == 0) if (kind == 0)
dev_warn(dev, "Ignoring 'force' " dev_warn(&adapter->dev, "Ignoring 'force' "
"parameter for unknown chip at " "parameter for unknown chip at "
"adapter %d, address 0x%02x\n", "address 0x%02x\n", address);
i2c_adapter_id(adapter), address);
err = -EINVAL; err = -EINVAL;
goto ERROR2; goto ERROR2;
} }