Skip to contentSkip to conversation

PCI: Re-factor 'pcibios_setup()'

PATCH In review Myron Stowe 11 participants 28 messages Jun 26, 2012 – Jul 5, 2012

Subsystems (10)
x86 PowerPC PCI MIPS +6 more subsystems
lore
Share & tools
lore
#0 lore raw

cover PCI: Re-factor 'pcibios_setup()'

Currently, all of the architectures implement their own 'pcibios_setup()' routine. Most of the implementations do nothing so this patch introduces a generic (__weak) routine into PCI's core that can be used by all architectures as a default. If necessary, it can then be over-ridden by architecture-specific code.

This series also cleans up 'pcibios_setup()' as necessary to consistently use the "__init" section annotation.

Suggested by Bjorn Helgaas -
http://marc.info/?l=linux-kernel&m=134023745124680&w=2

It looks as if there is a bug in the CRIS architecture's version of 'pcibios_setup()'. It implements pcibios_setup() such that pci_setup() doesn't look for any generic options. I included the fix for this in this series. If this ends up not being correct - i.e. PCI support for CRIS should be dropped - then that specific patch (which I included last in the series) can be dropped.

Note: I do not have a cross-compile environment so I have only tested x86.
---

Myron Stowe (16):
cris/PCI: Factor 'pcibios_setup()' out of cris xtensa/PCI: Factor 'pcibios_setup()' out of xtensa x86/PCI: adjust section annotations for 'pcibios_setup()' unicore32/PCI: adjust section annotations for 'pcibios_setup()' tile/PCI: Factor 'pcibios_setup()' out of tile sparc/PCI: Factor 'pcibios_setup()' out of sparc sh/PCI: adjust section annotations for 'pcibios_setup()' sh/PCI: Factor 'pcibios_setup()' out of sh powerpc/PCI: Factor 'pcibios_setup()' out of powerpc parisc/PCI: Factor 'pcibios_setup()' out of parisc MIPS/PCI: adjust section annotations for 'pcibios_setup()' MIPS/PCI: Factor 'pcibios_setup()' out of MIPS/pmc-sierra microblaze/PCI: Factor 'pcibios_setup()' out of microblaze ia64/PCI: Factor 'pcibios_setup' out of ia64 alpha/PCI: Factor 'pcibios_setup()' out of alpha
PCI: Pull 'pcibios_setup' up into PCI's core

 arch/alpha/kernel/pci.c               |    6 ------
 arch/cris/arch-v32/drivers/pci/bios.c |    5 -----
 arch/ia64/pci/pci.c                   |    9 ---------
 arch/microblaze/pci/pci-common.c      |    5 -----
 arch/mips/pci/pci.c                   |    4 ++--
 arch/mips/pmc-sierra/yosemite/ht.c    |   11 -----------
 arch/mips/txx9/generic/pci.c          |    4 ++--
 arch/parisc/kernel/pci.c              |    5 -----
 arch/powerpc/kernel/pci-common.c      |    5 -----
 arch/sh/drivers/pci/fixups-sdk7786.c  |    4 ++--
 arch/sh/drivers/pci/pci.c             |    5 -----
 arch/sparc/kernel/leon_pci.c          |    8 --------
 arch/sparc/kernel/pci.c               |    5 -----
 arch/sparc/kernel/pcic.c              |    8 --------
 arch/tile/kernel/pci.c                |   10 ----------
 arch/unicore32/kernel/pci.c           |    2 +-
 arch/x86/pci/common.c                 |    2 +-
 arch/xtensa/kernel/pci.c              |    6 ------
 drivers/pci/pci.c                     |   12 ++++++++++++
 include/linux/pci.h                   |    1 +
 20 files changed, 21 insertions(+), 96 deletions(-)
#1 lore raw

PATCH 1/16 PCI: Pull 'pcibios_setup' up into PCI's core

Currently, all of the architectures implement their own 'pcibios_setup()' routine. Most of the implementations do nothing so this patch introduces a generic (__weak) routine into PCI's core that can be used by all architectures as a default. If necessary, it can be over-ridden by architecture-specific code.

