diff mbox series

[09/22] drm/imx: Use drm_mode_duplicate()

Message ID 20220218100403.7028-10-ville.syrjala@linux.intel.com (mailing list archive)
State New, archived
Headers show
Series drm: Review of mode copies | expand

Commit Message

Ville Syrjälä Feb. 18, 2022, 10:03 a.m. UTC
From: Ville Syrjälä <ville.syrjala@linux.intel.com>

Replace the hand rolled drm_mode_duplicate() with the
real thing.

@is_dup@
@@
drm_mode_duplicate(...)
{ ... }

@depends on !is_dup@
expression dev, oldmode;
identifier newmode;
@@
- newmode = drm_mode_create(dev);
+ newmode = drm_mode_duplicate(dev, oldmode);
  ...
- drm_mode_copy(newmode, oldmode);

Cc: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 drivers/gpu/drm/imx/imx-ldb.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

Comments

Philipp Zabel Feb. 18, 2022, 11:42 a.m. UTC | #1
On Fri, 2022-02-18 at 12:03 +0200, Ville Syrjala wrote:
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> 
> Replace the hand rolled drm_mode_duplicate() with the
> real thing.
> 
> @is_dup@
> @@
> drm_mode_duplicate(...)
> { ... }
> 
> @depends on !is_dup@
> expression dev, oldmode;
> identifier newmode;
> @@
> - newmode = drm_mode_create(dev);
> + newmode = drm_mode_duplicate(dev, oldmode);
>   ...
> - drm_mode_copy(newmode, oldmode);
> 
> Cc: Philipp Zabel <p.zabel@pengutronix.de>
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>

Reviewed-by: Philipp Zabel <p.zabel@pengutronix.de>

regards
Philipp
diff mbox series

Patch

diff --git a/drivers/gpu/drm/imx/imx-ldb.c b/drivers/gpu/drm/imx/imx-ldb.c
index e5078d03020d..c8cf819f39ce 100644
--- a/drivers/gpu/drm/imx/imx-ldb.c
+++ b/drivers/gpu/drm/imx/imx-ldb.c
@@ -150,10 +150,9 @@  static int imx_ldb_connector_get_modes(struct drm_connector *connector)
 	if (imx_ldb_ch->mode_valid) {
 		struct drm_display_mode *mode;
 
-		mode = drm_mode_create(connector->dev);
+		mode = drm_mode_duplicate(connector->dev, &imx_ldb_ch->mode);
 		if (!mode)
 			return -EINVAL;
-		drm_mode_copy(mode, &imx_ldb_ch->mode);
 		mode->type |= DRM_MODE_TYPE_DRIVER | DRM_MODE_TYPE_PREFERRED;
 		drm_mode_probed_add(connector, mode);
 		num_modes++;