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 <laurent.pinchart@ideasonboard.com> Reviewed-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
This commit is contained in:
parent
67822ae119
commit
c1dfe721e0
|
@ -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)
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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]);
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue