]> err.no Git - linux-2.6/blobdiff - drivers/ide/ide.c
Merge branch 'core/rcu' into core/rcu-for-linus
[linux-2.6] / drivers / ide / ide.c
index f65be738b16ac0ffba8b936529d40cee1c252bcf..2b8453510e0900211b21ad6d742070fac1556151 100644 (file)
@@ -87,9 +87,9 @@ static const u8 ide_hwif_to_major[] = { IDE0_MAJOR, IDE1_MAJOR,
                                        IDE8_MAJOR, IDE9_MAJOR };
 
 DEFINE_MUTEX(ide_cfg_mtx);
- __cacheline_aligned_in_smp DEFINE_SPINLOCK(ide_lock);
 
-int noautodma = 0;
+__cacheline_aligned_in_smp DEFINE_SPINLOCK(ide_lock);
+EXPORT_SYMBOL(ide_lock);
 
 ide_hwif_t ide_hwifs[MAX_HWIFS];       /* master data repository */
 
@@ -136,7 +136,6 @@ static void ide_port_init_devices_data(ide_hwif_t *hwif)
                drive->media                    = ide_disk;
                drive->select.all               = (unit<<4)|0xa0;
                drive->hwif                     = hwif;
-               drive->ctl                      = 0x08;
                drive->ready_stat               = READY_STAT;
                drive->bad_wstat                = BAD_W_STAT;
                drive->special.b.recalibrate    = 1;
@@ -151,32 +150,9 @@ static void ide_port_init_devices_data(ide_hwif_t *hwif)
        }
 }
 
