commit 4efb2f694114 ("usb: host: xhci-plat: add struct xhci_plat_priv")
introduced struct xhci_plat_priv to hold the plat driver's specific
variables. The clk is only for plat driver, so let's move it to the
proper structure.

Signed-off-by: Jisheng Zhang <jisheng.zh...@synaptics.com>
---
 drivers/usb/host/xhci-plat.c | 17 +++++++++++------
 drivers/usb/host/xhci-plat.h |  2 ++
 drivers/usb/host/xhci.h      |  2 --
 3 files changed, 13 insertions(+), 8 deletions(-)

diff --git a/drivers/usb/host/xhci-plat.c b/drivers/usb/host/xhci-plat.c
index 09f164f..4cd9162 100644
--- a/drivers/usb/host/xhci-plat.c
+++ b/drivers/usb/host/xhci-plat.c
@@ -152,6 +152,7 @@ static int xhci_plat_probe(struct platform_device *pdev)
 {
        const struct xhci_plat_priv *priv_match;
        const struct hc_driver  *driver;
+       struct xhci_plat_priv   *priv;
        struct device           *sysdev;
        struct xhci_hcd         *xhci;
        struct resource         *res;
@@ -240,6 +241,7 @@ static int xhci_plat_probe(struct platform_device *pdev)
        }
 
        xhci = hcd_to_xhci(hcd);
+       priv = hcd_to_xhci_priv(hcd);
        priv_match = of_device_get_match_data(&pdev->dev);
        if (priv_match) {
                struct xhci_plat_priv *priv = hcd_to_xhci_priv(hcd);
@@ -251,7 +253,7 @@ static int xhci_plat_probe(struct platform_device *pdev)
 
        device_wakeup_enable(hcd->self.controller);
 
-       xhci->clk = clk;
+       priv->clk = clk;
        xhci->main_hcd = hcd;
        xhci->shared_hcd = __usb_create_hcd(driver, sysdev, &pdev->dev,
                        dev_name(&pdev->dev), hcd);
@@ -331,7 +333,8 @@ static int xhci_plat_remove(struct platform_device *dev)
 {
        struct usb_hcd  *hcd = platform_get_drvdata(dev);
        struct xhci_hcd *xhci = hcd_to_xhci(hcd);
-       struct clk *clk = xhci->clk;
+       struct xhci_plat_priv *priv = hcd_to_xhci_priv(hcd);
+       struct clk *clk = priv->clk;
 
        xhci->xhc_state |= XHCI_STATE_REMOVING;
 
@@ -355,6 +358,7 @@ static int __maybe_unused xhci_plat_suspend(struct device 
*dev)
 {
        struct usb_hcd  *hcd = dev_get_drvdata(dev);
        struct xhci_hcd *xhci = hcd_to_xhci(hcd);
+       struct xhci_plat_priv *priv = hcd_to_xhci_priv(hcd);
        int ret;
 
        /*
@@ -367,8 +371,8 @@ static int __maybe_unused xhci_plat_suspend(struct device 
*dev)
         */
        ret = xhci_suspend(xhci, device_may_wakeup(dev));
 
-       if (!device_may_wakeup(dev) && !IS_ERR(xhci->clk))
-               clk_disable_unprepare(xhci->clk);
+       if (!device_may_wakeup(dev) && !IS_ERR(priv->clk))
+               clk_disable_unprepare(priv->clk);
 
        return ret;
 }
@@ -377,10 +381,11 @@ static int __maybe_unused xhci_plat_resume(struct device 
*dev)
 {
        struct usb_hcd  *hcd = dev_get_drvdata(dev);
        struct xhci_hcd *xhci = hcd_to_xhci(hcd);
+       struct xhci_plat_priv *priv = hcd_to_xhci_priv(hcd);
        int ret;
 
-       if (!device_may_wakeup(dev) && !IS_ERR(xhci->clk))
-               clk_prepare_enable(xhci->clk);
+       if (!device_may_wakeup(dev) && !IS_ERR(priv->clk))
+               clk_prepare_enable(priv->clk);
 
        ret = xhci_priv_resume_quirk(hcd);
        if (ret)
diff --git a/drivers/usb/host/xhci-plat.h b/drivers/usb/host/xhci-plat.h
index ae29f22..4d6f048 100644
--- a/drivers/usb/host/xhci-plat.h
+++ b/drivers/usb/host/xhci-plat.h
@@ -12,6 +12,8 @@
 
 struct xhci_plat_priv {
        const char *firmware_name;
+       /* optional clock */
+       struct clk *clk;
        void (*plat_start)(struct usb_hcd *);
        int (*init_quirk)(struct usb_hcd *);
        int (*resume_quirk)(struct usb_hcd *);
diff --git a/drivers/usb/host/xhci.h b/drivers/usb/host/xhci.h
index 99a014a..55c3441 100644
--- a/drivers/usb/host/xhci.h
+++ b/drivers/usb/host/xhci.h
@@ -1724,8 +1724,6 @@ struct xhci_hcd {
        int             page_shift;
        /* msi-x vectors */
        int             msix_count;
-       /* optional clock */
-       struct clk              *clk;
        /* data structures */
        struct xhci_device_context_array *dcbaa;
        struct xhci_ring        *cmd_ring;
-- 
1.9.1

Reply via email to