summaryrefslogtreecommitdiff
path: root/drivers/hotplug
diff options
context:
space:
mode:
authorRussell King <rmk@arm.linux.org.uk>2003-03-06 01:49:14 -0800
committerLinus Torvalds <torvalds@home.transmeta.com>2003-03-06 01:49:14 -0800
commit7c3db3a879b4287393fd2b526b0b14b6883ae65c (patch)
tree5cd8fd85ee6b2652937c9a410c6bd2532da13514 /drivers/hotplug
parentf2820e1d77ac218f6b3a90944a8d0aa4567e1e24 (diff)
[PATCH] Eliminate stack allocation of struct pci_dev...
- Eliminate the stack allocation of a struct pci_dev, and make pci_scan_slot() take a bus and a devfn argument. - Add "dev->multifunction" to indicate whether this is a multifunction device. - Run header fixups before inserting the new pci device into any device lists or announcing it to the drivers. - Convert some more stuff to use the list_for_each* macro(s).
Diffstat (limited to 'drivers/hotplug')
-rw-r--r--drivers/hotplug/acpiphp_glue.c12
-rw-r--r--drivers/hotplug/cpci_hotplug_pci.c8
-rw-r--r--drivers/hotplug/cpqphp_pci.c9
-rw-r--r--drivers/hotplug/ibmphp_core.c12
4 files changed, 9 insertions, 32 deletions
diff --git a/drivers/hotplug/acpiphp_glue.c b/drivers/hotplug/acpiphp_glue.c
index 2398acda3639..0b75b19331be 100644
--- a/drivers/hotplug/acpiphp_glue.c
+++ b/drivers/hotplug/acpiphp_glue.c
@@ -801,7 +801,7 @@ static int power_off_slot (struct acpiphp_slot *slot)
static int enable_device (struct acpiphp_slot *slot)
{
u8 bus;
- struct pci_dev dev0, *dev;
+ struct pci_dev *dev;
struct pci_bus *child;
struct list_head *l;
struct acpiphp_func *func;
@@ -824,16 +824,8 @@ static int enable_device (struct acpiphp_slot *slot)
if (retval)
goto err_exit;
- memset(&dev0, 0, sizeof (struct pci_dev));
-
- dev0.bus = slot->bridge->pci_bus;
- dev0.devfn = PCI_DEVFN(slot->device, 0);
- dev0.sysdata = dev0.bus->sysdata;
- dev0.dev.parent = dev0.bus->dev;
- dev0.dev.bus = &pci_bus_type;
-
/* returned `dev' is the *first function* only! */
- dev = pci_scan_slot (&dev0);
+ dev = pci_scan_slot(slot->bridge->pci_bus, PCI_DEVFN(slot->device, 0));
if (!dev) {
err("No new device found\n");
diff --git a/drivers/hotplug/cpci_hotplug_pci.c b/drivers/hotplug/cpci_hotplug_pci.c
index 16e288238d6c..b11615d7529a 100644
--- a/drivers/hotplug/cpci_hotplug_pci.c
+++ b/drivers/hotplug/cpci_hotplug_pci.c
@@ -574,19 +574,13 @@ int cpci_configure_slot(struct slot* slot)
/* Still NULL? Well then scan for it! */
if(slot->dev == NULL) {
- struct pci_dev dev0;
-
dbg("pci_dev still null");
- memset(&dev0, 0, sizeof (struct pci_dev));
- dev0.bus = slot->bus;
- dev0.devfn = slot->devfn;
- dev0.sysdata = slot->bus->self->sysdata;
/*
* This will generate pci_dev structures for all functions, but
* we will only call this case when lookup fails.
*/
- slot->dev = pci_scan_slot(&dev0);
+ slot->dev = pci_scan_slot(slot->bus, slot->devfn);
if(slot->dev == NULL) {
err("Could not find PCI device for slot %02x", slot->number);
return 0;
diff --git a/drivers/hotplug/cpqphp_pci.c b/drivers/hotplug/cpqphp_pci.c
index 78f0b42187ff..0449d4d26a9d 100644
--- a/drivers/hotplug/cpqphp_pci.c
+++ b/drivers/hotplug/cpqphp_pci.c
@@ -84,24 +84,19 @@ static void *detect_HRT_floating_pointer(void *begin, void *end)
int cpqhp_configure_device (struct controller* ctrl, struct pci_func* func)
{
unsigned char bus;
- struct pci_dev dev0;
struct pci_bus *child;
int rc = 0;
- memset(&dev0, 0, sizeof(struct pci_dev));
-
if (func->pci_dev == NULL)
func->pci_dev = pci_find_slot(func->bus, (func->device << 3) | (func->function & 0x7));
//Still NULL ? Well then scan for it !
if (func->pci_dev == NULL) {
dbg("INFO: pci_dev still null\n");
- dev0.bus = ctrl->pci_dev->bus;
- dev0.devfn = (func->device << 3) + (func->function & 0x7);
- dev0.sysdata = ctrl->pci_dev->sysdata;
//this will generate pci_dev structures for all functions, but we will only call this case when lookup fails
- func->pci_dev = pci_scan_slot(&dev0);
+ func->pci_dev = pci_scan_slot(ctrl->pci_dev->bus,
+ (func->device << 3) + (func->function & 0x7));
if (func->pci_dev == NULL) {
dbg("ERROR: pci_dev still null\n");
return 0;
diff --git a/drivers/hotplug/ibmphp_core.c b/drivers/hotplug/ibmphp_core.c
index 74d9fd4ca029..a75f7fb8c0cc 100644
--- a/drivers/hotplug/ibmphp_core.c
+++ b/drivers/hotplug/ibmphp_core.c
@@ -845,26 +845,22 @@ static u8 bus_structure_fixup (u8 busno)
static int ibm_configure_device (struct pci_func *func)
{
unsigned char bus;
- struct pci_dev dev0;
struct pci_bus *child;
int rc = 0;
int flag = 0; /* this is to make sure we don't double scan the bus, for bridged devices primarily */
- memset (&dev0, 0, sizeof (struct pci_dev));
-
if (!(bus_structure_fixup (func->busno)))
flag = 1;
if (func->dev == NULL)
func->dev = pci_find_slot (func->busno, (func->device << 3) | (func->function & 0x7));
if (func->dev == NULL) {
- dev0.bus = ibmphp_find_bus (func->busno);
- if (!dev0.bus)
+ struct pci_bus *bus = ibmphp_find_bus (func->busno);
+ if (!bus)
return 0;
- dev0.devfn = ((func->device << 3) + (func->function & 0x7));
- dev0.sysdata = dev0.bus->sysdata;
- func->dev = pci_scan_slot (&dev0);
+ func->dev = pci_scan_slot(bus,
+ (func->device << 3) + (func->function & 0x7));
if (func->dev == NULL) {
err ("ERROR... : pci_dev still NULL \n");