No functional change.

---

 drivers/pci/pci.c   |   12 ++++++++++++
 include/linux/pci.h |    1 +
 2 files changed, 13 insertions(+), 0 deletions(-)
drivers/pci/pci.c +12 -0
index 77cb54a..0f6d472 100644
@@ -2671,6 +2671,18 @@ static void __pci_set_master(struct pci_dev *dev, bool enable)
 }
 
 /**
+ * pcibios_setup - process "pci=" kernel boot arguments
+ * @str: string used to pass in "pci=" kernel boot arguments
+ *
+ * Process kernel boot arguments.  This is the default implementation.
+ * Architecture specific implementations can override this as necessary.
+ */
+char * __weak __init pcibios_setup(char *str)
+{
+	return str;
+}
+
+/**
  * pcibios_set_master - enable PCI bus-mastering for device dev
  * @dev: the PCI device to enable
  *
include/linux/pci.h +1 -0
index fefb4e1..fdcff0e 100644
@@ -644,6 +644,7 @@ extern int no_pci_devices(void);
 
 void pcibios_fixup_bus(struct pci_bus *);
 int __must_check pcibios_enable_device(struct pci_dev *, int mask);
+/* Architecture specific versions may override this (weak) */
 char *pcibios_setup(char *str);
 
 /* Used only when drivers/pci/setup.c is used */
#2 lore raw

PATCH 2/16 alpha/PCI: Factor 'pcibios_setup()' out of alpha

In reply to Myron Stowe

The PCI core provides a generic (__weak) 'pcibios_setup()' routine that can be used by all architectures as a default. Drop alpha's architecture specific version in favor of that as it does not need to be over-ridden.

No functional change.

---

 arch/alpha/kernel/pci.c |    6 ------
 1 files changed, 0 insertions(+), 6 deletions(-)
arch/alpha/kernel/pci.c +0 -6
index 1a62963..133d2d4 100644
@@ -198,12 +198,6 @@ pcibios_init(void)
 
 subsys_initcall(pcibios_init);
 
-char * __devinit
-pcibios_setup(char *str)
-{
-	return str;
-}
-
 #ifdef ALPHA_RESTORE_SRM_SETUP
 static struct pdev_srm_saved_conf *srm_saved_configs;
 
Acked-by on v1 2/16
#3 lore raw

Re: [PATCH 02/16] alpha/PCI: Factor 'pcibios_setup()' out of alpha

Quoted 5 lines · Myron Stowe

The PCI core provides a generic (__weak) 'pcibios_setup()' routine that can be used by all architectures as a default. Drop alpha's architecture specific version in favor of that as it does not need to be over-ridden.

Quoted 7 lines

No functional change.

---

 arch/alpha/kernel/pci.c |    6 ------
 1 files changed, 0 insertions(+), 6 deletions(-)

r~

#4 lore raw

PATCH 3/16 ia64/PCI: Factor 'pcibios_setup' out of ia64

In reply to Myron Stowe

The PCI core provides a generic (__weak) 'pcibios_setup()' routine that can be used by all architectures as a default. Drop ia64's architecture specific version in favor of that as it does not need to be over-ridden.

No functional change.

---

 arch/ia64/pci/pci.c |    9 ---------
 1 files changed, 0 insertions(+), 9 deletions(-)
arch/ia64/pci/pci.c +0 -9
index 524df42..e51941f 100644
@@ -496,15 +496,6 @@ pcibios_align_resource (void *data, const struct resource *res,
 	return res->start;
 }
 
-/*
- * PCI BIOS setup, always defaults to SAL interface
- */
-char * __init
-pcibios_setup (char *str)
-{
-	return str;
-}
-
 int
 pci_mmap_page_range (struct pci_dev *dev, struct vm_area_struct *vma,
 		     enum pci_mmap_state mmap_state, int write_combine)
#5 lore raw

PATCH 4/16 microblaze/PCI: Factor 'pcibios_setup()' out of microblaze

In reply to Myron Stowe

The PCI core provides a generic (__weak) 'pcibios_setup()' routine that can be used by all architectures as a default. Drop microblaze's architecture specific version in favor of that as it does not need to be over-ridden.

