diff options
author | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2008-07-15 15:21:52 -0400 |
---|---|---|
committer | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2008-07-15 15:21:52 -0400 |
commit | 43a2b5b29385a3e0997a47c86f286d3645e5cb44 (patch) | |
tree | f590ec553fc54db04bdf3178518c52196bee304e /drivers/scsi/ide-scsi.c | |
parent | c8c51129805c0efb32f34afd3af8fe94f5757363 (diff) |
ide-scsi: add debug_log() macro
Add debug_log() macro and convert the driver to use it.
[ This makes debug messages to be always prefixed with "ide-scsi: "
and use KERN_INFO level. ]
While at it:
* Change "DMA complete" debug message to "DMA finished" to match
other ATAPI device drivers.
* Use __func__.
Cc: Borislav Petkov <petkovbb@gmail.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Diffstat (limited to 'drivers/scsi/ide-scsi.c')
-rw-r--r-- | drivers/scsi/ide-scsi.c | 51 |
1 files changed, 25 insertions, 26 deletions
diff --git a/drivers/scsi/ide-scsi.c b/drivers/scsi/ide-scsi.c index e9d3dbf596c7..d2dad9039e0d 100644 --- a/drivers/scsi/ide-scsi.c +++ b/drivers/scsi/ide-scsi.c | |||
@@ -60,6 +60,13 @@ | |||
60 | 60 | ||
61 | #define IDESCSI_DEBUG_LOG 0 | 61 | #define IDESCSI_DEBUG_LOG 0 |
62 | 62 | ||
63 | #if IDESCSI_DEBUG_LOG | ||
64 | #define debug_log(fmt, args...) \ | ||
65 | printk(KERN_INFO "ide-scsi: " fmt, ## args) | ||
66 | #else | ||
67 | #define debug_log(fmt, args...) do {} while (0) | ||
68 | #endif | ||
69 | |||
63 | /* | 70 | /* |
64 | * SCSI command transformation layer | 71 | * SCSI command transformation layer |
65 | */ | 72 | */ |
@@ -237,10 +244,9 @@ idescsi_atapi_error(ide_drive_t *drive, struct request *rq, u8 stat, u8 err) | |||
237 | static ide_startstop_t | 244 | static ide_startstop_t |
238 | idescsi_atapi_abort(ide_drive_t *drive, struct request *rq) | 245 | idescsi_atapi_abort(ide_drive_t *drive, struct request *rq) |
239 | { | 246 | { |
240 | #if IDESCSI_DEBUG_LOG | 247 | debug_log("%s called for %lu\n", __func__, |
241 | printk(KERN_WARNING "idescsi_atapi_abort called for %lu\n", | ||
242 | ((struct ide_atapi_pc *) rq->special)->scsi_cmd->serial_number); | 248 | ((struct ide_atapi_pc *) rq->special)->scsi_cmd->serial_number); |
243 | #endif | 249 | |
244 | rq->errors |= ERROR_MAX; | 250 | rq->errors |= ERROR_MAX; |
245 | 251 | ||
246 | idescsi_end_request(drive, 0, 0); | 252 | idescsi_end_request(drive, 0, 0); |
@@ -319,9 +325,9 @@ static int idescsi_expiry(ide_drive_t *drive) | |||
319 | idescsi_scsi_t *scsi = drive_to_idescsi(drive); | 325 | idescsi_scsi_t *scsi = drive_to_idescsi(drive); |
320 | struct ide_atapi_pc *pc = scsi->pc; | 326 | struct ide_atapi_pc *pc = scsi->pc; |
321 | 327 | ||
322 | #if IDESCSI_DEBUG_LOG | 328 | debug_log("%s called for %lu at %lu\n", __func__, |
323 | printk(KERN_WARNING "idescsi_expiry called for %lu at %lu\n", pc->scsi_cmd->serial_number, jiffies); | 329 | pc->scsi_cmd->serial_number, jiffies); |
324 | #endif | 330 | |
325 | pc->flags |= PC_FLAG_TIMEDOUT; | 331 | pc->flags |= PC_FLAG_TIMEDOUT; |
326 | 332 | ||
327 | return 0; /* we do not want the ide subsystem to retry */ | 333 | return 0; /* we do not want the ide subsystem to retry */ |
@@ -341,15 +347,11 @@ static ide_startstop_t idescsi_pc_intr (ide_drive_t *drive) | |||
341 | u16 bcount; | 347 | u16 bcount; |
342 | u8 stat, ireason; | 348 | u8 stat, ireason; |
343 | 349 | ||
344 | #if IDESCSI_DEBUG_LOG | 350 | debug_log("Reached %s interrupt handler\n", __func__); |
345 | printk (KERN_INFO "ide-scsi: Reached idescsi_pc_intr interrupt handler\n"); | ||
346 | #endif /* IDESCSI_DEBUG_LOG */ | ||
347 | 351 | ||
348 | if (pc->flags & PC_FLAG_TIMEDOUT) { | 352 | if (pc->flags & PC_FLAG_TIMEDOUT) { |
349 | #if IDESCSI_DEBUG_LOG | 353 | debug_log("%s: got timed out packet %lu at %lu\n", __func__, |
350 | printk(KERN_WARNING "idescsi_pc_intr: got timed out packet %lu at %lu\n", | 354 | pc->scsi_cmd->serial_number, jiffies); |
351 | pc->scsi_cmd->serial_number, jiffies); | ||
352 | #endif | ||
353 | /* end this request now - scsi should retry it*/ | 355 | /* end this request now - scsi should retry it*/ |
354 | idescsi_end_request (drive, 1, 0); | 356 | idescsi_end_request (drive, 1, 0); |
355 | return ide_stopped; | 357 | return ide_stopped; |
@@ -359,9 +361,7 @@ static ide_startstop_t idescsi_pc_intr (ide_drive_t *drive) | |||
359 | pc->flags |= PC_FLAG_DMA_ERROR; | 361 | pc->flags |= PC_FLAG_DMA_ERROR; |
360 | else | 362 | else |
361 | pc->xferred = pc->req_xfer; | 363 | pc->xferred = pc->req_xfer; |
362 | #if IDESCSI_DEBUG_LOG | 364 | debug_log("%s: DMA finished\n", drive->name); |
363 | printk ("ide-scsi: %s: DMA complete\n", drive->name); | ||
364 | #endif /* IDESCSI_DEBUG_LOG */ | ||
365 | } | 365 | } |
366 | 366 | ||
367 | /* Clear the interrupt */ | 367 | /* Clear the interrupt */ |
@@ -427,9 +427,8 @@ static ide_startstop_t idescsi_pc_intr (ide_drive_t *drive) | |||
427 | ide_set_handler(drive, &idescsi_pc_intr, get_timeout(pc), idescsi_expiry); | 427 | ide_set_handler(drive, &idescsi_pc_intr, get_timeout(pc), idescsi_expiry); |
428 | return ide_started; | 428 | return ide_started; |
429 | } | 429 | } |
430 | #if IDESCSI_DEBUG_LOG | 430 | debug_log("The scsi wants to send us more data than " |
431 | printk (KERN_NOTICE "ide-scsi: The scsi wants to send us more data than expected - allowing transfer\n"); | 431 | "expected - allowing transfer\n"); |
432 | #endif /* IDESCSI_DEBUG_LOG */ | ||
433 | } | 432 | } |
434 | xferfunc = hwif->input_data; | 433 | xferfunc = hwif->input_data; |
435 | } else | 434 | } else |
@@ -566,10 +565,10 @@ static ide_startstop_t idescsi_issue_pc(ide_drive_t *drive, | |||
566 | */ | 565 | */ |
567 | static ide_startstop_t idescsi_do_request (ide_drive_t *drive, struct request *rq, sector_t block) | 566 | static ide_startstop_t idescsi_do_request (ide_drive_t *drive, struct request *rq, sector_t block) |
568 | { | 567 | { |
569 | #if IDESCSI_DEBUG_LOG | 568 | debug_log("dev: %s, cmd: %x, errors: %d\n", rq->rq_disk->disk_name, |
570 | printk (KERN_INFO "dev: %s, cmd: %x, errors: %d\n", rq->rq_disk->disk_name,rq->cmd[0],rq->errors); | 569 | rq->cmd[0], rq->errors); |
571 | printk (KERN_INFO "sector: %ld, nr_sectors: %ld, current_nr_sectors: %d\n",rq->sector,rq->nr_sectors,rq->current_nr_sectors); | 570 | debug_log("sector: %ld, nr_sectors: %ld, current_nr_sectors: %d\n", |
572 | #endif /* IDESCSI_DEBUG_LOG */ | 571 | rq->sector, rq->nr_sectors, rq->current_nr_sectors); |
573 | 572 | ||
574 | if (blk_sense_request(rq) || blk_special_request(rq)) { | 573 | if (blk_sense_request(rq) || blk_special_request(rq)) { |
575 | return idescsi_issue_pc(drive, | 574 | return idescsi_issue_pc(drive, |
@@ -976,10 +975,10 @@ static int ide_scsi_probe(ide_drive_t *drive) | |||
976 | 975 | ||
977 | host->max_id = 1; | 976 | host->max_id = 1; |
978 | 977 | ||
979 | #if IDESCSI_DEBUG_LOG | ||
980 | if (drive->id->last_lun) | 978 | if (drive->id->last_lun) |
981 | printk(KERN_NOTICE "%s: id->last_lun=%u\n", drive->name, drive->id->last_lun); | 979 | debug_log("%s: id->last_lun=%u\n", drive->name, |
982 | #endif | 980 | drive->id->last_lun); |
981 | |||
983 | if ((drive->id->last_lun & 0x7) != 7) | 982 | if ((drive->id->last_lun & 0x7) != 7) |
984 | host->max_lun = (drive->id->last_lun & 0x7) + 1; | 983 | host->max_lun = (drive->id->last_lun & 0x7) + 1; |
985 | else | 984 | else |