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: 5472001 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id C118CBEEA8 for ; Wed, 10 Dec 2014 20:18:47 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id F2A1920114 for ; Wed, 10 Dec 2014 20:18:46 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 22F7620121 for ; Wed, 10 Dec 2014 20:18:46 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1Xyngv-0002cj-Th; Wed, 10 Dec 2014 20:16:57 +0000 Received: from mail-pd0-f170.google.com ([209.85.192.170]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1Xyngr-0002VN-98 for linux-arm-kernel@lists.infradead.org; Wed, 10 Dec 2014 20:16:54 +0000 Received: by mail-pd0-f170.google.com with SMTP id v10so3458054pde.1 for ; Wed, 10 Dec 2014 12:16:31 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=iFfXlt/MC3HG9RF4Kfty0+3cYsN0hMMNJr/Orc5wIEs=; b=LGtNeew3BAHCh011Uo3/UurnMw/HNJun8NOaA6xJC4Sfh6ducIEcjjqk5xoOsz98Xa 0ekqEkOJZbm1v7zzsIVzSJc1MgBFNvWno4zuC8YpIBVU50F5C1Ahw2rZKHYz3Asd97hA Smb/i8ICNzigcYq3CtKAEn9jBC9s2J44I01UhHdXgYQtJ2ect+vkSqC3lnYYbHF25vW2 ymESI70cYnKBIqPKpOZMRzywm3o3UnmnoeLIgFK9ume5ttJq4eDcxCkYValcF7lI1k3D ntpeZmN/lcVv0fIYkDPLCgnlNsIf37LNP7RigMFnmb9GybSWtLOSti4JnIYc23TB0T3e /biA== X-Gm-Message-State: ALoCoQk33uKPZkgimFbqXSduRosl8SWGCGPzDmmam8PBOAqTLnz8BmJV4X+Xh0xyV2zHOtub64gF 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 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-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20141210_121653_404241_51FDAB08 X-CRM114-Status: UNSURE ( 9.14 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -0.7 (/) Cc: Ashwin Chaugule , arnd@arndb.de, patches@linaro.org, linaro-acpi@lists.linaro.org, linux-kernel@vger.kernel.org, broonie@kernel.org, linux-arm-kernel@lists.infradead.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, T_RP_MATCHES_RCVD, 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 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); }