linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] rpmsg: qcom_smd: Add support for "label" property
@ 2016-12-02 22:06 Bjorn Andersson
  2016-12-08 12:14 ` Jeremy McNicoll
  0 siblings, 1 reply; 3+ messages in thread
From: Bjorn Andersson @ 2016-12-02 22:06 UTC (permalink / raw)
  To: Ohad Ben-Cohen, Bjorn Andersson
  Cc: linux-remoteproc, linux-kernel, linux-arm-msm

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 <bjorn.andersson@linaro.org>
---

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) {
-- 
2.5.0

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH v2] rpmsg: qcom_smd: Add support for "label" property
  2016-12-02 22:06 [PATCH v2] rpmsg: qcom_smd: Add support for "label" property Bjorn Andersson
@ 2016-12-08 12:14 ` Jeremy McNicoll
  2016-12-08 18:59   ` Bjorn Andersson
  0 siblings, 1 reply; 3+ messages in thread
From: Jeremy McNicoll @ 2016-12-08 12:14 UTC (permalink / raw)
  To: Bjorn Andersson, Ohad Ben-Cohen
  Cc: linux-remoteproc, linux-kernel, linux-arm-msm

On 2016-12-02 2:06 PM, Bjorn Andersson wrote:
> 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 <bjorn.andersson@linaro.org>
> ---
>
> Changes since v1:
> - Moved sysfs attribute to the correct (this) patch
>
>  drivers/rpmsg/qcom_smd.c | 22 ++++++++++++++++++++++
>  1 file changed, 22 insertions(+)
>

Could you please add something to Documentation/devicetree/bindings/
showing this "label" property.

Or add a "label" to an existing DTS so people/implementors  have a 
reference if they so choose to use this property.

Thanks.

-jeremy

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH v2] rpmsg: qcom_smd: Add support for "label" property
  2016-12-08 12:14 ` Jeremy McNicoll
@ 2016-12-08 18:59   ` Bjorn Andersson
  0 siblings, 0 replies; 3+ messages in thread
From: Bjorn Andersson @ 2016-12-08 18:59 UTC (permalink / raw)
  To: Jeremy McNicoll
  Cc: Ohad Ben-Cohen, linux-remoteproc, linux-kernel, linux-arm-msm

On Thu 08 Dec 04:14 PST 2016, Jeremy McNicoll wrote:

> On 2016-12-02 2:06 PM, Bjorn Andersson wrote:
> >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 <bjorn.andersson@linaro.org>
> >---
> >
> >Changes since v1:
> >- Moved sysfs attribute to the correct (this) patch
> >
> > drivers/rpmsg/qcom_smd.c | 22 ++++++++++++++++++++++
> > 1 file changed, 22 insertions(+)
> >
> 
> Could you please add something to Documentation/devicetree/bindings/
> showing this "label" property.
> 
> Or add a "label" to an existing DTS so people/implementors  have a reference
> if they so choose to use this property.
> 

The DT binding update was already in flight and has been Acked by Rob
and Andy. I just didn't get the implementation out until now.

You can find it here:
https://patchwork.kernel.org/patch/9385753/

Thanks for having a look.

Regards,
Bjorn

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-12-08 18:59 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-12-02 22:06 [PATCH v2] rpmsg: qcom_smd: Add support for "label" property Bjorn Andersson
2016-12-08 12:14 ` Jeremy McNicoll
2016-12-08 18:59   ` Bjorn Andersson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).