From patchwork Sun Jan 5 13:13:05 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ivaylo Dimitrov X-Patchwork-Id: 3434601 Return-Path: X-Original-To: patchwork-linux-omap@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 912779F2E9 for ; Sun, 5 Jan 2014 13:15:07 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id C2F6120165 for ; Sun, 5 Jan 2014 13:15:06 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id DB31120176 for ; Sun, 5 Jan 2014 13:15:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751196AbaAENOw (ORCPT ); Sun, 5 Jan 2014 08:14:52 -0500 Received: from mail-ea0-f179.google.com ([209.85.215.179]:49966 "EHLO mail-ea0-f179.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751050AbaAENOu (ORCPT ); Sun, 5 Jan 2014 08:14:50 -0500 Received: by mail-ea0-f179.google.com with SMTP id r15so7448286ead.24 for ; Sun, 05 Jan 2014 05:14:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=peehe7WT7j8+yjp6Bkmv0VLi5t6UxZxdL8LxJzD/DvE=; b=krMkqdoMvbOhvzoHIemndhB83T8d4AkNZeWBnRSNCQdgFZR7xTkHJa+mAtjMYOsvq0 l+Lc6pEtuY9p0QKFI7bAEcCtTFUwn6E3Y3fgyKlRCiLRBx8GlZ2+AaagulSTdpLWAscI QuzRY5HOOrXGVn1FQuyjwCe98/ZnpsecTtdkU0kjD8LrBTCV7xG4yrM/kxiVSdCXoAyr Q/Cqa//6AF+eZjCb9Ebyj29utEOW5nMfujttqSMO9pQRz9J1UJzgMG2nMBTcxQNLmgs6 bgX8PUoXCFDCHRAVpXUmVTH/9zqe9ntq63D03F/Z++47uIF+VR4j0FNnOuieQeFleyEd JRHg== X-Received: by 10.15.43.10 with SMTP id w10mr84396575eev.13.1388927689120; Sun, 05 Jan 2014 05:14:49 -0800 (PST) Received: from localhost ([46.249.74.23]) by mx.google.com with ESMTPSA id m1sm162047743eeg.0.2014.01.05.05.14.47 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Sun, 05 Jan 2014 05:14:48 -0800 (PST) From: Ivaylo Dimitrov 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 Subject: [PATCH v2] ARM: OMAPFB: panel-sony-acx565akm: fix missing mutex unlocks Date: Sun, 5 Jan 2014 15:13:05 +0200 Message-Id: <1388927585-5640-1-git-send-email-ivo.g.dimitrov.75@gmail.com> X-Mailer: git-send-email 1.8.4.msysgit.0 In-Reply-To: <52C956E9.2030008@gmail.com> References: <52C956E9.2030008@gmail.com> Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Ivaylo Dimitrov 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 --- .../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; }