linux-pci.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Shuai Xue <xueshuai@linux.alibaba.com>
To: "Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>,
	"Bjorn Helgaas" <helgaas@kernel.org>
Cc: 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-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
Subject: Re: [PATCH v11 3/5] PCI: Move pci_clear_and_set_dword() helper to PCI header
Date: Mon, 27 Nov 2023 09:34:05 +0800	[thread overview]
Message-ID: <71fa699f-5130-401a-bf4a-3271579a8dda@linux.alibaba.com> (raw)
In-Reply-To: <f2a31d7f-3acc-fbe8-2684-c61f355f1036@linux.intel.com>

+ Bjorn for PCI.

On 2023/11/22 21:14, Ilpo Järvinen wrote:

Hi, Ilpo,

Thank you for your reply. Please see my comments inline.


> 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 <xueshuai@linux.alibaba.com>
>> Acked-by: Bjorn Helgaas <bhelgaas@google.com>
>> Tested-by: Ilkka Koskinen <ilkka@os.amperecomputing.com>
>> ---
>>  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 bellow pci accessors:

    pci_read_config_dword()
    pci_write_config_dword()

At last, they are consistend :)

> 
>> +		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.
> 

Agreed.


Best Regards,
Shuai

  reply	other threads:[~2023-11-27  1:34 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-21  1:33 [PATCH v11 0/5] drivers/perf: add Synopsys DesignWare PCIe PMU driver support Shuai Xue
2023-11-21  1:33 ` [PATCH v11 1/5] docs: perf: Add description for Synopsys DesignWare PCIe PMU driver Shuai Xue
2023-11-21  1:33 ` [PATCH v11 2/5] PCI: Add Alibaba Vendor ID to linux/pci_ids.h Shuai Xue
2023-11-21  1:33 ` [PATCH v11 3/5] PCI: Move pci_clear_and_set_dword() helper to PCI header Shuai Xue
2023-11-22 13:14   ` Ilpo Järvinen
2023-11-27  1:34     ` Shuai Xue [this message]
2023-11-29 23:15       ` Bjorn Helgaas
2023-11-30 10:52         ` Ilpo Järvinen
2023-11-30 18:37           ` Bjorn Helgaas
2023-11-21  1:33 ` [PATCH v11 4/5] drivers/perf: add DesignWare PCIe PMU driver Shuai Xue
2023-11-25  7:06   ` Dan Carpenter
2023-12-05 14:21     ` Will Deacon
2023-12-06  9:28       ` Shuai Xue
2023-11-30  1:43   ` Ilkka Koskinen
2023-11-30  3:04     ` Shuai Xue
2023-11-21  1:34 ` [PATCH v11 5/5] MAINTAINERS: add maintainers for " Shuai Xue

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=71fa699f-5130-401a-bf4a-3271579a8dda@linux.alibaba.com \
    --to=xueshuai@linux.alibaba.com \
    --cc=Jonathan.Cameron@huawei.com \
    --cc=baolin.wang@linux.alibaba.com \
    --cc=chengyou@linux.alibaba.com \
    --cc=helgaas@kernel.org \
    --cc=ilkka@os.amperecomputing.com \
    --cc=ilpo.jarvinen@linux.intel.com \
    --cc=kaishen@linux.alibaba.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=rdunlap@infradead.org \
    --cc=renyu.zj@linux.alibaba.com \
    --cc=robin.murphy@arm.com \
    --cc=will@kernel.org \
    --cc=yangyicong@huawei.com \
    --cc=zhuo.song@linux.alibaba.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).