Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ata: define ATA_PROT_* in terms of ATA_PROT_FLAG_*

This avoid the need to always translate between the two in ata_prot_flags
and generally cleans up the taskfile protocol usage.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Tejun Heo <tj@kernel.org>

authored by

Christoph Hellwig and committed by
Tejun Heo
37f92d77 d6e50e37

+23 -49
+1 -1
drivers/ata/sata_dwc_460ex.c
··· 281 281 282 282 static const char *get_prot_descript(u8 protocol) 283 283 { 284 - switch ((enum ata_tf_protocols)protocol) { 284 + switch (protocol) { 285 285 case ATA_PROT_NODATA: 286 286 return "ATA no data"; 287 287 case ATA_PROT_PIO:
+17 -11
include/linux/ata.h
··· 523 523 SERR_DEV_XCHG = (1 << 26), /* device exchanged */ 524 524 }; 525 525 526 - enum ata_tf_protocols { 527 - /* ATA taskfile protocols */ 528 - ATA_PROT_UNKNOWN, /* unknown/invalid */ 529 - ATA_PROT_NODATA, /* no data */ 530 - ATA_PROT_PIO, /* PIO data xfer */ 531 - ATA_PROT_DMA, /* DMA */ 532 - ATA_PROT_NCQ, /* NCQ */ 533 - ATA_PROT_NCQ_NODATA, /* NCQ no data */ 534 - ATAPI_PROT_NODATA, /* packet command, no data */ 535 - ATAPI_PROT_PIO, /* packet command, PIO data xfer*/ 536 - ATAPI_PROT_DMA, /* packet command with special DMA sauce */ 526 + enum ata_prot_flags { 527 + /* protocol flags */ 528 + ATA_PROT_FLAG_PIO = (1 << 0), /* is PIO */ 529 + ATA_PROT_FLAG_DMA = (1 << 1), /* is DMA */ 530 + ATA_PROT_FLAG_NCQ = (1 << 2), /* is NCQ */ 531 + ATA_PROT_FLAG_ATAPI = (1 << 3), /* is ATAPI */ 532 + 533 + /* taskfile protocols */ 534 + ATA_PROT_UNKNOWN = (u8)-1, 535 + ATA_PROT_NODATA = 0, 536 + ATA_PROT_PIO = ATA_PROT_FLAG_PIO, 537 + ATA_PROT_DMA = ATA_PROT_FLAG_DMA, 538 + ATA_PROT_NCQ_NODATA = ATA_PROT_FLAG_NCQ, 539 + ATA_PROT_NCQ = ATA_PROT_FLAG_DMA | ATA_PROT_FLAG_NCQ, 540 + ATAPI_PROT_NODATA = ATA_PROT_FLAG_ATAPI, 541 + ATAPI_PROT_PIO = ATA_PROT_FLAG_ATAPI | ATA_PROT_FLAG_PIO, 542 + ATAPI_PROT_DMA = ATA_PROT_FLAG_ATAPI | ATA_PROT_FLAG_DMA, 537 543 }; 538 544 539 545 enum ata_ioctls {
+5 -37
include/linux/libata.h
··· 146 146 ATA_TFLAG_FUA = (1 << 5), /* enable FUA */ 147 147 ATA_TFLAG_POLLING = (1 << 6), /* set nIEN to 1 and use polling */ 148 148 149 - /* protocol flags */ 150 - ATA_PROT_FLAG_PIO = (1 << 0), /* is PIO */ 151 - ATA_PROT_FLAG_DMA = (1 << 1), /* is DMA */ 152 - ATA_PROT_FLAG_NCQ = (1 << 2), /* is NCQ */ 153 - ATA_PROT_FLAG_ATAPI = (1 << 3), /* is ATAPI */ 154 - 155 149 /* struct ata_device stuff */ 156 150 ATA_DFLAG_LBA = (1 << 0), /* device supports LBA */ 157 151 ATA_DFLAG_LBA48 = (1 << 1), /* device supports LBA48 */ ··· 1032 1038 extern struct ata_port_operations ata_dummy_port_ops; 1033 1039 extern const struct ata_port_info ata_dummy_port_info; 1034 1040 1035 - /* 1036 - * protocol tests 1037 - */ 1038 - static inline unsigned int ata_prot_flags(u8 prot) 1039 - { 1040 - switch (prot) { 1041 - case ATA_PROT_NODATA: 1042 - return 0; 1043 - case ATA_PROT_PIO: 1044 - return ATA_PROT_FLAG_PIO; 1045 - case ATA_PROT_DMA: 1046 - return ATA_PROT_FLAG_DMA; 1047 - case ATA_PROT_NCQ: 1048 - return ATA_PROT_FLAG_DMA | ATA_PROT_FLAG_NCQ; 1049 - case ATA_PROT_NCQ_NODATA: 1050 - return ATA_PROT_FLAG_NCQ; 1051 - case ATAPI_PROT_NODATA: 1052 - return ATA_PROT_FLAG_ATAPI; 1053 - case ATAPI_PROT_PIO: 1054 - return ATA_PROT_FLAG_ATAPI | ATA_PROT_FLAG_PIO; 1055 - case ATAPI_PROT_DMA: 1056 - return ATA_PROT_FLAG_ATAPI | ATA_PROT_FLAG_DMA; 1057 - } 1058 - return 0; 1059 - } 1060 - 1061 1041 static inline bool ata_is_atapi(u8 prot) 1062 1042 { 1063 - return ata_prot_flags(prot) & ATA_PROT_FLAG_ATAPI; 1043 + return prot & ATA_PROT_FLAG_ATAPI; 1064 1044 } 1065 1045 1066 1046 static inline bool ata_is_pio(u8 prot) 1067 1047 { 1068 - return ata_prot_flags(prot) & ATA_PROT_FLAG_PIO; 1048 + return prot & ATA_PROT_FLAG_PIO; 1069 1049 } 1070 1050 1071 1051 static inline bool ata_is_dma(u8 prot) 1072 1052 { 1073 - return ata_prot_flags(prot) & ATA_PROT_FLAG_DMA; 1053 + return prot & ATA_PROT_FLAG_DMA; 1074 1054 } 1075 1055 1076 1056 static inline bool ata_is_ncq(u8 prot) 1077 1057 { 1078 - return ata_prot_flags(prot) & ATA_PROT_FLAG_NCQ; 1058 + return prot & ATA_PROT_FLAG_NCQ; 1079 1059 } 1080 1060 1081 1061 static inline bool ata_is_data(u8 prot) 1082 1062 { 1083 - return ata_prot_flags(prot) & (ATA_PROT_FLAG_PIO | ATA_PROT_FLAG_DMA); 1063 + return prot & (ATA_PROT_FLAG_PIO | ATA_PROT_FLAG_DMA); 1084 1064 } 1085 1065 1086 1066 static inline int is_multi_taskfile(struct ata_taskfile *tf)