---

 arch/microblaze/pci/pci-common.c |    5 -----
 1 files changed, 0 insertions(+), 5 deletions(-)
arch/microblaze/pci/pci-common.c +0 -5
index ed22bfc..7b510ae 100644
@@ -192,11 +192,6 @@ void pcibios_set_master(struct pci_dev *dev)
 	/* No special bus mastering setup handling */
 }
 
-char __devinit *pcibios_setup(char *str)
-{
-	return str;
-}
-
 /*
  * Reads the interrupt pin to determine if interrupt is use by card.
  * If the interrupt is used, then gets the interrupt line from the
maintainer Acked-by on v1 4/16
#6 lore raw

Re: [PATCH 04/16] microblaze/PCI: Factor 'pcibios_setup()' out of microblaze

Quoted 18 lines · Myron Stowe

The PCI core provides a generic (__weak) 'pcibios_setup()' routine that can be used by all architectures as a default. Drop microblaze's architecture specific version in favor of that as it does not need to be over-ridden.

---

  arch/microblaze/pci/pci-common.c |    5 -----
  1 files changed, 0 insertions(+), 5 deletions(-)
arch/microblaze/pci/pci-common.c +0 -0
index ed22bfc..7b510ae 100644
@@ -192,11 +192,6 @@ void pcibios_set_master(struct pci_dev *dev)
  	/* No special bus mastering setup handling */

arch/microblaze/pci/pci-common.c void pcibios_set_master(struct pci_dev *dev) · line 197

Quoted 10 lines
arch/microblaze/pci/pci-common.c +0 -5
  }
 
-char __devinit *pcibios_setup(char *str)
-{
-	return str;
-}
-
  /*
   * Reads the interrupt pin to determine if interrupt is use by card.
   * If the interrupt is used, then gets the interrupt line from the

Thanks,
Michal

Signature · 4 lines
Michal Simek, Ing. (M.Eng)
w: www.monstr.eu p: +42-0-721842854
Maintainer of Linux kernel 2.6 Microblaze Linux - http://www.monstr.eu/fdt/
Microblaze U-BOOT custodian
#7 lore raw

PATCH 5/16 MIPS/PCI: Factor 'pcibios_setup()' out of MIPS/pmc-sierra

In reply to Myron Stowe

The PCI core provides a generic (__weak) 'pcibios_setup()' routine that can be used by all architectures as a default. Drop MIPS/pmc-sierra's architecture specific version in favor of that as it does not need to be over-ridden.

---

 arch/mips/pmc-sierra/yosemite/ht.c |   11 -----------
 1 files changed, 0 insertions(+), 11 deletions(-)
arch/mips/pmc-sierra/yosemite/ht.c +0 -11
index 63be40e..14dc9c8 100644
@@ -395,17 +395,6 @@ void __init pcibios_init(void)
         pci_scan_bus(3, &titan_pci_ops, NULL);
 }
 
-/*
- * for parsing "pci=" kernel boot arguments.
- */
-char *pcibios_setup(char *str)
-{
-        printk(KERN_INFO "rr: pcibios_setup\n");
-        /* Nothing to do for now.  */
-
-        return str;
-}
-
 unsigned __init int pcibios_assign_all_busses(void)
 {
         /* We want to use the PCI bus detection done by PMON */
#8 lore raw

PATCH 6/16 MIPS/PCI: adjust section annotations for 'pcibios_setup()'

In reply to Myron Stowe

Make pcibios_setup() consistently use the "__init" section annotation.

---

 arch/mips/pci/pci.c          |    4 ++--
 arch/mips/txx9/generic/pci.c |    4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)
arch/mips/pci/pci.c +2 -2
index 271e8c4..0e111d2 100644
@@ -348,9 +348,9 @@ int pci_mmap_page_range(struct pci_dev *dev, struct vm_area_struct *vma,
 		vma->vm_end - vma->vm_start, vma->vm_page_prot);
 }
 
-char * (*pcibios_plat_setup)(char *str) __devinitdata;
+char * (*pcibios_plat_setup)(char *str) __initdata;
 
