diff options
author | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2008-04-17 18:46:22 -0400 |
---|---|---|
committer | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2008-04-17 18:46:22 -0400 |
commit | 43514ed1ee6a2325692e173ea4eb41068bf72de0 (patch) | |
tree | 322431f77da814d2fee45c951465873ea4fe4421 /drivers/ide | |
parent | 71bf9f6fe822397e2cce781a2408c658a776fd68 (diff) |
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.c | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/drivers/ide/ide.c b/drivers/ide/ide.c index 31bc28aacdc..47c44d15ad4 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 | ||
106 | EXPORT_SYMBOL(ide_hwifs); | 106 | EXPORT_SYMBOL(ide_hwifs); |
107 | 107 | ||
108 | static 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 | */ |
111 | void ide_init_port_data(ide_hwif_t *hwif, unsigned int index) | 113 | void 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 | } | ||
136 | EXPORT_SYMBOL_GPL(ide_init_port_data); | ||
137 | |||
138 | static 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 | } |
154 | EXPORT_SYMBOL_GPL(ide_init_port_data); | 165 | |
155 | 166 | ||
156 | static void init_hwif_default(ide_hwif_t *hwif, unsigned int index) | 167 | static void init_hwif_default(ide_hwif_t *hwif, unsigned int index) |
157 | { | 168 | { |