summaryrefslogtreecommitdiffstats
path: root/drivers/ide
diff options
context:
space:
mode:
authorBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2008-04-18 00:46:22 +0200
committerBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2008-04-18 00:46:22 +0200
commit43514ed1ee6a2325692e173ea4eb41068bf72de0 (patch)
tree322431f77da814d2fee45c951465873ea4fe4421 /drivers/ide
parent71bf9f6fe822397e2cce781a2408c658a776fd68 (diff)
downloadlinux-43514ed1ee6a2325692e173ea4eb41068bf72de0.tar.bz2
ide: factor out devices init from ide_init_port_data()
* Factor out devices init from ide_init_port_data() to ide_port_init_devices_data(). While at it: * Add explicit clearing of IDE device structure. There should be no functionality changes caused by this patch. Acked-by: Sergei Shtylyov <sshtylyov@ru.mvista.com> Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
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 */
EXPORT_SYMBOL(ide_hwifs);
+static void ide_port_init_devices_data(ide_hwif_t *);
+
/*
* Do not even *think* about calling this!
*/
void ide_init_port_data(ide_hwif_t *hwif, unsigned int index)
{
- unsigned int unit;
-
/* bulk initialize hwif & drive info with zeros */
memset(hwif, 0, sizeof(ide_hwif_t));
@@ -130,8 +130,20 @@ void ide_init_port_data(ide_hwif_t *hwif, unsigned int index)
default_hwif_iops(hwif);
default_hwif_transport(hwif);
+
+ ide_port_init_devices_data(hwif);
+}
+EXPORT_SYMBOL_GPL(ide_init_port_data);
+
+static void ide_port_init_devices_data(ide_hwif_t *hwif)
+{
+ int unit;
+
for (unit = 0; unit < MAX_DRIVES; ++unit) {
ide_drive_t *drive = &hwif->drives[unit];
+ u8 j = (hwif->index * MAX_DRIVES) + unit;
+
+ memset(drive, 0, sizeof(*drive));
drive->media = ide_disk;
drive->select.all = (unit<<4)|0xa0;
@@ -143,15 +155,14 @@ void ide_init_port_data(ide_hwif_t *hwif, unsigned int index)
drive->special.b.set_geometry = 1;
drive->name[0] = 'h';
drive->name[1] = 'd';
- drive->name[2] = 'a' + (index * MAX_DRIVES) + unit;
+ drive->name[2] = 'a' + j;
drive->max_failures = IDE_DEFAULT_MAX_FAILURES;
- drive->using_dma = 0;
- drive->vdma = 0;
+
INIT_LIST_HEAD(&drive->list);
init_completion(&drive->gendev_rel_comp);
}
}
-EXPORT_SYMBOL_GPL(ide_init_port_data);
+
static void init_hwif_default(ide_hwif_t *hwif, unsigned int index)
{