public inbox for linux-ide@vger.kernel.org
 help / color / mirror / Atom feed
From: Damien Le Moal <damien.lemoal@opensource.wdc.com>
To: Sergey Shtylyov <s.shtylyov@omp.ru>, linux-ide@vger.kernel.org
Subject: Re: [PATCH] ata: libata-transport: fix {dma|pio|xfer}_mode sysfs files
Date: Mon, 6 Jun 2022 11:42:02 +0900	[thread overview]
Message-ID: <c9695894-3bc6-e825-8239-ea6aa3e4831e@opensource.wdc.com> (raw)
In-Reply-To: <b0f8a1d3-2550-31b2-702c-3294d0569187@omp.ru>

On 6/5/22 05:53, Sergey Shtylyov wrote:
> The {dma|pio|xfer}_mode sysfs files are incorrectly 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

Looks good, but Documentation/ABI/testing/sysfs-ata says:

pio_mode:       (RO) Transfer modes supported by the device when
                in PIO mode. Mostly used by PATA device.

xfer_mode:      (RO) Current transfer mode

dma_mode:       (RO) Transfer modes supported by the device when
                in DMA mode. Mostly used by PATA device.

which seems incorrect/badly worded for pio_mode and dma_mode. Since these
2 sysfs attributes do not actually device the pio mask (list of supported
pio modes) but the pio mode that will be used for that device, we should
reword, no ?

What about:

pio_mode:       (RO) Transfer mode used by the device when
                in PIO mode. Mostly used by PATA device.

xfer_mode:      (RO) Current transfer mode

dma_mode:       (RO) Transfer mode used by the device when
                in DMA mode. Mostly used by PATA device.


> 
> Fixes: d9027470b886 ("[libata] Add ATA transport class")
> Signed-off-by: Sergey Shtylyov <s.shtylyov@omp.ru>
> Cc: stable@vger.kernel.org
> 
> ---
> This patch is against the 'master' branch of Damien's 'libata.git' repo.
> 
>  drivers/ata/libata-transport.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> Index: libata/drivers/ata/libata-transport.c
> ===================================================================
> --- libata.orig/drivers/ata/libata-transport.c
> +++ libata/drivers/ata/libata-transport.c
> @@ -196,7 +196,7 @@ static struct {
>  	{ XFER_PIO_0,			"XFER_PIO_0" },
>  	{ XFER_PIO_SLOW,		"XFER_PIO_SLOW" }
>  };
> -ata_bitfield_name_match(xfer,ata_xfer_names)
> +ata_bitfield_name_search(xfer, ata_xfer_names)
>  
>  /*
>   * ATA Port attributes


-- 
Damien Le Moal
Western Digital Research

  reply	other threads:[~2022-06-06  2:42 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-04 20:53 [PATCH] ata: libata-transport: fix {dma|pio|xfer}_mode sysfs files Sergey Shtylyov
2022-06-06  2:42 ` Damien Le Moal [this message]
2022-06-06 20:38   ` Sergey Shtylyov
2022-06-07  0:37     ` Damien Le Moal
2022-06-07  9:49       ` Sergei Shtylyov
2022-06-08  3:14         ` Damien Le Moal
2022-06-08 10:09           ` Sergey Shtylyov
2022-06-08 10:17             ` Damien Le Moal
2022-06-08 17:13               ` Sergey Shtylyov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=c9695894-3bc6-e825-8239-ea6aa3e4831e@opensource.wdc.com \
    --to=damien.lemoal@opensource.wdc.com \
    --cc=linux-ide@vger.kernel.org \
    --cc=s.shtylyov@omp.ru \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox