summaryrefslogtreecommitdiffstats
path: root/drivers/video
diff options
context:
space:
mode:
authorTomi Valkeinen2013-05-03 10:40:54 +0200
committerTomi Valkeinen2013-06-17 13:00:52 +0200
commitd35317a42ddfff836d509cf128255721db8101c1 (patch)
tree54e63f2a44cff65fa6427d814c9545ace6d45ad3 /drivers/video
parentOMAPDSS: omapdss.h: add owner field to omap_dss_device (diff)
downloadkernel-qcow2-linux-d35317a42ddfff836d509cf128255721db8101c1.tar.gz
kernel-qcow2-linux-d35317a42ddfff836d509cf128255721db8101c1.tar.xz
kernel-qcow2-linux-d35317a42ddfff836d509cf128255721db8101c1.zip
OMAPDSS: add module_get/put to omap_dss_get/put_device()
omap_dss_get_device() should be called for omap_dss_device before it is used to increase its refcount. Currently we only increase the refcount for the underlying device. This patch adds managing the ref count to the underlying module also, which contains the ops for the omap_dss_device. Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
Diffstat (limited to 'drivers/video')
-rw-r--r--drivers/video/omap2/dss/display.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/drivers/video/omap2/dss/display.c b/drivers/video/omap2/dss/display.c
index 809676473a99..0daf3e37d597 100644
--- a/drivers/video/omap2/dss/display.c
+++ b/drivers/video/omap2/dss/display.c
@@ -158,15 +158,24 @@ void omapdss_unregister_display(struct omap_dss_device *dssdev)
}
EXPORT_SYMBOL(omapdss_unregister_display);
-void omap_dss_get_device(struct omap_dss_device *dssdev)
+struct omap_dss_device *omap_dss_get_device(struct omap_dss_device *dssdev)
{
- get_device(dssdev->dev);
+ 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);