-char *__devinit pcibios_setup(char *str)
+char *__init pcibios_setup(char *str)
 {
 	if (pcibios_plat_setup)
 		return pcibios_plat_setup(str);
arch/mips/txx9/generic/pci.c +2 -2
index 682efb0..f028e3d 100644
@@ -398,9 +398,9 @@ int __init pcibios_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
 	return txx9_board_vec->pci_map_irq(dev, slot, pin);
 }
 
-char * (*txx9_board_pcibios_setup)(char *str) __devinitdata;
+char * (*txx9_board_pcibios_setup)(char *str) __initdata;
 
-char *__devinit txx9_pcibios_setup(char *str)
+char *__init txx9_pcibios_setup(char *str)
 {
 	if (txx9_board_pcibios_setup && !txx9_board_pcibios_setup(str))
 		return NULL;
#9 lore raw

PATCH 7/16 parisc/PCI: Factor 'pcibios_setup()' out of parisc

In reply to Myron Stowe

The PCI core provides a generic (__weak) 'pcibios_setup()' routine that can be used by all architectures as a default. Drop parisc's architecture specific version in favor of that as it does not need to be over-ridden.

No functional change.

---

 arch/parisc/kernel/pci.c |    5 -----
 1 files changed, 0 insertions(+), 5 deletions(-)
arch/parisc/kernel/pci.c +0 -5
index 24644ac..6030905 100644
@@ -139,11 +139,6 @@ void pcibios_fixup_bus(struct pci_bus *bus)
 }
 
 
-char *pcibios_setup(char *str)
-{
-	return str;
-}
-
 /*
  * Called by pci_set_master() - a driver interface.
  *
#10 lore raw

PATCH 8/16 powerpc/PCI: Factor 'pcibios_setup()' out of powerpc

In reply to Myron Stowe

The PCI core provides a generic (__weak) 'pcibios_setup()' routine that can be used by all architectures as a default. Drop powerpc's architecture specific version in favor of that as it does not need to be over-ridden.

---

 arch/powerpc/kernel/pci-common.c |    5 -----
 1 files changed, 0 insertions(+), 5 deletions(-)
arch/powerpc/kernel/pci-common.c +0 -5
index 8e78e93..bf2306b 100644
@@ -200,11 +200,6 @@ int pcibios_add_platform_entries(struct pci_dev *pdev)
 	return device_create_file(&pdev->dev, &dev_attr_devspec);
 }
 
-char __devinit *pcibios_setup(char *str)
-{
-	return str;
-}
-
 /*
  * Reads the interrupt pin to determine if interrupt is use by card.
  * If the interrupt is used, then gets the interrupt line from the
Acked-by on v1 8/16
#11 lore raw

Re: [PATCH 08/16] powerpc/PCI: Factor 'pcibios_setup()' out of powerpc

Quoted 6 lines · Myron Stowe

The PCI core provides a generic (__weak) 'pcibios_setup()' routine that can be used by all architectures as a default. Drop powerpc's architecture specific version in favor of that as it does not need to be over-ridden.

Quoted 26 lines

---

 arch/powerpc/kernel/pci-common.c |    5 -----
 1 files changed, 0 insertions(+), 5 deletions(-)
arch/powerpc/kernel/pci-common.c +0 -6
index 8e78e93..bf2306b 100644
@@ -200,11 +200,6 @@ int pcibios_add_platform_entries(struct pci_dev *pdev)
 	return device_create_file(&pdev->dev, &dev_attr_devspec);
 }
 
-char __devinit *pcibios_setup(char *str)
-{
-	return str;
-}
-
 /*
  * Reads the interrupt pin to determine if interrupt is use by card.
  * If the interrupt is used, then gets the interrupt line from the
 
--

To unsubscribe from this list: send the line "unsubscribe linux-pci" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#12 lore raw

PATCH 9/16 sh/PCI: Factor 'pcibios_setup()' out of sh

In reply to Myron Stowe

The PCI core provides a generic (__weak) 'pcibios_setup()' routine that can be used by all architectures as a default. Drop sh's architecture specific version in favor of that as it does not need to be over-ridden.

---

 arch/sh/drivers/pci/pci.c |    5 -----
 1 files changed, 0 insertions(+), 5 deletions(-)
arch/sh/drivers/pci/pci.c +0 -5
index 9d10a3c..7d42288 100644
@@ -197,11 +197,6 @@ void __init pcibios_update_irq(struct pci_dev *dev, int irq)
 	pci_write_config_byte(dev, PCI_INTERRUPT_LINE, irq);
 }
 
-char * __devinit __weak pcibios_setup(char *str)
-{
-	return str;
-}
-
 static void __init
 pcibios_bus_report_status_early(struct pci_channel *hose,
 				int top_bus, int current_bus,
Tested-by on v1 9/16
#13 lore raw

Re: [PATCH 09/16] sh/PCI: Factor 'pcibios_setup()' out of sh

2012/6/26 Myron Stowe <[email protected]>:

Quoted 5 lines

The PCI core provides a generic (__weak) 'pcibios_setup()' routine that can be used by all architectures as a default.  Drop sh's architecture specific version in favor of that as it does not need to be over-ridden.

Signature · 1 line
Nobuhiro Iwamatsu
#15 lore raw

PATCH 10/16 sh/PCI: adjust section annotations for 'pcibios_setup()'

In reply to Myron Stowe

Make pcibios_setup() consistently use the "__init" section annotation.

---

 arch/sh/drivers/pci/fixups-sdk7786.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
arch/sh/drivers/pci/fixups-sdk7786.c +2 -2
index 0e18ee3..36eb6fc 100644
@@ -23,9 +23,9 @@
  * Misconfigurations can be detected through the FPGA via the slot
  * resistors to determine card presence. Hotplug remains unsupported.
  */
