Skip to content

Commit a190db9

Browse files
committed
ipmi: Clean up some printks
Convert to dev_xxx() and fix some verbage. Signed-off-by: Corey Minyard <[email protected]>
1 parent f8910ff commit a190db9

File tree

3 files changed

+29
-19
lines changed

3 files changed

+29
-19
lines changed

drivers/char/ipmi/ipmi_bt_sm.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ static int bt_start_transaction(struct si_sm_data *bt,
214214
return IPMI_NODE_BUSY_ERR;
215215

216216
if (bt->state != BT_STATE_IDLE) {
217-
dev_warn(bt->io->dev, "BT is now in the state %d\n", bt->state);
217+
dev_warn(bt->io->dev, "BT in invalid state %d\n", bt->state);
218218
return IPMI_NOT_IN_MY_STATE_ERR;
219219
}
220220

drivers/char/ipmi/ipmi_kcs_sm.c

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717
* that document.
1818
*/
1919

20+
#define DEBUG /* So dev_dbg() is always available. */
21+
2022
#include <linux/kernel.h> /* For printk. */
2123
#include <linux/module.h>
2224
#include <linux/moduleparam.h>
@@ -187,8 +189,8 @@ static inline void start_error_recovery(struct si_sm_data *kcs, char *reason)
187189
(kcs->error_retries)++;
188190
if (kcs->error_retries > MAX_ERROR_RETRIES) {
189191
if (kcs_debug & KCS_DEBUG_ENABLE)
190-
printk(KERN_DEBUG "ipmi_kcs_sm: kcs hosed: %s\n",
191-
reason);
192+
dev_dbg(kcs->io->dev, "ipmi_kcs_sm: kcs hosed: %s\n",
193+
reason);
192194
kcs->state = KCS_HOSED;
193195
} else {
194196
kcs->error0_timeout = jiffies + ERROR0_OBF_WAIT_JIFFIES;
@@ -269,12 +271,12 @@ static int start_kcs_transaction(struct si_sm_data *kcs, unsigned char *data,
269271
return IPMI_REQ_LEN_EXCEEDED_ERR;
270272

271273
if ((kcs->state != KCS_IDLE) && (kcs->state != KCS_HOSED)) {
272-
pr_warn("KCS is now in the state %d\n", kcs->state);
274+
dev_warn(kcs->io->dev, "KCS in invalid state %d\n", kcs->state);
273275
return IPMI_NOT_IN_MY_STATE_ERR;
274276
}
275277

276278
if (kcs_debug & KCS_DEBUG_MSG) {
277-
printk(KERN_DEBUG "start_kcs_transaction -");
279+
dev_dbg(kcs->io->dev, "%s -", __func__);
278280
for (i = 0; i < size; i++)
279281
pr_cont(" %02x", data[i]);
280282
pr_cont("\n");
@@ -333,7 +335,8 @@ static enum si_sm_result kcs_event(struct si_sm_data *kcs, long time)
333335
status = read_status(kcs);
334336

335337
if (kcs_debug & KCS_DEBUG_STATES)
336-
printk(KERN_DEBUG "KCS: State = %d, %x\n", kcs->state, status);
338+
dev_dbg(kcs->io->dev,
339+
"KCS: State = %d, %x\n", kcs->state, status);
337340

338341
/* All states wait for ibf, so just do it here. */
339342
if (!check_ibf(kcs, status, time))

drivers/char/ipmi/ipmi_smic_sm.c

Lines changed: 20 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@
2121
* 2001 Hewlett-Packard Company
2222
*/
2323

24+
#define DEBUG /* So dev_dbg() is always available. */
25+
2426
#include <linux/kernel.h> /* For printk. */
2527
#include <linux/string.h>
2628
#include <linux/module.h>
@@ -127,12 +129,13 @@ static int start_smic_transaction(struct si_sm_data *smic,
127129
return IPMI_REQ_LEN_EXCEEDED_ERR;
128130

129131
if ((smic->state != SMIC_IDLE) && (smic->state != SMIC_HOSED)) {
130-
pr_warn("SMIC is now in the state %d\n", smic->state);
132+
dev_warn(smic->io->dev,
133+
"SMIC in invalid state %d\n", smic->state);
131134
return IPMI_NOT_IN_MY_STATE_ERR;
132135
}
133136

134137
if (smic_debug & SMIC_DEBUG_MSG) {
135-
printk(KERN_DEBUG "start_smic_transaction -");
138+
dev_dbg(smic->io->dev, "%s -", __func__);
136139
for (i = 0; i < size; i++)
137140
pr_cont(" %02x", data[i]);
138141
pr_cont("\n");
@@ -154,7 +157,7 @@ static int smic_get_result(struct si_sm_data *smic,
154157
int i;
155158

156159
if (smic_debug & SMIC_DEBUG_MSG) {
157-
printk(KERN_DEBUG "smic_get result -");
160+
dev_dbg(smic->io->dev, "smic_get result -");
158161
for (i = 0; i < smic->read_pos; i++)
159162
pr_cont(" %02x", smic->read_data[i]);
160163
pr_cont("\n");
@@ -326,9 +329,9 @@ static enum si_sm_result smic_event(struct si_sm_data *smic, long time)
326329
}
327330
if (smic->state != SMIC_IDLE) {
328331
if (smic_debug & SMIC_DEBUG_STATES)
329-
printk(KERN_DEBUG
330-
"smic_event - smic->smic_timeout = %ld, time = %ld\n",
331-
smic->smic_timeout, time);
332+
dev_dbg(smic->io->dev,
333+
"%s - smic->smic_timeout = %ld, time = %ld\n",
334+
__func__, smic->smic_timeout, time);
332335
/*
333336
* FIXME: smic_event is sometimes called with time >
334337
* SMIC_RETRY_TIMEOUT
@@ -347,8 +350,9 @@ static enum si_sm_result smic_event(struct si_sm_data *smic, long time)
347350

348351
status = read_smic_status(smic);
349352
if (smic_debug & SMIC_DEBUG_STATES)
350-
printk(KERN_DEBUG "smic_event - state = %d, flags = 0x%02x, status = 0x%02x\n",
351-
smic->state, flags, status);
353+
dev_dbg(smic->io->dev,
354+
"%s - state = %d, flags = 0x%02x, status = 0x%02x\n",
355+
__func__, smic->state, flags, status);
352356

353357
switch (smic->state) {
354358
case SMIC_IDLE:
@@ -438,8 +442,9 @@ static enum si_sm_result smic_event(struct si_sm_data *smic, long time)
438442
data = read_smic_data(smic);
439443
if (data != 0) {
440444
if (smic_debug & SMIC_DEBUG_ENABLE)
441-
printk(KERN_DEBUG "SMIC_WRITE_END: data = %02x\n",
442-
data);
445+
dev_dbg(smic->io->dev,
446+
"SMIC_WRITE_END: data = %02x\n",
447+
data);
443448
start_error_recovery(smic,
444449
"state = SMIC_WRITE_END, "
445450
"data != SUCCESS");
@@ -518,8 +523,9 @@ static enum si_sm_result smic_event(struct si_sm_data *smic, long time)
518523
/* data register holds an error code */
519524
if (data != 0) {
520525
if (smic_debug & SMIC_DEBUG_ENABLE)
521-
printk(KERN_DEBUG "SMIC_READ_END: data = %02x\n",
522-
data);
526+
dev_dbg(smic->io->dev,
527+
"SMIC_READ_END: data = %02x\n",
528+
data);
523529
start_error_recovery(smic,
524530
"state = SMIC_READ_END, "
525531
"data != SUCCESS");
@@ -535,7 +541,8 @@ static enum si_sm_result smic_event(struct si_sm_data *smic, long time)
535541

536542
default:
537543
if (smic_debug & SMIC_DEBUG_ENABLE) {
538-
printk(KERN_DEBUG "smic->state = %d\n", smic->state);
544+
dev_dbg(smic->io->dev,
545+
"smic->state = %d\n", smic->state);
539546
start_error_recovery(smic, "state = UNKNOWN");
540547
return SI_SM_CALL_WITH_DELAY;
541548
}

0 commit comments

Comments
 (0)