From: Iker Pedrosa Date: Sat, 20 Sep 2025 09:45:43 +0000 (+0200) Subject: drm/solomon: Simplify mode_valid() using DRM helper X-Git-Tag: v6.19-rc1~157^2~24^2~65 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=7556fe21fdde79f5a919917578d04c419447f41e;p=thirdparty%2Flinux.git drm/solomon: Simplify mode_valid() using DRM helper The ssd130x_crtc_mode_valid() function contains a manual implementation to validate the display mode against the panel's single fixed resolution. This pattern is common for simple displays, and the DRM core already provides the drm_crtc_helper_mode_valid_fixed() helper for this exact use case. Reviewed-by: Javier Martinez Canillas Reviewed-by: Thomas Zimmermann Signed-off-by: Iker Pedrosa Link: https://lore.kernel.org/r/20250920-improve-ssd130x-v2-3-77721e87ae08@gmail.com Signed-off-by: Javier Martinez Canillas --- diff --git a/drivers/gpu/drm/solomon/ssd130x.c b/drivers/gpu/drm/solomon/ssd130x.c index 09792be46f91e..80ff9005c104e 100644 --- a/drivers/gpu/drm/solomon/ssd130x.c +++ b/drivers/gpu/drm/solomon/ssd130x.c @@ -1473,15 +1473,7 @@ static enum drm_mode_status ssd130x_crtc_mode_valid(struct drm_crtc *crtc, { struct ssd130x_device *ssd130x = drm_to_ssd130x(crtc->dev); - if (mode->hdisplay != ssd130x->mode.hdisplay && - mode->vdisplay != ssd130x->mode.vdisplay) - return MODE_ONE_SIZE; - else if (mode->hdisplay != ssd130x->mode.hdisplay) - return MODE_ONE_WIDTH; - else if (mode->vdisplay != ssd130x->mode.vdisplay) - return MODE_ONE_HEIGHT; - - return MODE_OK; + return drm_crtc_helper_mode_valid_fixed(crtc, mode, &ssd130x->mode); } static int ssd130x_crtc_atomic_check(struct drm_crtc *crtc,