[SCSI] sd: fix up start/stop messages for new sd_printk() API

Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
This commit is contained in:
James Bottomley 2007-03-20 12:26:03 -05:00 committed by James Bottomley
parent c3c94c5a2f
commit cc5d2c8c64
1 changed files with 16 additions and 22 deletions

View File

@ -1733,10 +1733,11 @@ static void scsi_disk_release(struct class_device *cdev)
kfree(sdkp); kfree(sdkp);
} }
static int sd_start_stop_device(struct scsi_device *sdp, int start) static int sd_start_stop_device(struct scsi_disk *sdkp, int start)
{ {
unsigned char cmd[6] = { START_STOP }; /* START_VALID */ unsigned char cmd[6] = { START_STOP }; /* START_VALID */
struct scsi_sense_hdr sshdr; struct scsi_sense_hdr sshdr;
struct scsi_device *sdp = sdkp->device;
int res; int res;
if (start) if (start)
@ -1748,12 +1749,10 @@ static int sd_start_stop_device(struct scsi_device *sdp, int start)
res = scsi_execute_req(sdp, cmd, DMA_NONE, NULL, 0, &sshdr, res = scsi_execute_req(sdp, cmd, DMA_NONE, NULL, 0, &sshdr,
SD_TIMEOUT, SD_MAX_RETRIES); SD_TIMEOUT, SD_MAX_RETRIES);
if (res) { if (res) {
printk(KERN_WARNING "FAILED\n status = %x, message = %02x, " sd_printk(KERN_WARNING, sdkp, "START_STOP FAILED\n");
"host = %d, driver = %02x\n ", sd_print_result(sdkp, res);
status_byte(res), msg_byte(res),
host_byte(res), driver_byte(res));
if (driver_byte(res) & DRIVER_SENSE) if (driver_byte(res) & DRIVER_SENSE)
scsi_print_sense_hdr("sd", &sshdr); sd_print_sense_hdr(sdkp, &sshdr);
} }
return res; return res;
@ -1766,7 +1765,6 @@ static int sd_start_stop_device(struct scsi_device *sdp, int start)
*/ */
static void sd_shutdown(struct device *dev) static void sd_shutdown(struct device *dev)
{ {
struct scsi_device *sdp = to_scsi_device(dev);
struct scsi_disk *sdkp = scsi_disk_get_from_dev(dev); struct scsi_disk *sdkp = scsi_disk_get_from_dev(dev);
if (!sdkp) if (!sdkp)
@ -1777,10 +1775,9 @@ static void sd_shutdown(struct device *dev)
sd_sync_cache(sdkp); sd_sync_cache(sdkp);
} }
if (system_state != SYSTEM_RESTART && sdp->manage_start_stop) { if (system_state != SYSTEM_RESTART && sdkp->device->manage_start_stop) {
printk(KERN_NOTICE "Stopping disk %s: \n", sd_printk(KERN_NOTICE, sdkp, "Stopping disk\n");
sdkp->disk->disk_name); sd_start_stop_device(sdkp, 0);
sd_start_stop_device(sdp, 0);
} }
scsi_disk_put(sdkp); scsi_disk_put(sdkp);
@ -1788,7 +1785,6 @@ static void sd_shutdown(struct device *dev)
static int sd_suspend(struct device *dev, pm_message_t mesg) static int sd_suspend(struct device *dev, pm_message_t mesg)
{ {
struct scsi_device *sdp = to_scsi_device(dev);
struct scsi_disk *sdkp = scsi_disk_get_from_dev(dev); struct scsi_disk *sdkp = scsi_disk_get_from_dev(dev);
int ret; int ret;
@ -1796,17 +1792,16 @@ static int sd_suspend(struct device *dev, pm_message_t mesg)
return 0; /* this can happen */ return 0; /* this can happen */
if (sdkp->WCE) { if (sdkp->WCE) {
printk(KERN_NOTICE "Synchronizing SCSI cache for disk %s: \n", sd_printk(KERN_NOTICE, sdkp, "Synchronizing SCSI cache\n");
sdkp->disk->disk_name);
ret = sd_sync_cache(sdkp); ret = sd_sync_cache(sdkp);
if (ret) if (ret)
return ret; return ret;
} }
if (mesg.event == PM_EVENT_SUSPEND && sdp->manage_start_stop) { if (mesg.event == PM_EVENT_SUSPEND &&
printk(KERN_NOTICE "Stopping disk %s: \n", sdkp->device->manage_start_stop) {
sdkp->disk->disk_name); sd_printk(KERN_NOTICE, sdkp, "Stopping disk\n");
ret = sd_start_stop_device(sdp, 0); ret = sd_start_stop_device(sdkp, 0);
if (ret) if (ret)
return ret; return ret;
} }
@ -1816,15 +1811,14 @@ static int sd_suspend(struct device *dev, pm_message_t mesg)
static int sd_resume(struct device *dev) static int sd_resume(struct device *dev)
{ {
struct scsi_device *sdp = to_scsi_device(dev);
struct scsi_disk *sdkp = scsi_disk_get_from_dev(dev); struct scsi_disk *sdkp = scsi_disk_get_from_dev(dev);
if (!sdp->manage_start_stop) if (!sdkp->device->manage_start_stop)
return 0; return 0;
printk(KERN_NOTICE "Starting disk %s: \n", sdkp->disk->disk_name); sd_printk(KERN_NOTICE, sdkp, "Starting disk\n");
return sd_start_stop_device(sdp, 1); return sd_start_stop_device(sdkp, 1);
} }
/** /**