Re: [RFC/PATCH v2 1/3] usb: gadget: introduce start() and stop()

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

 



On Thu, 16 Sep 2010 11:43:01 +0200, Felipe Balbi <balbi@xxxxxx> wrote:

On Thu, Sep 16, 2010 at 04:10:49AM -0500, Michał Nazarewicz wrote:
I don't understand one thing.  Isn't bind() and unbind() enough for that?

bind() unbind() is for the gadget driver, these are for the controller
(musb, omap_udc, dummy, etc).

Ah, right, forgot that usb_gaget_register_driver() is no longer
controlled by the UDC.

+ *
+ * Returns zero on success, else negative errno.
+ */
+static inline int usb_gadget_start(struct usb_gadget *gadget)
+{
+	if (!gadget->ops->start)
+		return -EOPNOTSUPP;

Wouldn't it be better to return 0 here?

nope, this is necessary for the framework to actually work. Otherwise
the controller has no way to now it has to e.g. enable clocks, setup
control register, etc.

My point is that if usb_gadget_start() returns error when start is not
set, no gadget driver can be registered.  In other words, usb_udc_add()
should verify that start and stop operations are implemented.

Moreover, I wonder if it's good idea to export usb_gadget_start() and
usb_gadget_stop() functions.  Will anyone other then the class use
those?

--
Best regards,                                        _     _
| Humble Liege of Serenely Enlightened Majesty of  o' \,=./ `o
| Computer Science,  Michał "mina86" Nazarewicz       (o o)
+----[mina86*mina86.com]---[mina86*jabber.org]----ooO--(_)--Ooo--
--
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