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: 73940 Delivered-To: patch@linaro.org Received: by 10.140.29.52 with SMTP id a49csp1711848qga; Mon, 15 Aug 2016 17:17:57 -0700 (PDT) X-Received: by 10.66.227.101 with SMTP id rz5mr58482927pac.81.1471306673111; Mon, 15 Aug 2016 17:17:53 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 77si28990605pft.11.2016.08.15.17.17.52; Mon, 15 Aug 2016 17:17:53 -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; 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 dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752409AbcHPARp (ORCPT + 8 others); Mon, 15 Aug 2016 20:17:45 -0400 Received: from mail-pf0-f171.google.com ([209.85.192.171]:36101 "EHLO mail-pf0-f171.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932487AbcHPARn (ORCPT ); Mon, 15 Aug 2016 20:17:43 -0400 Received: by mail-pf0-f171.google.com with SMTP id h186so21305128pfg.3 for ; Mon, 15 Aug 2016 17:17:43 -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=LunT5kOdtGUgDbFYar5fB47EdEHDtVls/CD++2VY6TI/uV9OJCCZM/BYCEJlkUqyzq L8o4TlDvZEpM4oSmP9TNuAYyxDUoEe4PWchSk7hBF8QLyGl1K5earlgdpwa9ZYoRIXkp G/EYB3rmv+86GAMhWbvVWKfVxR0KWVoXKCKnlhq3J2drTwVqWnvRh9jIHkl6f6CYTKM4 N6vJ0xohFklW0ftIpCToPYXjFNC8irqAaw4G0Q2WyqaGGgLC8NmJHYbhX0/E1MwJRDNt OmZWVwWQO2/p8V9BYyEcoWGp4LOq5pzNZPQwRz6cTNRNW+YaSgIpBDcwITN88a8rNwGF JuRQ== X-Gm-Message-State: AEkooutHTp09mNd0kMiGILQ40Dqwp+IJTFW6wGUuUnq8ZnWpv/vkPRAM8TvGEsXe7D6FyZ+0 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 Cc: linux-remoteproc@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org 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> Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org 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(-) -- 2.5.0 -- 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/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);