diff options
Diffstat (limited to 'drivers/ide/ide-probe.c')
-rw-r--r-- | drivers/ide/ide-probe.c | 44 |
1 files changed, 16 insertions, 28 deletions
diff --git a/drivers/ide/ide-probe.c b/drivers/ide/ide-probe.c index 5ccd691b0bd2..2cccfe9d39f4 100644 --- a/drivers/ide/ide-probe.c +++ b/drivers/ide/ide-probe.c | |||
@@ -1182,26 +1182,6 @@ static void drive_release_dev (struct device *dev) | |||
1182 | complete(&drive->gendev_rel_comp); | 1182 | complete(&drive->gendev_rel_comp); |
1183 | } | 1183 | } |
1184 | 1184 | ||
1185 | static void init_gendisk (ide_hwif_t *hwif) | ||
1186 | { | ||
1187 | unsigned int unit; | ||
1188 | |||
1189 | for (unit = 0; unit < MAX_DRIVES; ++unit) { | ||
1190 | ide_drive_t * drive = &hwif->drives[unit]; | ||
1191 | |||
1192 | if (!drive->present) | ||
1193 | continue; | ||
1194 | |||
1195 | ide_add_generic_settings(drive); | ||
1196 | snprintf(drive->gendev.bus_id,BUS_ID_SIZE,"%u.%u", | ||
1197 | hwif->index,unit); | ||
1198 | drive->gendev.parent = &hwif->gendev; | ||
1199 | drive->gendev.bus = &ide_bus_type; | ||
1200 | drive->gendev.driver_data = drive; | ||
1201 | drive->gendev.release = drive_release_dev; | ||
1202 | } | ||
1203 | } | ||
1204 | |||
1205 | static int hwif_init(ide_hwif_t *hwif) | 1185 | static int hwif_init(ide_hwif_t *hwif) |
1206 | { | 1186 | { |
1207 | int old_irq; | 1187 | int old_irq; |
@@ -1261,7 +1241,6 @@ done: | |||
1261 | blk_register_region(MKDEV(hwif->major, 0), MAX_DRIVES << PARTN_BITS, | 1241 | blk_register_region(MKDEV(hwif->major, 0), MAX_DRIVES << PARTN_BITS, |
1262 | THIS_MODULE, ata_probe, ata_lock, hwif); | 1242 | THIS_MODULE, ata_probe, ata_lock, hwif); |
1263 | ide_acpi_init(hwif); | 1243 | ide_acpi_init(hwif); |
1264 | init_gendisk(hwif); | ||
1265 | return 1; | 1244 | return 1; |
1266 | 1245 | ||
1267 | out: | 1246 | out: |
@@ -1275,15 +1254,24 @@ static void hwif_register_devices(ide_hwif_t *hwif) | |||
1275 | 1254 | ||
1276 | for (i = 0; i < MAX_DRIVES; i++) { | 1255 | for (i = 0; i < MAX_DRIVES; i++) { |
1277 | ide_drive_t *drive = &hwif->drives[i]; | 1256 | ide_drive_t *drive = &hwif->drives[i]; |
1257 | struct device *dev = &drive->gendev; | ||
1258 | int ret; | ||
1278 | 1259 | ||
1279 | if (drive->present) { | 1260 | if (!drive->present) |
1280 | int ret = device_register(&drive->gendev); | 1261 | continue; |
1281 | 1262 | ||
1282 | if (ret < 0) | 1263 | ide_add_generic_settings(drive); |
1283 | printk(KERN_WARNING "IDE: %s: " | 1264 | |
1284 | "device_register error: %d\n", | 1265 | snprintf(dev->bus_id, BUS_ID_SIZE, "%u.%u", hwif->index, i); |
1285 | __FUNCTION__, ret); | 1266 | dev->parent = &hwif->gendev; |
1286 | } | 1267 | dev->bus = &ide_bus_type; |
1268 | dev->driver_data = drive; | ||
1269 | dev->release = drive_release_dev; | ||
1270 | |||
1271 | ret = device_register(dev); | ||
1272 | if (ret < 0) | ||
1273 | printk(KERN_WARNING "IDE: %s: device_register error: " | ||
1274 | "%d\n", __func__, ret); | ||
1287 | } | 1275 | } |
1288 | } | 1276 | } |
1289 | 1277 | ||