OMAPDSS: use the panel list in omap_dss_get_next_device

omap_dss_get_next_device() uses the dss bus to iterate over the
displays. This patch changes omap_dss_get_next_device() to use the new
panel list instead.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
This commit is contained in:
Tomi Valkeinen 2013-03-15 16:33:29 +02:00
parent 2e7e3dc794
commit 67b23ca1b6
1 changed files with 39 additions and 15 deletions

View File

@ -191,27 +191,51 @@ void omap_dss_put_device(struct omap_dss_device *dssdev)
} }
EXPORT_SYMBOL(omap_dss_put_device); EXPORT_SYMBOL(omap_dss_put_device);
/* ref count of the found device is incremented. ref count /*
* of from-device is decremented. */ * ref count of the found device is incremented.
* ref count of from-device is decremented.
*/
struct omap_dss_device *omap_dss_get_next_device(struct omap_dss_device *from) struct omap_dss_device *omap_dss_get_next_device(struct omap_dss_device *from)
{ {
struct device *dev; struct list_head *l;
struct device *dev_start = NULL; struct omap_dss_device *dssdev;
struct omap_dss_device *dssdev = NULL;
int match(struct device *dev, void *data) mutex_lock(&panel_list_mutex);
{
return 1; if (list_empty(&panel_list)) {
dssdev = NULL;
goto out;
} }
if (from) if (from == NULL) {
dev_start = &from->dev; dssdev = list_first_entry(&panel_list, struct omap_dss_device,
dev = bus_find_device(dss_get_bus(), dev_start, NULL, match); panel_list);
if (dev) omap_dss_get_device(dssdev);
dssdev = to_dss_device(dev); goto out;
if (from) }
put_device(&from->dev);
omap_dss_put_device(from);
list_for_each(l, &panel_list) {
dssdev = list_entry(l, struct omap_dss_device, panel_list);
if (dssdev == from) {
if (list_is_last(l, &panel_list)) {
dssdev = NULL;
goto out;
}
dssdev = list_entry(l->next, struct omap_dss_device,
panel_list);
omap_dss_get_device(dssdev);
goto out;
}
}
WARN(1, "'from' dssdev not found\n");
dssdev = NULL;
out:
mutex_unlock(&panel_list_mutex);
return dssdev; return dssdev;
} }
EXPORT_SYMBOL(omap_dss_get_next_device); EXPORT_SYMBOL(omap_dss_get_next_device);