From patchwork Tue Aug 16 00:17:19 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bjorn Andersson X-Patchwork-Id: 9282431 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id AA834607FD for ; Tue, 16 Aug 2016 00:24:49 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9A71A28DCB for ; Tue, 16 Aug 2016 00:24:49 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8E9B328E8F; Tue, 16 Aug 2016 00:24:49 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.1 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED, T_DKIM_INVALID autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 4853028DCB for ; Tue, 16 Aug 2016 00:24:49 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.85_2 #1 (Red Hat Linux)) id 1bZSA2-0000JQ-5E; Tue, 16 Aug 2016 00:23:18 +0000 Received: from mail-pf0-x232.google.com ([2607:f8b0:400e:c00::232]) by bombadil.infradead.org with esmtps (Exim 4.85_2 #1 (Red Hat Linux)) id 1bZS4s-0003Ti-Sj for linux-arm-kernel@lists.infradead.org; Tue, 16 Aug 2016 00:18:08 +0000 Received: by mail-pf0-x232.google.com with SMTP id y134so21319462pfg.0 for ; Mon, 15 Aug 2016 17:17:38 -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=TOsyN2Vqr2BxS64heLAiYmsIBHY4Vy4ni4kULn+EESk=; b=fihwGbH4vtVPqpAmOLO8hCWQHmo8N64NhUr8PMuhy3NAw4Rwzzx7z4T04OjLDcpTwM U8sYBKNHxt53Dwaj86P8r0+TR7AvVEbMffauqUWTAoufi/SCbr+C6mXjueNgINm+UYbR 3aW+8FDVkQWua55zAiAUUhy6ilpnDs7juixOA= 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:in-reply-to :references; bh=TOsyN2Vqr2BxS64heLAiYmsIBHY4Vy4ni4kULn+EESk=; b=CygLaHPBd1l5XOww9ajvhbsez92U8IMwTmrE76jvHX7zvhDqhqY33/7vmUiFhHcYlz F6Nce2Ap9VTytBDi9Za5gN17WZ0eiUbvJ1Xd1tA+M7r1mSmp7k6mmqhuP9qtkZVGvswu xNTuAcjSXKpI/pkcK9y5R9RrmE01uYwZVSK8NCer0LXsY8Gdlqga8t8MdIBSCwVjWVtP roGE+VJMNp6V57/rO0JhXUpsqG5qRtiWIlqLDuv+QuUq/C/QM/CkSjbC3MYU+NtIGZB5 6w7j4A0hlIPO00+SA9k4F4FKZ2tOOWdg2vz7vkGG3BnBnkQZxKTVKi7xejKJadr0q7OX 1aIg== X-Gm-Message-State: AEkoouvdCJoA1mM7KRKQaQB+FnPcLbuIpI16e68QWxx7jNjlLx/8XCQe9rceNZLrdpSKXECG X-Received: by 10.98.200.29 with SMTP id z29mr58614049pff.143.1471306658083; Mon, 15 Aug 2016 17:17:38 -0700 (PDT) Received: from localhost.localdomain (ip68-111-223-48.sd.sd.cox.net. [68.111.223.48]) by smtp.gmail.com with ESMTPSA id p187sm34047931pfb.5.2016.08.15.17.17.37 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 15 Aug 2016 17:17:37 -0700 (PDT) From: Bjorn Andersson To: Ohad Ben-Cohen , Bjorn Andersson Subject: [PATCH 13/14] rpmsg: Allow callback to return errors Date: Mon, 15 Aug 2016 17:17:19 -0700 Message-Id: <1471306640-29917-14-git-send-email-bjorn.andersson@linaro.org> X-Mailer: git-send-email 2.5.0 In-Reply-To: <1471306640-29917-1-git-send-email-bjorn.andersson@linaro.org> References: <1471306640-29917-1-git-send-email-bjorn.andersson@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160815_171759_235830_00CABE8F X-CRM114-Status: GOOD ( 14.16 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-arm-msm@vger.kernel.org, linux-remoteproc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Some rpmsg backends support holding on to and redelivering messages upon failed handling of them, so provide a way for the callback to report and error and allow the backends to handle this. Signed-off-by: Bjorn Andersson --- drivers/rpmsg/virtio_rpmsg_bus.c | 10 ++++++---- include/linux/rpmsg.h | 4 ++-- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/drivers/rpmsg/virtio_rpmsg_bus.c b/drivers/rpmsg/virtio_rpmsg_bus.c index d39e381bc596..9d681d68f7f3 100644 --- a/drivers/rpmsg/virtio_rpmsg_bus.c +++ b/drivers/rpmsg/virtio_rpmsg_bus.c @@ -785,8 +785,8 @@ static void rpmsg_xmit_done(struct virtqueue *svq) } /* invoked when a name service announcement arrives */ -static void rpmsg_ns_cb(struct rpmsg_device *rpdev, void *data, int len, - void *priv, u32 src) +static int rpmsg_ns_cb(struct rpmsg_device *rpdev, void *data, int len, + void *priv, u32 src) { struct rpmsg_ns_msg *msg = data; struct rpmsg_device *newch; @@ -802,7 +802,7 @@ static void rpmsg_ns_cb(struct rpmsg_device *rpdev, void *data, int len, if (len != sizeof(*msg)) { dev_err(dev, "malformed ns msg (%d)\n", len); - return; + return -EINVAL; } /* @@ -813,7 +813,7 @@ static void rpmsg_ns_cb(struct rpmsg_device *rpdev, void *data, int len, */ if (rpdev) { dev_err(dev, "anomaly: ns ept has an rpdev handle\n"); - return; + return -EINVAL; } /* don't trust the remote processor for null terminating the name */ @@ -836,6 +836,8 @@ static void rpmsg_ns_cb(struct rpmsg_device *rpdev, void *data, int len, if (!newch) dev_err(dev, "rpmsg_create_channel failed\n"); } + + return 0; } static int rpmsg_probe(struct virtio_device *vdev) diff --git a/include/linux/rpmsg.h b/include/linux/rpmsg.h index bdd1a2285733..19213e660a9b 100644 --- a/include/linux/rpmsg.h +++ b/include/linux/rpmsg.h @@ -46,7 +46,7 @@ struct rpmsg_device; struct rpmsg_endpoint; -typedef void (*rpmsg_rx_cb_t)(struct rpmsg_device *, void *, int, void *, u32); +typedef int (*rpmsg_rx_cb_t)(struct rpmsg_device *, void *, int, void *, u32); /** * struct rpmsg_channel_info - internal channel info representation @@ -123,7 +123,7 @@ struct rpmsg_driver { const struct rpmsg_device_id *id_table; int (*probe)(struct rpmsg_device *dev); void (*remove)(struct rpmsg_device *dev); - void (*callback)(struct rpmsg_device *, void *, int, void *, u32); + int (*callback)(struct rpmsg_device *, void *, int, void *, u32); }; int register_rpmsg_device(struct rpmsg_device *dev);