[PATCH 1/3] usb: gadget: dummy_hcd: simplify dummy_start()

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

 



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 <pktoss@xxxxxxxxx>
Acked-by: Alan Stern <stern@xxxxxxxxxxxxxxxxxxx>
---
 drivers/usb/gadget/dummy_hcd.c | 30 +++++++-----------------------
 1 file changed, 7 insertions(+), 23 deletions(-)

diff --git a/drivers/usb/gadget/dummy_hcd.c b/drivers/usb/gadget/dummy_hcd.c
index 8c06430..853dd16 100644
--- a/drivers/usb/gadget/dummy_hcd.c
+++ b/drivers/usb/gadget/dummy_hcd.c
@@ -2314,26 +2314,6 @@ 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);
@@ -2343,10 +2323,9 @@ static int dummy_start(struct usb_hcd *hcd)
 	 * talk to one device (the slave side).  Also appears in sysfs,
 	 * just like more familiar pci-based HCDs.
 	 */
-	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 +2341,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);
 }
-- 
1.9.1

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