From: Greg KH <greg@kroah.com>
To: linux-kernel@vger.kernel.org
Subject: Re: [PATCH] PCI patches for 2.6.10
Date: Mon, 10 Jan 2005 09:20:59 -0800 [thread overview]
Message-ID: <11053776592895@kroah.com> (raw)
In-Reply-To: <110537765824@kroah.com>
ChangeSet 1.1938.447.16, 2004/12/21 16:48:08-08:00, rddunlap@osdl.org
[PATCH] cpqphp: reduce stack usage
Reduce local stack usage in cpqhp_set_irq()
from 1028 bytes to 12 bytes (on x86-32).
This was the 16th largest offender according to my
recent 'make checkstack' run (and 2 other patches
for large ones have recently been submitted).
Signed-off-by: Randy Dunlap <rddunlap@osdl.org>
Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
drivers/pci/hotplug/cpqphp_pci.c | 30 +++++++++++++++++++++---------
1 files changed, 21 insertions(+), 9 deletions(-)
diff -Nru a/drivers/pci/hotplug/cpqphp_pci.c b/drivers/pci/hotplug/cpqphp_pci.c
--- a/drivers/pci/hotplug/cpqphp_pci.c 2005-01-10 09:00:02 -08:00
+++ b/drivers/pci/hotplug/cpqphp_pci.c 2005-01-10 09:00:02 -08:00
@@ -151,18 +151,29 @@
*/
int cpqhp_set_irq (u8 bus_num, u8 dev_num, u8 int_pin, u8 irq_num)
{
- int rc;
- u16 temp_word;
- struct pci_dev fakedev;
- struct pci_bus fakebus;
+ int rc = 0;
if (cpqhp_legacy_mode) {
- fakedev.devfn = dev_num << 3;
- fakedev.bus = &fakebus;
- fakebus.number = bus_num;
+ struct pci_dev *fakedev;
+ struct pci_bus *fakebus;
+ u16 temp_word;
+
+ fakedev = kmalloc(sizeof(*fakedev), GFP_KERNEL);
+ fakebus = kmalloc(sizeof(*fakebus), GFP_KERNEL);
+ if (!fakedev || !fakebus) {
+ kfree(fakedev);
+ kfree(fakebus);
+ return -ENOMEM;
+ }
+
+ fakedev->devfn = dev_num << 3;
+ fakedev->bus = fakebus;
+ fakebus->number = bus_num;
dbg("%s: dev %d, bus %d, pin %d, num %d\n",
__FUNCTION__, dev_num, bus_num, int_pin, irq_num);
- rc = pcibios_set_irq_routing(&fakedev, int_pin - 0x0a, irq_num);
+ rc = pcibios_set_irq_routing(fakedev, int_pin - 0x0a, irq_num);
+ kfree(fakedev);
+ kfree(fakebus);
dbg("%s: rc %d\n", __FUNCTION__, rc);
if (!rc)
return !rc;
@@ -176,9 +187,10 @@
// This should only be for x86 as it sets the Edge Level Control Register
outb((u8) (temp_word & 0xFF), 0x4d0);
outb((u8) ((temp_word & 0xFF00) >> 8), 0x4d1);
+ rc = 0;
}
- return 0;
+ return rc;
}
next prev parent reply other threads:[~2005-01-10 17:38 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-01-10 17:18 [BK PATCH] PCI patches for 2.6.10-rc2 Greg KH
2005-01-10 17:19 ` Greg KH
2005-01-10 17:20 ` [PATCH] PCI patches for 2.6.10 Greg KH
2005-01-10 17:20 ` Greg KH
2005-01-10 17:20 ` Greg KH
2005-01-10 17:20 ` Greg KH
2005-01-10 17:20 ` Greg KH
2005-01-10 17:20 ` Greg KH
2005-01-10 17:20 ` Greg KH
2005-01-10 17:20 ` Greg KH
2005-01-10 17:20 ` Greg KH
2005-01-10 17:20 ` Greg KH
2005-01-10 17:20 ` Greg KH
2005-01-10 17:20 ` Greg KH
2005-01-10 17:20 ` Greg KH
2005-01-10 17:20 ` Greg KH
2005-01-10 17:20 ` Greg KH
2005-01-10 17:20 ` Greg KH
2005-01-10 17:20 ` Greg KH
2005-01-10 17:20 ` Greg KH
2005-01-10 17:20 ` Greg KH
2005-01-10 17:20 ` Greg KH
2005-01-10 17:20 ` Greg KH [this message]
2005-01-10 17:20 ` Greg KH
2005-01-10 17:20 ` Greg KH
2005-01-10 17:20 ` Greg KH
2005-01-11 22:39 ` Matt Mackall
2005-01-11 22:44 ` Greg KH
2005-01-12 13:09 ` Domen Puncer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=11053776592895@kroah.com \
--to=greg@kroah.com \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).