From: Hans Zhang <18255117159@163.com>
To: bhelgaas@google.com
Cc: linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] PCI: pciehp: Use PSN macro for Physical Slot Number consistently
Date: Thu, 12 Nov 2026 11:01:21 +0800 [thread overview]
Message-ID: <f14dcc5f-09a3-4c0d-9936-41fe5f912bf8@163.com> (raw)
In-Reply-To: <20260315154507.126524-1-18255117159@163.com>
Hello Bjorn,
Gentle ping.
Best regards,
Hans
On 3/15/26 23:45, Hans Zhang wrote:
> Replace open-coded bit shift in PSN macro with FIELD_GET() to improve
> readability and consistency. Additionally, convert a direct FIELD_GET()
> call in pciehp_hpc.c to use the PSN macro instead.
>
> This makes the code easier to understand and maintain by using the same
> accessor everywhere for the Physical Slot Number.
>
> Signed-off-by: Hans Zhang <18255117159@163.com>
> ---
> drivers/pci/hotplug/pciehp.h | 2 +-
> drivers/pci/hotplug/pciehp_hpc.c | 2 +-
> 2 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/pci/hotplug/pciehp.h b/drivers/pci/hotplug/pciehp.h
> index debc79b0adfb..e0d5d24b3351 100644
> --- a/drivers/pci/hotplug/pciehp.h
> +++ b/drivers/pci/hotplug/pciehp.h
> @@ -159,7 +159,7 @@ struct controller {
> #define ATTN_LED(ctrl) ((ctrl)->slot_cap & PCI_EXP_SLTCAP_AIP)
> #define PWR_LED(ctrl) ((ctrl)->slot_cap & PCI_EXP_SLTCAP_PIP)
> #define NO_CMD_CMPL(ctrl) ((ctrl)->slot_cap & PCI_EXP_SLTCAP_NCCS)
> -#define PSN(ctrl) (((ctrl)->slot_cap & PCI_EXP_SLTCAP_PSN) >> 19)
> +#define PSN(ctrl) FIELD_GET(PCI_EXP_SLTCAP_PSN, (ctrl)->slot_cap)
>
> void pciehp_request(struct controller *ctrl, int action);
> void pciehp_handle_button_press(struct controller *ctrl);
> diff --git a/drivers/pci/hotplug/pciehp_hpc.c b/drivers/pci/hotplug/pciehp_hpc.c
> index 4c62140a3cb4..8f6c583a96dd 100644
> --- a/drivers/pci/hotplug/pciehp_hpc.c
> +++ b/drivers/pci/hotplug/pciehp_hpc.c
> @@ -1059,7 +1059,7 @@ struct controller *pcie_init(struct pcie_device *dev)
> PCI_EXP_SLTSTA_DLLSC | PCI_EXP_SLTSTA_PDC);
>
> ctrl_info(ctrl, "Slot #%d AttnBtn%c PwrCtrl%c MRL%c AttnInd%c PwrInd%c HotPlug%c Surprise%c Interlock%c NoCompl%c IbPresDis%c LLActRep%c%s\n",
> - FIELD_GET(PCI_EXP_SLTCAP_PSN, slot_cap),
> + PSN(ctrl),
> FLAG(slot_cap, PCI_EXP_SLTCAP_ABP),
> FLAG(slot_cap, PCI_EXP_SLTCAP_PCP),
> FLAG(slot_cap, PCI_EXP_SLTCAP_MRLSP),
prev parent reply other threads:[~2026-11-12 3:01 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-15 15:45 Hans Zhang
2026-11-12 3:01 ` Hans Zhang [this message]
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=f14dcc5f-09a3-4c0d-9936-41fe5f912bf8@163.com \
--to=18255117159@163.com \
--cc=bhelgaas@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
/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
all inboxes | Powered by JetHome®