Received: by 2002:a05:7412:40d:b0:e2:908c:2ebd with SMTP id 13csp1080992rdf; Wed, 22 Nov 2023 05:17:25 -0800 (PST) X-Google-Smtp-Source: AGHT+IFaHvHuPZvSvCdPDNJGcTNPXQsdheStxnz9YLFruhbzxDeBh7p4C5tQ2fpQVWSLUcJurk9I X-Received: by 2002:a05:6a21:3889:b0:18a:59fe:3ae5 with SMTP id yj9-20020a056a21388900b0018a59fe3ae5mr1766179pzb.48.1700659045311; Wed, 22 Nov 2023 05:17:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700659045; cv=none; d=google.com; s=arc-20160816; b=BUuPw+ATiMHD7hxyyzqUryflXJW++HDBdlc68YsZTCHEy/nimldj5CBJmEpf5WL6Ic hc9C4AMJL0CuiXhFrBALAi7XVIOCvsEOCqXaY/3FUA9WX68R2fwE36aRE0cweVy/l83y QLOwB5LC8ujwdHD4vyTzniQ50EOZwzyTxknpdCBTiPJLSyaZHWIhkwQvtl0SGVuXvcqP /7W5Fli8Rz3sZRx959KqhkFMZEWMgJDfiUHtnY1Byvf44fpl8yaNeCJBN7bN1O9/usKE U26x9ut32TIIuLb5sLTqTN+4HhuhoTSbyvVq/YisM+jEI5jVHuypws9bCkf+CP1bv28P rVpQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:message-id:in-reply-to :subject:cc:to:from:date:dkim-signature; bh=GPzvbj88I8bBR2fTM7xDqG6gZXl+Bp9U+4/0Z5RcjkE=; fh=5kO65sQ2ykeTQpC9g6I3BVh9WD852HViUCaDfKM0eUg=; b=KsGgu4p1FtfyylmS82tizbYJodyk2Rfmz4JDw0IrTOT9YJxxi263LHLnI/OltAKhx/ O2pPqJvDYfFbcG6iKiqKEJkxs4hLLbd52eLPERPFlCpq8aQcjczsLaeNcMKxqZDn8UC1 CjxjCeQDVV0Irj88C/Aogtk3VfuDo9CULhPYxl5vnLunWKjmVGDiT6ddrOKvusL8LGcC Mc9v7CIJ4W6gNist+71ZlrOaIxgDhEeWafxYp96arF9Bh48REJduGFK/r0wHB6nXZA8v yltKXVYFMkwrXOXsg0d20W3Zk0Mitv270+CTeUg8ctpEhSN6HH9mES6msb8k1W3mN2A9 SQEA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=gWDJrgxg; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id q18-20020a056a00085200b0069014d63f21si13100766pfk.148.2023.11.22.05.17.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 Nov 2023 05:17:25 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=gWDJrgxg; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 9C0678029304; Wed, 22 Nov 2023 05:15:14 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343975AbjKVNO5 (ORCPT + 99 others); Wed, 22 Nov 2023 08:14:57 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38126 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343943AbjKVNOy (ORCPT ); Wed, 22 Nov 2023 08:14:54 -0500 Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.120]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7691719D; Wed, 22 Nov 2023 05:14:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1700658891; x=1732194891; h=date:from:to:cc:subject:in-reply-to:message-id: references:mime-version; bh=ytXM2Pyec8Qp9LaXAdCOR2oRjgWxjhxu7pHl5+cR+4w=; b=gWDJrgxg80wFyJAk7gJGbfT82zmjo81huAQZm5G/euUldKp1KN5uBeha Hx5Th8g/7mj3eQrPgGdbEDqz600AGAFfQIasm14Dppa9qtw2iGbmLMJ4A qAPq0HkdlDw7lbuJ8/aJ4DjbSHJd6ALMT4CnXcKwZ/glhgzatAoX5jUQh Ke2Ortwcefv6o5qLbZ1PzF2gjai1IPoN9SlF11HYhTchSl1EPR9uDxj5w MVV7VaSmDpkYvbPGxUjzt/CbniyKK5l8TbXUJ4QBs2dNOBhkJdwOFn+LE wdZDZwYYKH3nJEixOHTi5/eZf2J78CiAO+VuRy1LB9C+ygccCywXdmN7A g==; X-IronPort-AV: E=McAfee;i="6600,9927,10901"; a="390908483" X-IronPort-AV: E=Sophos;i="6.04,218,1695711600"; d="scan'208";a="390908483" Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Nov 2023 05:14:51 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10901"; a="857728170" X-IronPort-AV: E=Sophos;i="6.04,218,1695711600"; d="scan'208";a="857728170" Received: from johannes-ivm.ger.corp.intel.com ([10.249.47.139]) by fmsmga003-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Nov 2023 05:14:44 -0800 Date: Wed, 22 Nov 2023 15:14:41 +0200 (EET) From: =?ISO-8859-15?Q?Ilpo_J=E4rvinen?= To: Shuai Xue cc: ilkka@os.amperecomputing.com, kaishen@linux.alibaba.com, helgaas@kernel.org, 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 In-Reply-To: <20231121013400.18367-4-xueshuai@linux.alibaba.com> Message-ID: References: <20231121013400.18367-1-xueshuai@linux.alibaba.com> <20231121013400.18367-4-xueshuai@linux.alibaba.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE,SPF_NONE,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 X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Wed, 22 Nov 2023 05:15:14 -0800 (PST) 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 > + pci_clear_and_set_config_dword(child, > + child->l1ss + PCI_L1SS_CTL1, 0, > + cl1_2_enables); Adding clear and set only variants into the header like there are for pcie_capability_*() would remove the need to add those 0 parameters. IMO, it improves code readability considerably. -- i.