Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1495560 > unrolled thread

[PATCH] usb/core: Added devspec sysfs entry for devices behind usb hub

Started byVijay Kumar <vijay.ac.kumar@oracle.com>
First post2016-10-04 21:10 +0200
Last post2016-10-05 21:20 +0200
Articles 3 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] usb/core: Added devspec sysfs entry for devices behind usb hub Vijay Kumar <vijay.ac.kumar@oracle.com> - 2016-10-04 21:10 +0200
    Re: [PATCH] usb/core: Added devspec sysfs entry for devices behind  usb hub Greg KH <gregkh@linuxfoundation.org> - 2016-10-04 21:50 +0200
      Re: [PATCH] usb/core: Added devspec sysfs entry for devices behind  usb hub Vijay Kumar <vijay.ac.kumar@oracle.com> - 2016-10-05 21:20 +0200

#1495560 — [PATCH] usb/core: Added devspec sysfs entry for devices behind usb hub

FromVijay Kumar <vijay.ac.kumar@oracle.com>
Date2016-10-04 21:10 +0200
Subject[PATCH] usb/core: Added devspec sysfs entry for devices behind usb hub
Message-ID<soDgd-6NZ-1@gated-at.bofh.it>
Grub finds incorrect of_node path for devices behind usb hub.
Added devspec sysfs entry for devices behind usb hub so that
right of_node path is returned during grub sysfs walk for these
devices.

Signed-off-by: Vijay Kumar <vijay.ac.kumar@oracle.com>

---
 drivers/usb/core/sysfs.c |   15 +++++++++++++++
 1 files changed, 15 insertions(+), 0 deletions(-)

diff --git a/drivers/usb/core/sysfs.c b/drivers/usb/core/sysfs.c
index c953a0f..84d66d5 100644
--- a/drivers/usb/core/sysfs.c
+++ b/drivers/usb/core/sysfs.c
@@ -14,6 +14,7 @@
 #include <linux/string.h>
 #include <linux/usb.h>
 #include <linux/usb/quirks.h>
+#include <linux/of.h>
 #include "usb.h"
 
 /* Active configuration fields */
