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]

 



On Mon, Aug 29, 2011 at 02:32:50PM +0400, Sergei Shtylyov wrote:
> Hello.
Hello Sergei,

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

vim accident.

> >@@ -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'.
sure.

> >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'?

a typdef for a function pointer is cute as it saves key strokes and hiding
anything "huge".

> WBR, Sergei

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