Skip to content

Commit 72aad48

Browse files
Sergey ShtylyovDamien Le Moal
authored andcommitted
ata: libata-transport: fix {dma|pio|xfer}_mode sysfs files
The {dma|pio}_mode sysfs files are incorrectly documented as having a list of the supported DMA/PIO transfer modes, while the corresponding fields of the *struct* ata_device hold the transfer mode IDs, not masks. To match these docs, the {dma|pio}_mode (and even xfer_mode!) sysfs files are handled by the ata_bitfield_name_match() macro which leads to reading such kind of nonsense from them: $ cat /sys/class/ata_device/dev3.0/pio_mode XFER_UDMA_7, XFER_UDMA_6, XFER_UDMA_5, XFER_UDMA_4, XFER_MW_DMA_4, XFER_PIO_6, XFER_PIO_5, XFER_PIO_4, XFER_PIO_3, XFER_PIO_2, XFER_PIO_1, XFER_PIO_0 Using the correct ata_bitfield_name_search() macro fixes that: $ cat /sys/class/ata_device/dev3.0/pio_mode XFER_PIO_4 While fixing the file documentation, somewhat reword the {dma|pio}_mode file doc and add a note about being mostly useful for PATA devices to the xfer_mode file doc... Fixes: d902747 ("[libata] Add ATA transport class") Signed-off-by: Sergey Shtylyov <s.shtylyov@omp.ru> Cc: stable@vger.kernel.org Signed-off-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>
1 parent 6d11acd commit 72aad48

2 files changed

Lines changed: 7 additions & 6 deletions

File tree

Documentation/ABI/testing/sysfs-ata

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -107,13 +107,14 @@ Description:
107107
described in ATA8 7.16 and 7.17. Only valid if
108108
the device is not a PM.
109109

110-
pio_mode: (RO) Transfer modes supported by the device when
111-
in PIO mode. Mostly used by PATA device.
110+
pio_mode: (RO) PIO transfer mode used by the device.
111+
Mostly used by PATA devices.
112112

113-
xfer_mode: (RO) Current transfer mode
113+
xfer_mode: (RO) Current transfer mode. Mostly used by
114+
PATA devices.
114115

115-
dma_mode: (RO) Transfer modes supported by the device when
116-
in DMA mode. Mostly used by PATA device.
116+
dma_mode: (RO) DMA transfer mode used by the device.
117+
Mostly used by PATA devices.
117118

118119
class: (RO) Device class. Can be "ata" for disk,
119120
"atapi" for packet device, "pmp" for PM, or

drivers/ata/libata-transport.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ static struct {
196196
{ XFER_PIO_0, "XFER_PIO_0" },
197197
{ XFER_PIO_SLOW, "XFER_PIO_SLOW" }
198198
};
199-
ata_bitfield_name_match(xfer,ata_xfer_names)
199+
ata_bitfield_name_search(xfer, ata_xfer_names)
200200

201201
/*
202202
* ATA Port attributes

0 commit comments

Comments
 (0)