drm/mipi-dbi: Move drm_mode_config_init into mipi library
authorDaniel Vetter <daniel.vetter@ffwll.ch>
Mon, 23 Mar 2020 14:49:46 +0000 (15:49 +0100)
committerDaniel Vetter <daniel.vetter@ffwll.ch>
Thu, 26 Mar 2020 15:09:03 +0000 (16:09 +0100)
7/7 drivers agree that's the right choice, let's do this.

This avoids duplicating the same old error checking code over all 7
drivers, which is the motivation here.

Acked-by: Sam Ravnborg <sam@ravnborg.org>
Reviewed-by: Noralf Trønnes <noralf@tronnes.org>
Tested-by: Noralf Trønnes <noralf@tronnes.org>
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Cc: Maxime Ripard <mripard@kernel.org>
Cc: Thomas Zimmermann <tzimmermann@suse.de>
Cc: David Airlie <airlied@linux.ie>
Cc: Daniel Vetter <daniel@ffwll.ch>
Cc: Eric Anholt <eric@anholt.net>
Cc: David Lechner <david@lechnology.com>
Cc: Kamlesh Gurudasani <kamlesh.gurudasani@gmail.com>
Cc: "Noralf Trønnes" <noralf@tronnes.org>
Cc: Sam Ravnborg <sam@ravnborg.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20200323144950.3018436-48-daniel.vetter@ffwll.ch
drivers/gpu/drm/drm_mipi_dbi.c
drivers/gpu/drm/tiny/hx8357d.c
drivers/gpu/drm/tiny/ili9225.c
drivers/gpu/drm/tiny/ili9341.c
drivers/gpu/drm/tiny/ili9486.c
drivers/gpu/drm/tiny/mi0283qt.c
drivers/gpu/drm/tiny/st7586.c
drivers/gpu/drm/tiny/st7735r.c

index 44de8502a472ed2d521928cde6c1223efa324c37..bef93191882cf34a3f365c5dd4f835180d1ebafe 100644 (file)
@@ -511,6 +511,10 @@ int mipi_dbi_dev_init_with_formats(struct mipi_dbi_dev *dbidev,
        if (!dbidev->dbi.command)
                return -EINVAL;
 
+       ret = drm_mode_config_init(drm);
+       if (ret)
+               return ret;
+
        dbidev->tx_buf = devm_kmalloc(drm->dev, tx_buf_size, GFP_KERNEL);
        if (!dbidev->tx_buf)
                return -ENOMEM;
index 42bc5dadcb1c035a3fd859deaa12dfc1bfbec34d..c88b84366dc5aab5ec00079aa2db51b6a6a2b9df 100644 (file)
@@ -239,8 +239,6 @@ static int hx8357d_probe(struct spi_device *spi)
        }
        drmm_add_final_kfree(drm, dbidev);
 
-       drm_mode_config_init(drm);
-
        dc = devm_gpiod_get(dev, "dc", GPIOD_OUT_LOW);
        if (IS_ERR(dc)) {
                DRM_DEV_ERROR(dev, "Failed to get gpio 'dc'\n");
index aae88dc5b3f781210a7e61bad78569b234d313c8..fa998a16026c906a6cae55dbb5baa77b832adb5f 100644 (file)
@@ -390,8 +390,6 @@ static int ili9225_probe(struct spi_device *spi)
        }
        drmm_add_final_kfree(drm, dbidev);
 
-       drm_mode_config_init(drm);
-
        dbi->reset = devm_gpiod_get(dev, "reset", GPIOD_OUT_HIGH);
        if (IS_ERR(dbi->reset)) {
                DRM_DEV_ERROR(dev, "Failed to get gpio 'reset'\n");
index 7d40cb4ff72be82379914cd148cdf1c5880340bc..945e1516986699d090807728501b3ffb60dafc47 100644 (file)
@@ -197,8 +197,6 @@ static int ili9341_probe(struct spi_device *spi)
        }
        drmm_add_final_kfree(drm, dbidev);
 
-       drm_mode_config_init(drm);
-
        dbi->reset = devm_gpiod_get_optional(dev, "reset", GPIOD_OUT_HIGH);
        if (IS_ERR(dbi->reset)) {
                DRM_DEV_ERROR(dev, "Failed to get gpio 'reset'\n");
index 9515eed2625c075c6a0da3388e3d5604a01ca244..bf29b225d23a7abbbcd3bc5f4cd4b43062270b46 100644 (file)
@@ -211,8 +211,6 @@ static int ili9486_probe(struct spi_device *spi)
        }
        drmm_add_final_kfree(drm, dbidev);
 
-       drm_mode_config_init(drm);
-
        dbi->reset = devm_gpiod_get(dev, "reset", GPIOD_OUT_HIGH);
        if (IS_ERR(dbi->reset)) {
                DRM_DEV_ERROR(dev, "Failed to get gpio 'reset'\n");
index 8555a56bce8c29f9d440757cbafae993a2834694..b8c973bc2347da694bb66688673ca849660f7b8d 100644 (file)
@@ -201,8 +201,6 @@ static int mi0283qt_probe(struct spi_device *spi)
        }
        drmm_add_final_kfree(drm, dbidev);
 
-       drm_mode_config_init(drm);
-
        dbi->reset = devm_gpiod_get_optional(dev, "reset", GPIOD_OUT_HIGH);
        if (IS_ERR(dbi->reset)) {
                DRM_DEV_ERROR(dev, "Failed to get gpio 'reset'\n");
index 427c2561f5f4f3bffed391affae49aec04e50c19..1f1a576be93c9c4137ea732bf7053e624dd97a7d 100644 (file)
@@ -331,8 +331,6 @@ static int st7586_probe(struct spi_device *spi)
        }
        drmm_add_final_kfree(drm, dbidev);
 
-       drm_mode_config_init(drm);
-
        bufsize = (st7586_mode.vdisplay + 2) / 3 * st7586_mode.hdisplay;
 
        dbi->reset = devm_gpiod_get(dev, "reset", GPIOD_OUT_HIGH);
index 0790975695406da25467820b3511fca17421e308..1371005ed4d0501186c23203b74a417d21f5b287 100644 (file)
@@ -212,8 +212,6 @@ static int st7735r_probe(struct spi_device *spi)
        }
        drmm_add_final_kfree(drm, dbidev);
 
-       drm_mode_config_init(drm);
-
        dbi->reset = devm_gpiod_get(dev, "reset", GPIOD_OUT_HIGH);
        if (IS_ERR(dbi->reset)) {
                DRM_DEV_ERROR(dev, "Failed to get gpio 'reset'\n");