-static unsigned int slot4en __devinitdata;
+static unsigned int slot4en __initdata;
 
-char *__devinit pcibios_setup(char *str)
+char *__init pcibios_setup(char *str)
 {
 	if (strcmp(str, "slot4en") == 0) {
 		slot4en = 1;
#16 lore raw

PATCH 11/16 sparc/PCI: Factor 'pcibios_setup()' out of sparc

In reply to Myron Stowe

The PCI core provides a generic (__weak) 'pcibios_setup()' routine that can be used by all architectures as a default. Drop sparc's architecture specific version in favor of that as it does not need to be over-ridden.

---

 arch/sparc/kernel/leon_pci.c |    8 --------
 arch/sparc/kernel/pci.c      |    5 -----
 arch/sparc/kernel/pcic.c     |    8 --------
 3 files changed, 0 insertions(+), 21 deletions(-)
arch/sparc/kernel/leon_pci.c +0 -8
index 19f5605..21dcda7 100644
@@ -91,14 +91,6 @@ void __devinit pcibios_fixup_bus(struct pci_bus *pbus)
 	}
 }
 
-/*
- * Other archs parse arguments here.
- */
-char * __devinit pcibios_setup(char *str)
-{
-	return str;
-}
-
 resource_size_t pcibios_align_resource(void *data, const struct resource *res,
 				resource_size_t size, resource_size_t align)
 {
arch/sparc/kernel/pci.c +0 -5
index fdaf218..3e7fba0 100644
@@ -747,11 +747,6 @@ int pcibios_enable_device(struct pci_dev *dev, int mask)
 	return 0;
 }
 
