[i2c] [patch 2.6.20-rc1 2/6] I2C adapters (mostly) stop using i2c_adapter.dev
David Brownell
david-b at pacbell.net
Sun Dec 17 19:48:36 CET 2006
This updates I2C adapter drivers to stop using i2c_adapter.dev,
using i2c_adapter.class_dev instead.
Signed-off-by: David Brownell <dbrownell at users.sourceforge.net>
---
drivers/i2c/busses/i2c-ali1535.c | 28 +++++++-----
drivers/i2c/busses/i2c-ali1563.c | 33 ++++++++------
drivers/i2c/busses/i2c-ali15x3.c | 30 +++++++------
drivers/i2c/busses/i2c-amd756-s4882.c | 11 ++--
drivers/i2c/busses/i2c-amd756.c | 29 +++++++-----
drivers/i2c/busses/i2c-amd8111.c | 3 -
drivers/i2c/busses/i2c-at91.c | 15 +++---
drivers/i2c/busses/i2c-isa.c | 32 +++++++-------
drivers/i2c/busses/i2c-nforce2.c | 12 +++--
drivers/i2c/busses/i2c-piix4.c | 30 +++++++------
drivers/i2c/busses/i2c-pnx.c | 77 ++++++++++++++++++----------------
drivers/i2c/busses/i2c-pxa.c | 72 ++++++++++++++++++++-----------
drivers/i2c/busses/i2c-s3c2410.c | 7 +--
drivers/i2c/busses/i2c-sis5595.c | 17 ++++---
drivers/i2c/busses/i2c-sis630.c | 50 ++++++++++++++--------
drivers/i2c/busses/i2c-sis96x.c | 25 ++++++-----
drivers/i2c/busses/i2c-stub.c | 23 ++++++----
drivers/i2c/busses/i2c-viapro.c | 25 ++++++-----
drivers/i2c/busses/scx200_acb.c | 18 ++++---
19 files changed, 319 insertions(+), 218 deletions(-)
Index: g26/drivers/i2c/busses/i2c-nforce2.c
===================================================================
--- g26.orig/drivers/i2c/busses/i2c-nforce2.c 2006-12-16 15:51:11.000000000 -0800
+++ g26/drivers/i2c/busses/i2c-nforce2.c 2006-12-16 15:52:19.000000000 -0800
@@ -103,6 +103,7 @@ static s32 nforce2_access(struct i2c_ada
{
struct nforce2_smbus *smbus = adap->algo_data;
unsigned char protocol, pec, temp;
+ struct device *dev = adap->class_dev.dev;
protocol = (read_write == I2C_SMBUS_READ) ? NVIDIA_SMB_PRTCL_READ :
NVIDIA_SMB_PRTCL_WRITE;
@@ -138,7 +139,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;
}
@@ -157,7 +158,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;
}
@@ -233,7 +234,7 @@ static int __devinit nforce2_probe_smb (
smbus->dev = dev;
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;
}
@@ -247,11 +248,12 @@ 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(smbus->adapter.class_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.class_dev.dev, "%s\n", smbus->adapter.name);
return 0;
}
Index: g26/drivers/i2c/busses/i2c-amd8111.c
===================================================================
--- g26.orig/drivers/i2c/busses/i2c-amd8111.c 2006-12-16 15:51:11.000000000 -0800
+++ g26/drivers/i2c/busses/i2c-amd8111.c 2006-12-16 15:52:19.000000000 -0800
@@ -254,7 +254,8 @@ static s32 amd8111_access(struct i2c_ada
break;
default:
- dev_warn(&adap->dev, "Unsupported transaction %d\n", size);
+ dev_warn(adap->class_dev.dev,
+ "Unsupported transaction %d\n", size);
return -1;
}
Index: g26/drivers/i2c/busses/i2c-sis630.c
===================================================================
--- g26.orig/drivers/i2c/busses/i2c-sis630.c 2006-12-16 15:51:11.000000000 -0800
+++ g26/drivers/i2c/busses/i2c-sis630.c 2006-12-16 15:52:19.000000000 -0800
@@ -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->class_dev.dev,
+ "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->class_dev.dev, "Failed! (%02x)\n", temp);
return -1;
} else {
- dev_dbg(&adap->dev, "Successfull!\n");
+ dev_dbg(adap->class_dev.dev, "Successfull!\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->class_dev.dev, "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->class_dev.dev, "SMBus Timeout!\n");
result = -1;
}
if (temp & 0x02) {
- dev_dbg(&adap->dev, "Error: Failed bus transaction\n");
+ dev_dbg(adap->class_dev.dev, "Error: Failed bus transaction\n");
result = -1;
}
if (temp & 0x04) {
- dev_err(&adap->dev, "Bus collision!\n");
+ dev_err(adap->class_dev.dev, "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->class_dev.dev,
+ "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->class_dev.dev,
+ "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,25 @@ 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->class_dev.dev,
+ "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->class_dev.dev,
+ "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->class_dev.dev,
+ "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->class_dev.dev,
+ "clear smbary_sts "
+ "len=%d i=%d\n",
+ len,i);
/*
If this is not first transaction,
we must clear sticky bit.
@@ -265,7 +274,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->class_dev.dev,
+ "trans_wait failed\n");
rc = -1;
break;
}
@@ -280,7 +290,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->class_dev.dev,
+ "trans_wait failed\n");
rc = -1;
break;
}
@@ -292,14 +303,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->class_dev.dev,
+ "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->class_dev.dev,
+ "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->class_dev.dev,
+ "clear smbary_sts len=%d i=%d\n",len,i);
/* clear SMBARY_STS */
sis630_write(SMB_STS,0x10);
Index: g26/drivers/i2c/busses/i2c-amd756.c
===================================================================
--- g26.orig/drivers/i2c/busses/i2c-amd756.c 2006-12-16 15:51:11.000000000 -0800
+++ g26/drivers/i2c/busses/i2c-amd756.c 2006-12-16 15:52:19.000000000 -0800
@@ -115,14 +115,16 @@ static int amd756_transaction(struct i2c
int result = 0;
int timeout = 0;
- dev_dbg(&adap->dev, "Transaction (pre): GS=%04x, GE=%04x, ADD=%04x, "
+ dev_dbg(adap->class_dev.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(adap->class_dev.dev,
+ "SMBus busy (%04x). Waiting...\n", temp);
do {
msleep(1);
temp = inw_p(SMB_GLOBAL_STATUS);
@@ -130,7 +132,8 @@ 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(adap->class_dev.dev,
+ "Busy wait timeout (%04x)\n", temp);
goto abort;
}
timeout = 0;
@@ -147,38 +150,39 @@ 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(adap->class_dev.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(adap->class_dev.dev,
+ "SMBus Protocol error (no response)!\n");
}
if (temp & GS_COL_STS) {
result = -1;
- dev_warn(&adap->dev, "SMBus collision!\n");
+ dev_warn(adap->class_dev.dev, "SMBus collision!\n");
}
if (temp & GS_TO_STS) {
result = -1;
- dev_dbg(&adap->dev, "SMBus protocol timeout!\n");
+ dev_dbg(adap->class_dev.dev, "SMBus protocol timeout!\n");
}
if (temp & GS_HCYC_STS)
- dev_dbg(&adap->dev, "SMBus protocol success!\n");
+ dev_dbg(adap->class_dev.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(adap->class_dev.dev,
"Failed reset at end of transaction (%04x)\n", temp);
}
#endif
- dev_dbg(&adap->dev,
+ dev_dbg(adap->class_dev.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));
@@ -186,7 +190,7 @@ static int amd756_transaction(struct i2c
return result;
abort:
- dev_warn(&adap->dev, "Sending abort\n");
+ dev_warn(adap->class_dev.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);
@@ -203,7 +207,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->class_dev.dev,
+ "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:
Index: g26/drivers/i2c/busses/i2c-ali1563.c
===================================================================
--- g26.orig/drivers/i2c/busses/i2c-ali1563.c 2006-12-16 15:51:11.000000000 -0800
+++ g26/drivers/i2c/busses/i2c-ali1563.c 2006-12-16 15:52:19.000000000 -0800
@@ -68,7 +68,7 @@ static int ali1563_transaction(struct i2
u32 data;
int timeout;
- dev_dbg(&a->dev, "Transaction (pre): STS=%02x, CNTL1=%02x, "
+ dev_dbg(a->class_dev.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 +76,8 @@ 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(a->class_dev.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(a->class_dev.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,26 +100,27 @@ static int ali1563_transaction(struct i2
return 0;
if (!timeout) {
- dev_err(&a->dev, "Timeout - Trying to KILL transaction!\n");
+ dev_err(a->class_dev.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);
- }
+ }
/* 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(a->class_dev.dev, "Device error!\n");
}
/* bus collision */
if (data & HST_STS_BUSERR) {
- dev_err(&a->dev, "Bus collision!\n");
+ dev_err(a->class_dev.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(a->class_dev.dev, "Cleaning fail after KILL!\n");
outb_p(0x0,SMB_HST_CNTL2);
}
@@ -130,7 +132,7 @@ static int ali1563_block_start(struct i2
u32 data;
int timeout;
- dev_dbg(&a->dev, "Block (pre): STS=%02x, CNTL1=%02x, "
+ dev_dbg(a->class_dev.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,8 @@ 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(a->class_dev.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 +159,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(a->class_dev.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 +167,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(a->class_dev.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 +233,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->class_dev.dev,
+ "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->class_dev.dev,
+ "I2C_SMBUS_PROC_CALL not supported!\n");
error = -EINVAL;
break;
case I2C_SMBUS_QUICK:
Index: g26/drivers/i2c/busses/i2c-viapro.c
===================================================================
--- g26.orig/drivers/i2c/busses/i2c-viapro.c 2006-12-16 15:51:11.000000000 -0800
+++ g26/drivers/i2c/busses/i2c-viapro.c 2006-12-16 15:52:19.000000000 -0800
@@ -109,7 +109,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.class_dev.dev,
+ "%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));
@@ -118,11 +119,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.class_dev.dev, "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.class_dev.dev, " ");
for (; i < I2C_SMBUS_BLOCK_MAX - 1; i++)
printk("%02x,", inb_p(SMBBLKDAT));
printk("%02x\n", inb_p(SMBBLKDAT));
@@ -143,12 +144,13 @@ 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(vt596_adapter.class_dev.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(vt596_adapter.class_dev.dev,
+ "SMBus reset failed! "
"(0x%02x)\n", temp);
return -1;
}
@@ -166,18 +168,19 @@ 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(vt596_adapter.class_dev.dev, "SMBus timeout!\n");
}
if (temp & 0x10) {
result = -1;
- dev_err(&vt596_adapter.dev, "Transaction failed (0x%02x)\n",
+ dev_err(vt596_adapter.class_dev.dev,
+ "Transaction failed (0x%02x)\n",
size);
}
if (temp & 0x08) {
result = -1;
- dev_err(&vt596_adapter.dev, "SMBus collision!\n");
+ dev_err(vt596_adapter.class_dev.dev, "SMBus collision!\n");
}
if (temp & 0x04) {
@@ -188,7 +191,8 @@ 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(vt596_adapter.class_dev.dev,
+ "Transaction error!\n");
}
/* Resetting status register */
@@ -283,7 +287,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.class_dev.dev,
+ "Unsupported command invoked! (0x%02x)\n",
size);
return -1;
}
Index: g26/drivers/i2c/busses/i2c-pxa.c
===================================================================
--- g26.orig/drivers/i2c/busses/i2c-pxa.c 2006-12-16 15:51:11.000000000 -0800
+++ g26/drivers/i2c/busses/i2c-pxa.c 2006-12-16 15:52:19.000000000 -0800
@@ -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.class_dev.dev,
+ "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.class_dev.dev,
+ "%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.class_dev.dev,
+ "%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.class_dev.dev,
+ "%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.class_dev.dev,
+ "%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.class_dev.dev,
+ "%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.class_dev.dev, "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.class_dev.dev,
+ "%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.class_dev.dev,
+ "%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.class_dev.dev,
+ "%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.class_dev.dev,
+ "%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.class_dev.dev,
+ "%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.class_dev.dev, "%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.class_dev.dev,
+ "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.class_dev.dev, "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.class_dev.dev, "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.class_dev.dev,
+ "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.class_dev.dev, "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.class_dev.dev,
+ "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.class_dev.dev,
+ "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.class_dev.dev,
+ "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.class_dev.dev,
+ "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.class_dev.dev,
+ "%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->class_dev.dev,
+ "Retrying transmission\n");
udelay(100);
}
i2c_pxa_scream_blue_murder(i2c, "exhausted retries");
@@ -863,10 +883,10 @@ static int i2c_pxa_probe(struct platform
#ifdef CONFIG_I2C_PXA_SLAVE
printk(KERN_INFO "I2C: %s: PXA I2C adapter, slave address %d\n",
- i2c->adap.dev.bus_id, i2c->slave_addr);
+ i2c->adap.class_dev.class_id, i2c->slave_addr);
#else
printk(KERN_INFO "I2C: %s: PXA I2C adapter\n",
- i2c->adap.dev.bus_id);
+ i2c->adap.class_dev.class_id);
#endif
return 0;
Index: g26/drivers/i2c/busses/i2c-sis5595.c
===================================================================
--- g26.orig/drivers/i2c/busses/i2c-sis5595.c 2006-12-16 15:51:11.000000000 -0800
+++ g26/drivers/i2c/busses/i2c-sis5595.c 2006-12-16 15:52:19.000000000 -0800
@@ -230,14 +230,15 @@ 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(adap->class_dev.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(adap->class_dev.dev, "Failed! (%02x)\n", temp);
return -1;
} else {
- dev_dbg(&adap->dev, "Successfull!\n");
+ dev_dbg(adap->class_dev.dev, "Successfull!\n");
}
}
@@ -252,17 +253,18 @@ 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(adap->class_dev.dev, "SMBus Timeout!\n");
result = -1;
}
if (temp & 0x10) {
- dev_dbg(&adap->dev, "Error: Failed bus transaction\n");
+ dev_dbg(adap->class_dev.dev, "Error: Failed bus transaction\n");
result = -1;
}
if (temp & 0x20) {
- dev_err(&adap->dev, "Bus collision! SMBus may be locked until "
+ dev_err(adap->class_dev.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 +278,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(adap->class_dev.dev,
+ "Failed reset at end of transaction (%02x)\n", temp);
return result;
}
Index: g26/drivers/i2c/busses/i2c-s3c2410.c
===================================================================
--- g26.orig/drivers/i2c/busses/i2c-s3c2410.c 2006-12-16 15:51:11.000000000 -0800
+++ g26/drivers/i2c/busses/i2c-s3c2410.c 2006-12-16 15:52:19.000000000 -0800
@@ -694,7 +694,7 @@ static int s3c24xx_i2c_init(struct s3c24
/* get the plafrom data */
- pdata = s3c24xx_i2c_get_platformdata(i2c->adap.dev.parent);
+ pdata = s3c24xx_i2c_get_platformdata(i2c->adap.class_dev.dev);
/* inititalise the gpio */
@@ -836,7 +836,7 @@ static int s3c24xx_i2c_probe(struct plat
}
i2c->irq = res;
-
+
dev_dbg(&pdev->dev, "irq resource %p (%ld)\n", res, res->start);
ret = i2c_add_adapter(&i2c->adap);
@@ -847,7 +847,8 @@ static int s3c24xx_i2c_probe(struct plat
platform_set_drvdata(pdev, i2c);
- dev_info(&pdev->dev, "%s: S3C I2C adapter\n", i2c->adap.dev.bus_id);
+ dev_info(&pdev->dev, "%s: S3C I2C adapter\n",
+ i2c->adap.class_dev.class_id);
out:
if (ret < 0)
Index: g26/drivers/i2c/busses/i2c-piix4.c
===================================================================
--- g26.orig/drivers/i2c/busses/i2c-piix4.c 2006-12-16 15:51:11.000000000 -0800
+++ g26/drivers/i2c/busses/i2c-piix4.c 2006-12-16 15:52:19.000000000 -0800
@@ -213,21 +213,23 @@ static int piix4_transaction(void)
int result = 0;
int timeout = 0;
- dev_dbg(&piix4_adapter.dev, "Transaction (pre): CNT=%02x, CMD=%02x, "
+ dev_dbg(piix4_adapter.class_dev.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(piix4_adapter.class_dev.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(piix4_adapter.class_dev.dev,
+ "Failed! (%02x)\n", temp);
return -1;
} else {
- dev_dbg(&piix4_adapter.dev, "Successfull!\n");
+ dev_dbg(piix4_adapter.class_dev.dev, "Successfull!\n");
}
}
@@ -242,35 +244,38 @@ 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(piix4_adapter.class_dev.dev, "SMBus Timeout!\n");
result = -1;
}
if (temp & 0x10) {
result = -1;
- dev_err(&piix4_adapter.dev, "Error: Failed bus transaction\n");
+ dev_err(piix4_adapter.class_dev.dev,
+ "Error: Failed bus transaction\n");
}
if (temp & 0x08) {
result = -1;
- dev_dbg(&piix4_adapter.dev, "Bus collision! SMBus may be "
+ dev_dbg(piix4_adapter.class_dev.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(piix4_adapter.class_dev.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 "
- "transaction (%02x)\n", temp);
+ dev_err(piix4_adapter.class_dev.dev,
+ "Failed reset at end of transaction (%02x)\n", temp);
}
- dev_dbg(&piix4_adapter.dev, "Transaction (post): CNT=%02x, CMD=%02x, "
+ dev_dbg(piix4_adapter.class_dev.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 +291,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->class_dev.dev,
+ "I2C_SMBUS_PROC_CALL not supported!\n");
return -1;
case I2C_SMBUS_QUICK:
outb_p(((addr & 0x7f) << 1) | (read_write & 0x01),
Index: g26/drivers/i2c/busses/i2c-sis96x.c
===================================================================
--- g26.orig/drivers/i2c/busses/i2c-sis96x.c 2006-12-16 15:51:11.000000000 -0800
+++ g26/drivers/i2c/busses/i2c-sis96x.c 2006-12-16 15:52:19.000000000 -0800
@@ -98,12 +98,12 @@ static int sis96x_transaction(int size)
int result = 0;
int timeout = 0;
- dev_dbg(&sis96x_adapter.dev, "SMBus transaction %d\n", size);
+ dev_dbg(sis96x_adapter.class_dev.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). "
+ dev_dbg(sis96x_adapter.class_dev.dev, "SMBus busy (0x%02x). "
"Resetting...\n", temp);
/* kill the transaction */
@@ -111,10 +111,12 @@ static int sis96x_transaction(int size)
/* check it again */
if (((temp = sis96x_read(SMB_CNT)) & 0x03) != 0x00) {
- dev_dbg(&sis96x_adapter.dev, "Failed (0x%02x)\n", temp);
+ dev_dbg(sis96x_adapter.class_dev.dev,
+ "Failed (0x%02x)\n", temp);
return -1;
} else {
- dev_dbg(&sis96x_adapter.dev, "Successful\n");
+ dev_dbg(sis96x_adapter.class_dev.dev,
+ "Successful\n");
}
}
@@ -136,26 +138,29 @@ 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(sis96x_adapter.class_dev.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(sis96x_adapter.class_dev.dev,
+ "Failed bus transaction!\n");
result = -1;
}
/* bus collision */
if (temp & 0x04) {
- dev_dbg(&sis96x_adapter.dev, "Bus collision!\n");
+ dev_dbg(sis96x_adapter.class_dev.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(sis96x_adapter.class_dev.dev, "Failed reset at "
"end of transaction! (0x%02x)\n", temp);
}
@@ -203,12 +208,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->class_dev.dev, "SMBus block not implemented!\n");
return -1;
break;
default:
- dev_info(&adap->dev, "Unsupported I2C size\n");
+ dev_info(adap->class_dev.dev, "Unsupported I2C size\n");
return -1;
break;
}
Index: g26/drivers/i2c/busses/i2c-ali15x3.c
===================================================================
--- g26.orig/drivers/i2c/busses/i2c-ali15x3.c 2006-12-16 15:51:11.000000000 -0800
+++ g26/drivers/i2c/busses/i2c-ali15x3.c 2006-12-16 15:52:19.000000000 -0800
@@ -233,7 +233,8 @@ static int ali15x3_transaction(struct i2
int result = 0;
int timeout = 0;
- dev_dbg(&adap->dev, "Transaction (pre): STS=%02x, CNT=%02x, CMD=%02x, "
+ dev_dbg(adap->class_dev.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));
@@ -265,7 +266,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(adap->class_dev.dev, "Resetting entire SMB Bus to "
"clear busy condition (%02x)\n", temp);
outb_p(ALI15X3_T_OUT, SMBHSTCNT);
temp = inb_p(SMBHSTSTS);
@@ -280,8 +281,9 @@ 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) - "
- "controller or device on bus is probably hung\n",
+ dev_err(adap->class_dev.dev,
+ "SMBus reset failed! (0x%02x) - controller "
+ "or device on bus is probably hung\n",
temp);
return -1;
}
@@ -306,12 +308,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(adap->class_dev.dev, "SMBus Timeout!\n");
}
if (temp & ALI15X3_STS_TERM) {
result = -1;
- dev_dbg(&adap->dev, "Error: Failed bus transaction\n");
+ dev_dbg(adap->class_dev.dev, "Error: Failed bus transaction\n");
}
/*
@@ -322,7 +324,7 @@ static int ali15x3_transaction(struct i2
*/
if (temp & ALI15X3_STS_COLL) {
result = -1;
- dev_dbg(&adap->dev,
+ dev_dbg(adap->class_dev.dev,
"Error: no response or bus collision ADD=%02x\n",
inb_p(SMBHSTADD));
}
@@ -330,9 +332,10 @@ static int ali15x3_transaction(struct i2
/* haven't ever seen this */
if (temp & ALI15X3_STS_DEV) {
result = -1;
- dev_err(&adap->dev, "Error: device error\n");
+ dev_err(adap->class_dev.dev, "Error: device error\n");
}
- dev_dbg(&adap->dev, "Transaction (post): STS=%02x, CNT=%02x, CMD=%02x, "
+ dev_dbg(adap->class_dev.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));
@@ -359,12 +362,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->class_dev.dev,
+ "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->class_dev.dev,
+ "I2C_SMBUS_PROC_CALL not supported!\n");
return -1;
case I2C_SMBUS_QUICK:
outb_p(((addr & 0x7f) << 1) | (read_write & 0x01),
@@ -448,7 +453,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->class_dev.dev,
+ "Blk: len=%d, i=%d, data=%02x\n",
len, i, data->block[i]);
}
break;
Index: g26/drivers/i2c/busses/i2c-ali1535.c
===================================================================
--- g26.orig/drivers/i2c/busses/i2c-ali1535.c 2006-12-16 15:51:11.000000000 -0800
+++ g26/drivers/i2c/busses/i2c-ali1535.c 2006-12-16 15:52:19.000000000 -0800
@@ -210,7 +210,7 @@ static int ali1535_transaction(struct i2
int result = 0;
int timeout = 0;
- dev_dbg(&adap->dev, "Transaction (pre): STS=%02x, TYP=%02x, "
+ dev_dbg(adap->class_dev.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));
@@ -240,7 +240,7 @@ 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,
+ dev_info(adap->class_dev.dev,
"Resetting entire SMB Bus to clear busy condition (%02x)\n",
temp);
outb_p(ALI1535_T_OUT, SMBHSTTYP);
@@ -257,7 +257,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(adap->class_dev.dev,
"SMBus reset failed! (0x%02x) - controller or "
"device on bus is probably hung\n", temp);
return -1;
@@ -283,12 +283,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(adap->class_dev.dev, "SMBus Timeout!\n");
}
if (temp & ALI1535_STS_FAIL) {
result = -1;
- dev_dbg(&adap->dev, "Error: Failed bus transaction\n");
+ dev_dbg(adap->class_dev.dev, "Error: Failed bus transaction\n");
}
/* Unfortunately the ALI SMB controller maps "no response" and "bus
@@ -297,7 +297,7 @@ static int ali1535_transaction(struct i2
*/
if (temp & ALI1535_STS_BUSERR) {
result = -1;
- dev_dbg(&adap->dev,
+ dev_dbg(adap->class_dev.dev,
"Error: no response or bus collision ADD=%02x\n",
inb_p(SMBHSTADD));
}
@@ -305,16 +305,17 @@ static int ali1535_transaction(struct i2
/* haven't ever seen this */
if (temp & ALI1535_STS_DEV) {
result = -1;
- dev_err(&adap->dev, "Error: device error\n");
+ dev_err(adap->class_dev.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(adap->class_dev.dev,
+ "Error: command never completed\n");
}
- dev_dbg(&adap->dev, "Transaction (post): STS=%02x, TYP=%02x, "
+ dev_dbg(adap->class_dev.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));
@@ -352,14 +353,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->class_dev.dev,
+ "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->class_dev.dev,
+ "I2C_SMBUS_PROC_CALL not supported!\n");
result = -1;
goto EXIT;
case I2C_SMBUS_QUICK:
@@ -451,7 +454,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->class_dev.dev,
+ "Blk: len=%d, i=%d, data=%02x\n",
len, i, data->block[i]);
}
break;
Index: g26/drivers/i2c/busses/i2c-amd756-s4882.c
===================================================================
--- g26.orig/drivers/i2c/busses/i2c-amd756-s4882.c 2006-12-16 15:51:11.000000000 -0800
+++ g26/drivers/i2c/busses/i2c-amd756-s4882.c 2006-12-16 15:52:19.000000000 -0800
@@ -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.class_dev.dev,
+ "Physical bus removal failed\n");
goto ERROR0;
}
@@ -202,7 +202,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.class_dev.dev,
+ "PCA9556 configuration failed\n");
error = -EIO;
goto ERROR3;
}
@@ -211,7 +212,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.class_dev.dev,
"Virtual adapter %d registration "
"failed, module not inserted\n", i);
for (i--; i >= 0; i--)
@@ -249,7 +250,7 @@ static void __exit amd756_s4882_exit(voi
/* Restore physical bus */
if (i2c_add_adapter(&amd756_smbus))
- dev_err(&amd756_smbus.dev, "Physical bus restoration "
+ dev_err(amd756_smbus.class_dev.dev, "Physical bus restoration "
"failed\n");
}
Index: g26/drivers/i2c/busses/i2c-stub.c
===================================================================
--- g26.orig/drivers/i2c/busses/i2c-stub.c 2006-12-16 15:51:11.000000000 -0800
+++ g26/drivers/i2c/busses/i2c-stub.c 2006-12-16 15:52:19.000000000 -0800
@@ -47,19 +47,22 @@ static s32 stub_xfer(struct i2c_adapter
switch (size) {
case I2C_SMBUS_QUICK:
- dev_dbg(&adap->dev, "smbus quick - addr 0x%02x\n", addr);
+ dev_dbg(adap->class_dev.dev,
+ "smbus quick - addr 0x%02x\n", addr);
ret = 0;
break;
case I2C_SMBUS_BYTE:
if (read_write == I2C_SMBUS_WRITE) {
stub_pointer = command;
- dev_dbg(&adap->dev, "smbus byte - addr 0x%02x, "
+ dev_dbg(adap->class_dev.dev,
+ "smbus byte - addr 0x%02x, "
"wrote 0x%02x.\n",
addr, command);
} else {
data->byte = stub_bytes[stub_pointer++];
- dev_dbg(&adap->dev, "smbus byte - addr 0x%02x, "
+ dev_dbg(adap->class_dev.dev,
+ "smbus byte - addr 0x%02x, "
"read 0x%02x.\n",
addr, data->byte);
}
@@ -70,12 +73,14 @@ static s32 stub_xfer(struct i2c_adapter
case I2C_SMBUS_BYTE_DATA:
if (read_write == I2C_SMBUS_WRITE) {
stub_bytes[command] = data->byte;
- dev_dbg(&adap->dev, "smbus byte data - addr 0x%02x, "
+ dev_dbg(adap->class_dev.dev,
+ "smbus byte data - addr 0x%02x, "
"wrote 0x%02x at 0x%02x.\n",
addr, data->byte, command);
} else {
data->byte = stub_bytes[command];
- dev_dbg(&adap->dev, "smbus byte data - addr 0x%02x, "
+ dev_dbg(adap->class_dev.dev,
+ "smbus byte data - addr 0x%02x, "
"read 0x%02x at 0x%02x.\n",
addr, data->byte, command);
}
@@ -87,12 +92,14 @@ static s32 stub_xfer(struct i2c_adapter
case I2C_SMBUS_WORD_DATA:
if (read_write == I2C_SMBUS_WRITE) {
stub_words[command] = data->word;
- dev_dbg(&adap->dev, "smbus word data - addr 0x%02x, "
+ dev_dbg(adap->class_dev.dev,
+ "smbus word data - addr 0x%02x, "
"wrote 0x%04x at 0x%02x.\n",
addr, data->word, command);
} else {
data->word = stub_words[command];
- dev_dbg(&adap->dev, "smbus word data - addr 0x%02x, "
+ dev_dbg(adap->class_dev.dev,
+ "smbus word data - addr 0x%02x, "
"read 0x%04x at 0x%02x.\n",
addr, data->word, command);
}
@@ -101,7 +108,7 @@ static s32 stub_xfer(struct i2c_adapter
break;
default:
- dev_dbg(&adap->dev, "Unsupported I2C/SMBus command\n");
+ dev_dbg(adap->class_dev.dev, "Unsupported I2C/SMBus command\n");
ret = -1;
break;
} /* switch (size) */
Index: g26/drivers/i2c/busses/i2c-isa.c
===================================================================
--- g26.orig/drivers/i2c/busses/i2c-isa.c 2006-12-16 15:51:11.000000000 -0800
+++ g26/drivers/i2c/busses/i2c-isa.c 2006-12-16 15:52:19.000000000 -0800
@@ -86,12 +86,13 @@ int i2c_isa_add_driver(struct i2c_driver
res = driver_register(&driver->driver);
if (res)
return res;
- dev_dbg(&isa_adapter.dev, "Driver %s registered\n", driver->driver.name);
+ dev_dbg(isa_adapter.class_dev.dev, "Driver %s registered\n",
+ driver->driver.name);
/* Now look for clients */
res = driver->attach_adapter(&isa_adapter);
if (res) {
- dev_dbg(&isa_adapter.dev,
+ dev_dbg(isa_adapter.class_dev.dev,
"Driver %s failed to attach adapter, unregistering\n",
driver->driver.name);
driver_unregister(&driver->driver);
@@ -110,10 +111,11 @@ int i2c_isa_del_driver(struct i2c_driver
client = list_entry(item, struct i2c_client, list);
if (client->driver != driver)
continue;
- dev_dbg(&isa_adapter.dev, "Detaching client %s at 0x%x\n",
+ dev_dbg(isa_adapter.class_dev.dev,
+ "Detaching client %s at 0x%x\n",
client->name, client->addr);
if ((res = driver->detach_client(client))) {
- dev_err(&isa_adapter.dev, "Failed, driver "
+ dev_err(isa_adapter.class_dev.dev, "Failed, driver "
"%s not unregistered!\n",
driver->driver.name);
return res;
@@ -122,7 +124,8 @@ int i2c_isa_del_driver(struct i2c_driver
/* Get the driver off the core list */
driver_unregister(&driver->driver);
- dev_dbg(&isa_adapter.dev, "Driver %s unregistered\n", driver->driver.name);
+ dev_dbg(isa_adapter.class_dev.dev,
+ "Driver %s unregistered\n", driver->driver.name);
return 0;
}
@@ -163,7 +166,7 @@ static int __init i2c_isa_init(void)
goto exit_remove_name;
}
- dev_dbg(&isa_adapter.dev, "%s registered\n", isa_adapter.name);
+ dev_dbg(isa_adapter.class_dev.dev, "%s registered\n", isa_adapter.name);
return 0;
@@ -186,10 +189,11 @@ static void __exit i2c_isa_exit(void)
/* There should be no more active client */
#ifdef DEBUG
- dev_dbg(&isa_adapter.dev, "Looking for clients\n");
+ dev_dbg(isa_adapter.class_dev.dev, "Looking for clients\n");
list_for_each_safe(item, _n, &isa_adapter.clients) {
client = list_entry(item, struct i2c_client, list);
- dev_err(&isa_adapter.dev, "Driver %s still has an active "
+ dev_err(isa_adapter.class_dev.dev,
+ "Driver %s still has an active "
"ISA client at 0x%x\n", client->driver->driver.name,
client->addr);
}
@@ -198,19 +202,17 @@ static void __exit i2c_isa_exit(void)
#endif
/* Clean up the sysfs representation */
- dev_dbg(&isa_adapter.dev, "Unregistering from sysfs\n");
- init_completion(&isa_adapter.dev_released);
- init_completion(&isa_adapter.class_dev_released);
+ dev_dbg(isa_adapter.class_dev.dev, "Unregistering from sysfs\n");
class_device_unregister(&isa_adapter.class_dev);
- device_remove_file(&isa_adapter.dev, &dev_attr_name);
- device_unregister(&isa_adapter.dev);
+ platform_device_unregister(to_platform_device(isa_adapter.class_dev.dev));
/* Wait for sysfs to drop all references */
- dev_dbg(&isa_adapter.dev, "Waiting for sysfs completion\n");
+ dev_dbg(isa_adapter.class_dev.dev, "Waiting for sysfs completion\n");
wait_for_completion(&isa_adapter.dev_released);
wait_for_completion(&isa_adapter.class_dev_released);
- dev_dbg(&isa_adapter.dev, "%s unregistered\n", isa_adapter.name);
+ dev_dbg(isa_adapter.class_dev.dev,
+ "%s unregistered\n", isa_adapter.name);
}
EXPORT_SYMBOL(i2c_isa_add_driver);
Index: g26/drivers/i2c/busses/i2c-at91.c
===================================================================
--- g26.orig/drivers/i2c/busses/i2c-at91.c 2006-12-16 15:51:11.000000000 -0800
+++ g26/drivers/i2c/busses/i2c-at91.c 2006-12-16 15:52:19.000000000 -0800
@@ -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->class_dev.dev, "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->class_dev.dev, "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->class_dev.dev,
+ "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->class_dev.dev,
+ " #%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->class_dev.dev,
+ "TXCOMP timeout\n");
return -ETIMEDOUT;
}
}
- dev_dbg(&adap->dev, "transfer complete\n");
+ dev_dbg(adap->class_dev.dev, "transfer complete\n");
pmsg++; /* next message */
}
return i;
Index: g26/drivers/i2c/busses/scx200_acb.c
===================================================================
--- g26.orig/drivers/i2c/busses/scx200_acb.c 2006-12-16 15:51:11.000000000 -0800
+++ g26/drivers/i2c/busses/scx200_acb.c 2006-12-16 15:52:19.000000000 -0800
@@ -116,7 +116,7 @@ static void scx200_acb_machine(struct sc
{
const char *errmsg;
- dev_dbg(&iface->adapter.dev, "state %s, status = 0x%02x\n",
+ dev_dbg(iface->adapter.class_dev.dev, "state %s, status = 0x%02x\n",
scx200_acb_state_name[iface->state], status);
if (status & ACBST_BER) {
@@ -128,7 +128,8 @@ static void scx200_acb_machine(struct sc
goto error;
}
if (status & ACBST_NEGACK) {
- dev_dbg(&iface->adapter.dev, "negative ack in state %s\n",
+ dev_dbg(iface->adapter.class_dev.dev,
+ "negative ack in state %s\n",
scx200_acb_state_name[iface->state]);
iface->state = state_idle;
@@ -144,7 +145,8 @@ static void scx200_acb_machine(struct sc
switch (iface->state) {
case state_idle:
- dev_warn(&iface->adapter.dev, "interrupt in idle state\n");
+ dev_warn(iface->adapter.class_dev.dev,
+ "interrupt in idle state\n");
break;
case state_address:
@@ -218,7 +220,7 @@ static void scx200_acb_machine(struct sc
return;
error:
- dev_err(&iface->adapter.dev, "%s in state %s\n", errmsg,
+ dev_err(iface->adapter.class_dev.dev, "%s in state %s\n", errmsg,
scx200_acb_state_name[iface->state]);
iface->state = state_idle;
@@ -248,7 +250,7 @@ static void scx200_acb_poll(struct scx20
cond_resched();
}
- dev_err(&iface->adapter.dev, "timeout in state %s\n",
+ dev_err(iface->adapter.class_dev.dev, "timeout in state %s\n",
scx200_acb_state_name[iface->state]);
iface->state = state_idle;
@@ -323,12 +325,12 @@ static s32 scx200_acb_smbus_xfer(struct
return -EINVAL;
}
- dev_dbg(&adapter->dev,
+ dev_dbg(adapter->class_dev.dev,
"size=%d, address=0x%x, command=0x%x, len=%d, read=%d\n",
size, address, command, len, rw);
if (!len && rw == I2C_SMBUS_READ) {
- dev_dbg(&adapter->dev, "zero length read\n");
+ dev_dbg(adapter->class_dev.dev, "zero length read\n");
return -EINVAL;
}
@@ -362,7 +364,7 @@ static s32 scx200_acb_smbus_xfer(struct
data->word = le16_to_cpu(cur_word);
#ifdef DEBUG
- dev_dbg(&adapter->dev, "transfer done, result: %d", rc);
+ dev_dbg(adapter->class_dev.dev, "transfer done, result: %d", rc);
if (buffer) {
int i;
printk(" data:");
Index: g26/drivers/i2c/busses/i2c-pnx.c
===================================================================
--- g26.orig/drivers/i2c/busses/i2c-pnx.c 2006-12-16 15:51:11.000000000 -0800
+++ g26/drivers/i2c/busses/i2c-pnx.c 2006-12-16 15:52:19.000000000 -0800
@@ -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->class_dev.dev, "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->class_dev.dev, "%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->class_dev.dev, "%s: Invalid slave address %x. "
"Only 7-bit addresses are supported\n",
adap->name, slave_addr);
return -EINVAL;
@@ -90,7 +90,7 @@ 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, "
+ dev_err(adap->class_dev.dev, "%s: Bus busy. Slave addr = %02x, "
"cntrl = %x, stat = %x\n",
adap->name, slave_addr,
ioread32(I2C_REG_CTL(alg_data)),
@@ -98,7 +98,7 @@ static int i2c_pnx_start(unsigned char s
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->class_dev.dev, "%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->class_dev.dev, "%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->class_dev.dev, "%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->class_dev.dev, "%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->class_dev.dev, "%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->class_dev.dev, "%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->class_dev.dev, "%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->class_dev.dev,
+ "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->class_dev.dev,
+ "%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->class_dev.dev,
+ "%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->class_dev.dev, "%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->class_dev.dev, "%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->class_dev.dev, "%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->class_dev.dev, "%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->class_dev.dev,
+ "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->class_dev.dev, "%s(): exiting: stat = %04x.\n",
__FUNCTION__, ioread32(I2C_REG_STS(alg_data)));
return 0;
@@ -312,7 +316,8 @@ i2c_pnx_interrupt(int irq, void *dev_id,
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->class_dev.dev,
+ "%s(): mstat = %x mctrl = %x, mode = %d\n",
__FUNCTION__,
ioread32(I2C_REG_STS(alg_data)),
ioread32(I2C_REG_CTL(alg_data)),
@@ -335,7 +340,7 @@ i2c_pnx_interrupt(int irq, void *dev_id,
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->class_dev.dev, "%s(): "
"Slave did not acknowledge, generating a STOP.\n",
__FUNCTION__);
i2c_pnx_stop(adap);
@@ -375,7 +380,7 @@ i2c_pnx_interrupt(int irq, void *dev_id,
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->class_dev.dev, "%s(): exiting, stat = %x ctrl = %x.\n",
__FUNCTION__, ioread32(I2C_REG_STS(alg_data)),
ioread32(I2C_REG_CTL(alg_data)));
@@ -388,7 +393,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->class_dev.dev,
+ "Master timed out. stat = %04x, cntrl = %04x. "
"Resetting master...\n",
ioread32(I2C_REG_STS(alg_data)),
ioread32(I2C_REG_CTL(alg_data)));
@@ -411,7 +417,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->class_dev.dev,
"%s: Bus is still active after xfer. Reset it...\n",
adap->name);
iowrite32(ioread32(I2C_REG_CTL(alg_data)) | mcntrl_reset,
@@ -447,7 +453,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->class_dev.dev,
+ "%s(): entering: %d messages, stat = %04x.\n",
__FUNCTION__, num, ioread32(I2C_REG_STS(alg_data)));
bus_reset_if_active(adap);
@@ -460,7 +467,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->class_dev.dev,
"%s: 10 bits addr not supported!\n",
adap->name);
rc = -EINVAL;
@@ -474,7 +481,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->class_dev.dev,
+ "%s(): mode %d, %d bytes\n", __FUNCTION__,
alg_data->mif.mode,
alg_data->mif.len);
@@ -498,18 +506,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->class_dev.dev,
+ "%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->class_dev.dev,
"%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->class_dev.dev,
"%s: AFI still set... clearing now.\n",
adap->name);
iowrite32(stat, I2C_REG_STS(alg_data));
@@ -522,7 +531,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->class_dev.dev, "%s(): exiting, stat = %x\n",
__FUNCTION__, ioread32(I2C_REG_STS(alg_data)));
if (completed != num)
More information about the i2c
mailing list