usb: dwc2: move usb_disabled() call to host driver only
authorDinh Nguyen <dinguyen@opensource.altera.com>
Tue, 11 Nov 2014 17:13:39 +0000 (11:13 -0600)
committerFelipe Balbi <balbi@ti.com>
Fri, 14 Nov 2014 21:00:03 +0000 (15:00 -0600)
Since platform.c will get built for both Host and Gadget, if we leave the
usb_disabled() call in platform.c, it results in the following build error
when (!USB && USB_GADGET) condition is met.

ERROR: "usb_disabled" [drivers/usb/dwc2/dwc2_platform.ko] undefined!

Since usb_disabled() is mostly used to disable USB host functionality, move
the call the host portion for the DWC2 driver.

Acked-by: Paul Zimmerman <paulz@synopsys.com>
Signed-off-by: Dinh Nguyen <dinguyen@opensource.altera.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
drivers/usb/dwc2/hcd.c
drivers/usb/dwc2/platform.c

index 1a6dea323c8f09557f45906ba82a5a70237989d7..a0cd9db6f4cd0e7e9a655527711ca488ef8a971e 100644 (file)
@@ -2846,6 +2846,9 @@ int dwc2_hcd_init(struct dwc2_hsotg *hsotg, int irq,
        int i, num_channels;
        int retval;
 
+       if (usb_disabled())
+               return -ENODEV;
+
        dev_dbg(hsotg->dev, "DWC OTG HCD INIT\n");
 
        /* Detect config values from hardware */
index 3552602ddbf681f13580623f55b241930d3832f0..57eb8a3e022b4a0f09958456f043482bbe8f75b8 100644 (file)
@@ -157,9 +157,6 @@ static int dwc2_driver_probe(struct platform_device *dev)
        int retval;
        int irq;
 
-       if (usb_disabled())
-               return -ENODEV;
-
        match = of_match_device(dwc2_of_match_table, &dev->dev);
        if (match && match->data) {
                params = match->data;