* [BK PATCH] PCI fixes for 2.5.62
@ 2003-02-21 0:43 Greg KH
2003-02-21 0:44 ` [PATCH] " Greg KH
0 siblings, 1 reply; 5+ messages in thread
From: Greg KH @ 2003-02-21 0:43 UTC (permalink / raw)
To: torvalds; +Cc: linux-kernel
Hi,
Here's three patches that remove the pci functions off of the top of
your list of "abuse the most stack space" list. And there's a patch in
here from Louis Zhuang that cleans up some of the list handling code in
the pci core (his patch has been posted to lkml in the past).
Please pull from:
bk://kernel.bkbits.net/gregkh/linux/pci-2.5
thanks,
greg k-h
p.s. I'll send these as patches in response to this email to lkml for
those who want to see them.
arch/i386/pci/direct.c | 34 ++++++++++++++++++++++++----------
arch/i386/pci/legacy.c | 27 +++++++++++++++++++--------
drivers/pci/probe.c | 28 +++++++++++++++++-----------
drivers/pci/setup-bus.c | 30 ++++++++++++------------------
4 files changed, 72 insertions(+), 47 deletions(-)
-----
ChangeSet@1.1006, 2003-02-20 16:32:48-08:00, louis.zhuang@linux.co.intel.com
[PATCH] PCI: list code cleanup
Cleans up the list handling in a few places within the pci core.
drivers/pci/probe.c | 5 ++---
drivers/pci/setup-bus.c | 30 ++++++++++++------------------
2 files changed, 14 insertions(+), 21 deletions(-)
------
ChangeSet@1.1005, 2003-02-20 14:23:58-08:00, greg@kroah.com
[PATCH] PCI i386: remove large stack usage in pcibios_fixup_peer_bridges()
arch/i386/pci/legacy.c | 27 +++++++++++++++++++--------
1 files changed, 19 insertions(+), 8 deletions(-)
------
ChangeSet@1.1004, 2003-02-20 14:23:43-08:00, greg@kroah.com
[PATCH] PCI i386: remove large stack usage in pci_sanity_check()
arch/i386/pci/direct.c | 34 ++++++++++++++++++++++++----------
1 files changed, 24 insertions(+), 10 deletions(-)
------
ChangeSet@1.1003, 2003-02-20 14:23:27-08:00, greg@kroah.com
[PATCH] PCI: remove large stack usage in pci_do_scan_bus()
drivers/pci/probe.c | 23 +++++++++++++++--------
1 files changed, 15 insertions(+), 8 deletions(-)
------
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH] PCI fixes for 2.5.62
2003-02-21 0:43 [BK PATCH] PCI fixes for 2.5.62 Greg KH
@ 2003-02-21 0:44 ` Greg KH
2003-02-21 0:44 ` Greg KH
0 siblings, 1 reply; 5+ messages in thread
From: Greg KH @ 2003-02-21 0:44 UTC (permalink / raw)
To: linux-kernel
ChangeSet 1.1003, 2003/02/20 14:23:27-08:00, greg@kroah.com
[PATCH] PCI: remove large stack usage in pci_do_scan_bus()
diff -Nru a/drivers/pci/probe.c b/drivers/pci/probe.c
--- a/drivers/pci/probe.c Thu Feb 20 16:46:35 2003
+++ b/drivers/pci/probe.c Thu Feb 20 16:46:35 2003
@@ -505,23 +505,30 @@
{
unsigned int devfn, max, pass;
struct list_head *ln;
- struct pci_dev *dev, dev0;
+ struct pci_dev *dev;
+
+ dev = kmalloc(sizeof(*dev), GFP_KERNEL);
+ if (!dev) {
+ printk(KERN_ERR "Out of memory in %s\n", __FUNCTION__);
+ return 0;
+ }
DBG("Scanning bus %02x\n", bus->number);
max = bus->secondary;
/* Create a device template */
- memset(&dev0, 0, sizeof(dev0));
- dev0.bus = bus;
- dev0.sysdata = bus->sysdata;
- dev0.dev.parent = bus->dev;
- dev0.dev.bus = &pci_bus_type;
+ memset(dev, 0, sizeof(*dev));
+ dev->bus = bus;
+ dev->sysdata = bus->sysdata;
+ dev->dev.parent = bus->dev;
+ dev->dev.bus = &pci_bus_type;
/* Go find them, Rover! */
for (devfn = 0; devfn < 0x100; devfn += 8) {
- dev0.devfn = devfn;
- pci_scan_slot(&dev0);
+ dev->devfn = devfn;
+ pci_scan_slot(dev);
}
+ kfree(dev);
/*
* After performing arch-dependent fixup of the bus, look behind
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] PCI fixes for 2.5.62
2003-02-21 0:44 ` [PATCH] " Greg KH
@ 2003-02-21 0:44 ` Greg KH
2003-02-21 0:45 ` Greg KH
0 siblings, 1 reply; 5+ messages in thread
From: Greg KH @ 2003-02-21 0:44 UTC (permalink / raw)
To: linux-kernel
ChangeSet 1.1004, 2003/02/20 14:23:43-08:00, greg@kroah.com
[PATCH] PCI i386: remove large stack usage in pci_sanity_check()
diff -Nru a/arch/i386/pci/direct.c b/arch/i386/pci/direct.c
--- a/arch/i386/pci/direct.c Thu Feb 20 16:46:31 2003
+++ b/arch/i386/pci/direct.c Thu Feb 20 16:46:31 2003
@@ -196,21 +196,35 @@
static int __devinit pci_sanity_check(struct pci_ops *o)
{
u32 x = 0;
- struct pci_bus bus; /* Fake bus and device */
- struct pci_dev dev;
+ int retval = 0;
+ struct pci_bus *bus; /* Fake bus and device */
+ struct pci_dev *dev;
if (pci_probe & PCI_NO_CHECKS)
return 1;
- bus.number = 0;
- dev.bus = &bus;
- for(dev.devfn=0; dev.devfn < 0x100; dev.devfn++)
- if ((!o->read(&bus, dev.devfn, PCI_CLASS_DEVICE, 2, &x) &&
+
+ bus = kmalloc(sizeof(*bus), GFP_ATOMIC);
+ dev = kmalloc(sizeof(*dev), GFP_ATOMIC);
+ if (!bus || !dev) {
+ printk(KERN_ERR "Out of memory in %s\n", __FUNCTION__);
+ goto exit;
+ }
+
+ bus->number = 0;
+ dev->bus = bus;
+ for(dev->devfn=0; dev->devfn < 0x100; dev->devfn++)
+ if ((!o->read(bus, dev->devfn, PCI_CLASS_DEVICE, 2, &x) &&
(x == PCI_CLASS_BRIDGE_HOST || x == PCI_CLASS_DISPLAY_VGA)) ||
- (!o->read(&bus, dev.devfn, PCI_VENDOR_ID, 2, &x) &&
- (x == PCI_VENDOR_ID_INTEL || x == PCI_VENDOR_ID_COMPAQ)))
- return 1;
+ (!o->read(bus, dev->devfn, PCI_VENDOR_ID, 2, &x) &&
+ (x == PCI_VENDOR_ID_INTEL || x == PCI_VENDOR_ID_COMPAQ))) {
+ retval = 1;
+ goto exit;
+ }
DBG("PCI: Sanity check failed\n");
- return 0;
+exit:
+ kfree(dev);
+ kfree(bus);
+ return retval;
}
static int __init pci_direct_init(void)
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] PCI fixes for 2.5.62
2003-02-21 0:44 ` Greg KH
@ 2003-02-21 0:45 ` Greg KH
2003-02-21 0:45 ` Greg KH
0 siblings, 1 reply; 5+ messages in thread
From: Greg KH @ 2003-02-21 0:45 UTC (permalink / raw)
To: linux-kernel
ChangeSet 1.1005, 2003/02/20 14:23:58-08:00, greg@kroah.com
[PATCH] PCI i386: remove large stack usage in pcibios_fixup_peer_bridges()
diff -Nru a/arch/i386/pci/legacy.c b/arch/i386/pci/legacy.c
--- a/arch/i386/pci/legacy.c Thu Feb 20 16:46:27 2003
+++ b/arch/i386/pci/legacy.c Thu Feb 20 16:46:27 2003
@@ -12,28 +12,39 @@
static void __devinit pcibios_fixup_peer_bridges(void)
{
int n;
- struct pci_bus bus;
- struct pci_dev dev;
+ struct pci_bus *bus;
+ struct pci_dev *dev;
u16 l;
if (pcibios_last_bus <= 0 || pcibios_last_bus >= 0xff)
return;
DBG("PCI: Peer bridge fixup\n");
+
+ bus = kmalloc(sizeof(*bus), GFP_ATOMIC);
+ dev = kmalloc(sizeof(*dev), GFP_ATOMIC);
+ if (!bus || !dev) {
+ printk(KERN_ERR "Out of memory in %s\n", __FUNCTION__);
+ goto exit;
+ }
+
for (n=0; n <= pcibios_last_bus; n++) {
if (pci_bus_exists(&pci_root_buses, n))
continue;
- bus.number = n;
- bus.ops = pci_root_ops;
- dev.bus = &bus;
- for(dev.devfn=0; dev.devfn<256; dev.devfn += 8)
- if (!pci_read_config_word(&dev, PCI_VENDOR_ID, &l) &&
+ bus->number = n;
+ bus->ops = pci_root_ops;
+ dev->bus = bus;
+ for (dev->devfn=0; dev->devfn<256; dev->devfn += 8)
+ if (!pci_read_config_word(dev, PCI_VENDOR_ID, &l) &&
l != 0x0000 && l != 0xffff) {
- DBG("Found device at %02x:%02x [%04x]\n", n, dev.devfn, l);
+ DBG("Found device at %02x:%02x [%04x]\n", n, dev->devfn, l);
printk(KERN_INFO "PCI: Discovered peer bus %02x\n", n);
pci_scan_bus(n, pci_root_ops, NULL);
break;
}
}
+exit:
+ kfree(dev);
+ kfree(bus);
}
static int __init pci_legacy_init(void)
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] PCI fixes for 2.5.62
2003-02-21 0:45 ` Greg KH
@ 2003-02-21 0:45 ` Greg KH
0 siblings, 0 replies; 5+ messages in thread
From: Greg KH @ 2003-02-21 0:45 UTC (permalink / raw)
To: linux-kernel
ChangeSet 1.1006, 2003/02/20 16:32:48-08:00, louis.zhuang@linux.co.intel.com
[PATCH] PCI: list code cleanup
Cleans up the list handling in a few places within the pci core.
diff -Nru a/drivers/pci/probe.c b/drivers/pci/probe.c
--- a/drivers/pci/probe.c Thu Feb 20 16:46:23 2003
+++ b/drivers/pci/probe.c Thu Feb 20 16:46:23 2003
@@ -556,10 +556,9 @@
int __devinit pci_bus_exists(const struct list_head *list, int nr)
{
- const struct list_head *l;
+ const struct pci_bus *b;
- for(l=list->next; l != list; l = l->next) {
- const struct pci_bus *b = pci_bus_b(l);
+ list_for_each_entry(b, list, node) {
if (b->number == nr || pci_bus_exists(&b->children, nr))
return 1;
}
diff -Nru a/drivers/pci/setup-bus.c b/drivers/pci/setup-bus.c
--- a/drivers/pci/setup-bus.c Thu Feb 20 16:46:23 2003
+++ b/drivers/pci/setup-bus.c Thu Feb 20 16:46:23 2003
@@ -39,14 +39,13 @@
static int __devinit
pbus_assign_resources_sorted(struct pci_bus *bus)
{
- struct list_head *ln;
+ struct pci_dev *dev;
struct resource *res;
struct resource_list head, *list, *tmp;
int idx, found_vga = 0;
head.next = NULL;
- for (ln=bus->devices.next; ln != &bus->devices; ln=ln->next) {
- struct pci_dev *dev = pci_dev_b(ln);
+ list_for_each_entry(dev, &bus->devices, bus_list) {
u16 class = dev->class >> 8;
if (class == PCI_CLASS_DISPLAY_VGA
@@ -201,15 +200,14 @@
static void __devinit
pbus_size_io(struct pci_bus *bus)
{
- struct list_head *ln;
+ struct pci_dev *dev;
struct resource *b_res = bus->resource[0];
unsigned long size = 0, size1 = 0;
if (!(b_res->flags & IORESOURCE_IO))
return;
- for (ln=bus->devices.next; ln != &bus->devices; ln=ln->next) {
- struct pci_dev *dev = pci_dev_b(ln);
+ list_for_each_entry(dev, &bus->devices, bus_list) {
int i;
for (i = 0; i < PCI_NUM_RESOURCES; i++) {
@@ -250,7 +248,7 @@
static void __devinit
pbus_size_mem(struct pci_bus *bus, unsigned long mask, unsigned long type)
{
- struct list_head *ln;
+ struct pci_dev *dev;
unsigned long min_align, align, size;
unsigned long aligns[12]; /* Alignments from 1Mb to 2Gb */
int order, max_order;
@@ -261,8 +259,7 @@
max_order = 0;
size = 0;
- for (ln=bus->devices.next; ln != &bus->devices; ln=ln->next) {
- struct pci_dev *dev = pci_dev_b(ln);
+ list_for_each_entry(dev, &bus->devices, bus_list) {
int i;
for (i = 0; i < PCI_NUM_RESOURCES; i++) {
@@ -322,11 +319,12 @@
void __devinit
pci_bus_size_bridges(struct pci_bus *bus)
{
- struct list_head *ln;
+ struct pci_bus *b;
unsigned long mask, type;
- for (ln=bus->children.next; ln != &bus->children; ln=ln->next)
- pci_bus_size_bridges(pci_bus_b(ln));
+ list_for_each_entry(b, &bus->children, node) {
+ pci_bus_size_bridges(b);
+ }
/* The root bus? */
if (!bus->self)
@@ -350,20 +348,16 @@
void __devinit
pci_bus_assign_resources(struct pci_bus *bus)
{
- struct list_head *ln;
+ struct pci_bus *b;
int found_vga = pbus_assign_resources_sorted(bus);
if (found_vga) {
- struct pci_bus *b;
-
/* Propagate presence of the VGA to upstream bridges */
for (b = bus; b->parent; b = b->parent) {
b->resource[0]->flags |= IORESOURCE_BUS_HAS_VGA;
}
}
- for (ln=bus->children.next; ln != &bus->children; ln=ln->next) {
- struct pci_bus *b = pci_bus_b(ln);
-
+ list_for_each_entry(b, &bus->children, node) {
pci_bus_assign_resources(b);
pci_setup_bridge(b);
}
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2003-02-21 0:43 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-02-21 0:43 [BK PATCH] PCI fixes for 2.5.62 Greg KH
2003-02-21 0:44 ` [PATCH] " Greg KH
2003-02-21 0:44 ` Greg KH
2003-02-21 0:45 ` Greg KH
2003-02-21 0:45 ` Greg KH
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox