aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/ide/ide-probe.c2
-rw-r--r--drivers/ide/ide-proc.c16
-rw-r--r--include/linux/ide.h2
3 files changed, 6 insertions, 14 deletions
diff --git a/drivers/ide/ide-probe.c b/drivers/ide/ide-probe.c
index 9db8978ad394..dea314ce33d3 100644
--- a/drivers/ide/ide-probe.c
+++ b/drivers/ide/ide-probe.c
@@ -1199,6 +1199,8 @@ static void drive_release_dev (struct device *dev)
1199{ 1199{
1200 ide_drive_t *drive = container_of(dev, ide_drive_t, gendev); 1200 ide_drive_t *drive = container_of(dev, ide_drive_t, gendev);
1201 1201
1202 ide_proc_unregister_device(drive);
1203
1202 spin_lock_irq(&ide_lock); 1204 spin_lock_irq(&ide_lock);
1203 ide_remove_drive_from_hwgroup(drive); 1205 ide_remove_drive_from_hwgroup(drive);
1204 kfree(drive->id); 1206 kfree(drive->id);
diff --git a/drivers/ide/ide-proc.c b/drivers/ide/ide-proc.c
index bab88ca7f7ec..77025d1057b5 100644
--- a/drivers/ide/ide-proc.c
+++ b/drivers/ide/ide-proc.c
@@ -764,27 +764,16 @@ void ide_proc_port_register_devices(ide_hwif_t *hwif)
764 } 764 }
765} 765}
766 766
767static void destroy_proc_ide_device(ide_hwif_t *hwif, ide_drive_t *drive) 767void ide_proc_unregister_device(ide_drive_t *drive)
768{ 768{
769 if (drive->proc) { 769 if (drive->proc) {
770 ide_remove_proc_entries(drive->proc, generic_drive_entries); 770 ide_remove_proc_entries(drive->proc, generic_drive_entries);
771 remove_proc_entry(drive->name, proc_ide_root); 771 remove_proc_entry(drive->name, proc_ide_root);
772 remove_proc_entry(drive->name, hwif->proc); 772 remove_proc_entry(drive->name, drive->hwif->proc);
773 drive->proc = NULL; 773 drive->proc = NULL;
774 } 774 }
775} 775}
776 776
777static void destroy_proc_ide_drives(ide_hwif_t *hwif)
778{
779 int d;
780
781 for (d = 0; d < MAX_DRIVES; d++) {
782 ide_drive_t *drive = &hwif->drives[d];
783 if (drive->proc)
784 destroy_proc_ide_device(hwif, drive);
785 }
786}
787
788static ide_proc_entry_t hwif_entries[] = { 777static ide_proc_entry_t hwif_entries[] = {
789 { "channel", S_IFREG|S_IRUGO, proc_ide_read_channel, NULL }, 778 { "channel", S_IFREG|S_IRUGO, proc_ide_read_channel, NULL },
790 { "mate", S_IFREG|S_IRUGO, proc_ide_read_mate, NULL }, 779 { "mate", S_IFREG|S_IRUGO, proc_ide_read_mate, NULL },
@@ -816,7 +805,6 @@ EXPORT_SYMBOL_GPL(ide_pci_create_host_proc);
816void ide_proc_unregister_port(ide_hwif_t *hwif) 805void ide_proc_unregister_port(ide_hwif_t *hwif)
817{ 806{
818 if (hwif->proc) { 807 if (hwif->proc) {
819 destroy_proc_ide_drives(hwif);
820 ide_remove_proc_entries(hwif->proc, hwif_entries); 808 ide_remove_proc_entries(hwif->proc, hwif_entries);
821 remove_proc_entry(hwif->name, proc_ide_root); 809 remove_proc_entry(hwif->name, proc_ide_root);
822 hwif->proc = NULL; 810 hwif->proc = NULL;
diff --git a/include/linux/ide.h b/include/linux/ide.h
index 1b423958a894..f9449ecd79d9 100644
--- a/include/linux/ide.h
+++ b/include/linux/ide.h
@@ -690,6 +690,7 @@ void proc_ide_create(void);
690void proc_ide_destroy(void); 690void proc_ide_destroy(void);
691void ide_proc_register_port(ide_hwif_t *); 691void ide_proc_register_port(ide_hwif_t *);
692void ide_proc_port_register_devices(ide_hwif_t *); 692void ide_proc_port_register_devices(ide_hwif_t *);
693void ide_proc_unregister_device(ide_drive_t *);
693void ide_proc_unregister_port(ide_hwif_t *); 694void ide_proc_unregister_port(ide_hwif_t *);
694void ide_proc_register_driver(ide_drive_t *, ide_driver_t *); 695void ide_proc_register_driver(ide_drive_t *, ide_driver_t *);
695void ide_proc_unregister_driver(ide_drive_t *, ide_driver_t *); 696void ide_proc_unregister_driver(ide_drive_t *, ide_driver_t *);
@@ -723,6 +724,7 @@ static inline void proc_ide_create(void) { ; }
723static inline void proc_ide_destroy(void) { ; } 724static inline void proc_ide_destroy(void) { ; }
724static inline void ide_proc_register_port(ide_hwif_t *hwif) { ; } 725static inline void ide_proc_register_port(ide_hwif_t *hwif) { ; }
725static inline void ide_proc_port_register_devices(ide_hwif_t *hwif) { ; } 726static inline void ide_proc_port_register_devices(ide_hwif_t *hwif) { ; }
727static inline void ide_proc_unregister_device(ide_drive_t *drive) { ; }
726static inline void ide_proc_unregister_port(ide_hwif_t *hwif) { ; } 728static inline void ide_proc_unregister_port(ide_hwif_t *hwif) { ; }
727static inline void ide_proc_register_driver(ide_drive_t *drive, ide_driver_t *driver) { ; } 729static inline void ide_proc_register_driver(ide_drive_t *drive, ide_driver_t *driver) { ; }
728static inline void ide_proc_unregister_driver(ide_drive_t *drive, ide_driver_t *driver) { ; } 730static inline void ide_proc_unregister_driver(ide_drive_t *drive, ide_driver_t *driver) { ; }