patch-2.4.0-test5 linux/drivers/parport/share.c

Next file: linux/drivers/pci/pci.ids
Previous file: linux/drivers/parport/ieee1284.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.4.0-test4/linux/drivers/parport/share.c linux/drivers/parport/share.c
@@ -10,10 +10,9 @@
  * based on work by Grant Guenther <grant@torque.net>
  *          and Philip Blundell
  *
- * The block comments above the functions in this file are
- * licensed as part of the generated file
- * Documentation/DocBook/parportbook.sgml under the GNU Free
- * Documentation License.
+ * Any part of this program may be used in documents licensed under
+ * the GNU Free Documentation License, Version 1.1 or any later version
+ * published by the Free Software Foundation.
  */
 
 #undef PARPORT_DEBUG_SHARING		/* undef for production */
@@ -122,11 +121,11 @@
 
 	spin_lock (&driverlist_lock);
 	for (i = 0, drv = driver_chain; drv && i < count; drv = drv->next)
-		attach[i] = drv->attach;
+		attach[i++] = drv->attach;
 	spin_unlock (&driverlist_lock);
 
 	for (count = 0; count < i; count++)
-		(*attach[i]) (port);
+		(*attach[count]) (port);
 
 	kfree (attach);
 }
@@ -181,6 +180,9 @@
 	struct parport **ports;
 	int count = 0, i;
 
+	if (!portlist)
+		get_lowlevel_driver ();
+
 	/* We have to take the portlist lock for this to be sure
 	 * that port is valid for the duration of the callback. */
 
@@ -201,7 +203,7 @@
 		spin_lock (&parportlist_lock);
 		for (i = 0, port = portlist; port && i < count;
 		     port = port->next)
-			ports[i] = port;
+			ports[i++] = port;
 		spin_unlock (&parportlist_lock);
 
 		for (count = 0; count < i; count++)
@@ -209,9 +211,6 @@
 
 		kfree (ports);
 	}
-
-	if (!portlist)
-		get_lowlevel_driver ();
 
 	spin_lock (&driverlist_lock);
 	drv->next = driver_chain;

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)