Skip to content

Commit 3592a3b

Browse files
author
Fox Snowpatch
committed
1 parent 85ff933 commit 3592a3b

File tree

12 files changed

+96
-91
lines changed

12 files changed

+96
-91
lines changed

drivers/i2c/busses/i2c-ali1535.c

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ static int ali1535_transaction(struct i2c_adapter *adap)
215215
int result = 0;
216216
int timeout = 0;
217217

218-
dev_dbg(&adap->dev, "Transaction (pre): STS=%02x, TYP=%02x, "
218+
i2c_dbg(adap, "Transaction (pre): STS=%02x, TYP=%02x, "
219219
"CMD=%02x, ADD=%02x, DAT0=%02x, DAT1=%02x\n",
220220
inb_p(SMBHSTSTS), inb_p(SMBHSTTYP), inb_p(SMBHSTCMD),
221221
inb_p(SMBHSTADD), inb_p(SMBHSTDAT0), inb_p(SMBHSTDAT1));
@@ -245,7 +245,7 @@ static int ali1535_transaction(struct i2c_adapter *adap)
245245
* BUSY bit may come back on when you try and use the chip
246246
* again. If that's the case you are stuck.
247247
*/
248-
dev_info(&adap->dev,
248+
i2c_info(adap,
249249
"Resetting entire SMB Bus to clear busy condition (%02x)\n",
250250
temp);
251251
outb_p(ALI1535_T_OUT, SMBHSTTYP);
@@ -262,7 +262,7 @@ static int ali1535_transaction(struct i2c_adapter *adap)
262262
* power reset as one of the bits now appears to be
263263
* stuck */
264264
/* This may be a bus or device with electrical problems. */
265-
dev_err(&adap->dev,
265+
i2c_err(adap,
266266
"SMBus reset failed! (0x%02x) - controller or "
267267
"device on bus is probably hung\n", temp);
268268
return -EBUSY;
@@ -290,7 +290,7 @@ static int ali1535_transaction(struct i2c_adapter *adap)
290290

291291
if (temp & ALI1535_STS_FAIL) {
292292
result = -EIO;
293-
dev_dbg(&adap->dev, "Error: Failed bus transaction\n");
293+
i2c_dbg(adap, "Error: Failed bus transaction\n");
294294
}
295295

296296
/* Unfortunately the ALI SMB controller maps "no response" and "bus
@@ -299,22 +299,22 @@ static int ali1535_transaction(struct i2c_adapter *adap)
299299
*/
300300
if (temp & ALI1535_STS_BUSERR) {
301301
result = -ENXIO;
302-
dev_dbg(&adap->dev,
302+
i2c_dbg(adap,
303303
"Error: no response or bus collision ADD=%02x\n",
304304
inb_p(SMBHSTADD));
305305
}
306306

307307
/* haven't ever seen this */
308308
if (temp & ALI1535_STS_DEV) {
309309
result = -EIO;
310-
dev_err(&adap->dev, "Error: device error\n");
310+
i2c_err(adap, "Error: device error\n");
311311
}
312312

313313
/* check to see if the "command complete" indication is set */
314314
if (!(temp & ALI1535_STS_DONE))
315315
result = -ETIMEDOUT;
316316

317-
dev_dbg(&adap->dev, "Transaction (post): STS=%02x, TYP=%02x, "
317+
i2c_dbg(adap, "Transaction (post): STS=%02x, TYP=%02x, "
318318
"CMD=%02x, ADD=%02x, DAT0=%02x, DAT1=%02x\n",
319319
inb_p(SMBHSTSTS), inb_p(SMBHSTTYP), inb_p(SMBHSTCMD),
320320
inb_p(SMBHSTADD), inb_p(SMBHSTDAT0), inb_p(SMBHSTDAT1));
@@ -352,7 +352,7 @@ static s32 ali1535_access(struct i2c_adapter *adap, u16 addr,
352352
temp = inb_p(SMBHSTSTS);
353353
}
354354
if (timeout >= MAX_TIMEOUT)
355-
dev_warn(&adap->dev, "Idle wait Timeout! STS=0x%02x\n", temp);
355+
i2c_warn(adap, "Idle wait Timeout! STS=0x%02x\n", temp);
356356

357357
/* clear status register (clear-on-write) */
358358
outb_p(0xFF, SMBHSTSTS);
@@ -416,7 +416,7 @@ static s32 ali1535_access(struct i2c_adapter *adap, u16 addr,
416416
}
417417
break;
418418
default:
419-
dev_warn(&adap->dev, "Unsupported transaction %d\n", size);
419+
i2c_warn(adap, "Unsupported transaction %d\n", size);
420420
result = -EOPNOTSUPP;
421421
goto EXIT;
422422
}
@@ -449,7 +449,7 @@ static s32 ali1535_access(struct i2c_adapter *adap, u16 addr,
449449
outb_p(inb_p(SMBHSTTYP) | ALI1535_BLOCK_CLR, SMBHSTTYP);
450450
for (i = 1; i <= data->block[0]; i++) {
451451
data->block[i] = inb_p(SMBBLKDAT);
452-
dev_dbg(&adap->dev, "Blk: len=%d, i=%d, data=%02x\n",
452+
i2c_dbg(adap, "Blk: len=%d, i=%d, data=%02x\n",
453453
len, i, data->block[i]);
454454
}
455455
break;

drivers/i2c/busses/i2c-ali15x3.c

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ static int ali15x3_transaction(struct i2c_adapter *adap)
223223
int result = 0;
224224
int timeout = 0;
225225

226-
dev_dbg(&adap->dev, "Transaction (pre): STS=%02x, CNT=%02x, CMD=%02x, "
226+
i2c_dbg(adap, "Transaction (pre): STS=%02x, CNT=%02x, CMD=%02x, "
227227
"ADD=%02x, DAT0=%02x, DAT1=%02x\n", inb_p(SMBHSTSTS),
228228
inb_p(SMBHSTCNT), inb_p(SMBHSTCMD), inb_p(SMBHSTADD),
229229
inb_p(SMBHSTDAT0), inb_p(SMBHSTDAT1));
@@ -255,7 +255,7 @@ static int ali15x3_transaction(struct i2c_adapter *adap)
255255
then the BUSY bit may come back on when you try and use the chip again.
256256
If that's the case you are stuck.
257257
*/
258-
dev_info(&adap->dev, "Resetting entire SMB Bus to "
258+
i2c_info(adap, "Resetting entire SMB Bus to "
259259
"clear busy condition (%02x)\n", temp);
260260
outb_p(ALI15X3_T_OUT, SMBHSTCNT);
261261
temp = inb_p(SMBHSTSTS);
@@ -270,7 +270,7 @@ static int ali15x3_transaction(struct i2c_adapter *adap)
270270
/* this is probably going to be correctable only by a power reset
271271
as one of the bits now appears to be stuck */
272272
/* This may be a bus or device with electrical problems. */
273-
dev_err(&adap->dev, "SMBus reset failed! (0x%02x) - "
273+
i2c_err(adap, "SMBus reset failed! (0x%02x) - "
274274
"controller or device on bus is probably hung\n",
275275
temp);
276276
return -EBUSY;
@@ -299,7 +299,7 @@ static int ali15x3_transaction(struct i2c_adapter *adap)
299299

300300
if (temp & ALI15X3_STS_TERM) {
301301
result = -EIO;
302-
dev_dbg(&adap->dev, "Error: Failed bus transaction\n");
302+
i2c_dbg(adap, "Error: Failed bus transaction\n");
303303
}
304304

305305
/*
@@ -310,17 +310,17 @@ static int ali15x3_transaction(struct i2c_adapter *adap)
310310
*/
311311
if (temp & ALI15X3_STS_COLL) {
312312
result = -ENXIO;
313-
dev_dbg(&adap->dev,
313+
i2c_dbg(adap,
314314
"Error: no response or bus collision ADD=%02x\n",
315315
inb_p(SMBHSTADD));
316316
}
317317

318318
/* haven't ever seen this */
319319
if (temp & ALI15X3_STS_DEV) {
320320
result = -EIO;
321-
dev_err(&adap->dev, "Error: device error\n");
321+
i2c_err(adap, "Error: device error\n");
322322
}
323-
dev_dbg(&adap->dev, "Transaction (post): STS=%02x, CNT=%02x, CMD=%02x, "
323+
i2c_dbg(adap, "Transaction (post): STS=%02x, CNT=%02x, CMD=%02x, "
324324
"ADD=%02x, DAT0=%02x, DAT1=%02x\n", inb_p(SMBHSTSTS),
325325
inb_p(SMBHSTCNT), inb_p(SMBHSTCMD), inb_p(SMBHSTADD),
326326
inb_p(SMBHSTDAT0), inb_p(SMBHSTDAT1));
@@ -347,7 +347,7 @@ static s32 ali15x3_access(struct i2c_adapter * adap, u16 addr,
347347
temp = inb_p(SMBHSTSTS);
348348
}
349349
if (timeout >= MAX_TIMEOUT) {
350-
dev_err(&adap->dev, "Idle wait Timeout! STS=0x%02x\n", temp);
350+
i2c_err(adap, "Idle wait Timeout! STS=0x%02x\n", temp);
351351
}
352352

353353
switch (size) {
@@ -404,7 +404,7 @@ static s32 ali15x3_access(struct i2c_adapter * adap, u16 addr,
404404
size = ALI15X3_BLOCK_DATA;
405405
break;
406406
default:
407-
dev_warn(&adap->dev, "Unsupported transaction %d\n", size);
407+
i2c_warn(adap, "Unsupported transaction %d\n", size);
408408
return -EOPNOTSUPP;
409409
}
410410

@@ -437,7 +437,7 @@ static s32 ali15x3_access(struct i2c_adapter * adap, u16 addr,
437437
outb_p(inb_p(SMBHSTCNT) | ALI15X3_BLOCK_CLR, SMBHSTCNT);
438438
for (i = 1; i <= data->block[0]; i++) {
439439
data->block[i] = inb_p(SMBBLKDAT);
440-
dev_dbg(&adap->dev, "Blk: len=%d, i=%d, data=%02x\n",
440+
i2c_dbg(adap, "Blk: len=%d, i=%d, data=%02x\n",
441441
len, i, data->block[i]);
442442
}
443443
break;

drivers/i2c/busses/i2c-amd756.c

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -99,22 +99,22 @@ static int amd756_transaction(struct i2c_adapter *adap)
9999
int result = 0;
100100
int timeout = 0;
101101

102-
dev_dbg(&adap->dev, "Transaction (pre): GS=%04x, GE=%04x, ADD=%04x, "
102+
i2c_dbg(adap, "Transaction (pre): GS=%04x, GE=%04x, ADD=%04x, "
103103
"DAT=%04x\n", inw_p(SMB_GLOBAL_STATUS),
104104
inw_p(SMB_GLOBAL_ENABLE), inw_p(SMB_HOST_ADDRESS),
105105
inb_p(SMB_HOST_DATA));
106106

107107
/* Make sure the SMBus host is ready to start transmitting */
108108
if ((temp = inw_p(SMB_GLOBAL_STATUS)) & (GS_HST_STS | GS_SMB_STS)) {
109-
dev_dbg(&adap->dev, "SMBus busy (%04x). Waiting...\n", temp);
109+
i2c_dbg(adap, "SMBus busy (%04x). Waiting...\n", temp);
110110
do {
111111
msleep(1);
112112
temp = inw_p(SMB_GLOBAL_STATUS);
113113
} while ((temp & (GS_HST_STS | GS_SMB_STS)) &&
114114
(timeout++ < MAX_TIMEOUT));
115115
/* If the SMBus is still busy, we give up */
116116
if (timeout > MAX_TIMEOUT) {
117-
dev_dbg(&adap->dev, "Busy wait timeout (%04x)\n", temp);
117+
i2c_dbg(adap, "Busy wait timeout (%04x)\n", temp);
118118
goto abort;
119119
}
120120
timeout = 0;
@@ -131,46 +131,46 @@ static int amd756_transaction(struct i2c_adapter *adap)
131131

132132
/* If the SMBus is still busy, we give up */
133133
if (timeout > MAX_TIMEOUT) {
134-
dev_dbg(&adap->dev, "Completion timeout!\n");
134+
i2c_dbg(adap, "Completion timeout!\n");
135135
goto abort;
136136
}
137137

138138
if (temp & GS_PRERR_STS) {
139139
result = -ENXIO;
140-
dev_dbg(&adap->dev, "SMBus Protocol error (no response)!\n");
140+
i2c_dbg(adap, "SMBus Protocol error (no response)!\n");
141141
}
142142

143143
if (temp & GS_COL_STS) {
144144
result = -EIO;
145-
dev_warn(&adap->dev, "SMBus collision!\n");
145+
i2c_warn(adap, "SMBus collision!\n");
146146
}
147147

148148
if (temp & GS_TO_STS) {
149149
result = -ETIMEDOUT;
150-
dev_dbg(&adap->dev, "SMBus protocol timeout!\n");
150+
i2c_dbg(adap, "SMBus protocol timeout!\n");
151151
}
152152

153153
if (temp & GS_HCYC_STS)
154-
dev_dbg(&adap->dev, "SMBus protocol success!\n");
154+
i2c_dbg(adap, "SMBus protocol success!\n");
155155

156156
outw_p(GS_CLEAR_STS, SMB_GLOBAL_STATUS);
157157

158158
#ifdef DEBUG
159159
if (((temp = inw_p(SMB_GLOBAL_STATUS)) & GS_CLEAR_STS) != 0x00) {
160-
dev_dbg(&adap->dev,
160+
i2c_dbg(adap,
161161
"Failed reset at end of transaction (%04x)\n", temp);
162162
}
163163
#endif
164164

165-
dev_dbg(&adap->dev,
165+
i2c_dbg(adap,
166166
"Transaction (post): GS=%04x, GE=%04x, ADD=%04x, DAT=%04x\n",
167167
inw_p(SMB_GLOBAL_STATUS), inw_p(SMB_GLOBAL_ENABLE),
168168
inw_p(SMB_HOST_ADDRESS), inb_p(SMB_HOST_DATA));
169169

170170
return result;
171171

172172
abort:
173-
dev_warn(&adap->dev, "Sending abort\n");
173+
i2c_warn(adap, "Sending abort\n");
174174
outw_p(inw(SMB_GLOBAL_ENABLE) | GE_ABORT, SMB_GLOBAL_ENABLE);
175175
msleep(100);
176176
outw_p(GS_CLEAR_STS, SMB_GLOBAL_STATUS);
@@ -233,7 +233,7 @@ static s32 amd756_access(struct i2c_adapter * adap, u16 addr,
233233
size = AMD756_BLOCK_DATA;
234234
break;
235235
default:
236-
dev_warn(&adap->dev, "Unsupported transaction %d\n", size);
236+
i2c_warn(adap, "Unsupported transaction %d\n", size);
237237
return -EOPNOTSUPP;
238238
}
239239

drivers/i2c/busses/i2c-isch.c

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ static int sch_transaction(struct i2c_adapter *adap)
8686
int temp;
8787
int rc;
8888

89-
dev_dbg(&adap->dev,
89+
i2c_dbg(adap,
9090
"Transaction (pre): CNT=%02x, CMD=%02x, ADD=%02x, DAT0=%02x, DAT1=%02x\n",
9191
sch_io_rd8(priv, SMBHSTCNT), sch_io_rd8(priv, SMBHSTCMD),
9292
sch_io_rd8(priv, SMBHSTADD),
@@ -97,13 +97,13 @@ static int sch_transaction(struct i2c_adapter *adap)
9797
if (temp) {
9898
/* Can not be busy since we checked it in sch_access */
9999
if (temp & 0x01)
100-
dev_dbg(&adap->dev, "Completion (%02x). Clear...\n", temp);
100+
i2c_dbg(adap, "Completion (%02x). Clear...\n", temp);
101101
if (temp & 0x06)
102-
dev_dbg(&adap->dev, "SMBus error (%02x). Resetting...\n", temp);
102+
i2c_dbg(adap, "SMBus error (%02x). Resetting...\n", temp);
103103
sch_io_wr8(priv, SMBHSTSTS, temp);
104104
temp = sch_io_rd8(priv, SMBHSTSTS) & 0x0f;
105105
if (temp) {
106-
dev_err(&adap->dev, "SMBus is not ready: (%02x)\n", temp);
106+
i2c_err(adap, "SMBus is not ready: (%02x)\n", temp);
107107
return -EAGAIN;
108108
}
109109
}
@@ -116,28 +116,28 @@ static int sch_transaction(struct i2c_adapter *adap)
116116
rc = read_poll_timeout(sch_io_rd8, temp, !(temp & 0x08), 200, 500000, true, priv, SMBHSTSTS);
117117
/* If the SMBus is still busy, we give up */
118118
if (rc) {
119-
dev_err(&adap->dev, "SMBus Timeout!\n");
119+
i2c_err(adap, "SMBus Timeout!\n");
120120
} else if (temp & 0x04) {
121121
rc = -EIO;
122-
dev_dbg(&adap->dev, "Bus collision! SMBus may be locked until next hard reset. (sorry!)\n");
122+
i2c_dbg(adap, "Bus collision! SMBus may be locked until next hard reset. (sorry!)\n");
123123
/* Clock stops and target is stuck in mid-transmission */
124124
} else if (temp & 0x02) {
125125
rc = -EIO;
126-
dev_err(&adap->dev, "Error: no response!\n");
126+
i2c_err(adap, "Error: no response!\n");
127127
} else if (temp & 0x01) {
128-
dev_dbg(&adap->dev, "Post complete!\n");
128+
i2c_dbg(adap, "Post complete!\n");
129129
sch_io_wr8(priv, SMBHSTSTS, temp & 0x0f);
130130
temp = sch_io_rd8(priv, SMBHSTSTS) & 0x07;
131131
if (temp & 0x06) {
132132
/* Completion clear failed */
133-
dev_dbg(&adap->dev,
133+
i2c_dbg(adap,
134134
"Failed reset at end of transaction (%02x), Bus error!\n", temp);
135135
}
136136
} else {
137137
rc = -ENXIO;
138-
dev_dbg(&adap->dev, "No such address.\n");
138+
i2c_dbg(adap, "No such address.\n");
139139
}
140-
dev_dbg(&adap->dev, "Transaction (post): CNT=%02x, CMD=%02x, ADD=%02x, DAT0=%02x, DAT1=%02x\n",
140+
i2c_dbg(adap, "Transaction (post): CNT=%02x, CMD=%02x, ADD=%02x, DAT0=%02x, DAT1=%02x\n",
141141
sch_io_rd8(priv, SMBHSTCNT), sch_io_rd8(priv, SMBHSTCMD),
142142
sch_io_rd8(priv, SMBHSTADD),
143143
sch_io_rd8(priv, SMBHSTDAT0), sch_io_rd8(priv, SMBHSTDAT1));
@@ -166,7 +166,7 @@ static s32 sch_access(struct i2c_adapter *adap, u16 addr,
166166
/* Make sure the SMBus host is not busy */
167167
temp = sch_io_rd8(priv, SMBHSTSTS) & 0x0f;
168168
if (temp & 0x08) {
169-
dev_dbg(&adap->dev, "SMBus busy (%02x)\n", temp);
169+
i2c_dbg(adap, "SMBus busy (%02x)\n", temp);
170170
return -EAGAIN;
171171
}
172172
temp = sch_io_rd16(priv, SMBHSTCLK);
@@ -177,11 +177,11 @@ static s32 sch_access(struct i2c_adapter *adap, u16 addr,
177177
* 100 kHz. If we actually run at 25 MHz the bus will be
178178
* run ~75 kHz instead which should do no harm.
179179
*/
180-
dev_notice(&adap->dev, "Clock divider uninitialized. Setting defaults\n");
180+
i2c_notice(adap, "Clock divider uninitialized. Setting defaults\n");
181181
sch_io_wr16(priv, SMBHSTCLK, backbone_speed / (4 * 100));
182182
}
183183

184-
dev_dbg(&adap->dev, "access size: %d %s\n", size, str_read_write(read_write));
184+
i2c_dbg(adap, "access size: %d %s\n", size, str_read_write(read_write));
185185
switch (size) {
186186
case I2C_SMBUS_QUICK:
187187
sch_io_wr8(priv, SMBHSTADD, (addr << 1) | read_write);
@@ -223,10 +223,10 @@ static s32 sch_access(struct i2c_adapter *adap, u16 addr,
223223
size = SCH_BLOCK_DATA;
224224
break;
225225
default:
226-
dev_warn(&adap->dev, "Unsupported transaction %d\n", size);
226+
i2c_warn(adap, "Unsupported transaction %d\n", size);
227227
return -EOPNOTSUPP;
228228
}
229-
dev_dbg(&adap->dev, "write size %d to 0x%04x\n", size, SMBHSTCNT);
229+
i2c_dbg(adap, "write size %d to 0x%04x\n", size, SMBHSTCNT);
230230

231231
temp = sch_io_rd8(priv, SMBHSTCNT);
232232
temp = (temp & 0xb0) | (size & 0x7);

0 commit comments

Comments
 (0)