Re: [RFC 14/17] usb/hcd: add one-time init callback to usb_add_hcd()

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

 



Hello.

On 29-08-2011 1:21, Sebastian Andrzej Siewior wrote:

This patch introduces usb_add_hcd_init(). Its purpose is the same as of
usb_add_hcd() except it takes a one-time-init callback. This callback
should take over from ->reset() in hc_driver. It executed only once and
therefore not required for the complete runtime.
If the one_time callback is specified, the ->reset() callback is omited.

Signed-off-by: Sebastian Andrzej Siewior<sebastian@xxxxxxxxxxxxx>
---
  drivers/usb/core/hcd.c  |   19 ++++++++++++++-----
  include/linux/usb/hcd.h |   11 +++++++++--
  2 files changed, 23 insertions(+), 7 deletions(-)

diff --git a/drivers/usb/core/hcd.c b/drivers/usb/core/hcd.c
index 73cbbd8..a761a76 100644
--- a/drivers/usb/core/hcd.c
+++ b/drivers/usb/core/hcd.c
@@ -2376,8 +2376,8 @@ static int usb_hcd_request_irqs(struct usb_hcd *hcd,
   * buffers of consistent memory, register the bus, request the IRQ line,
   * and call the driver's reset() and start() routines.
   */
-int usb_add_hcd(struct usb_hcd *hcd,
-		unsigned int irqnum, unsigned long irqflags)
+int usb_add_hcd_init(struct usb_hcd *hcd, u32 irqnum, unsigned long irqflags,
+		 hcd_ot_init ot_init, void *ot_priv)

   Why extra space here? Either align to '(' above, or use only tabs to indent.

@@ -2440,9 +2440,18 @@ int usb_add_hcd(struct usb_hcd *hcd,
  	/* "reset" is misnamed; its role is now one-time init. the controller
  	 * should already have been reset (and boot firmware kicked off etc).
  	 */
-	if (hcd->driver->reset&&  (retval = hcd->driver->reset(hcd))<  0) {
-		dev_err(hcd->self.controller, "can't setup\n");
-		goto err_hcd_driver_setup;
+	if (ot_init) {
+		retval = ot_init(hcd, ot_priv);
+		if (retval) {
+			dev_err(hcd->self.controller, "can't perform init)\n");

   ')' not needed before '\n'.

diff --git a/include/linux/usb/hcd.h b/include/linux/usb/hcd.h
index d29a8a0..c0619af 100644
--- a/include/linux/usb/hcd.h
+++ b/include/linux/usb/hcd.h
@@ -380,8 +380,15 @@ extern struct usb_hcd *usb_create_shared_hcd(const struct hc_driver *driver,
  extern struct usb_hcd *usb_get_hcd(struct usb_hcd *hcd);
  extern void usb_put_hcd(struct usb_hcd *hcd);
  extern int usb_hcd_is_primary_hcd(struct usb_hcd *hcd);
-extern int usb_add_hcd(struct usb_hcd *hcd,
-		unsigned int irqnum, unsigned long irqflags);
+
+typedef int (*hcd_ot_init)(struct usb_hcd *hcd, void *priv);

   Er, doesn't checkpatch.pl complain about 'typedef'?

WBR, Sergei
--
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