-/*
- * init_ide_data() sets reasonable default values into all fields
- * of all instances of the hwifs and drives, but only on the first call.
- * Subsequent calls have no effect (they don't wipe out anything).
- *
- * This routine is normally called at driver initialization time,
- * but may also be called MUCH earlier during kernel "command-line"
- * parameter processing.  As such, we cannot depend on any other parts
- * of the kernel (such as memory allocation) to be functioning yet.
- *
- * This is too bad, as otherwise we could dynamically allocate the
- * ide_drive_t structs as needed, rather than always consuming memory
- * for the max possible number (MAX_HWIFS * MAX_DRIVES) of them.
- *
- * FIXME: We should stuff the setup data into __init and copy the
- * relevant hwifs/allocate them properly during boot.
- */
-#define MAGIC_COOKIE 0x12345678
 static void __init init_ide_data (void)
 {
        unsigned int index;
-       static unsigned long magic_cookie = MAGIC_COOKIE;
-
-       if (magic_cookie != MAGIC_COOKIE)
-               return;         /* already initialized */
-       magic_cookie = 0;
 
        /* Initialise all interface structures */
        for (index = 0; index < MAX_HWIFS; ++index) {
@@ -721,197 +697,6 @@ set_val:
 
 EXPORT_SYMBOL(generic_ide_ioctl);
 
-/*
- * stridx() returns the offset of c within s,
- * or -1 if c is '\0' or not found within s.
- */
-static int __init stridx (const char *s, char c)
-{
-       char *i = strchr(s, c);
-       return (i && c) ? i - s : -1;
-}
-
-/*
- * match_parm() does parsing for ide_setup():
- *
- * 1. the first char of s must be '='.
- * 2. if the remainder matches one of the supplied keywords,
- *     the index (1 based) of the keyword is negated and returned.
- * 3. if the remainder is a series of no more than max_vals numbers
- *     separated by commas, the numbers are saved in vals[] and a
- *     count of how many were saved is returned.  Base10 is assumed,
- *     and base16 is allowed when prefixed with "0x".
- * 4. otherwise, zero is returned.
- */
-static int __init match_parm (char *s, const char *keywords[], int vals[], int max_vals)
-{
-       static const char *decimal = "0123456789";
-       static const char *hex = "0123456789abcdef";
-       int i, n;
-
-       if (*s++ == '=') {
-               /*
-                * Try matching against the supplied keywords,
-                * and return -(index+1) if we match one
-                */
-               if (keywords != NULL) {
-                       for (i = 0; *keywords != NULL; ++i) {
-                               if (!strcmp(s, *keywords++))
-                                       return -(i+1);
-                       }
-               }
-               /*
-                * Look for a series of no more than "max_vals"
-                * numeric values separated by commas, in base10,
-                * or base16 when prefixed with "0x".
-                * Return a count of how many were found.
-                */
-               for (n = 0; (i = stridx(decimal, *s)) >= 0;) {
-                       vals[n] = i;
-                       while ((i = stridx(decimal, *++s)) >= 0)
-                               vals[n] = (vals[n] * 10) + i;
-                       if (*s == 'x' && !vals[n]) {
-                               while ((i = stridx(hex, *++s)) >= 0)
-                                       vals[n] = (vals[n] * 0x10) + i;
-                       }
-                       if (++n == max_vals)
-                               break;
-                       if (*s == ',' || *s == ';')
-                               ++s;
-               }
-               if (!*s)
-                       return n;
-       }
-       return 0;       /* zero = nothing matched */
-}
-
-/*
- * ide_setup() gets called VERY EARLY during initialization,
- * to handle kernel "command line" strings beginning with "hdx=" or "ide".
- *
- * Remember to update Documentation/ide/ide.txt if you change something here.
- */
-static int __init ide_setup(char *s)
-{
-       ide_hwif_t *hwif;
-       ide_drive_t *drive;
-       unsigned int hw, unit;
-       int vals[3];
-       const char max_drive = 'a' + ((MAX_HWIFS * MAX_DRIVES) - 1);
-
-       if (strncmp(s,"hd",2) == 0 && s[2] == '=')      /* hd= is for hd.c   */
-               return 0;                               /* driver and not us */
-
-       if (strncmp(s, "ide", 3) && strncmp(s, "hd", 2))
-               return 0;
-
-       printk(KERN_INFO "ide_setup: %s", s);
-       init_ide_data ();
-
-#ifdef CONFIG_BLK_DEV_IDEDOUBLER
-       if (!strcmp(s, "ide=doubler")) {
-               extern int ide_doubler;
-
-               printk(" : Enabled support for IDE doublers\n");
-               ide_doubler = 1;
-               goto obsolete_option;
-       }
-#endif /* CONFIG_BLK_DEV_IDEDOUBLER */
-
-       if (!strcmp(s, "ide=nodma")) {
-               printk(" : Prevented DMA\n");
-               noautodma = 1;
-               goto obsolete_option;
-       }
-
-#ifdef CONFIG_BLK_DEV_IDEACPI
-       if (!strcmp(s, "ide=noacpi")) {
-               //printk(" : Disable IDE ACPI support.\n");
-               ide_noacpi = 1;
-               goto obsolete_option;
-       }
-       if (!strcmp(s, "ide=acpigtf")) {
-               //printk(" : Enable IDE ACPI _GTF support.\n");
-               ide_acpigtf = 1;
-               goto obsolete_option;
-       }
-       if (!strcmp(s, "ide=acpionboot")) {
-               //printk(" : Call IDE ACPI methods on boot.\n");
-               ide_acpionboot = 1;
-               goto obsolete_option;
-       }
-#endif /* CONFIG_BLK_DEV_IDEACPI */
-
-       /*
-        * Look for drive options:  "hdx="
-        */
-       if (s[0] == 'h' && s[1] == 'd' && s[2] >= 'a' && s[2] <= max_drive) {
-               const char *hd_words[] = {
-                       "none", "noprobe", "nowerr", "cdrom", "nodma",
-                       "-6", "-7", "-8", "-9", "-10",
-                       "noflush", "remap", "remap63", "scsi", NULL };
-               unit = s[2] - 'a';
-               hw   = unit / MAX_DRIVES;
-               unit = unit % MAX_DRIVES;
-               hwif = &ide_hwifs[hw];
-               drive = &hwif->drives[unit];
-               if (strncmp(s + 4, "ide-", 4) == 0) {
-                       strlcpy(drive->driver_req, s + 4, sizeof(drive->driver_req));
-                       goto obsolete_option;
-               }
-               switch (match_parm(&s[3], hd_words, vals, 3)) {
-                       case -1: /* "none" */
-                       case -2: /* "noprobe" */
-                               drive->noprobe = 1;
-                               goto obsolete_option;
-                       case -3: /* "nowerr" */
-                               drive->bad_wstat = BAD_R_STAT;
-                               goto obsolete_option;
-                       case -4: /* "cdrom" */
-                               drive->present = 1;
-                               drive->media = ide_cdrom;
-                               /* an ATAPI device ignores DRDY */
-                               drive->ready_stat = 0;
-                               goto obsolete_option;
-                       case -5: /* nodma */
-                               drive->nodma = 1;
-                               goto obsolete_option;
-                       case -11: /* noflush */
-                               drive->noflush = 1;
-                               goto obsolete_option;
-                       case -12: /* "remap" */
-                               drive->remap_0_to_1 = 1;
-                               goto obsolete_option;
-                       case -13: /* "remap63" */
-                               drive->sect0 = 63;
-                               goto obsolete_option;
-                       case -14: /* "scsi" */
-                               drive->scsi = 1;
-                               goto obsolete_option;
-                       case 3: /* cyl,head,sect */
-                               drive->media    = ide_disk;
-                               drive->ready_stat = READY_STAT;
-                               drive->cyl      = drive->bios_cyl  = vals[0];
-                               drive->head     = drive->bios_head = vals[1];
-                               drive->sect     = drive->bios_sect = vals[2];
-                               drive->present  = 1;
-                               drive->forced_geom = 1;
-                               goto obsolete_option;
-                       default:
-                               goto bad_option;
-               }
-       }
-
-bad_option:
-       printk(" -- BAD OPTION\n");
-       return 1;
-obsolete_option:
-       printk(" -- OBSOLETE OPTION, WILL BE REMOVED SOON!\n");
-       return 1;
-}
-
-EXPORT_SYMBOL(ide_lock);
-
 static int ide_bus_match(struct device *dev, struct device_driver *drv)
 {
        return 1;
@@ -1248,32 +1033,7 @@ out_port_class:
        return ret;
 }
 
-#ifdef MODULE
-static char *options = NULL;
-module_param(options, charp, 0);
-MODULE_LICENSE("GPL");
-
-static void __init parse_options (char *line)
-{
-       char *next = line;
-
-       if (line == NULL || !*line)
-               return;
-       while ((line = next) != NULL) {
-               if ((next = strchr(line,' ')) != NULL)
-                       *next++ = 0;
-               if (!ide_setup(line))
-                       printk (KERN_INFO "Unknown option '%s'\n", line);
-       }
-}
-
-int __init init_module (void)
-{
-       parse_options(options);
-       return ide_init();
-}
-
-void __exit cleanup_module (void)
+static void __exit ide_exit(void)
 {
        proc_ide_destroy();
 
@@ -1282,10 +1042,7 @@ void __exit cleanup_module (void)
        bus_unregister(&ide_bus_type);
 }
 
-#else /* !MODULE */
-
-__setup("", ide_setup);
-
 module_init(ide_init);
+module_exit(ide_exit);
 
-#endif /* MODULE */
+MODULE_LICENSE("GPL");