From patchwork Wed Dec 10 20:16:12 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ashwin Chaugule X-Patchwork-Id: 42099 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f197.google.com (mail-wi0-f197.google.com [209.85.212.197]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 5707826666 for ; Wed, 10 Dec 2014 20:16:35 +0000 (UTC) Received: by mail-wi0-f197.google.com with SMTP id l15sf2764110wiw.0 for ; Wed, 10 Dec 2014 12:16:34 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:x-original-sender:x-original-authentication-results :precedence:mailing-list:list-id:list-post:list-help:list-archive :list-unsubscribe; bh=iFfXlt/MC3HG9RF4Kfty0+3cYsN0hMMNJr/Orc5wIEs=; b=cUHuCPKx+M/DVQtFkcErnuQiUgN8e4JXWjx4wPm1X8kdUCSU2Ff8A5VDz4BehTBrcS cFsMXUyFnmjBAZ2RobCo64VGbOIMTgCBBdaOQSFThIKu62Qx3dnrKLJ94I68RQeTg1nN wwgmgKVFHdGbuSLtKG1VcMMruwjCTvfgA8YGb5bZpNoTsUhL47eYHUa/0md9LEXnooFG iqItX/ZnemoSufYeNACv06CGRTdSlLKeeqZoopHoNO/wq9kzZCFccXqDGVAQCGlCNC0X 9g32uG6ptts9Z22OND9QggRz4pxbgUGXZiaC1zSoFLTkTc3dgMWOCy487oL46LvxguA2 tVQQ== X-Gm-Message-State: ALoCoQkpP9AKJnlICgEK6DYvhbBxKuevxnNXF70DD+oKsQf+0DCes/KyFJc5CgMtrjgbH/T0UkBj X-Received: by 10.180.24.35 with SMTP id r3mr1856574wif.0.1418242594629; Wed, 10 Dec 2014 12:16:34 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.44.135 with SMTP id e7ls25505lam.76.gmail; Wed, 10 Dec 2014 12:16:34 -0800 (PST) X-Received: by 10.112.171.136 with SMTP id au8mr5960986lbc.71.1418242594472; Wed, 10 Dec 2014 12:16:34 -0800 (PST) Received: from mail-la0-f54.google.com (mail-la0-f54.google.com. [209.85.215.54]) by mx.google.com with ESMTPS id ob7si5641690lbb.127.2014.12.10.12.16.34 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 10 Dec 2014 12:16:34 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.54 as permitted sender) client-ip=209.85.215.54; Received: by mail-la0-f54.google.com with SMTP id pv20so3075550lab.27 for ; Wed, 10 Dec 2014 12:16:34 -0800 (PST) X-Received: by 10.112.52.37 with SMTP id q5mr5929848lbo.32.1418242594339; Wed, 10 Dec 2014 12:16:34 -0800 (PST) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.112.142.69 with SMTP id ru5csp315231lbb; Wed, 10 Dec 2014 12:16:33 -0800 (PST) X-Received: by 10.70.26.100 with SMTP id k4mr10066318pdg.101.1418242592423; Wed, 10 Dec 2014 12:16:32 -0800 (PST) Received: from mail-pd0-f181.google.com (mail-pd0-f181.google.com. [209.85.192.181]) by mx.google.com with ESMTPS id fq5si8252595pdb.160.2014.12.10.12.16.31 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 10 Dec 2014 12:16:32 -0800 (PST) Received-SPF: pass (google.com: domain of ashwin.chaugule@linaro.org designates 209.85.192.181 as permitted sender) client-ip=209.85.192.181; Received: by mail-pd0-f181.google.com with SMTP id v10so3438535pde.40 for ; Wed, 10 Dec 2014 12:16:31 -0800 (PST) X-Received: by 10.66.173.40 with SMTP id bh8mr10107337pac.119.1418242591412; Wed, 10 Dec 2014 12:16:31 -0800 (PST) Received: from esagroth.qualcomm.com (rrcs-67-52-130-30.west.biz.rr.com. [67.52.130.30]) by mx.google.com with ESMTPSA id ns6sm4925752pbb.77.2014.12.10.12.16.28 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 10 Dec 2014 12:16:30 -0800 (PST) From: Ashwin Chaugule To: jaswinder.singh@linaro.org Cc: broonie@kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linaro-acpi@lists.linaro.org, patches@linaro.org, arnd@arndb.de, Ashwin Chaugule Subject: [PATCH] Mailbox: Complete wait event only if Tx was successful Date: Wed, 10 Dec 2014 15:16:12 -0500 Message-Id: <1418242572-20998-1-git-send-email-ashwin.chaugule@linaro.org> X-Mailer: git-send-email 1.9.1 X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: ashwin.chaugule@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.54 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , If a wait_for_completion_timeout() call returns due to a timeout, the mbox code can still call complete() after returning from the wait. This can cause subsequent transmissions on a channel to fail, since the wait_for_completion_timeout() sees the completion variable is !=0, caused by the erroneous complete() call, and immediately returns without waiting for the time as expected by the client. Fix this by calling complete() only if the TX was successful. Signed-off-by: Ashwin Chaugule --- drivers/mailbox/mailbox.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/mailbox/mailbox.c b/drivers/mailbox/mailbox.c index 17e9e4a..4acaddb 100644 --- a/drivers/mailbox/mailbox.c +++ b/drivers/mailbox/mailbox.c @@ -101,7 +101,7 @@ static void tx_tick(struct mbox_chan *chan, int r) if (mssg && chan->cl->tx_done) chan->cl->tx_done(chan->cl, mssg, r); - if (chan->cl->tx_block) + if ((!r) && chan->cl->tx_block) complete(&chan->tx_complete); }