diff options
Diffstat (limited to 'drivers/gpu/drm/omapdrm/dss/base.c')
-rw-r--r-- | drivers/gpu/drm/omapdrm/dss/base.c | 27 |
1 files changed, 24 insertions, 3 deletions
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) | |||
91 | return found; | 91 | return found; |
92 | } | 92 | } |
93 | 93 | ||
94 | struct omap_dss_device *omapdss_device_get(struct omap_dss_device *dssdev) | ||
95 | { | ||
96 | if (!try_module_get(dssdev->owner)) | ||
97 | return NULL; | ||
98 | |||
99 | if (get_device(dssdev->dev) == NULL) { | ||
100 | module_put(dssdev->owner); | ||
101 | return NULL; | ||
102 | } | ||
103 | |||
104 | return dssdev; | ||
105 | } | ||
106 | EXPORT_SYMBOL(omapdss_device_get); | ||
107 | |||
108 | void omapdss_device_put(struct omap_dss_device *dssdev) | ||
109 | { | ||
110 | put_device(dssdev->dev); | ||
111 | module_put(dssdev->owner); | ||
112 | } | ||
113 | EXPORT_SYMBOL(omapdss_device_put); | ||
114 | |||
94 | struct omap_dss_device *omapdss_find_device_by_port(struct device_node *src, | 115 | struct omap_dss_device *omapdss_find_device_by_port(struct device_node *src, |
95 | unsigned int port) | 116 | unsigned int port) |
96 | { | 117 | { |
@@ -98,7 +119,7 @@ struct omap_dss_device *omapdss_find_device_by_port(struct device_node *src, | |||
98 | 119 | ||
99 | list_for_each_entry(dssdev, &omapdss_devices_list, list) { | 120 | list_for_each_entry(dssdev, &omapdss_devices_list, list) { |
100 | if (dssdev->dev->of_node == src && dssdev->port_num == port) | 121 | if (dssdev->dev->of_node == src && dssdev->port_num == port) |
101 | return omap_dss_get_device(dssdev); | 122 | return omapdss_device_get(dssdev); |
102 | } | 123 | } |
103 | 124 | ||
104 | return NULL; | 125 | return NULL; |
@@ -147,9 +168,9 @@ struct omap_dss_device *omapdss_device_get_next(struct omap_dss_device *from, | |||
147 | 168 | ||
148 | done: | 169 | done: |
149 | if (from) | 170 | if (from) |
150 | omap_dss_put_device(from); | 171 | omapdss_device_put(from); |
151 | if (dssdev) | 172 | if (dssdev) |
152 | omap_dss_get_device(dssdev); | 173 | omapdss_device_get(dssdev); |
153 | 174 | ||
154 | mutex_unlock(&omapdss_devices_lock); | 175 | mutex_unlock(&omapdss_devices_lock); |
155 | return dssdev; | 176 | return dssdev; |