]> Pileus Git - ~andy/linux/blobdiff - drivers/parport/daisy.c
Merge master.kernel.org:/home/rmk/linux-2.6-arm
[~andy/linux] / drivers / parport / daisy.c
index 6915114b95365806ba2925474ac42843ec60d5eb..fd41e28101eaa4b305230fccdaad77392847ab15 100644 (file)
@@ -144,9 +144,9 @@ again:
        add_dev (numdevs++, port, -1);
 
        /* Find out the legacy device's IEEE 1284 device ID. */
-       deviceid = kmalloc (1000, GFP_KERNEL);
+       deviceid = kmalloc (1024, GFP_KERNEL);
        if (deviceid) {
-               if (parport_device_id (numdevs - 1, deviceid, 1000) > 2)
+               if (parport_device_id (numdevs - 1, deviceid, 1024) > 2)
                        detected++;
 
                kfree (deviceid);
@@ -252,7 +252,7 @@ struct pardevice *parport_open (int devnum, const char *name,
                selected = port->daisy;
                parport_release (dev);
 
-               if (selected != port->daisy) {
+               if (selected != daisy) {
                        /* No corresponding device. */
                        parport_unregister_device (dev);
                        return NULL;
@@ -283,7 +283,7 @@ void parport_close (struct pardevice *dev)
  *
  *     This tries to locate a device on the given parallel port,
  *     multiplexor port and daisy chain address, and returns its
- *     device number or -NXIO if no device with those coordinates
+ *     device number or %-ENXIO if no device with those coordinates
  *     exists.
  **/
 
@@ -344,9 +344,9 @@ static int cpp_daisy (struct parport *port, int cmd)
                              PARPORT_CONTROL_STROBE,
                              PARPORT_CONTROL_STROBE);
        udelay (1);
+       s = parport_read_status (port);
        parport_frob_control (port, PARPORT_CONTROL_STROBE, 0);
        udelay (1);
-       s = parport_read_status (port);
        parport_write_data (port, 0xff); udelay (2);
 
        return s;
@@ -395,15 +395,15 @@ int parport_daisy_select (struct parport *port, int daisy, int mode)
                case IEEE1284_MODE_EPP:
                case IEEE1284_MODE_EPPSL:
                case IEEE1284_MODE_EPPSWE:
-                       return (cpp_daisy (port, 0x20 + daisy) &
-                               PARPORT_STATUS_ERROR);
+                       return !(cpp_daisy (port, 0x20 + daisy) &
+                                PARPORT_STATUS_ERROR);
 
                // For these modes we should switch to ECP mode:
                case IEEE1284_MODE_ECP:
                case IEEE1284_MODE_ECPRLE:
                case IEEE1284_MODE_ECPSWE: 
-                       return (cpp_daisy (port, 0xd0 + daisy) &
-                               PARPORT_STATUS_ERROR);
+                       return !(cpp_daisy (port, 0xd0 + daisy) &
+                                PARPORT_STATUS_ERROR);
 
                // Nothing was told for BECP in Daisy chain specification.
                // May be it's wise to use ECP?
@@ -413,8 +413,8 @@ int parport_daisy_select (struct parport *port, int daisy, int mode)
                case IEEE1284_MODE_BYTE:
                case IEEE1284_MODE_COMPAT:
                default:
-                       return (cpp_daisy (port, 0xe0 + daisy) &
-                               PARPORT_STATUS_ERROR);
+                       return !(cpp_daisy (port, 0xe0 + daisy) &
+                                PARPORT_STATUS_ERROR);
        }
 }
 
@@ -508,11 +508,11 @@ static int assign_addrs (struct parport *port)
                 detected);
 
        /* Ask the new devices to introduce themselves. */
-       deviceid = kmalloc (1000, GFP_KERNEL);
+       deviceid = kmalloc (1024, GFP_KERNEL);
        if (!deviceid) return 0;
 
        for (daisy = 0; thisdev < numdevs; thisdev++, daisy++)
-               parport_device_id (thisdev, deviceid, 1000);
+               parport_device_id (thisdev, deviceid, 1024);
 
        kfree (deviceid);
        return detected;