Skip to contentSkip to conversation

ARM: PCI: expand single-line pci_common_init() wrapper function

PATCH In review Ethan Nelson-Moore 2 participants 4 messages May 17 – May 18

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ARM: PCI: expand single-line pci_common_init() wrapper function

pci_common_init() is a compatibility wrapper that simply calls pci_common_init_dev() with an additional NULL argument. The comment above it implies that it should be replaced by pci_common_init_dev(), but that has never happened - there are no callers of pci_common_init_dev() in the kernel. Make the PCI code more straightforward by updating all uses of pci_common_init() to instead call pci_common_init_dev() with a NULL first argument and removing pci_common_init().

---
 arch/arm/include/asm/mach/pci.h                | 9 ---------
 arch/arm/mach-dove/pcie.c                      | 2 +-
 arch/arm/mach-footbridge/ebsa285-pci.c         | 2 +-
 arch/arm/mach-footbridge/netwinder-pci.c       | 2 +-
 arch/arm/mach-mv78xx0/pcie.c                   | 2 +-
 arch/arm/mach-orion5x/board-mss2.c             | 2 +-
 arch/arm/mach-orion5x/board-rd88f5182.c        | 2 +-
 arch/arm/mach-orion5x/dns323-setup.c           | 2 +-
 arch/arm/mach-orion5x/kurobox_pro-setup.c      | 2 +-
 arch/arm/mach-orion5x/terastation_pro2-setup.c | 2 +-
 arch/arm/mach-orion5x/ts209-setup.c            | 2 +-
 arch/arm/mach-orion5x/ts409-setup.c            | 2 +-
 12 files changed, 11 insertions(+), 20 deletions(-)
arch/arm/include/asm/mach/pci.h +0 -9
index ea9bd08895b7..caad50f64a9c 100644
@@ -52,15 +52,6 @@ struct pci_sys_data {
  */
 void pci_common_init_dev(struct device *, struct hw_pci *);
 
-/*
- * Compatibility wrapper for older platforms that do not care about
- * passing the parent device.
- */
-static inline void pci_common_init(struct hw_pci *hw)
-{
-	pci_common_init_dev(NULL, hw);
-}
-
 /*
  * Setup early fixed I/O mapping.
  */
arch/arm/mach-dove/pcie.c +1 -1
index 3044b7e03890..f990836409f4 100644
@@ -222,5 +222,5 @@ void __init dove_pcie_init(int init_port0, int init_port1)
 	if (init_port1)
 		add_pcie_port(1, DOVE_PCIE1_VIRT_BASE);
 
-	pci_common_init(&dove_pci);
+	pci_common_init_dev(NULL, &dove_pci);
 }
arch/arm/mach-footbridge/ebsa285-pci.c +1 -1
index c3f280d08fa7..93078a031383 100644
@@ -41,7 +41,7 @@ static struct hw_pci ebsa285_pci __initdata = {
 static int __init ebsa285_init_pci(void)
 {
 	if (machine_is_ebsa285())
-		pci_common_init(&ebsa285_pci);
+		pci_common_init_dev(NULL, &ebsa285_pci);
 	return 0;
 }
 
arch/arm/mach-footbridge/netwinder-pci.c +1 -1
index e8304392074b..5fc0023f988f 100644
@@ -55,7 +55,7 @@ static struct hw_pci netwinder_pci __initdata = {
 static int __init netwinder_pci_init(void)
 {
 	if (machine_is_netwinder())
-		pci_common_init(&netwinder_pci);
+		pci_common_init_dev(NULL, &netwinder_pci);
 	return 0;
 }
 
arch/arm/mach-mv78xx0/pcie.c +1 -1
index 533cb7856943..9cca6841644e 100644
@@ -276,5 +276,5 @@ void __init mv78xx0_pcie_init(int init_port0, int init_port1)
 		}
 	}
 
-	pci_common_init(&mv78xx0_pci);
+	pci_common_init_dev(NULL, &mv78xx0_pci);
 }
