Commit ca0e5f35 authored by Patrick Mochel's avatar Patrick Mochel

IDE: add struct device to ide_drive_t and use that for IDE drives

... instead of the one in struct gendisk.
parent 716041cc
...@@ -998,15 +998,6 @@ static void init_gendisk (ide_hwif_t *hwif) ...@@ -998,15 +998,6 @@ static void init_gendisk (ide_hwif_t *hwif)
sprintf(disk->disk_name,"hd%c",'a'+hwif->index*MAX_DRIVES+unit); sprintf(disk->disk_name,"hd%c",'a'+hwif->index*MAX_DRIVES+unit);
disk->minor_shift = PARTN_BITS; disk->minor_shift = PARTN_BITS;
disk->fops = ide_fops; disk->fops = ide_fops;
snprintf(disk->disk_dev.bus_id,BUS_ID_SIZE,"%u.%u",
hwif->index,unit);
snprintf(disk->disk_dev.name,DEVICE_NAME_SIZE,
"%s","IDE Drive");
disk->disk_dev.parent = &hwif->gendev;
disk->disk_dev.bus = &ide_bus_type;
if (hwif->drives[unit].present)
device_register(&disk->disk_dev);
hwif->drives[unit].disk = disk; hwif->drives[unit].disk = disk;
} }
...@@ -1020,6 +1011,20 @@ static void init_gendisk (ide_hwif_t *hwif) ...@@ -1020,6 +1011,20 @@ static void init_gendisk (ide_hwif_t *hwif)
if (hwif->drives[unit].present) if (hwif->drives[unit].present)
hwif->drives[unit].de = devfs_mk_dir(ide_devfs_handle, name, NULL); hwif->drives[unit].de = devfs_mk_dir(ide_devfs_handle, name, NULL);
} }
for (unit = 0; unit < units; ++unit) {
ide_drive_t * drive = &hwif->drives[unit];
snprintf(drive->gendev.bus_id,BUS_ID_SIZE,"%u.%u",
hwif->index,unit);
snprintf(drive->gendev.name,DEVICE_NAME_SIZE,
"%s","IDE Drive");
drive->gendev.parent = &hwif->gendev;
drive->gendev.bus = &ide_bus_type;
if (drive->present)
device_register(&drive->gendev);
}
return; return;
err_kmalloc_gd: err_kmalloc_gd:
......
...@@ -794,6 +794,7 @@ typedef struct ide_drive_s { ...@@ -794,6 +794,7 @@ typedef struct ide_drive_s {
int lun; /* logical unit */ int lun; /* logical unit */
int crc_count; /* crc counter to reduce drive speed */ int crc_count; /* crc counter to reduce drive speed */
struct list_head list; struct list_head list;
struct device gendev;
struct gendisk *disk; struct gendisk *disk;
} ide_drive_t; } ide_drive_t;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment