diff options
author | Jens Axboe | 2009-12-03 13:49:39 +0100 |
---|---|---|
committer | Jens Axboe | 2009-12-03 13:49:39 +0100 |
commit | 220d0b1dbf78c6417a658c96e571415552d3abac (patch) | |
tree | 70cd3862540c38ea490e7a27c3c7acc35b680234 /include/scsi/scsi_host.h | |
parent | cfq-iosched: no dispatch limit for single queue (diff) | |
parent | Linux 2.6.32 (diff) | |
download | kernel-qcow2-linux-220d0b1dbf78c6417a658c96e571415552d3abac.tar.gz kernel-qcow2-linux-220d0b1dbf78c6417a658c96e571415552d3abac.tar.xz kernel-qcow2-linux-220d0b1dbf78c6417a658c96e571415552d3abac.zip |
Merge branch 'master' into for-2.6.33
Diffstat (limited to 'include/scsi/scsi_host.h')
-rw-r--r-- | include/scsi/scsi_host.h | 29 |
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) static inline unsigned int scsi_host_dif_capable(struct Scsi_Host *shost, unsigned int target_type) { - switch (target_type) { - case 1: - if (shost->prot_capabilities & SHOST_DIF_TYPE1_PROTECTION) - return target_type; - case 2: - if (shost->prot_capabilities & SHOST_DIF_TYPE2_PROTECTION) - return target_type; - case 3: - if (shost->prot_capabilities & SHOST_DIF_TYPE3_PROTECTION) - return target_type; - } + static unsigned char cap[] = { 0, + SHOST_DIF_TYPE1_PROTECTION, + SHOST_DIF_TYPE2_PROTECTION, + SHOST_DIF_TYPE3_PROTECTION }; - return 0; + return shost->prot_capabilities & cap[target_type] ? target_type : 0; } static inline unsigned int scsi_host_dix_capable(struct Scsi_Host *shost, unsigned int target_type) { #if defined(CONFIG_BLK_DEV_INTEGRITY) - switch (target_type) { - case 0: return shost->prot_capabilities & SHOST_DIX_TYPE0_PROTECTION; - case 1: return shost->prot_capabilities & SHOST_DIX_TYPE1_PROTECTION; - case 2: return shost->prot_capabilities & SHOST_DIX_TYPE2_PROTECTION; - case 3: return shost->prot_capabilities & SHOST_DIX_TYPE3_PROTECTION; - } + static unsigned char cap[] = { SHOST_DIX_TYPE0_PROTECTION, + SHOST_DIX_TYPE1_PROTECTION, + SHOST_DIX_TYPE2_PROTECTION, + SHOST_DIX_TYPE3_PROTECTION }; + + return shost->prot_capabilities & cap[target_type]; #endif return 0; } |