vserver 1.9.5.x5
[linux-2.6.git] / drivers / block / xd.c
index 5ca834f..3fbadc8 100644 (file)
@@ -123,7 +123,7 @@ static unsigned int xd_bases[] __initdata =
        0xE0000
 };
 
-static spinlock_t xd_lock = SPIN_LOCK_UNLOCKED;
+static DEFINE_SPINLOCK(xd_lock);
 
 static struct gendisk *xd_gendisk[2];
 
@@ -266,7 +266,7 @@ Enomem:
 /* xd_detect: scan the possible BIOS ROM locations for the signature strings */
 static u_char __init xd_detect (u_char *controller, unsigned int *address)
 {
-       u_char i,j,found = 0;
+       int i, j;
 
        if (xd_override)
        {
@@ -275,15 +275,23 @@ static u_char __init xd_detect (u_char *controller, unsigned int *address)
                return(1);
        }
 
-       for (i = 0; i < (sizeof(xd_bases) / sizeof(xd_bases[0])) && !found; i++)
-               for (j = 1; j < (sizeof(xd_sigs) / sizeof(xd_sigs[0])) && !found; j++)
-                       if (isa_check_signature(xd_bases[i] + xd_sigs[j].offset,xd_sigs[j].string,strlen(xd_sigs[j].string))) {
+       for (i = 0; i < (sizeof(xd_bases) / sizeof(xd_bases[0])); i++) {
+               void __iomem *p = ioremap(xd_bases[i], 0x2000);
+               if (!p)
+                       continue;
+               for (j = 1; j < (sizeof(xd_sigs) / sizeof(xd_sigs[0])); j++) {
+                       const char *s = xd_sigs[j].string;
+                       if (check_signature(p + xd_sigs[j].offset, s, strlen(s))) {
                                *controller = j;
                                xd_type = j;
                                *address = xd_bases[i];
-                               found++;
+                               iounmap(p);
+                               return 1;
                        }
-       return (found);
+               }
+               iounmap(p);
+       }
+       return 0;
 }
 
 /* do_xd_request: handle an incoming request */
@@ -1046,9 +1054,9 @@ static void __init xd_setparam (u_char command,u_char drive,u_char heads,u_short
 
 #ifdef MODULE
 
-MODULE_PARM(xd, "1-4i");
-MODULE_PARM(xd_geo, "3-6i");
-MODULE_PARM(nodma, "i");
+module_param_array(xd, int, NULL, 0);
+module_param_array(xd_geo, int, NULL, 0);
+module_param(nodma, bool, 0);
 
 MODULE_LICENSE("GPL");