Re: [PATCH 2/3] usb: gadget: introduce UDC Class

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

 



Sorry for second mail on the same patch, but this stroke me when I was
reviewing the third patch, and it seems like a big issue after all.

On Mon, 30 May 2011 19:28:34 +0200, Sebastian Andrzej Siewior wrote:
diff --git a/include/linux/usb/gadget.h b/include/linux/usb/gadget.h
index bf945c5..3d2d46f 100644
--- a/include/linux/usb/gadget.h
+++ b/include/linux/usb/gadget.h
@@ -718,6 +718,8 @@ static inline int usb_gadget_disconnect(struct usb_gadget *gadget)
  *	when the host is disconnected.  May be called in_interrupt; this
  *	may not sleep.  Some devices can't detect disconnect, so this might
  *	not be called except as part of controller shutdown.
+ * @bind: Invoked when the driver is bound to a UDC-driver. Called from UDC's
+ *      ->start() callback once there is a match between UDC and gadget.
  * @unbind: Invoked when the driver is unbound from a gadget,
  *	usually from rmmod (after a disconnect is reported).
  *	Called in a context that permits sleeping.
@@ -772,6 +774,7 @@ static inline int usb_gadget_disconnect(struct usb_gadget *gadget)
 struct usb_gadget_driver {
 	char			*function;
 	enum usb_device_speed	speed;
+	int			(*bind)(struct usb_gadget *gadget);
 	void			(*unbind)(struct usb_gadget *);
 	int			(*setup)(struct usb_gadget *,
 					const struct usb_ctrlrequest *);
@@ -795,19 +798,19 @@ struct usb_gadget_driver {
  */
/**
- * usb_gadget_probe_driver - probe a gadget driver
+ * usb_gadget_register_driver - register a gadget driver
  * @driver: the driver being registered
- * @bind: the driver's bind callback
  * Context: can sleep
  *
  * Call this in your gadget driver's module initialization function,
  * to tell the underlying usb controller driver about your driver.
- * The @bind() function will be called to bind it to a gadget before this - * registration call returns. It's expected that the @bind() function will
- * be in init sections.
+ * The @driver->bind() function will be called to bind it to a gadget before + * this registration call returns. It's expected that the @driver->bind()
+ * function will be in init sections.
  */
 int usb_gadget_probe_driver(struct usb_gadget_driver *driver,
 		int (*bind)(struct usb_gadget *));
+int usb_gadget_register_driver(struct usb_gadget_driver *driver);

Wasn't the whole point of introducing usb_gadget_probe_driver() and
removing bind callback to avoid problems with section mismatches?
Adding it back the way it was will bring all those warnings back.

Instead, it appears to me, we should leave usb_gadget_probe_driver()
the way it is and convert all drivers in the same patch or make the
new usb_gadget_register_driver() take the bind callback.  Personally,
I'd prefer the first approach as it seems *_probe_driver() matches
other similar functions' names.

--
Best regards,                                         _     _
.o. | Liege of Serenely Enlightened Majesty of      o' \,=./ `o
..o | Computer Science,  Michal "mina86" Nazarewicz    (o o)
ooo +-----<email/xmpp: mnazarewicz@xxxxxxxxxx>-----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