All of lore.kernel.org
 help / color / mirror / Atom feed
* usblp BKL removal
@ 2004-10-05  0:23 Pete Zaitcev
  2004-10-20 23:16 ` Greg KH
  0 siblings, 1 reply; 2+ messages in thread
From: Pete Zaitcev @ 2004-10-05  0:23 UTC (permalink / raw)
  To: vojtech; +Cc: zaitcev, linux-kernel, greg

Hello, Vojtech,

the appended patch is not in yet, what gives? I sent it to Marcelo with
an understanding that it would be in Linus tree any day now. It was a couple
of months ago. It's not just BKL witchhunt either. I remember that it fixed
an oops, although I do not remember the precise scenario by now (it had
something to do with a race between ->release and ->disconnect).

-- Pete

--- linux-2.6.9-rc3-mm2/drivers/usb/class/usblp.c	2004-10-04 16:59:42.849589554 -0700
+++ linux-2.6.9-rc3-mm2-usblp/drivers/usb/class/usblp.c	2004-10-04 17:15:42.983282509 -0700
@@ -222,6 +222,7 @@
 
 /* forward reference to make our lives easier */
 static struct usb_driver usblp_driver;
+static DECLARE_MUTEX(usblp_sem);	/* locks the existence of usblp's */
 
 /*
  * Functions for usblp control messages.
@@ -343,7 +344,7 @@
 	if (minor < 0)
 		return -ENODEV;
 
-	lock_kernel();
+	down (&usblp_sem);
 
 	retval = -ENODEV;
 	intf = usb_find_interface(&usblp_driver, minor);
@@ -389,7 +390,7 @@
 		}
 	}
 out:
-	unlock_kernel();
+	up (&usblp_sem);
 	return retval;
 }
 
@@ -415,13 +416,13 @@
 {
 	struct usblp *usblp = file->private_data;
 
-	down (&usblp->sem);
+	down (&usblp_sem);
 	usblp->used = 0;
 	if (usblp->present) {
 		usblp_unlink_urbs(usblp);
-		up(&usblp->sem);
 	} else 		/* finish cleanup from disconnect */
 		usblp_cleanup (usblp);
+	up (&usblp_sem);
 	return 0;
 }
 
@@ -1149,8 +1150,8 @@
 		BUG ();
 	}
 
+	down (&usblp_sem);
 	down (&usblp->sem);
-	lock_kernel();
 	usblp->present = 0;
 	usb_set_intfdata (intf, NULL);
 
@@ -1159,12 +1160,11 @@
 			usblp->writebuf, usblp->writeurb->transfer_dma);
 	usb_buffer_free (usblp->dev, USBLP_BUF_SIZE,
 			usblp->readbuf, usblp->readurb->transfer_dma);
+	up (&usblp->sem);
 
 	if (!usblp->used)
 		usblp_cleanup (usblp);
-	else 	/* cleanup later, on release */
-		up (&usblp->sem);
-	unlock_kernel();
+	up (&usblp_sem);
 }
 
 static struct usb_device_id usblp_ids [] = {

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2004-10-20 23:57 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-10-05  0:23 usblp BKL removal Pete Zaitcev
2004-10-20 23:16 ` Greg KH

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.