From: Ivaylo Dimitrov <ivo.g.dimitrov.75@gmail.com> To: tomi.valkeinen@ti.com Cc: plagnioj@jcrosoft.com, pali.rohar@gmail.com, pavel@ucw.cz, linux-omap@vger.kernel.org, linux-fbdev@vger.kernel.org, linux-kernel@vger.kernel.org, Ivaylo Dimitrov <freemangordon@abv.bg> Subject: [PATCH v2] ARM: OMAPFB: panel-sony-acx565akm: fix missing mutex unlocks Date: Sun, 5 Jan 2014 15:13:05 +0200 [thread overview] Message-ID: <1388927585-5640-1-git-send-email-ivo.g.dimitrov.75@gmail.com> (raw) In-Reply-To: <52C956E9.2030008@gmail.com> From: Ivaylo Dimitrov <freemangordon@abv.bg> Commit c37dd677988ca50bc8bc60ab5ab053720583c168 fixes the unbalanced unlock in acx565akm_enable but introduces another problem - if acx565akm_panel_power_on exits early, the mutex is not unlocked. Fix that by unlocking the mutex on early return. Also add mutex protection in acx565akm_panel_power_off and remove an unused variable Signed-off-by: Ivaylo Dimitrov <freemangordon@abv.bg> --- .../omap2/displays-new/panel-sony-acx565akm.c | 16 ++++++++++------ 1 files changed, 10 insertions(+), 6 deletions(-) diff --git a/drivers/video/omap2/displays-new/panel-sony-acx565akm.c b/drivers/video/omap2/displays-new/panel-sony-acx565akm.c index d94f35d..9aef7fa 100644 --- a/drivers/video/omap2/displays-new/panel-sony-acx565akm.c +++ b/drivers/video/omap2/displays-new/panel-sony-acx565akm.c @@ -535,6 +535,7 @@ static int acx565akm_panel_power_on(struct omap_dss_device *dssdev) r = in->ops.sdi->enable(in); if (r) { + mutex_unlock(&ddata->mutex); pr_err("%s sdi enable failed\n", __func__); return r; } @@ -546,6 +547,7 @@ static int acx565akm_panel_power_on(struct omap_dss_device *dssdev) gpio_set_value(ddata->reset_gpio, 1); if (ddata->enabled) { + mutex_unlock(&ddata->mutex); dev_dbg(&ddata->spi->dev, "panel already enabled\n"); return 0; } @@ -578,10 +580,14 @@ static void acx565akm_panel_power_off(struct omap_dss_device *dssdev) struct panel_drv_data *ddata = to_panel_data(dssdev); struct omap_dss_device *in = ddata->in; + mutex_lock(&ddata->mutex); + dev_dbg(dssdev->dev, "%s\n", __func__); - if (!ddata->enabled) + if (!ddata->enabled) { + mutex_unlock(&ddata->mutex); return; + } set_display_state(ddata, 0); set_sleep_mode(ddata, 1); @@ -601,11 +607,13 @@ static void acx565akm_panel_power_off(struct omap_dss_device *dssdev) msleep(100); in->ops.sdi->disable(in); + + mutex_unlock(&ddata->mutex); + } static int acx565akm_enable(struct omap_dss_device *dssdev) { - struct panel_drv_data *ddata = to_panel_data(dssdev); int r; dev_dbg(dssdev->dev, "%s\n", __func__); @@ -627,16 +635,12 @@ static int acx565akm_enable(struct omap_dss_device *dssdev) static void acx565akm_disable(struct omap_dss_device *dssdev) { - struct panel_drv_data *ddata = to_panel_data(dssdev); - dev_dbg(dssdev->dev, "%s\n", __func__); if (!omapdss_device_is_enabled(dssdev)) return; - mutex_lock(&ddata->mutex); acx565akm_panel_power_off(dssdev); - mutex_unlock(&ddata->mutex); dssdev->state = OMAP_DSS_DISPLAY_DISABLED; } -- 1.5.6.1
WARNING: multiple messages have this Message-ID (diff)
From: Ivaylo Dimitrov <ivo.g.dimitrov.75@gmail.com> To: tomi.valkeinen@ti.com Cc: plagnioj@jcrosoft.com, pali.rohar@gmail.com, pavel@ucw.cz, linux-omap@vger.kernel.org, linux-fbdev@vger.kernel.org, linux-kernel@vger.kernel.org, Ivaylo Dimitrov <freemangordon@abv.bg> Subject: [PATCH v2] ARM: OMAPFB: panel-sony-acx565akm: fix missing mutex unlocks Date: Sun, 05 Jan 2014 13:13:05 +0000 [thread overview] Message-ID: <1388927585-5640-1-git-send-email-ivo.g.dimitrov.75@gmail.com> (raw) In-Reply-To: <52C956E9.2030008@gmail.com> From: Ivaylo Dimitrov <freemangordon@abv.bg> Commit c37dd677988ca50bc8bc60ab5ab053720583c168 fixes the unbalanced unlock in acx565akm_enable but introduces another problem - if acx565akm_panel_power_on exits early, the mutex is not unlocked. Fix that by unlocking the mutex on early return. Also add mutex protection in acx565akm_panel_power_off and remove an unused variable Signed-off-by: Ivaylo Dimitrov <freemangordon@abv.bg> --- .../omap2/displays-new/panel-sony-acx565akm.c | 16 ++++++++++------ 1 files changed, 10 insertions(+), 6 deletions(-) diff --git a/drivers/video/omap2/displays-new/panel-sony-acx565akm.c b/drivers/video/omap2/displays-new/panel-sony-acx565akm.c index d94f35d..9aef7fa 100644 --- a/drivers/video/omap2/displays-new/panel-sony-acx565akm.c +++ b/drivers/video/omap2/displays-new/panel-sony-acx565akm.c @@ -535,6 +535,7 @@ static int acx565akm_panel_power_on(struct omap_dss_device *dssdev) r = in->ops.sdi->enable(in); if (r) { + mutex_unlock(&ddata->mutex); pr_err("%s sdi enable failed\n", __func__); return r; } @@ -546,6 +547,7 @@ static int acx565akm_panel_power_on(struct omap_dss_device *dssdev) gpio_set_value(ddata->reset_gpio, 1); if (ddata->enabled) { + mutex_unlock(&ddata->mutex); dev_dbg(&ddata->spi->dev, "panel already enabled\n"); return 0; } @@ -578,10 +580,14 @@ static void acx565akm_panel_power_off(struct omap_dss_device *dssdev) struct panel_drv_data *ddata = to_panel_data(dssdev); struct omap_dss_device *in = ddata->in; + mutex_lock(&ddata->mutex); + dev_dbg(dssdev->dev, "%s\n", __func__); - if (!ddata->enabled) + if (!ddata->enabled) { + mutex_unlock(&ddata->mutex); return; + } set_display_state(ddata, 0); set_sleep_mode(ddata, 1); @@ -601,11 +607,13 @@ static void acx565akm_panel_power_off(struct omap_dss_device *dssdev) msleep(100); in->ops.sdi->disable(in); + + mutex_unlock(&ddata->mutex); + } static int acx565akm_enable(struct omap_dss_device *dssdev) { - struct panel_drv_data *ddata = to_panel_data(dssdev); int r; dev_dbg(dssdev->dev, "%s\n", __func__); @@ -627,16 +635,12 @@ static int acx565akm_enable(struct omap_dss_device *dssdev) static void acx565akm_disable(struct omap_dss_device *dssdev) { - struct panel_drv_data *ddata = to_panel_data(dssdev); - dev_dbg(dssdev->dev, "%s\n", __func__); if (!omapdss_device_is_enabled(dssdev)) return; - mutex_lock(&ddata->mutex); acx565akm_panel_power_off(dssdev); - mutex_unlock(&ddata->mutex); dssdev->state = OMAP_DSS_DISPLAY_DISABLED; } -- 1.5.6.1
next prev parent reply other threads:[~2014-01-05 13:14 UTC|newest] Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top 2013-12-30 16:17 [PATCH] ARM: OMAPFB: panel-sony-acx565akm: fix missing mutex unlocks Ivaylo Dimitrov 2013-12-30 16:17 ` Ivaylo Dimitrov 2014-01-04 12:51 ` Pavel Machek 2014-01-04 12:51 ` Pavel Machek 2014-01-05 12:58 ` Ivaylo Dimitrov 2014-01-05 12:58 ` Ivaylo Dimitrov 2014-01-05 13:13 ` Ivaylo Dimitrov [this message] 2014-01-05 13:13 ` [PATCH v2] " Ivaylo Dimitrov 2014-01-10 10:56 ` Tomi Valkeinen 2014-01-10 10:56 ` Tomi Valkeinen 2014-01-10 10:56 ` Tomi Valkeinen 2014-01-11 9:39 ` Ivaylo Dimitrov 2014-01-11 9:39 ` Ivaylo Dimitrov 2014-01-13 10:20 ` Tomi Valkeinen 2014-01-13 10:20 ` Tomi Valkeinen 2014-01-13 10:20 ` Tomi Valkeinen 2015-12-25 13:29 ` Ivaylo Dimitrov 2015-12-25 13:29 ` Ivaylo Dimitrov 2015-12-29 7:46 ` Tomi Valkeinen 2015-12-29 7:46 ` Tomi Valkeinen 2015-12-29 7:46 ` Tomi Valkeinen 2016-01-01 12:25 ` Ivaylo Dimitrov 2016-01-01 12:25 ` Ivaylo Dimitrov -- strict thread matches above, loose matches on Subject: below -- 2013-11-06 21:24 [PATCH] ARM: OMAPFB: panel-sony-acx565akm: fix bad unlock balance Aaro Koskinen 2013-11-06 21:24 ` Aaro Koskinen 2013-11-11 13:37 ` Tomi Valkeinen 2013-11-11 13:37 ` Tomi Valkeinen 2013-11-11 18:37 ` Aaro Koskinen 2013-11-11 18:37 ` Aaro Koskinen 2013-12-06 12:55 ` [PATCH] ARM: OMAPFB: panel-sony-acx565akm: fix missing unlock in acx565akm_panel_power_on() Wei Yongjun 2013-12-06 12:55 ` Wei Yongjun 2013-12-11 14:29 ` Tomi Valkeinen 2013-12-11 14:29 ` Tomi Valkeinen
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=1388927585-5640-1-git-send-email-ivo.g.dimitrov.75@gmail.com \ --to=ivo.g.dimitrov.75@gmail.com \ --cc=freemangordon@abv.bg \ --cc=linux-fbdev@vger.kernel.org \ --cc=linux-kernel@vger.kernel.org \ --cc=linux-omap@vger.kernel.org \ --cc=pali.rohar@gmail.com \ --cc=pavel@ucw.cz \ --cc=plagnioj@jcrosoft.com \ --cc=tomi.valkeinen@ti.com \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.