diff options
author | Dave Airlie <airlied@redhat.com> | 2016-04-22 00:32:51 +0200 |
---|---|---|
committer | Dave Airlie <airlied@redhat.com> | 2016-04-22 00:32:51 +0200 |
commit | 49047962ecf02d76bdaa378c00a51c9b829ac195 (patch) | |
tree | 4e711bead6598486b033c4d2dbdb7f7c0dd6f23a /include/scsi/scsi_device.h | |
parent | Merge tag 'topic/drm-misc-2016-04-21' of git://anongit.freedesktop.org/drm-in... (diff) | |
parent | Linux 4.6-rc3 (diff) | |
download | linux-49047962ecf02d76bdaa378c00a51c9b829ac195.tar.xz linux-49047962ecf02d76bdaa378c00a51c9b829ac195.zip |
Merge tag 'v4.6-rc3' into drm-next
Backmerge 4.6-rc3 for i915.
Linux 4.6-rc3
Diffstat (limited to 'include/scsi/scsi_device.h')
-rw-r--r-- | include/scsi/scsi_device.h | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/include/scsi/scsi_device.h b/include/scsi/scsi_device.h index c067019ed12a..74d79bde7075 100644 --- a/include/scsi/scsi_device.h +++ b/include/scsi/scsi_device.h @@ -516,6 +516,31 @@ static inline int scsi_device_tpgs(struct scsi_device *sdev) return sdev->inquiry ? (sdev->inquiry[5] >> 4) & 0x3 : 0; } +/** + * scsi_device_supports_vpd - test if a device supports VPD pages + * @sdev: the &struct scsi_device to test + * + * If the 'try_vpd_pages' flag is set it takes precedence. + * Otherwise we will assume VPD pages are supported if the + * SCSI level is at least SPC-3 and 'skip_vpd_pages' is not set. + */ +static inline int scsi_device_supports_vpd(struct scsi_device *sdev) +{ + /* Attempt VPD inquiry if the device blacklist explicitly calls + * for it. + */ + if (sdev->try_vpd_pages) + return 1; + /* + * Although VPD inquiries can go to SCSI-2 type devices, + * some USB ones crash on receiving them, and the pages + * we currently ask for are for SPC-3 and beyond + */ + if (sdev->scsi_level > SCSI_SPC_2 && !sdev->skip_vpd_pages) + return 1; + return 0; +} + #define MODULE_ALIAS_SCSI_DEVICE(type) \ MODULE_ALIAS("scsi:t-" __stringify(type) "*") #define SCSI_DEVICE_MODALIAS_FMT "scsi:t-0x%02x" |