diff options
author | Geert Uytterhoeven <geert@linux-m68k.org> | 2013-06-29 04:40:20 -0400 |
---|---|---|
committer | Geert Uytterhoeven <geert@linux-m68k.org> | 2013-11-26 05:09:03 -0500 |
commit | c293738e6d8dfb9c941759855b5161fde449644d (patch) | |
tree | 3c2d4b2041af3e2fe5a8a4702cdfe49fca3e1f7f /arch | |
parent | 1ea636eb68322198e08aebdede141244d98e8299 (diff) |
zorro: Do not allocate zorro_autocon[] statically
Currently the array of Zorro devices is allocated statically, wasting
up to 4.5 KiB when running an Amiga or multi-platform kernel on a machine
with no or a handful of Zorro expansion cards. Convert it to conditional
dynamic memory allocation to fix this.
amiga_parse_bootinfo() still needs to store some information about the
detected Zorro devices, at a time even the bootmem allocator is not yet
available. This is now handled using a much smaller array (typically less
than 0.5 KiB), which is __initdata and thus freed later.
Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/m68k/amiga/config.c | 6 | ||||
-rw-r--r-- | arch/m68k/amiga/platform.c | 4 |
2 files changed, 5 insertions, 5 deletions
diff --git a/arch/m68k/amiga/config.c b/arch/m68k/amiga/config.c index 93ab423758da..d956ddbfebe1 100644 --- a/arch/m68k/amiga/config.c +++ b/arch/m68k/amiga/config.c | |||
@@ -174,12 +174,12 @@ int __init amiga_parse_bootinfo(const struct bi_record *record) | |||
174 | #ifdef CONFIG_ZORRO | 174 | #ifdef CONFIG_ZORRO |
175 | if (zorro_num_autocon < ZORRO_NUM_AUTO) { | 175 | if (zorro_num_autocon < ZORRO_NUM_AUTO) { |
176 | const struct ConfigDev *cd = (struct ConfigDev *)data; | 176 | const struct ConfigDev *cd = (struct ConfigDev *)data; |
177 | struct zorro_dev *dev = &zorro_autocon[zorro_num_autocon++]; | 177 | struct zorro_dev_init *dev = &zorro_autocon_init[zorro_num_autocon++]; |
178 | dev->rom = cd->cd_Rom; | 178 | dev->rom = cd->cd_Rom; |
179 | dev->slotaddr = cd->cd_SlotAddr; | 179 | dev->slotaddr = cd->cd_SlotAddr; |
180 | dev->slotsize = cd->cd_SlotSize; | 180 | dev->slotsize = cd->cd_SlotSize; |
181 | dev->resource.start = (unsigned long)cd->cd_BoardAddr; | 181 | dev->boardaddr = (u32)cd->cd_BoardAddr; |
182 | dev->resource.end = dev->resource.start + cd->cd_BoardSize - 1; | 182 | dev->boardsize = cd->cd_BoardSize; |
183 | } else | 183 | } else |
184 | printk("amiga_parse_bootinfo: too many AutoConfig devices\n"); | 184 | printk("amiga_parse_bootinfo: too many AutoConfig devices\n"); |
185 | #endif /* CONFIG_ZORRO */ | 185 | #endif /* CONFIG_ZORRO */ |
diff --git a/arch/m68k/amiga/platform.c b/arch/m68k/amiga/platform.c index dacd9f911f71..7847b2b1b5b6 100644 --- a/arch/m68k/amiga/platform.c +++ b/arch/m68k/amiga/platform.c | |||
@@ -67,8 +67,8 @@ static int __init z_dev_present(zorro_id id) | |||
67 | unsigned int i; | 67 | unsigned int i; |
68 | 68 | ||
69 | for (i = 0; i < zorro_num_autocon; i++) | 69 | for (i = 0; i < zorro_num_autocon; i++) |
70 | if (zorro_autocon[i].rom.er_Manufacturer == ZORRO_MANUF(id) && | 70 | if (zorro_autocon_init[i].rom.er_Manufacturer == ZORRO_MANUF(id) && |
71 | zorro_autocon[i].rom.er_Product == ZORRO_PROD(id)) | 71 | zorro_autocon_init[i].rom.er_Product == ZORRO_PROD(id)) |
72 | return 1; | 72 | return 1; |
73 | 73 | ||
74 | return 0; | 74 | return 0; |