aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTomi Valkeinen <tomi.valkeinen@ti.com>2013-05-03 04:40:54 -0400
committerTomi Valkeinen <tomi.valkeinen@ti.com>2013-06-17 07:00:52 -0400
commitd35317a42ddfff836d509cf128255721db8101c1 (patch)
tree54e63f2a44cff65fa6427d814c9545ace6d45ad3
parent4f3e44ea07eafb5252e8414ae4f75f749e1729de (diff)
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>
-rw-r--r--drivers/video/omap2/dss/display.c13
-rw-r--r--include/video/omapdss.h2
2 files changed, 12 insertions, 3 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)
158} 158}
159EXPORT_SYMBOL(omapdss_unregister_display); 159EXPORT_SYMBOL(omapdss_unregister_display);
160 160
161void omap_dss_get_device(struct omap_dss_device *dssdev) 161struct omap_dss_device *omap_dss_get_device(struct omap_dss_device *dssdev)
162{ 162{
163 get_device(dssdev->dev); 163 if (!try_module_get(dssdev->owner))
164 return NULL;
165
166 if (get_device(dssdev->dev) == NULL) {
167 module_put(dssdev->owner);
168 return NULL;
169 }
170
171 return dssdev;
164} 172}
165EXPORT_SYMBOL(omap_dss_get_device); 173EXPORT_SYMBOL(omap_dss_get_device);
166 174
167void omap_dss_put_device(struct omap_dss_device *dssdev) 175void omap_dss_put_device(struct omap_dss_device *dssdev)
168{ 176{
169 put_device(dssdev->dev); 177 put_device(dssdev->dev);
178 module_put(dssdev->owner);
170} 179}
171EXPORT_SYMBOL(omap_dss_put_device); 180EXPORT_SYMBOL(omap_dss_put_device);
172 181
diff --git a/include/video/omapdss.h b/include/video/omapdss.h
index d667a4a78a49..80d7eb6358ae 100644
--- a/include/video/omapdss.h
+++ b/include/video/omapdss.h
@@ -767,7 +767,7 @@ void omap_dss_unregister_driver(struct omap_dss_driver *);
767int omapdss_register_display(struct omap_dss_device *dssdev); 767int omapdss_register_display(struct omap_dss_device *dssdev);
768void omapdss_unregister_display(struct omap_dss_device *dssdev); 768void omapdss_unregister_display(struct omap_dss_device *dssdev);
769 769
770void omap_dss_get_device(struct omap_dss_device *dssdev); 770struct omap_dss_device *omap_dss_get_device(struct omap_dss_device *dssdev);
771void omap_dss_put_device(struct omap_dss_device *dssdev); 771void omap_dss_put_device(struct omap_dss_device *dssdev);
772#define for_each_dss_dev(d) while ((d = omap_dss_get_next_device(d)) != NULL) 772#define for_each_dss_dev(d) while ((d = omap_dss_get_next_device(d)) != NULL)
773struct omap_dss_device *omap_dss_get_next_device(struct omap_dss_device *from); 773struct omap_dss_device *omap_dss_get_next_device(struct omap_dss_device *from);