drm/omap: dss: Move and rename omap_dss_(get|put)_device()
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>
Fri, 2 Mar 2018 00:43:45 +0000 (02:43 +0200)
committerTomi Valkeinen <tomi.valkeinen@ti.com>
Mon, 3 Sep 2018 13:13:26 +0000 (16:13 +0300)
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@ideasonboard.com>
Reviewed-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
21 files changed:
drivers/gpu/drm/omapdrm/displays/connector-analog-tv.c
drivers/gpu/drm/omapdrm/displays/connector-dvi.c
drivers/gpu/drm/omapdrm/displays/connector-hdmi.c
drivers/gpu/drm/omapdrm/displays/encoder-opa362.c
drivers/gpu/drm/omapdrm/displays/encoder-tfp410.c
drivers/gpu/drm/omapdrm/displays/encoder-tpd12s015.c
drivers/gpu/drm/omapdrm/displays/panel-dpi.c
drivers/gpu/drm/omapdrm/displays/panel-dsi-cm.c
drivers/gpu/drm/omapdrm/displays/panel-lgphilips-lb035q02.c
drivers/gpu/drm/omapdrm/displays/panel-nec-nl8048hl11.c
drivers/gpu/drm/omapdrm/displays/panel-sharp-ls037v7dw01.c
drivers/gpu/drm/omapdrm/displays/panel-sony-acx565akm.c
drivers/gpu/drm/omapdrm/displays/panel-tpo-td028ttec1.c
drivers/gpu/drm/omapdrm/displays/panel-tpo-td043mtea1.c
drivers/gpu/drm/omapdrm/dss/base.c
drivers/gpu/drm/omapdrm/dss/display.c
drivers/gpu/drm/omapdrm/dss/omapdss.h
drivers/gpu/drm/omapdrm/dss/output.c
drivers/gpu/drm/omapdrm/omap_connector.c
drivers/gpu/drm/omapdrm/omap_crtc.c
drivers/gpu/drm/omapdrm/omap_drv.c

index 49720117da15f0254921fbeb3700b33fd2b26b38..0eacd2dc302d057dcc17f1e316212e742e29dacb 100644 (file)
@@ -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)
index 7876e61bf63ef74f67fab61ae24aee51f102eef9..754f15bc0115d2c3e8df43e02ff4426122098947 100644 (file)
@@ -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)
index 5e07a8479cfc5744e1289531bc79b4dbff2cdc90..e05f2964f8e1933863efd5337b6c242bdf5655bd 100644 (file)
@@ -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)
index 52ceaae14647743998ba23f46a2dd10dc6a3eae6..f665f2caea22553ae36fce467cb173a171835c21 100644 (file)
@@ -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)
index f4223cf7f03f28450f9aa7525152b256f4ffc135..11c123ca7916a30e75f8500877af2dd2c2a84b67 100644 (file)
@@ -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)
index 90e07036fb48d1a3dc834951c728da380b8d23d4..eb2d5af34a35006d9633ca72c996d9b8062261d4 100644 (file)
@@ -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)
index 3e2bca737de0a4fa81029396cca99afcdac1f122..64eab64e5f0dcf0d9184588d2e691c6ecf51a2ee 100644 (file)
@@ -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)
index 0614db1c7366ed9c3c3a115c3f04197c7984d7ed..bd9401c1c11e53e5ed9d3adba2f07281ad633283 100644 (file)
@@ -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)
index 0698b64e5bdc598a07733704a12330ec0c368c11..9f9caeadf5dd81cda55a5fd798c9984c36b43cdb 100644 (file)
@@ -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)
index da34c35009dd816b8090a27adf3d4d4a750ef81a..d07c955ea06f688ee3f80cae5e42fb24f9bbf299 100644 (file)
@@ -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)
index d92ee6f1ae7fec0eb0b371bbc81b2b6030079ae1..d02f22a858e2305c4e348e26578a951d8bf8ef54 100644 (file)
@@ -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)
index 4602f7cd1b536f4c25041c9df79e9cbec33a4807..a98c1181887aae8988b929babe47785a4af54f1d 100644 (file)
@@ -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)
index b7c95b903d035e9a09e73f9c3fc1576518b953a2..07c3f8143e4c5a8a1974e2562868c93d9f8a90d4 100644 (file)
@@ -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)
index e6b2381b971cda18a3c43d5589948e1dcc535e37..c32ab872e9f92595ddc3fc1e18028398ab34e036 100644 (file)
@@ -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)
index 9f01a4f2814531c1871c6a1bba67d7a31dc13180..08846eea5a532603bb7a2d3a729d39034f89e04e 100644 (file)
@@ -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;
index 178d88841e0c5f915d1638cc4f802e0025fa53c5..53cb46f6503d0d5b2d1cad20f3bfaf8c34d2aabc 100644 (file)
@@ -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);
index 5f71f6885991d72881452477bc5172d6160626a5..96011e42da05b5064d01f8b984b4af1e73186444 100644 (file)
@@ -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);
index e62da96f83af7db338923ce23466fca4de6dc4f8..b5bf7a5e35d919a4f4b87216ce33f95c17274459 100644 (file)
@@ -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;
 }
index 3b60086f293869d71e8e6d29ccad9a8c25f13ed4..69ebb0fa1df5184976e395740504f2ee99610105 100644 (file)
@@ -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)
index 6c4d40b824e407fc45b648ddd01dd0f6e3d6ce53..e18ca6cdc0d6329f8d6e59b45bb440e3e4d40cc2 100644 (file)
@@ -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]);
 
index 4f402eb8088d0cf6a0b129b8d7134156c1e3c10d..a3b7dbf1b92b13b0b69988ee44fe7e0cc15afd83 100644 (file)
@@ -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;
                        }
                }