Re: [RFC PATCH 2/4] usb: chipidea: udc: add set_selfpowered gaget ops

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

 



On Tue, Jan 27, 2015 at 11:27:57AM -0500, Alan Stern wrote:
> On Tue, 27 Jan 2015, Peter Chen wrote:
> 
> > The gadget power property will be used at get_status request.
> > 
> > Signed-off-by: Peter Chen <peter.chen@xxxxxxxxxxxxx>
> > ---
> >  drivers/usb/chipidea/udc.c | 14 ++++++++++++++
> >  1 file changed, 14 insertions(+)
> > 
> > diff --git a/drivers/usb/chipidea/udc.c b/drivers/usb/chipidea/udc.c
> > index 540db0e..45914ba 100644
> > --- a/drivers/usb/chipidea/udc.c
> > +++ b/drivers/usb/chipidea/udc.c
> > @@ -841,6 +841,7 @@ __acquires(hwep->lock)
> >  	if ((setup->bRequestType & USB_RECIP_MASK) == USB_RECIP_DEVICE) {
> >  		/* Assume that device is bus powered for now. */
> >  		*(u16 *)req->buf = ci->remote_wakeup << 1;
> > +		*(u16 *)req->buf |= ci->gadget.is_selfpowered << 1;
> >  	} else if ((setup->bRequestType & USB_RECIP_MASK) \
> 
> When you add this line, don't you want to remove the comment two lines 
> above?
> 
> Also, you can simplify the code slightly by writing it like this:
> 
> 		*(u16 *) req->buf = (ci->remote_wakeup << 1) |
> 				ci->gadget.is_selfpowered;
> 
> Note that is_selfpowered should not be bit-shifted; 
> USB_DEVICE_SELF_POWERED is 0.
> 

Thanks, I will change.

-- 

Best Regards,
Peter Chen
--
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