@@ -104,6 +105,17 @@ static ssize_t bConfigurationValue_store(struct device *dev,
 static DEVICE_ATTR_IGNORE_LOCKDEP(bConfigurationValue, S_IRUGO | S_IWUSR,
 		bConfigurationValue_show, bConfigurationValue_store);
 
+#ifdef CONFIG_OF
+static ssize_t devspec_show(struct device *dev, struct device_attribute *attr,
+			     char *buf)
+{
+	struct device_node *of_node = dev->of_node;
+
+	return sprintf(buf, "%s\n", of_node_full_name(of_node));
+}
+static DEVICE_ATTR_RO(devspec);
+#endif
+
 /* String fields */
 #define usb_string_attr(name)						\
 static ssize_t  name##_show(struct device *dev,				\
@@ -786,6 +798,9 @@ static struct attribute *dev_attrs[] = {
 	&dev_attr_remove.attr,
 	&dev_attr_removable.attr,
 	&dev_attr_ltm_capable.attr,
+#ifdef CONFIG_OF
+	&dev_attr_devspec.attr,
+#endif
 	NULL,
 };
 static struct attribute_group dev_attr_grp = {
-- 
1.7.1

[toc] | [next] | [standalone]


#1495578 — Re: [PATCH] usb/core: Added devspec sysfs entry for devices behind usb hub

FromGreg KH <gregkh@linuxfoundation.org>
Date2016-10-04 21:50 +0200
SubjectRe: [PATCH] usb/core: Added devspec sysfs entry for devices behind usb hub
Message-ID<soDSW-71V-25@gated-at.bofh.it>
In reply to#1495560
On Tue, Oct 04, 2016 at 12:04:40PM -0700, Vijay Kumar wrote:
> Grub finds incorrect of_node path for devices behind usb hub.
> Added devspec sysfs entry for devices behind usb hub so that
> right of_node path is returned during grub sysfs walk for these
> devices.
> 
> Signed-off-by: Vijay Kumar <vijay.ac.kumar@oracle.com>
> 
> ---
>  drivers/usb/core/sysfs.c |   15 +++++++++++++++
>  1 files changed, 15 insertions(+), 0 deletions(-)
> 
> diff --git a/drivers/usb/core/sysfs.c b/drivers/usb/core/sysfs.c
> index c953a0f..84d66d5 100644
> --- a/drivers/usb/core/sysfs.c
> +++ b/drivers/usb/core/sysfs.c
> @@ -14,6 +14,7 @@
>  #include <linux/string.h>
>  #include <linux/usb.h>
>  #include <linux/usb/quirks.h>
> +#include <linux/of.h>
>  #include "usb.h"
>  
>  /* Active configuration fields */
> @@ -104,6 +105,17 @@ static ssize_t bConfigurationValue_store(struct device *dev,
>  static DEVICE_ATTR_IGNORE_LOCKDEP(bConfigurationValue, S_IRUGO | S_IWUSR,
>  		bConfigurationValue_show, bConfigurationValue_store);
>  
> +#ifdef CONFIG_OF
> +static ssize_t devspec_show(struct device *dev, struct device_attribute *attr,
> +			     char *buf)
> +{
> +	struct device_node *of_node = dev->of_node;
> +
> +	return sprintf(buf, "%s\n", of_node_full_name(of_node));
> +}
> +static DEVICE_ATTR_RO(devspec);
> +#endif

Any way to do this without the #ifdef?

And you need to also update Documentation/ABI if you add a new sysfs
file.

thanks,

greg k-h

[toc] | [prev] | [next] | [standalone]


#1496002 — Re: [PATCH] usb/core: Added devspec sysfs entry for devices behind usb hub

FromVijay Kumar <vijay.ac.kumar@oracle.com>
Date2016-10-05 21:20 +0200
SubjectRe: [PATCH] usb/core: Added devspec sysfs entry for devices behind usb hub
Message-ID<soZTr-5Rt-5@gated-at.bofh.it>
In reply to#1495578
On 10/4/2016 2:49 PM, Greg KH wrote:
> On Tue, Oct 04, 2016 at 12:04:40PM -0700, Vijay Kumar wrote:
>> Grub finds incorrect of_node path for devices behind usb hub.
>> Added devspec sysfs entry for devices behind usb hub so that
>> right of_node path is returned during grub sysfs walk for these
>> devices.
>>
>> Signed-off-by: Vijay Kumar <vijay.ac.kumar@oracle.com>
>>
>> ---
>>   drivers/usb/core/sysfs.c |   15 +++++++++++++++
>>   1 files changed, 15 insertions(+), 0 deletions(-)
>>
>> diff --git a/drivers/usb/core/sysfs.c b/drivers/usb/core/sysfs.c
>> index c953a0f..84d66d5 100644
>> --- a/drivers/usb/core/sysfs.c
>> +++ b/drivers/usb/core/sysfs.c
>> @@ -14,6 +14,7 @@
>>   #include <linux/string.h>
>>   #include <linux/usb.h>
>>   #include <linux/usb/quirks.h>
>> +#include <linux/of.h>
>>   #include "usb.h"
>>   
>>   /* Active configuration fields */
>> @@ -104,6 +105,17 @@ static ssize_t bConfigurationValue_store(struct device *dev,
>>   static DEVICE_ATTR_IGNORE_LOCKDEP(bConfigurationValue, S_IRUGO | S_IWUSR,
>>   		bConfigurationValue_show, bConfigurationValue_store);
>>   
>> +#ifdef CONFIG_OF
>> +static ssize_t devspec_show(struct device *dev, struct device_attribute *attr,
>> +			     char *buf)
>> +{
>> +	struct device_node *of_node = dev->of_node;
>> +
>> +	return sprintf(buf, "%s\n", of_node_full_name(of_node));
>> +}
>> +static DEVICE_ATTR_RO(devspec);
>> +#endif
> Any way to do this without the #ifdef?
Thanks for your comment. I looked into it again and find that grub would
report ofpath incorrectly if CONFIG_OF not defined but devspec sysfs 
file exists.
I see pci-sysfs.c has  also defines devspec in same way.
>
> And you need to also update Documentation/ABI if you add a new sysfs
> file.
>
Sure,  if you agree with my above comment then should I make Document/ABI
changes in a separate patch?

Thanks,
Vijay

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web