linux-pci.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>
To: Bjorn Helgaas <helgaas@kernel.org>
Cc: Shuai Xue <xueshuai@linux.alibaba.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: Thu, 30 Nov 2023 12:52:20 +0200 (EET)	[thread overview]
Message-ID: <b2aeaf4-8960-8967-ce7b-663f9d77260@linux.intel.com> (raw)
In-Reply-To: <20231129231555.GA443895@bhelgaas>

[-- Attachment #1: Type: text/plain, Size: 2750 bytes --]

On Wed, 29 Nov 2023, Bjorn Helgaas wrote:

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

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

What I was hoping for a way to (eventually) have consistency in naming 
like this (that is, the place where "config" or "capabilitity" appears 
in the name):

pci_config_read_dword()
pci_config_clear_and_set_dword()
pcie_capability_read_dword()
pcie_capability_clear_and_set_dword()

(+ the omitted clear/set/write & size variants)

But thanks to pci_read_config_dword() & friends being there since dawn of 
time and with 6k+ instances, I guess I'm just dreaming of impossible 
things.

-- 
 i.

  reply	other threads:[~2023-11-30 10:52 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
2023-11-30 10:52         ` Ilpo Järvinen [this message]
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=b2aeaf4-8960-8967-ce7b-663f9d77260@linux.intel.com \
    --to=ilpo.jarvinen@linux.intel.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=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).