ide-scsi: add ide_scsi_hex_dump() helper

Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Denis Cheng <crquan@gmail.com>
Cc: Randy Dunlap <randy.dunlap@oracle.com>
Signed-off-by: default avatarBartlomiej Zolnierkiewicz <bzolnier@gmail.com>
parent da8cadb3
...@@ -242,6 +242,11 @@ static void idescsi_output_buffers (ide_drive_t *drive, idescsi_pc_t *pc, unsign ...@@ -242,6 +242,11 @@ static void idescsi_output_buffers (ide_drive_t *drive, idescsi_pc_t *pc, unsign
} }
} }
static void ide_scsi_hex_dump(u8 *data, int len)
{
print_hex_dump(KERN_CONT, "", DUMP_PREFIX_NONE, 16, 1, data, len, 0);
}
static int idescsi_check_condition(ide_drive_t *drive, struct request *failed_command) static int idescsi_check_condition(ide_drive_t *drive, struct request *failed_command)
{ {
idescsi_scsi_t *scsi = drive_to_idescsi(drive); idescsi_scsi_t *scsi = drive_to_idescsi(drive);
...@@ -272,8 +277,7 @@ static int idescsi_check_condition(ide_drive_t *drive, struct request *failed_co ...@@ -272,8 +277,7 @@ static int idescsi_check_condition(ide_drive_t *drive, struct request *failed_co
pc->scsi_cmd = ((idescsi_pc_t *) failed_command->special)->scsi_cmd; pc->scsi_cmd = ((idescsi_pc_t *) failed_command->special)->scsi_cmd;
if (test_bit(IDESCSI_LOG_CMD, &scsi->log)) { if (test_bit(IDESCSI_LOG_CMD, &scsi->log)) {
printk ("ide-scsi: %s: queue cmd = ", drive->name); printk ("ide-scsi: %s: queue cmd = ", drive->name);
print_hex_dump(KERN_CONT, "", DUMP_PREFIX_NONE, 16, 1, pc->c, ide_scsi_hex_dump(pc->c, 6);
6, 0);
} }
rq->rq_disk = scsi->disk; rq->rq_disk = scsi->disk;
return ide_do_drive_cmd(drive, rq, ide_preempt); return ide_do_drive_cmd(drive, rq, ide_preempt);
...@@ -328,8 +332,7 @@ static int idescsi_end_request (ide_drive_t *drive, int uptodate, int nrsecs) ...@@ -328,8 +332,7 @@ static int idescsi_end_request (ide_drive_t *drive, int uptodate, int nrsecs)
idescsi_pc_t *opc = (idescsi_pc_t *) rq->buffer; idescsi_pc_t *opc = (idescsi_pc_t *) rq->buffer;
if (log) { if (log) {
printk ("ide-scsi: %s: wrap up check %lu, rst = ", drive->name, opc->scsi_cmd->serial_number); printk ("ide-scsi: %s: wrap up check %lu, rst = ", drive->name, opc->scsi_cmd->serial_number);
print_hex_dump(KERN_CONT, "", DUMP_PREFIX_NONE, 16, 1, ide_scsi_hex_dump(pc->buffer, 16);
pc->buffer, 16, 0);
} }
memcpy((void *) opc->scsi_cmd->sense_buffer, pc->buffer, SCSI_SENSE_BUFFERSIZE); memcpy((void *) opc->scsi_cmd->sense_buffer, pc->buffer, SCSI_SENSE_BUFFERSIZE);
kfree(pc->buffer); kfree(pc->buffer);
...@@ -808,12 +811,10 @@ static int idescsi_queue (struct scsi_cmnd *cmd, ...@@ -808,12 +811,10 @@ static int idescsi_queue (struct scsi_cmnd *cmd,
if (test_bit(IDESCSI_LOG_CMD, &scsi->log)) { if (test_bit(IDESCSI_LOG_CMD, &scsi->log)) {
printk ("ide-scsi: %s: que %lu, cmd = ", drive->name, cmd->serial_number); printk ("ide-scsi: %s: que %lu, cmd = ", drive->name, cmd->serial_number);
print_hex_dump(KERN_CONT, "", DUMP_PREFIX_NONE, 16, 1, ide_scsi_hex_dump(cmd->cmnd, cmd->cmd_len);
cmd->cmnd, cmd->cmd_len, 0);
if (memcmp(pc->c, cmd->cmnd, cmd->cmd_len)) { if (memcmp(pc->c, cmd->cmnd, cmd->cmd_len)) {
printk ("ide-scsi: %s: que %lu, tsl = ", drive->name, cmd->serial_number); printk ("ide-scsi: %s: que %lu, tsl = ", drive->name, cmd->serial_number);
print_hex_dump(KERN_CONT, "", DUMP_PREFIX_NONE, 16, 1, ide_scsi_hex_dump(pc->c, 12);
pc->c, 12, 0);
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment