Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 130718
b: refs/heads/master
c: 9a100f4
h: refs/heads/master
v: v3
  • Loading branch information
Bartlomiej Zolnierkiewicz committed Feb 2, 2009
1 parent 6327874 commit 94b57df
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 9 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: e5461f38b43d5658087a598c8deb2a9928d6b92b
refs/heads/master: 9a100f4b78c4c59fdd1cc38c5fa6a1ec66f23d9a
40 changes: 32 additions & 8 deletions trunk/drivers/ide/ide-probe.c
Original file line number Diff line number Diff line change
Expand Up @@ -1467,6 +1467,30 @@ struct ide_host *ide_host_alloc(const struct ide_port_info *d, hw_regs_t **hws)
}
EXPORT_SYMBOL_GPL(ide_host_alloc);

static void ide_port_free(ide_hwif_t *hwif)
{
ide_port_free_devices(hwif);
ide_free_port_slot(hwif->index);
kfree(hwif);
}

static void ide_disable_port(ide_hwif_t *hwif)
{
struct ide_host *host = hwif->host;
int i;

printk(KERN_INFO "%s: disabling port\n", hwif->name);

for (i = 0; i < MAX_HOST_PORTS; i++) {
if (host->ports[i] == hwif) {
host->ports[i] = NULL;
host->n_ports--;
}
}

ide_port_free(hwif);
}

int ide_host_register(struct ide_host *host, const struct ide_port_info *d,
hw_regs_t **hws)
{
Expand Down Expand Up @@ -1507,8 +1531,12 @@ int ide_host_register(struct ide_host *host, const struct ide_port_info *d,
hwif->present = 1;

if (hwif->chipset != ide_4drives || !hwif->mate ||
!hwif->mate->present)
ide_register_port(hwif);
!hwif->mate->present) {
if (ide_register_port(hwif)) {
ide_disable_port(hwif);
continue;
}
}

if (hwif->present)
ide_port_tune_devices(hwif);
Expand Down Expand Up @@ -1660,12 +1688,8 @@ void ide_host_free(struct ide_host *host)
int i;

ide_host_for_each_port(i, hwif, host) {
if (hwif == NULL)
continue;

ide_port_free_devices(hwif);
ide_free_port_slot(hwif->index);
kfree(hwif);
if (hwif)
ide_port_free(hwif);
}

kfree(host);
Expand Down

0 comments on commit 94b57df

Please sign in to comment.