21
21
* 2001 Hewlett-Packard Company
22
22
*/
23
23
24
+ #define DEBUG /* So dev_dbg() is always available. */
25
+
24
26
#include <linux/kernel.h> /* For printk. */
25
27
#include <linux/string.h>
26
28
#include <linux/module.h>
@@ -127,12 +129,13 @@ static int start_smic_transaction(struct si_sm_data *smic,
127
129
return IPMI_REQ_LEN_EXCEEDED_ERR ;
128
130
129
131
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 );
131
134
return IPMI_NOT_IN_MY_STATE_ERR ;
132
135
}
133
136
134
137
if (smic_debug & SMIC_DEBUG_MSG ) {
135
- printk ( KERN_DEBUG "start_smic_transaction -" );
138
+ dev_dbg ( smic -> io -> dev , "%s -", __func__ );
136
139
for (i = 0 ; i < size ; i ++ )
137
140
pr_cont (" %02x" , data [i ]);
138
141
pr_cont ("\n" );
@@ -154,7 +157,7 @@ static int smic_get_result(struct si_sm_data *smic,
154
157
int i ;
155
158
156
159
if (smic_debug & SMIC_DEBUG_MSG ) {
157
- printk ( KERN_DEBUG "smic_get result -" );
160
+ dev_dbg ( smic -> io -> dev , "smic_get result -" );
158
161
for (i = 0 ; i < smic -> read_pos ; i ++ )
159
162
pr_cont (" %02x" , smic -> read_data [i ]);
160
163
pr_cont ("\n" );
@@ -326,9 +329,9 @@ static enum si_sm_result smic_event(struct si_sm_data *smic, long time)
326
329
}
327
330
if (smic -> state != SMIC_IDLE ) {
328
331
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 );
332
335
/*
333
336
* FIXME: smic_event is sometimes called with time >
334
337
* SMIC_RETRY_TIMEOUT
@@ -347,8 +350,9 @@ static enum si_sm_result smic_event(struct si_sm_data *smic, long time)
347
350
348
351
status = read_smic_status (smic );
349
352
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 );
352
356
353
357
switch (smic -> state ) {
354
358
case SMIC_IDLE :
@@ -438,8 +442,9 @@ static enum si_sm_result smic_event(struct si_sm_data *smic, long time)
438
442
data = read_smic_data (smic );
439
443
if (data != 0 ) {
440
444
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 );
443
448
start_error_recovery (smic ,
444
449
"state = SMIC_WRITE_END, "
445
450
"data != SUCCESS" );
@@ -518,8 +523,9 @@ static enum si_sm_result smic_event(struct si_sm_data *smic, long time)
518
523
/* data register holds an error code */
519
524
if (data != 0 ) {
520
525
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 );
523
529
start_error_recovery (smic ,
524
530
"state = SMIC_READ_END, "
525
531
"data != SUCCESS" );
@@ -535,7 +541,8 @@ static enum si_sm_result smic_event(struct si_sm_data *smic, long time)
535
541
536
542
default :
537
543
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 );
539
546
start_error_recovery (smic , "state = UNKNOWN" );
540
547
return SI_SM_CALL_WITH_DELAY ;
541
548
}
0 commit comments