mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-06-07 23:28:55 +00:00
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>
This commit is contained in:
parent
af1cbba373
commit
18de10170d
2 changed files with 6 additions and 9 deletions
|
@ -39,8 +39,6 @@
|
||||||
#include <asm/uaccess.h>
|
#include <asm/uaccess.h>
|
||||||
#include <asm/io.h>
|
#include <asm/io.h>
|
||||||
|
|
||||||
static ide_hwif_t ide_hwifs[MAX_HWIFS]; /* master data repository */
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* generic_id - add a generic drive id
|
* generic_id - add a generic drive id
|
||||||
* @drive: drive to make an ID block for
|
* @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,
|
||||||
if (hws[i] == NULL)
|
if (hws[i] == NULL)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
hwif = kzalloc(sizeof(*hwif), GFP_KERNEL);
|
||||||
|
if (hwif == NULL)
|
||||||
|
continue;
|
||||||
|
|
||||||
idx = ide_find_port_slot(d);
|
idx = ide_find_port_slot(d);
|
||||||
if (idx < 0) {
|
if (idx < 0) {
|
||||||
printk(KERN_ERR "%s: no free slot for interface\n",
|
printk(KERN_ERR "%s: no free slot for interface\n",
|
||||||
d ? d->name : "ide");
|
d ? d->name : "ide");
|
||||||
|
kfree(hwif);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
hwif = &ide_hwifs[idx];
|
|
||||||
|
|
||||||
ide_init_port_data(hwif, idx);
|
ide_init_port_data(hwif, idx);
|
||||||
|
|
||||||
host->ports[i] = hwif;
|
host->ports[i] = hwif;
|
||||||
|
@ -1755,6 +1756,7 @@ void ide_host_remove(struct ide_host *host)
|
||||||
|
|
||||||
ide_unregister(hwif);
|
ide_unregister(hwif);
|
||||||
ide_free_port_slot(hwif->index);
|
ide_free_port_slot(hwif->index);
|
||||||
|
kfree(hwif);
|
||||||
}
|
}
|
||||||
|
|
||||||
kfree(host);
|
kfree(host);
|
||||||
|
|
|
@ -233,11 +233,6 @@ void ide_unregister(ide_hwif_t *hwif)
|
||||||
if (hwif->dma_base)
|
if (hwif->dma_base)
|
||||||
ide_release_dma_engine(hwif);
|
ide_release_dma_engine(hwif);
|
||||||
|
|
||||||
spin_lock_irq(&ide_lock);
|
|
||||||
/* restore hwif data to pristine status */
|
|
||||||
ide_init_port_data(hwif, hwif->index);
|
|
||||||
spin_unlock_irq(&ide_lock);
|
|
||||||
|
|
||||||
mutex_unlock(&ide_cfg_mtx);
|
mutex_unlock(&ide_cfg_mtx);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue