Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp636170iog; Mon, 13 Jun 2022 09:35:59 -0700 (PDT) X-Google-Smtp-Source: ABdhPJynvhfedYg2GXbvP17udEwlWcOHmRFCReOnnV/Pd4msqYXqpGnw2BzWUCybQYuxKsOCnAY6 X-Received: by 2002:a63:86c3:0:b0:3fd:9c06:ee37 with SMTP id x186-20020a6386c3000000b003fd9c06ee37mr371911pgd.357.1655138159536; Mon, 13 Jun 2022 09:35:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1655138159; cv=none; d=google.com; s=arc-20160816; b=BXYClUHmlEUjcWcHvhY3/FnaETycq7v5hgykRO+QBtuHucEiHCqsXpt9Z5U3TKCrIQ wm11ceh9vur+pu62/fJo0iPj9722TbuCQy2zs6bKvbvmwd3TT9OwZfN9e2R/lIuNGl4/ xSptrQlGtnlTK43mPbE05Fk4JOexi/EhHzQQf7k4u1Y1+smP4sAiwF+rppw1tAcJlVSo OQe9na2T1yj7zkzQrAdj0NUi/1H102gNHjYWIGKPUfk49r0xblgGwpbgY38VwFCdaXv7 3QtTUHdcCDOosvuemMvyZKPms2P0sP8GCYjwxH9V3CKF9tUvNCJLnoRo6dY+6i4AOCx6 bTog== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=d9cKlA7lPv0k2N49zF8Ch6EM6mnkrEDdEDclUZG6GZ8=; b=dG9T9gdkRDFWZEpEU7GezTeDVCUfnq8ar7yPfkbFTXHaQrP8yxfw5HJLHknSvMixMh c3AmCY1uxRlavlJOpS4kfRyZWmXnOhwHQ+DobXFYjv0Qud/sO1UpimqoA+wezEdNDS6w DHwul2bFjyxu/BlMtCsa9iTk2mOfe502y0u2LCIoA4i8kjpTBSoL/rvvwA785G20HL/P 6T2YVPyF6HGLSrGwnZuHUDdiq9RIXCXoos6icYEXm5AuQEIyrIhTAJ/oBWGCI9Pl+zjt +sIPm4gutIxgCtXmc1UKKDzo2QRIiJBlutSu7CeBI+Sl5oMI9LgVfOt6IxV5OPggKJt/ 1sgg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=f3+1NKqF; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id k14-20020a634b4e000000b003db379692e2si9829179pgl.181.2022.06.13.09.35.47; Mon, 13 Jun 2022 09:35:59 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=f3+1NKqF; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1377311AbiFMNZ5 (ORCPT + 99 others); Mon, 13 Jun 2022 09:25:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60884 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1359179AbiFMNWk (ORCPT ); Mon, 13 Jun 2022 09:22:40 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A41C56B082; Mon, 13 Jun 2022 04:23:42 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 48712B80E93; Mon, 13 Jun 2022 11:23:40 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9140BC34114; Mon, 13 Jun 2022 11:23:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1655119419; bh=7ZJdOB8NWztNFmJga+HULPqObVqV573O24/WNfw5IOk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=f3+1NKqF9SzxoECOq/Pc+9WYVfp/Q3sLcUjQiDZra0TZAEh8iJSBjflgY2Aqafl1c a4NZqn/4hx83lO4GmQgey2EgZyZWWQkSqBGQ34oe5VzRx4P89zCiAiurcPD+8n8VB+ OpRf7A2EPASfrtsqlDYfOw/48PTv9V5LFftAAUpw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Sergey Shtylyov , Damien Le Moal Subject: [PATCH 5.15 222/247] ata: libata-transport: fix {dma|pio|xfer}_mode sysfs files Date: Mon, 13 Jun 2022 12:12:04 +0200 Message-Id: <20220613094929.678779354@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220613094922.843438024@linuxfoundation.org> References: <20220613094922.843438024@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-8.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Sergey Shtylyov commit 72aad489f992871e908ff6d9055b26c6366fb864 upstream. 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: d9027470b886 ("[libata] Add ATA transport class") Signed-off-by: Sergey Shtylyov Cc: stable@vger.kernel.org Signed-off-by: Damien Le Moal Signed-off-by: Greg Kroah-Hartman --- Documentation/ABI/testing/sysfs-ata | 11 ++++++----- drivers/ata/libata-transport.c | 2 +- 2 files changed, 7 insertions(+), 6 deletions(-) --- a/Documentation/ABI/testing/sysfs-ata +++ b/Documentation/ABI/testing/sysfs-ata @@ -107,13 +107,14 @@ Description: described in ATA8 7.16 and 7.17. Only valid if the device is not a PM. - pio_mode: (RO) Transfer modes supported by the device when - in PIO mode. Mostly used by PATA device. + pio_mode: (RO) PIO transfer mode used by the device. + Mostly used by PATA devices. - xfer_mode: (RO) Current transfer mode + xfer_mode: (RO) Current transfer mode. Mostly used by + PATA devices. - dma_mode: (RO) Transfer modes supported by the device when - in DMA mode. Mostly used by PATA device. + dma_mode: (RO) DMA transfer mode used by the device. + Mostly used by PATA devices. class: (RO) Device class. Can be "ata" for disk, "atapi" for packet device, "pmp" for PM, or --- a/drivers/ata/libata-transport.c +++ b/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