From c1dfe721e0966947019c43b65f2837c591fdcb3c Mon Sep 17 00:00:00 2001 From: Laurent Pinchart Date: Fri, 2 Mar 2018 02:43:45 +0200 Subject: drm/omap: dss: Move and rename omap_dss_(get|put)_device() 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 Reviewed-by: Sebastian Reichel Signed-off-by: Tomi Valkeinen --- .../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(-) (limited to 'drivers/gpu') diff --git a/drivers/gpu/drm/omapdrm/displays/connector-analog-tv.c b/drivers/gpu/drm/omapdrm/displays/connector-analog-tv.c index 49720117da15..0eacd2dc302d 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 7876e61bf63e..754f15bc0115 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 5e07a8479cfc..e05f2964f8e1 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 52ceaae14647..f665f2caea22 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 f4223cf7f03f..11c123ca7916 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 90e07036fb48..eb2d5af34a35 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 3e2bca737de0..64eab64e5f0d 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 0614db1c7366..bd9401c1c11e 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 @@ err_vc_id: 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 0698b64e5bdc..9f9caeadf5dd 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 da34c35009dd..d07c955ea06f 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 d92ee6f1ae7f..d02f22a858e2 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 4602f7cd1b53..a98c1181887a 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 b7c95b903d03..07c3f8143e4c 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 e6b2381b971c..c32ab872e9f9 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 9f01a4f28145..08846eea5a53 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 178d88841e0c..53cb46f6503d 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 -#include -#include -#include #include #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 3b60086f2938..69ebb0fa1df5 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 4f402eb8088d..a3b7dbf1b92b 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; } } -- cgit v1.2.3