]> git.karo-electronics.de Git - karo-tx-linux.git/commit
storage: Fix bus scan and multi-LUN support for SCM eUSCSI devices
authorMark Knibbs <markk@clara.co.uk>
Sat, 8 Nov 2014 21:39:55 +0000 (21:39 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 25 Nov 2014 01:22:38 +0000 (17:22 -0800)
commit646a3843177b2ae0cb81813ec0f830fe64e81bf1
tree207f3a865c9b38c6dd30a55e0a46f73030f7bbfb
parenteab77694098469d80e1186fdda9f965045730a3e
storage: Fix bus scan and multi-LUN support for SCM eUSCSI devices

This patch does two things for SCM eUSCSI USB-SCSI converters:

1. SCM eUSCSI bridge devices are hard-wired to use SCSI ID 7. On connecting
the converter, access to that ID is attempted during the bus scan. Asking
the converter to issue INQUIRY commands to itself isn't very polite and
wastes time. Set this_id to 7 so __scsi_scan_target() skips it in the scan.

2. Enable multi-LUN support. eUSCSI devices don't support Get Max LUN
requests, returning an error (-32). [Different targets could have different
numbers of LUNs, so it wouldn't make sense to return a particular value in
response to Get Max LUN.]

usb_stor_scan_dwork() does this:
    /* For bulk-only devices, determine the max LUN value */
    if (us->protocol == USB_PR_BULK && !(us->fflags & US_FL_SINGLE_LUN)) {
            mutex_lock(&us->dev_mutex);
            us->max_lun = usb_stor_Bulk_max_lun(us);
            mutex_unlock(&us->dev_mutex);

It avoids calling usb_stor_Bulk_max_lun() if US_FL_SINGLE_LUN, but not for
US_FL_SCM_MULT_TARG. Since usb_stor_Bulk_max_lun() returns 0 in the error
case, us->max_lun was always set to 0.

[If the user doesn't want multi-LUN support (perhaps there are SCSI devices
which respond to commands on all LUNs?), the US_FL_SINGLE_LUN quirk can be
specified on the kernel command line.]

Signed-off-by: Mark Knibbs <markk@clara.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/storage/usb.c