aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide/h8300/ide-h8300.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/ide/h8300/ide-h8300.c')
-rw-r--r--drivers/ide/h8300/ide-h8300.c27
1 files changed, 20 insertions, 7 deletions
diff --git a/drivers/ide/h8300/ide-h8300.c b/drivers/ide/h8300/ide-h8300.c
index 4a49b5c59acb..4f6d0191cf6c 100644
--- a/drivers/ide/h8300/ide-h8300.c
+++ b/drivers/ide/h8300/ide-h8300.c
@@ -84,11 +84,12 @@ static inline void hwif_setup(ide_hwif_t *hwif)
84 hwif->INSL = NULL; 84 hwif->INSL = NULL;
85} 85}
86 86
87void __init h8300_ide_init(void) 87static int __init h8300_ide_init(void)
88{ 88{
89 hw_regs_t hw; 89 hw_regs_t hw;
90 ide_hwif_t *hwif; 90 ide_hwif_t *hwif;
91 int idx; 91 int index;
92 u8 idx[4] = { 0xff, 0xff, 0xff, 0xff };
92 93
93 if (!request_region(CONFIG_H8300_IDE_BASE, H8300_IDE_GAP*8, "ide-h8300")) 94 if (!request_region(CONFIG_H8300_IDE_BASE, H8300_IDE_GAP*8, "ide-h8300"))
94 goto out_busy; 95 goto out_busy;
@@ -100,16 +101,28 @@ void __init h8300_ide_init(void)
100 hw_setup(&hw); 101 hw_setup(&hw);
101 102
102 /* register if */ 103 /* register if */
103 idx = ide_register_hw(&hw, NULL, 1, &hwif); 104 hwif = ide_find_port(hw.io_ports[IDE_DATA_OFFSET]);
104 if (idx == -1) { 105 if (hwif == NULL) {
105 printk(KERN_ERR "ide-h8300: IDE I/F register failed\n"); 106 printk(KERN_ERR "ide-h8300: IDE I/F register failed\n");
106 return; 107 return -ENOENT;
107 } 108 }
108 109
110 index = hwif->index;
111 ide_init_port_data(hwif, index);
112 ide_init_port_hw(hwif, &hw);
109 hwif_setup(hwif); 113 hwif_setup(hwif);
110 printk(KERN_INFO "ide%d: H8/300 generic IDE interface\n", idx); 114 printk(KERN_INFO "ide%d: H8/300 generic IDE interface\n", index);
111 return; 115
116 idx[0] = index;
117
118 ide_device_add(idx);
119
120 return 0;
112 121
113out_busy: 122out_busy:
114 printk(KERN_ERR "ide-h8300: IDE I/F resource already used.\n"); 123 printk(KERN_ERR "ide-h8300: IDE I/F resource already used.\n");
124
125 return -EBUSY;
115} 126}
127
128module_init(h8300_ide_init);