From patchwork Tue Mar 27 21:06:43 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bjorn Andersson X-Patchwork-Id: 132492 Delivered-To: patch@linaro.org Received: by 10.46.84.29 with SMTP id i29csp5560636ljb; Tue, 27 Mar 2018 14:07:08 -0700 (PDT) X-Google-Smtp-Source: AIpwx49wirHVCxBVbmnCi3XWvkZfZIPyabOlLCBNV0HF7h+OvH8YnjySvM7YUmi0uUR6Z+03CFnr X-Received: by 2002:a17:902:5496:: with SMTP id e22-v6mr869223pli.81.1522184828495; Tue, 27 Mar 2018 14:07:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1522184828; cv=none; d=google.com; s=arc-20160816; b=j2dUa41QXewAuBp8Aj//J1Cg6wUrY25vSYd0rWzczOqongapglavwvuHIDlyUsqRp9 aB9E+Xn5MWQrd66TwgYHuPyz32ZBLuiBkc7fLML0t+4To3VXkuYTJvy8B60bZIQaRLMX hlB9SEgH15CYw4TqpggxTkYI2EJsQTOMZW6nD+xkIEOtc+DOKBCy3XXKt7wSLA7Pando cnKmdkRk1s+bXnq/PVm5msniYHPOFD+ZkrC/02mu6Bmn2vs0w3zSuAQok1YO44tcC9DC Z0e5PwOu/Xlj28w1wAKOogkHN9KEBm7lSRh0HfD4szzB2XRKe6RWAm4dQuYIWR37xV+W 62VQ== 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:dkim-signature:arc-authentication-results; bh=ugSlorH49D6fg2c/5YwboYUpU3Eg18J6kndmR1azfFQ=; b=bEPIaOCR2LXbMPAmnV0/yXr4cwTg5/lWaR4jGScpmB8UPO7MTOjn77gRxHIeJepqZD 0AcKt6RMERd2fMTJXRO8SRrRGn3a933fRXz+JB3SPfYe/X3fa5D0vI3OW4budl4Y+hTT mZ4xqcCb8oTZY2+CwK5T7fzBWp6IS7LI2zNNI0B0OC5ed8kUy+e5lTllo6+l4NOo6gmg 1VC1iBZPSUdfi38vuY3sds1ZltaWFtqmghc3vdypCTzxj9JUH4gPlGujgR80d0qa2uLh j2urs4NgIejGfWwum0Od73b7SUJXykUlaIwH1nV2AfHNpKMbzRll2KJKLqAU7jGJMQ/9 lBMg== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=Kaw66EQ9; spf=pass (google.com: best guess record for domain of linux-arm-msm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-arm-msm-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t9si1576485pfh.101.2018.03.27.14.07.08; Tue, 27 Mar 2018 14:07:08 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-arm-msm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=Kaw66EQ9; spf=pass (google.com: best guess record for domain of linux-arm-msm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-arm-msm-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751249AbeC0VHG (ORCPT + 10 others); Tue, 27 Mar 2018 17:07:06 -0400 Received: from mail-pl0-f66.google.com ([209.85.160.66]:45508 "EHLO mail-pl0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752462AbeC0VGv (ORCPT ); Tue, 27 Mar 2018 17:06:51 -0400 Received: by mail-pl0-f66.google.com with SMTP id n15-v6so176237plp.12 for ; Tue, 27 Mar 2018 14:06:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=TH/q6BAZLzjlPk3UuRME7yjXjX/7VZb/z437mW1+0JA=; b=Kaw66EQ9fudFCqk6ZoSaBufbvFBrQAq2I1SOZcoGxDQaZcgAjp+v8DbEB01euIKM51 o+iqkvoVUbUjRmbc3g1FRUits8skpMtQz1Mq9EhCpKvqIRp6fHz8wgoxBsQ9xangwAk2 xGwsE9O0s/RBvt3tl8IL5Zaq1RD7X5MfdI9+8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=TH/q6BAZLzjlPk3UuRME7yjXjX/7VZb/z437mW1+0JA=; b=FUXdBkJDz9Y5Y+X6e/vBynq0z0M/SJxSzBdSGWadNITeujREmuu7TshrOMloPo/xpK SzkfEaX5kP6AwN0esbZMrqqm76bG0RM3/rkL7Zm1WeGT16Wfr84V04zq0WR+3RqBIrwr JNvzbFBa23BMm4CfQJa0CMYcRGZLGCrFTSZs6udGz2BiZp2/9h7w2Tq9jayKCSiIl4BG XClanZrWW6HIesudCqaycA4clrDGwuHJAmy6bYbH91ld/zlGrQqCllJIOvq2sqICs/yf c8AA2QjOZ7swrd+mFDbAeFy6qYgLlNdosyyLwz0EjKcBL4t6WR1k0vi15ouFxXgQ5RiQ pBJw== X-Gm-Message-State: AElRT7GAuRTK8uhrFYaoNA4vROO+qqX0CdUJCyBajWDvTGXUFxSelO7f u05LcqJZOFqcXHMMYUMmiQnJBg== X-Received: by 2002:a17:902:28a4:: with SMTP id f33-v6mr837851plb.115.1522184810307; Tue, 27 Mar 2018 14:06:50 -0700 (PDT) Received: from localhost.localdomain (104-188-17-28.lightspeed.sndgca.sbcglobal.net. [104.188.17.28]) by smtp.gmail.com with ESMTPSA id b64sm4661907pfl.148.2018.03.27.14.06.49 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 27 Mar 2018 14:06:49 -0700 (PDT) From: Bjorn Andersson To: Ohad Ben-Cohen , Bjorn Andersson Cc: linux-remoteproc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org Subject: [PATCH 3/3] rpmsg: smd: Use announce_create to process any receive work Date: Tue, 27 Mar 2018 14:06:43 -0700 Message-Id: <20180327210643.3436-4-bjorn.andersson@linaro.org> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180327210643.3436-1-bjorn.andersson@linaro.org> References: <20180327210643.3436-1-bjorn.andersson@linaro.org> Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org It is possible that incoming data arrives before the client driver has reached a point in the probe method where adequate context for handling the incoming message has been established. In the event that the client's callback function returns an error the message will be left on the FIFO and by invoking the receive handler after the device has been probed the message will be picked off the FIFO and the callback invoked again. Signed-off-by: Bjorn Andersson --- drivers/rpmsg/qcom_smd.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) -- 2.16.2 -- To unsubscribe from this list: send the line "unsubscribe linux-arm-msm" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/rpmsg/qcom_smd.c b/drivers/rpmsg/qcom_smd.c index 6bb9d21be6bc..4f6b216522a8 100644 --- a/drivers/rpmsg/qcom_smd.c +++ b/drivers/rpmsg/qcom_smd.c @@ -996,8 +996,26 @@ static struct device_node *qcom_smd_match_channel(struct device_node *edge_node, return NULL; } +static int qcom_smd_announce_create(struct rpmsg_device *rpdev) +{ + struct qcom_smd_endpoint *qept = to_smd_endpoint(rpdev->ept); + struct qcom_smd_channel *channel = qept->qsch; + unsigned long flags; + bool kick_state; + + spin_lock_irqsave(&channel->recv_lock, flags); + kick_state = qcom_smd_channel_intr(channel); + spin_unlock_irqrestore(&channel->recv_lock, flags); + + if (kick_state) + schedule_work(&channel->edge->state_work); + + return 0; +} + static const struct rpmsg_device_ops qcom_smd_device_ops = { .create_ept = qcom_smd_create_ept, + .announce_create = qcom_smd_announce_create, }; static const struct rpmsg_endpoint_ops qcom_smd_endpoint_ops = {