aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2016-07-16 09:16:43 -0400
committerTejun Heo <tj@kernel.org>2016-07-18 20:55:38 -0400
commit37f92d77dc45d1fb74eff8501f26e72a3dcaa3cf (patch)
tree329727c34d87d22f1abfdd864ae8efce190fd340
parentd6e50e379eb1e7f2426eac61a1bbbf6e4cf68905 (diff)
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>
-rw-r--r--drivers/ata/sata_dwc_460ex.c2
-rw-r--r--include/linux/ata.h28
-rw-r--r--include/linux/libata.h42
3 files changed, 23 insertions, 49 deletions
diff --git a/drivers/ata/sata_dwc_460ex.c b/drivers/ata/sata_dwc_460ex.c
index fa1530a9dc03..b051c03fefc2 100644
--- a/drivers/ata/sata_dwc_460ex.c
+++ b/drivers/ata/sata_dwc_460ex.c
@@ -281,7 +281,7 @@ static void sata_dwc_dma_exit_old(struct sata_dwc_device *hsdev)
281 281
282static const char *get_prot_descript(u8 protocol) 282static const char *get_prot_descript(u8 protocol)
283{ 283{
284 switch ((enum ata_tf_protocols)protocol) { 284 switch (protocol) {
285 case ATA_PROT_NODATA: 285 case ATA_PROT_NODATA:
286 return "ATA no data"; 286 return "ATA no data";
287 case ATA_PROT_PIO: 287 case ATA_PROT_PIO:
diff --git a/include/linux/ata.h b/include/linux/ata.h
index 5b67ff407ec2..adbc812c009b 100644
--- a/include/linux/ata.h
+++ b/include/linux/ata.h
@@ -523,17 +523,23 @@ enum {
523 SERR_DEV_XCHG = (1 << 26), /* device exchanged */ 523 SERR_DEV_XCHG = (1 << 26), /* device exchanged */
524}; 524};
525 525
526enum ata_tf_protocols { 526enum ata_prot_flags {
527 /* ATA taskfile protocols */ 527 /* protocol flags */
528 ATA_PROT_UNKNOWN, /* unknown/invalid */ 528 ATA_PROT_FLAG_PIO = (1 << 0), /* is PIO */
529 ATA_PROT_NODATA, /* no data */ 529 ATA_PROT_FLAG_DMA = (1 << 1), /* is DMA */
530 ATA_PROT_PIO, /* PIO data xfer */ 530 ATA_PROT_FLAG_NCQ = (1 << 2), /* is NCQ */
531 ATA_PROT_DMA, /* DMA */ 531 ATA_PROT_FLAG_ATAPI = (1 << 3), /* is ATAPI */
532 ATA_PROT_NCQ, /* NCQ */ 532
533 ATA_PROT_NCQ_NODATA, /* NCQ no data */ 533 /* taskfile protocols */
534 ATAPI_PROT_NODATA, /* packet command, no data */ 534 ATA_PROT_UNKNOWN = (u8)-1,
535 ATAPI_PROT_PIO, /* packet command, PIO data xfer*/ 535 ATA_PROT_NODATA = 0,
536 ATAPI_PROT_DMA, /* packet command with special DMA sauce */ 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
539enum ata_ioctls { 545enum ata_ioctls {
diff --git a/include/linux/libata.h b/include/linux/libata.h
index 5838fbf6acf7..e37d4f99f510 100644
--- a/include/linux/libata.h
+++ b/include/linux/libata.h
@@ -146,12 +146,6 @@ enum {
146 ATA_TFLAG_FUA = (1 << 5), /* enable FUA */ 146 ATA_TFLAG_FUA = (1 << 5), /* enable FUA */
147 ATA_TFLAG_POLLING = (1 << 6), /* set nIEN to 1 and use polling */ 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 /* struct ata_device stuff */ 149 /* struct ata_device stuff */
156 ATA_DFLAG_LBA = (1 << 0), /* device supports LBA */ 150 ATA_DFLAG_LBA = (1 << 0), /* device supports LBA */
157 ATA_DFLAG_LBA48 = (1 << 1), /* device supports LBA48 */ 151 ATA_DFLAG_LBA48 = (1 << 1), /* device supports LBA48 */
@@ -1038,55 +1032,29 @@ extern const unsigned long sata_deb_timing_long[];
1038extern struct ata_port_operations ata_dummy_port_ops; 1032extern struct ata_port_operations ata_dummy_port_ops;
1039extern const struct ata_port_info ata_dummy_port_info; 1033extern const struct ata_port_info ata_dummy_port_info;
1040 1034
1041/*
1042 * protocol tests
1043 */
1044static inline unsigned int ata_prot_flags(u8 prot)
1045{
1046 switch (prot) {
1047 case ATA_PROT_NODATA:
1048 return 0;
1049 case ATA_PROT_PIO:
1050 return ATA_PROT_FLAG_PIO;
1051 case ATA_PROT_DMA:
1052 return ATA_PROT_FLAG_DMA;
1053 case ATA_PROT_NCQ:
1054 return ATA_PROT_FLAG_DMA | ATA_PROT_FLAG_NCQ;
1055 case ATA_PROT_NCQ_NODATA:
1056 return ATA_PROT_FLAG_NCQ;
1057 case ATAPI_PROT_NODATA:
1058 return ATA_PROT_FLAG_ATAPI;
1059 case ATAPI_PROT_PIO:
1060 return ATA_PROT_FLAG_ATAPI | ATA_PROT_FLAG_PIO;
1061 case ATAPI_PROT_DMA:
1062 return ATA_PROT_FLAG_ATAPI | ATA_PROT_FLAG_DMA;
1063 }
1064 return 0;
1065}
1066
1067static inline bool ata_is_atapi(u8 prot) 1035static inline bool ata_is_atapi(u8 prot)
1068{ 1036{
1069 return ata_prot_flags(prot) & ATA_PROT_FLAG_ATAPI; 1037 return prot & ATA_PROT_FLAG_ATAPI;
1070} 1038}
1071 1039
1072static inline bool ata_is_pio(u8 prot) 1040static inline bool ata_is_pio(u8 prot)
1073{ 1041{
1074 return ata_prot_flags(prot) & ATA_PROT_FLAG_PIO; 1042 return prot & ATA_PROT_FLAG_PIO;
1075} 1043}
1076 1044
1077static inline bool ata_is_dma(u8 prot) 1045static inline bool ata_is_dma(u8 prot)
1078{ 1046{
1079 return ata_prot_flags(prot) & ATA_PROT_FLAG_DMA; 1047 return prot & ATA_PROT_FLAG_DMA;
1080} 1048}
1081 1049
1082static inline bool ata_is_ncq(u8 prot) 1050static inline bool ata_is_ncq(u8 prot)
1083{ 1051{
1084 return ata_prot_flags(prot) & ATA_PROT_FLAG_NCQ; 1052 return prot & ATA_PROT_FLAG_NCQ;
1085} 1053}
1086 1054
1087static inline bool ata_is_data(u8 prot) 1055static inline bool ata_is_data(u8 prot)
1088{ 1056{
1089 return ata_prot_flags(prot) & (ATA_PROT_FLAG_PIO | ATA_PROT_FLAG_DMA); 1057 return prot & (ATA_PROT_FLAG_PIO | ATA_PROT_FLAG_DMA);
1090} 1058}
1091 1059
1092static inline int is_multi_taskfile(struct ata_taskfile *tf) 1060static inline int is_multi_taskfile(struct ata_taskfile *tf)