Split manager_display_store() into two function, the first function finds a device with the same name. The second unsets the current output attached and sets the one we had searched for. This is done so that there can be re use between display store and writeback store sysfs ops. Signed-off-by: Archit Taneja <archit@xxxxxx> --- drivers/video/omap2/dss/manager.c | 46 ++++++++++++++++++++++++++++++------ 1 files changed, 38 insertions(+), 8 deletions(-) diff --git a/drivers/video/omap2/dss/manager.c b/drivers/video/omap2/dss/manager.c index f4fd3d8..fb7c1e6 100644 --- a/drivers/video/omap2/dss/manager.c +++ b/drivers/video/omap2/dss/manager.c @@ -49,13 +49,11 @@ static ssize_t manager_display_show(struct omap_overlay_manager *mgr, char *buf) dssdev->name : "<none>"); } -static ssize_t manager_display_store(struct omap_overlay_manager *mgr, +static int dss_find_device_buf(struct omap_dss_device **pdssdev, const char *buf, size_t size) { - int r = 0; size_t len = size; struct omap_dss_device *dssdev = NULL; - struct omap_dss_device *curr_display; int match(struct omap_dss_device *dssdev, void *data) { @@ -73,12 +71,25 @@ static ssize_t manager_display_store(struct omap_overlay_manager *mgr, return -EINVAL; if (dssdev) - DSSDBG("display %s found\n", dssdev->name); + DSSDBG("device %s found\n", dssdev->name); + + *pdssdev = dssdev; + + return 0; +} +static int dss_mgr_set_output(struct omap_overlay_manager *mgr, + struct omap_dss_device *dssdev) +{ + int r; + struct omap_dss_device *curr_dssdev; - curr_display = mgr->get_display(mgr); + if (dssdev->wbdev) + curr_dssdev = mgr->get_writeback(mgr); + else + curr_dssdev = mgr->get_display(mgr); - if (curr_display) { - r = mgr->unset_device(mgr, curr_display); + if (curr_dssdev) { + r = mgr->unset_device(mgr, curr_dssdev); if (r) { DSSERR("failed to unset display\n"); goto put_device; @@ -99,11 +110,30 @@ static ssize_t manager_display_store(struct omap_overlay_manager *mgr, } } + return 0; + put_device: if (dssdev) omap_dss_put_device(dssdev); - return r ? r : size; + return r; +} + +static ssize_t manager_display_store(struct omap_overlay_manager *mgr, + const char *buf, size_t size) +{ + int r; + struct omap_dss_device *dssdev; + + r = dss_find_device_buf(&dssdev, buf, size); + if (r) + return r; + + r = dss_mgr_set_output(mgr, dssdev); + if (r) + return r; + + return size; } static ssize_t manager_default_color_show(struct omap_overlay_manager *mgr, -- 1.7.4.1 -- To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html