usb: renesas_usbhs: move flags to param
authorChris Brandt <chris.brandt@renesas.com>
Wed, 15 May 2019 15:20:41 +0000 (10:20 -0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 21 May 2019 08:25:59 +0000 (10:25 +0200)
Move options from 'flags' field in private structure to param structure
where other options are already being kept.

Signed-off-by: Chris Brandt <chris.brandt@renesas.com>
Reviewed-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Reviewed-by: Simon Horman <horms+renesas@verge.net.au>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/renesas_usbhs/common.c
drivers/usb/renesas_usbhs/common.h
include/linux/usb/renesas_usbhs.h

index 0ca89de..1de7a44 100644 (file)
  *                     | ....  |       +-----------+
  */
 
-
-#define USBHSF_RUNTIME_PWCTRL  (1 << 0)
-
-/* status */
-#define usbhsc_flags_init(p)   do {(p)->flags = 0; } while (0)
-#define usbhsc_flags_set(p, b) ((p)->flags |=  (b))
-#define usbhsc_flags_clr(p, b) ((p)->flags &= ~(b))
-#define usbhsc_flags_has(p, b) ((p)->flags &   (b))
-
 /*
  * platform call back
  *
@@ -479,7 +470,7 @@ static void usbhsc_hotplug(struct usbhs_priv *priv)
                dev_dbg(&pdev->dev, "%s enable\n", __func__);
 
                /* power on */
-               if (usbhsc_flags_has(priv, USBHSF_RUNTIME_PWCTRL))
+               if (usbhs_get_dparam(priv, runtime_pwctrl))
                        usbhsc_power_ctrl(priv, enable);
 
                /* bus init */
@@ -499,7 +490,7 @@ static void usbhsc_hotplug(struct usbhs_priv *priv)
                usbhsc_bus_init(priv);
 
                /* power off */
-               if (usbhsc_flags_has(priv, USBHSF_RUNTIME_PWCTRL))
+               if (usbhs_get_dparam(priv, runtime_pwctrl))
                        usbhsc_power_ctrl(priv, enable);
 
                usbhs_mod_change(priv, -1);
@@ -733,7 +724,7 @@ static int usbhs_probe(struct platform_device *pdev)
        /* FIXME */
        /* runtime power control ? */
        if (priv->pfunc.get_vbus)
-               usbhsc_flags_set(priv, USBHSF_RUNTIME_PWCTRL);
+               usbhs_get_dparam(priv, runtime_pwctrl) = 1;
 
        /*
         * priv settings
@@ -807,7 +798,7 @@ static int usbhs_probe(struct platform_device *pdev)
 
        /* power control */
        pm_runtime_enable(&pdev->dev);
-       if (!usbhsc_flags_has(priv, USBHSF_RUNTIME_PWCTRL)) {
+       if (!usbhs_get_dparam(priv, runtime_pwctrl)) {
                usbhsc_power_ctrl(priv, 1);
                usbhs_mod_autonomy_mode(priv);
        }
@@ -848,7 +839,7 @@ static int usbhs_remove(struct platform_device *pdev)
        dfunc->notify_hotplug = NULL;
 
        /* power off */
-       if (!usbhsc_flags_has(priv, USBHSF_RUNTIME_PWCTRL))
+       if (!usbhs_get_dparam(priv, runtime_pwctrl))
                usbhsc_power_ctrl(priv, 0);
 
        pm_runtime_disable(&pdev->dev);
@@ -873,7 +864,7 @@ static __maybe_unused int usbhsc_suspend(struct device *dev)
                usbhs_mod_change(priv, -1);
        }
 
-       if (mod || !usbhsc_flags_has(priv, USBHSF_RUNTIME_PWCTRL))
+       if (mod || !usbhs_get_dparam(priv, runtime_pwctrl))
                usbhsc_power_ctrl(priv, 0);
 
        return 0;
@@ -884,7 +875,7 @@ static __maybe_unused int usbhsc_resume(struct device *dev)
        struct usbhs_priv *priv = dev_get_drvdata(dev);
        struct platform_device *pdev = usbhs_priv_to_pdev(priv);
 
-       if (!usbhsc_flags_has(priv, USBHSF_RUNTIME_PWCTRL)) {
+       if (!usbhs_get_dparam(priv, runtime_pwctrl)) {
                usbhsc_power_ctrl(priv, 1);
                usbhs_mod_autonomy_mode(priv);
        }
index de1a663..1fbffb7 100644 (file)
@@ -260,8 +260,6 @@ struct usbhs_priv {
 
        spinlock_t              lock;
 
-       u32 flags;
-
        /*
         * module control
         */
index 53924f8..17fae6e 100644 (file)
@@ -189,6 +189,7 @@ struct renesas_usbhs_driver_param {
        u32 has_otg:1; /* for controlling PWEN/EXTLP */
        u32 has_sudmac:1; /* for SUDMAC */
        u32 has_usb_dmac:1; /* for USB-DMAC */
+       u32 runtime_pwctrl:1;
 #define USBHS_USB_DMAC_XFER_SIZE       32      /* hardcode the xfer size */
 };