Re: [PATCH 1/5] usb: musb: call musb_start() only once in OTG mode

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

 



On 10/15/2013 07:43 PM, Felipe Balbi wrote:
> Hi,

Hi,

>> index d1d6b83..9af6bba 100644 ---
>> a/drivers/usb/musb/musb_virthub.c +++
>> b/drivers/usb/musb/musb_virthub.c @@ -220,6 +220,23 @@ int
>> musb_hub_status_data(struct usb_hcd *hcd, char *buf) return
>> retval; }
>> 
>> +static int musb_has_gadget(struct musb *musb) +{ +	/* +	 * In
>> host-only mode we start a connection right away. In OTG mode +	 *
>> we have to wait until we loaded a gadget. We don't really need a 
>> +	 * gadget if we operate as a host but we should not start a
>> session +	 * as a device without a gadget or else we explode. +
>> */ +#ifdef CONFIG_USB_MUSB_HOST +	return 1; +#else +	if
>> (musb->port_mode == MUSB_PORT_MODE_HOST) +		return 1; +	return
>> musb->g.dev.driver != NULL; +#endif
> 
> the logic looks inverted :-s has_gadget() is true when port mode is
> host or we're in host-only builds :-(

No, that is okay. As the comment says in host-only mode we never have a
gadget therefore we always return 1 (as we never get a second chance to
power up the port).

If you don't like the "has_gadget" part here I could rename it to
"musb_can_power_port" how about it?

Sebastian
--
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