]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
ide: remove IDE devices from /proc/ide/ before unregistering them
authorBartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Thu, 17 Apr 2008 22:46:22 +0000 (00:46 +0200)
committerBartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Thu, 17 Apr 2008 22:46:22 +0000 (00:46 +0200)
IDE devices need to be removed from /proc/ide/ _before_ being unregistered:

* Drop 'ide_hwif_t *hwif' argument from destroy_proc_ide_device()
  and use drive->hwif instead.

* Rename destroy_proc_ide_device() to ide_proc_unregister_device().

* Call ide_proc_unregister_device() in drive_release_dev().

* Remove no longer needed destroy_proc_ide_drives().

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
drivers/ide/ide-probe.c
drivers/ide/ide-proc.c
include/linux/ide.h

index 9db8978ad3949b4267409cc5b86454228b6117d0..dea314ce33d358325281bd689ca689125848b727 100644 (file)
@@ -1199,6 +1199,8 @@ static void drive_release_dev (struct device *dev)
 {
        ide_drive_t *drive = container_of(dev, ide_drive_t, gendev);
 
+       ide_proc_unregister_device(drive);
+
        spin_lock_irq(&ide_lock);
        ide_remove_drive_from_hwgroup(drive);
        kfree(drive->id);
index bab88ca7f7ecb953495cd09c17d979a395ae5fd9..77025d1057b5344cdaff36fb262ad282108e0313 100644 (file)
@@ -764,27 +764,16 @@ void ide_proc_port_register_devices(ide_hwif_t *hwif)
        }
 }
 
-static void destroy_proc_ide_device(ide_hwif_t *hwif, ide_drive_t *drive)
+void ide_proc_unregister_device(ide_drive_t *drive)
 {
        if (drive->proc) {
                ide_remove_proc_entries(drive->proc, generic_drive_entries);
                remove_proc_entry(drive->name, proc_ide_root);
-               remove_proc_entry(drive->name, hwif->proc);
+               remove_proc_entry(drive->name, drive->hwif->proc);
                drive->proc = NULL;
        }
 }
 
-static void destroy_proc_ide_drives(ide_hwif_t *hwif)
-{
-       int     d;
-
-       for (d = 0; d < MAX_DRIVES; d++) {
-               ide_drive_t *drive = &hwif->drives[d];
-               if (drive->proc)
-                       destroy_proc_ide_device(hwif, drive);
-       }
-}
-
 static ide_proc_entry_t hwif_entries[] = {
        { "channel",    S_IFREG|S_IRUGO,        proc_ide_read_channel,  NULL },
        { "mate",       S_IFREG|S_IRUGO,        proc_ide_read_mate,     NULL },
@@ -816,7 +805,6 @@ EXPORT_SYMBOL_GPL(ide_pci_create_host_proc);
 void ide_proc_unregister_port(ide_hwif_t *hwif)
 {
        if (hwif->proc) {
-               destroy_proc_ide_drives(hwif);
                ide_remove_proc_entries(hwif->proc, hwif_entries);
                remove_proc_entry(hwif->name, proc_ide_root);
                hwif->proc = NULL;
index 1b423958a89476a2307646acedc2072038d7fa58..f9449ecd79d9839131bb6087eac1b57fb87d64a7 100644 (file)
@@ -690,6 +690,7 @@ void proc_ide_create(void);
 void proc_ide_destroy(void);
 void ide_proc_register_port(ide_hwif_t *);
 void ide_proc_port_register_devices(ide_hwif_t *);
+void ide_proc_unregister_device(ide_drive_t *);
 void ide_proc_unregister_port(ide_hwif_t *);
 void ide_proc_register_driver(ide_drive_t *, ide_driver_t *);
 void ide_proc_unregister_driver(ide_drive_t *, ide_driver_t *);
@@ -723,6 +724,7 @@ static inline void proc_ide_create(void) { ; }
 static inline void proc_ide_destroy(void) { ; }
 static inline void ide_proc_register_port(ide_hwif_t *hwif) { ; }
 static inline void ide_proc_port_register_devices(ide_hwif_t *hwif) { ; }
+static inline void ide_proc_unregister_device(ide_drive_t *drive) { ; }
 static inline void ide_proc_unregister_port(ide_hwif_t *hwif) { ; }
 static inline void ide_proc_register_driver(ide_drive_t *drive, ide_driver_t *driver) { ; }
 static inline void ide_proc_unregister_driver(ide_drive_t *drive, ide_driver_t *driver) { ; }