aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2009-11-17 14:01:54 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2009-11-17 14:01:54 -0500
commit23f268fa2db4cbe6c4c668d6c277fae906f54922 (patch)
tree05e4baecce7415daedd591df0f3173872da53b07 /include
parentac50e950784cae1c26ad9e09ebd8f8c706131eb3 (diff)
parent1a0f437235ccb15361bfe0a37c7023f6234c2e9f (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi-rc-fixes-2.6
* git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi-rc-fixes-2.6: [SCSI] bfa: declare MODULE_FIRMWARE [SCSI] gdth: Prevent negative offsets in ioctl CVE-2009-3080 [SCSI] libsas: do not set res = 0 in sas_ex_discover_dev() [SCSI] Fix incorrect reporting of host protection capabilities [SCSI] pmcraid: Fix ppc64 driver build for using cpu_to_le32 on U8 data type [SCSI] ipr: add workaround for MSI interrupts on P7 [SCSI] scsi_transport_fc: Fix WARN message for FC passthru failure paths [SCSI] bfa: fix test in bfad_os_fc_host_init()
Diffstat (limited to 'include')
-rw-r--r--include/scsi/scsi_host.h29
1 files changed, 11 insertions, 18 deletions
diff --git a/include/scsi/scsi_host.h b/include/scsi/scsi_host.h
index 6e728b176904..47941fc5aba7 100644
--- a/include/scsi/scsi_host.h
+++ b/include/scsi/scsi_host.h
@@ -797,30 +797,23 @@ static inline unsigned int scsi_host_get_prot(struct Scsi_Host *shost)
797 797
798static inline unsigned int scsi_host_dif_capable(struct Scsi_Host *shost, unsigned int target_type) 798static inline unsigned int scsi_host_dif_capable(struct Scsi_Host *shost, unsigned int target_type)
799{ 799{
800 switch (target_type) { 800 static unsigned char cap[] = { 0,
801 case 1: 801 SHOST_DIF_TYPE1_PROTECTION,
802 if (shost->prot_capabilities & SHOST_DIF_TYPE1_PROTECTION) 802 SHOST_DIF_TYPE2_PROTECTION,
803 return target_type; 803 SHOST_DIF_TYPE3_PROTECTION };
804 case 2:
805 if (shost->prot_capabilities & SHOST_DIF_TYPE2_PROTECTION)
806 return target_type;
807 case 3:
808 if (shost->prot_capabilities & SHOST_DIF_TYPE3_PROTECTION)
809 return target_type;
810 }
811 804
812 return 0; 805 return shost->prot_capabilities & cap[target_type] ? target_type : 0;
813} 806}
814 807
815static inline unsigned int scsi_host_dix_capable(struct Scsi_Host *shost, unsigned int target_type) 808static inline unsigned int scsi_host_dix_capable(struct Scsi_Host *shost, unsigned int target_type)
816{ 809{
817#if defined(CONFIG_BLK_DEV_INTEGRITY) 810#if defined(CONFIG_BLK_DEV_INTEGRITY)
818 switch (target_type) { 811 static unsigned char cap[] = { SHOST_DIX_TYPE0_PROTECTION,
819 case 0: return shost->prot_capabilities & SHOST_DIX_TYPE0_PROTECTION; 812 SHOST_DIX_TYPE1_PROTECTION,
820 case 1: return shost->prot_capabilities & SHOST_DIX_TYPE1_PROTECTION; 813 SHOST_DIX_TYPE2_PROTECTION,
821 case 2: return shost->prot_capabilities & SHOST_DIX_TYPE2_PROTECTION; 814 SHOST_DIX_TYPE3_PROTECTION };
822 case 3: return shost->prot_capabilities & SHOST_DIX_TYPE3_PROTECTION; 815
823 } 816 return shost->prot_capabilities & cap[target_type];
824#endif 817#endif
825 return 0; 818 return 0;
826} 819}