Re: [PATCH 10/10] USB: OHCI: Properly handle ohci-spear suspend

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, 13 Jun 2013, Viresh Kumar wrote:

> > +       bool do_wakeup = device_may_wakeup(&pdev->dev);
> > +       int ret;
> > +
> > +       ret = ohci_suspend(hcd, do_wakeup);
> > +       if (ret == 0 && do_wakeup && HCD_WAKEUP_PENDING(hcd)) {
> 
> maybe s/ret == 0/!ret

I tend to prefer using ! for boolean values and == 0 for numeric 
values.  Just a matter of personal taste.

> I thought ret == 0 is the success case and not error case.
> 
> > +               ohci_resume(hcd, false);
> > +               ret = -EBUSY;
> > +       }

Yes, 0 is the success case.  You must not have seen the explanation for
this code; it is needed to handle a race.  If the suspend succeeds but
a wakeup request has already arrived, we need to undo the suspend.  
Obviously, if the suspend failed then there's no need to undo anything.

Alan Stern

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




[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux