Patchwork [02/48] drm: omapdrm: Pass drm_device to omap_gem_resume()

login
register
mail settings
Submitter Laurent Pinchart
Date Oct. 13, 2017, 2:58 p.m.
Message ID <20171013145944.26557-3-laurent.pinchart@ideasonboard.com>
Download mbox | patch
Permalink /patch/10004961/
State New
Headers show

Comments

Laurent Pinchart - Oct. 13, 2017, 2:58 p.m.
The omap_gem_resume() function is internal to the driver. Pass it a
drm_device pointer that the caller already has instead of looking it up
from device data.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
---
 drivers/gpu/drm/omapdrm/omap_drv.c | 2 +-
 drivers/gpu/drm/omapdrm/omap_drv.h | 2 +-
 drivers/gpu/drm/omapdrm/omap_gem.c | 7 +++----
 3 files changed, 5 insertions(+), 6 deletions(-)
Sebastian Reichel - Oct. 14, 2017, 12:15 p.m.
Hi,

On Fri, Oct 13, 2017 at 05:58:58PM +0300, Laurent Pinchart wrote:
> The omap_gem_resume() function is internal to the driver. Pass it a
> drm_device pointer that the caller already has instead of looking it up
> from device data.
> 
> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

Reviewed-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>

-- Sebastian

> ---
>  drivers/gpu/drm/omapdrm/omap_drv.c | 2 +-
>  drivers/gpu/drm/omapdrm/omap_drv.h | 2 +-
>  drivers/gpu/drm/omapdrm/omap_gem.c | 7 +++----
>  3 files changed, 5 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/gpu/drm/omapdrm/omap_drv.c b/drivers/gpu/drm/omapdrm/omap_drv.c
> index cdf5b0601eba..2d15ea1d6c92 100644
> --- a/drivers/gpu/drm/omapdrm/omap_drv.c
> +++ b/drivers/gpu/drm/omapdrm/omap_drv.c
> @@ -740,7 +740,7 @@ static int omap_drm_resume(struct device *dev)
>  
>  	drm_kms_helper_poll_enable(drm_dev);
>  
> -	return omap_gem_resume(dev);
> +	return omap_gem_resume(drm_dev);
>  }
>  #endif
>  
> diff --git a/drivers/gpu/drm/omapdrm/omap_drv.h b/drivers/gpu/drm/omapdrm/omap_drv.h
> index 4bd1e9070b31..04f35f74f80c 100644
> --- a/drivers/gpu/drm/omapdrm/omap_drv.h
> +++ b/drivers/gpu/drm/omapdrm/omap_drv.h
> @@ -94,7 +94,7 @@ void omap_gem_describe_objects(struct list_head *list, struct seq_file *m);
>  #endif
>  
>  #ifdef CONFIG_PM
> -int omap_gem_resume(struct device *dev);
> +int omap_gem_resume(struct drm_device *dev);
>  #endif
>  
>  int omap_irq_enable_vblank(struct drm_crtc *crtc);
> diff --git a/drivers/gpu/drm/omapdrm/omap_gem.c b/drivers/gpu/drm/omapdrm/omap_gem.c
> index 5c5c86ddd6f4..fd81396baaf9 100644
> --- a/drivers/gpu/drm/omapdrm/omap_gem.c
> +++ b/drivers/gpu/drm/omapdrm/omap_gem.c
> @@ -996,10 +996,9 @@ void *omap_gem_vaddr(struct drm_gem_object *obj)
>  
>  #ifdef CONFIG_PM
>  /* re-pin objects in DMM in resume path: */
> -int omap_gem_resume(struct device *dev)
> +int omap_gem_resume(struct drm_device *dev)
>  {
> -	struct drm_device *drm_dev = dev_get_drvdata(dev);
> -	struct omap_drm_private *priv = drm_dev->dev_private;
> +	struct omap_drm_private *priv = dev->dev_private;
>  	struct omap_gem_object *omap_obj;
>  	int ret = 0;
>  
> @@ -1012,7 +1011,7 @@ int omap_gem_resume(struct device *dev)
>  					omap_obj->pages, npages,
>  					omap_obj->roll, true);
>  			if (ret) {
> -				dev_err(dev, "could not repin: %d\n", ret);
> +				dev_err(dev->dev, "could not repin: %d\n", ret);
>  				return ret;
>  			}
>  		}
> -- 
> Regards,
> 
> Laurent Pinchart
> 
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel

Patch

diff --git a/drivers/gpu/drm/omapdrm/omap_drv.c b/drivers/gpu/drm/omapdrm/omap_drv.c
index cdf5b0601eba..2d15ea1d6c92 100644
--- a/drivers/gpu/drm/omapdrm/omap_drv.c
+++ b/drivers/gpu/drm/omapdrm/omap_drv.c
@@ -740,7 +740,7 @@  static int omap_drm_resume(struct device *dev)
 
 	drm_kms_helper_poll_enable(drm_dev);
 
-	return omap_gem_resume(dev);
+	return omap_gem_resume(drm_dev);
 }
 #endif
 
diff --git a/drivers/gpu/drm/omapdrm/omap_drv.h b/drivers/gpu/drm/omapdrm/omap_drv.h
index 4bd1e9070b31..04f35f74f80c 100644
--- a/drivers/gpu/drm/omapdrm/omap_drv.h
+++ b/drivers/gpu/drm/omapdrm/omap_drv.h
@@ -94,7 +94,7 @@  void omap_gem_describe_objects(struct list_head *list, struct seq_file *m);
 #endif
 
 #ifdef CONFIG_PM
-int omap_gem_resume(struct device *dev);
+int omap_gem_resume(struct drm_device *dev);
 #endif
 
 int omap_irq_enable_vblank(struct drm_crtc *crtc);
diff --git a/drivers/gpu/drm/omapdrm/omap_gem.c b/drivers/gpu/drm/omapdrm/omap_gem.c
index 5c5c86ddd6f4..fd81396baaf9 100644
--- a/drivers/gpu/drm/omapdrm/omap_gem.c
+++ b/drivers/gpu/drm/omapdrm/omap_gem.c
@@ -996,10 +996,9 @@  void *omap_gem_vaddr(struct drm_gem_object *obj)
 
 #ifdef CONFIG_PM
 /* re-pin objects in DMM in resume path: */
-int omap_gem_resume(struct device *dev)
+int omap_gem_resume(struct drm_device *dev)
 {
-	struct drm_device *drm_dev = dev_get_drvdata(dev);
-	struct omap_drm_private *priv = drm_dev->dev_private;
+	struct omap_drm_private *priv = dev->dev_private;
 	struct omap_gem_object *omap_obj;
 	int ret = 0;
 
@@ -1012,7 +1011,7 @@  int omap_gem_resume(struct device *dev)
 					omap_obj->pages, npages,
 					omap_obj->roll, true);
 			if (ret) {
-				dev_err(dev, "could not repin: %d\n", ret);
+				dev_err(dev->dev, "could not repin: %d\n", ret);
 				return ret;
 			}
 		}