The ssd130x_connector_get_modes function contains a manual implementation
to manage modes.

This pattern is common for simple displays, and the DRM core already
provides the drm_connector_helper_get_modes_fixed() helper for this exact
use case.

Reviewed-by: Javier Martinez Canillas <[email protected]>
Reviewed-by: Thomas Zimmermann <[email protected]>
Signed-off-by: Iker Pedrosa <[email protected]>
---
 drivers/gpu/drm/solomon/ssd130x.c | 14 +-------------
 1 file changed, 1 insertion(+), 13 deletions(-)

diff --git a/drivers/gpu/drm/solomon/ssd130x.c 
b/drivers/gpu/drm/solomon/ssd130x.c
index 
6083fd9e9e5e4def670961dc46df7e4adef7462d..50528a94cd3bcfa46517c6ffccf3f458e17cf816
 100644
--- a/drivers/gpu/drm/solomon/ssd130x.c
+++ b/drivers/gpu/drm/solomon/ssd130x.c
@@ -1732,20 +1732,8 @@ static const struct drm_encoder_funcs 
ssd130x_encoder_funcs = {
 static int ssd130x_connector_get_modes(struct drm_connector *connector)
 {
        struct ssd130x_device *ssd130x = drm_to_ssd130x(connector->dev);
-       struct drm_display_mode *mode;
-       struct device *dev = ssd130x->dev;
-
-       mode = drm_mode_duplicate(connector->dev, &ssd130x->mode);
-       if (!mode) {
-               dev_err(dev, "Failed to duplicated mode\n");
-               return 0;
-       }
-
-       drm_mode_probed_add(connector, mode);
-       drm_set_preferred_mode(connector, mode->hdisplay, mode->vdisplay);
 
-       /* There is only a single mode */
-       return 1;
+       return drm_connector_helper_get_modes_fixed(connector, &ssd130x->mode);
 }
 
 static const struct drm_connector_helper_funcs ssd130x_connector_helper_funcs 
= {

-- 
2.51.0

Reply via email to