]> git.neil.brown.name Git - history.git/commitdiff
IDE: add struct device to ide_drive_t and use that for IDE drives
authorPatrick Mochel <mochel@osdl.org>
Wed, 9 Oct 2002 03:29:48 +0000 (20:29 -0700)
committerPatrick Mochel <mochel@osdl.org>
Wed, 9 Oct 2002 03:29:48 +0000 (20:29 -0700)
... instead of the one in struct gendisk.

drivers/ide/ide-probe.c
include/linux/ide.h

index 9caa96e0051862c0f3a69afcb2847ce389f317fc..6277ce3cb1e043d4506e665c21cceeaa50bbaf38 100644 (file)
@@ -998,15 +998,6 @@ static void init_gendisk (ide_hwif_t *hwif)
                sprintf(disk->disk_name,"hd%c",'a'+hwif->index*MAX_DRIVES+unit);
                disk->minor_shift = PARTN_BITS; 
                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;
        }
 
@@ -1020,6 +1011,20 @@ static void init_gendisk (ide_hwif_t *hwif)
                if (hwif->drives[unit].present)
                        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;
 
 err_kmalloc_gd:
index 0655a585300f8c4d66bb29dcb99f41d9102c3757..419b0c92f6f5e8fe6aaaf37950d4a20056a73927 100644 (file)
@@ -794,6 +794,7 @@ typedef struct ide_drive_s {
        int             lun;            /* logical unit */
        int             crc_count;      /* crc counter to reduce drive speed */
        struct list_head list;
+       struct device   gendev;
        struct gendisk *disk;
 } ide_drive_t;