From patchwork Wed Jan 11 14:35:13 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bjorn Andersson X-Patchwork-Id: 91004 Delivered-To: patch@linaro.org Received: by 10.140.20.99 with SMTP id 90csp1348346qgi; Wed, 11 Jan 2017 14:35:05 -0800 (PST) X-Received: by 10.84.175.3 with SMTP id s3mr16427720plb.66.1484174105259; Wed, 11 Jan 2017 14:35:05 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w2si7074154pfg.122.2017.01.11.14.35.04; Wed, 11 Jan 2017 14:35:05 -0800 (PST) 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 sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S935416AbdAKWeu (ORCPT + 9 others); Wed, 11 Jan 2017 17:34:50 -0500 Received: from mail-pf0-f172.google.com ([209.85.192.172]:36763 "EHLO mail-pf0-f172.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1758061AbdAKWen (ORCPT ); Wed, 11 Jan 2017 17:34:43 -0500 Received: by mail-pf0-f172.google.com with SMTP id 189so1014709pfu.3 for ; Wed, 11 Jan 2017 14:34:43 -0800 (PST) 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=KlHKX6ry2YUWQb6UB6hzMYEpuEeslsaXBdpSKhc10gE=; b=YPqnil9muPh2iDq1j3UgYllkaIxM3GTRGLg0E/xDlVr/tDm871Q6CDGoblvFuCFX2M cCkofo29fSeQl0tsPh1XR4Wg48QHprJI3rZ6aW1jEOb0ViIHgB9Q0vVB+SP9LJOF6/QP NG5FzTuxGpkZSDk1jSlxISYZgQWcg+WkaUWsc= 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=KlHKX6ry2YUWQb6UB6hzMYEpuEeslsaXBdpSKhc10gE=; b=Lz7mVq4Kq9b4mNirIODvVuMRZMEV+3YaUV3LyNstqajtrtg+92jX7mdRpk8sPGco0J Q5FCmPn1tEIEw9nNG8vDn12qwPbPz75BQemHieOMNEbF7xO4Ey0b8dvMSYnijijr83pn n/mIaPoQGUtmFgL8Q4162eFAHs9vatMtlzIkiPju4Alz5Rp5QVnKikIg3Jp4DcMEdFON ocbcUMpS0ZG72eRmLvaURVxQ/MbmL62XsFlOMtLXViGUvSse/vKDaTIt01lHIjhYaxLY MPQBIF8sQHDOPu5OkTo7BKGW2xREaWrpOrluAiaao7U5VkupPrBN0VgNXbRnochFizxl SPJA== X-Gm-Message-State: AIkVDXIlZtaWDTcb4osQli4bmOzpW1yD/bV+bi7/NMY6GlHRMUX2fl4aOTTbaVDOAG1hhZuA X-Received: by 10.98.117.10 with SMTP id q10mr10187753pfc.31.1484174082810; Wed, 11 Jan 2017 14:34:42 -0800 (PST) Received: from localhost.localdomain (ip68-111-223-48.sd.sd.cox.net. [68.111.223.48]) by smtp.gmail.com with ESMTPSA id o89sm16128591pfi.26.2017.01.11.14.34.40 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 11 Jan 2017 14:34:41 -0800 (PST) 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 v3 4/4] rpmsg: smd: Register rpmsg user space interface for edges Date: Wed, 11 Jan 2017 06:35:13 -0800 Message-Id: <20170111143513.32251-4-bjorn.andersson@linaro.org> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170111143513.32251-1-bjorn.andersson@linaro.org> References: <20170111143513.32251-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 Create and register a rpmsg device for use with the rpmsg user space interface, allowing user space to access SMD channels. Also provide the "rpmsg_name" device attribute to expose the edge name in sysfs, allowing the user to write udev rules for specific rpmsg devices and their children. Signed-off-by: Bjorn Andersson --- Changes since v2: - None Changes since v1: - Moved rpmsg_name attribute to different patch drivers/rpmsg/qcom_smd.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) -- 2.11.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/qcom_smd.c b/drivers/rpmsg/qcom_smd.c index 9e2af6a18aa2..beaef5dd973e 100644 --- a/drivers/rpmsg/qcom_smd.c +++ b/drivers/rpmsg/qcom_smd.c @@ -1002,6 +1002,20 @@ static int qcom_smd_create_device(struct qcom_smd_channel *channel) return rpmsg_register_device(rpdev); } +static int qcom_smd_create_chrdev(struct qcom_smd_edge *edge) +{ + struct qcom_smd_device *qsdev; + + qsdev = kzalloc(sizeof(*qsdev), GFP_KERNEL); + if (!qsdev) + return -ENOMEM; + + qsdev->edge = edge; + qsdev->rpdev.ops = &qcom_smd_device_ops; + qsdev->rpdev.dev.parent = &edge->dev; + return rpmsg_chrdev_register_device(&qsdev->rpdev); +} + /* * Allocate the qcom_smd_channel object for a newly found smd channel, * retrieving and validating the smem items involved. @@ -1357,6 +1371,12 @@ struct qcom_smd_edge *qcom_smd_register_edge(struct device *parent, goto unregister_dev; } + ret = qcom_smd_create_chrdev(edge); + if (ret) { + dev_err(&edge->dev, "failed to register chrdev for edge\n"); + goto unregister_dev; + } + schedule_work(&edge->scan_work); return edge;