aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/ide')
-rw-r--r--drivers/ide/ide.c23
1 files changed, 17 insertions, 6 deletions
diff --git a/drivers/ide/ide.c b/drivers/ide/ide.c
index 31bc28aacdc9..47c44d15ad4a 100644
--- a/drivers/ide/ide.c
+++ b/drivers/ide/ide.c
@@ -105,13 +105,13 @@ ide_hwif_t ide_hwifs[MAX_HWIFS]; /* master data repository */
105 105
106EXPORT_SYMBOL(ide_hwifs); 106EXPORT_SYMBOL(ide_hwifs);
107 107
108static void ide_port_init_devices_data(ide_hwif_t *);
109
108/* 110/*
109 * Do not even *think* about calling this! 111 * Do not even *think* about calling this!
110 */ 112 */
111void ide_init_port_data(ide_hwif_t *hwif, unsigned int index) 113void ide_init_port_data(ide_hwif_t *hwif, unsigned int index)
112{ 114{
113 unsigned int unit;
114
115 /* bulk initialize hwif & drive info with zeros */ 115 /* bulk initialize hwif & drive info with zeros */
116 memset(hwif, 0, sizeof(ide_hwif_t)); 116 memset(hwif, 0, sizeof(ide_hwif_t));
117 117
@@ -130,8 +130,20 @@ void ide_init_port_data(ide_hwif_t *hwif, unsigned int index)
130 130
131 default_hwif_iops(hwif); 131 default_hwif_iops(hwif);
132 default_hwif_transport(hwif); 132 default_hwif_transport(hwif);
133
134 ide_port_init_devices_data(hwif);
135}
136EXPORT_SYMBOL_GPL(ide_init_port_data);
137
138static void ide_port_init_devices_data(ide_hwif_t *hwif)
139{
140 int unit;
141
133 for (unit = 0; unit < MAX_DRIVES; ++unit) { 142 for (unit = 0; unit < MAX_DRIVES; ++unit) {
134 ide_drive_t *drive = &hwif->drives[unit]; 143 ide_drive_t *drive = &hwif->drives[unit];
144 u8 j = (hwif->index * MAX_DRIVES) + unit;
145
146 memset(drive, 0, sizeof(*drive));
135 147
136 drive->media = ide_disk; 148 drive->media = ide_disk;
137 drive->select.all = (unit<<4)|0xa0; 149 drive->select.all = (unit<<4)|0xa0;
@@ -143,15 +155,14 @@ void ide_init_port_data(ide_hwif_t *hwif, unsigned int index)
143 drive->special.b.set_geometry = 1; 155 drive->special.b.set_geometry = 1;
144 drive->name[0] = 'h'; 156 drive->name[0] = 'h';
145 drive->name[1] = 'd'; 157 drive->name[1] = 'd';
146 drive->name[2] = 'a' + (index * MAX_DRIVES) + unit; 158 drive->name[2] = 'a' + j;
147 drive->max_failures = IDE_DEFAULT_MAX_FAILURES; 159 drive->max_failures = IDE_DEFAULT_MAX_FAILURES;
148 drive->using_dma = 0; 160
149 drive->vdma = 0;
150 INIT_LIST_HEAD(&drive->list); 161 INIT_LIST_HEAD(&drive->list);
151 init_completion(&drive->gendev_rel_comp); 162 init_completion(&drive->gendev_rel_comp);
152 } 163 }
153} 164}
154EXPORT_SYMBOL_GPL(ide_init_port_data); 165
155 166
156static void init_hwif_default(ide_hwif_t *hwif, unsigned int index) 167static void init_hwif_default(ide_hwif_t *hwif, unsigned int index)
157{ 168{