On Tue, Aug 20, 2013 at 02:08:39PM +0200, Bart Van Assche wrote:
> Changing the state of a SCSI device via sysfs into "cancel",
> "cancel-offline" or "deleted" prevents removal of these devices by
> scsi_remove_host(). Hence do not allow this.

Looks good modulo a minor style nipick below.

Reviewed-by: Christoph Hellwig <[email protected]>

> +     if (state == 0 || state == SDEV_CANCEL ||
> +         state == SDEV_CANCEL_OFFLINE || state == SDEV_DEL ||
> +         scsi_device_set_state(sdev, state) != 0)
>               return -EINVAL;

Doing a switch on the state would be a lot more readable here:

        switch (state) {
        case 0:
        case SDEV_CANCEL:
        case SDEV_CANCEL_OFFLINE:
        case SDEV_DEL:
                ret = -EINVAL;
                break;
        default:
                ret = scsi_device_set_state(sdev, state);
        }

        if (ret)
                return ret;
>       return count;
>  }
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to