[5/8] drm/mipi-dbi: convert to drm device based logging
diff mbox series

Message ID 20191210123050.8799-5-jani.nikula@intel.com
State New
Headers show
Series
  • [1/8] drm/print: introduce new struct drm_device based logging macros
Related show

Commit Message

Jani Nikula Dec. 10, 2019, 12:30 p.m. UTC
Prefer drm device based logging where possible.

Signed-off-by: Jani Nikula <jani.nikula@intel.com>
---
 drivers/gpu/drm/drm_mipi_dbi.c | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

Comments

Sam Ravnborg Dec. 17, 2019, 7 p.m. UTC | #1
On Tue, Dec 10, 2019 at 02:30:47PM +0200, Jani Nikula wrote:
> Prefer drm device based logging where possible.
> 
> Signed-off-by: Jani Nikula <jani.nikula@intel.com>
> ---
>  drivers/gpu/drm/drm_mipi_dbi.c | 15 ++++++++-------
>  1 file changed, 8 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/gpu/drm/drm_mipi_dbi.c b/drivers/gpu/drm/drm_mipi_dbi.c
> index e34058c721be..86d98e7fc30a 100644
> --- a/drivers/gpu/drm/drm_mipi_dbi.c
> +++ b/drivers/gpu/drm/drm_mipi_dbi.c
> @@ -225,7 +225,7 @@ int mipi_dbi_buf_copy(void *dst, struct drm_framebuffer *fb,
>  		drm_fb_xrgb8888_to_rgb565(dst, src, fb, clip, swap);
>  		break;
>  	default:
> -		dev_err_once(fb->dev->dev, "Format is not supported: %s\n",
> +		drm_err_once(fb->dev, "Format is not supported: %s\n",
>  			     drm_get_format_name(fb->format->format,
>  						 &format_name));
>  		return -EINVAL;
> @@ -242,7 +242,8 @@ static void mipi_dbi_fb_dirty(struct drm_framebuffer *fb, struct drm_rect *rect)
>  {
>  	struct drm_gem_object *gem = drm_gem_fb_get_obj(fb, 0);
>  	struct drm_gem_cma_object *cma_obj = to_drm_gem_cma_obj(gem);
> -	struct mipi_dbi_dev *dbidev = drm_to_mipi_dbi_dev(fb->dev);
> +	struct drm_device *dev = fb->dev;

In this file the pattern is to use the variable name "drm" for a
drm_device *. Your changes should follow the same pattern.

	Sam

> +	struct mipi_dbi_dev *dbidev = drm_to_mipi_dbi_dev(dev);
>  	unsigned int height = rect->y2 - rect->y1;
>  	unsigned int width = rect->x2 - rect->x1;
>  	struct mipi_dbi *dbi = &dbidev->dbi;
> @@ -259,7 +260,7 @@ static void mipi_dbi_fb_dirty(struct drm_framebuffer *fb, struct drm_rect *rect)
>  
>  	full = width == fb->width && height == fb->height;
>  
> -	DRM_DEBUG_KMS("Flushing [FB:%d] " DRM_RECT_FMT "\n", fb->base.id, DRM_RECT_ARG(rect));
> +	drm_dbg_kms(dev, "Flushing [FB:%d] " DRM_RECT_FMT "\n", fb->base.id, DRM_RECT_ARG(rect));
>  
>  	if (!dbi->dc || !full || swap ||
>  	    fb->format->format == DRM_FORMAT_XRGB8888) {
> @@ -282,7 +283,7 @@ static void mipi_dbi_fb_dirty(struct drm_framebuffer *fb, struct drm_rect *rect)
>  				   width * height * 2);
>  err_msg:
>  	if (ret)
> -		dev_err_once(fb->dev->dev, "Failed to update display %d\n", ret);
> +		drm_err_once(dev, "Failed to update display %d\n", ret);
>  
>  	drm_dev_exit(idx);
>  }
> @@ -649,14 +650,14 @@ EXPORT_SYMBOL(mipi_dbi_display_is_on);
>  
>  static int mipi_dbi_poweron_reset_conditional(struct mipi_dbi_dev *dbidev, bool cond)
>  {
> -	struct device *dev = dbidev->drm.dev;
> +	struct drm_device *dev = &dbidev->drm;
>  	struct mipi_dbi *dbi = &dbidev->dbi;
>  	int ret;
>  
>  	if (dbidev->regulator) {
>  		ret = regulator_enable(dbidev->regulator);
>  		if (ret) {
> -			DRM_DEV_ERROR(dev, "Failed to enable regulator (%d)\n", ret);
> +			drm_err(dev, "Failed to enable regulator (%d)\n", ret);
>  			return ret;
>  		}
>  	}
> @@ -667,7 +668,7 @@ static int mipi_dbi_poweron_reset_conditional(struct mipi_dbi_dev *dbidev, bool
>  	mipi_dbi_hw_reset(dbi);
>  	ret = mipi_dbi_command(dbi, MIPI_DCS_SOFT_RESET);
>  	if (ret) {
> -		DRM_DEV_ERROR(dev, "Failed to send reset command (%d)\n", ret);
> +		drm_err(dev, "Failed to send reset command (%d)\n", ret);
>  		if (dbidev->regulator)
>  			regulator_disable(dbidev->regulator);
>  		return ret;
> -- 
> 2.20.1
> 
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
Sam Ravnborg Dec. 17, 2019, 7:10 p.m. UTC | #2
On Tue, Dec 17, 2019 at 08:00:11PM +0100, Sam Ravnborg wrote:
> On Tue, Dec 10, 2019 at 02:30:47PM +0200, Jani Nikula wrote:
> > Prefer drm device based logging where possible.
> > 
> > Signed-off-by: Jani Nikula <jani.nikula@intel.com>
> > ---
> >  drivers/gpu/drm/drm_mipi_dbi.c | 15 ++++++++-------
> >  1 file changed, 8 insertions(+), 7 deletions(-)
> > 
> > diff --git a/drivers/gpu/drm/drm_mipi_dbi.c b/drivers/gpu/drm/drm_mipi_dbi.c
> > index e34058c721be..86d98e7fc30a 100644
> > --- a/drivers/gpu/drm/drm_mipi_dbi.c
> > +++ b/drivers/gpu/drm/drm_mipi_dbi.c
> > @@ -225,7 +225,7 @@ int mipi_dbi_buf_copy(void *dst, struct drm_framebuffer *fb,
> >  		drm_fb_xrgb8888_to_rgb565(dst, src, fb, clip, swap);
> >  		break;
> >  	default:
> > -		dev_err_once(fb->dev->dev, "Format is not supported: %s\n",
> > +		drm_err_once(fb->dev, "Format is not supported: %s\n",
> >  			     drm_get_format_name(fb->format->format,
> >  						 &format_name));
> >  		return -EINVAL;
> > @@ -242,7 +242,8 @@ static void mipi_dbi_fb_dirty(struct drm_framebuffer *fb, struct drm_rect *rect)
> >  {
> >  	struct drm_gem_object *gem = drm_gem_fb_get_obj(fb, 0);
> >  	struct drm_gem_cma_object *cma_obj = to_drm_gem_cma_obj(gem);
> > -	struct mipi_dbi_dev *dbidev = drm_to_mipi_dbi_dev(fb->dev);
> > +	struct drm_device *dev = fb->dev;
> 
> In this file the pattern is to use the variable name "drm" for a
> drm_device *. Your changes should follow the same pattern.
With this fixed:
Reviewed-by: Sam Ravnborg <sam@ravnborg.org>

> 
> 	Sam
> 
> > +	struct mipi_dbi_dev *dbidev = drm_to_mipi_dbi_dev(dev);
> >  	unsigned int height = rect->y2 - rect->y1;
> >  	unsigned int width = rect->x2 - rect->x1;
> >  	struct mipi_dbi *dbi = &dbidev->dbi;
> > @@ -259,7 +260,7 @@ static void mipi_dbi_fb_dirty(struct drm_framebuffer *fb, struct drm_rect *rect)
> >  
> >  	full = width == fb->width && height == fb->height;
> >  
> > -	DRM_DEBUG_KMS("Flushing [FB:%d] " DRM_RECT_FMT "\n", fb->base.id, DRM_RECT_ARG(rect));
> > +	drm_dbg_kms(dev, "Flushing [FB:%d] " DRM_RECT_FMT "\n", fb->base.id, DRM_RECT_ARG(rect));
> >  
> >  	if (!dbi->dc || !full || swap ||
> >  	    fb->format->format == DRM_FORMAT_XRGB8888) {
> > @@ -282,7 +283,7 @@ static void mipi_dbi_fb_dirty(struct drm_framebuffer *fb, struct drm_rect *rect)
> >  				   width * height * 2);
> >  err_msg:
> >  	if (ret)
> > -		dev_err_once(fb->dev->dev, "Failed to update display %d\n", ret);
> > +		drm_err_once(dev, "Failed to update display %d\n", ret);
> >  
> >  	drm_dev_exit(idx);
> >  }
> > @@ -649,14 +650,14 @@ EXPORT_SYMBOL(mipi_dbi_display_is_on);
> >  
> >  static int mipi_dbi_poweron_reset_conditional(struct mipi_dbi_dev *dbidev, bool cond)
> >  {
> > -	struct device *dev = dbidev->drm.dev;
> > +	struct drm_device *dev = &dbidev->drm;
> >  	struct mipi_dbi *dbi = &dbidev->dbi;
> >  	int ret;
> >  
> >  	if (dbidev->regulator) {
> >  		ret = regulator_enable(dbidev->regulator);
> >  		if (ret) {
> > -			DRM_DEV_ERROR(dev, "Failed to enable regulator (%d)\n", ret);
> > +			drm_err(dev, "Failed to enable regulator (%d)\n", ret);
> >  			return ret;
> >  		}
> >  	}
> > @@ -667,7 +668,7 @@ static int mipi_dbi_poweron_reset_conditional(struct mipi_dbi_dev *dbidev, bool
> >  	mipi_dbi_hw_reset(dbi);
> >  	ret = mipi_dbi_command(dbi, MIPI_DCS_SOFT_RESET);
> >  	if (ret) {
> > -		DRM_DEV_ERROR(dev, "Failed to send reset command (%d)\n", ret);
> > +		drm_err(dev, "Failed to send reset command (%d)\n", ret);
> >  		if (dbidev->regulator)
> >  			regulator_disable(dbidev->regulator);
> >  		return ret;
> > -- 
> > 2.20.1
> > 
> > _______________________________________________
> > dri-devel mailing list
> > dri-devel@lists.freedesktop.org
> > https://lists.freedesktop.org/mailman/listinfo/dri-devel
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel

Patch
diff mbox series

diff --git a/drivers/gpu/drm/drm_mipi_dbi.c b/drivers/gpu/drm/drm_mipi_dbi.c
index e34058c721be..86d98e7fc30a 100644
--- a/drivers/gpu/drm/drm_mipi_dbi.c
+++ b/drivers/gpu/drm/drm_mipi_dbi.c
@@ -225,7 +225,7 @@  int mipi_dbi_buf_copy(void *dst, struct drm_framebuffer *fb,
 		drm_fb_xrgb8888_to_rgb565(dst, src, fb, clip, swap);
 		break;
 	default:
-		dev_err_once(fb->dev->dev, "Format is not supported: %s\n",
+		drm_err_once(fb->dev, "Format is not supported: %s\n",
 			     drm_get_format_name(fb->format->format,
 						 &format_name));
 		return -EINVAL;
@@ -242,7 +242,8 @@  static void mipi_dbi_fb_dirty(struct drm_framebuffer *fb, struct drm_rect *rect)
 {
 	struct drm_gem_object *gem = drm_gem_fb_get_obj(fb, 0);
 	struct drm_gem_cma_object *cma_obj = to_drm_gem_cma_obj(gem);
-	struct mipi_dbi_dev *dbidev = drm_to_mipi_dbi_dev(fb->dev);
+	struct drm_device *dev = fb->dev;
+	struct mipi_dbi_dev *dbidev = drm_to_mipi_dbi_dev(dev);
 	unsigned int height = rect->y2 - rect->y1;
 	unsigned int width = rect->x2 - rect->x1;
 	struct mipi_dbi *dbi = &dbidev->dbi;
@@ -259,7 +260,7 @@  static void mipi_dbi_fb_dirty(struct drm_framebuffer *fb, struct drm_rect *rect)
 
 	full = width == fb->width && height == fb->height;
 
-	DRM_DEBUG_KMS("Flushing [FB:%d] " DRM_RECT_FMT "\n", fb->base.id, DRM_RECT_ARG(rect));
+	drm_dbg_kms(dev, "Flushing [FB:%d] " DRM_RECT_FMT "\n", fb->base.id, DRM_RECT_ARG(rect));
 
 	if (!dbi->dc || !full || swap ||
 	    fb->format->format == DRM_FORMAT_XRGB8888) {
@@ -282,7 +283,7 @@  static void mipi_dbi_fb_dirty(struct drm_framebuffer *fb, struct drm_rect *rect)
 				   width * height * 2);
 err_msg:
 	if (ret)
-		dev_err_once(fb->dev->dev, "Failed to update display %d\n", ret);
+		drm_err_once(dev, "Failed to update display %d\n", ret);
 
 	drm_dev_exit(idx);
 }
@@ -649,14 +650,14 @@  EXPORT_SYMBOL(mipi_dbi_display_is_on);
 
 static int mipi_dbi_poweron_reset_conditional(struct mipi_dbi_dev *dbidev, bool cond)
 {
-	struct device *dev = dbidev->drm.dev;
+	struct drm_device *dev = &dbidev->drm;
 	struct mipi_dbi *dbi = &dbidev->dbi;
 	int ret;
 
 	if (dbidev->regulator) {
 		ret = regulator_enable(dbidev->regulator);
 		if (ret) {
-			DRM_DEV_ERROR(dev, "Failed to enable regulator (%d)\n", ret);
+			drm_err(dev, "Failed to enable regulator (%d)\n", ret);
 			return ret;
 		}
 	}
@@ -667,7 +668,7 @@  static int mipi_dbi_poweron_reset_conditional(struct mipi_dbi_dev *dbidev, bool
 	mipi_dbi_hw_reset(dbi);
 	ret = mipi_dbi_command(dbi, MIPI_DCS_SOFT_RESET);
 	if (ret) {
-		DRM_DEV_ERROR(dev, "Failed to send reset command (%d)\n", ret);
+		drm_err(dev, "Failed to send reset command (%d)\n", ret);
 		if (dbidev->regulator)
 			regulator_disable(dbidev->regulator);
 		return ret;