Commit 8cd1ec78 authored by Hannes Reinecke's avatar Hannes Reinecke Committed by Martin K. Petersen

scsi: scsi_lib: rework scsi_internal_device_unblock_nowait()

Rework scsi_internal_device_unblock_nowait() into using a switch
statement. No functional changes.
Signed-off-by: default avatarHannes Reinecke <hare@suse.com>
Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
Reviewed-by: default avatarJohannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
parent fe083323
...@@ -3073,19 +3073,24 @@ int scsi_internal_device_unblock_nowait(struct scsi_device *sdev, ...@@ -3073,19 +3073,24 @@ int scsi_internal_device_unblock_nowait(struct scsi_device *sdev,
* Try to transition the scsi device to SDEV_RUNNING or one of the * Try to transition the scsi device to SDEV_RUNNING or one of the
* offlined states and goose the device queue if successful. * offlined states and goose the device queue if successful.
*/ */
if ((sdev->sdev_state == SDEV_BLOCK) || switch (sdev->sdev_state) {
(sdev->sdev_state == SDEV_TRANSPORT_OFFLINE)) case SDEV_BLOCK:
case SDEV_TRANSPORT_OFFLINE:
sdev->sdev_state = new_state; sdev->sdev_state = new_state;
else if (sdev->sdev_state == SDEV_CREATED_BLOCK) { break;
case SDEV_CREATED_BLOCK:
if (new_state == SDEV_TRANSPORT_OFFLINE || if (new_state == SDEV_TRANSPORT_OFFLINE ||
new_state == SDEV_OFFLINE) new_state == SDEV_OFFLINE)
sdev->sdev_state = new_state; sdev->sdev_state = new_state;
else else
sdev->sdev_state = SDEV_CREATED; sdev->sdev_state = SDEV_CREATED;
} else if (sdev->sdev_state != SDEV_CANCEL && break;
sdev->sdev_state != SDEV_OFFLINE) case SDEV_CANCEL:
case SDEV_OFFLINE:
break;
default:
return -EINVAL; return -EINVAL;
}
scsi_start_queue(sdev); scsi_start_queue(sdev);
return 0; return 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