Commit ec5d4a72 authored by Ville Syrjälä's avatar Ville Syrjälä
Browse files

drm/panel: Use drm_mode_duplicate()



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);

Signed-off-by: default avatarVille Syrjälä <ville.syrjala@linux.intel.com>
Cc: Thierry Reding <thierry.reding@gmail.com>
Cc: Sam Ravnborg <sam@ravnborg.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20220218100403.7028-21-ville.syrjala@linux.intel.com


Acked-by: default avatarSam Ravnborg <sam@ravnborg.org>
parent 193c4df5
Loading
Loading
Loading
Loading
+1 −2
Original line number Diff line number Diff line
@@ -446,7 +446,7 @@ static int truly_nt35597_get_modes(struct drm_panel *panel,
	const struct nt35597_config *config;

	config = ctx->config;
	mode = drm_mode_create(connector->dev);
	mode = drm_mode_duplicate(connector->dev, config->dm);
	if (!mode) {
		dev_err(ctx->dev, "failed to create a new display mode\n");
		return 0;
@@ -454,7 +454,6 @@ static int truly_nt35597_get_modes(struct drm_panel *panel,

	connector->display_info.width_mm = config->width_mm;
	connector->display_info.height_mm = config->height_mm;
	drm_mode_copy(mode, config->dm);
	mode->type = DRM_MODE_TYPE_DRIVER | DRM_MODE_TYPE_PREFERRED;
	drm_mode_probed_add(connector, mode);

+2 −2
Original line number Diff line number Diff line
@@ -168,7 +168,8 @@ static int visionox_rm69299_get_modes(struct drm_panel *panel,
	struct visionox_rm69299 *ctx = panel_to_ctx(panel);
	struct drm_display_mode *mode;

	mode = drm_mode_create(connector->dev);
	mode = drm_mode_duplicate(connector->dev,
				  &visionox_rm69299_1080x2248_60hz);
	if (!mode) {
		dev_err(ctx->panel.dev, "failed to create a new display mode\n");
		return 0;
@@ -176,7 +177,6 @@ static int visionox_rm69299_get_modes(struct drm_panel *panel,

	connector->display_info.width_mm = 74;
	connector->display_info.height_mm = 131;
	drm_mode_copy(mode, &visionox_rm69299_1080x2248_60hz);
	mode->type = DRM_MODE_TYPE_DRIVER | DRM_MODE_TYPE_PREFERRED;
	drm_mode_probed_add(connector, mode);