From 017560fca496f72ed9dd734ffde63ce39dfe0411 Mon Sep 17 00:00:00 2001 From: Jeff Garzik Date: Mon, 24 Oct 2005 18:04:36 -0400 Subject: [SCSI] use sfoo_printk() in drivers Rejections fixed up and Signed-off-by: James Bottomley --- drivers/scsi/aic7xxx/aic79xx_osm.c | 28 +++++++++------------------- drivers/scsi/aic7xxx/aic7xxx_osm.c | 22 ++++++---------------- 2 files changed, 15 insertions(+), 35 deletions(-) (limited to 'drivers/scsi/aic7xxx') diff --git a/drivers/scsi/aic7xxx/aic79xx_osm.c b/drivers/scsi/aic7xxx/aic79xx_osm.c index 95c285cc83e..5e023dca4e5 100644 --- a/drivers/scsi/aic7xxx/aic79xx_osm.c +++ b/drivers/scsi/aic7xxx/aic79xx_osm.c @@ -52,6 +52,7 @@ static struct scsi_transport_template *ahd_linux_transport_template = NULL; #include /* For fetching system memory size */ #include /* For block_size() */ #include /* For ssleep/msleep */ +#include /* * Bucket size for counting good commands in between bad ones. @@ -565,7 +566,7 @@ ahd_linux_slave_configure(struct scsi_device *sdev) ahd = *((struct ahd_softc **)sdev->host->hostdata); if (bootverbose) - printf("%s: Slave Configure %d\n", ahd_name(ahd), sdev->id); + sdev_printk(KERN_INFO, sdev, "Slave Configure\n"); ahd_linux_device_queue_depth(sdev); @@ -2067,9 +2068,8 @@ ahd_linux_queue_recovery_cmd(struct scsi_cmnd *cmd, scb_flag flag) wait = FALSE; ahd = *(struct ahd_softc **)cmd->device->host->hostdata; - printf("%s:%d:%d:%d: Attempting to queue a%s message:", - ahd_name(ahd), cmd->device->channel, - cmd->device->id, cmd->device->lun, + scmd_printk(KERN_INFO, cmd, + "Attempting to queue a%s message:", flag == SCB_ABORT ? "n ABORT" : " TARGET RESET"); printf("CDB:"); @@ -2093,9 +2093,7 @@ ahd_linux_queue_recovery_cmd(struct scsi_cmnd *cmd, scb_flag flag) * No target device for this command exists, * so we must not still own the command. */ - printf("%s:%d:%d:%d: Is not an active device\n", - ahd_name(ahd), cmd->device->channel, cmd->device->id, - cmd->device->lun); + scmd_printk(KERN_INFO, cmd, "Is not an active device\n"); retval = SUCCESS; goto no_cmd; } @@ -2121,9 +2119,7 @@ ahd_linux_queue_recovery_cmd(struct scsi_cmnd *cmd, scb_flag flag) } if (pending_scb == NULL) { - printf("%s:%d:%d:%d: Command not found\n", - ahd_name(ahd), cmd->device->channel, cmd->device->id, - cmd->device->lun); + scmd_printk(KERN_INFO, cmd, "Command not found\n"); goto no_cmd; } @@ -2146,9 +2142,7 @@ ahd_linux_queue_recovery_cmd(struct scsi_cmnd *cmd, scb_flag flag) paused = TRUE; if ((pending_scb->flags & SCB_ACTIVE) == 0) { - printf("%s:%d:%d:%d: Command already completed\n", - ahd_name(ahd), cmd->device->channel, cmd->device->id, - cmd->device->lun); + scmd_printk(KERN_INFO, cmd, "Command already completed\n"); goto no_cmd; } @@ -2214,9 +2208,7 @@ ahd_linux_queue_recovery_cmd(struct scsi_cmnd *cmd, scb_flag flag) pending_scb->flags |= SCB_RECOVERY_SCB|flag; ahd_outb(ahd, MSG_OUT, HOST_MSG); ahd_outb(ahd, SCSISIGO, last_phase|ATNO); - printf("%s:%d:%d:%d: Device is active, asserting ATN\n", - ahd_name(ahd), cmd->device->channel, - cmd->device->id, cmd->device->lun); + scmd_printk(KERN_INFO, cmd, "Device is active, asserting ATN\n"); wait = TRUE; } else if (disconnected) { @@ -2277,9 +2269,7 @@ ahd_linux_queue_recovery_cmd(struct scsi_cmnd *cmd, scb_flag flag) printf("Device is disconnected, re-queuing SCB\n"); wait = TRUE; } else { - printf("%s:%d:%d:%d: Unable to deliver message\n", - ahd_name(ahd), cmd->device->channel, - cmd->device->id, cmd->device->lun); + scmd_printk(KERN_INFO, cmd, "Unable to deliver message\n"); retval = FAILED; goto done; } diff --git a/drivers/scsi/aic7xxx/aic7xxx_osm.c b/drivers/scsi/aic7xxx/aic7xxx_osm.c index 6ee1435d37f..7074ab95d1c 100644 --- a/drivers/scsi/aic7xxx/aic7xxx_osm.c +++ b/drivers/scsi/aic7xxx/aic7xxx_osm.c @@ -641,7 +641,7 @@ ahc_linux_slave_configure(struct scsi_device *sdev) ahc = *((struct ahc_softc **)sdev->host->hostdata); if (bootverbose) - printf("%s: Slave Configure %d\n", ahc_name(ahc), sdev->id); + sdev_printk(KERN_INFO, sdev, "Slave Configure\n"); ahc_linux_device_queue_depth(sdev); @@ -2117,9 +2117,7 @@ ahc_linux_queue_recovery_cmd(struct scsi_cmnd *cmd, scb_flag flag) wait = FALSE; ahc = *(struct ahc_softc **)cmd->device->host->hostdata; - printf("%s:%d:%d:%d: Attempting to queue a%s message\n", - ahc_name(ahc), cmd->device->channel, - cmd->device->id, cmd->device->lun, + scmd_printk(KERN_INFO, cmd, "Attempting to queue a%s message\n", flag == SCB_ABORT ? "n ABORT" : " TARGET RESET"); printf("CDB:"); @@ -2183,9 +2181,7 @@ ahc_linux_queue_recovery_cmd(struct scsi_cmnd *cmd, scb_flag flag) } if (pending_scb == NULL) { - printf("%s:%d:%d:%d: Command not found\n", - ahc_name(ahc), cmd->device->channel, cmd->device->id, - cmd->device->lun); + scmd_printk(KERN_INFO, cmd, "Command not found\n"); goto no_cmd; } @@ -2207,9 +2203,7 @@ ahc_linux_queue_recovery_cmd(struct scsi_cmnd *cmd, scb_flag flag) paused = TRUE; if ((pending_scb->flags & SCB_ACTIVE) == 0) { - printf("%s:%d:%d:%d: Command already completed\n", - ahc_name(ahc), cmd->device->channel, cmd->device->id, - cmd->device->lun); + scmd_printk(KERN_INFO, cmd, "Command already completed\n"); goto no_cmd; } @@ -2276,9 +2270,7 @@ ahc_linux_queue_recovery_cmd(struct scsi_cmnd *cmd, scb_flag flag) pending_scb->flags |= SCB_RECOVERY_SCB|flag; ahc_outb(ahc, MSG_OUT, HOST_MSG); ahc_outb(ahc, SCSISIGO, last_phase|ATNO); - printf("%s:%d:%d:%d: Device is active, asserting ATN\n", - ahc_name(ahc), cmd->device->channel, cmd->device->id, - cmd->device->lun); + scmd_printk(KERN_INFO, cmd, "Device is active, asserting ATN\n"); wait = TRUE; } else if (disconnected) { @@ -2344,9 +2336,7 @@ ahc_linux_queue_recovery_cmd(struct scsi_cmnd *cmd, scb_flag flag) printf("Device is disconnected, re-queuing SCB\n"); wait = TRUE; } else { - printf("%s:%d:%d:%d: Unable to deliver message\n", - ahc_name(ahc), cmd->device->channel, cmd->device->id, - cmd->device->lun); + scmd_printk(KERN_INFO, cmd, "Unable to deliver message\n"); retval = FAILED; goto done; } -- cgit v1.2.3 From 422c0d61d591cbfb70f029e13505fb437e169d68 Mon Sep 17 00:00:00 2001 From: Jeff Garzik Date: Mon, 24 Oct 2005 18:05:09 -0400 Subject: [SCSI] use scmd_id(), scmd_channel() throughout code Wrap a highly common idiom. Makes the code easier to read, helps pave the way for sdev->{id,channel} removal, and adds a token that can easily by grepped-for in the future. There are a couple sdev_id() and scmd_printk() updates thrown in as well. Rejections fixed up and Signed-off-by: James Bottomley --- drivers/scsi/aic7xxx/aic79xx_osm.c | 11 ++++++----- drivers/scsi/aic7xxx/aic7xxx_osm.c | 10 +++++----- 2 files changed, 11 insertions(+), 10 deletions(-) (limited to 'drivers/scsi/aic7xxx') diff --git a/drivers/scsi/aic7xxx/aic79xx_osm.c b/drivers/scsi/aic7xxx/aic79xx_osm.c index 5e023dca4e5..cfb46c241b3 100644 --- a/drivers/scsi/aic7xxx/aic79xx_osm.c +++ b/drivers/scsi/aic7xxx/aic79xx_osm.c @@ -398,7 +398,7 @@ ahd_linux_unmap_scb(struct ahd_softc *ahd, struct scb *scb) /******************************** Macros **************************************/ #define BUILD_SCSIID(ahd, cmd) \ - ((((cmd)->device->id << TID_SHIFT) & TID) | (ahd)->our_id) + (((scmd_id(cmd) << TID_SHIFT) & TID) | (ahd)->our_id) /* * Return a string describing the driver. @@ -685,7 +685,7 @@ ahd_linux_bus_reset(struct scsi_cmnd *cmd) ahd_name(ahd), cmd); #endif ahd_lock(ahd, &s); - found = ahd_reset_channel(ahd, cmd->device->channel + 'A', + found = ahd_reset_channel(ahd, scmd_channel(cmd) + 'A', /*initiate reset*/TRUE); ahd_unlock(ahd, &s); @@ -2110,8 +2110,9 @@ ahd_linux_queue_recovery_cmd(struct scsi_cmnd *cmd, scb_flag flag) /* Any SCB for this device will do for a target reset */ LIST_FOREACH(pending_scb, &ahd->pending_scbs, pending_links) { - if (ahd_match_scb(ahd, pending_scb, cmd->device->id, - cmd->device->channel + 'A', + if (ahd_match_scb(ahd, pending_scb, + scmd_id(cmd), + scmd_channel(cmd) + 'A', CAM_LUN_WILDCARD, SCB_LIST_NULL, ROLE_INITIATOR) == 0) break; @@ -2198,7 +2199,7 @@ ahd_linux_queue_recovery_cmd(struct scsi_cmnd *cmd, scb_flag flag) if (last_phase != P_BUSFREE && (SCB_GET_TAG(pending_scb) == active_scbptr || (flag == SCB_DEVICE_RESET - && SCSIID_TARGET(ahd, saved_scsiid) == cmd->device->id))) { + && SCSIID_TARGET(ahd, saved_scsiid) == scmd_id(cmd)))) { /* * We're active on the bus, so assert ATN diff --git a/drivers/scsi/aic7xxx/aic7xxx_osm.c b/drivers/scsi/aic7xxx/aic7xxx_osm.c index 7074ab95d1c..1861407422e 100644 --- a/drivers/scsi/aic7xxx/aic7xxx_osm.c +++ b/drivers/scsi/aic7xxx/aic7xxx_osm.c @@ -686,7 +686,7 @@ ahc_linux_biosparam(struct scsi_device *sdev, struct block_device *bdev, u_int channel; ahc = *((struct ahc_softc **)sdev->host->hostdata); - channel = sdev->channel; + channel = sdev_channel(sdev); bh = scsi_bios_ptable(bdev); if (bh) { @@ -759,7 +759,7 @@ ahc_linux_bus_reset(struct scsi_cmnd *cmd) ahc = *(struct ahc_softc **)cmd->device->host->hostdata; ahc_lock(ahc, &flags); - found = ahc_reset_channel(ahc, cmd->device->channel + 'A', + found = ahc_reset_channel(ahc, scmd_channel(cmd) + 'A', /*initiate reset*/TRUE); ahc_unlock(ahc, &flags); @@ -2172,8 +2172,8 @@ ahc_linux_queue_recovery_cmd(struct scsi_cmnd *cmd, scb_flag flag) /* Any SCB for this device will do for a target reset */ LIST_FOREACH(pending_scb, &ahc->pending_scbs, pending_links) { - if (ahc_match_scb(ahc, pending_scb, cmd->device->id, - cmd->device->channel + 'A', + if (ahc_match_scb(ahc, pending_scb, scmd_id(cmd), + scmd_channel(cmd) + 'A', CAM_LUN_WILDCARD, SCB_LIST_NULL, ROLE_INITIATOR) == 0) break; @@ -2260,7 +2260,7 @@ ahc_linux_queue_recovery_cmd(struct scsi_cmnd *cmd, scb_flag flag) if (last_phase != P_BUSFREE && (pending_scb->hscb->tag == active_scb_index || (flag == SCB_DEVICE_RESET - && SCSIID_TARGET(ahc, saved_scsiid) == cmd->device->id))) { + && SCSIID_TARGET(ahc, saved_scsiid) == scmd_id(cmd)))) { /* * We're active on the bus, so assert ATN -- cgit v1.2.3