aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2008-07-23 13:55:58 -0400
committerBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2008-07-23 13:55:58 -0400
commit18de10170df31d34b342612f1c896a16a52f0a5c (patch)
tree70b101260d2517ea9ec67ddbca0f7224054eef4c
parentaf1cbba37343c827e116638b097b94f5e6c38963 (diff)
ide: allocate ide_hwif_t instances dynamically
* Allocate ide_hwif_t instances dynamically and remove ide_hwifs[]. This cuts almost ~14kB from ide-probe.o (x86-32, MAX_HWIFS == 10): text data bss dec hex filename 9140 40 14084 23264 5ae0 drivers/ide/ide-probe.o.before 9169 40 44 9253 2425 drivers/ide/ide-probe.o.after * Remove no longer needed ide_init_port_data() call from ide_unregister(). Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
-rw-r--r--drivers/ide/ide-probe.c10
-rw-r--r--drivers/ide/ide.c5
2 files changed, 6 insertions, 9 deletions
diff --git a/drivers/ide/ide-probe.c b/drivers/ide/ide-probe.c
index 482f41f3f15e..6d57b7cd5424 100644
--- a/drivers/ide/ide-probe.c
+++ b/drivers/ide/ide-probe.c
@@ -39,8 +39,6 @@
39#include <asm/uaccess.h> 39#include <asm/uaccess.h>
40#include <asm/io.h> 40#include <asm/io.h>
41 41
42static ide_hwif_t ide_hwifs[MAX_HWIFS]; /* master data repository */
43
44/** 42/**
45 * generic_id - add a generic drive id 43 * generic_id - add a generic drive id
46 * @drive: drive to make an ID block for 44 * @drive: drive to make an ID block for
@@ -1583,15 +1581,18 @@ struct ide_host *ide_host_alloc_all(const struct ide_port_info *d,
1583 if (hws[i] == NULL) 1581 if (hws[i] == NULL)
1584 continue; 1582 continue;
1585 1583
1584 hwif = kzalloc(sizeof(*hwif), GFP_KERNEL);
1585 if (hwif == NULL)
1586 continue;
1587
1586 idx = ide_find_port_slot(d); 1588 idx = ide_find_port_slot(d);
1587 if (idx < 0) { 1589 if (idx < 0) {
1588 printk(KERN_ERR "%s: no free slot for interface\n", 1590 printk(KERN_ERR "%s: no free slot for interface\n",
1589 d ? d->name : "ide"); 1591 d ? d->name : "ide");
1592 kfree(hwif);
1590 continue; 1593 continue;
1591 } 1594 }
1592 1595
1593 hwif = &ide_hwifs[idx];
1594
1595 ide_init_port_data(hwif, idx); 1596 ide_init_port_data(hwif, idx);
1596 1597
1597 host->ports[i] = hwif; 1598 host->ports[i] = hwif;
@@ -1755,6 +1756,7 @@ void ide_host_remove(struct ide_host *host)
1755 1756
1756 ide_unregister(hwif); 1757 ide_unregister(hwif);
1757 ide_free_port_slot(hwif->index); 1758 ide_free_port_slot(hwif->index);
1759 kfree(hwif);
1758 } 1760 }
1759 1761
1760 kfree(host); 1762 kfree(host);
diff --git a/drivers/ide/ide.c b/drivers/ide/ide.c
index 60c5db1c59e5..914942a766db 100644
--- a/drivers/ide/ide.c
+++ b/drivers/ide/ide.c
@@ -233,11 +233,6 @@ void ide_unregister(ide_hwif_t *hwif)
233 if (hwif->dma_base) 233 if (hwif->dma_base)
234 ide_release_dma_engine(hwif); 234 ide_release_dma_engine(hwif);
235 235
236 spin_lock_irq(&ide_lock);
237 /* restore hwif data to pristine status */
238 ide_init_port_data(hwif, hwif->index);
239 spin_unlock_irq(&ide_lock);
240
241 mutex_unlock(&ide_cfg_mtx); 236 mutex_unlock(&ide_cfg_mtx);
242} 237}
243 238