diff mbox series

gpu/drm/hisilicon: Convert drm_atomic_helper_suspend/resume()

Message ID 20180806144900.GA13925@jordon-HP-15-Notebook-PC (mailing list archive)
State New, archived
Headers show
Series gpu/drm/hisilicon: Convert drm_atomic_helper_suspend/resume() | expand

Commit Message

Souptick Joarder Aug. 6, 2018, 2:49 p.m. UTC
convert drm_atomic_helper_suspend/resume() to use
drm_mode_config_helper_suspend/resume().

Fixed one sparse warning by making hibmc_drm_interrupt
static.

Signed-off-by: Ajit Negi <ajitn.linux@gmail.com>
Signed-off-by: Souptick Joarder <jrdr.linux@gmail.com>
Reviewed-by: Xinliang Liu <z.liuxinliang@hisilicon.com>
---
v2: remove ret variable from both suspend and resume.
    remove suspend_state from hibmc_drm_private struct.

 drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c | 20 +++-----------------
 drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.h |  1 -
 2 files changed, 3 insertions(+), 18 deletions(-)

Comments

Souptick Joarder Sept. 11, 2018, 8:34 a.m. UTC | #1
On Mon, Aug 6, 2018 at 8:16 PM Souptick Joarder <jrdr.linux@gmail.com> wrote:
>
> convert drm_atomic_helper_suspend/resume() to use
> drm_mode_config_helper_suspend/resume().
>
> Fixed one sparse warning by making hibmc_drm_interrupt
> static.
>
> Signed-off-by: Ajit Negi <ajitn.linux@gmail.com>
> Signed-off-by: Souptick Joarder <jrdr.linux@gmail.com>
> Reviewed-by: Xinliang Liu <z.liuxinliang@hisilicon.com>

Can we get this patch in queue for 4.20 ??

