[i2c] [PATCH] i2c: Use i2c_adapter.dev.parent for messages
Jean Delvare
khali at linux-fr.org
Sun Feb 18 13:24:41 CET 2007
Update many I2C drivers to stop using i2c_adapter.dev in messages,
using i2c_adapter.dev.parent instead. This is required because
i2c_adapter.dev doesn't correspond to a physical device, and soon
it will no longer have a driver, so using it in messages will
produce broken messages.
Not all drivers can be updated yet, as some i2c bus drivers lack
a proper parent device at the moment.
This is heavily based on prior work by David Brownell.
Signed-off-by: Jean Delvare <khali at linux-fr.org>
---
drivers/i2c/busses/i2c-ali1535.c | 32 +++++-----
drivers/i2c/busses/i2c-ali1563.c | 30 +++++----
drivers/i2c/busses/i2c-ali15x3.c | 27 ++++----
drivers/i2c/busses/i2c-amd756-s4882.c | 13 ++--
drivers/i2c/busses/i2c-amd756.c | 26 ++++----
drivers/i2c/busses/i2c-amd8111.c | 3 +
drivers/i2c/busses/i2c-at91.c | 15 +++--
drivers/i2c/busses/i2c-mv64xxx.c | 10 +-
drivers/i2c/busses/i2c-nforce2.c | 12 ++--
drivers/i2c/busses/i2c-pasemi.c | 3 +
drivers/i2c/busses/i2c-piix4.c | 24 ++++---
drivers/i2c/busses/i2c-pnx.c | 79 +++++++++++++-----------
drivers/i2c/busses/i2c-pxa.c | 68 ++++++++++++++-------
drivers/i2c/busses/i2c-sis5595.c | 16 +++--
drivers/i2c/busses/i2c-sis630.c | 49 +++++++++------
drivers/i2c/busses/i2c-sis96x.c | 22 +++---
drivers/i2c/busses/i2c-viapro.c | 23 ++++---
drivers/media/dvb/frontends/nxt200x.c | 6 +-
drivers/media/dvb/frontends/or51132.c | 2
drivers/media/video/cx25840/cx25840-firmware.c | 2
drivers/video/fb_ddc.c | 6 +-
21 files changed, 269 insertions(+), 199 deletions(-)
--- linux-2.6.21-pre.orig/drivers/i2c/busses/i2c-ali1535.c 2007-02-18 10:41:54.000000000 +0100
+++ linux-2.6.21-pre/drivers/i2c/busses/i2c-ali1535.c 2007-02-18 10:57:18.000000000 +0100
@@ -205,11 +205,12 @@ exit_free:
static int ali1535_transaction(struct i2c_adapter *adap)
{
+ struct device *dev = adap->dev.parent;
int temp;
int result = 0;
int timeout = 0;
- dev_dbg(&adap->dev, "Transaction (pre): STS=%02x, TYP=%02x, "
+ dev_dbg(dev, "Transaction (pre): STS=%02x, TYP=%02x, "
"CMD=%02x, ADD=%02x, DAT0=%02x, DAT1=%02x\n",
inb_p(SMBHSTSTS), inb_p(SMBHSTTYP), inb_p(SMBHSTCMD),
inb_p(SMBHSTADD), inb_p(SMBHSTDAT0), inb_p(SMBHSTDAT1));
@@ -239,9 +240,8 @@ static int ali1535_transaction(struct i2
* BUSY bit may come back on when you try and use the chip
* again. If that's the case you are stuck.
*/
- dev_info(&adap->dev,
- "Resetting entire SMB Bus to clear busy condition (%02x)\n",
- temp);
+ dev_info(dev, "Resetting entire SMB Bus to clear busy "
+ "condition (%02x)\n", temp);
outb_p(ALI1535_T_OUT, SMBHSTTYP);
temp = inb_p(SMBHSTSTS);
}
@@ -256,7 +256,7 @@ static int ali1535_transaction(struct i2
* power reset as one of the bits now appears to be
* stuck */
/* This may be a bus or device with electrical problems. */
- dev_err(&adap->dev,
+ dev_err(dev,
"SMBus reset failed! (0x%02x) - controller or "
"device on bus is probably hung\n", temp);
return -1;
@@ -282,12 +282,12 @@ static int ali1535_transaction(struct i2
/* If the SMBus is still busy, we give up */
if (timeout >= MAX_TIMEOUT) {
result = -1;
- dev_err(&adap->dev, "SMBus Timeout!\n");
+ dev_err(dev, "SMBus Timeout!\n");
}
if (temp & ALI1535_STS_FAIL) {
result = -1;
- dev_dbg(&adap->dev, "Error: Failed bus transaction\n");
+ dev_dbg(dev, "Error: Failed bus transaction\n");
}
/* Unfortunately the ALI SMB controller maps "no response" and "bus
@@ -296,24 +296,23 @@ static int ali1535_transaction(struct i2
*/
if (temp & ALI1535_STS_BUSERR) {
result = -1;
- dev_dbg(&adap->dev,
- "Error: no response or bus collision ADD=%02x\n",
+ dev_dbg(dev, "Error: no response or bus collision ADD=%02x\n",
inb_p(SMBHSTADD));
}
/* haven't ever seen this */
if (temp & ALI1535_STS_DEV) {
result = -1;
- dev_err(&adap->dev, "Error: device error\n");
+ dev_err(dev, "Error: device error\n");
}
/* check to see if the "command complete" indication is set */
if (!(temp & ALI1535_STS_DONE)) {
result = -1;
- dev_err(&adap->dev, "Error: command never completed\n");
+ dev_err(dev, "Error: command never completed\n");
}
- dev_dbg(&adap->dev, "Transaction (post): STS=%02x, TYP=%02x, "
+ dev_dbg(dev, "Transaction (post): STS=%02x, TYP=%02x, "
"CMD=%02x, ADD=%02x, DAT0=%02x, DAT1=%02x\n",
inb_p(SMBHSTSTS), inb_p(SMBHSTTYP), inb_p(SMBHSTCMD),
inb_p(SMBHSTADD), inb_p(SMBHSTDAT0), inb_p(SMBHSTDAT1));
@@ -351,14 +350,16 @@ static s32 ali1535_access(struct i2c_ada
temp = inb_p(SMBHSTSTS);
}
if (timeout >= MAX_TIMEOUT)
- dev_warn(&adap->dev, "Idle wait Timeout! STS=0x%02x\n", temp);
+ dev_warn(adap->dev.parent,
+ "Idle wait Timeout! STS=0x%02x\n", temp);
/* clear status register (clear-on-write) */
outb_p(0xFF, SMBHSTSTS);
switch (size) {
case I2C_SMBUS_PROC_CALL:
- dev_err(&adap->dev, "I2C_SMBUS_PROC_CALL not supported!\n");
+ dev_err(adap->dev.parent,
+ "I2C_SMBUS_PROC_CALL not supported!\n");
result = -1;
goto EXIT;
case I2C_SMBUS_QUICK:
@@ -450,7 +451,8 @@ static s32 ali1535_access(struct i2c_ada
outb_p(inb_p(SMBHSTTYP) | ALI1535_BLOCK_CLR, SMBHSTTYP);
for (i = 1; i <= data->block[0]; i++) {
data->block[i] = inb_p(SMBBLKDAT);
- dev_dbg(&adap->dev, "Blk: len=%d, i=%d, data=%02x\n",
+ dev_dbg(adap->dev.parent,
+ "Blk: len=%d, i=%d, data=%02x\n",
len, i, data->block[i]);
}
break;
--- linux-2.6.21-pre.orig/drivers/i2c/busses/i2c-ali1563.c 2007-02-18 10:41:54.000000000 +0100
+++ linux-2.6.21-pre/drivers/i2c/busses/i2c-ali1563.c 2007-02-18 10:57:18.000000000 +0100
@@ -65,10 +65,11 @@ static unsigned short ali1563_smba;
static int ali1563_transaction(struct i2c_adapter * a, int size)
{
+ struct device *dev = a->dev.parent;
u32 data;
int timeout;
- dev_dbg(&a->dev, "Transaction (pre): STS=%02x, CNTL1=%02x, "
+ dev_dbg(dev, "Transaction (pre): STS=%02x, CNTL1=%02x, "
"CNTL2=%02x, CMD=%02x, ADD=%02x, DAT0=%02x, DAT1=%02x\n",
inb_p(SMB_HST_STS), inb_p(SMB_HST_CNTL1), inb_p(SMB_HST_CNTL2),
inb_p(SMB_HST_CMD), inb_p(SMB_HST_ADD), inb_p(SMB_HST_DAT0),
@@ -76,7 +77,7 @@ static int ali1563_transaction(struct i2
data = inb_p(SMB_HST_STS);
if (data & HST_STS_BAD) {
- dev_err(&a->dev, "ali1563: Trying to reset busy device\n");
+ dev_err(dev, "ali1563: Trying to reset busy device\n");
outb_p(data | HST_STS_BAD,SMB_HST_STS);
data = inb_p(SMB_HST_STS);
if (data & HST_STS_BAD)
@@ -89,7 +90,7 @@ static int ali1563_transaction(struct i2
msleep(1);
while (((data = inb_p(SMB_HST_STS)) & HST_STS_BUSY) && --timeout);
- dev_dbg(&a->dev, "Transaction (post): STS=%02x, CNTL1=%02x, "
+ dev_dbg(dev, "Transaction (post): STS=%02x, CNTL1=%02x, "
"CNTL2=%02x, CMD=%02x, ADD=%02x, DAT0=%02x, DAT1=%02x\n",
inb_p(SMB_HST_STS), inb_p(SMB_HST_CNTL1), inb_p(SMB_HST_CNTL2),
inb_p(SMB_HST_CMD), inb_p(SMB_HST_ADD), inb_p(SMB_HST_DAT0),
@@ -99,7 +100,7 @@ static int ali1563_transaction(struct i2
return 0;
if (!timeout) {
- dev_err(&a->dev, "Timeout - Trying to KILL transaction!\n");
+ dev_err(dev, "Timeout - Trying to KILL transaction!\n");
/* Issue 'kill' to host controller */
outb_p(HST_CNTL2_KILL,SMB_HST_CNTL2);
data = inb_p(SMB_HST_STS);
@@ -107,18 +108,18 @@ static int ali1563_transaction(struct i2
/* device error - no response, ignore the autodetection case */
if ((data & HST_STS_DEVERR) && (size != HST_CNTL2_QUICK)) {
- dev_err(&a->dev, "Device error!\n");
+ dev_err(dev, "Device error!\n");
}
/* bus collision */
if (data & HST_STS_BUSERR) {
- dev_err(&a->dev, "Bus collision!\n");
+ dev_err(dev, "Bus collision!\n");
/* Issue timeout, hoping it helps */
outb_p(HST_CNTL1_TIMEOUT,SMB_HST_CNTL1);
}
if (data & HST_STS_FAIL) {
- dev_err(&a->dev, "Cleaning fail after KILL!\n");
+ dev_err(dev, "Cleaning fail after KILL!\n");
outb_p(0x0,SMB_HST_CNTL2);
}
@@ -127,10 +128,11 @@ static int ali1563_transaction(struct i2
static int ali1563_block_start(struct i2c_adapter * a)
{
+ struct device *dev = a->dev.parent;
u32 data;
int timeout;
- dev_dbg(&a->dev, "Block (pre): STS=%02x, CNTL1=%02x, "
+ dev_dbg(dev, "Block (pre): STS=%02x, CNTL1=%02x, "
"CNTL2=%02x, CMD=%02x, ADD=%02x, DAT0=%02x, DAT1=%02x\n",
inb_p(SMB_HST_STS), inb_p(SMB_HST_CNTL1), inb_p(SMB_HST_CNTL2),
inb_p(SMB_HST_CMD), inb_p(SMB_HST_ADD), inb_p(SMB_HST_DAT0),
@@ -138,7 +140,7 @@ static int ali1563_block_start(struct i2
data = inb_p(SMB_HST_STS);
if (data & HST_STS_BAD) {
- dev_warn(&a->dev,"ali1563: Trying to reset busy device\n");
+ dev_warn(dev, "ali1563: Trying to reset busy device\n");
outb_p(data | HST_STS_BAD,SMB_HST_STS);
data = inb_p(SMB_HST_STS);
if (data & HST_STS_BAD)
@@ -156,7 +158,7 @@ static int ali1563_block_start(struct i2
msleep(1);
while (!((data = inb_p(SMB_HST_STS)) & HST_STS_DONE) && --timeout);
- dev_dbg(&a->dev, "Block (post): STS=%02x, CNTL1=%02x, "
+ dev_dbg(dev, "Block (post): STS=%02x, CNTL1=%02x, "
"CNTL2=%02x, CMD=%02x, ADD=%02x, DAT0=%02x, DAT1=%02x\n",
inb_p(SMB_HST_STS), inb_p(SMB_HST_CNTL1), inb_p(SMB_HST_CNTL2),
inb_p(SMB_HST_CMD), inb_p(SMB_HST_ADD), inb_p(SMB_HST_DAT0),
@@ -164,7 +166,7 @@ static int ali1563_block_start(struct i2
if (timeout && !(data & HST_STS_BAD))
return 0;
- dev_err(&a->dev, "SMBus Error: %s%s%s%s%s\n",
+ dev_err(dev, "SMBus Error: %s%s%s%s%s\n",
timeout ? "Timeout " : "",
data & HST_STS_FAIL ? "Transaction Failed " : "",
data & HST_STS_BUSERR ? "No response or Bus Collision " : "",
@@ -230,13 +232,15 @@ static s32 ali1563_access(struct i2c_ada
break;
}
if (!timeout)
- dev_warn(&a->dev,"SMBus not idle. HST_STS = %02x\n",reg);
+ dev_warn(a->dev.parent,
+ "SMBus not idle. HST_STS = %02x\n", reg);
outb_p(0xff,SMB_HST_STS);
/* Map the size to what the chip understands */
switch (size) {
case I2C_SMBUS_PROC_CALL:
- dev_err(&a->dev, "I2C_SMBUS_PROC_CALL not supported!\n");
+ dev_err(a->dev.parent,
+ "I2C_SMBUS_PROC_CALL not supported!\n");
error = -EINVAL;
break;
case I2C_SMBUS_QUICK:
--- linux-2.6.21-pre.orig/drivers/i2c/busses/i2c-ali15x3.c 2007-02-18 10:41:54.000000000 +0100
+++ linux-2.6.21-pre/drivers/i2c/busses/i2c-ali15x3.c 2007-02-18 10:57:18.000000000 +0100
@@ -228,11 +228,12 @@ error:
/* Another internally used function */
static int ali15x3_transaction(struct i2c_adapter *adap)
{
+ struct device *dev = adap->dev.parent;
int temp;
int result = 0;
int timeout = 0;
- dev_dbg(&adap->dev, "Transaction (pre): STS=%02x, CNT=%02x, CMD=%02x, "
+ dev_dbg(dev, "Transaction (pre): STS=%02x, CNT=%02x, CMD=%02x, "
"ADD=%02x, DAT0=%02x, DAT1=%02x\n", inb_p(SMBHSTSTS),
inb_p(SMBHSTCNT), inb_p(SMBHSTCMD), inb_p(SMBHSTADD),
inb_p(SMBHSTDAT0), inb_p(SMBHSTDAT1));
@@ -264,7 +265,7 @@ static int ali15x3_transaction(struct i2
then the BUSY bit may come back on when you try and use the chip again.
If that's the case you are stuck.
*/
- dev_info(&adap->dev, "Resetting entire SMB Bus to "
+ dev_info(dev, "Resetting entire SMB Bus to "
"clear busy condition (%02x)\n", temp);
outb_p(ALI15X3_T_OUT, SMBHSTCNT);
temp = inb_p(SMBHSTSTS);
@@ -279,7 +280,7 @@ static int ali15x3_transaction(struct i2
/* this is probably going to be correctable only by a power reset
as one of the bits now appears to be stuck */
/* This may be a bus or device with electrical problems. */
- dev_err(&adap->dev, "SMBus reset failed! (0x%02x) - "
+ dev_err(dev, "SMBus reset failed! (0x%02x) - "
"controller or device on bus is probably hung\n",
temp);
return -1;
@@ -305,12 +306,12 @@ static int ali15x3_transaction(struct i2
/* If the SMBus is still busy, we give up */
if (timeout >= MAX_TIMEOUT) {
result = -1;
- dev_err(&adap->dev, "SMBus Timeout!\n");
+ dev_err(dev, "SMBus Timeout!\n");
}
if (temp & ALI15X3_STS_TERM) {
result = -1;
- dev_dbg(&adap->dev, "Error: Failed bus transaction\n");
+ dev_dbg(dev, "Error: Failed bus transaction\n");
}
/*
@@ -321,17 +322,16 @@ static int ali15x3_transaction(struct i2
*/
if (temp & ALI15X3_STS_COLL) {
result = -1;
- dev_dbg(&adap->dev,
- "Error: no response or bus collision ADD=%02x\n",
+ dev_dbg(dev, "Error: no response or bus collision ADD=%02x\n",
inb_p(SMBHSTADD));
}
/* haven't ever seen this */
if (temp & ALI15X3_STS_DEV) {
result = -1;
- dev_err(&adap->dev, "Error: device error\n");
+ dev_err(adap->dev.parent, "Error: device error\n");
}
- dev_dbg(&adap->dev, "Transaction (post): STS=%02x, CNT=%02x, CMD=%02x, "
+ dev_dbg(dev, "Transaction (post): STS=%02x, CNT=%02x, CMD=%02x, "
"ADD=%02x, DAT0=%02x, DAT1=%02x\n", inb_p(SMBHSTSTS),
inb_p(SMBHSTCNT), inb_p(SMBHSTCMD), inb_p(SMBHSTADD),
inb_p(SMBHSTDAT0), inb_p(SMBHSTDAT1));
@@ -358,12 +358,14 @@ static s32 ali15x3_access(struct i2c_ada
temp = inb_p(SMBHSTSTS);
}
if (timeout >= MAX_TIMEOUT) {
- dev_err(&adap->dev, "Idle wait Timeout! STS=0x%02x\n", temp);
+ dev_err(adap->dev.parent,
+ "Idle wait Timeout! STS=0x%02x\n", temp);
}
switch (size) {
case I2C_SMBUS_PROC_CALL:
- dev_err(&adap->dev, "I2C_SMBUS_PROC_CALL not supported!\n");
+ dev_err(adap->dev.parent,
+ "I2C_SMBUS_PROC_CALL not supported!\n");
return -1;
case I2C_SMBUS_QUICK:
outb_p(((addr & 0x7f) << 1) | (read_write & 0x01),
@@ -447,7 +449,8 @@ static s32 ali15x3_access(struct i2c_ada
outb_p(inb_p(SMBHSTCNT) | ALI15X3_BLOCK_CLR, SMBHSTCNT);
for (i = 1; i <= data->block[0]; i++) {
data->block[i] = inb_p(SMBBLKDAT);
- dev_dbg(&adap->dev, "Blk: len=%d, i=%d, data=%02x\n",
+ dev_dbg(adap->dev.parent,
+ "Blk: len=%d, i=%d, data=%02x\n",
len, i, data->block[i]);
}
break;
--- linux-2.6.21-pre.orig/drivers/i2c/busses/i2c-amd756-s4882.c 2007-02-18 10:41:54.000000000 +0100
+++ linux-2.6.21-pre/drivers/i2c/busses/i2c-amd756-s4882.c 2007-02-18 10:57:18.000000000 +0100
@@ -161,8 +161,8 @@ static int __init amd756_s4882_init(void
if (error == -EINVAL)
error = -ENODEV;
else
- dev_err(&amd756_smbus.dev, "Physical bus removal "
- "failed\n");
+ dev_err(amd756_smbus.dev.parent,
+ "Physical bus removal failed\n");
goto ERROR0;
}
@@ -204,7 +204,8 @@ static int __init amd756_s4882_init(void
I2C_SMBUS_WRITE, 0x03,
I2C_SMBUS_BYTE_DATA, &ioconfig);
if (error) {
- dev_err(&amd756_smbus.dev, "PCA9556 configuration failed\n");
+ dev_err(amd756_smbus.dev.parent,
+ "PCA9556 configuration failed\n");
error = -EIO;
goto ERROR3;
}
@@ -213,7 +214,7 @@ static int __init amd756_s4882_init(void
for (i = 0; i < 5; i++) {
error = i2c_add_adapter(s4882_adapter+i);
if (error) {
- dev_err(&amd756_smbus.dev,
+ dev_err(amd756_smbus.dev.parent,
"Virtual adapter %d registration "
"failed, module not inserted\n", i);
for (i--; i >= 0; i--)
@@ -251,8 +252,8 @@ static void __exit amd756_s4882_exit(voi
/* Restore physical bus */
if (i2c_add_adapter(&amd756_smbus))
- dev_err(&amd756_smbus.dev, "Physical bus restoration "
- "failed\n");
+ dev_err(amd756_smbus.dev.parent,
+ "Physical bus restoration failed\n");
}
MODULE_AUTHOR("Jean Delvare <khali at linux-fr.org>");
--- linux-2.6.21-pre.orig/drivers/i2c/busses/i2c-amd756.c 2007-02-18 10:41:54.000000000 +0100
+++ linux-2.6.21-pre/drivers/i2c/busses/i2c-amd756.c 2007-02-18 10:57:18.000000000 +0100
@@ -110,18 +110,19 @@ static unsigned short amd756_ioport;
static int amd756_transaction(struct i2c_adapter *adap)
{
+ struct device *dev = adap->dev.parent;
int temp;
int result = 0;
int timeout = 0;
- dev_dbg(&adap->dev, "Transaction (pre): GS=%04x, GE=%04x, ADD=%04x, "
+ dev_dbg(dev, "Transaction (pre): GS=%04x, GE=%04x, ADD=%04x, "
"DAT=%04x\n", inw_p(SMB_GLOBAL_STATUS),
inw_p(SMB_GLOBAL_ENABLE), inw_p(SMB_HOST_ADDRESS),
inb_p(SMB_HOST_DATA));
/* Make sure the SMBus host is ready to start transmitting */
if ((temp = inw_p(SMB_GLOBAL_STATUS)) & (GS_HST_STS | GS_SMB_STS)) {
- dev_dbg(&adap->dev, "SMBus busy (%04x). Waiting...\n", temp);
+ dev_dbg(dev, "SMBus busy (%04x). Waiting...\n", temp);
do {
msleep(1);
temp = inw_p(SMB_GLOBAL_STATUS);
@@ -129,7 +130,7 @@ static int amd756_transaction(struct i2c
(timeout++ < MAX_TIMEOUT));
/* If the SMBus is still busy, we give up */
if (timeout >= MAX_TIMEOUT) {
- dev_dbg(&adap->dev, "Busy wait timeout (%04x)\n", temp);
+ dev_dbg(dev, "Busy wait timeout (%04x)\n", temp);
goto abort;
}
timeout = 0;
@@ -146,38 +147,38 @@ static int amd756_transaction(struct i2c
/* If the SMBus is still busy, we give up */
if (timeout >= MAX_TIMEOUT) {
- dev_dbg(&adap->dev, "Completion timeout!\n");
+ dev_dbg(dev, "Completion timeout!\n");
goto abort;
}
if (temp & GS_PRERR_STS) {
result = -1;
- dev_dbg(&adap->dev, "SMBus Protocol error (no response)!\n");
+ dev_dbg(dev, "SMBus Protocol error (no response)!\n");
}
if (temp & GS_COL_STS) {
result = -1;
- dev_warn(&adap->dev, "SMBus collision!\n");
+ dev_warn(dev, "SMBus collision!\n");
}
if (temp & GS_TO_STS) {
result = -1;
- dev_dbg(&adap->dev, "SMBus protocol timeout!\n");
+ dev_dbg(dev, "SMBus protocol timeout!\n");
}
if (temp & GS_HCYC_STS)
- dev_dbg(&adap->dev, "SMBus protocol success!\n");
+ dev_dbg(dev, "SMBus protocol success!\n");
outw_p(GS_CLEAR_STS, SMB_GLOBAL_STATUS);
#ifdef DEBUG
if (((temp = inw_p(SMB_GLOBAL_STATUS)) & GS_CLEAR_STS) != 0x00) {
- dev_dbg(&adap->dev,
+ dev_dbg(dev,
"Failed reset at end of transaction (%04x)\n", temp);
}
#endif
- dev_dbg(&adap->dev,
+ dev_dbg(dev,
"Transaction (post): GS=%04x, GE=%04x, ADD=%04x, DAT=%04x\n",
inw_p(SMB_GLOBAL_STATUS), inw_p(SMB_GLOBAL_ENABLE),
inw_p(SMB_HOST_ADDRESS), inb_p(SMB_HOST_DATA));
@@ -185,7 +186,7 @@ static int amd756_transaction(struct i2c
return result;
abort:
- dev_warn(&adap->dev, "Sending abort\n");
+ dev_warn(dev, "Sending abort\n");
outw_p(inw(SMB_GLOBAL_ENABLE) | GE_ABORT, SMB_GLOBAL_ENABLE);
msleep(100);
outw_p(GS_CLEAR_STS, SMB_GLOBAL_STATUS);
@@ -202,7 +203,8 @@ static s32 amd756_access(struct i2c_adap
/** TODO: Should I supporte the 10-bit transfers? */
switch (size) {
case I2C_SMBUS_PROC_CALL:
- dev_dbg(&adap->dev, "I2C_SMBUS_PROC_CALL not supported!\n");
+ dev_dbg(adap->dev.parent,
+ "I2C_SMBUS_PROC_CALL not supported!\n");
/* TODO: Well... It is supported, I'm just not sure what to do here... */
return -1;
case I2C_SMBUS_QUICK:
--- linux-2.6.21-pre.orig/drivers/i2c/busses/i2c-amd8111.c 2007-02-18 10:41:54.000000000 +0100
+++ linux-2.6.21-pre/drivers/i2c/busses/i2c-amd8111.c 2007-02-18 10:57:18.000000000 +0100
@@ -266,7 +266,8 @@ static s32 amd8111_access(struct i2c_ada
break;
default:
- dev_warn(&adap->dev, "Unsupported transaction %d\n", size);
+ dev_warn(adap->dev.parent,
+ "Unsupported transaction %d\n", size);
return -1;
}
--- linux-2.6.21-pre.orig/drivers/i2c/busses/i2c-at91.c 2007-02-18 10:41:54.000000000 +0100
+++ linux-2.6.21-pre/drivers/i2c/busses/i2c-at91.c 2007-02-18 10:57:18.000000000 +0100
@@ -96,7 +96,7 @@ static int xfer_read(struct i2c_adapter
if (!length) /* need to send Stop before reading last byte */
at91_twi_write(AT91_TWI_CR, AT91_TWI_STOP);
if (!at91_poll_status(AT91_TWI_RXRDY)) {
- dev_dbg(&adap->dev, "RXRDY timeout\n");
+ dev_dbg(adap->dev.parent, "RXRDY timeout\n");
return -ETIMEDOUT;
}
*buf++ = (at91_twi_read(AT91_TWI_RHR) & 0xff);
@@ -115,7 +115,7 @@ static int xfer_write(struct i2c_adapter
do {
if (!at91_poll_status(AT91_TWI_TXRDY)) {
- dev_dbg(&adap->dev, "TXRDY timeout\n");
+ dev_dbg(adap->dev.parent, "TXRDY timeout\n");
return -ETIMEDOUT;
}
@@ -143,10 +143,12 @@ static int at91_xfer(struct i2c_adapter
{
int i, ret;
- dev_dbg(&adap->dev, "at91_xfer: processing %d messages:\n", num);
+ dev_dbg(adap->dev.parent,
+ "at91_xfer: processing %d messages:\n", num);
for (i = 0; i < num; i++) {
- dev_dbg(&adap->dev, " #%d: %sing %d byte%s %s 0x%02x\n", i,
+ dev_dbg(adap->dev.parent,
+ " #%d: %sing %d byte%s %s 0x%02x\n", i,
pmsg->flags & I2C_M_RD ? "read" : "writ",
pmsg->len, pmsg->len > 1 ? "s" : "",
pmsg->flags & I2C_M_RD ? "from" : "to", pmsg->addr);
@@ -165,11 +167,12 @@ static int at91_xfer(struct i2c_adapter
/* Wait until transfer is finished */
if (!at91_poll_status(AT91_TWI_TXCOMP)) {
- dev_dbg(&adap->dev, "TXCOMP timeout\n");
+ dev_dbg(adap->dev.parent,
+ "TXCOMP timeout\n");
return -ETIMEDOUT;
}
}
- dev_dbg(&adap->dev, "transfer complete\n");
+ dev_dbg(adap->dev.parent, "transfer complete\n");
pmsg++; /* next message */
}
return i;
--- linux-2.6.21-pre.orig/drivers/i2c/busses/i2c-mv64xxx.c 2007-02-18 10:41:54.000000000 +0100
+++ linux-2.6.21-pre/drivers/i2c/busses/i2c-mv64xxx.c 2007-02-18 10:57:18.000000000 +0100
@@ -197,7 +197,7 @@ mv64xxx_i2c_fsm(struct mv64xxx_i2c_data
break;
default:
- dev_err(&drv_data->adapter.dev,
+ dev_err(drv_data->adapter.dev.parent,
"mv64xxx_i2c_fsm: Ctlr Error -- state: 0x%x, "
"status: 0x%x, addr: 0x%x, flags: 0x%x\n",
drv_data->state, status, drv_data->msg->addr,
@@ -262,7 +262,7 @@ mv64xxx_i2c_do_action(struct mv64xxx_i2c
case MV64XXX_I2C_ACTION_INVALID:
default:
- dev_err(&drv_data->adapter.dev,
+ dev_err(drv_data->adapter.dev.parent,
"mv64xxx_i2c_do_action: Invalid action: %d\n",
drv_data->action);
drv_data->rc = -EIO;
@@ -363,7 +363,7 @@ mv64xxx_i2c_wait_for_completion(struct m
if ((time_left <= 0) && drv_data->block) {
drv_data->state = MV64XXX_I2C_STATE_IDLE;
- dev_err(&drv_data->adapter.dev,
+ dev_err(drv_data->adapter.dev.parent,
"mv64xxx: I2C bus locked, block: %d, "
"time_left: %d\n", drv_data->block,
(int)time_left);
@@ -534,13 +534,13 @@ mv64xxx_i2c_probe(struct platform_device
if (request_irq(drv_data->irq, mv64xxx_i2c_intr, 0,
MV64XXX_I2C_CTLR_NAME, drv_data)) {
- dev_err(&drv_data->adapter.dev,
+ dev_err(drv_data->adapter.dev.parent,
"mv64xxx: Can't register intr handler irq: %d\n",
drv_data->irq);
rc = -EINVAL;
goto exit_unmap_regs;
} else if ((rc = i2c_add_adapter(&drv_data->adapter)) != 0) {
- dev_err(&drv_data->adapter.dev,
+ dev_err(drv_data->adapter.dev.parent,
"mv64xxx: Can't add i2c adapter, rc: %d\n", -rc);
goto exit_free_irq;
}
--- linux-2.6.21-pre.orig/drivers/i2c/busses/i2c-nforce2.c 2007-02-18 10:41:54.000000000 +0100
+++ linux-2.6.21-pre/drivers/i2c/busses/i2c-nforce2.c 2007-02-18 10:57:18.000000000 +0100
@@ -101,6 +101,7 @@ static s32 nforce2_access(struct i2c_ada
{
struct nforce2_smbus *smbus = adap->algo_data;
unsigned char protocol, pec, temp;
+ struct device *dev = adap->dev.parent;
protocol = (read_write == I2C_SMBUS_READ) ? NVIDIA_SMB_PRTCL_READ :
NVIDIA_SMB_PRTCL_WRITE;
@@ -136,7 +137,7 @@ static s32 nforce2_access(struct i2c_ada
break;
default:
- dev_err(&adap->dev, "Unsupported transaction %d\n", size);
+ dev_err(dev, "Unsupported transaction %d\n", size);
return -1;
}
@@ -155,7 +156,7 @@ static s32 nforce2_access(struct i2c_ada
}
if ((~temp & NVIDIA_SMB_STS_DONE) || (temp & NVIDIA_SMB_STS_STATUS)) {
- dev_dbg(&adap->dev, "SMBus Timeout! (0x%02x)\n", temp);
+ dev_dbg(dev, "SMBus Timeout! (0x%02x)\n", temp);
return -1;
}
@@ -230,7 +231,8 @@ static int __devinit nforce2_probe_smb (
}
if (!request_region(smbus->base, smbus->size, nforce2_driver.name)) {
- dev_err(&smbus->adapter.dev, "Error requesting region %02x .. %02X for %s\n",
+ dev_err(&dev->dev,
+ "Error requesting region %02x .. %02X for %s\n",
smbus->base, smbus->base+smbus->size-1, name);
return -1;
}
@@ -245,11 +247,11 @@ static int __devinit nforce2_probe_smb (
error = i2c_add_adapter(&smbus->adapter);
if (error) {
- dev_err(&smbus->adapter.dev, "Failed to register adapter.\n");
+ dev_err(&dev->dev, "Failed to register adapter.\n");
release_region(smbus->base, smbus->size);
return -1;
}
- dev_info(&smbus->adapter.dev, "nForce2 SMBus adapter at %#x\n", smbus->base);
+ dev_info(smbus->adapter.dev.parent, "%s\n", smbus->adapter.name);
return 0;
}
--- linux-2.6.21-pre.orig/drivers/i2c/busses/i2c-pasemi.c 2007-02-18 10:41:54.000000000 +0100
+++ linux-2.6.21-pre/drivers/i2c/busses/i2c-pasemi.c 2007-02-18 10:57:18.000000000 +0100
@@ -262,7 +262,8 @@ static int pasemi_smb_xfer(struct i2c_ad
break;
default:
- dev_warn(&adapter->dev, "Unsupported transaction %d\n", size);
+ dev_warn(adapter->dev.parent,
+ "Unsupported transaction %d\n", size);
return -EINVAL;
}
--- linux-2.6.21-pre.orig/drivers/i2c/busses/i2c-piix4.c 2007-02-18 10:41:54.000000000 +0100
+++ linux-2.6.21-pre/drivers/i2c/busses/i2c-piix4.c 2007-02-18 10:57:18.000000000 +0100
@@ -209,25 +209,26 @@ static int __devinit piix4_setup(struct
/* Another internally used function */
static int piix4_transaction(void)
{
+ struct device *dev = piix4_adapter.dev.parent;
int temp;
int result = 0;
int timeout = 0;
- dev_dbg(&piix4_adapter.dev, "Transaction (pre): CNT=%02x, CMD=%02x, "
+ dev_dbg(dev, "Transaction (pre): CNT=%02x, CMD=%02x, "
"ADD=%02x, DAT0=%02x, DAT1=%02x\n", inb_p(SMBHSTCNT),
inb_p(SMBHSTCMD), inb_p(SMBHSTADD), inb_p(SMBHSTDAT0),
inb_p(SMBHSTDAT1));
/* Make sure the SMBus host is ready to start transmitting */
if ((temp = inb_p(SMBHSTSTS)) != 0x00) {
- dev_dbg(&piix4_adapter.dev, "SMBus busy (%02x). "
+ dev_dbg(dev, "SMBus busy (%02x). "
"Resetting...\n", temp);
outb_p(temp, SMBHSTSTS);
if ((temp = inb_p(SMBHSTSTS)) != 0x00) {
- dev_err(&piix4_adapter.dev, "Failed! (%02x)\n", temp);
+ dev_err(dev, "Failed! (%02x)\n", temp);
return -1;
} else {
- dev_dbg(&piix4_adapter.dev, "Successfull!\n");
+ dev_dbg(dev, "Successful!\n");
}
}
@@ -242,35 +243,35 @@ static int piix4_transaction(void)
/* If the SMBus is still busy, we give up */
if (timeout >= MAX_TIMEOUT) {
- dev_err(&piix4_adapter.dev, "SMBus Timeout!\n");
+ dev_err(dev, "SMBus Timeout!\n");
result = -1;
}
if (temp & 0x10) {
result = -1;
- dev_err(&piix4_adapter.dev, "Error: Failed bus transaction\n");
+ dev_err(dev, "Error: Failed bus transaction\n");
}
if (temp & 0x08) {
result = -1;
- dev_dbg(&piix4_adapter.dev, "Bus collision! SMBus may be "
+ dev_dbg(dev, "Bus collision! SMBus may be "
"locked until next hard reset. (sorry!)\n");
/* Clock stops and slave is stuck in mid-transmission */
}
if (temp & 0x04) {
result = -1;
- dev_dbg(&piix4_adapter.dev, "Error: no response!\n");
+ dev_dbg(dev, "Error: no response!\n");
}
if (inb_p(SMBHSTSTS) != 0x00)
outb_p(inb(SMBHSTSTS), SMBHSTSTS);
if ((temp = inb_p(SMBHSTSTS)) != 0x00) {
- dev_err(&piix4_adapter.dev, "Failed reset at end of "
+ dev_err(dev, "Failed reset at end of "
"transaction (%02x)\n", temp);
}
- dev_dbg(&piix4_adapter.dev, "Transaction (post): CNT=%02x, CMD=%02x, "
+ dev_dbg(dev, "Transaction (post): CNT=%02x, CMD=%02x, "
"ADD=%02x, DAT0=%02x, DAT1=%02x\n", inb_p(SMBHSTCNT),
inb_p(SMBHSTCMD), inb_p(SMBHSTADD), inb_p(SMBHSTDAT0),
inb_p(SMBHSTDAT1));
@@ -286,7 +287,8 @@ static s32 piix4_access(struct i2c_adapt
switch (size) {
case I2C_SMBUS_PROC_CALL:
- dev_err(&adap->dev, "I2C_SMBUS_PROC_CALL not supported!\n");
+ dev_err(adap->dev.parent,
+ "I2C_SMBUS_PROC_CALL not supported!\n");
return -1;
case I2C_SMBUS_QUICK:
outb_p(((addr & 0x7f) << 1) | (read_write & 0x01),
--- linux-2.6.21-pre.orig/drivers/i2c/busses/i2c-pnx.c 2007-02-18 10:41:54.000000000 +0100
+++ linux-2.6.21-pre/drivers/i2c/busses/i2c-pnx.c 2007-02-18 10:57:18.000000000 +0100
@@ -56,7 +56,7 @@ static inline void i2c_pnx_arm_timer(str
del_timer_sync(timer);
- dev_dbg(&adap->dev, "Timer armed at %lu plus %u jiffies.\n",
+ dev_dbg(adap->dev.parent, "Timer armed at %lu plus %u jiffies.\n",
jiffies, expires);
timer->expires = jiffies + expires;
@@ -76,12 +76,12 @@ static int i2c_pnx_start(unsigned char s
{
struct i2c_pnx_algo_data *alg_data = adap->algo_data;
- dev_dbg(&adap->dev, "%s(): addr 0x%x mode %d\n", __FUNCTION__,
+ dev_dbg(adap->dev.parent, "%s(): addr 0x%x mode %d\n", __FUNCTION__,
slave_addr, alg_data->mif.mode);
/* Check for 7 bit slave addresses only */
if (slave_addr & ~0x7f) {
- dev_err(&adap->dev, "%s: Invalid slave address %x. "
+ dev_err(adap->dev.parent, "%s: Invalid slave address %x. "
"Only 7-bit addresses are supported\n",
adap->name, slave_addr);
return -EINVAL;
@@ -90,15 +90,15 @@ static int i2c_pnx_start(unsigned char s
/* First, make sure bus is idle */
if (wait_timeout(I2C_PNX_TIMEOUT, alg_data)) {
/* Somebody else is monopolizing the bus */
- dev_err(&adap->dev, "%s: Bus busy. Slave addr = %02x, "
- "cntrl = %x, stat = %x\n",
+ dev_err(adap->dev.parent, "%s: Bus busy. "
+ "Slave addr = %02x, cntrl = %x, stat = %x\n",
adap->name, slave_addr,
ioread32(I2C_REG_CTL(alg_data)),
ioread32(I2C_REG_STS(alg_data)));
return -EBUSY;
} else if (ioread32(I2C_REG_STS(alg_data)) & mstatus_afi) {
/* Sorry, we lost the bus */
- dev_err(&adap->dev, "%s: Arbitration failure. "
+ dev_err(adap->dev.parent, "%s: Arbitration failure. "
"Slave addr = %02x\n", adap->name, slave_addr);
return -EIO;
}
@@ -110,14 +110,14 @@ static int i2c_pnx_start(unsigned char s
iowrite32(ioread32(I2C_REG_STS(alg_data)) | mstatus_tdi | mstatus_afi,
I2C_REG_STS(alg_data));
- dev_dbg(&adap->dev, "%s(): sending %#x\n", __FUNCTION__,
+ dev_dbg(adap->dev.parent, "%s(): sending %#x\n", __FUNCTION__,
(slave_addr << 1) | start_bit | alg_data->mif.mode);
/* Write the slave address, START bit and R/W bit */
iowrite32((slave_addr << 1) | start_bit | alg_data->mif.mode,
I2C_REG_TX(alg_data));
- dev_dbg(&adap->dev, "%s(): exit\n", __FUNCTION__);
+ dev_dbg(adap->dev.parent, "%s(): exit\n", __FUNCTION__);
return 0;
}
@@ -134,7 +134,7 @@ static void i2c_pnx_stop(struct i2c_adap
/* Only 1 msec max timeout due to interrupt context */
long timeout = 1000;
- dev_dbg(&adap->dev, "%s(): entering: stat = %04x.\n",
+ dev_dbg(adap->dev.parent, "%s(): entering: stat = %04x.\n",
__FUNCTION__, ioread32(I2C_REG_STS(alg_data)));
/* Write a STOP bit to TX FIFO */
@@ -148,7 +148,7 @@ static void i2c_pnx_stop(struct i2c_adap
timeout--;
}
- dev_dbg(&adap->dev, "%s(): exiting: stat = %04x.\n",
+ dev_dbg(adap->dev.parent, "%s(): exiting: stat = %04x.\n",
__FUNCTION__, ioread32(I2C_REG_STS(alg_data)));
}
@@ -163,7 +163,7 @@ static int i2c_pnx_master_xmit(struct i2
struct i2c_pnx_algo_data *alg_data = adap->algo_data;
u32 val;
- dev_dbg(&adap->dev, "%s(): entering: stat = %04x.\n",
+ dev_dbg(adap->dev.parent, "%s(): entering: stat = %04x.\n",
__FUNCTION__, ioread32(I2C_REG_STS(alg_data)));
if (alg_data->mif.len > 0) {
@@ -179,14 +179,15 @@ static int i2c_pnx_master_xmit(struct i2
alg_data->mif.len--;
iowrite32(val, I2C_REG_TX(alg_data));
- dev_dbg(&adap->dev, "%s(): xmit %#x [%d]\n", __FUNCTION__,
- val, alg_data->mif.len + 1);
+ dev_dbg(adap->dev.parent, "%s(): xmit %#x [%d]\n",
+ __FUNCTION__, val, alg_data->mif.len + 1);
if (alg_data->mif.len == 0) {
if (alg_data->last) {
/* Wait until the STOP is seen. */
if (wait_timeout(I2C_PNX_TIMEOUT, alg_data))
- dev_err(&adap->dev, "The bus is still "
+ dev_err(adap->dev.parent,
+ "The bus is still "
"active after timeout\n");
}
/* Disable master interrupts */
@@ -196,7 +197,8 @@ static int i2c_pnx_master_xmit(struct i2
del_timer_sync(&alg_data->mif.timer);
- dev_dbg(&adap->dev, "%s(): Waking up xfer routine.\n",
+ dev_dbg(adap->dev.parent,
+ "%s(): Waking up xfer routine.\n",
__FUNCTION__);
complete(&alg_data->mif.complete);
@@ -212,13 +214,14 @@ static int i2c_pnx_master_xmit(struct i2
/* Stop timer. */
del_timer_sync(&alg_data->mif.timer);
- dev_dbg(&adap->dev, "%s(): Waking up xfer routine after "
+ dev_dbg(adap->dev.parent,
+ "%s(): Waking up xfer routine after "
"zero-xfer.\n", __FUNCTION__);
complete(&alg_data->mif.complete);
}
- dev_dbg(&adap->dev, "%s(): exiting: stat = %04x.\n",
+ dev_dbg(adap->dev.parent, "%s(): exiting: stat = %04x.\n",
__FUNCTION__, ioread32(I2C_REG_STS(alg_data)));
return 0;
@@ -236,14 +239,14 @@ static int i2c_pnx_master_rcv(struct i2c
unsigned int val = 0;
u32 ctl = 0;
- dev_dbg(&adap->dev, "%s(): entering: stat = %04x.\n",
+ dev_dbg(adap->dev.parent, "%s(): entering: stat = %04x.\n",
__FUNCTION__, ioread32(I2C_REG_STS(alg_data)));
/* Check, whether there is already data,
* or we didn't 'ask' for it yet.
*/
if (ioread32(I2C_REG_STS(alg_data)) & mstatus_rfe) {
- dev_dbg(&adap->dev, "%s(): Write dummy data to fill "
+ dev_dbg(adap->dev.parent, "%s(): Write dummy data to fill "
"Rx-fifo...\n", __FUNCTION__);
if (alg_data->mif.len == 1) {
@@ -276,15 +279,16 @@ static int i2c_pnx_master_rcv(struct i2c
if (alg_data->mif.len > 0) {
val = ioread32(I2C_REG_RX(alg_data));
*alg_data->mif.buf++ = (u8) (val & 0xff);
- dev_dbg(&adap->dev, "%s(): rcv 0x%x [%d]\n", __FUNCTION__, val,
- alg_data->mif.len);
+ dev_dbg(adap->dev.parent, "%s(): rcv 0x%x [%d]\n",
+ __FUNCTION__, val, alg_data->mif.len);
alg_data->mif.len--;
if (alg_data->mif.len == 0) {
if (alg_data->last)
/* Wait until the STOP is seen. */
if (wait_timeout(I2C_PNX_TIMEOUT, alg_data))
- dev_err(&adap->dev, "The bus is still "
+ dev_err(adap->dev.parent,
+ "The bus is still "
"active after timeout\n");
/* Disable master interrupts */
@@ -299,7 +303,7 @@ static int i2c_pnx_master_rcv(struct i2c
}
}
- dev_dbg(&adap->dev, "%s(): exiting: stat = %04x.\n",
+ dev_dbg(adap->dev.parent, "%s(): exiting: stat = %04x.\n",
__FUNCTION__, ioread32(I2C_REG_STS(alg_data)));
return 0;
@@ -311,7 +315,8 @@ static irqreturn_t i2c_pnx_interrupt(int
struct i2c_adapter *adap = dev_id;
struct i2c_pnx_algo_data *alg_data = adap->algo_data;
- dev_dbg(&adap->dev, "%s(): mstat = %x mctrl = %x, mode = %d\n",
+ dev_dbg(adap->dev.parent,
+ "%s(): mstat = %x mctrl = %x, mode = %d\n",
__FUNCTION__,
ioread32(I2C_REG_STS(alg_data)),
ioread32(I2C_REG_CTL(alg_data)),
@@ -334,7 +339,7 @@ static irqreturn_t i2c_pnx_interrupt(int
complete(&alg_data->mif.complete);
} else if (stat & mstatus_nai) {
/* Slave did not acknowledge, generate a STOP */
- dev_dbg(&adap->dev, "%s(): "
+ dev_dbg(adap->dev.parent, "%s(): "
"Slave did not acknowledge, generating a STOP.\n",
__FUNCTION__);
i2c_pnx_stop(adap);
@@ -374,7 +379,7 @@ static irqreturn_t i2c_pnx_interrupt(int
stat = ioread32(I2C_REG_STS(alg_data));
iowrite32(stat | mstatus_tdi | mstatus_afi, I2C_REG_STS(alg_data));
- dev_dbg(&adap->dev, "%s(): exiting, stat = %x ctrl = %x.\n",
+ dev_dbg(adap->dev.parent, "%s(): exiting, stat = %x ctrl = %x.\n",
__FUNCTION__, ioread32(I2C_REG_STS(alg_data)),
ioread32(I2C_REG_CTL(alg_data)));
@@ -387,7 +392,8 @@ static void i2c_pnx_timeout(unsigned lon
struct i2c_pnx_algo_data *alg_data = adap->algo_data;
u32 ctl;
- dev_err(&adap->dev, "Master timed out. stat = %04x, cntrl = %04x. "
+ dev_err(adap->dev.parent,
+ "Master timed out. stat = %04x, cntrl = %04x. "
"Resetting master...\n",
ioread32(I2C_REG_STS(alg_data)),
ioread32(I2C_REG_CTL(alg_data)));
@@ -410,7 +416,7 @@ static inline void bus_reset_if_active(s
u32 stat;
if ((stat = ioread32(I2C_REG_STS(alg_data))) & mstatus_active) {
- dev_err(&adap->dev,
+ dev_err(adap->dev.parent,
"%s: Bus is still active after xfer. Reset it...\n",
adap->name);
iowrite32(ioread32(I2C_REG_CTL(alg_data)) | mcntrl_reset,
@@ -446,7 +452,8 @@ i2c_pnx_xfer(struct i2c_adapter *adap, s
struct i2c_pnx_algo_data *alg_data = adap->algo_data;
u32 stat = ioread32(I2C_REG_STS(alg_data));
- dev_dbg(&adap->dev, "%s(): entering: %d messages, stat = %04x.\n",
+ dev_dbg(adap->dev.parent,
+ "%s(): entering: %d messages, stat = %04x.\n",
__FUNCTION__, num, ioread32(I2C_REG_STS(alg_data)));
bus_reset_if_active(adap);
@@ -459,7 +466,7 @@ i2c_pnx_xfer(struct i2c_adapter *adap, s
addr = pmsg->addr;
if (pmsg->flags & I2C_M_TEN) {
- dev_err(&adap->dev,
+ dev_err(adap->dev.parent,
"%s: 10 bits addr not supported!\n",
adap->name);
rc = -EINVAL;
@@ -473,7 +480,8 @@ i2c_pnx_xfer(struct i2c_adapter *adap, s
alg_data->mif.ret = 0;
alg_data->last = (i == num - 1);
- dev_dbg(&adap->dev, "%s(): mode %d, %d bytes\n", __FUNCTION__,
+ dev_dbg(adap->dev.parent,
+ "%s(): mode %d, %d bytes\n", __FUNCTION__,
alg_data->mif.mode,
alg_data->mif.len);
@@ -497,18 +505,19 @@ i2c_pnx_xfer(struct i2c_adapter *adap, s
if (!(rc = alg_data->mif.ret))
completed++;
- dev_dbg(&adap->dev, "%s(): Complete, return code = %d.\n",
+ dev_dbg(adap->dev.parent,
+ "%s(): Complete, return code = %d.\n",
__FUNCTION__, rc);
/* Clear TDI and AFI bits in case they are set. */
if ((stat = ioread32(I2C_REG_STS(alg_data))) & mstatus_tdi) {
- dev_dbg(&adap->dev,
+ dev_dbg(adap->dev.parent,
"%s: TDI still set... clearing now.\n",
adap->name);
iowrite32(stat, I2C_REG_STS(alg_data));
}
if ((stat = ioread32(I2C_REG_STS(alg_data))) & mstatus_afi) {
- dev_dbg(&adap->dev,
+ dev_dbg(adap->dev.parent,
"%s: AFI still set... clearing now.\n",
adap->name);
iowrite32(stat, I2C_REG_STS(alg_data));
@@ -521,7 +530,7 @@ i2c_pnx_xfer(struct i2c_adapter *adap, s
alg_data->mif.buf = NULL;
alg_data->mif.len = 0;
- dev_dbg(&adap->dev, "%s(): exiting, stat = %x\n",
+ dev_dbg(adap->dev.parent, "%s(): exiting, stat = %x\n",
__FUNCTION__, ioread32(I2C_REG_STS(alg_data)));
if (completed != num)
--- linux-2.6.21-pre.orig/drivers/i2c/busses/i2c-pxa.c 2007-02-18 10:41:54.000000000 +0100
+++ linux-2.6.21-pre/drivers/i2c/busses/i2c-pxa.c 2007-02-18 10:57:18.000000000 +0100
@@ -130,7 +130,9 @@ static unsigned int i2c_debug = DEBUG;
static void i2c_pxa_show_state(struct pxa_i2c *i2c, int lno, const char *fname)
{
- dev_dbg(&i2c->adap.dev, "state:%s:%d: ISR=%08x, ICR=%08x, IBMR=%02x\n", fname, lno, ISR, ICR, IBMR);
+ dev_dbg(i2c->adap.dev.parent,
+ "state:%s:%d: ISR=%08x, ICR=%08x, IBMR=%02x\n",
+ fname, lno, ISR, ICR, IBMR);
}
#define show_state(i2c) i2c_pxa_show_state(i2c, __LINE__, __FUNCTION__)
@@ -169,7 +171,8 @@ static void i2c_pxa_abort(struct pxa_i2c
unsigned long timeout = jiffies + HZ/4;
if (i2c_pxa_is_slavemode(i2c)) {
- dev_dbg(&i2c->adap.dev, "%s: called in slave mode\n", __func__);
+ dev_dbg(i2c->adap.dev.parent,
+ "%s: called in slave mode\n", __func__);
return;
}
@@ -213,12 +216,14 @@ static int i2c_pxa_wait_master(struct px
while (time_before(jiffies, timeout)) {
if (i2c_debug > 1)
- dev_dbg(&i2c->adap.dev, "%s: %ld: ISR=%08x, ICR=%08x, IBMR=%02x\n",
+ dev_dbg(i2c->adap.dev.parent,
+ "%s: %ld: ISR=%08x, ICR=%08x, IBMR=%02x\n",
__func__, (long)jiffies, ISR, ICR, IBMR);
if (ISR & ISR_SAD) {
if (i2c_debug > 0)
- dev_dbg(&i2c->adap.dev, "%s: Slave detected\n", __func__);
+ dev_dbg(i2c->adap.dev.parent,
+ "%s: Slave detected\n", __func__);
goto out;
}
@@ -228,7 +233,8 @@ static int i2c_pxa_wait_master(struct px
*/
if ((ISR & (ISR_UB | ISR_IBB)) == 0 && IBMR == 3) {
if (i2c_debug > 0)
- dev_dbg(&i2c->adap.dev, "%s: done\n", __func__);
+ dev_dbg(i2c->adap.dev.parent,
+ "%s: done\n", __func__);
return 1;
}
@@ -236,7 +242,8 @@ static int i2c_pxa_wait_master(struct px
}
if (i2c_debug > 0)
- dev_dbg(&i2c->adap.dev, "%s: did not free\n", __func__);
+ dev_dbg(i2c->adap.dev.parent,
+ "%s: did not free\n", __func__);
out:
return 0;
}
@@ -244,12 +251,14 @@ static int i2c_pxa_wait_master(struct px
static int i2c_pxa_set_master(struct pxa_i2c *i2c)
{
if (i2c_debug)
- dev_dbg(&i2c->adap.dev, "setting to bus master\n");
+ dev_dbg(i2c->adap.dev.parent, "setting to bus master\n");
if ((ISR & (ISR_UB | ISR_IBB)) != 0) {
- dev_dbg(&i2c->adap.dev, "%s: unit is busy\n", __func__);
+ dev_dbg(i2c->adap.dev.parent,
+ "%s: unit is busy\n", __func__);
if (!i2c_pxa_wait_master(i2c)) {
- dev_dbg(&i2c->adap.dev, "%s: error: unit busy\n", __func__);
+ dev_dbg(i2c->adap.dev.parent,
+ "%s: error: unit busy\n", __func__);
return I2C_RETRY;
}
}
@@ -269,14 +278,16 @@ static int i2c_pxa_wait_slave(struct pxa
while (time_before(jiffies, timeout)) {
if (i2c_debug > 1)
- dev_dbg(&i2c->adap.dev, "%s: %ld: ISR=%08x, ICR=%08x, IBMR=%02x\n",
+ dev_dbg(i2c->adap.dev.parent,
+ "%s: %ld: ISR=%08x, ICR=%08x, IBMR=%02x\n",
__func__, (long)jiffies, ISR, ICR, IBMR);
if ((ISR & (ISR_UB|ISR_IBB)) == 0 ||
(ISR & ISR_SAD) != 0 ||
(ICR & ICR_SCLE) == 0) {
if (i2c_debug > 1)
- dev_dbg(&i2c->adap.dev, "%s: done\n", __func__);
+ dev_dbg(i2c->adap.dev.parent,
+ "%s: done\n", __func__);
return 1;
}
@@ -284,7 +295,8 @@ static int i2c_pxa_wait_slave(struct pxa
}
if (i2c_debug > 0)
- dev_dbg(&i2c->adap.dev, "%s: did not free\n", __func__);
+ dev_dbg(i2c->adap.dev.parent,
+ "%s: did not free\n", __func__);
return 0;
}
@@ -308,7 +320,7 @@ static void i2c_pxa_set_slave(struct pxa
}
if (!i2c_pxa_wait_slave(i2c)) {
- dev_err(&i2c->adap.dev, "%s: wait timedout\n",
+ dev_err(i2c->adap.dev.parent, "%s: wait timedout\n",
__func__);
return;
}
@@ -318,7 +330,8 @@ static void i2c_pxa_set_slave(struct pxa
ICR &= ~ICR_SCLE;
if (i2c_debug) {
- dev_dbg(&i2c->adap.dev, "ICR now %08x, ISR %08x\n", ICR, ISR);
+ dev_dbg(i2c->adap.dev.parent,
+ "ICR now %08x, ISR %08x\n", ICR, ISR);
decode_ICR(ICR);
}
}
@@ -344,7 +357,7 @@ static void i2c_pxa_reset(struct pxa_i2c
ICR = I2C_ICR_INIT;
#ifdef CONFIG_I2C_PXA_SLAVE
- dev_info(&i2c->adap.dev, "Enabling slave mode\n");
+ dev_info(i2c->adap.dev.parent, "Enabling slave mode\n");
ICR |= ICR_SADIE | ICR_ALDIE | ICR_SSDIE;
#endif
@@ -391,7 +404,7 @@ static void i2c_pxa_slave_start(struct p
int timeout;
if (i2c_debug > 0)
- dev_dbg(&i2c->adap.dev, "SAD, mode is slave-%cx\n",
+ dev_dbg(i2c->adap.dev.parent, "SAD, mode is slave-%cx\n",
(isr & ISR_RWM) ? 'r' : 't');
if (i2c->slave != NULL)
@@ -415,7 +428,8 @@ static void i2c_pxa_slave_start(struct p
timeout--;
if (timeout <= 0) {
- dev_err(&i2c->adap.dev, "timeout waiting for SCL high\n");
+ dev_err(i2c->adap.dev.parent,
+ "timeout waiting for SCL high\n");
break;
}
}
@@ -426,13 +440,14 @@ static void i2c_pxa_slave_start(struct p
static void i2c_pxa_slave_stop(struct pxa_i2c *i2c)
{
if (i2c_debug > 2)
- dev_dbg(&i2c->adap.dev, "ISR: SSD (Slave Stop)\n");
+ dev_dbg(i2c->adap.dev.parent, "ISR: SSD (Slave Stop)\n");
if (i2c->slave != NULL)
i2c->slave->event(i2c->slave->data, I2C_SLAVE_EVENT_STOP);
if (i2c_debug > 2)
- dev_dbg(&i2c->adap.dev, "ISR: SSD (Slave Stop) acked\n");
+ dev_dbg(i2c->adap.dev.parent,
+ "ISR: SSD (Slave Stop) acked\n");
/*
* If we have a master-mode message waiting,
@@ -478,7 +493,8 @@ static void i2c_pxa_slave_start(struct p
timeout--;
if (timeout <= 0) {
- dev_err(&i2c->adap.dev, "timeout waiting for SCL high\n");
+ dev_err(i2c->adap.dev.parent,
+ "timeout waiting for SCL high\n");
break;
}
}
@@ -536,7 +552,8 @@ static int i2c_pxa_do_xfer(struct pxa_i2
*/
ret = i2c_pxa_wait_bus_not_busy(i2c);
if (ret) {
- dev_err(&i2c->adap.dev, "i2c_pxa: timeout waiting for bus free\n");
+ dev_err(i2c->adap.dev.parent,
+ "i2c_pxa: timeout waiting for bus free\n");
goto out;
}
@@ -545,7 +562,8 @@ static int i2c_pxa_do_xfer(struct pxa_i2
*/
ret = i2c_pxa_set_master(i2c);
if (ret) {
- dev_err(&i2c->adap.dev, "i2c_pxa_set_master: error %d\n", ret);
+ dev_err(i2c->adap.dev.parent,
+ "i2c_pxa_set_master: error %d\n", ret);
goto out;
}
@@ -733,7 +751,8 @@ static irqreturn_t i2c_pxa_handler(int t
u32 isr = ISR;
if (i2c_debug > 2 && 0) {
- dev_dbg(&i2c->adap.dev, "%s: ISR=%08x, ICR=%08x, IBMR=%02x\n",
+ dev_dbg(i2c->adap.dev.parent,
+ "%s: ISR=%08x, ICR=%08x, IBMR=%02x\n",
__func__, isr, ICR, IBMR);
decode_ISR(isr);
}
@@ -788,7 +807,8 @@ static int i2c_pxa_xfer(struct i2c_adapt
goto out;
if (i2c_debug)
- dev_dbg(&adap->dev, "Retrying transmission\n");
+ dev_dbg(adap->dev.parent,
+ "Retrying transmission\n");
udelay(100);
}
i2c_pxa_scream_blue_murder(i2c, "exhausted retries");
--- linux-2.6.21-pre.orig/drivers/i2c/busses/i2c-sis5595.c 2007-02-18 10:41:54.000000000 +0100
+++ linux-2.6.21-pre/drivers/i2c/busses/i2c-sis5595.c 2007-02-18 10:57:18.000000000 +0100
@@ -223,6 +223,7 @@ error:
static int sis5595_transaction(struct i2c_adapter *adap)
{
+ struct device *dev = adap->dev.parent;
int temp;
int result = 0;
int timeout = 0;
@@ -230,14 +231,14 @@ static int sis5595_transaction(struct i2
/* Make sure the SMBus host is ready to start transmitting */
temp = sis5595_read(SMB_STS_LO) + (sis5595_read(SMB_STS_HI) << 8);
if (temp != 0x00) {
- dev_dbg(&adap->dev, "SMBus busy (%04x). Resetting...\n", temp);
+ dev_dbg(dev, "SMBus busy (%04x). Resetting...\n", temp);
sis5595_write(SMB_STS_LO, temp & 0xff);
sis5595_write(SMB_STS_HI, temp >> 8);
if ((temp = sis5595_read(SMB_STS_LO) + (sis5595_read(SMB_STS_HI) << 8)) != 0x00) {
- dev_dbg(&adap->dev, "Failed! (%02x)\n", temp);
+ dev_dbg(dev, "Failed! (%02x)\n", temp);
return -1;
} else {
- dev_dbg(&adap->dev, "Successfull!\n");
+ dev_dbg(dev, "Successful!\n");
}
}
@@ -252,17 +253,17 @@ static int sis5595_transaction(struct i2
/* If the SMBus is still busy, we give up */
if (timeout >= MAX_TIMEOUT) {
- dev_dbg(&adap->dev, "SMBus Timeout!\n");
+ dev_dbg(dev, "SMBus Timeout!\n");
result = -1;
}
if (temp & 0x10) {
- dev_dbg(&adap->dev, "Error: Failed bus transaction\n");
+ dev_dbg(dev, "Error: Failed bus transaction\n");
result = -1;
}
if (temp & 0x20) {
- dev_err(&adap->dev, "Bus collision! SMBus may be locked until "
+ dev_err(dev, "Bus collision! SMBus may be locked until "
"next hard reset (or not...)\n");
/* Clock stops and slave is stuck in mid-transmission */
result = -1;
@@ -276,7 +277,8 @@ static int sis5595_transaction(struct i2
temp = sis5595_read(SMB_STS_LO) + (sis5595_read(SMB_STS_HI) << 8);
if (temp != 0x00)
- dev_dbg(&adap->dev, "Failed reset at end of transaction (%02x)\n", temp);
+ dev_dbg(dev, "Failed reset at end of transaction "
+ "(%02x)\n", temp);
return result;
}
--- linux-2.6.21-pre.orig/drivers/i2c/busses/i2c-sis630.c 2007-02-18 10:41:54.000000000 +0100
+++ linux-2.6.21-pre/drivers/i2c/busses/i2c-sis630.c 2007-02-18 10:57:18.000000000 +0100
@@ -128,22 +128,23 @@ static int sis630_transaction_start(stru
/* Make sure the SMBus host is ready to start transmitting. */
if ((temp = sis630_read(SMB_CNT) & 0x03) != 0x00) {
- dev_dbg(&adap->dev, "SMBus busy (%02x).Resetting...\n",temp);
+ dev_dbg(adap->dev.parent,
+ "SMBus busy (%02x). Resetting...\n", temp);
/* kill smbus transaction */
sis630_write(SMBHOST_CNT, 0x20);
if ((temp = sis630_read(SMB_CNT) & 0x03) != 0x00) {
- dev_dbg(&adap->dev, "Failed! (%02x)\n", temp);
+ dev_dbg(adap->dev.parent, "Failed! (%02x)\n", temp);
return -1;
} else {
- dev_dbg(&adap->dev, "Successfull!\n");
+ dev_dbg(adap->dev.parent, "Successful!\n");
}
}
/* save old clock, so we can prevent machine for hung */
*oldclock = sis630_read(SMB_CNT);
- dev_dbg(&adap->dev, "saved clock 0x%02x\n", *oldclock);
+ dev_dbg(adap->dev.parent, "saved clock 0x%02x\n", *oldclock);
/* disable timeout interrupt , set Host Master Clock to 56KHz if requested */
if (high_clock)
@@ -176,17 +177,17 @@ static int sis630_transaction_wait(struc
/* If the SMBus is still busy, we give up */
if (timeout >= MAX_TIMEOUT) {
- dev_dbg(&adap->dev, "SMBus Timeout!\n");
+ dev_dbg(adap->dev.parent, "SMBus Timeout!\n");
result = -1;
}
if (temp & 0x02) {
- dev_dbg(&adap->dev, "Error: Failed bus transaction\n");
+ dev_dbg(adap->dev.parent, "Error: Failed bus transaction\n");
result = -1;
}
if (temp & 0x04) {
- dev_err(&adap->dev, "Bus collision!\n");
+ dev_err(adap->dev.parent, "Bus collision!\n");
result = -1;
/*
TBD: Datasheet say:
@@ -205,7 +206,8 @@ static void sis630_transaction_end(struc
/* clear all status "sticky" bits */
sis630_write(SMB_STS, temp);
- dev_dbg(&adap->dev, "SMB_CNT before clock restore 0x%02x\n", sis630_read(SMB_CNT));
+ dev_dbg(adap->dev.parent,
+ "SMB_CNT before clock restore 0x%02x\n", sis630_read(SMB_CNT));
/*
* restore old Host Master Clock if high_clock is set
@@ -214,7 +216,8 @@ static void sis630_transaction_end(struc
if (high_clock && !(oldclock & 0x20))
sis630_write(SMB_CNT,(sis630_read(SMB_CNT) & ~0x20));
- dev_dbg(&adap->dev, "SMB_CNT after clock restore 0x%02x\n", sis630_read(SMB_CNT));
+ dev_dbg(adap->dev.parent,
+ "SMB_CNT after clock restore 0x%02x\n", sis630_read(SMB_CNT));
}
static int sis630_transaction(struct i2c_adapter *adap, int size)
@@ -244,19 +247,24 @@ static int sis630_block_data(struct i2c_
len = 32;
sis630_write(SMB_COUNT, len);
for (i=1; i <= len; i++) {
- dev_dbg(&adap->dev, "set data 0x%02x\n", data->block[i]);
+ dev_dbg(adap->dev.parent,
+ "set data 0x%02x\n", data->block[i]);
/* set data */
sis630_write(SMB_BYTE+(i-1)%8, data->block[i]);
if (i==8 || (len<8 && i==len)) {
- dev_dbg(&adap->dev, "start trans len=%d i=%d\n",len ,i);
+ dev_dbg(adap->dev.parent,
+ "start trans len=%d i=%d\n", len, i);
/* first transaction */
if (sis630_transaction_start(adap, SIS630_BLOCK_DATA, &oldclock))
return -1;
}
else if ((i-1)%8 == 7 || i==len) {
- dev_dbg(&adap->dev, "trans_wait len=%d i=%d\n",len,i);
+ dev_dbg(adap->dev.parent,
+ "trans_wait len=%d i=%d\n", len, i);
if (i>8) {
- dev_dbg(&adap->dev, "clear smbary_sts len=%d i=%d\n",len,i);
+ dev_dbg(adap->dev.parent,
+ "clear smbary_sts "
+ "len=%d i=%d\n", len, i);
/*
If this is not first transaction,
we must clear sticky bit.
@@ -265,7 +273,8 @@ static int sis630_block_data(struct i2c_
sis630_write(SMB_STS,0x10);
}
if (sis630_transaction_wait(adap, SIS630_BLOCK_DATA)) {
- dev_dbg(&adap->dev, "trans_wait failed\n");
+ dev_dbg(adap->dev.parent,
+ "trans_wait failed\n");
rc = -1;
break;
}
@@ -280,7 +289,8 @@ static int sis630_block_data(struct i2c_
}
do {
if (sis630_transaction_wait(adap, SIS630_BLOCK_DATA)) {
- dev_dbg(&adap->dev, "trans_wait failed\n");
+ dev_dbg(adap->dev.parent,
+ "trans_wait failed\n");
rc = -1;
break;
}
@@ -292,14 +302,17 @@ static int sis630_block_data(struct i2c_
if (data->block[0] > 32)
data->block[0] = 32;
- dev_dbg(&adap->dev, "block data read len=0x%x\n", data->block[0]);
+ dev_dbg(adap->dev.parent,
+ "block data read len=0x%x\n", data->block[0]);
for (i=0; i < 8 && len < data->block[0]; i++,len++) {
- dev_dbg(&adap->dev, "read i=%d len=%d\n", i, len);
+ dev_dbg(adap->dev.parent,
+ "read i=%d len=%d\n", i, len);
data->block[len+1] = sis630_read(SMB_BYTE+i);
}
- dev_dbg(&adap->dev, "clear smbary_sts len=%d i=%d\n",len,i);
+ dev_dbg(adap->dev.parent,
+ "clear smbary_sts len=%d i=%d\n", len, i);
/* clear SMBARY_STS */
sis630_write(SMB_STS,0x10);
--- linux-2.6.21-pre.orig/drivers/i2c/busses/i2c-sis96x.c 2007-02-18 10:41:54.000000000 +0100
+++ linux-2.6.21-pre/drivers/i2c/busses/i2c-sis96x.c 2007-02-18 10:57:18.000000000 +0100
@@ -93,27 +93,27 @@ static inline void sis96x_write(u8 reg,
*/
static int sis96x_transaction(int size)
{
+ struct device *dev = sis96x_adapter.dev.parent;
int temp;
int result = 0;
int timeout = 0;
- dev_dbg(&sis96x_adapter.dev, "SMBus transaction %d\n", size);
+ dev_dbg(dev, "SMBus transaction %d\n", size);
/* Make sure the SMBus host is ready to start transmitting */
if (((temp = sis96x_read(SMB_CNT)) & 0x03) != 0x00) {
- dev_dbg(&sis96x_adapter.dev, "SMBus busy (0x%02x). "
- "Resetting...\n", temp);
+ dev_dbg(dev, "SMBus busy (0x%02x). Resetting...\n", temp);
/* kill the transaction */
sis96x_write(SMB_HOST_CNT, 0x20);
/* check it again */
if (((temp = sis96x_read(SMB_CNT)) & 0x03) != 0x00) {
- dev_dbg(&sis96x_adapter.dev, "Failed (0x%02x)\n", temp);
+ dev_dbg(dev, "Failed (0x%02x)\n", temp);
return -1;
} else {
- dev_dbg(&sis96x_adapter.dev, "Successful\n");
+ dev_dbg(dev, "Successful\n");
}
}
@@ -135,26 +135,26 @@ static int sis96x_transaction(int size)
/* If the SMBus is still busy, we give up */
if (timeout >= MAX_TIMEOUT) {
- dev_dbg(&sis96x_adapter.dev, "SMBus Timeout! (0x%02x)\n", temp);
+ dev_dbg(dev, "SMBus Timeout! (0x%02x)\n", temp);
result = -1;
}
/* device error - probably missing ACK */
if (temp & 0x02) {
- dev_dbg(&sis96x_adapter.dev, "Failed bus transaction!\n");
+ dev_dbg(dev, "Failed bus transaction!\n");
result = -1;
}
/* bus collision */
if (temp & 0x04) {
- dev_dbg(&sis96x_adapter.dev, "Bus collision!\n");
+ dev_dbg(dev, "Bus collision!\n");
result = -1;
}
/* Finish up by resetting the bus */
sis96x_write(SMB_STS, temp);
if ((temp = sis96x_read(SMB_STS))) {
- dev_dbg(&sis96x_adapter.dev, "Failed reset at "
+ dev_dbg(dev, "Failed reset at "
"end of transaction! (0x%02x)\n", temp);
}
@@ -202,12 +202,12 @@ static s32 sis96x_access(struct i2c_adap
case I2C_SMBUS_BLOCK_DATA:
/* TO DO: */
- dev_info(&adap->dev, "SMBus block not implemented!\n");
+ dev_info(adap->dev.parent, "SMBus block not implemented!\n");
return -1;
break;
default:
- dev_info(&adap->dev, "Unsupported I2C size\n");
+ dev_info(adap->dev.parent, "Unsupported I2C size\n");
return -1;
break;
}
--- linux-2.6.21-pre.orig/drivers/i2c/busses/i2c-viapro.c 2007-02-18 10:41:54.000000000 +0100
+++ linux-2.6.21-pre/drivers/i2c/busses/i2c-viapro.c 2007-02-18 10:57:18.000000000 +0100
@@ -110,7 +110,8 @@ static unsigned int vt596_features;
#ifdef DEBUG
static void vt596_dump_regs(const char *msg, u8 size)
{
- dev_dbg(&vt596_adapter.dev, "%s: STS=%02x CNT=%02x CMD=%02x ADD=%02x "
+ dev_dbg(vt596_adapter.dev.parent,
+ "%s: STS=%02x CNT=%02x CMD=%02x ADD=%02x "
"DAT=%02x,%02x\n", msg, inb_p(SMBHSTSTS), inb_p(SMBHSTCNT),
inb_p(SMBHSTCMD), inb_p(SMBHSTADD), inb_p(SMBHSTDAT0),
inb_p(SMBHSTDAT1));
@@ -119,11 +120,11 @@ static void vt596_dump_regs(const char *
|| size == VT596_I2C_BLOCK_DATA) {
int i;
- dev_dbg(&vt596_adapter.dev, "BLK=");
+ dev_dbg(vt596_adapter.dev.parent, "BLK=");
for (i = 0; i < I2C_SMBUS_BLOCK_MAX / 2; i++)
printk("%02x,", inb_p(SMBBLKDAT));
printk("\n");
- dev_dbg(&vt596_adapter.dev, " ");
+ dev_dbg(vt596_adapter.dev.parent, " ");
for (; i < I2C_SMBUS_BLOCK_MAX - 1; i++)
printk("%02x,", inb_p(SMBBLKDAT));
printk("%02x\n", inb_p(SMBBLKDAT));
@@ -136,6 +137,7 @@ static inline void vt596_dump_regs(const
/* Return -1 on error, 0 on success */
static int vt596_transaction(u8 size)
{
+ struct device *dev = vt596_adapter.dev.parent;
int temp;
int result = 0;
int timeout = 0;
@@ -144,12 +146,12 @@ static int vt596_transaction(u8 size)
/* Make sure the SMBus host is ready to start transmitting */
if ((temp = inb_p(SMBHSTSTS)) & 0x1F) {
- dev_dbg(&vt596_adapter.dev, "SMBus busy (0x%02x). "
+ dev_dbg(dev, "SMBus busy (0x%02x). "
"Resetting...\n", temp);
outb_p(temp, SMBHSTSTS);
if ((temp = inb_p(SMBHSTSTS)) & 0x1F) {
- dev_err(&vt596_adapter.dev, "SMBus reset failed! "
+ dev_err(dev, "SMBus reset failed! "
"(0x%02x)\n", temp);
return -1;
}
@@ -167,18 +169,18 @@ static int vt596_transaction(u8 size)
/* If the SMBus is still busy, we give up */
if (timeout >= MAX_TIMEOUT) {
result = -1;
- dev_err(&vt596_adapter.dev, "SMBus timeout!\n");
+ dev_err(dev, "SMBus timeout!\n");
}
if (temp & 0x10) {
result = -1;
- dev_err(&vt596_adapter.dev, "Transaction failed (0x%02x)\n",
+ dev_err(dev, "Transaction failed (0x%02x)\n",
size);
}
if (temp & 0x08) {
result = -1;
- dev_err(&vt596_adapter.dev, "SMBus collision!\n");
+ dev_err(dev, "SMBus collision!\n");
}
if (temp & 0x04) {
@@ -189,7 +191,7 @@ static int vt596_transaction(u8 size)
to frighten the user. */
if (!((size == VT596_QUICK && !read) ||
(size == VT596_BYTE && read)))
- dev_err(&vt596_adapter.dev, "Transaction error!\n");
+ dev_err(dev, "Transaction error!\n");
}
/* Resetting status register */
@@ -284,7 +286,8 @@ static s32 vt596_access(struct i2c_adapt
return 0;
exit_unsupported:
- dev_warn(&vt596_adapter.dev, "Unsupported command invoked! (0x%02x)\n",
+ dev_warn(vt596_adapter.dev.parent,
+ "Unsupported command invoked! (0x%02x)\n",
size);
return -1;
}
--- linux-2.6.21-pre.orig/drivers/media/dvb/frontends/nxt200x.c 2007-02-18 12:52:49.000000000 +0100
+++ linux-2.6.21-pre/drivers/media/dvb/frontends/nxt200x.c 2007-02-18 12:53:04.000000000 +0100
@@ -888,7 +888,8 @@ static int nxt2002_init(struct dvb_front
/* request the firmware, this will block until someone uploads it */
printk("nxt2002: Waiting for firmware upload (%s)...\n", NXT2002_DEFAULT_FIRMWARE);
- ret = request_firmware(&fw, NXT2002_DEFAULT_FIRMWARE, &state->i2c->dev);
+ ret = request_firmware(&fw, NXT2002_DEFAULT_FIRMWARE,
+ state->i2c->dev.parent);
printk("nxt2002: Waiting for firmware upload(2)...\n");
if (ret) {
printk("nxt2002: No firmware uploaded (timeout or file not found?)\n");
@@ -952,7 +953,8 @@ static int nxt2004_init(struct dvb_front
/* request the firmware, this will block until someone uploads it */
printk("nxt2004: Waiting for firmware upload (%s)...\n", NXT2004_DEFAULT_FIRMWARE);
- ret = request_firmware(&fw, NXT2004_DEFAULT_FIRMWARE, &state->i2c->dev);
+ ret = request_firmware(&fw, NXT2004_DEFAULT_FIRMWARE,
+ state->i2c->dev.parent);
printk("nxt2004: Waiting for firmware upload(2)...\n");
if (ret) {
printk("nxt2004: No firmware uploaded (timeout or file not found?)\n");
--- linux-2.6.21-pre.orig/drivers/media/dvb/frontends/or51132.c 2007-02-18 12:52:49.000000000 +0100
+++ linux-2.6.21-pre/drivers/media/dvb/frontends/or51132.c 2007-02-18 12:53:04.000000000 +0100
@@ -362,7 +362,7 @@ static int or51132_set_parameters(struct
}
printk("or51132: Waiting for firmware upload(%s)...\n",
fwname);
- ret = request_firmware(&fw, fwname, &state->i2c->dev);
+ ret = request_firmware(&fw, fwname, state->i2c->dev.parent);
if (ret) {
printk(KERN_WARNING "or51132: No firmware up"
"loaded(timeout or file not found?)\n");
--- linux-2.6.21-pre.orig/drivers/media/video/cx25840/cx25840-firmware.c 2007-02-18 12:52:49.000000000 +0100
+++ linux-2.6.21-pre/drivers/media/video/cx25840/cx25840-firmware.c 2007-02-18 12:53:04.000000000 +0100
@@ -37,7 +37,7 @@
*/
#define FWSEND 48
-#define FWDEV(x) &((x)->adapter->dev)
+#define FWDEV(x) ((x)->adapter->dev.parent)
static char *firmware = FWFILE;
--- linux-2.6.21-pre.orig/drivers/video/fb_ddc.c 2007-02-18 12:52:49.000000000 +0100
+++ linux-2.6.21-pre/drivers/video/fb_ddc.c 2007-02-18 12:53:04.000000000 +0100
@@ -36,15 +36,15 @@ static unsigned char *fb_do_probe_ddc_ed
};
if (!buf) {
- dev_warn(&adapter->dev, "unable to allocate memory for EDID "
- "block.\n");
+ dev_warn(adapter->dev.parent,
+ "unable to allocate memory for EDID block.\n");
return NULL;
}
if (i2c_transfer(adapter, msgs, 2) == 2)
return buf;
- dev_warn(&adapter->dev, "unable to read EDID block.\n");
+ dev_warn(adapter->dev.parent, "unable to read EDID block.\n");
kfree(buf);
return NULL;
}
--
Jean Delvare
More information about the i2c
mailing list