From 67822ae11971c664f5d28d7914b4b00cff07a9fd Mon Sep 17 00:00:00 2001 From: Laurent Pinchart Date: Fri, 2 Mar 2018 01:25:32 +0200 Subject: [PATCH] drm/omap: dss: Remove panel devices list The panel devices list isn't used anymore, all panel devices are accessed through the global devices list. Remove it. Signed-off-by: Laurent Pinchart Reviewed-by: Sebastian Reichel Signed-off-by: Tomi Valkeinen --- .../omapdrm/displays/connector-analog-tv.c | 9 ++----- .../gpu/drm/omapdrm/displays/connector-dvi.c | 14 ++-------- .../gpu/drm/omapdrm/displays/connector-hdmi.c | 8 ++---- drivers/gpu/drm/omapdrm/displays/panel-dpi.c | 8 ++---- .../gpu/drm/omapdrm/displays/panel-dsi-cm.c | 8 ++---- .../displays/panel-lgphilips-lb035q02.c | 8 ++---- .../omapdrm/displays/panel-nec-nl8048hl11.c | 8 ++---- .../displays/panel-sharp-ls037v7dw01.c | 8 ++---- .../omapdrm/displays/panel-sony-acx565akm.c | 27 ++++++------------- .../omapdrm/displays/panel-tpo-td028ttec1.c | 8 ++---- .../omapdrm/displays/panel-tpo-td043mtea1.c | 22 ++++----------- drivers/gpu/drm/omapdrm/dss/display.c | 23 ---------------- drivers/gpu/drm/omapdrm/dss/omapdss.h | 3 --- 13 files changed, 31 insertions(+), 123 deletions(-) diff --git a/drivers/gpu/drm/omapdrm/displays/connector-analog-tv.c b/drivers/gpu/drm/omapdrm/displays/connector-analog-tv.c index ae3976a97ce2..49720117da15 100644 --- a/drivers/gpu/drm/omapdrm/displays/connector-analog-tv.c +++ b/drivers/gpu/drm/omapdrm/displays/connector-analog-tv.c @@ -154,7 +154,6 @@ static int tvc_probe(struct platform_device *pdev) { struct panel_drv_data *ddata; struct omap_dss_device *dssdev; - int r; ddata = devm_kzalloc(&pdev->dev, sizeof(*ddata), GFP_KERNEL); if (!ddata) @@ -172,11 +171,7 @@ static int tvc_probe(struct platform_device *pdev) dssdev->owner = THIS_MODULE; omapdss_display_init(dssdev); - r = omapdss_register_display(dssdev); - if (r) { - dev_err(&pdev->dev, "Failed to register panel\n"); - return r; - } + omapdss_device_register(dssdev); return 0; } @@ -186,7 +181,7 @@ static int __exit tvc_remove(struct platform_device *pdev) struct panel_drv_data *ddata = platform_get_drvdata(pdev); struct omap_dss_device *dssdev = &ddata->dssdev; - omapdss_unregister_display(&ddata->dssdev); + omapdss_device_unregister(&ddata->dssdev); tvc_disable(dssdev); omapdss_device_disconnect(dssdev, NULL); diff --git a/drivers/gpu/drm/omapdrm/displays/connector-dvi.c b/drivers/gpu/drm/omapdrm/displays/connector-dvi.c index 5e3ef5e9e9f6..7876e61bf63e 100644 --- a/drivers/gpu/drm/omapdrm/displays/connector-dvi.c +++ b/drivers/gpu/drm/omapdrm/displays/connector-dvi.c @@ -391,19 +391,9 @@ static int dvic_probe(struct platform_device *pdev) dssdev->owner = THIS_MODULE; omapdss_display_init(dssdev); - r = omapdss_register_display(dssdev); - if (r) { - dev_err(&pdev->dev, "Failed to register panel\n"); - goto err_reg; - } + omapdss_device_register(dssdev); return 0; - -err_reg: - i2c_put_adapter(ddata->i2c_adapter); - mutex_destroy(&ddata->hpd_lock); - - return r; } static int __exit dvic_remove(struct platform_device *pdev) @@ -411,7 +401,7 @@ static int __exit dvic_remove(struct platform_device *pdev) struct panel_drv_data *ddata = platform_get_drvdata(pdev); struct omap_dss_device *dssdev = &ddata->dssdev; - omapdss_unregister_display(&ddata->dssdev); + omapdss_device_unregister(&ddata->dssdev); dvic_disable(dssdev); omapdss_device_disconnect(dssdev, NULL); diff --git a/drivers/gpu/drm/omapdrm/displays/connector-hdmi.c b/drivers/gpu/drm/omapdrm/displays/connector-hdmi.c index cf64742d8646..5e07a8479cfc 100644 --- a/drivers/gpu/drm/omapdrm/displays/connector-hdmi.c +++ b/drivers/gpu/drm/omapdrm/displays/connector-hdmi.c @@ -351,11 +351,7 @@ static int hdmic_probe(struct platform_device *pdev) dssdev->owner = THIS_MODULE; omapdss_display_init(dssdev); - r = omapdss_register_display(dssdev); - if (r) { - dev_err(&pdev->dev, "Failed to register panel\n"); - return r; - } + omapdss_device_register(dssdev); return 0; } @@ -365,7 +361,7 @@ static int __exit hdmic_remove(struct platform_device *pdev) struct panel_drv_data *ddata = platform_get_drvdata(pdev); struct omap_dss_device *dssdev = &ddata->dssdev; - omapdss_unregister_display(&ddata->dssdev); + omapdss_device_unregister(&ddata->dssdev); hdmic_disable(dssdev); omapdss_device_disconnect(dssdev, NULL); diff --git a/drivers/gpu/drm/omapdrm/displays/panel-dpi.c b/drivers/gpu/drm/omapdrm/displays/panel-dpi.c index c4c529531243..3e2bca737de0 100644 --- a/drivers/gpu/drm/omapdrm/displays/panel-dpi.c +++ b/drivers/gpu/drm/omapdrm/displays/panel-dpi.c @@ -219,11 +219,7 @@ static int panel_dpi_probe(struct platform_device *pdev) dssdev->owner = THIS_MODULE; omapdss_display_init(dssdev); - r = omapdss_register_display(dssdev); - if (r) { - dev_err(&pdev->dev, "Failed to register panel\n"); - return r; - } + omapdss_device_register(dssdev); return 0; } @@ -233,7 +229,7 @@ static int __exit panel_dpi_remove(struct platform_device *pdev) struct panel_drv_data *ddata = platform_get_drvdata(pdev); struct omap_dss_device *dssdev = &ddata->dssdev; - omapdss_unregister_display(dssdev); + omapdss_device_unregister(dssdev); panel_dpi_disable(dssdev); omapdss_device_disconnect(dssdev, NULL); diff --git a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c index 479ce69fd8d8..0614db1c7366 100644 --- a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c +++ b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c @@ -1329,11 +1329,7 @@ static int dsicm_probe(struct platform_device *pdev) OMAP_DSS_DISPLAY_CAP_TEAR_ELIM; omapdss_display_init(dssdev); - r = omapdss_register_display(dssdev); - if (r) { - dev_err(dev, "Failed to register panel\n"); - goto err_reg; - } + omapdss_device_register(dssdev); mutex_init(&ddata->lock); @@ -1404,7 +1400,7 @@ static int __exit dsicm_remove(struct platform_device *pdev) dev_dbg(&pdev->dev, "remove\n"); - omapdss_unregister_display(dssdev); + omapdss_device_unregister(dssdev); dsicm_disable(dssdev); omapdss_device_disconnect(dssdev, NULL); diff --git a/drivers/gpu/drm/omapdrm/displays/panel-lgphilips-lb035q02.c b/drivers/gpu/drm/omapdrm/displays/panel-lgphilips-lb035q02.c index fb0afd5adf48..0698b64e5bdc 100644 --- a/drivers/gpu/drm/omapdrm/displays/panel-lgphilips-lb035q02.c +++ b/drivers/gpu/drm/omapdrm/displays/panel-lgphilips-lb035q02.c @@ -271,11 +271,7 @@ static int lb035q02_panel_spi_probe(struct spi_device *spi) dssdev->owner = THIS_MODULE; omapdss_display_init(dssdev); - r = omapdss_register_display(dssdev); - if (r) { - dev_err(&spi->dev, "Failed to register panel\n"); - return r; - } + omapdss_device_register(dssdev); return 0; } @@ -285,7 +281,7 @@ static int lb035q02_panel_spi_remove(struct spi_device *spi) struct panel_drv_data *ddata = dev_get_drvdata(&spi->dev); struct omap_dss_device *dssdev = &ddata->dssdev; - omapdss_unregister_display(dssdev); + omapdss_device_unregister(dssdev); lb035q02_disable(dssdev); omapdss_device_disconnect(dssdev, NULL); diff --git a/drivers/gpu/drm/omapdrm/displays/panel-nec-nl8048hl11.c b/drivers/gpu/drm/omapdrm/displays/panel-nec-nl8048hl11.c index 6ae113871032..da34c35009dd 100644 --- a/drivers/gpu/drm/omapdrm/displays/panel-nec-nl8048hl11.c +++ b/drivers/gpu/drm/omapdrm/displays/panel-nec-nl8048hl11.c @@ -294,11 +294,7 @@ static int nec_8048_probe(struct spi_device *spi) dssdev->owner = THIS_MODULE; omapdss_display_init(dssdev); - r = omapdss_register_display(dssdev); - if (r) { - dev_err(&spi->dev, "Failed to register panel\n"); - return r; - } + omapdss_device_register(dssdev); return 0; } @@ -310,7 +306,7 @@ static int nec_8048_remove(struct spi_device *spi) dev_dbg(&ddata->spi->dev, "%s\n", __func__); - omapdss_unregister_display(dssdev); + omapdss_device_unregister(dssdev); nec_8048_disable(dssdev); omapdss_device_disconnect(dssdev, NULL); diff --git a/drivers/gpu/drm/omapdrm/displays/panel-sharp-ls037v7dw01.c b/drivers/gpu/drm/omapdrm/displays/panel-sharp-ls037v7dw01.c index fb986b586749..d92ee6f1ae7f 100644 --- a/drivers/gpu/drm/omapdrm/displays/panel-sharp-ls037v7dw01.c +++ b/drivers/gpu/drm/omapdrm/displays/panel-sharp-ls037v7dw01.c @@ -270,11 +270,7 @@ static int sharp_ls_probe(struct platform_device *pdev) dssdev->owner = THIS_MODULE; omapdss_display_init(dssdev); - r = omapdss_register_display(dssdev); - if (r) { - dev_err(&pdev->dev, "Failed to register panel\n"); - return r; - } + omapdss_device_register(dssdev); return 0; } @@ -284,7 +280,7 @@ static int __exit sharp_ls_remove(struct platform_device *pdev) struct panel_drv_data *ddata = platform_get_drvdata(pdev); struct omap_dss_device *dssdev = &ddata->dssdev; - omapdss_unregister_display(dssdev); + omapdss_device_unregister(dssdev); sharp_ls_disable(dssdev); omapdss_device_disconnect(dssdev, NULL); diff --git a/drivers/gpu/drm/omapdrm/displays/panel-sony-acx565akm.c b/drivers/gpu/drm/omapdrm/displays/panel-sony-acx565akm.c index e110187ff911..4602f7cd1b53 100644 --- a/drivers/gpu/drm/omapdrm/displays/panel-sony-acx565akm.c +++ b/drivers/gpu/drm/omapdrm/displays/panel-sony-acx565akm.c @@ -733,7 +733,7 @@ static int acx565akm_probe(struct spi_device *spi) r = devm_gpio_request_one(&spi->dev, ddata->reset_gpio, GPIOF_OUT_INIT_LOW, "lcd reset"); if (r) - goto err_gpio; + return r; } if (gpio_is_valid(ddata->reset_gpio)) @@ -754,7 +754,7 @@ static int acx565akm_probe(struct spi_device *spi) if (r) { dev_err(&spi->dev, "%s panel detect error\n", __func__); - goto err_detect; + return r; } memset(&props, 0, sizeof(props)); @@ -764,17 +764,15 @@ static int acx565akm_probe(struct spi_device *spi) bldev = backlight_device_register("acx565akm", &ddata->spi->dev, ddata, &acx565akm_bl_ops, &props); - if (IS_ERR(bldev)) { - r = PTR_ERR(bldev); - goto err_reg_bl; - } + if (IS_ERR(bldev)) + return PTR_ERR(bldev); ddata->bl_dev = bldev; if (ddata->has_cabc) { r = sysfs_create_group(&bldev->dev.kobj, &bldev_attr_group); if (r) { dev_err(&bldev->dev, "%s failed to create sysfs files\n", __func__); - goto err_sysfs; + goto err_backlight_unregister; } ddata->cabc_mode = get_hw_cabc_mode(ddata); } @@ -801,21 +799,12 @@ static int acx565akm_probe(struct spi_device *spi) dssdev->owner = THIS_MODULE; omapdss_display_init(dssdev); - r = omapdss_register_display(dssdev); - if (r) { - dev_err(&spi->dev, "Failed to register panel\n"); - goto err_reg; - } + omapdss_device_register(dssdev); return 0; -err_reg: - sysfs_remove_group(&bldev->dev.kobj, &bldev_attr_group); -err_sysfs: +err_backlight_unregister: backlight_device_unregister(bldev); -err_reg_bl: -err_detect: -err_gpio: return r; } @@ -829,7 +818,7 @@ static int acx565akm_remove(struct spi_device *spi) sysfs_remove_group(&ddata->bl_dev->dev.kobj, &bldev_attr_group); backlight_device_unregister(ddata->bl_dev); - omapdss_unregister_display(dssdev); + omapdss_device_unregister(dssdev); acx565akm_disable(dssdev); omapdss_device_disconnect(dssdev, NULL); diff --git a/drivers/gpu/drm/omapdrm/displays/panel-tpo-td028ttec1.c b/drivers/gpu/drm/omapdrm/displays/panel-tpo-td028ttec1.c index c44e1b430a0e..b7c95b903d03 100644 --- a/drivers/gpu/drm/omapdrm/displays/panel-tpo-td028ttec1.c +++ b/drivers/gpu/drm/omapdrm/displays/panel-tpo-td028ttec1.c @@ -395,11 +395,7 @@ static int td028ttec1_panel_probe(struct spi_device *spi) dssdev->owner = THIS_MODULE; omapdss_display_init(dssdev); - r = omapdss_register_display(dssdev); - if (r) { - dev_err(&spi->dev, "Failed to register panel\n"); - return r; - } + omapdss_device_register(dssdev); return 0; } @@ -411,7 +407,7 @@ static int td028ttec1_panel_remove(struct spi_device *spi) dev_dbg(&ddata->spi_dev->dev, "%s\n", __func__); - omapdss_unregister_display(dssdev); + omapdss_device_unregister(dssdev); td028ttec1_panel_disable(dssdev); omapdss_device_disconnect(dssdev, NULL); diff --git a/drivers/gpu/drm/omapdrm/displays/panel-tpo-td043mtea1.c b/drivers/gpu/drm/omapdrm/displays/panel-tpo-td043mtea1.c index 0cb70abb6e5d..e6b2381b971c 100644 --- a/drivers/gpu/drm/omapdrm/displays/panel-tpo-td043mtea1.c +++ b/drivers/gpu/drm/omapdrm/displays/panel-tpo-td043mtea1.c @@ -509,8 +509,7 @@ static int tpo_td043_probe(struct spi_device *spi) ddata->vcc_reg = devm_regulator_get(&spi->dev, "vcc"); if (IS_ERR(ddata->vcc_reg)) { dev_err(&spi->dev, "failed to get LCD VCC regulator\n"); - r = PTR_ERR(ddata->vcc_reg); - goto err_regulator; + return PTR_ERR(ddata->vcc_reg); } if (gpio_is_valid(ddata->nreset_gpio)) { @@ -519,14 +518,14 @@ static int tpo_td043_probe(struct spi_device *spi) "lcd reset"); if (r < 0) { dev_err(&spi->dev, "couldn't request reset GPIO\n"); - goto err_gpio_req; + return r; } } r = sysfs_create_group(&spi->dev.kobj, &tpo_td043_attr_group); if (r) { dev_err(&spi->dev, "failed to create sysfs files\n"); - goto err_sysfs; + return r; } ddata->vm = tpo_td043_vm; @@ -538,20 +537,9 @@ static int tpo_td043_probe(struct spi_device *spi) dssdev->owner = THIS_MODULE; omapdss_display_init(dssdev); - r = omapdss_register_display(dssdev); - if (r) { - dev_err(&spi->dev, "Failed to register panel\n"); - goto err_reg; - } + omapdss_device_register(dssdev); return 0; - -err_reg: - sysfs_remove_group(&spi->dev.kobj, &tpo_td043_attr_group); -err_sysfs: -err_gpio_req: -err_regulator: - return r; } static int tpo_td043_remove(struct spi_device *spi) @@ -561,7 +549,7 @@ static int tpo_td043_remove(struct spi_device *spi) dev_dbg(&ddata->spi->dev, "%s\n", __func__); - omapdss_unregister_display(dssdev); + omapdss_device_unregister(dssdev); tpo_td043_disable(dssdev); omapdss_device_disconnect(dssdev, NULL); diff --git a/drivers/gpu/drm/omapdrm/dss/display.c b/drivers/gpu/drm/omapdrm/dss/display.c index c641993c7d17..178d88841e0c 100644 --- a/drivers/gpu/drm/omapdrm/dss/display.c +++ b/drivers/gpu/drm/omapdrm/dss/display.c @@ -28,8 +28,6 @@ #include "omapdss.h" -static LIST_HEAD(panel_list); -static DEFINE_MUTEX(panel_list_mutex); static int disp_num_counter; void omapdss_display_init(struct omap_dss_device *dssdev) @@ -55,27 +53,6 @@ void omapdss_display_init(struct omap_dss_device *dssdev) } EXPORT_SYMBOL_GPL(omapdss_display_init); -int omapdss_register_display(struct omap_dss_device *dssdev) -{ - mutex_lock(&panel_list_mutex); - list_add_tail(&dssdev->panel_list, &panel_list); - mutex_unlock(&panel_list_mutex); - - omapdss_device_register(dssdev); - return 0; -} -EXPORT_SYMBOL(omapdss_register_display); - -void omapdss_unregister_display(struct omap_dss_device *dssdev) -{ - mutex_lock(&panel_list_mutex); - list_del(&dssdev->panel_list); - mutex_unlock(&panel_list_mutex); - - omapdss_device_register(dssdev); -} -EXPORT_SYMBOL(omapdss_unregister_display); - struct omap_dss_device *omap_dss_get_device(struct omap_dss_device *dssdev) { if (!try_module_get(dssdev->owner)) diff --git a/drivers/gpu/drm/omapdrm/dss/omapdss.h b/drivers/gpu/drm/omapdrm/dss/omapdss.h index e42821583b91..5f71f6885991 100644 --- a/drivers/gpu/drm/omapdrm/dss/omapdss.h +++ b/drivers/gpu/drm/omapdrm/dss/omapdss.h @@ -395,7 +395,6 @@ struct omap_dss_device { struct omap_dss_device *dst; struct list_head list; - struct list_head panel_list; unsigned int alias_id; @@ -488,8 +487,6 @@ static inline bool omapdss_is_initialized(void) } void omapdss_display_init(struct omap_dss_device *dssdev); -int omapdss_register_display(struct omap_dss_device *dssdev); -void omapdss_unregister_display(struct omap_dss_device *dssdev); #define for_each_dss_display(d) \ while ((d = omapdss_device_get_next(d, true)) != NULL)