Commit b134c462 authored by Patrick Mochel's avatar Patrick Mochel

IDE: register ide driver for all ide drives; not just for disk drives.

  
This adds
      struct device_driver    gen_driver;
  
to ide_driver_t, which is filled in with necessary fields when an ide
driver calls ide_register_driver(). That then registers the driver with
the driver model core. 
  
As a result, this gives us the following output in driverfs:
  
# tree -d /sys/bus/ide/drivers/
/sys/bus/ide/drivers/
|-- ide-cdrom
`-- ide-disk
  
The suspend/resume callbacks in ide-disk.c have been temporarily
disabled until the ide core implements generic methods which forward
the calls to the drive drivers. 
parent ca0e5f35
...@@ -1664,14 +1664,6 @@ static int idedisk_resume(struct device *dev, u32 level) ...@@ -1664,14 +1664,6 @@ static int idedisk_resume(struct device *dev, u32 level)
/* This is just a hook for the overall driver tree. /* This is just a hook for the overall driver tree.
*/ */
static struct device_driver idedisk_devdrv = {
.bus = &ide_bus_type,
.name = "IDE disk driver",
.suspend = idedisk_suspend,
.resume = idedisk_resume,
};
static int idedisk_ioctl (ide_drive_t *drive, struct inode *inode, static int idedisk_ioctl (ide_drive_t *drive, struct inode *inode,
struct file *file, unsigned int cmd, unsigned long arg) struct file *file, unsigned int cmd, unsigned long arg)
{ {
...@@ -1717,12 +1709,6 @@ static void idedisk_setup (ide_drive_t *drive) ...@@ -1717,12 +1709,6 @@ static void idedisk_setup (ide_drive_t *drive)
drive->doorlocking = 1; drive->doorlocking = 1;
} }
} }
{
sprintf(drive->disk->disk_dev.name, "ide-disk");
drive->disk->disk_dev.driver = &idedisk_devdrv;
drive->disk->disk_dev.driver_data = drive;
}
#if 1 #if 1
(void) probe_lba_addressing(drive, 1); (void) probe_lba_addressing(drive, 1);
#else #else
...@@ -1806,7 +1792,7 @@ static int idedisk_cleanup (ide_drive_t *drive) ...@@ -1806,7 +1792,7 @@ static int idedisk_cleanup (ide_drive_t *drive)
{ {
struct gendisk *g = drive->disk; struct gendisk *g = drive->disk;
device_unregister(&drive->disk->disk_dev); device_unregister(&drive->gendev);
if ((drive->id->cfs_enable_2 & 0x3000) && drive->wcache) if ((drive->id->cfs_enable_2 & 0x3000) && drive->wcache)
if (do_idedisk_flushcache(drive)) if (do_idedisk_flushcache(drive))
printk (KERN_INFO "%s: Write Cache FAILED Flushing!\n", printk (KERN_INFO "%s: Write Cache FAILED Flushing!\n",
...@@ -1905,7 +1891,6 @@ static void __exit idedisk_exit (void) ...@@ -1905,7 +1891,6 @@ static void __exit idedisk_exit (void)
static int idedisk_init (void) static int idedisk_init (void)
{ {
ide_register_driver(&idedisk_driver); ide_register_driver(&idedisk_driver);
driver_register(&idedisk_devdrv);
return 0; return 0;
} }
......
...@@ -3440,7 +3440,9 @@ int ide_register_driver(ide_driver_t *driver) ...@@ -3440,7 +3440,9 @@ int ide_register_driver(ide_driver_t *driver)
list_del_init(&drive->list); list_del_init(&drive->list);
ata_attach(drive); ata_attach(drive);
} }
return 0; driver->gen_driver.name = driver->name;
driver->gen_driver.bus = &ide_bus_type;
return driver_register(&driver->gen_driver);
} }
EXPORT_SYMBOL(ide_register_driver); EXPORT_SYMBOL(ide_register_driver);
......
...@@ -1200,6 +1200,7 @@ typedef struct ide_driver_s { ...@@ -1200,6 +1200,7 @@ typedef struct ide_driver_s {
int (*attach)(ide_drive_t *); int (*attach)(ide_drive_t *);
void (*ata_prebuilder)(ide_drive_t *); void (*ata_prebuilder)(ide_drive_t *);
void (*atapi_prebuilder)(ide_drive_t *); void (*atapi_prebuilder)(ide_drive_t *);
struct device_driver gen_driver;
struct list_head drives; struct list_head drives;
struct list_head drivers; struct list_head drivers;
} ide_driver_t; } ide_driver_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