Re: Lockdep false positive in sysfs
From: Alan Stern
Date: Mon May 07 2012 - 17:51:49 EST
On Mon, 7 May 2012, Tejun Heo wrote:
> Hello, Alan.
Hi.
> On Fri, May 04, 2012 at 03:08:53PM -0400, Alan Stern wrote:
> > @@ -588,10 +591,15 @@ static ssize_t usb_dev_authorized_store(
> > result = sscanf(buf, "%u\n", &val);
> > if (result != 1)
> > result = -EINVAL;
> > - else if (val == 0)
> > + else if (val == 0) {
> > + void *cookie;
> > +
> > + cookie = device_start_attribute_infanticide(dev, attr, NULL);
> > result = usb_deauthorize_device(usb_dev);
> > - else
> > + device_end_attribute_infanticide(cookie);
> > + } else {
> > result = usb_authorize_device(usb_dev);
> > + }
>
> I *think* it looks way too huge as lockdep workaround. We're adding a
Well, it's not _terribly_ huge. As far as the driver is concerned,
it's just a start and an end call. The lookup interface isn't even
EXPORTed, because its only user is the device core.
> whole separate lookup interface for this. If looking up afterwards is
> difficult, can't we get away with adding a field in struct attribute?
You mean, an "ignore this attribute for lockdep purposes" flag? Yes,
that would work just as well.
I guess in the end it's a question of balance. Which has more
overhead, adding a few function calls here and there, or adding a new
flags field to every struct attribute?
Alan Stern
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/