Re: [bk/patch] IDE driver model update

From: Patrick Mochel (mochel@osdl.org)
Date: Wed Oct 09 2002 - 13:43:32 EST


ChangeSet@1.727, 2002-10-09 10:29:48-07:00, mochel@osdl.org
  IDE: add struct device to ide_drive_t and use that for IDE drives
  
  ... instead of the one in struct gendisk.

diff -Nru a/drivers/ide/ide-probe.c b/drivers/ide/ide-probe.c
--- a/drivers/ide/ide-probe.c Wed Oct 9 11:41:41 2002
+++ b/drivers/ide/ide-probe.c Wed Oct 9 11:41:41 2002
@@ -998,15 +998,6 @@
                 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 @@
                 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:
diff -Nru a/include/linux/ide.h b/include/linux/ide.h
--- a/include/linux/ide.h Wed Oct 9 11:41:41 2002
+++ b/include/linux/ide.h Wed Oct 9 11:41:41 2002
@@ -794,6 +794,7 @@
         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;
 

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Tue Oct 15 2002 - 22:00:32 EST