PCI: Update pci_find_capability() stub return values
PATCH 1/1 PCI: Update pci_find_capability() stub return values
From: Bjorn Helgaas <[email protected]>
f646c2a0a668 ("PCI: Return u8 from pci_find_capability() and similar") and ee8b1c478a9f ("PCI: Return u16 from pci_find_ext_capability() and similar") updated the return type of the extern declarations, but neglected to update the type of the stubs used CONFIG_PCI is not enabled.
Update them to match the extern declarations.
--- include/linux/pci.h | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
include/linux/pci.h +2 -3
@@ -2011,10 +2011,9 @@ static inline int pci_register_driver(struct pci_driver *drv)static inline void pci_unregister_driver (struct pci_driver *drv) { }static inline u8 pci_find_capability (struct pci_dev *dev,int cap) {return 0 ; } -static inline int pci_find_next_capability (struct pci_dev *dev,u8 post, -int cap) +static inline u8 pci_find_next_capability (struct pci_dev *dev,u8 post,int cap) {return 0 ; } -static inline int pci_find_ext_capability (struct pci_dev *dev,int cap) +static inline u16 pci_find_ext_capability (struct pci_dev *dev,int cap) {return 0 ; }static inline u64 pci_get_dsn (struct pci_dev *dev)
Signature · 1 line
2.34.1
Quoted 10 lines · Bjorn Helgaas
From: Bjorn Helgaas <[email protected]>
f646c2a0a668("PCI: Return u8 frompci_find_capability()and similar") andee8b1c478a9f("PCI: Return u16 frompci_find_ext_capability()and similar") updated the return type of the extern declarations, but neglected to update the type of the stubs usedCONFIG_PCIis not enabled.Update them to match the extern declarations.
Signed-off-by Bjorn Helgaas <[email protected]>
Provisionally applied to pci/enumeration for v6.10, let me know if you see any issues.
Quoted 24 lines
--- include/linux/pci.h | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)include/linux/pci.h +2
-3@@ -2011,10 +2011,9 @@ static inline int pci_register_driver(struct pci_driver *drv)static inline void pci_unregister_driver (struct pci_driver *drv) { }static inline u8 pci_find_capability (struct pci_dev *dev,int cap) {return 0 ; } -static inline int pci_find_next_capability (struct pci_dev *dev,u8 post, -int cap) +static inline u8 pci_find_next_capability (struct pci_dev *dev,u8 post,int cap) {return 0 ; } -static inline int pci_find_ext_capability (struct pci_dev *dev,int cap) +static inline u16 pci_find_ext_capability (struct pci_dev *dev,int cap) {return 0 ; }static inline u64 pci_get_dsn (struct pci_dev *dev)Signature · 1 line
2.34.1
Quoted 11 lines · Bjorn Helgaas
From: Bjorn Helgaas <[email protected]>
f646c2a0a668("PCI: Return u8 frompci_find_capability()and similar") andee8b1c478a9f("PCI: Return u16 frompci_find_ext_capability()and similar") updated the return type of the extern declarations, but neglected to update the type of the stubs usedCONFIG_PCIis not enabled.Update them to match the extern declarations.
Signed-off-by Bjorn Helgaas <[email protected]>---
This change looks fine to me.
But the callers of these functions still seems to use int declaration to store the output. Any reason for not changing them? Like the usages in drivers/pci/pci.c?
Quoted 20 lines
include/linux/pci.h | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)include/linux/pci.h +2
-3@@ -2011,10 +2011,9 @@ static inline int pci_register_driver(struct pci_driver *drv)static inline void pci_unregister_driver (struct pci_driver *drv) { }static inline u8 pci_find_capability (struct pci_dev *dev,int cap) {return 0 ; } -static inline int pci_find_next_capability (struct pci_dev *dev,u8 post, -int cap) +static inline u8 pci_find_next_capability (struct pci_dev *dev,u8 post,int cap) {return 0 ; } -static inline int pci_find_ext_capability (struct pci_dev *dev,int cap) +static inline u16 pci_find_ext_capability (struct pci_dev *dev,int cap) {return 0 ; }static inline u64 pci_get_dsn (struct pci_dev *dev)
Signature · 2 lines
Sathyanarayanan Kuppuswamy Linux Kernel Developer
Quoted 8 lines · Kuppuswamy Sathyanarayanan
Quoted 7 lines · Bjorn Helgaas
From: Bjorn Helgaas <[email protected]>
f646c2a0a668("PCI: Return u8 frompci_find_capability()and similar") andee8b1c478a9f("PCI: Return u16 frompci_find_ext_capability()and similar") updated the return type of the extern declarations, but neglected to update the type of the stubs usedCONFIG_PCIis not enabled.
Quoted 8 lines
Quoted 4 lines
Update them to match the extern declarations.
Signed-off-by Bjorn Helgaas <[email protected]>---
This change looks fine to me.
Reviewed-by Kuppuswamy Sathyanarayanan <[email protected]>
Thanks for reviewing it!
Quoted 3 lines
But the callers of these functions still seems to use int declaration to store the output. Any reason for not changing them? Like the usages in
drivers/pci/pci.c?
This patch is just to make the extern declarations match the stubs.
No particular reason not to change users other than I didn't want to change the users before the declarations (to avoid warnings about assigning an int to a u8 or u16), and there's not a lot of value in changing local variables, where an int is just on the stack and works fine.
Changing stored values in a struct would have more benefit. I took a quick look and found these possibilities:
struct controller.cap_offset (drivers/pci/hotplug/shpchp.h SHPC cap) struct pci_sriov.pos (drivers/pci/pci.h SR-IOV ext cap)
struct altera_pcie_data.cap_offset (drivers/pci/controller/pcie-altera.c PCIe cap)
struct tg3.msi_cap (broadcom/tg3.h MSI cap)
struct tg3.pcix_cap (broadcom/tg3.h PCI-X cap)
struct bnx2.pm_cap (broadcom/bnx2.h PM cap)
struct bnx2.pcix_cap (broadcom/bnx2.h PCI-X cap)
struct bnx2x_sriov.cap (broadcom/bnx2x/bnx2x_sriov.h SR-IOV ext cap) struct amd8111e_priv.pm_cap (amd/amd8111e.c, removed [1]) struct pci_params.pm_cap (qlogic/qed/qed.h, removed [2]) struct qed_hw_sriov_info.cap (qlogic/qed/qed_sriov.h SR-IOV ext cap) struct eeh_dev.pcix_cap (powerpc/include/asm/eeh.h PCI-X cap) struct eeh_dev.pcie_cap (powerpc/include/asm/eeh.h PCIe cap) struct eeh_dev.aer_cap (powerpc/include/asm/eeh.h AER ext cap) struct eeh_dev.af_cap (powerpc/include/asm/eeh.h AF cap) struct icm.vnd_cap (drivers/thunderbolt/icm.c VNDR ext cap)
[1] https://lore.kernel.org/all/[email protected]/
[2] https://lore.kernel.org/all/[email protected]/
Bjorn
Hi,
Quoted 27 lines · Bjorn Helgaas
Quoted 8 lines · Kuppuswamy Sathyanarayanan
Quoted 7 lines · Bjorn Helgaas
From: Bjorn Helgaas <[email protected]>
f646c2a0a668("PCI: Return u8 frompci_find_capability()and similar") andee8b1c478a9f("PCI: Return u16 frompci_find_ext_capability()and similar") updated the return type of the extern declarations, but neglected to update the type of the stubs usedCONFIG_PCIis not enabled.Quoted 8 lines
Quoted 4 lines
Update them to match the extern declarations.
Signed-off-by Bjorn Helgaas <[email protected]>---
This change looks fine to me.
Reviewed-by Kuppuswamy Sathyanarayanan <[email protected]>Thanks for reviewing it!
Quoted 3 lines
But the callers of these functions still seems to use int declaration to store the output. Any reason for not changing them? Like the usages in
drivers/pci/pci.c?This patch is just to make the extern declarations match the stubs.
Quoted 9 lines
No particular reason not to change users other than I didn't want to change the users before the declarations (to avoid warnings about assigning an int to a u8 or u16), and there's not a lot of value in changing local variables, where an int is just on the stack and works fine.
Changing stored values in a struct would have more benefit. I took a quick look and found these possibilities:
Agree. Thanks for clarifying it.
Quoted 22 lines
struct controller.cap_offset (
drivers/pci/hotplug/shpchp.hSHPC cap) struct pci_sriov.pos (drivers/pci/pci.hSR-IOV ext cap)
struct altera_pcie_data.cap_offset (drivers/pci/controller/pcie-altera.cPCIe cap)struct tg3.msi_cap (
broadcom/tg3.hMSI cap)
struct tg3.pcix_cap (broadcom/tg3.hPCI-X cap)
struct bnx2.pm_cap (broadcom/bnx2.hPM cap)
struct bnx2.pcix_cap (broadcom/bnx2.hPCI-X cap)
struct bnx2x_sriov.cap (broadcom/bnx2x/bnx2x_sriov.hSR-IOV ext cap) struct amd8111e_priv.pm_cap (amd/amd8111e.c, removed [1]) struct pci_params.pm_cap (qlogic/qed/qed.h, removed [2]) struct qed_hw_sriov_info.cap (qlogic/qed/qed_sriov.hSR-IOV ext cap) struct eeh_dev.pcix_cap (powerpc/include/asm/eeh.hPCI-X cap) struct eeh_dev.pcie_cap (powerpc/include/asm/eeh.hPCIe cap) struct eeh_dev.aer_cap (powerpc/include/asm/eeh.hAER ext cap) struct eeh_dev.af_cap (powerpc/include/asm/eeh.hAF cap) struct icm.vnd_cap (drivers/thunderbolt/icm.cVNDR ext cap)[1] https://lore.kernel.org/all/[email protected]/
[2] https://lore.kernel.org/all/[email protected]/Bjorn