* [PATCH 1/2] parisc: processor.c, fix bloated stack frame
@ 2009-06-23 17:18 Kyle McMartin
2009-06-23 17:18 ` [PATCH 2/2] parisc: inventory.c, " Kyle McMartin
2009-06-25 6:16 ` [PATCH 1/2] parisc: processor.c, " Grant Grundler
0 siblings, 2 replies; 3+ messages in thread
From: Kyle McMartin @ 2009-06-23 17:18 UTC (permalink / raw)
To: linux-parisc
From: Kyle McMartin <kyle@shortfin.cabal.ca>
The pa_pdc_cell struct can be kmalloc'd, so do that instead.
Signed-off-by: Kyle McMartin <kyle@mcmartin.ca>
---
arch/parisc/kernel/processor.c | 16 +++++++++++-----
1 files changed, 11 insertions(+), 5 deletions(-)
diff --git a/arch/parisc/kernel/processor.c b/arch/parisc/kernel/processor.c
index 1ca69a8..c8fb61e 100644
--- a/arch/parisc/kernel/processor.c
+++ b/arch/parisc/kernel/processor.c
@@ -120,22 +120,28 @@ static int __cpuinit processor_probe(struct parisc_device *dev)
if (is_pdc_pat()) {
ulong status;
unsigned long bytecnt;
- pdc_pat_cell_mod_maddr_block_t pa_pdc_cell;
+ pdc_pat_cell_mod_maddr_block_t *pa_pdc_cell;
#undef USE_PAT_CPUID
#ifdef USE_PAT_CPUID
struct pdc_pat_cpu_num cpu_info;
#endif
+ pa_pdc_cell = kmalloc(sizeof (*pa_pdc_cell), GFP_KERNEL);
+ if (!pa_pdc_cell)
+ panic("couldn't allocate memory for PDC_PAT_CELL!");
+
status = pdc_pat_cell_module(&bytecnt, dev->pcell_loc,
- dev->mod_index, PA_VIEW, &pa_pdc_cell);
+ dev->mod_index, PA_VIEW, pa_pdc_cell);
BUG_ON(PDC_OK != status);
/* verify it's the same as what do_pat_inventory() found */
- BUG_ON(dev->mod_info != pa_pdc_cell.mod_info);
- BUG_ON(dev->pmod_loc != pa_pdc_cell.mod_location);
+ BUG_ON(dev->mod_info != pa_pdc_cell->mod_info);
+ BUG_ON(dev->pmod_loc != pa_pdc_cell->mod_location);
+
+ txn_addr = pa_pdc_cell->mod[0]; /* id_eid for IO sapic */
- txn_addr = pa_pdc_cell.mod[0]; /* id_eid for IO sapic */
+ kfree(pa_pdc_cell);
#ifdef USE_PAT_CPUID
/* We need contiguous numbers for cpuid. Firmware's notion
--
1.6.3.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH 2/2] parisc: inventory.c, fix bloated stack frame
2009-06-23 17:18 [PATCH 1/2] parisc: processor.c, fix bloated stack frame Kyle McMartin
@ 2009-06-23 17:18 ` Kyle McMartin
2009-06-25 6:16 ` [PATCH 1/2] parisc: processor.c, " Grant Grundler
1 sibling, 0 replies; 3+ messages in thread
From: Kyle McMartin @ 2009-06-23 17:18 UTC (permalink / raw)
To: linux-parisc
From: Kyle McMartin <kyle@shortfin.cabal.ca>
The pa_pdc_cell struct can be kmalloc'd, so do that
instead.
Signed-off-by: Kyle McMartin <kyle@mcmartin.ca>
---
arch/parisc/kernel/inventory.c | 41 +++++++++++++++++++++++----------------
1 files changed, 24 insertions(+), 17 deletions(-)
diff --git a/arch/parisc/kernel/inventory.c b/arch/parisc/kernel/inventory.c
index bd1f7f1..bb3195b 100644
--- a/arch/parisc/kernel/inventory.c
+++ b/arch/parisc/kernel/inventory.c
@@ -170,23 +170,27 @@ static void __init pagezero_memconfig(void)
static int __init
pat_query_module(ulong pcell_loc, ulong mod_index)
{
- pdc_pat_cell_mod_maddr_block_t pa_pdc_cell;
+ pdc_pat_cell_mod_maddr_block_t *pa_pdc_cell;
unsigned long bytecnt;
unsigned long temp; /* 64-bit scratch value */
long status; /* PDC return value status */
struct parisc_device *dev;
+ pa_pdc_cell = kmalloc(sizeof (*pa_pdc_cell), GFP_KERNEL);
+ if (!pa_pdc_cell)
+ panic("couldn't allocate memory for PDC_PAT_CELL!");
+
/* return cell module (PA or Processor view) */
status = pdc_pat_cell_module(&bytecnt, pcell_loc, mod_index,
- PA_VIEW, &pa_pdc_cell);
+ PA_VIEW, pa_pdc_cell);
if (status != PDC_OK) {
/* no more cell modules or error */
return status;
}
- temp = pa_pdc_cell.cba;
- dev = alloc_pa_dev(PAT_GET_CBA(temp), &pa_pdc_cell.mod_path);
+ temp = pa_pdc_cell->cba;
+ dev = alloc_pa_dev(PAT_GET_CBA(temp), &(pa_pdc_cell->mod_path));
if (!dev) {
return PDC_OK;
}
@@ -203,8 +207,8 @@ pat_query_module(ulong pcell_loc, ulong mod_index)
/* save generic info returned from the call */
/* REVISIT: who is the consumer of this? not sure yet... */
- dev->mod_info = pa_pdc_cell.mod_info; /* pass to PAT_GET_ENTITY() */
- dev->pmod_loc = pa_pdc_cell.mod_location;
+ dev->mod_info = pa_pdc_cell->mod_info; /* pass to PAT_GET_ENTITY() */
+ dev->pmod_loc = pa_pdc_cell->mod_location;
register_parisc_device(dev); /* advertise device */
@@ -216,14 +220,14 @@ pat_query_module(ulong pcell_loc, ulong mod_index)
case PAT_ENTITY_PROC:
printk(KERN_DEBUG "PAT_ENTITY_PROC: id_eid 0x%lx\n",
- pa_pdc_cell.mod[0]);
+ pa_pdc_cell->mod[0]);
break;
case PAT_ENTITY_MEM:
printk(KERN_DEBUG
"PAT_ENTITY_MEM: amount 0x%lx min_gni_base 0x%lx min_gni_len 0x%lx\n",
- pa_pdc_cell.mod[0], pa_pdc_cell.mod[1],
- pa_pdc_cell.mod[2]);
+ pa_pdc_cell->mod[0], pa_pdc_cell->mod[1],
+ pa_pdc_cell->mod[2]);
break;
case PAT_ENTITY_CA:
printk(KERN_DEBUG "PAT_ENTITY_CA: %ld\n", pcell_loc);
@@ -243,23 +247,26 @@ pat_query_module(ulong pcell_loc, ulong mod_index)
print_ranges:
pdc_pat_cell_module(&bytecnt, pcell_loc, mod_index,
IO_VIEW, &io_pdc_cell);
- printk(KERN_DEBUG "ranges %ld\n", pa_pdc_cell.mod[1]);
- for (i = 0; i < pa_pdc_cell.mod[1]; i++) {
+ printk(KERN_DEBUG "ranges %ld\n", pa_pdc_cell->mod[1]);
+ for (i = 0; i < pa_pdc_cell->mod[1]; i++) {
printk(KERN_DEBUG
" PA_VIEW %ld: 0x%016lx 0x%016lx 0x%016lx\n",
- i, pa_pdc_cell.mod[2 + i * 3], /* type */
- pa_pdc_cell.mod[3 + i * 3], /* start */
- pa_pdc_cell.mod[4 + i * 3]); /* finish (ie end) */
+ i, pa_pdc_cell->mod[2 + i * 3], /* type */
+ pa_pdc_cell->mod[3 + i * 3], /* start */
+ pa_pdc_cell->mod[4 + i * 3]); /* finish (ie end) */
printk(KERN_DEBUG
" IO_VIEW %ld: 0x%016lx 0x%016lx 0x%016lx\n",
- i, io_pdc_cell.mod[2 + i * 3], /* type */
- io_pdc_cell.mod[3 + i * 3], /* start */
- io_pdc_cell.mod[4 + i * 3]); /* finish (ie end) */
+ i, io_pdc_cell->mod[2 + i * 3], /* type */
+ io_pdc_cell->mod[3 + i * 3], /* start */
+ io_pdc_cell->mod[4 + i * 3]); /* finish (ie end) */
}
printk(KERN_DEBUG "\n");
break;
}
#endif /* DEBUG_PAT */
+
+ kfree(pa_pdc_cell);
+
return PDC_OK;
}
--
1.6.3.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH 1/2] parisc: processor.c, fix bloated stack frame
2009-06-23 17:18 [PATCH 1/2] parisc: processor.c, fix bloated stack frame Kyle McMartin
2009-06-23 17:18 ` [PATCH 2/2] parisc: inventory.c, " Kyle McMartin
@ 2009-06-25 6:16 ` Grant Grundler
1 sibling, 0 replies; 3+ messages in thread
From: Grant Grundler @ 2009-06-25 6:16 UTC (permalink / raw)
To: Kyle McMartin; +Cc: linux-parisc
On Tue, Jun 23, 2009 at 01:18:26PM -0400, Kyle McMartin wrote:
> From: Kyle McMartin <kyle@shortfin.cabal.ca>
>
> The pa_pdc_cell struct can be kmalloc'd, so do that instead.
>
> Signed-off-by: Kyle McMartin <kyle@mcmartin.ca>
> ---
> arch/parisc/kernel/processor.c | 16 +++++++++++-----
> 1 files changed, 11 insertions(+), 5 deletions(-)
>
> diff --git a/arch/parisc/kernel/processor.c b/arch/parisc/kernel/processor.c
> index 1ca69a8..c8fb61e 100644
> --- a/arch/parisc/kernel/processor.c
> +++ b/arch/parisc/kernel/processor.c
> @@ -120,22 +120,28 @@ static int __cpuinit processor_probe(struct parisc_device *dev)
> if (is_pdc_pat()) {
> ulong status;
> unsigned long bytecnt;
> - pdc_pat_cell_mod_maddr_block_t pa_pdc_cell;
> + pdc_pat_cell_mod_maddr_block_t *pa_pdc_cell;
> #undef USE_PAT_CPUID
> #ifdef USE_PAT_CPUID
> struct pdc_pat_cpu_num cpu_info;
> #endif
>
> + pa_pdc_cell = kmalloc(sizeof (*pa_pdc_cell), GFP_KERNEL);
> + if (!pa_pdc_cell)
> + panic("couldn't allocate memory for PDC_PAT_CELL!");
Even though we are never going to hit this panic, could this be coded
so processor_probe just fails for that PDC device?
ie printk and return 1 like some of the code right above it does.
I really dislike adding panic() calls if they are easy to avoid.
The rest looks fine to me.
thanks
grant
> +
> status = pdc_pat_cell_module(&bytecnt, dev->pcell_loc,
> - dev->mod_index, PA_VIEW, &pa_pdc_cell);
> + dev->mod_index, PA_VIEW, pa_pdc_cell);
>
> BUG_ON(PDC_OK != status);
>
> /* verify it's the same as what do_pat_inventory() found */
> - BUG_ON(dev->mod_info != pa_pdc_cell.mod_info);
> - BUG_ON(dev->pmod_loc != pa_pdc_cell.mod_location);
> + BUG_ON(dev->mod_info != pa_pdc_cell->mod_info);
> + BUG_ON(dev->pmod_loc != pa_pdc_cell->mod_location);
> +
> + txn_addr = pa_pdc_cell->mod[0]; /* id_eid for IO sapic */
>
> - txn_addr = pa_pdc_cell.mod[0]; /* id_eid for IO sapic */
> + kfree(pa_pdc_cell);
>
> #ifdef USE_PAT_CPUID
> /* We need contiguous numbers for cpuid. Firmware's notion
> --
> 1.6.3.1
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-parisc" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2009-06-25 6:16 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-06-23 17:18 [PATCH 1/2] parisc: processor.c, fix bloated stack frame Kyle McMartin
2009-06-23 17:18 ` [PATCH 2/2] parisc: inventory.c, " Kyle McMartin
2009-06-25 6:16 ` [PATCH 1/2] parisc: processor.c, " Grant Grundler
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.