mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Shuai Xue <xueshuai@linux.alibaba.com>
To: Bjorn Helgaas <helgaas@kernel.org>
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
Subject: Re: [PATCH v10 3/5] PCI: move pci_clear_and_set_dword helper to pci header
Date: Wed, 8 Nov 2023 08:51:06 +0800	[thread overview]
Message-ID: <98b1dbba-3b82-4fe3-bb72-7447c8118bf2@linux.alibaba.com> (raw)
In-Reply-To: <20231107150342.GA288219@bhelgaas>



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 <bhelgaas@google.com>

Hi, Bjorn,

Thank you for comments, will fix them in next version.

Best Regards,
Shuai

> 
>> Signed-off-by: Shuai Xue <xueshuai@linux.alibaba.com>
>> ---
>>  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

  reply	other threads:[~2023-11-08  0:51 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-04 13:32 [PATCH v10 0/5] drivers/perf: add Synopsys DesignWare PCIe PMU driver support Shuai Xue
2023-11-04 13:32 ` [PATCH v10 1/5] docs: perf: Add description for Synopsys DesignWare PCIe PMU driver Shuai Xue
2023-11-04 13:32 ` [PATCH v10 2/5] PCI: Add Alibaba Vendor ID to linux/pci_ids.h Shuai Xue
2023-11-04 13:32 ` [PATCH v10 3/5] PCI: move pci_clear_and_set_dword helper to pci header Shuai Xue
2023-11-07 15:03   ` Bjorn Helgaas
2023-11-08  0:51     ` Shuai Xue [this message]
2023-11-04 13:32 ` [PATCH v10 4/5] drivers/perf: add DesignWare PCIe PMU driver Shuai Xue
2023-11-15  0:07   ` Ilkka Koskinen
2023-11-15  1:26     ` Shuai Xue
2023-11-16  0:48       ` Ilkka Koskinen
2023-11-16  3:50   ` Ilkka Koskinen
2023-11-16  8:02     ` Shuai Xue
2023-11-16 19:02       ` Ilkka Koskinen
2023-11-04 13:32 ` [PATCH v10 5/5] MAINTAINERS: add maintainers for " Shuai Xue
2023-11-16  0:57 ` [PATCH v10 0/5] drivers/perf: add Synopsys DesignWare PCIe PMU driver support Ilkka Koskinen
2023-11-16  1:49   ` Shuai Xue
2023-11-16  2:42     ` Ilkka Koskinen

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=98b1dbba-3b82-4fe3-bb72-7447c8118bf2@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=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

Powered by JetHome