Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 114198
b: refs/heads/master
c: 6ccc6d7
h: refs/heads/master
v: v3
  • Loading branch information
Bartlomiej Zolnierkiewicz committed Oct 13, 2008
1 parent 8da584b commit e9a8f72
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 36 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: bfa7d8e55f0c5ae22ef57eb22942c74fdde7b9bd
refs/heads/master: 6ccc6d7ecbb427580d045699e434bc5c6f45e227
47 changes: 12 additions & 35 deletions trunk/drivers/ide/ide-generic.c
Original file line number Diff line number Diff line change
Expand Up @@ -137,10 +137,9 @@ static void ide_generic_check_pci_legacy_iobases(int *primary, int *secondary)

static int __init ide_generic_init(void)
{
hw_regs_t hw[MAX_HWIFS], *hws[MAX_HWIFS];
struct ide_host *host;
hw_regs_t hw, *hws[] = { &hw, NULL, NULL, NULL };
unsigned long io_addr;
int i, rc, primary = 0, secondary = 0;
int i, rc = 0, primary = 0, secondary = 0;

#ifdef CONFIG_MIPS
if (!ide_probe_legacy())
Expand All @@ -161,13 +160,9 @@ static int __init ide_generic_init(void)
printk(KERN_INFO DRV_NAME ": enforcing probing of I/O ports "
"upon user request\n");

memset(hws, 0, sizeof(hw_regs_t *) * MAX_HWIFS);

for (i = 0; i < ARRAY_SIZE(legacy_bases); i++) {
io_addr = legacy_bases[i];

hws[i] = NULL;

if ((probe_mask & (1 << i)) && io_addr) {
if (!request_region(io_addr, 8, DRV_NAME)) {
printk(KERN_ERR "%s: I/O resource 0x%lX-0x%lX "
Expand All @@ -184,45 +179,27 @@ static int __init ide_generic_init(void)
continue;
}

memset(&hw[i], 0, sizeof(hw[i]));
ide_std_init_ports(&hw[i], io_addr, io_addr + 0x206);
memset(&hw, 0, sizeof(hw));
ide_std_init_ports(&hw, io_addr, io_addr + 0x206);
#ifdef CONFIG_IA64
hw[i].irq = isa_irq_to_vector(legacy_irqs[i]);
hw.irq = isa_irq_to_vector(legacy_irqs[i]);
#else
hw[i].irq = legacy_irqs[i];
hw.irq = legacy_irqs[i];
#endif
hw[i].chipset = ide_generic;
hw.chipset = ide_generic;

hws[i] = &hw[i];
rc = ide_host_add(NULL, hws, NULL);
if (rc) {
release_region(io_addr + 0x206, 1);
release_region(io_addr, 8);
}
}
}

host = ide_host_alloc_all(NULL, hws);
if (host == NULL) {
rc = -ENOMEM;
goto err;
}

rc = ide_host_register(host, NULL, hws);
if (rc)
goto err_free;

if (ide_generic_sysfs_init())
printk(KERN_ERR DRV_NAME ": failed to create ide_generic "
"class\n");

return 0;
err_free:
ide_host_free(host);
err:
for (i = 0; i < MAX_HWIFS; i++) {
if (hws[i] == NULL)
continue;

io_addr = hws[i]->io_ports.data_addr;
release_region(io_addr + 0x206, 1);
release_region(io_addr, 8);
}
return rc;
}

Expand Down

0 comments on commit e9a8f72

Please sign in to comment.