usb: host: lpc32xx: fix warnings caused by enabling unprepared clock
authorVladimir Zapolskiy <vz@mleia.com>
Sat, 17 Oct 2015 19:30:24 +0000 (22:30 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 25 Oct 2015 02:53:53 +0000 (19:53 -0700)
If common clock framework is configured, the driver generates a warning,
which is fixed by this change:

    WARNING: CPU: 0 PID: 573 at drivers/clk/clk.c:728 clk_core_enable+0x2c/0xf0()
    Modules linked in: ohci_nxp(+) sc16is7xx snd_soc_uda1380
    CPU: 0 PID: 573 Comm: udevd Not tainted 4.3.0-rc2+ #285
    Hardware name: LPC32XX SoC (Flattened Device Tree)
    Backtrace:
    [<>] (dump_backtrace) from [<>] (show_stack+0x18/0x1c)
    [<>] (show_stack) from [<>] (dump_stack+0x20/0x28)
    [<>] (dump_stack) from [<>] (warn_slowpath_common+0x90/0xb8)
    [<>] (warn_slowpath_common) from [<>] (warn_slowpath_null+0x24/0x2c)
    [<>] (warn_slowpath_null) from [<>] (clk_core_enable+0x2c/0xf0)
    [<>] (clk_core_enable) from [<>] (clk_enable+0x24/0x38)
    [<>] (clk_enable) from [<>] (ohci_hcd_nxp_probe+0x1d0/0x518 [ohci_nxp])
    [<>] (ohci_hcd_nxp_probe [ohci_nxp]) from [<>] (platform_drv_probe+0x50/0xa0)
    [<>] (platform_drv_probe) from [<>] (driver_probe_device+0x18c/0x408)
    [<>] (driver_probe_device) from [<>] (__driver_attach+0x70/0x94)
    [<>] (__driver_attach) from [<>] (bus_for_each_dev+0x74/0x98)
    [<>] (bus_for_each_dev) from [<>] (driver_attach+0x20/0x28)
    [<>] (driver_attach) from [<>] (bus_add_driver+0x11c/0x248)
    [<>] (bus_add_driver) from [<>] (driver_register+0xa4/0xe8)
    [<>] (driver_register) from [<>] (__platform_driver_register+0x50/0x64)
    [<>] (__platform_driver_register) from [<>] (ohci_nxp_init+0x3c/0x5c [ohci_nxp])
    [<>] (ohci_nxp_init [ohci_nxp]) from [<>] (do_one_initcall+0x11c/0x1dc)
    [<>] (do_one_initcall) from [<>] (do_init_module+0x60/0x368)
    [<>] (do_init_module) from [<>] (load_module+0x16d0/0x1b7c)
    [<>] (load_module) from [<>] (SyS_finit_module+0x90/0xa4)
    [<>] (SyS_finit_module) from [<>] (ret_fast_syscall+0x0/0x38)

Signed-off-by: Vladimir Zapolskiy <vz@mleia.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/host/ohci-nxp.c

index d9f0481..0b3cf0d 100644 (file)
@@ -203,7 +203,7 @@ static int ohci_hcd_nxp_probe(struct platform_device *pdev)
                goto fail_disable;
        }
 
-       ret = clk_enable(usb_pll_clk);
+       ret = clk_prepare_enable(usb_pll_clk);
        if (ret < 0) {
                dev_err(&pdev->dev, "failed to start USB PLL\n");
                goto fail_disable;
@@ -223,7 +223,7 @@ static int ohci_hcd_nxp_probe(struct platform_device *pdev)
                goto fail_rate;
        }
 
-       ret = clk_enable(usb_dev_clk);
+       ret = clk_prepare_enable(usb_dev_clk);
        if (ret < 0) {
                dev_err(&pdev->dev, "failed to start USB DEV Clock\n");
                goto fail_rate;
@@ -239,7 +239,7 @@ static int ohci_hcd_nxp_probe(struct platform_device *pdev)
 
        __raw_writel(__raw_readl(USB_CTRL) | USB_HOST_NEED_CLK_EN, USB_CTRL);
 
-       ret = clk_enable(usb_otg_clk);
+       ret = clk_prepare_enable(usb_otg_clk);
        if (ret < 0) {
                dev_err(&pdev->dev, "failed to start USB DEV Clock\n");
                goto fail_otg;
@@ -283,11 +283,11 @@ static int ohci_hcd_nxp_probe(struct platform_device *pdev)
 fail_resource:
        usb_put_hcd(hcd);
 fail_hcd:
-       clk_disable(usb_otg_clk);
+       clk_disable_unprepare(usb_otg_clk);
 fail_otg:
-       clk_disable(usb_dev_clk);
+       clk_disable_unprepare(usb_dev_clk);
 fail_rate:
-       clk_disable(usb_pll_clk);
+       clk_disable_unprepare(usb_pll_clk);
 fail_disable:
        isp1301_i2c_client = NULL;
        return ret;
@@ -300,8 +300,8 @@ static int ohci_hcd_nxp_remove(struct platform_device *pdev)
        usb_remove_hcd(hcd);
        ohci_nxp_stop_hc();
        usb_put_hcd(hcd);
-       clk_disable(usb_pll_clk);
-       clk_disable(usb_dev_clk);
+       clk_disable_unprepare(usb_pll_clk);
+       clk_disable_unprepare(usb_dev_clk);
        i2c_unregister_device(isp1301_i2c_client);
        isp1301_i2c_client = NULL;