[PATCH 2/3] usb-storage: use NO_WP_DETECT for two devices

From: Paul Bolle
Date: Tue May 08 2012 - 06:23:38 EST


Two USB memory sticks will generate two errors when inserted
[...] Asking for cache data failed
[...] Assuming drive cache: write through

These errors are generated by the SCSI stack (and printed thrice).
Adding some printk()s to drivers/scsi/sd.c revealed the header of the
MODE SENSE response was shorter than three bytes. That triggers the
bad_sense error path, which for these two devices prints the "Asking for
cache data failed" error. That error can be avoided by adding the
NO_WP_DETECT quirk to these devices: it will set the skip_ms_page_3f
flag which will make the SCSI code skip MODE SENSE with page=0x3f (and
assume these devices are write enabled)

(The second error can be avoided by downgrading it to a notice, which is
done in a separate commit.)

Signed-off-by: Paul Bolle <pebolle@xxxxxxxxxx>
---
Note: I used the coding style of this file, which checkpatch doesn't
like.

drivers/usb/storage/unusual_devs.h | 8 +++++++-
1 files changed, 7 insertions(+), 1 deletions(-)

diff --git a/drivers/usb/storage/unusual_devs.h b/drivers/usb/storage/unusual_devs.h
index 856ad92..2a7b87f 100644
--- a/drivers/usb/storage/unusual_devs.h
+++ b/drivers/usb/storage/unusual_devs.h
@@ -261,7 +261,7 @@ UNUSUAL_DEV( 0x0457, 0x0151, 0x0100, 0x0100,
"USB 2.0",
"Flash Disk",
USB_SC_DEVICE, USB_PR_DEVICE, NULL,
- US_FL_NOT_LOCKABLE ),
+ US_FL_NOT_LOCKABLE | US_FL_NO_WP_DETECT ),

/* Reported by Tamas Kerecsen <kerecsen@xxxxxxxxxxx>
* Obviously the PROM has not been customized by the VAR;
@@ -1840,6 +1840,12 @@ UNUSUAL_DEV( 0x12d1, 0x143F, 0x0000, 0x0000,
USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_huawei_e220_init,
0),

+UNUSUAL_DEV( 0x1307, 0x0163, 0x0100, 0x0100,
+ "P Technology",
+ "USB Mass Storage Device",
+ USB_SC_DEVICE, USB_PR_DEVICE, NULL,
+ US_FL_NO_WP_DETECT ),
+
/* Reported by Vilius Bilinkevicius <vilisas AT xxx DOT lt) */
UNUSUAL_DEV( 0x132b, 0x000b, 0x0001, 0x0001,
"Minolta",
--
1.7.7.6




--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/