[PATCH v2 12/12] drm: panel: replace dev_* with DRM_DEV_* equivalent in panel-sharp-lq101r1sx01

Aastha Gupta aastha.gupta4104 at gmail.com
Tue Oct 24 14:11:03 UTC 2017


For drivers which could have multiple instances, it is necessary to
differentiate between which is which in the logs. Since
DRM_INFO/WARN/ERROR don’t do this, drivers used dev_info/warn/err to
make this differentiation. We now have DRM_DEV_* variants of the drm
print macros, so we can start to convert those drivers back to using
drm-formatted specific log messages.

This patch is using following Coccinelle script:
@@
@@

(
- dev_info
+ DRM_DEV_INFO
|
- dev_err
+ DRM_DEV_ERROR
|
- dev_dbg
+ DRM_DEV_DEBUG
)

Signed-off-by: Aastha Gupta <aastha.gupta4104 at gmail.com>
---
 drivers/gpu/drm/panel/panel-sharp-lq101r1sx01.c | 60 +++++++++++++++----------
 1 file changed, 37 insertions(+), 23 deletions(-)

diff --git a/drivers/gpu/drm/panel/panel-sharp-lq101r1sx01.c b/drivers/gpu/drm/panel/panel-sharp-lq101r1sx01.c
index 3cce3ca..42a9d4d 100644
--- a/drivers/gpu/drm/panel/panel-sharp-lq101r1sx01.c
+++ b/drivers/gpu/drm/panel/panel-sharp-lq101r1sx01.c
@@ -57,14 +57,14 @@ static int sharp_panel_write(struct sharp_panel *sharp, u16 offset, u8 value)
 
 	err = mipi_dsi_generic_write(dsi, payload, sizeof(payload));
 	if (err < 0) {
-		dev_err(&dsi->dev, "failed to write %02x to %04x: %zd\n",
-			value, offset, err);
+		DRM_DEV_ERROR(&dsi->dev, "failed to write %02x to %04x: %zd\n",
+			      value, offset, err);
 		return err;
 	}
 
 	err = mipi_dsi_dcs_nop(dsi);
 	if (err < 0) {
-		dev_err(&dsi->dev, "failed to send DCS nop: %zd\n", err);
+		DRM_DEV_ERROR(&dsi->dev, "failed to send DCS nop: %zd\n", err);
 		return err;
 	}
 
@@ -83,8 +83,9 @@ static __maybe_unused int sharp_panel_read(struct sharp_panel *sharp,
 	err = mipi_dsi_generic_read(sharp->link1, &offset, sizeof(offset),
 				    value, sizeof(*value));
 	if (err < 0)
-		dev_err(&sharp->link1->dev, "failed to read from %04x: %zd\n",
-			offset, err);
+		DRM_DEV_ERROR(&sharp->link1->dev,
+			      "failed to read from %04x: %zd\n",
+			      offset, err);
 
 	return err;
 }
@@ -118,11 +119,13 @@ static int sharp_panel_unprepare(struct drm_panel *panel)
 
 	err = mipi_dsi_dcs_set_display_off(sharp->link1);
 	if (err < 0)
-		dev_err(panel->dev, "failed to set display off: %d\n", err);
+		DRM_DEV_ERROR(panel->dev,
+			      "failed to set display off: %d\n", err);
 
 	err = mipi_dsi_dcs_enter_sleep_mode(sharp->link1);
 	if (err < 0)
-		dev_err(panel->dev, "failed to enter sleep mode: %d\n", err);
+		DRM_DEV_ERROR(panel->dev,
+			      "failed to enter sleep mode: %d\n", err);
 
 	msleep(120);
 
