Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

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

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
Loading
Loading
Loading
Loading
+11 −6
Original line number Original line Diff line number Diff line
@@ -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;