patch-2.1.48 linux/drivers/misc/parport_share.c

Next file: linux/drivers/net/myri_sbus.c
Previous file: linux/drivers/misc/parport_procfs.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.1.47/linux/drivers/misc/parport_share.c linux/drivers/misc/parport_share.c
@@ -88,6 +88,23 @@
 	return tmp;
 }
 
+void parport_unregister_port(struct parport *port)
+{
+	struct parport *p;
+	kfree(port->name);
+	if (portlist == port) {
+		portlist = port->next;
+	} else {
+		for (p = portlist; (p != NULL) && (p->next != port); 
+		     p=p->next);
+		if (p) {
+			if ((p->next = port->next) == NULL)
+				portlist_tail = p;
+		}
+	}
+	kfree(port);
+}
+
 void parport_quiesce(struct parport *port)
 {
 	if (port->devices) {
@@ -106,7 +123,7 @@
 }
 
 struct pardevice *parport_register_device(struct parport *port, const char *name,
-			  int (*pf)(void *), int (*kf)(void *),
+			  int (*pf)(void *), void (*kf)(void *),
 			  void (*irq_func)(int, void *, struct pt_regs *), 
 			  int flags, void *handle)
 {
@@ -223,7 +240,6 @@
 	pd1 = dev->port->cad;
 	if (dev->port->cad) {
 		if (dev->port->cad->preempt) {
-			/* Now try to preempt */
 			if (dev->port->cad->preempt(dev->port->cad->private))
 				return -EAGAIN;
 			dev->port->ops->save_state(dev->port, dev->state);
@@ -301,19 +317,10 @@
 	}
 
 	/* Now give the lurker a chance.
-	 * There should be a wakeup callback because we checked for it
+	 * There must be a wakeup callback because we checked for it
 	 * at registration.
 	 */
 	if (dev->port->lurker && (dev->port->lurker != dev)) {
-		if (dev->port->lurker->wakeup) {
-			dev->port->lurker->wakeup(dev->port->lurker->private);
-		} 
-#ifdef PARPORT_PARANOID
-		else {  /* can't happen */
-			printk(KERN_DEBUG
-			  "%s (%s): lurker's wakeup callback went away!\n",
-			       dev->port->name, dev->name);
-		}
-#endif
+		dev->port->lurker->wakeup(dev->port->lurker->private);
 	}
 }

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov