On Monday 27 August 2012 10:10:37 Sebastian Andrzej Siewior wrote:
> On 08/26/2012 09:34 PM, oli...@neukum.org wrote:
> > diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c
> > index c34452a..dcc10ac 100644
> > --- a/drivers/usb/dwc3/core.c
> > +++ b/drivers/usb/dwc3/core.c
> > @@ -99,6 +99,7 @@ void dwc3_put_device_id(int id)
> >
> >     ret = test_bit(id, dwc3_devs);
> >     WARN(!ret, "dwc3: ID %d not in use\n", id);
> > +   smp_mb__before_clear_bit();
> >     clear_bit(id, dwc3_devs);
> 
> Why before and not after?

While you own the device you may manipulate it and any
memory areas the HCD accesses. So the latest time you may
manipulate memory associated with the HCD is as you write
out the flag set to zero. You cannot do that, therefore the barrier
has to be before that.

> This has more a locking semantic. Would
> test_and_clear_bit() make the mb obsolete?

I have no idea. The thought is evil.

        Regards
                Oliver

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to