-char * __devinit pcibios_setup(char *str)
-{
-	return str;
-}
-
 /* Platform support for /proc/bus/pci/X/Y mmap()s. */
 
 /* If the user uses a host-bridge as the PCI device, he may use
arch/sparc/kernel/pcic.c +0 -8
index ded3f60..97eb529 100644
@@ -767,14 +767,6 @@ static void watchdog_reset() {
 }
 #endif
 
-/*
- * Other archs parse arguments here.
- */
-char * __devinit pcibios_setup(char *str)
-{
-	return str;
-}
-
 resource_size_t pcibios_align_resource(void *data, const struct resource *res,
 				resource_size_t size, resource_size_t align)
 {
maintainer Acked-by on v1 11/16
#17 lore raw

Re: [PATCH 11/16] sparc/PCI: Factor 'pcibios_setup()' out of sparc

From: Myron Stowe <[email protected]>
Date: Mon, 25 Jun 2012 21:32:12 -0600

Quoted 6 lines

The PCI core provides a generic (__weak) 'pcibios_setup()' routine that can be used by all architectures as a default. Drop sparc's architecture specific version in favor of that as it does not need to be over-ridden.

#18 lore raw

PATCH 12/16 tile/PCI: Factor 'pcibios_setup()' out of tile

In reply to Myron Stowe

The PCI core provides a generic (__weak) 'pcibios_setup()' routine that can be used by all architectures as a default. Drop tile's architecture specific version in favor of that as it does not need to be over-ridden.

---

 arch/tile/kernel/pci.c |   10 ----------
 1 files changed, 0 insertions(+), 10 deletions(-)
arch/tile/kernel/pci.c +0 -10
index b56d12b..e257226 100644
@@ -401,16 +401,6 @@ void pcibios_set_master(struct pci_dev *dev)
 }
 
 /*
- * This can be called from the generic PCI layer, but doesn't need to
- * do anything.
- */
-char __devinit *pcibios_setup(char *str)
-{
-	/* Nothing needs to be done. */
-	return str;
-}
-
-/*
  * This is called from the generic Linux layer.
  */
 void __devinit pcibios_update_irq(struct pci_dev *dev, int irq)
Acked-by on v1 12/16
#19 lore raw

Re: [PATCH 12/16] tile/PCI: Factor 'pcibios_setup()' out of tile

Quoted 10 lines · Myron Stowe

The PCI core provides a generic (__weak) 'pcibios_setup()' routine that can be used by all architectures as a default. Drop tile's architecture specific version in favor of that as it does not need to be over-ridden.

---

 arch/tile/kernel/pci.c |   10 ----------
 1 files changed, 0 insertions(+), 10 deletions(-)

In our internal tree we have x86-like support for "pci=off" here. When I push that I can just push it as a new function to override the removed one, so I'm happy with your change as proposed. But perhaps it would make sense to move the support for "pci=off" to common code, since multiple architectures handle this the same way?

Signature · 2 lines
Chris Metcalf, Tilera Corp.
http://www.tilera.com
#20 lore raw

Re: [PATCH 12/16] tile/PCI: Factor 'pcibios_setup()' out of tile

Quoted 9 lines · Chris Metcalf
Quoted 8 lines · Myron Stowe

The PCI core provides a generic (__weak) 'pcibios_setup()' routine that can be used by all architectures as a default. Drop tile's architecture specific version in favor of that as it does not need to be over-ridden.

---

Quoted 8 lines
Quoted 2 lines
 arch/tile/kernel/pci.c |   10 ----------
 1 files changed, 0 insertions(+), 10 deletions(-)

In our internal tree we have x86-like support for "pci=off" here. When I push that I can just push it as a new function to override the removed one, so I'm happy with your change as proposed.

Yes, that should be fine. Just an FYI - when you introduce the over-ride, I believe that it should be __init and not __devinit as the previous tile version of 'pcibios_setup()' was.

Quoted 3 lines

But perhaps it would make sense
to move the support for "pci=off" to common code, since multiple architectures handle this the same way?

Looking at the tree I only see three of the architectures currently using/implementing "pci=off" (four with the 'tile' addition). Perhaps there is a way to avoid such but it seems like adding this to the core would require introducing the global variable 'pci_probe' which seems like unnecessary pollution?

Myron

#21 lore raw

Re: [PATCH 12/16] tile/PCI: Factor 'pcibios_setup()' out of tile

Quoted 17 lines · Myron Stowe
Quoted 9 lines · Chris Metcalf
Quoted 8 lines · Myron Stowe

The PCI core provides a generic (__weak) 'pcibios_setup()' routine that can be used by all architectures as a default. Drop tile's architecture specific version in favor of that as it does not need to be over-ridden.

---