arch/arm/mach-orion5x/board-mss2.c +1 -1
index 9e3d69891d2f..aad8d088f839 100644
@@ -48,7 +48,7 @@ static struct hw_pci mss2_pci __initdata = {
 static int __init mss2_pci_init(void)
 {
 	if (machine_is_mss2())
-		pci_common_init(&mss2_pci);
+		pci_common_init_dev(NULL, &mss2_pci);
 
 	return 0;
 }
arch/arm/mach-orion5x/board-rd88f5182.c +1 -1
index 1c14e49a90a6..cee3902a95ae 100644
@@ -106,7 +106,7 @@ static struct hw_pci rd88f5182_pci __initdata = {
 static int __init rd88f5182_pci_init(void)
 {
 	if (of_machine_is_compatible("marvell,rd-88f5182-nas"))
-		pci_common_init(&rd88f5182_pci);
+		pci_common_init_dev(NULL, &rd88f5182_pci);
 
 	return 0;
 }
arch/arm/mach-orion5x/dns323-setup.c +1 -1
index fcd38ff7ca45..cdc12b4ce4c5 100644
@@ -99,7 +99,7 @@ static int __init dns323_pci_init(void)
 	 * gets in the way of initialising the SATA controller.
 	 */
 	if (machine_is_dns323() && system_rev == DNS323_REV_A1)
-		pci_common_init(&dns323_pci);
+		pci_common_init_dev(NULL, &dns323_pci);
 
 	return 0;
 }
arch/arm/mach-orion5x/kurobox_pro-setup.c +1 -1
index 339b10891808..c1791aeefeeb 100644
@@ -144,7 +144,7 @@ static int __init kurobox_pro_pci_init(void)
 {
 	if (machine_is_kurobox_pro()) {
 		orion5x_pci_disable();
-		pci_common_init(&kurobox_pro_pci);
+		pci_common_init_dev(NULL, &kurobox_pro_pci);
 	}
 
 	return 0;
arch/arm/mach-orion5x/terastation_pro2-setup.c +1 -1
index a9f01859d101..c7af30134fab 100644
@@ -126,7 +126,7 @@ static struct hw_pci tsp2_pci __initdata = {
 static int __init tsp2_pci_init(void)
 {
 	if (machine_is_terastation_pro2())
-		pci_common_init(&tsp2_pci);
+		pci_common_init_dev(NULL, &tsp2_pci);
 
 	return 0;
 }
arch/arm/mach-orion5x/ts209-setup.c +1 -1
index de9092e992c5..a2c05f039d72 100644
@@ -174,7 +174,7 @@ static struct hw_pci qnap_ts209_pci __initdata = {
 static int __init qnap_ts209_pci_init(void)
 {
 	if (machine_is_ts209())
-		pci_common_init(&qnap_ts209_pci);
+		pci_common_init_dev(NULL, &qnap_ts209_pci);
 
 	return 0;
 }
arch/arm/mach-orion5x/ts409-setup.c +1 -1
index 725688aa5cba..94e0100dee36 100644
@@ -145,7 +145,7 @@ static struct hw_pci qnap_ts409_pci __initdata = {
 static int __init qnap_ts409_pci_init(void)
 {
 	if (machine_is_ts409())
-		pci_common_init(&qnap_ts409_pci);
+		pci_common_init_dev(NULL, &qnap_ts409_pci);
 
 	return 0;
 }
Signature · 1 line
2.43.0
maintainer
#1 lore raw
Quoted 8 lines · Ethan Nelson-Moore

pci_common_init() is a compatibility wrapper that simply calls pci_common_init_dev() with an additional NULL argument. The comment above it implies that it should be replaced by pci_common_init_dev(), but that has never happened - there are no callers of pci_common_init_dev() in the kernel. Make the PCI code more straightforward by updating all uses of pci_common_init() to instead call pci_common_init_dev() with a NULL first argument and removing pci_common_init().

Nobody seems to call pci_common_init_dev() without passing NULL. So i think it makes more sense to rename pci_common_init_dev() to pci_common_init() and drop struct device *parent parameter. You then only need to change pci.h and bios32.c.

Andrew

#2 lore raw

Hi, Andrew,

Quoted 4 lines · Andrew Lunn

Nobody seems to call pci_common_init_dev() without passing NULL. So i think it makes more sense to rename pci_common_init_dev() to pci_common_init() and drop struct device *parent parameter. You then only need to change pci.h and bios32.c.

I considered that, but decided against it because it would prevent the code from easily being updated to pass a parent parameter in the future. However, given the age of the affected platforms, that is unlikely to happen, so your approach might make more sense. What do you think?

Ethan

maintainer
#3 lore raw
Quoted 8 lines · Ethan Nelson-Moore

Hi, Andrew,

Quoted 4 lines · Andrew Lunn

Nobody seems to call pci_common_init_dev() without passing NULL. So i think it makes more sense to rename pci_common_init_dev() to pci_common_init() and drop struct device *parent parameter. You then only need to change pci.h and bios32.c.

Quoted 5 lines

I considered that, but decided against it because it would prevent the code from easily being updated to pass a parent parameter in the future. However, given the age of the affected platforms, that is unlikely to happen, so your approach might make more sense. What do you think?

These are all old platforms, they are likely to be slowly removed over the next few years, and then pci_common_init* can be removed. I don't expect any code to need to set the parent. And some new board does come along which needs it, it is an easy revert.

You could also include a tiny patch which removes parent from pcibios_init_hw().

Andrew