From patchwork Thu Sep 1 22:28:03 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bjorn Andersson X-Patchwork-Id: 75253 Delivered-To: patch@linaro.org Received: by 10.140.29.8 with SMTP id a8csp536910qga; Thu, 1 Sep 2016 15:30:33 -0700 (PDT) X-Received: by 10.98.55.1 with SMTP id e1mr30847656pfa.58.1472769033270; Thu, 01 Sep 2016 15:30:33 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id zj4si7638238pac.95.2016.09.01.15.30.33; Thu, 01 Sep 2016 15:30:33 -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 S1751638AbcIAWab (ORCPT + 8 others); Thu, 1 Sep 2016 18:30:31 -0400 Received: from mail-pa0-f48.google.com ([209.85.220.48]:34278 "EHLO mail-pa0-f48.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752007AbcIAW20 (ORCPT ); Thu, 1 Sep 2016 18:28:26 -0400 Received: by mail-pa0-f48.google.com with SMTP id fi15so33782605pac.1 for ; Thu, 01 Sep 2016 15:28:25 -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=kC6JEb+v4px1xXmbztIzSkEa83GwmdDNfmD+bVPQM6w=; b=ATw48A0odsUVX7P6zmLEDXFs4PLDeqV+fbvFdbyRSdcD9gXbnZL/1H+162Z1LbUz96 hLQQYHsowMnJ4EhOe6FAlpUrx8Aw7lR9sXb5ShrPiSpTkjWw7i2VxD9JbYWtqVWCNC28 zWR5ip8kdN9m87WnBegvqbve7sBiSiaZnq/Uc= 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=kC6JEb+v4px1xXmbztIzSkEa83GwmdDNfmD+bVPQM6w=; b=Z5YyqOdg5s8BqMZJQrln0Z+VRbQL7/1JCHGDhyziBuusrrlsMnWgWKAvl7BDSwLXuV AEe345aUqcnMnYZ7J/6yxEAZO7e5KnFA6BlTTpqZ5gX+ENj1Nb52yoNmkD/fG0TyKuw3 jXmyRYoqdYgFPHd0S6GFge7cUJyJvrUhddpEByLvP95g5TzX+GNowA578rg+LDrpV5NI XvKyM2E6UB/CBhSTOr5g+zz3XdsPkXlUNlen3Bl7ez7aaoDr4fTCHWhthoU4psbK2pGF LFqKWku4plG5+gHhcU+FJvRaS9FA8xgTd9S0Zje/0kFraV0mJgUHd9fv4OM+up1jnqGb 0QGQ== X-Gm-Message-State: AE9vXwPx0cmjaUlykWGpEbpwEiFnYaJHc5ulB/kGO4AsJRzSvLPf9sGHVc2lL0NxyCnR4KPV X-Received: by 10.66.66.233 with SMTP id i9mr30866441pat.45.1472768905393; Thu, 01 Sep 2016 15:28:25 -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 iw10sm8887131pac.14.2016.09.01.15.28.24 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 01 Sep 2016 15:28:24 -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 v2 11/17] rpmsg: Split off generic tail of create_channel() Date: Thu, 1 Sep 2016 15:28:03 -0700 Message-Id: <1472768889-3906-12-git-send-email-bjorn.andersson@linaro.org> X-Mailer: git-send-email 2.5.0 In-Reply-To: <1472768889-3906-1-git-send-email-bjorn.andersson@linaro.org> References: <1472768889-3906-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 The tail of create_channel() is common among all rpmsg backends, so split it off from the virtio specific part to allow it to be extracted to the rpmsg core. Signed-off-by: Bjorn Andersson --- Changes since v1: - None drivers/rpmsg/virtio_rpmsg_bus.c | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 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 488fd93a290c..e1052622c6a2 100644 --- a/drivers/rpmsg/virtio_rpmsg_bus.c +++ b/drivers/rpmsg/virtio_rpmsg_bus.c @@ -120,6 +120,7 @@ static int virtio_rpmsg_trysendto(struct rpmsg_endpoint *ept, void *data, int len, u32 dst); static int virtio_rpmsg_trysend_offchannel(struct rpmsg_endpoint *ept, u32 src, u32 dst, void *data, int len); +static int rpmsg_register_device(struct rpmsg_device *rpdev); /* sysfs show configuration fields */ #define rpmsg_show_attr(field, path, format_string) \ @@ -499,10 +500,22 @@ static struct rpmsg_device *rpmsg_create_channel(struct virtproc_info *vrp, strncpy(rpdev->id.name, chinfo->name, RPMSG_NAME_SIZE); + rpdev->dev.parent = &vrp->vdev->dev; + ret = rpmsg_register_device(rpdev); + if (ret) + return NULL; + + return rpdev; +} + +static int rpmsg_register_device(struct rpmsg_device *rpdev) +{ + struct device *dev = &rpdev->dev; + int ret; + dev_set_name(&rpdev->dev, "%s:%s", dev_name(dev->parent), rpdev->id.name); - rpdev->dev.parent = &vrp->vdev->dev; rpdev->dev.bus = &rpmsg_bus; rpdev->dev.release = rpmsg_release_device; @@ -510,10 +523,9 @@ static struct rpmsg_device *rpmsg_create_channel(struct virtproc_info *vrp, if (ret) { dev_err(dev, "device_register failed: %d\n", ret); put_device(&rpdev->dev); - return NULL; } - return rpdev; + return ret; } /*