protocol flag cleanups
This series contains a few cleanups for the way the ATA_PROT_* values are handled.
PATCH 1/3 libata: remove ata_is_nodata
The only caller an just check for !ata_is_data instead.
--- drivers/ata/libata-core.c | 2 +- include/linux/libata.h | 5 ----- 2 files changed, 1 insertion(+), 6 deletions(-)
drivers/ata/libata-core.c +1 -1
@@ -5044,7 +5044,7 @@ static void ata_verify_xfer(struct ata_queued_cmd *qc) {struct ata_device *dev = qc->dev; -if (ata_is_nodata (qc->tf.protocol)) +if (!ata_is_data (qc->tf.protocol))return ;if ((dev->mwdma_mask || dev->udma_mask) &&ata_is_pio (qc->tf.protocol))
include/linux/libata.h +0 -5
@@ -1070,11 +1070,6 @@ static inline bool ata_is_atapi(u8 prot)return ata_prot_flags (prot) &ATA_PROT_FLAG_ATAPI ; } -static inline bool ata_is_nodata (u8 prot) -{ -return !(ata_prot_flags (prot) &ATA_PROT_FLAG_DATA ); -} -static inline bool ata_is_pio (u8 prot) {return ata_prot_flags (prot) &ATA_PROT_FLAG_PIO ;
Signature · 1 line
2.1.4
PATCH 2/3 libata: remove ATA_PROT_FLAG_DATA
In reply to Christoph HellwigInstead we can simply check for PIO or DMA in ata_is_data.
--- include/linux/libata.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
include/linux/libata.h +1 -2
@@ -149,7 +149,6 @@ enum {/* protocol flags */ ATA_PROT_FLAG_PIO = (1 <<0 ),/* is PIO */ ATA_PROT_FLAG_DMA = (1 <<1 ),/* is DMA */ -ATA_PROT_FLAG_DATA =ATA_PROT_FLAG_PIO |ATA_PROT_FLAG_DMA ,ATA_PROT_FLAG_NCQ = (1 <<2 ),/* is NCQ */ ATA_PROT_FLAG_ATAPI = (1 << 3), /* is ATAPI */
@@ -1087,7 +1086,7 @@ static inline bool ata_is_ncq(u8 prot)static inline bool ata_is_data (u8 prot) { -return ata_prot_flags (prot) &ATA_PROT_FLAG_DATA ; +return ata_prot_flags (prot) & (ATA_PROT_FLAG_PIO |ATA_PROT_FLAG_DMA ); }static inline int is_multi_taskfile (struct ata_taskfile *tf)
Signature · 1 line
2.1.4
PATCH 3/3 ata: define ATA_PROT_* in terms of ATA_PROT_FLAG_*
In reply to Christoph HellwigThis avoid the need to always translate between the two in ata_prot_flags and generally cleans up the taskfile protocol usage.
--- drivers/ata/sata_dwc_460ex.c | 2 +- include/linux/ata.h | 28 +++++++++++++++++----------- include/linux/libata.h | 42 +++++------------------------------------- 3 files changed, 23 insertions(+), 49 deletions(-)
drivers/ata/sata_dwc_460ex.c +1 -1
@@ -281,7 +281,7 @@ static void sata_dwc_dma_exit_old(struct sata_dwc_device *hsdev)static const char *get_prot_descript (u8 protocol) { -switch ((enum ata_tf_protocols )protocol) { +switch (protocol) {case ATA_PROT_NODATA :return "ATA no data" ;case ATA_PROT_PIO :
include/linux/ata.h +17 -11
@@ -523,17 +523,23 @@ enum { SERR_DEV_XCHG = (1 << 26), /* device exchanged */ }; -enum ata_tf_protocols { -/* ATA taskfile protocols */ -ATA_PROT_UNKNOWN ,/* unknown/invalid */ -ATA_PROT_NODATA ,/* no data */ -ATA_PROT_PIO ,/* PIO data xfer */ -ATA_PROT_DMA ,/* DMA */ -ATA_PROT_NCQ ,/* NCQ */ -ATA_PROT_NCQ_NODATA ,/* NCQ no data */ -ATAPI_PROT_NODATA ,/* packet command, no data */ -ATAPI_PROT_PIO ,/* packet command, PIO data xfer*/ -ATAPI_PROT_DMA ,/* packet command with special DMA sauce */ +enum ata_prot_flags { +/* protocol flags */ +ATA_PROT_FLAG_PIO = (1 <<0 ),/* is PIO */ +ATA_PROT_FLAG_DMA = (1 <<1 ),/* is DMA */ +ATA_PROT_FLAG_NCQ = (1 <<2 ),/* is NCQ */ +ATA_PROT_FLAG_ATAPI = (1 <<3 ),/* is ATAPI */ + +/* taskfile protocols */ +ATA_PROT_UNKNOWN = (u8)-1 , +ATA_PROT_NODATA =0 , +ATA_PROT_PIO =ATA_PROT_FLAG_PIO , +ATA_PROT_DMA =ATA_PROT_FLAG_DMA , +ATA_PROT_NCQ_NODATA =ATA_PROT_FLAG_NCQ , +ATA_PROT_NCQ =ATA_PROT_FLAG_DMA |ATA_PROT_FLAG_NCQ , +ATAPI_PROT_NODATA =ATA_PROT_FLAG_ATAPI , +ATAPI_PROT_PIO =ATA_PROT_FLAG_ATAPI |ATA_PROT_FLAG_PIO , +ATAPI_PROT_DMA =ATA_PROT_FLAG_ATAPI |ATA_PROT_FLAG_DMA , };enum ata_ioctls {
include/linux/libata.h +5 -37
72 lines not on this page · raw message
Signature · 1 line
2.1.4
Re: [PATCH 1/3] libata: remove ata_is_nodata
In reply to Christoph HellwigQuoted 1 line · Christoph Hellwig
The only caller an just check for !ata_is_data instead.
s/ca/can/?
Quoted 1 line
Signed-off-by Christoph Hellwig <[email protected]>
[...]
MBR, Sergei
Re: [PATCH 1/3] libata: remove ata_is_nodata
Quoted 5 lines · Sergei Shtylyov
Quoted 1 line · Christoph Hellwig
The only caller an just check for !ata_is_data instead.
s/ca/can/?
Yes.
Re: [PATCH 1/3] libata: remove ata_is_nodata
Quoted 5 lines · Christoph Hellwig
Quoted 3 lines
Quoted 1 line
The only caller an just check for !ata_is_data instead.
s/ca/can/?Yes.
Sorry, I meant s/an/can/. :-)
MBR, Sergei
Quoted 2 lines · Christoph Hellwig
This series contains a few cleanups for the way the ATA_PROT_* values are handled.
Applied 1-3 to libata/for-4.8.
Thanks.
Signature · 1 line
tejun