Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp355007iog; Mon, 13 Jun 2022 04:18:25 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxzvKR+zurSqdH1kFZseYoEGamDdQay5G3wVTv0hRWGcKrqsExyg5fLSCrmg6XLNvdDXuNs X-Received: by 2002:a62:7cca:0:b0:4fd:e594:fac0 with SMTP id x193-20020a627cca000000b004fde594fac0mr59346398pfc.79.1655119104913; Mon, 13 Jun 2022 04:18:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1655119104; cv=none; d=google.com; s=arc-20160816; b=jk0dRcjkNfgDbHYW+Am9GhC1/j4ZMXPUWFvF9Clt26mnbp15WNQip5qzKmqSuX0g3I fnaRp8C+4AgYCPX/pay98gg92w0yivNu565KVFxZE9bCmrKxyF2B36iHBYLvq4O+DEPA ILEIxSz0M1Wz76aSxqagM552Ie+jZYrqI2N8YSQKxGQohXDbnVzndticGQooTafCZEs2 ujVSUwwB48Q3zDJ8im/fCB31D1gTcfY4QLpqYdXFygJFQy0vykuKIsVI6KjiWfm7XWQI 9ZKUJLw7XN7zNrSu2y4TNTYVJKCyYgSNdi1+TWKwYJI7I9mOqgILCxnxNPGr0of1UC3I mgVw== 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=+GOrE4ZPpqP1X0tCP+WWhirz1Kvb1ies8kF1VM2RDbQ=; b=LwqJhBpW0rJs7jU2Ca/hHaiEdyCZudvR6hbp1lFNcTLT1cFOvHtYyJH/oHhcUOqLTc WHotIgjA5SMTn4r+LFza/c1m93PvTwp6v+YxL1h8XRKcjtIkrd9F3LnMSDhCTFoNuHib AfcrJkn5Y0Il5op4ejnAnLV5/e0hm+HFVYs5P+ZkCD4CG0PWkMOIaPQEsXnV26cZ+fpq wYePz0yzHiPQdHQo+wioeJj739oGbjCeREFHNHNFpolxhQYWoJka8OwkMIf+jrEz8TAG KkXNllNm5ChiFtpVjJT4fY1AWhA7n6shS2qdMmXDXqyLxR8Mt9xISEMarldHetQ2hr3w EYNA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=DcHEWzXf; 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 p23-20020a17090a0e5700b001df3d491cb1si11586692pja.161.2022.06.13.04.18.09; Mon, 13 Jun 2022 04:18:24 -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=DcHEWzXf; 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 S238142AbiFMLRW (ORCPT + 99 others); Mon, 13 Jun 2022 07:17:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43236 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1352553AbiFMLOA (ORCPT ); Mon, 13 Jun 2022 07:14:00 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4F8C63616C; Mon, 13 Jun 2022 03:36:29 -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 dfw.source.kernel.org (Postfix) with ESMTPS id D1B2C60EF5; Mon, 13 Jun 2022 10:36:28 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E3F92C34114; Mon, 13 Jun 2022 10:36:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1655116588; bh=wTL/YhKNf0DTayTEaRcXxDNUnVvYMZPFROyuLfG+zG4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DcHEWzXfMUOozL26YX+9Ih/c2FzOl5XJWFgo58GvF/iasj6zWjUUg0TwNJhccTOnd 9zfgr6NkgxscWWv0i3bWUPq44nxipFbg/tLa3mm3jf5MLVVxlxPPakNLCx83n20mVM MNK0npgTxguZPfX0WpG7hzIHjTDX94j25uWzPLjA= 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 4.14 208/218] ata: libata-transport: fix {dma|pio|xfer}_mode sysfs files Date: Mon, 13 Jun 2022 12:11:06 +0200 Message-Id: <20220613094926.933251321@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220613094908.257446132@linuxfoundation.org> References: <20220613094908.257446132@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 | 5 +++-- drivers/ata/libata-transport.c | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) --- a/Documentation/ABI/testing/sysfs-ata +++ b/Documentation/ABI/testing/sysfs-ata @@ -59,17 +59,18 @@ class dma_mode - Transfer modes supported by the device when in DMA mode. + DMA transfer mode used by the device. Mostly used by PATA device. pio_mode - Transfer modes supported by the device when in PIO mode. + PIO transfer mode used by the device. Mostly used by PATA device. xfer_mode Current transfer mode. + Mostly used by PATA device. id --- 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