This patch also gets rid of the warning that happens when
request_module("parport_lowlevel") works.
Comments?
Tim.
*/
1999-12-24 <twaugh@twaugh.surrey.redhat.com>
* share.c (get_lowlevel_driver): New function. Don't warn.
(parport_register_driver): Use it.
(parport_enumerate): Likewise.
(parport_unregister_driver): Call drv->detach with each port.
Index: linux/drivers/parport/share.c
diff -u linux/drivers/parport/share.c:1.4 linux/drivers/parport/share.c:1.5
--- linux/drivers/parport/share.c:1.4 Mon Dec 13 12:16:35 1999
+++ linux/drivers/parport/share.c Fri Dec 24 11:17:01 1999
@@ -95,6 +95,14 @@
}
}
+/* Ask kmod for some lowlevel drivers. */
+static void get_lowlevel_driver (void)
+{
+ /* There is no actual module called this: you should set
+ * up an alias for modutils. */
+ request_module ("parport_lowlevel");
+}
+
int parport_register_driver (struct parport_driver *drv)
{
struct parport *port;
@@ -107,12 +115,8 @@
for (port = portlist; port; port = port->next)
drv->attach (port);
- /* For compatibility with 2.2, check the (obsolete) parport_lowlevel
- * alias in case some people haven't changed to post-install rules
- * yet. parport_enumerate (itself deprecated) will printk a
- * friendly reminder. */
if (!portlist)
- parport_enumerate ();
+ get_lowlevel_driver ();
return 0;
}
@@ -123,12 +127,21 @@
while (drv) {
if (drv == arg) {
+ struct parport *port;
+
spin_lock (&driverlist_lock);
if (olddrv)
olddrv->next = drv->next;
else
driver_chain = drv->next;
spin_unlock (&driverlist_lock);
+
+ /* Call the driver's detach routine for each
+ * port to clean up any resources that the
+ * attach routine acquired. */
+ for (port = portlist; port; port = port->next)
+ drv->detach (port);
+
return;
}
olddrv = drv;
@@ -136,20 +149,12 @@
}
}
-/* Return a list of all the ports we know about. */
+/* Return a list of all the ports we know about. This function shouldn't
+ * really be used -- use parport_register_driver instead. */
struct parport *parport_enumerate(void)
{
- /* Attempt to make things work on 2.2 systems. */
- if (!portlist) {
- request_module ("parport_lowlevel");
- if (portlist)
- /* The user has a parport_lowlevel alias in
- * modules.conf. Warn them that it won't work
- * for long. */
- printk (KERN_WARNING
- "parport: 'parport_lowlevel' is deprecated; "
- "see parport.txt\n");
- }
+ if (!portlist)
+ get_lowlevel_driver ();
return portlist;
}
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/