From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 59388C4332F for ; Wed, 8 Nov 2023 00:51:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:From:References:Cc:To: Subject:MIME-Version:Date:Message-ID:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=AQbLXI7nFPyItTuhj9pN2OpPr7YVBHTcuSRNLTGMxZY=; b=XAXRCLUqOoTUd1 lTGLbPFkqjLc09e0YoPr8fIauRu4L0Mz9au1Q9IPxQLGz8DVH/jmbhHe4XfhQitSCVZvou7EHKxmE nfXP/KGy6gljhak7FBFr/wPPKYdgPkki+bPejv61ExT9Vp/muB01uwGH/Z2z4F0Nt+ykZ1IbjpzR8 odOnIVyQDBOhkecGa+iDnXpD3L44NU+wGNBc9l0N0scpZ34kI6sKAy9eDjfNAn3emgIGxle8JqCA+ tx6gsRBZs8jbid/Hoq76eP9VX9l9FCwJWEHfePgrT6wv6mWd6aN2bgJ+mYYjd2m19hZQG6ccmm6ij 5xtUH1Uvgho2bKlIgALg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1r0Wn0-002j3E-2J; Wed, 08 Nov 2023 00:51:26 +0000 Received: from out30-99.freemail.mail.aliyun.com ([115.124.30.99]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1r0Wmw-002j0d-0f for linux-arm-kernel@lists.infradead.org; Wed, 08 Nov 2023 00:51:25 +0000 X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R151e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=ay29a033018045170;MF=xueshuai@linux.alibaba.com;NM=1;PH=DS;RN=15;SR=0;TI=SMTPD_---0VvvcIdY_1699404667; Received: from 30.240.112.123(mailfrom:xueshuai@linux.alibaba.com fp:SMTPD_---0VvvcIdY_1699404667) by smtp.aliyun-inc.com; Wed, 08 Nov 2023 08:51:09 +0800 Message-ID: <98b1dbba-3b82-4fe3-bb72-7447c8118bf2@linux.alibaba.com> Date: Wed, 8 Nov 2023 08:51:06 +0800 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v10 3/5] PCI: move pci_clear_and_set_dword helper to pci header To: Bjorn Helgaas Cc: 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, linux-kernel@vger.kernel.org, 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 References: <20231107150342.GA288219@bhelgaas> Content-Language: en-US From: Shuai Xue In-Reply-To: <20231107150342.GA288219@bhelgaas> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231107_165122_760373_E3B5D030 X-CRM114-Status: GOOD ( 14.25 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On 2023/11/7 23:03, Bjorn Helgaas wrote: > On Sat, Nov 04, 2023 at 09:32:14PM +0800, 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. > > s/move/Move/ (in subject, capitalize first word) > s/pci/PCI/ (capitalize in English text) > s/pci_clear_and_set_dword/pci_clear_and_set_dword()/ (add parens to > function names, also in subject) > > With the fixes here and below: > > Acked-by: Bjorn Helgaas Hi, Bjorn, Thank you for comments, will fix them in next version. Best Regards, Shuai > >> Signed-off-by: Shuai Xue >> --- >> drivers/pci/access.c | 12 ++++++++++++ >> drivers/pci/pcie/aspm.c | 11 ----------- >> include/linux/pci.h | 2 ++ >> 3 files changed, 14 insertions(+), 11 deletions(-) >> >> diff --git a/drivers/pci/access.c b/drivers/pci/access.c >> index 6554a2e89d36..526360481d99 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_dword(const struct pci_dev *dev, int pos, >> + u32 clear, u32 set) > > Rename to pci_clear_and_set_config_dword() to retain the "config" > information and match the other accessors. Got it. Will rename it. > > Align "u32 clear" under "const struct ...". pci_write_config_dword() > above is an anomaly. > Got it. Will align it. >> +{ >> + u32 val; >> + >> + pci_read_config_dword(dev, pos, &val); >> + val &= ~clear; >> + val |= set; >> + pci_write_config_dword(dev, pos, val); >> +} >> +EXPORT_SYMBOL(pci_clear_and_set_dword); >> diff --git a/drivers/pci/pcie/aspm.c b/drivers/pci/pcie/aspm.c >> index 1bf630059264..f4e64fedc048 100644 >> --- a/drivers/pci/pcie/aspm.c >> +++ b/drivers/pci/pcie/aspm.c >> @@ -423,17 +423,6 @@ static void pcie_aspm_check_latency(struct pci_dev *endpoint) >> } >> } >> >> -static void pci_clear_and_set_dword(struct pci_dev *pdev, int pos, >> - u32 clear, u32 set) >> -{ >> - u32 val; >> - >> - pci_read_config_dword(pdev, pos, &val); >> - val &= ~clear; >> - val |= set; >> - pci_write_config_dword(pdev, pos, val); >> -} >> - >> /* Calculate L1.2 PM substate timing parameters */ >> static void aspm_calc_l12_info(struct pcie_link_state *link, >> u32 parent_l1ss_cap, u32 child_l1ss_cap) >> diff --git a/include/linux/pci.h b/include/linux/pci.h >> index 8c7c2c3c6c65..271f30fd7ca4 100644 >> --- a/include/linux/pci.h >> +++ b/include/linux/pci.h >> @@ -1213,6 +1213,8 @@ int pci_read_config_dword(const struct pci_dev *dev, int where, u32 *val); >> int pci_write_config_byte(const struct pci_dev *dev, int where, u8 val); >> int pci_write_config_word(const struct pci_dev *dev, int where, u16 val); >> int pci_write_config_dword(const struct pci_dev *dev, int where, u32 val); >> +void pci_clear_and_set_dword(const struct pci_dev *dev, int pos, >> + u32 clear, u32 set); > > Align "u32 clear" again. Thank you. Will align it. > >> int pcie_capability_read_word(struct pci_dev *dev, int pos, u16 *val); >> int pcie_capability_read_dword(struct pci_dev *dev, int pos, u32 *val); >> -- >> 2.39.3 >> >> >> _______________________________________________ >> linux-arm-kernel mailing list >> linux-arm-kernel@lists.infradead.org >> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel