Skip to contentSkip to conversation

PCI fixes for 2.6.21-rc3

PATCH New Greg KH 1 participant 5 messages Mar 10, 2007 PCI

lore
Share & tools
lore

Greg KH

author
#0 lore raw

PATCH 1/1 PCI fixes for 2.6.21-rc3

Here are some PCI fixes against 2.6.21-rc3

They fix a problem that shows up with the libata drivers and fix a number of section mismatches.

All of these have been in the -mm tree.

Please pull from:

	master.kernel.org:/pub/scm/linux/kernel/git/gregkh/pci-2.6.git/

The full patches will be sent to the linux-pci mailing list, if anyone wants to see it

thanks,

greg k-h

 drivers/pci/pci.c              |   15 ++++++++-------
 drivers/pci/pcie/aer/aerdrv.c  |    6 +++---
 drivers/pci/pcie/portdrv_pci.c |    6 +++---
 drivers/pci/search.c           |    2 +-
 4 files changed, 15 insertions(+), 14 deletions(-)

---------------

Sam Ravnborg (3):
pcie: fix section mismatch warning
PCI: aer: fix section mismatch warning
pci: fix section mismatch warning

Tejun Heo (1):
PCI: allow multiple calls to pcim_pin_device()

#1 lore raw

PATCH 1/4 PCI: allow multiple calls to pcim_pin_device()

From: Tejun Heo <[email protected]>

Sanity check in pcim_pin_device() was too restrictive in that it didn't allow multiple calls to the function, which is against the devres philosohpy of fire-and-forget. Track pinned status separately and allow pinning multiple times.

---
 drivers/pci/pci.c |   15 ++++++++-------
 1 files changed, 8 insertions(+), 7 deletions(-)
drivers/pci/pci.c +8 -7
index df49530..a32db06 100644
@@ -757,7 +757,8 @@ int pci_enable_device(struct pci_dev *dev)
  * when a device is enabled using managed PCI device enable interface.
  */
 struct pci_devres {
-	unsigned int disable:1;
+	unsigned int enabled:1;
+	unsigned int pinned:1;
 	unsigned int orig_intx:1;
 	unsigned int restore_intx:1;
 	u32 region_mask;
@@ -781,7 +782,7 @@ static void pcim_release(struct device *gendev, void *res)
 	if (this->restore_intx)
 		pci_intx(dev, this->orig_intx);
 
-	if (this->disable)
+	if (this->enabled && !this->pinned)
 		pci_disable_device(dev);
 }
 
@@ -820,12 +821,12 @@ int pcim_enable_device(struct pci_dev *pdev)
 	dr = get_pci_dr(pdev);
 	if (unlikely(!dr))
 		return -ENOMEM;
-	WARN_ON(!!dr->disable);
+	WARN_ON(!!dr->enabled);
 
 	rc = pci_enable_device(pdev);
 	if (!rc) {
 		pdev->is_managed = 1;
-		dr->disable = 1;
+		dr->enabled = 1;
 	}
 	return rc;
 }
@@ -843,9 +844,9 @@ void pcim_pin_device(struct pci_dev *pdev)
 	struct pci_devres *dr;
 
 	dr = find_pci_dr(pdev);
-	WARN_ON(!dr || !dr->disable);
+	WARN_ON(!dr || !dr->enabled);
 	if (dr)
-		dr->disable = 0;
+		dr->pinned = 1;
 }
 
 /**
@@ -876,7 +877,7 @@ pci_disable_device(struct pci_dev *dev)
 
 	dr = find_pci_dr(dev);
 	if (dr)
-		dr->disable = 0;
+		dr->enabled = 0;
 
 	if (atomic_sub_return(1, &dev->enable_cnt) != 0)
 		return;
Signature · 1 line
1.5.0.2
#2 lore raw

PATCH 2/4 pcie: fix section mismatch warning

From: Sam Ravnborg <[email protected]>

Fix following section mismatch warning (when compiled with CONFIG_HOTPLUG=n):
WARNING: drivers/pci/built-in.o - Section mismatch: reference to .init.text:pcie_portdrv_probe from .data between 'pcie_portdrv' (at offset 0xe40) and 'pcie_portdrv_err_handler'

This warning was fixed by renaming pcie_portdrv to pcie_portdriver so we pass the whitelist.

---
 drivers/pci/pcie/portdrv_pci.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)
drivers/pci/pcie/portdrv_pci.c +3 -3
index f17e7ed..0be5a0b 100644
@@ -276,7 +276,7 @@ static struct pci_error_handlers pcie_portdrv_err_handler = {
 		.resume = pcie_portdrv_err_resume,
 };
 
-static struct pci_driver pcie_portdrv = {
+static struct pci_driver pcie_portdriver = {
 	.name		= (char *)device_name,
 	.id_table	= &port_pci_ids[0],
 
@@ -298,7 +298,7 @@ static int __init pcie_portdrv_init(void)
 		printk(KERN_WARNING "PCIE: bus_register error: %d\n", retval);
 		goto out;
 	}
-	retval = pci_register_driver(&pcie_portdrv);
+	retval = pci_register_driver(&pcie_portdriver);
 	if (retval)
 		pcie_port_bus_unregister();
  out:
@@ -307,7 +307,7 @@ static int __init pcie_portdrv_init(void)
 
 static void __exit pcie_portdrv_exit(void) 
 {
-	pci_unregister_driver(&pcie_portdrv);
+	pci_unregister_driver(&pcie_portdriver);
 	pcie_port_bus_unregister();
 }
 
Signature · 1 line
1.5.0.2
#3 lore raw

PATCH 3/4 PCI: aer: fix section mismatch warning

From: Sam Ravnborg <[email protected]>

Fix following section mismatch warning (when compiled with CONFIG_HOTPLUG=n):
WARNING: drivers/pci/built-in.o - Section mismatch: reference to .init.text:aer_probe from .data between 'aerdrv' (at offset 0x1608) and 'aer_error_handlers'

Warning was fixed by renaming aerdrv to aerdriver so we pass the whitelist.

---
 drivers/pci/pcie/aer/aerdrv.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)
drivers/pci/pcie/aer/aerdrv.c +3 -3
index b164de0..db6ad8e 100644
@@ -66,7 +66,7 @@ static struct pci_error_handlers aer_error_handlers = {
 	.resume = aer_error_resume,
 };
 
-static struct pcie_port_service_driver aerdrv = {
+static struct pcie_port_service_driver aerdriver = {
 	.name		= "aer",
 	.id_table	= &aer_id[0],
 
@@ -328,7 +328,7 @@ static void aer_error_resume(struct pci_dev *dev)
  **/
 static int __init aer_service_init(void)
 {
-	return pcie_port_service_register(&aerdrv);
+	return pcie_port_service_register(&aerdriver);
 }
 
 /**
@@ -338,7 +338,7 @@ static int __init aer_service_init(void)
  **/
 static void __exit aer_service_exit(void)
 {
-	pcie_port_service_unregister(&aerdrv);
+	pcie_port_service_unregister(&aerdriver);
 }
 
 module_init(aer_service_init);
Signature · 1 line
1.5.0.2
#4 lore raw

PATCH 4/4 pci: fix section mismatch warning

From: Sam Ravnborg <[email protected]>

drivers/pci/search.c caused following section mismatch warning (if compiled with CONFIG_HOTPLUG=n):

WARNING: drivers/pci/built-in.o - Section mismatch: reference to .init.text: from .text.pci_find_bus after 'pci_find_bus' (at offset 0x24)

This was due to pci_find_bus() calling a function marked __devinit. Fix was to remove the __devinit from the offending function.

---
 drivers/pci/search.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/pci/search.c +1 -1
index ff98ead..2dd8681 100644
@@ -15,7 +15,7 @@
 
 DECLARE_RWSEM(pci_bus_sem);
 
-static struct pci_bus * __devinit
+static struct pci_bus *
 pci_do_find_bus(struct pci_bus* bus, unsigned char busnr)
 {
 	struct pci_bus* child;
Signature · 1 line
1.5.0.2