@@ -141,26 +144,30 @@ static int sharp_setup_symmetrical_split(struct mipi_dsi_device *left,
 
 	err = mipi_dsi_dcs_set_column_address(left, 0, mode->hdisplay / 2 - 1);
 	if (err < 0) {
-		dev_err(&left->dev, "failed to set column address: %d\n", err);
+		DRM_DEV_ERROR(&left->dev,
+			      "failed to set column address: %d\n", err);
 		return err;
 	}
 
 	err = mipi_dsi_dcs_set_page_address(left, 0, mode->vdisplay - 1);
 	if (err < 0) {
-		dev_err(&left->dev, "failed to set page address: %d\n", err);
+		DRM_DEV_ERROR(&left->dev,
+			      "failed to set page address: %d\n", err);
 		return err;
 	}
 
 	err = mipi_dsi_dcs_set_column_address(right, mode->hdisplay / 2,
 					      mode->hdisplay - 1);
 	if (err < 0) {
-		dev_err(&right->dev, "failed to set column address: %d\n", err);
+		DRM_DEV_ERROR(&right->dev,
+			      "failed to set column address: %d\n", err);
 		return err;
 	}
 
 	err = mipi_dsi_dcs_set_page_address(right, 0, mode->vdisplay - 1);
 	if (err < 0) {
-		dev_err(&right->dev, "failed to set page address: %d\n", err);
+		DRM_DEV_ERROR(&right->dev,
+			      "failed to set page address: %d\n", err);
 		return err;
 	}
 
@@ -190,7 +197,8 @@ static int sharp_panel_prepare(struct drm_panel *panel)
 
 	err = mipi_dsi_dcs_exit_sleep_mode(sharp->link1);
 	if (err < 0) {
-		dev_err(panel->dev, "failed to exit sleep mode: %d\n", err);
+		DRM_DEV_ERROR(panel->dev,
+			      "failed to exit sleep mode: %d\n", err);
 		goto poweroff;
 	}
 
@@ -206,20 +214,23 @@ static int sharp_panel_prepare(struct drm_panel *panel)
 	/* set left-right mode */
 	err = sharp_panel_write(sharp, 0x1000, 0x2a);
 	if (err < 0) {
-		dev_err(panel->dev, "failed to set left-right mode: %d\n", err);
+		DRM_DEV_ERROR(panel->dev,
+			      "failed to set left-right mode: %d\n", err);
 		goto poweroff;
 	}
 
 	/* enable command mode */
 	err = sharp_panel_write(sharp, 0x1001, 0x01);
 	if (err < 0) {
-		dev_err(panel->dev, "failed to enable command mode: %d\n", err);
+		DRM_DEV_ERROR(panel->dev,
+			      "failed to enable command mode: %d\n", err);
 		goto poweroff;
 	}
 
 	err = mipi_dsi_dcs_set_pixel_format(sharp->link1, format);
 	if (err < 0) {
-		dev_err(panel->dev, "failed to set pixel format: %d\n", err);
+		DRM_DEV_ERROR(panel->dev,
+			      "failed to set pixel format: %d\n", err);
 		goto poweroff;
 	}
 
@@ -233,14 +244,16 @@ static int sharp_panel_prepare(struct drm_panel *panel)
 	err = sharp_setup_symmetrical_split(sharp->link1, sharp->link2,
 					    sharp->mode);
 	if (err < 0) {
-		dev_err(panel->dev, "failed to set up symmetrical split: %d\n",
-			err);
+		DRM_DEV_ERROR(panel->dev,
+			      "failed to set up symmetrical split: %d\n",
+			      err);
 		goto poweroff;
 	}
 
 	err = mipi_dsi_dcs_set_display_on(sharp->link1);
 	if (err < 0) {
-		dev_err(panel->dev, "failed to set display on: %d\n", err);
+		DRM_DEV_ERROR(panel->dev,
+			      "failed to set display on: %d\n", err);
 		goto poweroff;
 	}
 
@@ -292,9 +305,9 @@ static int sharp_panel_get_modes(struct drm_panel *panel)
 
 	mode = drm_mode_duplicate(panel->drm, &default_mode);
 	if (!mode) {
-		dev_err(panel->drm->dev, "failed to add mode %ux%ux@%u\n",
-			default_mode.hdisplay, default_mode.vdisplay,
-			default_mode.vrefresh);
+		DRM_DEV_ERROR(panel->drm->dev, "failed to add mode %ux%ux@%u\n",
+			      default_mode.hdisplay, default_mode.vdisplay,
+			      default_mode.vrefresh);
 		return -ENOMEM;
 	}
 
@@ -436,11 +449,12 @@ static int sharp_panel_remove(struct mipi_dsi_device *dsi)
 
 	err = sharp_panel_disable(&sharp->base);
 	if (err < 0)
-		dev_err(&dsi->dev, "failed to disable panel: %d\n", err);
+		DRM_DEV_ERROR(&dsi->dev, "failed to disable panel: %d\n", err);
 
 	err = mipi_dsi_detach(dsi);
 	if (err < 0)
-		dev_err(&dsi->dev, "failed to detach from DSI host: %d\n", err);
+		DRM_DEV_ERROR(&dsi->dev,
+			      "failed to detach from DSI host: %d\n", err);
 
 	drm_panel_detach(&sharp->base);
 	sharp_panel_del(sharp);
-- 
2.7.4



More information about the dri-devel mailing list