On Tue, 3 Jun 2014, Pantelis Koukousoulas wrote:
> dummy_start() and dummy_start_ss() do mostly the same things
> so just merge them into a simpler / easier to maintain dummy_start().
>
> Signed-off-by: Pantelis Koukousoulas <[email protected]>
> ---
> drivers/usb/gadget/dummy_hcd.c | 35 +++++++----------------------------
> 1 file changed, 7 insertions(+), 28 deletions(-)
>
> diff --git a/drivers/usb/gadget/dummy_hcd.c b/drivers/usb/gadget/dummy_hcd.c
> index 8c06430..5b67c75 100644
> --- a/drivers/usb/gadget/dummy_hcd.c
> +++ b/drivers/usb/gadget/dummy_hcd.c
> @@ -2314,39 +2314,13 @@ static ssize_t urbs_show(struct device *dev, struct
> device_attribute *attr,
> }
> static DEVICE_ATTR_RO(urbs);
>
> -static int dummy_start_ss(struct dummy_hcd *dum_hcd)
> -{
> - init_timer(&dum_hcd->timer);
> - dum_hcd->timer.function = dummy_timer;
> - dum_hcd->timer.data = (unsigned long)dum_hcd;
> - dum_hcd->rh_state = DUMMY_RH_RUNNING;
> - dum_hcd->stream_en_ep = 0;
> - INIT_LIST_HEAD(&dum_hcd->urbp_list);
> - dummy_hcd_to_hcd(dum_hcd)->power_budget = POWER_BUDGET;
> - dummy_hcd_to_hcd(dum_hcd)->state = HC_STATE_RUNNING;
> - dummy_hcd_to_hcd(dum_hcd)->uses_new_polling = 1;
> -#ifdef CONFIG_USB_OTG
> - dummy_hcd_to_hcd(dum_hcd)->self.otg_port = 1;
> -#endif
> - return 0;
> -
> - /* FIXME 'urbs' should be a per-device thing, maybe in usbcore */
> - return device_create_file(dummy_dev(dum_hcd), &dev_attr_urbs);
> -}
> -
> static int dummy_start(struct usb_hcd *hcd)
> {
> struct dummy_hcd *dum_hcd = hcd_to_dummy_hcd(hcd);
>
> - /*
> - * MASTER side init ... we emulate a root hub that'll only ever
> - * talk to one device (the slave side). Also appears in sysfs,
> - * just like more familiar pci-based HCDs.
> - */
Like I said before, please do not remove this comment.
> - if (!usb_hcd_is_primary_hcd(hcd))
> - return dummy_start_ss(dum_hcd);
> + if (usb_hcd_is_primary_hcd(hcd))
> + spin_lock_init(&dum_hcd->dum->lock);
>
> - spin_lock_init(&dum_hcd->dum->lock);
> init_timer(&dum_hcd->timer);
> dum_hcd->timer.function = dummy_timer;
> dum_hcd->timer.data = (unsigned long)dum_hcd;
> @@ -2362,6 +2336,11 @@ static int dummy_start(struct usb_hcd *hcd)
> hcd->self.otg_port = 1;
> #endif
>
> + if (!usb_hcd_is_primary_hcd(hcd)) {
> + dum_hcd->stream_en_ep = 0;
> + return 0;
> + }
> +
> /* FIXME 'urbs' should be a per-device thing, maybe in usbcore */
> return device_create_file(dummy_dev(dum_hcd), &dev_attr_urbs);
> }
When you put the comment back, you can add
Acked-by: Alan Stern <[email protected]>
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html