linux 2.6.16.38 w/ vs2.0.3-rc1
[linux-2.6.git] / drivers / ide / ide.c
index defd4b4..b2cc437 100644 (file)
 
 #define _IDE_C                 /* Tell ide.h it's really us */
 
+#include <linux/config.h>
 #include <linux/module.h>
 #include <linux/types.h>
 #include <linux/string.h>
 #include <linux/pci.h>
 #include <linux/delay.h>
 #include <linux/ide.h>
+#include <linux/devfs_fs_kernel.h>
 #include <linux/completion.h>
 #include <linux/reboot.h>
 #include <linux/cdrom.h>
@@ -590,8 +592,13 @@ void ide_unregister(unsigned int index)
                goto abort;
        for (unit = 0; unit < MAX_DRIVES; ++unit) {
                drive = &hwif->drives[unit];
-               if (!drive->present)
+               if (!drive->present) {
+                       if (drive->devfs_name[0] != '\0') {
+                               devfs_remove(drive->devfs_name);
+                               drive->devfs_name[0] = '\0';
+                       }
                        continue;
+               }
                spin_unlock_irq(&ide_lock);
                device_unregister(&drive->gendev);
                wait_for_completion(&drive->gendev_rel_comp);
@@ -719,7 +726,6 @@ void ide_setup_ports (      hw_regs_t *hw,
 {
        int i;
 
-       memset(hw, 0, sizeof(hw_regs_t));
        for (i = 0; i < IDE_NR_PORTS; i++) {
                if (offsets[i] == -1) {
                        switch(i) {
@@ -1219,7 +1225,7 @@ static int generic_ide_suspend(struct device *dev, pm_message_t state)
        memset(&args, 0, sizeof(args));
        rq.flags = REQ_PM_SUSPEND;
        rq.special = &args;
-       rq.end_io_data = &rqpm;
+       rq.pm = &rqpm;
        rqpm.pm_step = ide_pm_state_start_suspend;
        rqpm.pm_state = state.event;
 
@@ -1238,7 +1244,7 @@ static int generic_ide_resume(struct device *dev)
        memset(&args, 0, sizeof(args));
        rq.flags = REQ_PM_RESUME;
        rq.special = &args;
-       rq.end_io_data = &rqpm;
+       rq.pm = &rqpm;
        rqpm.pm_step = ide_pm_state_start_resume;
        rqpm.pm_state = PM_EVENT_ON;
 
@@ -1360,7 +1366,8 @@ int generic_ide_ioctl(ide_drive_t *drive, struct file *file, struct block_device
 
                        ide_abort(drive, "drive reset");
 
-                       BUG_ON(HWGROUP(drive)->handler);
+                       if(HWGROUP(drive)->handler)
+                               BUG();
                                
                        /* Ensure nothing gets queued after we
                           drop the lock. Reset will clear the busy */
@@ -1539,7 +1546,7 @@ static int __init ide_setup(char *s)
                const char *hd_words[] = {
                        "none", "noprobe", "nowerr", "cdrom", "serialize",
                        "autotune", "noautotune", "minus8", "swapdata", "bswap",
-                       "noflush", "remap", "remap63", "scsi", NULL };
+                       "minus11", "remap", "remap63", "scsi", NULL };
                unit = s[2] - 'a';
                hw   = unit / MAX_DRIVES;
                unit = unit % MAX_DRIVES;
@@ -1578,9 +1585,6 @@ static int __init ide_setup(char *s)
                        case -10: /* "bswap" */
                                drive->bswap = 1;
                                goto done;
-                       case -11: /* noflush */
-                               drive->noflush = 1;
-                               goto done;
                        case -12: /* "remap" */
                                drive->remap_0_to_1 = 1;
                                goto done;
@@ -1992,6 +1996,7 @@ EXPORT_SYMBOL_GPL(ide_bus_type);
 static int __init ide_init(void)
 {
        printk(KERN_INFO "Uniform Multi-Platform E-IDE driver " REVISION "\n");
+       devfs_mk_dir("ide");
        system_bus_speed = ide_system_bus_speed();
 
        bus_register(&ide_bus_type);
@@ -2053,7 +2058,7 @@ static void __init parse_options (char *line)
        }
 }
 
-int __init init_module (void)
+int init_module (void)
 {
        parse_options(options);
        return ide_init();
@@ -2069,6 +2074,7 @@ void cleanup_module (void)
 #ifdef CONFIG_PROC_FS
        proc_ide_destroy();
 #endif
+       devfs_remove("ide");
 
        bus_unregister(&ide_bus_type);
 }