From patchwork Tue Nov 3 20:36:28 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kroah-Hartman X-Patchwork-Id: 317108 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 98716C2D0A3 for ; Tue, 3 Nov 2020 21:04:47 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 62C0920757 for ; Tue, 3 Nov 2020 21:04:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1604437487; bh=X5a1uvzYGmq5gW5+Myp/lnzk7747LtgnpE0vjziG6ZM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=wSw73pczE4zeBr26I9j6x5o8Gi/W/w+2TvAaeDQAd6iFHkPW4UFD1Wp0AVWcNNVLK m5Hhc4phEmZJ/yQ3jjkPnI/Y15iI7HQtpYrtTiemlpEi1WvrV9lyq1Sjc01rh17p/z S8VRMCtmdl4doJab9PdmZY3pIXRMWVBLj3YXAIwA= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388023AbgKCVEq (ORCPT ); Tue, 3 Nov 2020 16:04:46 -0500 Received: from mail.kernel.org ([198.145.29.99]:42860 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388013AbgKCVEm (ORCPT ); Tue, 3 Nov 2020 16:04:42 -0500 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 2D7A2206B5; Tue, 3 Nov 2020 21:04:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1604437481; bh=X5a1uvzYGmq5gW5+Myp/lnzk7747LtgnpE0vjziG6ZM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=xM1U/xrWQw8weL9t7DaouSlh0JSoZ5teZ7l/cJBArioWD2+vQl5xNrGwawGNB9wYm zsT31SORz/39kt32TjeJpnAQrgyn5Yic08bkcmpC60AnuKl5YNsW4nBAa8a1wJ9KER kr6AlXlIYIisMBsQlXh4s1OxoR+P9014z8IwrCXQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Chris Lew , Arun Kumar Neelakantam , Deepak Kumar Singh , Bjorn Andersson , Sasha Levin Subject: [PATCH 4.19 096/191] rpmsg: glink: Use complete_all for open states Date: Tue, 3 Nov 2020 21:36:28 +0100 Message-Id: <20201103203242.817041055@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201103203232.656475008@linuxfoundation.org> References: <20201103203232.656475008@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Chris Lew [ Upstream commit 4fcdaf6e28d11e2f3820d54dd23cd12a47ddd44e ] The open_req and open_ack completion variables are the state variables to represet a remote channel as open. Use complete_all so there are no races with waiters and using completion_done. Signed-off-by: Chris Lew Signed-off-by: Arun Kumar Neelakantam Signed-off-by: Deepak Kumar Singh Link: https://lore.kernel.org/r/1593017121-7953-2-git-send-email-deesin@codeaurora.org Signed-off-by: Bjorn Andersson Signed-off-by: Sasha Levin --- drivers/rpmsg/qcom_glink_native.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/rpmsg/qcom_glink_native.c b/drivers/rpmsg/qcom_glink_native.c index facc577ab0acc..a755f85686e53 100644 --- a/drivers/rpmsg/qcom_glink_native.c +++ b/drivers/rpmsg/qcom_glink_native.c @@ -970,7 +970,7 @@ static int qcom_glink_rx_open_ack(struct qcom_glink *glink, unsigned int lcid) return -EINVAL; } - complete(&channel->open_ack); + complete_all(&channel->open_ack); return 0; } @@ -1178,7 +1178,7 @@ static int qcom_glink_announce_create(struct rpmsg_device *rpdev) __be32 *val = defaults; int size; - if (glink->intentless) + if (glink->intentless || !completion_done(&channel->open_ack)) return 0; prop = of_find_property(np, "qcom,intents", NULL); @@ -1413,7 +1413,7 @@ static int qcom_glink_rx_open(struct qcom_glink *glink, unsigned int rcid, channel->rcid = ret; spin_unlock_irqrestore(&glink->idr_lock, flags); - complete(&channel->open_req); + complete_all(&channel->open_req); if (create_device) { rpdev = kzalloc(sizeof(*rpdev), GFP_KERNEL);