> ---
> v2: remove ret variable from both suspend and resume.
>     remove suspend_state from hibmc_drm_private struct.
>
>  drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c | 20 +++-----------------
>  drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.h |  1 -
>  2 files changed, 3 insertions(+), 18 deletions(-)
>
> diff --git a/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c b/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c
> index d4f6f1f..ee24480 100644
> --- a/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c
> +++ b/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c
> @@ -37,7 +37,7 @@
>         .llseek         = no_llseek,
>  };
>
> -irqreturn_t hibmc_drm_interrupt(int irq, void *arg)
> +static irqreturn_t hibmc_drm_interrupt(int irq, void *arg)
>  {
>         struct drm_device *dev = (struct drm_device *)arg;
>         struct hibmc_drm_private *priv =
> @@ -74,30 +74,16 @@ static int __maybe_unused hibmc_pm_suspend(struct device *dev)
>  {
>         struct pci_dev *pdev = to_pci_dev(dev);
>         struct drm_device *drm_dev = pci_get_drvdata(pdev);
> -       struct hibmc_drm_private *priv = drm_dev->dev_private;
> -
> -       drm_kms_helper_poll_disable(drm_dev);
> -       priv->suspend_state = drm_atomic_helper_suspend(drm_dev);
> -       if (IS_ERR(priv->suspend_state)) {
> -               DRM_ERROR("drm_atomic_helper_suspend failed: %ld\n",
> -                         PTR_ERR(priv->suspend_state));
> -               drm_kms_helper_poll_enable(drm_dev);
> -               return PTR_ERR(priv->suspend_state);
> -       }
>
> -       return 0;
> +       return drm_mode_config_helper_suspend(drm_dev);
>  }
>
>  static int  __maybe_unused hibmc_pm_resume(struct device *dev)
>  {
>         struct pci_dev *pdev = to_pci_dev(dev);
>         struct drm_device *drm_dev = pci_get_drvdata(pdev);
> -       struct hibmc_drm_private *priv = drm_dev->dev_private;
>
> -       drm_atomic_helper_resume(drm_dev, priv->suspend_state);
> -       drm_kms_helper_poll_enable(drm_dev);
> -
> -       return 0;
> +       return drm_mode_config_helper_resume(drm_dev);
>  }
>
>  static const struct dev_pm_ops hibmc_pm_ops = {
> diff --git a/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.h b/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.h
> index e195521..45c25a4 100644
> --- a/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.h
> +++ b/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.h
> @@ -47,7 +47,6 @@ struct hibmc_drm_private {
>         /* drm */
>         struct drm_device  *dev;
>         bool mode_config_initialized;
> -       struct drm_atomic_state *suspend_state;
>
>         /* ttm */
>         struct drm_global_reference mem_global_ref;
> --
> 1.9.1
>
Souptick Joarder Sept. 17, 2018, 5:17 a.m. UTC | #2
On Tue, Sep 11, 2018 at 2:04 PM Souptick Joarder <jrdr.linux@gmail.com> wrote:
>
> On Mon, Aug 6, 2018 at 8:16 PM Souptick Joarder <jrdr.linux@gmail.com> wrote:
> >
> > convert drm_atomic_helper_suspend/resume() to use
> > drm_mode_config_helper_suspend/resume().
> >
> > Fixed one sparse warning by making hibmc_drm_interrupt
> > static.
> >
> > Signed-off-by: Ajit Negi <ajitn.linux@gmail.com>
> > Signed-off-by: Souptick Joarder <jrdr.linux@gmail.com>
> > Reviewed-by: Xinliang Liu <z.liuxinliang@hisilicon.com>
>
> Can we get this patch in queue for 4.20 ??

Daniel, can we get this patch in queue for 4.20, if no further comment  ?

>
> > ---
> > v2: remove ret variable from both suspend and resume.
> >     remove suspend_state from hibmc_drm_private struct.
> >
> >  drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c | 20 +++-----------------
> >  drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.h |  1 -
> >  2 files changed, 3 insertions(+), 18 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c b/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c
> > index d4f6f1f..ee24480 100644
> > --- a/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c
> > +++ b/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c
> > @@ -37,7 +37,7 @@
> >         .llseek         = no_llseek,
> >  };
> >
> > -irqreturn_t hibmc_drm_interrupt(int irq, void *arg)
> > +static irqreturn_t hibmc_drm_interrupt(int irq, void *arg)
> >  {
> >         struct drm_device *dev = (struct drm_device *)arg;
> >         struct hibmc_drm_private *priv =
> > @@ -74,30 +74,16 @@ static int __maybe_unused hibmc_pm_suspend(struct device *dev)
> >  {
> >         struct pci_dev *pdev = to_pci_dev(dev);
> >         struct drm_device *drm_dev = pci_get_drvdata(pdev);
> > -       struct hibmc_drm_private *priv = drm_dev->dev_private;
> > -
> > -       drm_kms_helper_poll_disable(drm_dev);
> > -       priv->suspend_state = drm_atomic_helper_suspend(drm_dev);
> > -       if (IS_ERR(priv->suspend_state)) {
> > -               DRM_ERROR("drm_atomic_helper_suspend failed: %ld\n",
> > -                         PTR_ERR(priv->suspend_state));
> > -               drm_kms_helper_poll_enable(drm_dev);
> > -               return PTR_ERR(priv->suspend_state);
> > -       }
> >
> > -       return 0;
> > +       return drm_mode_config_helper_suspend(drm_dev);
> >  }
> >
> >  static int  __maybe_unused hibmc_pm_resume(struct device *dev)
> >  {
> >         struct pci_dev *pdev = to_pci_dev(dev);
> >         struct drm_device *drm_dev = pci_get_drvdata(pdev);
> > -       struct hibmc_drm_private *priv = drm_dev->dev_private;
> >
> > -       drm_atomic_helper_resume(drm_dev, priv->suspend_state);
> > -       drm_kms_helper_poll_enable(drm_dev);
> > -
> > -       return 0;
> > +       return drm_mode_config_helper_resume(drm_dev);
> >  }
> >
> >  static const struct dev_pm_ops hibmc_pm_ops = {
> > diff --git a/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.h b/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.h
> > index e195521..45c25a4 100644
> > --- a/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.h
> > +++ b/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.h
> > @@ -47,7 +47,6 @@ struct hibmc_drm_private {
> >         /* drm */
> >         struct drm_device  *dev;
> >         bool mode_config_initialized;
> > -       struct drm_atomic_state *suspend_state;
> >
> >         /* ttm */
> >         struct drm_global_reference mem_global_ref;
> > --
> > 1.9.1
> >
Xinliang Liu Sept. 25, 2018, 12:37 p.m. UTC | #3
Hi Souptick,

On Mon, 17 Sep 2018 at 15:40, Souptick Joarder <jrdr.linux@gmail.com> wrote:
>
> On Tue, Sep 11, 2018 at 2:04 PM Souptick Joarder <jrdr.linux@gmail.com> wrote:
> >
> > On Mon, Aug 6, 2018 at 8:16 PM Souptick Joarder <jrdr.linux@gmail.com> wrote:
> > >
> > > convert drm_atomic_helper_suspend/resume() to use
> > > drm_mode_config_helper_suspend/resume().
> > >
> > > Fixed one sparse warning by making hibmc_drm_interrupt
> > > static.
> > >
> > > Signed-off-by: Ajit Negi <ajitn.linux@gmail.com>
> > > Signed-off-by: Souptick Joarder <jrdr.linux@gmail.com>
> > > Reviewed-by: Xinliang Liu <z.liuxinliang@hisilicon.com>
> >
> > Can we get this patch in queue for 4.20 ??
>
> Daniel, can we get this patch in queue for 4.20, if no further comment  ?

Will send 4.20 drm-next pull for this patch. I am verifying it on our D05 board.

Thanks,
Xinliang

>
> >
> > > ---
> > > v2: remove ret variable from both suspend and resume.
> > >     remove suspend_state from hibmc_drm_private struct.
> > >
> > >  drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c | 20 +++-----------------
> > >  drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.h |  1 -
> > >  2 files changed, 3 insertions(+), 18 deletions(-)
> > >
> > > diff --git a/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c b/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c
> > > index d4f6f1f..ee24480 100644
> > > --- a/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c
> > > +++ b/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c
> > > @@ -37,7 +37,7 @@
> > >         .llseek         = no_llseek,
> > >  };
> > >
> > > -irqreturn_t hibmc_drm_interrupt(int irq, void *arg)
> > > +static irqreturn_t hibmc_drm_interrupt(int irq, void *arg)
> > >  {
> > >         struct drm_device *dev = (struct drm_device *)arg;
> > >         struct hibmc_drm_private *priv =
> > > @@ -74,30 +74,16 @@ static int __maybe_unused hibmc_pm_suspend(struct device *dev)
> > >  {
> > >         struct pci_dev *pdev = to_pci_dev(dev);
> > >         struct drm_device *drm_dev = pci_get_drvdata(pdev);
> > > -       struct hibmc_drm_private *priv = drm_dev->dev_private;
> > > -
> > > -       drm_kms_helper_poll_disable(drm_dev);
> > > -       priv->suspend_state = drm_atomic_helper_suspend(drm_dev);
> > > -       if (IS_ERR(priv->suspend_state)) {
> > > -               DRM_ERROR("drm_atomic_helper_suspend failed: %ld\n",
> > > -                         PTR_ERR(priv->suspend_state));
> > > -               drm_kms_helper_poll_enable(drm_dev);
> > > -               return PTR_ERR(priv->suspend_state);
> > > -       }
> > >
> > > -       return 0;
> > > +       return drm_mode_config_helper_suspend(drm_dev);
> > >  }
> > >
> > >  static int  __maybe_unused hibmc_pm_resume(struct device *dev)
> > >  {
> > >         struct pci_dev *pdev = to_pci_dev(dev);
> > >         struct drm_device *drm_dev = pci_get_drvdata(pdev);
> > > -       struct hibmc_drm_private *priv = drm_dev->dev_private;
> > >
> > > -       drm_atomic_helper_resume(drm_dev, priv->suspend_state);
> > > -       drm_kms_helper_poll_enable(drm_dev);
> > > -
> > > -       return 0;
> > > +       return drm_mode_config_helper_resume(drm_dev);
> > >  }
> > >
> > >  static const struct dev_pm_ops hibmc_pm_ops = {
> > > diff --git a/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.h b/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.h
> > > index e195521..45c25a4 100644
> > > --- a/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.h
> > > +++ b/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.h
> > > @@ -47,7 +47,6 @@ struct hibmc_drm_private {
> > >         /* drm */
> > >         struct drm_device  *dev;
> > >         bool mode_config_initialized;
> > > -       struct drm_atomic_state *suspend_state;
> > >
> > >         /* ttm */
> > >         struct drm_global_reference mem_global_ref;
> > > --
> > > 1.9.1
> > >
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
Souptick Joarder Sept. 25, 2018, 12:43 p.m. UTC | #4
On Tue, Sep 25, 2018 at 6:07 PM Xinliang Liu <xinliang.liu@linaro.org> wrote:
>
> Hi Souptick,
>
> On Mon, 17 Sep 2018 at 15:40, Souptick Joarder <jrdr.linux@gmail.com> wrote:
> >
> > On Tue, Sep 11, 2018 at 2:04 PM Souptick Joarder <jrdr.linux@gmail.com> wrote:
> > >
> > > On Mon, Aug 6, 2018 at 8:16 PM Souptick Joarder <jrdr.linux@gmail.com> wrote:
> > > >
> > > > convert drm_atomic_helper_suspend/resume() to use
> > > > drm_mode_config_helper_suspend/resume().
> > > >
> > > > Fixed one sparse warning by making hibmc_drm_interrupt
> > > > static.
> > > >
> > > > Signed-off-by: Ajit Negi <ajitn.linux@gmail.com>
> > > > Signed-off-by: Souptick Joarder <jrdr.linux@gmail.com>
> > > > Reviewed-by: Xinliang Liu <z.liuxinliang@hisilicon.com>
> > >
> > > Can we get this patch in queue for 4.20 ??
> >
> > Daniel, can we get this patch in queue for 4.20, if no further comment  ?
>
> Will send 4.20 drm-next pull for this patch. I am verifying it on our D05 board.

Thanks.
> > >
> > > > ---
> > > > v2: remove ret variable from both suspend and resume.
> > > >     remove suspend_state from hibmc_drm_private struct.
> > > >
> > > >  drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c | 20 +++-----------------
> > > >  drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.h |  1 -
> > > >  2 files changed, 3 insertions(+), 18 deletions(-)
> > > >
> > > > diff --git a/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c b/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c
> > > > index d4f6f1f..ee24480 100644
> > > > --- a/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c
> > > > +++ b/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c
> > > > @@ -37,7 +37,7 @@
> > > >         .llseek         = no_llseek,
> > > >  };
> > > >
> > > > -irqreturn_t hibmc_drm_interrupt(int irq, void *arg)
> > > > +static irqreturn_t hibmc_drm_interrupt(int irq, void *arg)
> > > >  {
> > > >         struct drm_device *dev = (struct drm_device *)arg;
> > > >         struct hibmc_drm_private *priv =
> > > > @@ -74,30 +74,16 @@ static int __maybe_unused hibmc_pm_suspend(struct device *dev)
> > > >  {
> > > >         struct pci_dev *pdev = to_pci_dev(dev);
> > > >         struct drm_device *drm_dev = pci_get_drvdata(pdev);
> > > > -       struct hibmc_drm_private *priv = drm_dev->dev_private;
> > > > -
> > > > -       drm_kms_helper_poll_disable(drm_dev);
> > > > -       priv->suspend_state = drm_atomic_helper_suspend(drm_dev);
> > > > -       if (IS_ERR(priv->suspend_state)) {
> > > > -               DRM_ERROR("drm_atomic_helper_suspend failed: %ld\n",
> > > > -                         PTR_ERR(priv->suspend_state));
> > > > -               drm_kms_helper_poll_enable(drm_dev);
> > > > -               return PTR_ERR(priv->suspend_state);
> > > > -       }
> > > >
> > > > -       return 0;
> > > > +       return drm_mode_config_helper_suspend(drm_dev);
> > > >  }
> > > >
> > > >  static int  __maybe_unused hibmc_pm_resume(struct device *dev)
> > > >  {
> > > >         struct pci_dev *pdev = to_pci_dev(dev);
> > > >         struct drm_device *drm_dev = pci_get_drvdata(pdev);
> > > > -       struct hibmc_drm_private *priv = drm_dev->dev_private;
> > > >
> > > > -       drm_atomic_helper_resume(drm_dev, priv->suspend_state);
> > > > -       drm_kms_helper_poll_enable(drm_dev);
> > > > -
> > > > -       return 0;
> > > > +       return drm_mode_config_helper_resume(drm_dev);
> > > >  }
> > > >
> > > >  static const struct dev_pm_ops hibmc_pm_ops = {
> > > > diff --git a/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.h b/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.h
> > > > index e195521..45c25a4 100644
> > > > --- a/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.h
> > > > +++ b/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.h
> > > > @@ -47,7 +47,6 @@ struct hibmc_drm_private {
> > > >         /* drm */
> > > >         struct drm_device  *dev;
> > > >         bool mode_config_initialized;
> > > > -       struct drm_atomic_state *suspend_state;
> > > >
> > > >         /* ttm */
> > > >         struct drm_global_reference mem_global_ref;
> > > > --
> > > > 1.9.1
> > > >
> > _______________________________________________
> > dri-devel mailing list
> > dri-devel@lists.freedesktop.org
> > https://lists.freedesktop.org/mailman/listinfo/dri-devel
diff mbox series

Patch

diff --git a/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c b/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c
index d4f6f1f..ee24480 100644
--- a/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c
+++ b/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c
@@ -37,7 +37,7 @@ 
 	.llseek		= no_llseek,
 };
 
-irqreturn_t hibmc_drm_interrupt(int irq, void *arg)
+static irqreturn_t hibmc_drm_interrupt(int irq, void *arg)
 {
 	struct drm_device *dev = (struct drm_device *)arg;
 	struct hibmc_drm_private *priv =
@@ -74,30 +74,16 @@  static int __maybe_unused hibmc_pm_suspend(struct device *dev)
 {
 	struct pci_dev *pdev = to_pci_dev(dev);
 	struct drm_device *drm_dev = pci_get_drvdata(pdev);
-	struct hibmc_drm_private *priv = drm_dev->dev_private;
-
-	drm_kms_helper_poll_disable(drm_dev);
-	priv->suspend_state = drm_atomic_helper_suspend(drm_dev);
-	if (IS_ERR(priv->suspend_state)) {
-		DRM_ERROR("drm_atomic_helper_suspend failed: %ld\n",
-			  PTR_ERR(priv->suspend_state));
-		drm_kms_helper_poll_enable(drm_dev);
-		return PTR_ERR(priv->suspend_state);
-	}
 
-	return 0;
+	return drm_mode_config_helper_suspend(drm_dev);
 }
 
 static int  __maybe_unused hibmc_pm_resume(struct device *dev)
 {
 	struct pci_dev *pdev = to_pci_dev(dev);
 	struct drm_device *drm_dev = pci_get_drvdata(pdev);
-	struct hibmc_drm_private *priv = drm_dev->dev_private;
 
-	drm_atomic_helper_resume(drm_dev, priv->suspend_state);
-	drm_kms_helper_poll_enable(drm_dev);
-
-	return 0;
+	return drm_mode_config_helper_resume(drm_dev);
 }
 
 static const struct dev_pm_ops hibmc_pm_ops = {
diff --git a/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.h b/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.h
index e195521..45c25a4 100644
--- a/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.h
+++ b/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.h
@@ -47,7 +47,6 @@  struct hibmc_drm_private {
 	/* drm */
 	struct drm_device  *dev;
 	bool mode_config_initialized;
-	struct drm_atomic_state *suspend_state;
 
 	/* ttm */
 	struct drm_global_reference mem_global_ref;