Hi Noralf. On Sun, Feb 10, 2019 at 02:10:36PM +0100, Noralf Trønnes wrote: > Use devm_drm_dev_init() and drop using tinydrm_device. > > v2: devm_drm_dev_register() was dropped so add driver release callbacks. > > Signed-off-by: Noralf Trønnes <noralf@xxxxxxxxxxx> > --- > drivers/gpu/drm/tinydrm/hx8357d.c | 40 +++++++++-- > drivers/gpu/drm/tinydrm/ili9225.c | 40 +++++++++-- > drivers/gpu/drm/tinydrm/ili9341.c | 40 +++++++++-- > drivers/gpu/drm/tinydrm/mi0283qt.c | 40 +++++++++-- > drivers/gpu/drm/tinydrm/mipi-dbi.c | 67 +++++++++++------- > drivers/gpu/drm/tinydrm/st7586.c | 105 ++++++++++++++++------------- > drivers/gpu/drm/tinydrm/st7735r.c | 40 +++++++++-- > include/drm/tinydrm/mipi-dbi.h | 26 ++++--- > 8 files changed, 294 insertions(+), 104 deletions(-) > > diff --git a/drivers/gpu/drm/tinydrm/hx8357d.c b/drivers/gpu/drm/tinydrm/hx8357d.c > index 84dda622df85..e9b9e08fafc7 100644 > --- a/drivers/gpu/drm/tinydrm/hx8357d.c > +++ b/drivers/gpu/drm/tinydrm/hx8357d.c > @@ -18,6 +18,7 @@ > > #include <drm/drm_atomic_helper.h> > #include <drm/drm_drv.h> > +#include <drm/drm_fb_helper.h> > #include <drm/drm_gem_cma_helper.h> > #include <drm/drm_gem_framebuffer_helper.h> > #include <drm/drm_modeset_helper.h> > @@ -189,6 +190,7 @@ DEFINE_DRM_GEM_CMA_FOPS(hx8357d_fops); > static struct drm_driver hx8357d_driver = { > .driver_features = DRIVER_GEM | DRIVER_MODESET | DRIVER_PRIME | DRIVER_ATOMIC, > .fops = &hx8357d_fops, > + .release = mipi_dbi_release, > DRM_GEM_CMA_VMAP_DRIVER_OPS, > .debugfs_init = mipi_dbi_debugfs_init, > .name = "hx8357d", > @@ -213,15 +215,25 @@ MODULE_DEVICE_TABLE(spi, hx8357d_id); > static int hx8357d_probe(struct spi_device *spi) > { > struct device *dev = &spi->dev; > + struct drm_device *drm; > struct mipi_dbi *mipi; > struct gpio_desc *dc; > u32 rotation = 0; > int ret; > > - mipi = devm_kzalloc(dev, sizeof(*mipi), GFP_KERNEL); > + mipi = kzalloc(sizeof(*mipi), GFP_KERNEL); > if (!mipi) > return -ENOMEM; > > + drm = &mipi->drm; > + ret = devm_drm_dev_init(dev, drm, &hx8357d_driver); > + if (ret) { > + kfree(mipi); > + return ret; > + } > + > + 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"); > @@ -238,14 +250,31 @@ static int hx8357d_probe(struct spi_device *spi) > if (ret) > return ret; > > - ret = mipi_dbi_init(&spi->dev, mipi, &hx8357d_pipe_funcs, > - &hx8357d_driver, &yx350hv15_mode, rotation); > + ret = mipi_dbi_init(mipi, &hx8357d_pipe_funcs, &yx350hv15_mode, rotation); > if (ret) > return ret; > > - spi_set_drvdata(spi, mipi->tinydrm.drm); > + drm_mode_config_reset(drm); > > - return devm_tinydrm_register(&mipi->tinydrm); > + ret = drm_dev_register(drm, 0); > + if (ret) > + return ret; > + > + spi_set_drvdata(spi, drm); > + > + drm_fbdev_generic_setup(drm, 32); > + > + return 0; > +} > + > +static int hx8357d_remove(struct spi_device *spi) > +{ > + struct drm_device *drm = spi_get_drvdata(spi); > + > + drm_dev_unplug(drm); > + drm_atomic_helper_shutdown(drm); > + > + return 0; > } The sample code uses drm_dev_unregister() in the _remove() function. Do I miss something obvious? Sam _______________________________________________ dri-devel mailing list dri-devel@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/dri-devel