aboutsummaryrefslogtreecommitdiffstats
path: root/include/scsi/scsi_host.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/scsi/scsi_host.h')
-rw-r--r--include/scsi/scsi_host.h24
1 files changed, 12 insertions, 12 deletions
diff --git a/include/scsi/scsi_host.h b/include/scsi/scsi_host.h
index b62a097b3ecb..47941fc5aba7 100644
--- a/include/scsi/scsi_host.h
+++ b/include/scsi/scsi_host.h
@@ -797,24 +797,24 @@ 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: return shost->prot_capabilities & SHOST_DIF_TYPE1_PROTECTION; 801 SHOST_DIF_TYPE1_PROTECTION,
802 case 2: return shost->prot_capabilities & SHOST_DIF_TYPE2_PROTECTION; 802 SHOST_DIF_TYPE2_PROTECTION,
803 case 3: return shost->prot_capabilities & SHOST_DIF_TYPE3_PROTECTION; 803 SHOST_DIF_TYPE3_PROTECTION };
804 }
805 804
806 return 0; 805 return shost->prot_capabilities & cap[target_type] ? target_type : 0;
807} 806}
808 807
809static 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)
810{ 809{
811 switch (target_type) { 810#if defined(CONFIG_BLK_DEV_INTEGRITY)
812 case 0: return shost->prot_capabilities & SHOST_DIX_TYPE0_PROTECTION; 811 static unsigned char cap[] = { SHOST_DIX_TYPE0_PROTECTION,
813 case 1: return shost->prot_capabilities & SHOST_DIX_TYPE1_PROTECTION; 812 SHOST_DIX_TYPE1_PROTECTION,
814 case 2: return shost->prot_capabilities & SHOST_DIX_TYPE2_PROTECTION; 813 SHOST_DIX_TYPE2_PROTECTION,
815 case 3: return shost->prot_capabilities & SHOST_DIX_TYPE3_PROTECTION; 814 SHOST_DIX_TYPE3_PROTECTION };
816 }
817 815
816 return shost->prot_capabilities & cap[target_type];
817#endif
818 return 0; 818 return 0;
819} 819}
820 820