* [PATCH] PCI: pciehp: Use PSN macro for Physical Slot Number consistently
@ 2026-03-15 15:45 Hans Zhang
2026-11-12 3:01 ` Hans Zhang
0 siblings, 1 reply; 2+ messages in thread
From: Hans Zhang @ 2026-03-15 15:45 UTC (permalink / raw)
To: bhelgaas; +Cc: linux-pci, linux-kernel, Hans Zhang
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),
--
2.34.1
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] PCI: pciehp: Use PSN macro for Physical Slot Number consistently
2026-03-15 15:45 [PATCH] PCI: pciehp: Use PSN macro for Physical Slot Number consistently Hans Zhang
@ 2026-11-12 3:01 ` Hans Zhang
0 siblings, 0 replies; 2+ messages in thread
From: Hans Zhang @ 2026-11-12 3:01 UTC (permalink / raw)
To: bhelgaas; +Cc: linux-pci, linux-kernel
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),
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-11-12 3:01 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-03-15 15:45 [PATCH] PCI: pciehp: Use PSN macro for Physical Slot Number consistently Hans Zhang
2026-11-12 3:01 ` Hans Zhang
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®