Received: by 2002:a05:7412:419a:b0:f3:1519:9f41 with SMTP id i26csp4929451rdh; Wed, 29 Nov 2023 15:16:10 -0800 (PST) X-Google-Smtp-Source: AGHT+IHbYdHcLYI4gvVVL3aszNe50pIizYA72U+8jlP76Ad2tJC6galmX9H439rJdTpOTOiozvzJ X-Received: by 2002:a05:6a00:1914:b0:68b:e29c:b69 with SMTP id y20-20020a056a00191400b0068be29c0b69mr27495535pfi.9.1701299770241; Wed, 29 Nov 2023 15:16:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701299770; cv=none; d=google.com; s=arc-20160816; b=QaS9yXpZZXZ+E3i+XdO9l2lLRcxHOHZsINEA0Fp7m6afNG+AaDy4SXatMXjom3rFDn OZ09dsxgFZL45JtCboZxPjEMp/t/GtYW/vTqnstXtDFfqRU6u2zxs8reUvU5R9uD8TR3 4/4GX3eo3Nu7Bb2iFakwmWsNYX7tpIKk9vlYtwYLcfcK0qGgIdAstv3melIhUdwVm2Wr ZBjvRtVuXilKlNzDVdfIGWahlJqyGd89os69c1Z/dL94C3FIyDxZWLr2p8m4RYZaNORo XV3bkq2SxuvvkoGZsrC90tB37xyyxiSaA6yESTJloXd05yNmaGi8SHQfbB8yWrGPuJzx U9Tg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-transfer-encoding :content-disposition:mime-version:message-id:subject:cc:to:from:date :dkim-signature; bh=Btg9OkZMnNrouPREn74fiRvvCMTL8u6p+VQZMee0bk0=; fh=L8W8rPB8yyDOIg5EAD/aZzajmDtRKDaJhSvSnw5cWfU=; b=aVXveP7TAewQijsS/DdS181sy5Hvyq4GmiTLO6UW9uj+5w7FX/xdZIGWNbsJAF0c5o Okt2ShjlSIozDJFWEtCnNrYajILY02sHYTvIrSizvrflv3H5N4gmHI88ADR9FJU5xwaH DrYx2tFvIB3vP+9ZcrDa+OvLWttCfwa9jYRXXWXnrFXbwQQJmO+tov2i4VJKoCK0GCFn /+J2MO7tJWmTxjqIjoxZPiZM7ArZEkB3NxxwWYyirCkNV69TN27TbxLX17XuIfhOveEl WItovDrTCSm78IyWHgBWg6Ya46Niogy4vTFgn9MoGAGXTckCYjVT+uaKpBmHm/Tp64S6 633Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=lsmYRCtm; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from lipwig.vger.email (lipwig.vger.email. [2620:137:e000::3:3]) by mx.google.com with ESMTPS id y9-20020a056a00190900b006cd9c550815si5922993pfi.288.2023.11.29.15.16.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 Nov 2023 15:16:10 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) client-ip=2620:137:e000::3:3; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=lsmYRCtm; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id 8BC188038B59; Wed, 29 Nov 2023 15:16:07 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234859AbjK2XPy (ORCPT + 99 others); Wed, 29 Nov 2023 18:15:54 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51748 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229658AbjK2XPw (ORCPT ); Wed, 29 Nov 2023 18:15:52 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0B788D54 for ; Wed, 29 Nov 2023 15:15:57 -0800 (PST) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6817CC433C9; Wed, 29 Nov 2023 23:15:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1701299757; bh=eZ85cA7Ik1tM1F3uhz1PsvW2kqzGygwIuLJ/hwc0ym8=; h=Date:From:To:Cc:Subject:In-Reply-To:From; b=lsmYRCtmKFcBu1rcXaomCG95v4pA6taD5qmHpyLOrgRIDlZ1SOWv5L+WIZ8hyBMum laxg0oycsMQQkuO1QeJIcjlqYNWqmEBqXg/4gz5SspvN0xpYzYOM0siFTlJG8ryyHp vljciukoKJwsG8RuHFositnwxAh75YOMaei6kmhKKGyL00wIYrEovNqm+rR2+AHcW7 ORb0aQ0cGLdsnPAfKE/rnH8Yfiu7CQ7WO+/Qa3Arr5beMLLBhhoTr/hdY5+35TE1Bh QIi8nDG56bIgOx8PQbM11gjbmbRnQ1j3Jj2msYgAFjW6uGlvOcwym5mBzcfNulMSfa im9jbRW+GrMtA== Date: Wed, 29 Nov 2023 17:15:55 -0600 From: Bjorn Helgaas To: Shuai Xue Cc: Ilpo =?utf-8?B?SsOkcnZpbmVu?= , ilkka@os.amperecomputing.com, kaishen@linux.alibaba.com, yangyicong@huawei.com, will@kernel.org, Jonathan.Cameron@huawei.com, baolin.wang@linux.alibaba.com, robin.murphy@arm.com, chengyou@linux.alibaba.com, LKML , linux-arm-kernel@lists.infradead.org, linux-pci@vger.kernel.org, rdunlap@infradead.org, mark.rutland@arm.com, zhuo.song@linux.alibaba.com, renyu.zj@linux.alibaba.com Subject: Re: [PATCH v11 3/5] PCI: Move pci_clear_and_set_dword() helper to PCI header Message-ID: <20231129231555.GA443895@bhelgaas> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <71fa699f-5130-401a-bf4a-3271579a8dda@linux.alibaba.com> X-Spam-Status: No, score=-1.2 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (lipwig.vger.email [0.0.0.0]); Wed, 29 Nov 2023 15:16:07 -0800 (PST) On Mon, Nov 27, 2023 at 09:34:05AM +0800, Shuai Xue wrote: > On 2023/11/22 21:14, Ilpo Järvinen wrote: > > On Tue, 21 Nov 2023, Shuai Xue wrote: > > > >> The clear and set pattern is commonly used for accessing PCI config, > >> move the helper pci_clear_and_set_dword() from aspm.c into PCI header. > >> In addition, rename to pci_clear_and_set_config_dword() to retain the > >> "config" information and match the other accessors. > >> > >> No functional change intended. > >> > >> Signed-off-by: Shuai Xue > >> Acked-by: Bjorn Helgaas > >> Tested-by: Ilkka Koskinen > >> --- > >> drivers/pci/access.c | 12 ++++++++ > >> drivers/pci/pcie/aspm.c | 65 +++++++++++++++++++---------------------- > >> include/linux/pci.h | 2 ++ > >> 3 files changed, 44 insertions(+), 35 deletions(-) > >> > >> diff --git a/drivers/pci/access.c b/drivers/pci/access.c > >> index 6554a2e89d36..6449056b57dd 100644 > >> --- a/drivers/pci/access.c > >> +++ b/drivers/pci/access.c > >> @@ -598,3 +598,15 @@ int pci_write_config_dword(const struct pci_dev *dev, int where, > >> return pci_bus_write_config_dword(dev->bus, dev->devfn, where, val); > >> } > >> EXPORT_SYMBOL(pci_write_config_dword); > >> + > >> +void pci_clear_and_set_config_dword(const struct pci_dev *dev, int pos, > >> + u32 clear, u32 set) > > > > Just noting that annoyingly the ordering within the name is inconsistent > > between: > > pci_clear_and_set_config_dword() > > and > > pcie_capability_clear_and_set_dword() > > > > And if changed, it would be again annoyingly inconsistent with > > pci_read/write_config_*(), oh well... And renaming pci_read/write_config_* > > into the hierarchical pci_config_read/write_*() form for would touch only > > ~6k lines... ;-D > > I think it is a good question, but I don't have a clear answer. I don't > know much about the name history. As you mentioned, the above two > accessors are the foundation operation, may it comes to @Bjorn decision. > > The pci_clear_and_set_config_dword() is a variant of below pci accessors: > > pci_read_config_dword() > pci_write_config_dword() > > At last, they are consistent :) "pcie_capability_clear_and_set_dword" is specific to the PCIe Capability, doesn't work for arbitrary config space, and doesn't include the word "config". "pci_clear_and_set_config_dword" seems consistent with the arbitrary config space accessor pattern. At least "clear_and_set" is consistent across both. I'm not too bothered by the difference between "clear_and_set_dword" (for the PCIe capability) and "clear_and_set_config_dword" (for arbitrary things). Yes, "pcie_capability_clear_and_set_config_dword" would be a little more consistent, but seems excessively wordy (no pun intended). But maybe I'm missing your point, Ilpo. If so, what would you propose? Bjorn