Quoted 7 lines
Quoted 2 lines
 arch/tile/kernel/pci.c |   10 ----------
 1 files changed, 0 insertions(+), 10 deletions(-)

[...]
In our internal tree we have x86-like support for "pci=off" here. [...] But perhaps it would make sense
to move the support for "pci=off" to common code, since multiple architectures handle this the same way?

Quoted 5 lines

Looking at the tree I only see three of the architectures currently using/implementing "pci=off" (four with the 'tile' addition). Perhaps there is a way to avoid such but it seems like adding this to the core would require introducing the global variable 'pci_probe' which seems like unnecessary pollution?

I'd argue that the core might expose a pci_probing_disabled() function that returns whether "pci=off" was seen, and modify the other architectures that already support pci_probe to call that function instead. It's true that x86 has a much more elaborate use of pci_probe than the other architectures, which means x86 would probably want to keep the variable as-is and just call pci_probing_disabled() to set pci_probe to zero and return.

All that said, I'm not volunteering to make this change, so if it doesn't seem right to you, I certainly won't insist. :-)

Signature · 2 lines
Chris Metcalf, Tilera Corp.
http://www.tilera.com
#22 lore raw

PATCH 13/16 unicore32/PCI: adjust section annotations for 'pcibios_setup()'

In reply to Myron Stowe

Make pcibios_setup() consistently use the "__init" section annotation.

---

 arch/unicore32/kernel/pci.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
arch/unicore32/kernel/pci.c +1 -1
index 2fc2b1b..46cb6c9 100644
@@ -296,7 +296,7 @@ static int __init pci_common_init(void)
 }
 subsys_initcall(pci_common_init);
 
