The functions operate on any omap_dss_device, move them from display.c to base.c. While at it rename them to match the naming of the other functions operating on struct omap_dss_device. Signed-off-by: Laurent Pinchart <laurent.pinchart@xxxxxxxxxxxxxxxx> --- .../gpu/drm/omapdrm/displays/connector-analog-tv.c | 4 ++-- drivers/gpu/drm/omapdrm/displays/connector-dvi.c | 4 ++-- drivers/gpu/drm/omapdrm/displays/connector-hdmi.c | 4 ++-- drivers/gpu/drm/omapdrm/displays/encoder-opa362.c | 4 ++-- drivers/gpu/drm/omapdrm/displays/encoder-tfp410.c | 4 ++-- .../gpu/drm/omapdrm/displays/encoder-tpd12s015.c | 4 ++-- drivers/gpu/drm/omapdrm/displays/panel-dpi.c | 4 ++-- drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c | 4 ++-- .../omapdrm/displays/panel-lgphilips-lb035q02.c | 4 ++-- .../drm/omapdrm/displays/panel-nec-nl8048hl11.c | 4 ++-- .../drm/omapdrm/displays/panel-sharp-ls037v7dw01.c | 4 ++-- .../drm/omapdrm/displays/panel-sony-acx565akm.c | 4 ++-- .../drm/omapdrm/displays/panel-tpo-td028ttec1.c | 4 ++-- .../drm/omapdrm/displays/panel-tpo-td043mtea1.c | 4 ++-- drivers/gpu/drm/omapdrm/dss/base.c | 27 +++++++++++++++++++--- drivers/gpu/drm/omapdrm/dss/display.c | 24 ------------------- drivers/gpu/drm/omapdrm/dss/omapdss.h | 5 ++-- drivers/gpu/drm/omapdrm/dss/output.c | 2 +- drivers/gpu/drm/omapdrm/omap_connector.c | 4 ++-- drivers/gpu/drm/omapdrm/omap_crtc.c | 2 +- drivers/gpu/drm/omapdrm/omap_drv.c | 8 +++---- 21 files changed, 62 insertions(+), 66 deletions(-) diff --git a/drivers/gpu/drm/omapdrm/displays/connector-analog-tv.c b/drivers/gpu/drm/omapdrm/displays/connector-analog-tv.c index f1d1c67d72b8..a7eb25bd9283 100644 --- a/drivers/gpu/drm/omapdrm/displays/connector-analog-tv.c +++ b/drivers/gpu/drm/omapdrm/displays/connector-analog-tv.c @@ -55,7 +55,7 @@ static int tvc_connect(struct omap_dss_device *dssdev) r = omapdss_device_connect(src, dssdev); if (r) { - omap_dss_put_device(src); + omapdss_device_put(src); return r; } @@ -68,7 +68,7 @@ static void tvc_disconnect(struct omap_dss_device *dssdev) omapdss_device_disconnect(src, dssdev); - omap_dss_put_device(src); + omapdss_device_put(src); } static int tvc_enable(struct omap_dss_device *dssdev) diff --git a/drivers/gpu/drm/omapdrm/displays/connector-dvi.c b/drivers/gpu/drm/omapdrm/displays/connector-dvi.c index 9e0b5a0b2eea..3e71af9ba0c3 100644 --- a/drivers/gpu/drm/omapdrm/displays/connector-dvi.c +++ b/drivers/gpu/drm/omapdrm/displays/connector-dvi.c @@ -69,7 +69,7 @@ static int dvic_connect(struct omap_dss_device *dssdev) r = omapdss_device_connect(src, dssdev); if (r) { - omap_dss_put_device(src); + omapdss_device_put(src); return r; } @@ -82,7 +82,7 @@ static void dvic_disconnect(struct omap_dss_device *dssdev) omapdss_device_disconnect(src, dssdev); - omap_dss_put_device(src); + omapdss_device_put(src); } static int dvic_enable(struct omap_dss_device *dssdev) diff --git a/drivers/gpu/drm/omapdrm/displays/connector-hdmi.c b/drivers/gpu/drm/omapdrm/displays/connector-hdmi.c index 064b051c0a29..fd0bad4dc7c9 100644 --- a/drivers/gpu/drm/omapdrm/displays/connector-hdmi.c +++ b/drivers/gpu/drm/omapdrm/displays/connector-hdmi.c @@ -65,7 +65,7 @@ static int hdmic_connect(struct omap_dss_device *dssdev) r = omapdss_device_connect(src, dssdev); if (r) { - omap_dss_put_device(src); + omapdss_device_put(src); return r; } @@ -78,7 +78,7 @@ static void hdmic_disconnect(struct omap_dss_device *dssdev) omapdss_device_disconnect(src, dssdev); - omap_dss_put_device(src); + omapdss_device_put(src); } static int hdmic_enable(struct omap_dss_device *dssdev) diff --git a/drivers/gpu/drm/omapdrm/displays/encoder-opa362.c b/drivers/gpu/drm/omapdrm/displays/encoder-opa362.c index c1ed4e2ce8f3..01b00eea3a98 100644 --- a/drivers/gpu/drm/omapdrm/displays/encoder-opa362.c +++ b/drivers/gpu/drm/omapdrm/displays/encoder-opa362.c @@ -45,7 +45,7 @@ static int opa362_connect(struct omap_dss_device *dssdev, r = omapdss_device_connect(src, dssdev); if (r) { - omap_dss_put_device(src); + omapdss_device_put(src); return r; } @@ -60,7 +60,7 @@ static void opa362_disconnect(struct omap_dss_device *dssdev, omapdss_device_disconnect(src, &ddata->dssdev); - omap_dss_put_device(src); + omapdss_device_put(src); } static int opa362_enable(struct omap_dss_device *dssdev) diff --git a/drivers/gpu/drm/omapdrm/displays/encoder-tfp410.c b/drivers/gpu/drm/omapdrm/displays/encoder-tfp410.c index b360a68f074d..6f71d2b7de03 100644 --- a/drivers/gpu/drm/omapdrm/displays/encoder-tfp410.c +++ b/drivers/gpu/drm/omapdrm/displays/encoder-tfp410.c @@ -41,7 +41,7 @@ static int tfp410_connect(struct omap_dss_device *dssdev, r = omapdss_device_connect(src, dssdev); if (r) { - omap_dss_put_device(src); + omapdss_device_put(src); return r; } @@ -56,7 +56,7 @@ static void tfp410_disconnect(struct omap_dss_device *dssdev, omapdss_device_disconnect(src, &ddata->dssdev); - omap_dss_put_device(src); + omapdss_device_put(src); } static int tfp410_enable(struct omap_dss_device *dssdev) diff --git a/drivers/gpu/drm/omapdrm/displays/encoder-tpd12s015.c b/drivers/gpu/drm/omapdrm/displays/encoder-tpd12s015.c index efeae1401490..8031f2c087f6 100644 --- a/drivers/gpu/drm/omapdrm/displays/encoder-tpd12s015.c +++ b/drivers/gpu/drm/omapdrm/displays/encoder-tpd12s015.c @@ -50,7 +50,7 @@ static int tpd_connect(struct omap_dss_device *dssdev, r = omapdss_device_connect(src, dssdev); if (r) { - omap_dss_put_device(src); + omapdss_device_put(src); return r; } @@ -74,7 +74,7 @@ static void tpd_disconnect(struct omap_dss_device *dssdev, omapdss_device_disconnect(src, &ddata->dssdev); - omap_dss_put_device(src); + omapdss_device_put(src); } static int tpd_enable(struct omap_dss_device *dssdev) diff --git a/drivers/gpu/drm/omapdrm/displays/panel-dpi.c b/drivers/gpu/drm/omapdrm/displays/panel-dpi.c index bd598be1ba6b..5306af0206c2 100644 --- a/drivers/gpu/drm/omapdrm/displays/panel-dpi.c +++ b/drivers/gpu/drm/omapdrm/displays/panel-dpi.c @@ -47,7 +47,7 @@ static int panel_dpi_connect(struct omap_dss_device *dssdev) r = omapdss_device_connect(src, dssdev); if (r) { - omap_dss_put_device(src); + omapdss_device_put(src); return r; } @@ -60,7 +60,7 @@ static void panel_dpi_disconnect(struct omap_dss_device *dssdev) omapdss_device_disconnect(src, dssdev); - omap_dss_put_device(src); + omapdss_device_put(src); } static int panel_dpi_enable(struct omap_dss_device *dssdev) diff --git a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c index e27399ca3ac5..e0a607846284 100644 --- a/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c +++ b/drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c @@ -794,7 +794,7 @@ static int dsicm_connect(struct omap_dss_device *dssdev) err_req_vc: omapdss_device_disconnect(src, dssdev); err_connect: - omap_dss_put_device(src); + omapdss_device_put(src); return r; } @@ -806,7 +806,7 @@ static void dsicm_disconnect(struct omap_dss_device *dssdev) src->ops->dsi.release_vc(src, ddata->channel); omapdss_device_disconnect(src, dssdev); - omap_dss_put_device(src); + omapdss_device_put(src); } static int dsicm_enable(struct omap_dss_device *dssdev) diff --git a/drivers/gpu/drm/omapdrm/displays/panel-lgphilips-lb035q02.c b/drivers/gpu/drm/omapdrm/displays/panel-lgphilips-lb035q02.c index 0e89fc1bc34c..015488594de3 100644 --- a/drivers/gpu/drm/omapdrm/displays/panel-lgphilips-lb035q02.c +++ b/drivers/gpu/drm/omapdrm/displays/panel-lgphilips-lb035q02.c @@ -129,7 +129,7 @@ static int lb035q02_connect(struct omap_dss_device *dssdev) r = omapdss_device_connect(src, dssdev); if (r) { - omap_dss_put_device(src); + omapdss_device_put(src); return r; } @@ -144,7 +144,7 @@ static void lb035q02_disconnect(struct omap_dss_device *dssdev) omapdss_device_disconnect(src, dssdev); - omap_dss_put_device(src); + omapdss_device_put(src); } static int lb035q02_enable(struct omap_dss_device *dssdev) diff --git a/drivers/gpu/drm/omapdrm/displays/panel-nec-nl8048hl11.c b/drivers/gpu/drm/omapdrm/displays/panel-nec-nl8048hl11.c index 9f32343e5122..c23bf5ba0c47 100644 --- a/drivers/gpu/drm/omapdrm/displays/panel-nec-nl8048hl11.c +++ b/drivers/gpu/drm/omapdrm/displays/panel-nec-nl8048hl11.c @@ -124,7 +124,7 @@ static int nec_8048_connect(struct omap_dss_device *dssdev) r = omapdss_device_connect(src, dssdev); if (r) { - omap_dss_put_device(src); + omapdss_device_put(src); return r; } @@ -137,7 +137,7 @@ static void nec_8048_disconnect(struct omap_dss_device *dssdev) omapdss_device_disconnect(src, dssdev); - omap_dss_put_device(src); + omapdss_device_put(src); } static int nec_8048_enable(struct omap_dss_device *dssdev) diff --git a/drivers/gpu/drm/omapdrm/displays/panel-sharp-ls037v7dw01.c b/drivers/gpu/drm/omapdrm/displays/panel-sharp-ls037v7dw01.c index 320d2e73c40c..a7c053d031c1 100644 --- a/drivers/gpu/drm/omapdrm/displays/panel-sharp-ls037v7dw01.c +++ b/drivers/gpu/drm/omapdrm/displays/panel-sharp-ls037v7dw01.c @@ -70,7 +70,7 @@ static int sharp_ls_connect(struct omap_dss_device *dssdev) r = omapdss_device_connect(src, dssdev); if (r) { - omap_dss_put_device(src); + omapdss_device_put(src); return r; } @@ -83,7 +83,7 @@ static void sharp_ls_disconnect(struct omap_dss_device *dssdev) omapdss_device_disconnect(src, dssdev); - omap_dss_put_device(src); + omapdss_device_put(src); } static int sharp_ls_enable(struct omap_dss_device *dssdev) diff --git a/drivers/gpu/drm/omapdrm/displays/panel-sony-acx565akm.c b/drivers/gpu/drm/omapdrm/displays/panel-sony-acx565akm.c index 5411c0ce9bb4..cad158a142d4 100644 --- a/drivers/gpu/drm/omapdrm/displays/panel-sony-acx565akm.c +++ b/drivers/gpu/drm/omapdrm/displays/panel-sony-acx565akm.c @@ -519,7 +519,7 @@ static int acx565akm_connect(struct omap_dss_device *dssdev) r = omapdss_device_connect(src, dssdev); if (r) { - omap_dss_put_device(src); + omapdss_device_put(src); return r; } @@ -532,7 +532,7 @@ static void acx565akm_disconnect(struct omap_dss_device *dssdev) omapdss_device_disconnect(src, dssdev); - omap_dss_put_device(src); + omapdss_device_put(src); } static int acx565akm_panel_power_on(struct omap_dss_device *dssdev) diff --git a/drivers/gpu/drm/omapdrm/displays/panel-tpo-td028ttec1.c b/drivers/gpu/drm/omapdrm/displays/panel-tpo-td028ttec1.c index 839fc0eaf164..cadbbb4dcbd4 100644 --- a/drivers/gpu/drm/omapdrm/displays/panel-tpo-td028ttec1.c +++ b/drivers/gpu/drm/omapdrm/displays/panel-tpo-td028ttec1.c @@ -178,7 +178,7 @@ static int td028ttec1_panel_connect(struct omap_dss_device *dssdev) r = omapdss_device_connect(src, dssdev); if (r) { - omap_dss_put_device(src); + omapdss_device_put(src); return r; } @@ -191,7 +191,7 @@ static void td028ttec1_panel_disconnect(struct omap_dss_device *dssdev) omapdss_device_disconnect(src, dssdev); - omap_dss_put_device(src); + omapdss_device_put(src); } static int td028ttec1_panel_enable(struct omap_dss_device *dssdev) diff --git a/drivers/gpu/drm/omapdrm/displays/panel-tpo-td043mtea1.c b/drivers/gpu/drm/omapdrm/displays/panel-tpo-td043mtea1.c index 5ad85326a84e..2f70b3c74262 100644 --- a/drivers/gpu/drm/omapdrm/displays/panel-tpo-td043mtea1.c +++ b/drivers/gpu/drm/omapdrm/displays/panel-tpo-td043mtea1.c @@ -349,7 +349,7 @@ static int tpo_td043_connect(struct omap_dss_device *dssdev) r = omapdss_device_connect(src, dssdev); if (r) { - omap_dss_put_device(src); + omapdss_device_put(src); return r; } @@ -362,7 +362,7 @@ static void tpo_td043_disconnect(struct omap_dss_device *dssdev) omapdss_device_disconnect(src, dssdev); - omap_dss_put_device(src); + omapdss_device_put(src); } static int tpo_td043_enable(struct omap_dss_device *dssdev) diff --git a/drivers/gpu/drm/omapdrm/dss/base.c b/drivers/gpu/drm/omapdrm/dss/base.c index f7b8958f15bc..4abde473eba7 100644 --- a/drivers/gpu/drm/omapdrm/dss/base.c +++ b/drivers/gpu/drm/omapdrm/dss/base.c @@ -91,6 +91,27 @@ static bool omapdss_device_is_registered(struct device_node *node) return found; } +struct omap_dss_device *omapdss_device_get(struct omap_dss_device *dssdev) +{ + if (!try_module_get(dssdev->owner)) + return NULL; + + if (get_device(dssdev->dev) == NULL) { + module_put(dssdev->owner); + return NULL; + } + + return dssdev; +} +EXPORT_SYMBOL(omapdss_device_get); + +void omapdss_device_put(struct omap_dss_device *dssdev) +{ + put_device(dssdev->dev); + module_put(dssdev->owner); +} +EXPORT_SYMBOL(omapdss_device_put); + struct omap_dss_device *omapdss_find_device_by_port(struct device_node *src, unsigned int port) { @@ -98,7 +119,7 @@ struct omap_dss_device *omapdss_find_device_by_port(struct device_node *src, list_for_each_entry(dssdev, &omapdss_devices_list, list) { if (dssdev->dev->of_node == src && dssdev->port_num == port) - return omap_dss_get_device(dssdev); + return omapdss_device_get(dssdev); } return NULL; @@ -147,9 +168,9 @@ struct omap_dss_device *omapdss_device_get_next(struct omap_dss_device *from, done: if (from) - omap_dss_put_device(from); + omapdss_device_put(from); if (dssdev) - omap_dss_get_device(dssdev); + omapdss_device_get(dssdev); mutex_unlock(&omapdss_devices_lock); return dssdev; diff --git a/drivers/gpu/drm/omapdrm/dss/display.c b/drivers/gpu/drm/omapdrm/dss/display.c index 524e43f71af4..65ca71859c7d 100644 --- a/drivers/gpu/drm/omapdrm/dss/display.c +++ b/drivers/gpu/drm/omapdrm/dss/display.c @@ -21,9 +21,6 @@ #define DSS_SUBSYS_NAME "DISPLAY" #include <linux/kernel.h> -#include <linux/module.h> -#include <linux/jiffies.h> -#include <linux/platform_device.h> #include <linux/of.h> #include "omapdss.h" @@ -52,24 +49,3 @@ void omapdss_display_init(struct omap_dss_device *dssdev) "display%u", id); } EXPORT_SYMBOL_GPL(omapdss_display_init); - -struct omap_dss_device *omap_dss_get_device(struct omap_dss_device *dssdev) -{ - if (!try_module_get(dssdev->owner)) - return NULL; - - if (get_device(dssdev->dev) == NULL) { - module_put(dssdev->owner); - return NULL; - } - - return dssdev; -} -EXPORT_SYMBOL(omap_dss_get_device); - -void omap_dss_put_device(struct omap_dss_device *dssdev) -{ - put_device(dssdev->dev); - module_put(dssdev->owner); -} -EXPORT_SYMBOL(omap_dss_put_device); diff --git a/drivers/gpu/drm/omapdrm/dss/omapdss.h b/drivers/gpu/drm/omapdrm/dss/omapdss.h index 5f71f6885991..96011e42da05 100644 --- a/drivers/gpu/drm/omapdrm/dss/omapdss.h +++ b/drivers/gpu/drm/omapdrm/dss/omapdss.h @@ -492,6 +492,8 @@ void omapdss_display_init(struct omap_dss_device *dssdev); void omapdss_device_register(struct omap_dss_device *dssdev); void omapdss_device_unregister(struct omap_dss_device *dssdev); +struct omap_dss_device *omapdss_device_get(struct omap_dss_device *dssdev); +void omapdss_device_put(struct omap_dss_device *dssdev); struct omap_dss_device *omapdss_find_device_by_port(struct device_node *src, unsigned int port); struct omap_dss_device *omapdss_device_get_next(struct omap_dss_device *from, @@ -501,9 +503,6 @@ int omapdss_device_connect(struct omap_dss_device *src, void omapdss_device_disconnect(struct omap_dss_device *src, struct omap_dss_device *dst); -struct omap_dss_device *omap_dss_get_device(struct omap_dss_device *dssdev); -void omap_dss_put_device(struct omap_dss_device *dssdev); - int omap_dss_get_num_overlay_managers(void); int omap_dss_get_num_overlays(void); diff --git a/drivers/gpu/drm/omapdrm/dss/output.c b/drivers/gpu/drm/omapdrm/dss/output.c index e62da96f83af..b5bf7a5e35d9 100644 --- a/drivers/gpu/drm/omapdrm/dss/output.c +++ b/drivers/gpu/drm/omapdrm/dss/output.c @@ -93,7 +93,7 @@ struct omap_dss_device *omapdss_find_output_from_display(struct omap_dss_device dssdev = dssdev->src; if (dssdev->id != 0) - return omap_dss_get_device(dssdev); + return omapdss_device_get(dssdev); return NULL; } diff --git a/drivers/gpu/drm/omapdrm/omap_connector.c b/drivers/gpu/drm/omapdrm/omap_connector.c index eec3aa83dfcd..de001596c481 100644 --- a/drivers/gpu/drm/omapdrm/omap_connector.c +++ b/drivers/gpu/drm/omapdrm/omap_connector.c @@ -98,7 +98,7 @@ static void omap_connector_destroy(struct drm_connector *connector) drm_connector_cleanup(connector); kfree(omap_connector); - omap_dss_put_device(dssdev); + omapdss_device_put(dssdev); } #define MAX_EDID 512 @@ -254,7 +254,7 @@ struct drm_connector *omap_connector_init(struct drm_device *dev, DBG("%s", dssdev->name); - omap_dss_get_device(dssdev); + omapdss_device_get(dssdev); omap_connector = kzalloc(sizeof(*omap_connector), GFP_KERNEL); if (!omap_connector) diff --git a/drivers/gpu/drm/omapdrm/omap_crtc.c b/drivers/gpu/drm/omapdrm/omap_crtc.c index 6c4d40b824e4..e18ca6cdc0d6 100644 --- a/drivers/gpu/drm/omapdrm/omap_crtc.c +++ b/drivers/gpu/drm/omapdrm/omap_crtc.c @@ -704,7 +704,7 @@ struct drm_crtc *omap_crtc_init(struct drm_device *dev, out = omapdss_find_output_from_display(dssdev); channel = out->dispc_channel; - omap_dss_put_device(out); + omapdss_device_put(out); DBG("%s", channel_names[channel]); diff --git a/drivers/gpu/drm/omapdrm/omap_drv.c b/drivers/gpu/drm/omapdrm/omap_drv.c index 21ca4002ac38..cf0f76bf5773 100644 --- a/drivers/gpu/drm/omapdrm/omap_drv.c +++ b/drivers/gpu/drm/omapdrm/omap_drv.c @@ -161,7 +161,7 @@ static void omap_disconnect_dssdevs(struct drm_device *ddev) omapdss_device_disconnect(dssdev, NULL); priv->dssdevs[i] = NULL; - omap_dss_put_device(dssdev); + omapdss_device_put(dssdev); } priv->num_dssdevs = 0; @@ -191,17 +191,17 @@ static int omap_connect_dssdevs(struct drm_device *ddev) for_each_dss_display(dssdev) { r = omapdss_device_connect(dssdev, NULL); if (r == -EPROBE_DEFER) { - omap_dss_put_device(dssdev); + omapdss_device_put(dssdev); goto cleanup; } else if (r) { dev_warn(dssdev->dev, "could not connect display: %s\n", dssdev->name); } else { - omap_dss_get_device(dssdev); + omapdss_device_get(dssdev); priv->dssdevs[priv->num_dssdevs++] = dssdev; if (priv->num_dssdevs == ARRAY_SIZE(priv->dssdevs)) { /* To balance the 'for_each_dss_display' loop */ - omap_dss_put_device(dssdev); + omapdss_device_put(dssdev); break; } } -- Regards, Laurent Pinchart _______________________________________________ dri-devel mailing list dri-devel@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/dri-devel