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: 9459335 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 253D16074E for ; Fri, 2 Dec 2016 22:06:08 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 163022858E for ; Fri, 2 Dec 2016 22:06:08 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0AE8528599; Fri, 2 Dec 2016 22:06:08 +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=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A137B2858E for ; Fri, 2 Dec 2016 22:06:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756599AbcLBWGH (ORCPT ); Fri, 2 Dec 2016 17:06:07 -0500 Received: from mail-pg0-f51.google.com ([74.125.83.51]:35703 "EHLO mail-pg0-f51.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755230AbcLBWGG (ORCPT ); Fri, 2 Dec 2016 17:06:06 -0500 Received: by mail-pg0-f51.google.com with SMTP id p66so111762826pga.2 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=CMcWcMmmHrFN3g/PqYKiPtZ9nAZixdd109VPK4a9X9ktFedJyJOB+jchQQWmEbxd+8 EmnhXVUnd5W8cTZTwL5jN9WNvXbpLlsbMFByJKaPV2UzSpJkmugz8AxeME3+xxjI/XDU 0SlXIf/PZVw6P+9njnHLHS724gEqUMZ6SFwTnIixcY8B4mB7A0+k2+5sQeRwKomH0XKw y6ASObTfOMg2XIWqAcrpiKaaUccGhExHNT54CwgE4qHo6XvmGobHEgtjOhLylNZLSu0+ FeWVfKaD74bVMyC4v9IlRvF428fZZ9WTwr6gIkqIDJBZfaXl2z63quFAL5rU+NrhTXwq jfFw== X-Gm-Message-State: AKaTC02IMC4QY4Er3vWNHMvi7g6DXQbtwF8V+abOgtNRFmcKZFfnI/PTwCtatRirA9xWnrKF 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-remoteproc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-remoteproc@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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(+) 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) {