The patch titled
reduce the stack footprint of pcmcia_device_query()
has been added to the -mm tree. Its filename is
reduce-the-stack-footprint-of-pcmcia_device_query.patch
Patches currently in -mm which might be from [EMAIL PROTECTED] are
detect-soft-lockups.patch
reduce-the-stack-footprint-of-pcmcia_device_query.patch
ingo-nfs-stuff.patch
spinlock-consolidation.patch
spinlock-consolidation-m32r-fix.patch
spinlock-consolidation-up-spinlocks-gcc-29x-fix.patch
kgdb-ga.patch
detect-atomic-counter-underflows.patch
sched-run-sched_normal-tasks-with-real-time-tasks-on-smt-siblings.patch
max_user_rt_prio-and-max_rt_prio-are-wrong.patch
sched-cleanups.patch
sched-task_noninteractive.patch
sched-add-cacheflush-asm.patch
scheduler-cache-hot-autodetect.patch
sched-implement-nice-support-across-physical-cpus-on-smp.patch
sched-change_prio_bias_only_if_queued.patch
sched-account_rt_tasks_in_prio_bias.patch
sched-fix-smt-scheduler-latency-bug.patch
sched-consider-migration-thread-with-smp-nice.patch
timer-initialization-cleanup-define_timer.patch
timer-initialization-cleanup-define_timer-pluto-fix.patch
more-spin_lock_unlocked-define_spinlock-conversions.patch
unexport-idle_cpu.patch
From: Ingo Molnar <[EMAIL PROTECTED]>
This patch reduces the stack footprint of pcmcia_device_query() from 416
bytes to 36 bytes.
Signed-off-by: Ingo Molnar <[EMAIL PROTECTED]>
Signed-off-by: Andrew Morton <[EMAIL PROTECTED]>
---
drivers/pcmcia/ds.c | 28 +++++++++++++++++++++-------
1 files changed, 21 insertions(+), 7 deletions(-)
diff -puN drivers/pcmcia/ds.c~reduce-the-stack-footprint-of-pcmcia_device_query
drivers/pcmcia/ds.c
--- devel/drivers/pcmcia/ds.c~reduce-the-stack-footprint-of-pcmcia_device_query
2005-07-09 12:05:19.000000000 -0700
+++ devel-akpm/drivers/pcmcia/ds.c 2005-07-09 12:05:19.000000000 -0700
@@ -424,9 +424,13 @@ static int pcmcia_device_query(struct pc
{
cistpl_manfid_t manf_id;
cistpl_funcid_t func_id;
- cistpl_vers_1_t vers1;
+ cistpl_vers_1_t *vers1;
unsigned int i;
+ vers1 = kmalloc(sizeof(*vers1), GFP_KERNEL);
+ if (!vers1)
+ return -ENOMEM;
+
if (!pccard_read_tuple(p_dev->socket, p_dev->func,
CISTPL_MANFID, &manf_id)) {
p_dev->manf_id = manf_id.manf;
@@ -443,23 +447,30 @@ static int pcmcia_device_query(struct pc
/* rule of thumb: cards with no FUNCID, but with
* common memory device geometry information, are
* probably memory cards (from pcmcia-cs) */
- cistpl_device_geo_t devgeo;
+ cistpl_device_geo_t *devgeo;
+
+ devgeo = kmalloc(sizeof(*devgeo), GFP_KERNEL);
+ if (!devgeo) {
+ kfree(vers1);
+ return -ENOMEM;
+ }
if (!pccard_read_tuple(p_dev->socket, p_dev->func,
- CISTPL_DEVICE_GEO, &devgeo)) {
+ CISTPL_DEVICE_GEO, devgeo)) {
ds_dbg(0, "mem device geometry probably means "
"FUNCID_MEMORY\n");
p_dev->func_id = CISTPL_FUNCID_MEMORY;
p_dev->has_func_id = 1;
}
+ kfree(devgeo);
}
if (!pccard_read_tuple(p_dev->socket, p_dev->func, CISTPL_VERS_1,
- &vers1)) {
- for (i=0; i < vers1.ns; i++) {
+ vers1)) {
+ for (i=0; i < vers1->ns; i++) {
char *tmp;
unsigned int length;
- tmp = vers1.str + vers1.ofs[i];
+ tmp = vers1->str + vers1->ofs[i];
length = strlen(tmp) + 1;
if ((length < 3) || (length > 255))
@@ -475,6 +486,7 @@ static int pcmcia_device_query(struct pc
}
}
+ kfree(vers1);
return 0;
}
@@ -525,7 +537,9 @@ struct pcmcia_device * pcmcia_device_add
list_add_tail(&p_dev->socket_device_list, &s->devices_list);
spin_unlock_irqrestore(&pcmcia_dev_list_lock, flags);
- pcmcia_device_query(p_dev);
+ ret = pcmcia_device_query(p_dev);
+ if (ret)
+ goto err_put_module;
if (device_register(&p_dev->dev)) {
spin_lock_irqsave(&pcmcia_dev_list_lock, flags);
_
-
To unsubscribe from this list: send the line "unsubscribe mm-commits" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at http://vger.kernel.org/majordomo-info.html