From patchwork Fri Dec 2 22:06:02 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bjorn Andersson X-Patchwork-Id: 86378 Delivered-To: patch@linaro.org Received: by 10.140.20.101 with SMTP id 92csp464933qgi; Fri, 2 Dec 2016 14:06:11 -0800 (PST) X-Received: by 10.84.216.24 with SMTP id m24mr29094723pli.26.1480716371304; Fri, 02 Dec 2016 14:06:11 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q126si6587886pga.158.2016.12.02.14.06.11; Fri, 02 Dec 2016 14:06:11 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755226AbcLBWGI (ORCPT + 25 others); Fri, 2 Dec 2016 17:06:08 -0500 Received: from mail-pg0-f48.google.com ([74.125.83.48]:33042 "EHLO mail-pg0-f48.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754378AbcLBWGG (ORCPT ); Fri, 2 Dec 2016 17:06:06 -0500 Received: by mail-pg0-f48.google.com with SMTP id 3so111765115pgd.0 for ; Fri, 02 Dec 2016 14:06:06 -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; bh=1VhLXygTO37YlBsadQv0xD+MR9ZSyKmAu4qIYvAMcSY=; b=bGHfElL7+vRvp8ieMgE0EVXkncsfkxZn33dlvQbRTpmsS2sqfb5Ddz/RlsmxdI3nzE g0ImP9wtS/zSUuNZ16/bx63YtKDh7PM8v5vXgK7VYfGbn6nuuZWEBCTCz+3G6QnPVcYp j8w11DLMgwwRzyTsvnPUzfEAbdM3BCkaP6Zjc= 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; bh=1VhLXygTO37YlBsadQv0xD+MR9ZSyKmAu4qIYvAMcSY=; b=jYBPAZy92lJgmvXFcgVJXnGDvD5/jrumSdOsk8rS5zH6W3o+T+PCNsAI0PAFmeDBdP K0vsgzz8HxpLX36FgJDw/cTiBG/rLG76lofsZL+CZbvruLdL73BRd7+xjXT8AEnE06mg rESz3EB7QAsIIFo63oraHo7ysOtDONJd0co04miG8JxI7MA+nnhrtaN72jpr9H5ZlDXS OcG0ppfL1xUAS/dcDtXeSvXr6RFnTuxADvNWGjgld8EPyxIo5E4DlHmEPbB9xt4x3V1L uyQmDHoy6RHfH0XC3ZSrX/5puGkIwVu3EV1EsaamBgPjUyHfcxlEqGU+qem+I1uSM8td a2Gw== X-Gm-Message-State: AKaTC01qKXZ4EHIFQ2uDS28oFAzFnZSMaArDSkP5LG4HJhF0ytyGCHIHwLdM7E8kRprJ5/r5 X-Received: by 10.98.147.93 with SMTP id b90mr46240133pfe.170.1480716365549; Fri, 02 Dec 2016 14:06:05 -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 x90sm9887674pfk.73.2016.12.02.14.06.03 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 02 Dec 2016 14:06:04 -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 v2] rpmsg: qcom_smd: Add support for "label" property Date: Fri, 2 Dec 2016 14:06:02 -0800 Message-Id: <1480716362-23467-1-git-send-email-bjorn.andersson@linaro.org> X-Mailer: git-send-email 2.5.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Add support for the "label" property, used to give the edge a name other than the one of the DT node. This allows the implementor to provide consistently named edges when using the rpmsg character device. Signed-off-by: Bjorn Andersson --- Changes since v1: - Moved sysfs attribute to the correct (this) patch drivers/rpmsg/qcom_smd.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) -- 2.5.0 diff --git a/drivers/rpmsg/qcom_smd.c b/drivers/rpmsg/qcom_smd.c index 1b1f18373d89..3b77320fb8c9 100644 --- a/drivers/rpmsg/qcom_smd.c +++ b/drivers/rpmsg/qcom_smd.c @@ -117,6 +117,8 @@ static const struct { struct qcom_smd_edge { struct device dev; + const char *name; + struct device_node *of_node; unsigned edge_id; unsigned remote_pid; @@ -1248,6 +1250,10 @@ static int qcom_smd_parse_edge(struct device *dev, return -EINVAL; } + ret = of_property_read_string(node, "label", &edge->name); + if (ret < 0) + edge->name = node->name; + irq = irq_of_parse_and_map(node, 0); if (irq < 0) { dev_err(dev, "required smd interrupt missing\n"); @@ -1285,6 +1291,21 @@ static void qcom_smd_edge_release(struct device *dev) kfree(edge); } +static ssize_t rpmsg_name_show(struct device *dev, + struct device_attribute *attr, char *buf) +{ + struct qcom_smd_edge *edge = to_smd_edge(dev); + + return sprintf(buf, "%s\n", edge->name); +} +static DEVICE_ATTR_RO(rpmsg_name); + +static struct attribute *qcom_smd_edge_attrs[] = { + &dev_attr_rpmsg_name.attr, + NULL +}; +ATTRIBUTE_GROUPS(qcom_smd_edge); + /** * qcom_smd_register_edge() - register an edge based on an device_node * @parent: parent device for the edge @@ -1306,6 +1327,7 @@ struct qcom_smd_edge *qcom_smd_register_edge(struct device *parent, edge->dev.parent = parent; edge->dev.release = qcom_smd_edge_release; + edge->dev.groups = qcom_smd_edge_groups; dev_set_name(&edge->dev, "%s:%s", dev_name(parent), node->name); ret = device_register(&edge->dev); if (ret) {