Commit f5ad671b authored by Daniel Vetter's avatar Daniel Vetter

drm/mipi_dbi: Use drmm_add_final_kfree in all drivers

They all share mipi_dbi_release so we need to switch them all
together. With this we can drop the final kfree from the release
function.

Aside, I think we could perhaps have a tiny additional helper for
these mipi_dbi drivers, the first few lines around devm_drm_dev_init
are all the same (except for the drm_driver pointer).
Acked-by: default avatarSam Ravnborg <sam@ravnborg.org>
Reviewed-by: default avatarNoralf Trønnes <noralf@tronnes.org>
Tested-by: default avatarNoralf Trønnes <noralf@tronnes.org>
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>
Signed-off-by: default avatarDaniel Vetter <daniel.vetter@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200323144950.3018436-6-daniel.vetter@ffwll.ch
parent 6f365e56
...@@ -589,13 +589,10 @@ EXPORT_SYMBOL(mipi_dbi_dev_init); ...@@ -589,13 +589,10 @@ EXPORT_SYMBOL(mipi_dbi_dev_init);
*/ */
void mipi_dbi_release(struct drm_device *drm) void mipi_dbi_release(struct drm_device *drm)
{ {
struct mipi_dbi_dev *dbidev = drm_to_mipi_dbi_dev(drm);
DRM_DEBUG_DRIVER("\n"); DRM_DEBUG_DRIVER("\n");
drm_mode_config_cleanup(drm); drm_mode_config_cleanup(drm);
drm_dev_fini(drm); drm_dev_fini(drm);
kfree(dbidev);
} }
EXPORT_SYMBOL(mipi_dbi_release); EXPORT_SYMBOL(mipi_dbi_release);
......
...@@ -21,6 +21,7 @@ ...@@ -21,6 +21,7 @@
#include <drm/drm_fb_helper.h> #include <drm/drm_fb_helper.h>
#include <drm/drm_gem_cma_helper.h> #include <drm/drm_gem_cma_helper.h>
#include <drm/drm_gem_framebuffer_helper.h> #include <drm/drm_gem_framebuffer_helper.h>
#include <drm/drm_managed.h>
#include <drm/drm_mipi_dbi.h> #include <drm/drm_mipi_dbi.h>
#include <drm/drm_modeset_helper.h> #include <drm/drm_modeset_helper.h>
#include <video/mipi_display.h> #include <video/mipi_display.h>
...@@ -236,6 +237,7 @@ static int hx8357d_probe(struct spi_device *spi) ...@@ -236,6 +237,7 @@ static int hx8357d_probe(struct spi_device *spi)
kfree(dbidev); kfree(dbidev);
return ret; return ret;
} }
drmm_add_final_kfree(drm, dbidev);
drm_mode_config_init(drm); drm_mode_config_init(drm);
......
...@@ -24,6 +24,7 @@ ...@@ -24,6 +24,7 @@
#include <drm/drm_fourcc.h> #include <drm/drm_fourcc.h>
#include <drm/drm_gem_cma_helper.h> #include <drm/drm_gem_cma_helper.h>
#include <drm/drm_gem_framebuffer_helper.h> #include <drm/drm_gem_framebuffer_helper.h>
#include <drm/drm_managed.h>
#include <drm/drm_mipi_dbi.h> #include <drm/drm_mipi_dbi.h>
#include <drm/drm_rect.h> #include <drm/drm_rect.h>
...@@ -387,6 +388,7 @@ static int ili9225_probe(struct spi_device *spi) ...@@ -387,6 +388,7 @@ static int ili9225_probe(struct spi_device *spi)
kfree(dbidev); kfree(dbidev);
return ret; return ret;
} }
drmm_add_final_kfree(drm, dbidev);
drm_mode_config_init(drm); drm_mode_config_init(drm);
......
...@@ -20,6 +20,7 @@ ...@@ -20,6 +20,7 @@
#include <drm/drm_fb_helper.h> #include <drm/drm_fb_helper.h>
#include <drm/drm_gem_cma_helper.h> #include <drm/drm_gem_cma_helper.h>
#include <drm/drm_gem_framebuffer_helper.h> #include <drm/drm_gem_framebuffer_helper.h>
#include <drm/drm_managed.h>
#include <drm/drm_mipi_dbi.h> #include <drm/drm_mipi_dbi.h>
#include <drm/drm_modeset_helper.h> #include <drm/drm_modeset_helper.h>
#include <video/mipi_display.h> #include <video/mipi_display.h>
...@@ -194,6 +195,7 @@ static int ili9341_probe(struct spi_device *spi) ...@@ -194,6 +195,7 @@ static int ili9341_probe(struct spi_device *spi)
kfree(dbidev); kfree(dbidev);
return ret; return ret;
} }
drmm_add_final_kfree(drm, dbidev);
drm_mode_config_init(drm); drm_mode_config_init(drm);
......
...@@ -19,6 +19,7 @@ ...@@ -19,6 +19,7 @@
#include <drm/drm_fb_helper.h> #include <drm/drm_fb_helper.h>
#include <drm/drm_gem_cma_helper.h> #include <drm/drm_gem_cma_helper.h>
#include <drm/drm_gem_framebuffer_helper.h> #include <drm/drm_gem_framebuffer_helper.h>
#include <drm/drm_managed.h>
#include <drm/drm_mipi_dbi.h> #include <drm/drm_mipi_dbi.h>
#include <drm/drm_modeset_helper.h> #include <drm/drm_modeset_helper.h>
...@@ -208,6 +209,7 @@ static int ili9486_probe(struct spi_device *spi) ...@@ -208,6 +209,7 @@ static int ili9486_probe(struct spi_device *spi)
kfree(dbidev); kfree(dbidev);
return ret; return ret;
} }
drmm_add_final_kfree(drm, dbidev);
drm_mode_config_init(drm); drm_mode_config_init(drm);
......
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
#include <drm/drm_fb_helper.h> #include <drm/drm_fb_helper.h>
#include <drm/drm_gem_cma_helper.h> #include <drm/drm_gem_cma_helper.h>
#include <drm/drm_gem_framebuffer_helper.h> #include <drm/drm_gem_framebuffer_helper.h>
#include <drm/drm_managed.h>
#include <drm/drm_mipi_dbi.h> #include <drm/drm_mipi_dbi.h>
#include <drm/drm_modeset_helper.h> #include <drm/drm_modeset_helper.h>
#include <video/mipi_display.h> #include <video/mipi_display.h>
...@@ -198,6 +199,7 @@ static int mi0283qt_probe(struct spi_device *spi) ...@@ -198,6 +199,7 @@ static int mi0283qt_probe(struct spi_device *spi)
kfree(dbidev); kfree(dbidev);
return ret; return ret;
} }
drmm_add_final_kfree(drm, dbidev);
drm_mode_config_init(drm); drm_mode_config_init(drm);
......
...@@ -21,6 +21,7 @@ ...@@ -21,6 +21,7 @@
#include <drm/drm_format_helper.h> #include <drm/drm_format_helper.h>
#include <drm/drm_gem_cma_helper.h> #include <drm/drm_gem_cma_helper.h>
#include <drm/drm_gem_framebuffer_helper.h> #include <drm/drm_gem_framebuffer_helper.h>
#include <drm/drm_managed.h>
#include <drm/drm_mipi_dbi.h> #include <drm/drm_mipi_dbi.h>
#include <drm/drm_rect.h> #include <drm/drm_rect.h>
...@@ -328,6 +329,7 @@ static int st7586_probe(struct spi_device *spi) ...@@ -328,6 +329,7 @@ static int st7586_probe(struct spi_device *spi)
kfree(dbidev); kfree(dbidev);
return ret; return ret;
} }
drmm_add_final_kfree(drm, dbidev);
drm_mode_config_init(drm); drm_mode_config_init(drm);
......
...@@ -21,6 +21,7 @@ ...@@ -21,6 +21,7 @@
#include <drm/drm_fb_helper.h> #include <drm/drm_fb_helper.h>
#include <drm/drm_gem_cma_helper.h> #include <drm/drm_gem_cma_helper.h>
#include <drm/drm_gem_framebuffer_helper.h> #include <drm/drm_gem_framebuffer_helper.h>
#include <drm/drm_managed.h>
#include <drm/drm_mipi_dbi.h> #include <drm/drm_mipi_dbi.h>
#define ST7735R_FRMCTR1 0xb1 #define ST7735R_FRMCTR1 0xb1
...@@ -209,6 +210,7 @@ static int st7735r_probe(struct spi_device *spi) ...@@ -209,6 +210,7 @@ static int st7735r_probe(struct spi_device *spi)
kfree(dbidev); kfree(dbidev);
return ret; return ret;
} }
drmm_add_final_kfree(drm, dbidev);
drm_mode_config_init(drm); drm_mode_config_init(drm);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment