Received: by 2002:a25:868d:0:0:0:0:0 with SMTP id z13csp250515ybk; Tue, 12 May 2020 22:13:13 -0700 (PDT) X-Google-Smtp-Source: APiQypI7gpcnFSfdZIRQgu8FyIxA2Vp2/9Z3xtNXwwj5MMChZbm7b53mWQZGEAiv+PMxxfzTV4AW X-Received: by 2002:a17:906:cec5:: with SMTP id si5mr21124136ejb.267.1589346793365; Tue, 12 May 2020 22:13:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589346793; cv=none; d=google.com; s=arc-20160816; b=KBCmfQ44JLQ6HZipXZNWI5gYSKgM3AiRPkhsYi3cJVocMiz9+I3rRA1/YBZ+EfkqME aZZD5rd8CagEcMhVIc1K7nFXSVr7MIeKza7QnHmafp61y+Zk6qPNTJF9VSXimYAuW/Av cRgfXY3arb7SA4MvRWXnl4KQ0XK9RSr2oDnk60xupVgjM+z6qd6a6EkrGZUDdZiM+Axj gs3eMz3WXuMD7SotHOR9QXs1gCYy4uFiLV28XKK73+cuDJ2PTkBC0n3sGOCh80dCuxsv dN8+zZQY2U+8Q2nY2zT0sY4C1fKsWfLvLSLPgD9uNjcND6xycdv9RA/6JwZvgmIwCe3a pPMw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dmarc-filter:dkim-signature; bh=gOLhQscu2oEzn2VaWraaqHZ/5GFOyVJgmsmkxDlohJA=; b=q66/GIoeoD0m7V0tcrOKH4ZuonRTcDIJOJ0AVHvQQMP0hLA0Fgo6KcjPPffyOsZv0T AVzI7oAQS/CtoYXTeyCtsoAyGYVTxHvGhqHuCagW5PwR4RXG12OXeCmip28lxeCYZlMu 1gH9OgOlefELuRnx6pYYlo1mXBqUpURsVUoXtmWG8b5yYZUk5dRcxcFjahNTevPnIl28 44n6P4aYKruKGb5nDXOqClMy3YqynXK13vTeR3ir25PRmSjV6FbDsA9fFzcXKlXDXpKO p/ym6UpYts+ykiiXJNdKWMD/PGkipPrrEX5uolP5saC3PY7ziAb9DfQ5L2LdphKuAGKf Axgw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@mg.codeaurora.org header.s=smtp header.b=S7y3y+GE; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g8si6477748eje.444.2020.05.12.22.12.49; Tue, 12 May 2020 22:13:13 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=fail header.i=@mg.codeaurora.org header.s=smtp header.b=S7y3y+GE; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728131AbgEMFKp (ORCPT + 99 others); Wed, 13 May 2020 01:10:45 -0400 Received: from mail26.static.mailgun.info ([104.130.122.26]:38235 "EHLO mail26.static.mailgun.info" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728930AbgEMFKn (ORCPT ); Wed, 13 May 2020 01:10:43 -0400 DKIM-Signature: a=rsa-sha256; v=1; c=relaxed/relaxed; d=mg.codeaurora.org; q=dns/txt; s=smtp; t=1589346643; h=References: In-Reply-To: Message-Id: Date: Subject: Cc: To: From: Sender; bh=gOLhQscu2oEzn2VaWraaqHZ/5GFOyVJgmsmkxDlohJA=; b=S7y3y+GEbjefPwzunE9O27eM9cQHoJsp1V9EKPPSc6+e895vnZu1cSYDoe6VHn3RZLBuNlzo aISu4mVis7VXM2yTNhQS2JJF/il9EIPsUE2UrGXWIhLPmzpjOWSsi5hDKf47wUavoGbQfx9Z lCC9KwNKr+2Mt+MYW9QKrlo/xZc= X-Mailgun-Sending-Ip: 104.130.122.26 X-Mailgun-Sid: WyI0MWYwYSIsICJsaW51eC1rZXJuZWxAdmdlci5rZXJuZWwub3JnIiwgImJlOWU0YSJd Received: from smtp.codeaurora.org (ec2-35-166-182-171.us-west-2.compute.amazonaws.com [35.166.182.171]) by mxa.mailgun.org with ESMTP id 5ebb8151.7fdc6137f110-smtp-out-n05; Wed, 13 May 2020 05:10:41 -0000 (UTC) Received: by smtp.codeaurora.org (Postfix, from userid 1001) id 105DBC4478F; Wed, 13 May 2020 05:10:41 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-caf-mail-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.0 required=2.0 tests=ALL_TRUSTED,SPF_NONE, URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.0 Received: from aneelaka-linux.qualcomm.com (blr-c-bdr-fw-01_GlobalNAT_AllZones-Outside.qualcomm.com [103.229.19.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: aneela) by smtp.codeaurora.org (Postfix) with ESMTPSA id 3AA5DC44792; Wed, 13 May 2020 05:10:36 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 3AA5DC44792 Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; spf=none smtp.mailfrom=aneela@codeaurora.org From: Arun Kumar Neelakantam To: ohad@wizery.com, bjorn.andersson@linaro.org, clew@codeaurora.org, sricharan@codeaurora.org Cc: linux-remoteproc@vger.kernel.org, linux-kernel@vger.kernel.org, Arun Kumar Neelakantam , Andy Gross , linux-arm-msm@vger.kernel.org (open list:ARM/QUALCOMM SUPPORT) Subject: [PATCH V5 5/5] rpmsg: glink: unregister rpmsg device during endpoint destroy Date: Wed, 13 May 2020 10:40:06 +0530 Message-Id: <1589346606-15046-6-git-send-email-aneela@codeaurora.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1589346606-15046-1-git-send-email-aneela@codeaurora.org> References: <1589346606-15046-1-git-send-email-aneela@codeaurora.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Rpmsg device unregister is not happening if channel close is triggered from local side and causing re-registration of device failures. Unregister rpmsg device for local close in endpoint destroy path. Signed-off-by: Arun Kumar Neelakantam --- drivers/rpmsg/qcom_glink_native.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/drivers/rpmsg/qcom_glink_native.c b/drivers/rpmsg/qcom_glink_native.c index 0e8a28c0..fc8ef66 100644 --- a/drivers/rpmsg/qcom_glink_native.c +++ b/drivers/rpmsg/qcom_glink_native.c @@ -1207,6 +1207,7 @@ static void qcom_glink_destroy_ept(struct rpmsg_endpoint *ept) { struct glink_channel *channel = to_glink_channel(ept); struct qcom_glink *glink = channel->glink; + struct rpmsg_channel_info chinfo; unsigned long flags; spin_lock_irqsave(&channel->recv_lock, flags); @@ -1214,6 +1215,13 @@ static void qcom_glink_destroy_ept(struct rpmsg_endpoint *ept) spin_unlock_irqrestore(&channel->recv_lock, flags); /* Decouple the potential rpdev from the channel */ + if (channel->rpdev) { + strncpy(chinfo.name, channel->name, sizeof(chinfo.name)); + chinfo.src = RPMSG_ADDR_ANY; + chinfo.dst = RPMSG_ADDR_ANY; + + rpmsg_unregister_device(glink->dev, &chinfo); + } channel->rpdev = NULL; qcom_glink_send_close_req(glink, channel); @@ -1477,6 +1485,7 @@ static void qcom_glink_rx_close(struct qcom_glink *glink, unsigned int rcid) rpmsg_unregister_device(glink->dev, &chinfo); } + channel->rpdev = NULL; qcom_glink_send_close_ack(glink, channel->rcid); -- 2.7.4