aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide/ide-probe.c
diff options
context:
space:
mode:
authorBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2008-02-02 13:56:39 -0500
committerBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2008-02-02 13:56:39 -0500
commit7704ca2a3ee4b3690c5dcc99ea4f8dcf10d7bbdb (patch)
treeed6a3d6461fba99ba967b206d46d51e965fc9c1b /drivers/ide/ide-probe.c
parent909f4369bca30f9a186316a3bf2b4a9c1e702a25 (diff)
ide: factor out code initializing devices from ide_init_port()
* Factor out code initializing devices from ide_init_port() to ide_port_init_devices(). * Call the new function from ide_device_add_all(). There should be no functionality changes caused by this patch. Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Diffstat (limited to 'drivers/ide/ide-probe.c')
-rw-r--r--drivers/ide/ide-probe.c32
1 files changed, 17 insertions, 15 deletions
diff --git a/drivers/ide/ide-probe.c b/drivers/ide/ide-probe.c
index c25df65b51f8..802a04ad6024 100644
--- a/drivers/ide/ide-probe.c
+++ b/drivers/ide/ide-probe.c
@@ -1289,6 +1289,22 @@ static void hwif_register_devices(ide_hwif_t *hwif)
1289 } 1289 }
1290} 1290}
1291 1291
1292static void ide_port_init_devices(ide_hwif_t *hwif)
1293{
1294 int i;
1295
1296 for (i = 0; i < MAX_DRIVES; i++) {
1297 ide_drive_t *drive = &hwif->drives[i];
1298
1299 if (hwif->host_flags & IDE_HFLAG_IO_32BIT)
1300 drive->io_32bit = 1;
1301 if (hwif->host_flags & IDE_HFLAG_UNMASK_IRQS)
1302 drive->unmask = 1;
1303 if ((hwif->host_flags & IDE_HFLAG_NO_AUTOTUNE) == 0)
1304 drive->autotune = 1;
1305 }
1306}
1307
1292static void ide_init_port(ide_hwif_t *hwif, unsigned int port, 1308static void ide_init_port(ide_hwif_t *hwif, unsigned int port,
1293 const struct ide_port_info *d) 1309 const struct ide_port_info *d)
1294{ 1310{
@@ -1314,16 +1330,6 @@ static void ide_init_port(ide_hwif_t *hwif, unsigned int port,
1314 if ((d->host_flags & IDE_HFLAG_SERIALIZE) && hwif->mate) 1330 if ((d->host_flags & IDE_HFLAG_SERIALIZE) && hwif->mate)
1315 hwif->mate->serialized = hwif->serialized = 1; 1331 hwif->mate->serialized = hwif->serialized = 1;
1316 1332
1317 if (d->host_flags & IDE_HFLAG_IO_32BIT) {
1318 hwif->drives[0].io_32bit = 1;
1319 hwif->drives[1].io_32bit = 1;
1320 }
1321
1322 if (d->host_flags & IDE_HFLAG_UNMASK_IRQS) {
1323 hwif->drives[0].unmask = 1;
1324 hwif->drives[1].unmask = 1;
1325 }
1326
1327 hwif->swdma_mask = d->swdma_mask; 1333 hwif->swdma_mask = d->swdma_mask;
1328 hwif->mwdma_mask = d->mwdma_mask; 1334 hwif->mwdma_mask = d->mwdma_mask;
1329 hwif->ultra_mask = d->udma_mask; 1335 hwif->ultra_mask = d->udma_mask;
@@ -1332,11 +1338,6 @@ static void ide_init_port(ide_hwif_t *hwif, unsigned int port,
1332 if ((d->host_flags && IDE_HFLAG_NO_DMA) == 0 && hwif->dma_base == 0) 1338 if ((d->host_flags && IDE_HFLAG_NO_DMA) == 0 && hwif->dma_base == 0)
1333 hwif->swdma_mask = hwif->mwdma_mask = hwif->ultra_mask = 0; 1339 hwif->swdma_mask = hwif->mwdma_mask = hwif->ultra_mask = 0;
1334 1340
1335 if ((d->host_flags & IDE_HFLAG_NO_AUTOTUNE) == 0) {
1336 hwif->drives[0].autotune = 1;
1337 hwif->drives[1].autotune = 1;
1338 }
1339
1340 if (d->host_flags & IDE_HFLAG_RQSIZE_256) 1341 if (d->host_flags & IDE_HFLAG_RQSIZE_256)
1341 hwif->rqsize = 256; 1342 hwif->rqsize = 256;
1342 1343
@@ -1371,6 +1372,7 @@ int ide_device_add_all(u8 *idx, const struct ide_port_info *d)
1371 mate = (i & 1) ? NULL : hwif; 1372 mate = (i & 1) ? NULL : hwif;
1372 1373
1373 ide_init_port(hwif, i & 1, d); 1374 ide_init_port(hwif, i & 1, d);
1375 ide_port_init_devices(hwif);
1374 } 1376 }
1375 1377
1376 for (i = 0; i < MAX_HWIFS; i++) { 1378 for (i = 0; i < MAX_HWIFS; i++) {