Message ID | 20241115-drm-connector-mode-valid-const-v1-3-b1b523156f71@linaro.org |
---|---|
State | Superseded |
Headers | show |
Series | drm/connector: make mode_valid() callback accept const mode pointer | expand |
Hi Dmitry, Thank you for the patch. On Fri, Nov 15, 2024 at 11:09:28PM +0200, Dmitry Baryshkov wrote: > Make hda_get_mode_idx() accept const struct drm_display_mode pointer > instead of just raw struct drm_display_mode. This is a preparation to > converting the mode_valid() callback of drm_connector to accept const > struct drm_display_mode argument. > > Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org> Reviewed-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com> > --- > drivers/gpu/drm/sti/sti_hda.c | 10 +++++----- > 1 file changed, 5 insertions(+), 5 deletions(-) > > diff --git a/drivers/gpu/drm/sti/sti_hda.c b/drivers/gpu/drm/sti/sti_hda.c > index f18faad974aa2eda58c1e49537f8337db119d4b7..829dc4b034e8a79a908bda60485c2b94ef96890c 100644 > --- a/drivers/gpu/drm/sti/sti_hda.c > +++ b/drivers/gpu/drm/sti/sti_hda.c > @@ -280,12 +280,12 @@ static void hda_write(struct sti_hda *hda, u32 val, int offset) > * > * Return true if mode is found > */ > -static bool hda_get_mode_idx(struct drm_display_mode mode, int *idx) > +static bool hda_get_mode_idx(const struct drm_display_mode *mode, int *idx) > { > unsigned int i; > > for (i = 0; i < ARRAY_SIZE(hda_supported_modes); i++) > - if (drm_mode_equal(&hda_supported_modes[i].mode, &mode)) { > + if (drm_mode_equal(&hda_supported_modes[i].mode, mode)) { > *idx = i; > return true; > } > @@ -443,7 +443,7 @@ static void sti_hda_pre_enable(struct drm_bridge *bridge) > if (clk_prepare_enable(hda->clk_hddac)) > DRM_ERROR("Failed to prepare/enable hda_hddac clk\n"); > > - if (!hda_get_mode_idx(hda->mode, &mode_idx)) { > + if (!hda_get_mode_idx(&hda->mode, &mode_idx)) { > DRM_ERROR("Undefined mode\n"); > return; > } > @@ -526,7 +526,7 @@ static void sti_hda_set_mode(struct drm_bridge *bridge, > > drm_mode_copy(&hda->mode, mode); > > - if (!hda_get_mode_idx(hda->mode, &mode_idx)) { > + if (!hda_get_mode_idx(&hda->mode, &mode_idx)) { > DRM_ERROR("Undefined mode\n"); > return; > } > @@ -614,7 +614,7 @@ sti_hda_connector_mode_valid(struct drm_connector *connector, > = to_sti_hda_connector(connector); > struct sti_hda *hda = hda_connector->hda; > > - if (!hda_get_mode_idx(*mode, &idx)) { > + if (!hda_get_mode_idx(mode, &idx)) { > return MODE_BAD; > } else { > result = clk_round_rate(hda->clk_pix, target); >
> Make hda_get_mode_idx() accept const struct drm_display_mode pointer > instead of just raw struct drm_display_mode. This is a preparation to > converting the mode_valid() callback of drm_connector to accept const > struct drm_display_mode argument. > > Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org> > --- Hi Dmitry, Thank you for the patch. Acked-by: Raphael Gallais-Pou <rgallaispou@gmail.com> Regards, Raphaël
diff --git a/drivers/gpu/drm/sti/sti_hda.c b/drivers/gpu/drm/sti/sti_hda.c index f18faad974aa2eda58c1e49537f8337db119d4b7..829dc4b034e8a79a908bda60485c2b94ef96890c 100644 --- a/drivers/gpu/drm/sti/sti_hda.c +++ b/drivers/gpu/drm/sti/sti_hda.c @@ -280,12 +280,12 @@ static void hda_write(struct sti_hda *hda, u32 val, int offset) * * Return true if mode is found */ -static bool hda_get_mode_idx(struct drm_display_mode mode, int *idx) +static bool hda_get_mode_idx(const struct drm_display_mode *mode, int *idx) { unsigned int i; for (i = 0; i < ARRAY_SIZE(hda_supported_modes); i++) - if (drm_mode_equal(&hda_supported_modes[i].mode, &mode)) { + if (drm_mode_equal(&hda_supported_modes[i].mode, mode)) { *idx = i; return true; } @@ -443,7 +443,7 @@ static void sti_hda_pre_enable(struct drm_bridge *bridge) if (clk_prepare_enable(hda->clk_hddac)) DRM_ERROR("Failed to prepare/enable hda_hddac clk\n"); - if (!hda_get_mode_idx(hda->mode, &mode_idx)) { + if (!hda_get_mode_idx(&hda->mode, &mode_idx)) { DRM_ERROR("Undefined mode\n"); return; } @@ -526,7 +526,7 @@ static void sti_hda_set_mode(struct drm_bridge *bridge, drm_mode_copy(&hda->mode, mode); - if (!hda_get_mode_idx(hda->mode, &mode_idx)) { + if (!hda_get_mode_idx(&hda->mode, &mode_idx)) { DRM_ERROR("Undefined mode\n"); return; } @@ -614,7 +614,7 @@ sti_hda_connector_mode_valid(struct drm_connector *connector, = to_sti_hda_connector(connector); struct sti_hda *hda = hda_connector->hda; - if (!hda_get_mode_idx(*mode, &idx)) { + if (!hda_get_mode_idx(mode, &idx)) { return MODE_BAD; } else { result = clk_round_rate(hda->clk_pix, target);
Make hda_get_mode_idx() accept const struct drm_display_mode pointer instead of just raw struct drm_display_mode. This is a preparation to converting the mode_valid() callback of drm_connector to accept const struct drm_display_mode argument. Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org> --- drivers/gpu/drm/sti/sti_hda.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)