lkml.org 
[lkml]   [2008]   [Aug]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: [PATCH] USB: add USB test and measurement class driver - round 2
Date
Am Mittwoch 27 August 2008 20:28:22 schrieb Alan Stern:
> On Wed, 27 Aug 2008, Greg KH wrote:
>
> > Here's an updated version of the usbtmc driver, with all of the
> > different issues that have been raised, hopefully addressed.
>
> This is an example of what I was discussing with Oliver.  In all
> likelihood you simply don't need usbtmc_mutex, and using it will cause
> a lockdep violation.
>
> That's why so many of the other USB class drivers don't have an
> analogous static mutex.
>
> > +static int usbtmc_open(struct inode *inode, struct file *filp)
> > +{
> > +     struct usb_interface *intf;
> > +     struct usbtmc_device_data *data;
> > +     int retval = -ENODEV;
> > +
> > +     mutex_lock(&usbtmc_mutex);
>
> You must never acquire a lock in your open method if it will be held
> by your disconnect method while unregistering the minor.

And this rule depends on sharing the USB major or not. This needs
a big fat mention in Documentation.

Regards
Oliver

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2008-08-27 20:39    [W:0.083 / U:1.084 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site