linux-pci.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Bjorn Helgaas <helgaas@kernel.org>
To: Shuai Xue <xueshuai@linux.alibaba.com>
Cc: "Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>,
	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: Wed, 29 Nov 2023 17:15:55 -0600	[thread overview]
Message-ID: <20231129231555.GA443895@bhelgaas> (raw)
In-Reply-To: <71fa699f-5130-401a-bf4a-3271579a8dda@linux.alibaba.com>

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

  reply	other threads:[~2023-11-29 23:15 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
2023-11-29 23:15       ` Bjorn Helgaas [this message]
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=20231129231555.GA443895@bhelgaas \
    --to=helgaas@kernel.org \
    --cc=Jonathan.Cameron@huawei.com \
    --cc=baolin.wang@linux.alibaba.com \
    --cc=chengyou@linux.alibaba.com \
    --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=xueshuai@linux.alibaba.com \
    --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).