-char * __devinit pcibios_setup(char *str)
+char * __init pcibios_setup(char *str)
 {
 	if (!strcmp(str, "debug")) {
 		debug_pci = 1;
#24 lore raw

PATCH 14/16 x86/PCI: adjust section annotations for 'pcibios_setup()'

In reply to Myron Stowe

Make pcibios_setup() consistently use the "__init" section annotation.

---

 arch/x86/pci/common.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
arch/x86/pci/common.c +1 -1
index 0ad990a..720e973 100644
@@ -494,7 +494,7 @@ int __init pcibios_init(void)
 	return 0;
 }
 
-char * __devinit  pcibios_setup(char *str)
+char * __init pcibios_setup(char *str)
 {
 	if (!strcmp(str, "off")) {
 		pci_probe = 0;
#25 lore raw

PATCH 15/16 xtensa/PCI: Factor 'pcibios_setup()' out of xtensa

In reply to Myron Stowe

The PCI core provides a generic (__weak) 'pcibios_setup()' routine that can be used by all architectures as a default. Drop xtensa's architecture specific version in favor of that as it does not need to be over-ridden.

No functional change.

---

 arch/xtensa/kernel/pci.c |    6 ------
 1 files changed, 0 insertions(+), 6 deletions(-)
arch/xtensa/kernel/pci.c +0 -6
index eb30e35..3a2cae4 100644
@@ -46,7 +46,6 @@
  * pcibios_fixups
  * pcibios_align_resource
  * pcibios_fixup_bus
- * pcibios_setup
  * pci_bus_add_device
  * pci_mmap_page_range
  */
@@ -206,11 +205,6 @@ void __init pcibios_fixup_bus(struct pci_bus *bus)
 	}
 }
 
-char __init *pcibios_setup(char *str)
-{
-	return str;
-}
-
 void pcibios_set_master(struct pci_dev *dev)
 {
 	/* No special bus mastering setup handling */
#26 lore raw

PATCH 16/16 cris/PCI: Factor 'pcibios_setup()' out of cris

In reply to Myron Stowe

This patch fixes what looks like a bug in cris, which implements pcibios_setup() such that pci_setup() doesn't look for any generic options.

The PCI core provides a generic (__weak) 'pcibios_setup()' routine that can be used by all architectures as a default. Drop cris's architecture specific version in favor of that as it does not need to be over-ridden.

---

 arch/cris/arch-v32/drivers/pci/bios.c |    5 -----
 1 files changed, 0 insertions(+), 5 deletions(-)
arch/cris/arch-v32/drivers/pci/bios.c +0 -5
index bc0cfda..5b1ee82 100644
@@ -6,11 +6,6 @@ void __devinit  pcibios_fixup_bus(struct pci_bus *b)
 {
 }
 
-char * __devinit  pcibios_setup(char *str)
-{
-	return NULL;
-}
-
 void pcibios_set_master(struct pci_dev *dev)
 {
 	u8 lat;
maintainer
#27 lore raw
In reply to Myron Stowe
Quoted 55 lines · Myron Stowe

Currently, all of the architectures implement their own 'pcibios_setup()' routine. Most of the implementations do nothing so this patch introduces a generic (__weak) routine into PCI's core that can be used by all architectures as a default. If necessary, it can then be over-ridden by architecture-specific code.

This series also cleans up 'pcibios_setup()' as necessary to consistently use the "__init" section annotation.

Suggested by Bjorn Helgaas -
http://marc.info/?l=linux-kernel&m=134023745124680&w=2

It looks as if there is a bug in the CRIS architecture's version of 'pcibios_setup()'. It implements pcibios_setup() such that pci_setup() doesn't look for any generic options. I included the fix for this in this series. If this ends up not being correct - i.e. PCI support for CRIS should be dropped - then that specific patch (which I included last in the series) can be dropped.

Note: I do not have a cross-compile environment so I have only tested x86.
---

Myron Stowe (16):
cris/PCI: Factor 'pcibios_setup()' out of cris xtensa/PCI: Factor 'pcibios_setup()' out of xtensa x86/PCI: adjust section annotations for 'pcibios_setup()' unicore32/PCI: adjust section annotations for 'pcibios_setup()' tile/PCI: Factor 'pcibios_setup()' out of tile sparc/PCI: Factor 'pcibios_setup()' out of sparc sh/PCI: adjust section annotations for 'pcibios_setup()' sh/PCI: Factor 'pcibios_setup()' out of sh powerpc/PCI: Factor 'pcibios_setup()' out of powerpc parisc/PCI: Factor 'pcibios_setup()' out of parisc MIPS/PCI: adjust section annotations for 'pcibios_setup()' MIPS/PCI: Factor 'pcibios_setup()' out of MIPS/pmc-sierra microblaze/PCI: Factor 'pcibios_setup()' out of microblaze ia64/PCI: Factor 'pcibios_setup' out of ia64 alpha/PCI: Factor 'pcibios_setup()' out of alpha
PCI: Pull 'pcibios_setup' up into PCI's core

 arch/alpha/kernel/pci.c               |    6 ------
 arch/cris/arch-v32/drivers/pci/bios.c |    5 -----
 arch/ia64/pci/pci.c                   |    9 ---------
 arch/microblaze/pci/pci-common.c      |    5 -----
 arch/mips/pci/pci.c                   |    4 ++--
 arch/mips/pmc-sierra/yosemite/ht.c    |   11 -----------
 arch/mips/txx9/generic/pci.c          |    4 ++--
 arch/parisc/kernel/pci.c              |    5 -----
 arch/powerpc/kernel/pci-common.c      |    5 -----
 arch/sh/drivers/pci/fixups-sdk7786.c  |    4 ++--
 arch/sh/drivers/pci/pci.c             |    5 -----
 arch/sparc/kernel/leon_pci.c          |    8 --------
 arch/sparc/kernel/pci.c               |    5 -----
Quoted 8 lines
 arch/sparc/kernel/pcic.c              |    8 --------
 arch/tile/kernel/pci.c                |   10 ----------
 arch/unicore32/kernel/pci.c           |    2 +-
 arch/x86/pci/common.c                 |    2 +-
 arch/xtensa/kernel/pci.c              |    6 ------
 drivers/pci/pci.c                     |   12 ++++++++++++
 include/linux/pci.h                   |    1 +
 20 files changed, 21 insertions(+), 96 deletions(-)

I pushed these to my -next branch, for inclusion in 3.6. Thanks for the cleanups!

Bjorn