[SCSI] use scmd_id(), scmd_channel() throughout code
[deliverable/linux.git] / drivers / scsi / aic7xxx / aic79xx_osm.c
index 6b6d4e287793acd5b3c044e7f80e7cf4ab7bba5f..cfb46c241b38c96f8614be60043a995b82ff38f0 100644 (file)
@@ -52,6 +52,7 @@ static struct scsi_transport_template *ahd_linux_transport_template = NULL;
 #include <linux/mm.h>          /* For fetching system memory size */
 #include <linux/blkdev.h>              /* For block_size() */
 #include <linux/delay.h>       /* For ssleep/msleep */
+#include <linux/device.h>
 
 /*
  * Bucket size for counting good commands in between bad ones.
@@ -397,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.
@@ -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);
 
@@ -684,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);
 
@@ -1192,11 +1193,6 @@ ahd_platform_free(struct ahd_softc *ahd)
        int i, j;
 
        if (ahd->platform_data != NULL) {
-               if (ahd->platform_data->host != NULL) {
-                       scsi_remove_host(ahd->platform_data->host);
-                       scsi_host_put(ahd->platform_data->host);
-               }
-
                /* destroy all of the device and target objects */
                for (i = 0; i < AHD_NUM_TARGETS; i++) {
                        starget = ahd->platform_data->starget[i];
@@ -1226,6 +1222,9 @@ ahd_platform_free(struct ahd_softc *ahd)
                        release_mem_region(ahd->platform_data->mem_busaddr,
                                           0x1000);
                }
+               if (ahd->platform_data->host)
+                       scsi_host_put(ahd->platform_data->host);
+
                free(ahd->platform_data, M_DEVBUF);
        }
 }
@@ -2069,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:");
@@ -2095,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;
        }
@@ -2114,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;
@@ -2123,9 +2120,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;
        }
 
@@ -2148,9 +2143,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;
        }
 
@@ -2206,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
@@ -2216,9 +2209,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) {
 
@@ -2279,9 +2270,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;
        }
This page took 0.029046 seconds and 5 git commands to generate.