Re: [PATCH] sysfs, device-tree: aid for debugging device tree boot problems

2014-04-28 Thread Grant Likely
On Wed, Apr 23, 2014 at 11:48 PM, Frank Rowand  wrote:
> On 4/23/2014 4:54 AM, Grant Likely wrote:
>> On Tue, 22 Apr 2014 20:20:44 -0700, Greg Kroah-Hartman 
>>  wrote:
>>> On Tue, Apr 22, 2014 at 06:25:25PM -0700, Frank Rowand wrote:
 Create some infrastructure to aid trouble shooting device tree related
 boot issues.

 Add a %driver_name file to each device tree node sysfs directory which has 
 had
 a driver bound to it.  This allows detecting device tree nodes which failed
 to be bound to any driver.
>>>
>>> Why is this needed, shouldn't there already be a "driver" symlink in
>>> sysfs for these devices when a driver binds to them?  The rest of the
>>> driver model works that way, why is of devices any different?
>>>
>>
>> Because it hasn't been added yet! I only just committed the change to
>> convert device_nodes into kobjects in v3.14. The next step is to add
>> driver symlinks.
>
> No need to add a "driver" symlink.  The device directories in sysfs already
> have a driver symlink.

Sorry, I meant of_node symlink. That is the bit I've been planning to add.

g.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] sysfs, device-tree: aid for debugging device tree boot problems

2014-04-28 Thread Grant Likely
On Wed, Apr 23, 2014 at 11:48 PM, Frank Rowand frowand.l...@gmail.com wrote:
 On 4/23/2014 4:54 AM, Grant Likely wrote:
 On Tue, 22 Apr 2014 20:20:44 -0700, Greg Kroah-Hartman 
 gre...@linuxfoundation.org wrote:
 On Tue, Apr 22, 2014 at 06:25:25PM -0700, Frank Rowand wrote:
 Create some infrastructure to aid trouble shooting device tree related
 boot issues.

 Add a %driver_name file to each device tree node sysfs directory which has 
 had
 a driver bound to it.  This allows detecting device tree nodes which failed
 to be bound to any driver.

 Why is this needed, shouldn't there already be a driver symlink in
 sysfs for these devices when a driver binds to them?  The rest of the
 driver model works that way, why is of devices any different?


 Because it hasn't been added yet! I only just committed the change to
 convert device_nodes into kobjects in v3.14. The next step is to add
 driver symlinks.

 No need to add a driver symlink.  The device directories in sysfs already
 have a driver symlink.

Sorry, I meant of_node symlink. That is the bit I've been planning to add.

g.
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] sysfs, device-tree: aid for debugging device tree boot problems

2014-04-23 Thread Greg Kroah-Hartman
On Wed, Apr 23, 2014 at 03:45:11PM -0700, Frank Rowand wrote:
> >>   3) To find list of device tree nodes with a bound driver:
> >>
> >>   # output is:  driver_name node_full_path
> >>   #
> >>   cd /proc/device-tree
> >>   for k in `find . -name %driver_name` ; do
> >>  echo `cat ${k}` `echo ${k} | sed -e 's|./||' -e 's|/%driver_name$||'`
> >>   done | sort
> > 
> > If we take this patch, these examples should be somewhere in the
> > documentation to make it easy for others.
> 
> That is a good idea.  I'll package up the equivalent shell code from
> Grant's email.  Any suggestions on location?
> 
>   scripts/debug/devicetree/
>   scripts/devicetree/debug/
>   Documentation/devicetree/scripts/

tools/ is probably the best place for them, or in Documentation/, either
would work.

thanks,

greg k-h
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] sysfs, device-tree: aid for debugging device tree boot problems

2014-04-23 Thread Frank Rowand
On 4/23/2014 4:54 AM, Grant Likely wrote:
> On Tue, 22 Apr 2014 20:20:44 -0700, Greg Kroah-Hartman 
>  wrote:
>> On Tue, Apr 22, 2014 at 06:25:25PM -0700, Frank Rowand wrote:
>>> Create some infrastructure to aid trouble shooting device tree related
>>> boot issues.
>>>
>>> Add a %driver_name file to each device tree node sysfs directory which has 
>>> had
>>> a driver bound to it.  This allows detecting device tree nodes which failed
>>> to be bound to any driver.
>>
>> Why is this needed, shouldn't there already be a "driver" symlink in
>> sysfs for these devices when a driver binds to them?  The rest of the
>> driver model works that way, why is of devices any different?
>>
> 
> Because it hasn't been added yet! I only just committed the change to
> convert device_nodes into kobjects in v3.14. The next step is to add
> driver symlinks.

No need to add a "driver" symlink.  The device directories in sysfs already
have a driver symlink.

> 
> That said, the devicetree node is already exposed in the uevent for a
> device. It should already be possible to find all device tree nodes that
> don't have a device, or devices without a driver:
> 
> To get a list of all nodes:
> 
> find /proc/device-tree/ -type d | sed -e 's/\/proc\/device-tree//'
> 
> or a little more nuanced, only choosing nodes with a compatible property:
> 
> for k in `find /proc/device-tree/ -name compatible`; do
>   echo $(dirname $k) | sed -e 's/\/proc\/device-tree//'
> done | sort
> 
> It can get even more refined than that if need be.
> 
> To get a list of all nodes with a device that has been created:
> 
> for k in `find devices -name uevent`; do
>   grep '^OF_FULLNAME' $k | sed -e 's/OF_FULLNAME=//'
> done | sort

< snip >

Thanks Grant!  I did not realize that uevent contained that
information.

-Frank

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] sysfs, device-tree: aid for debugging device tree boot problems

2014-04-23 Thread Frank Rowand
On 4/22/2014 8:20 PM, Greg Kroah-Hartman wrote:
> On Tue, Apr 22, 2014 at 06:25:25PM -0700, Frank Rowand wrote:
>> Create some infrastructure to aid trouble shooting device tree related
>> boot issues.
>>
>> Add a %driver_name file to each device tree node sysfs directory which has 
>> had
>> a driver bound to it.  This allows detecting device tree nodes which failed
>> to be bound to any driver.
> 
> Why is this needed, shouldn't there already be a "driver" symlink in
> sysfs for these devices when a driver binds to them?  The rest of the
> driver model works that way, why is of devices any different?

Yes, the devices do have a "driver" symlink in sysfs.

The problem I had was that I could not deterministically determine the
device name in /sysfs that was associated with a device tree node that
the device was created for.  And I couldn't find a link from the device
tree entries to the device tree node.

Grant's reply to your email provided the solution to my problem; the
device uevents file contains the full device tree path of the associated
device tree node.

Grant's reply removes the need for my patch.

> 
>> Examples of using the %driver_name file (note that /proc/device-tree is a
>> link to the base of the device tree sysfs tree):
>>
>>
>>   1) To find list of device tree nodes with no driver:
>>
>>   # A few false positives may be reported.  For example,
>>   #   node_full_path of "." is the board.
>>   #
>>   # output is: node_full_path compatible_string
>>   #
>>   cd /proc/device-tree
>>   for k in `find . -type d`; do
>>  if [[ -f ${k}/compatible && ! -f ${k}/%driver_name ]] ; then
>> if [[ "`cat ${k}/compatible`" != "simple-bus" ]] ; then
>>echo `echo ${k} | sed -e 's|./||'` `cat ${k}/compatible`
>> fi
>>  fi
>>   done | sort
>>
>>
>>   2) To find list of device tree nodes with a bound driver:
>>
>>   # output is:  node_full_path driver_name
>>   #
>>   cd /proc/device-tree
>>   for k in `find . -name %driver_name` ; do
>>  echo `echo ${k} | sed -e 's|./||' -e 's|/%driver_name$||'` `cat ${k}`
>>   done | sort
>>
>>
>>   3) To find list of device tree nodes with a bound driver:
>>
>>   # output is:  driver_name node_full_path
>>   #
>>   cd /proc/device-tree
>>   for k in `find . -name %driver_name` ; do
>>  echo `cat ${k}` `echo ${k} | sed -e 's|./||' -e 's|/%driver_name$||'`
>>   done | sort
> 
> If we take this patch, these examples should be somewhere in the
> documentation to make it easy for others.

That is a good idea.  I'll package up the equivalent shell code from
Grant's email.  Any suggestions on location?

  scripts/debug/devicetree/
  scripts/devicetree/debug/
  Documentation/devicetree/scripts/

If there is no good location in the kernel tree, then I will put them
either on the devicetree wiki, or the devicetree section of the
elinux wiki.

> 
>> Signed-off-by: Frank Rowand 
> 
> Minor nit, your From: line doesn't match this signed-off-by: so
> something has to change (or add a new From: line, like SubmittingPatches
> decribes how to do.)

Oops, thanks for pointing that out.

> 
> thanks,
> 
> greg k-h

-Frank

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] sysfs, device-tree: aid for debugging device tree boot problems

2014-04-23 Thread Grant Likely
On Tue, 22 Apr 2014 20:20:44 -0700, Greg Kroah-Hartman 
 wrote:
> On Tue, Apr 22, 2014 at 06:25:25PM -0700, Frank Rowand wrote:
> > Create some infrastructure to aid trouble shooting device tree related
> > boot issues.
> > 
> > Add a %driver_name file to each device tree node sysfs directory which has 
> > had
> > a driver bound to it.  This allows detecting device tree nodes which failed
> > to be bound to any driver.
> 
> Why is this needed, shouldn't there already be a "driver" symlink in
> sysfs for these devices when a driver binds to them?  The rest of the
> driver model works that way, why is of devices any different?
> 

Because it hasn't been added yet! I only just committed the change to
convert device_nodes into kobjects in v3.14. The next step is to add
driver symlinks.

That said, the devicetree node is already exposed in the uevent for a
device. It should already be possible to find all device tree nodes that
don't have a device, or devices without a driver:

To get a list of all nodes:

find /proc/device-tree/ -type d | sed -e 's/\/proc\/device-tree//'

or a little more nuanced, only choosing nodes with a compatible property:

for k in `find /proc/device-tree/ -name compatible`; do
echo $(dirname $k) | sed -e 's/\/proc\/device-tree//'
done | sort

It can get even more refined than that if need be.

To get a list of all nodes with a device that has been created:

for k in `find devices -name uevent`; do
grep '^OF_FULLNAME' $k | sed -e 's/OF_FULLNAME=//'
done | sort

To get a list of all nodes with a device that has been bound to a driver:

for k in `find devices -name uevent`; do
if [[ -d $(dirname $k)/driver ]]; then
grep '^OF_FULLNAME' $k | sed -e 's/OF_FULLNAME=//'
fi
done | sort


The suggestions you have below would be the anything in the first list
that isn't in the second or third:

bound=$(for k in `find /sys/devices -name uevent`; do
if [[ -d $(dirname $k)/driver ]]; then
grep '^OF_FULLNAME' $k | sed -e 's/OF_FULLNAME=//'
fi
done)

nodes=$(for k in `find /proc/device-tree/ -name compatible`; do
echo $(dirname $k) | sed -e 's/\/proc\/device-tree//'
done | sort)

for n in $nodes; do
if ! echo $bound | grep -q "$n"; then
echo $n $(cat /proc/device-tree/$n/compatible)
fi
done



> > Examples of using the %driver_name file (note that /proc/device-tree is a
> > link to the base of the device tree sysfs tree):
> > 
> > 
> >   1) To find list of device tree nodes with no driver:
> > 
> >   # A few false positives may be reported.  For example,
> >   #   node_full_path of "." is the board.
> >   #
> >   # output is: node_full_path compatible_string
> >   #
> >   cd /proc/device-tree
> >   for k in `find . -type d`; do
> >  if [[ -f ${k}/compatible && ! -f ${k}/%driver_name ]] ; then
> > if [[ "`cat ${k}/compatible`" != "simple-bus" ]] ; then
> >echo `echo ${k} | sed -e 's|./||'` `cat ${k}/compatible`
> > fi
> >  fi
> >   done | sort
> > 
> > 
> >   2) To find list of device tree nodes with a bound driver:
> > 
> >   # output is:  node_full_path driver_name
> >   #
> >   cd /proc/device-tree
> >   for k in `find . -name %driver_name` ; do
> >  echo `echo ${k} | sed -e 's|./||' -e 's|/%driver_name$||'` `cat ${k}`
> >   done | sort
> > 
> > 
> >   3) To find list of device tree nodes with a bound driver:
> > 
> >   # output is:  driver_name node_full_path
> >   #
> >   cd /proc/device-tree
> >   for k in `find . -name %driver_name` ; do
> >  echo `cat ${k}` `echo ${k} | sed -e 's|./||' -e 's|/%driver_name$||'`
> >   done | sort
> 
> If we take this patch, these examples should be somewhere in the
> documentation to make it easy for others.
> 
> > Signed-off-by: Frank Rowand 
> 
> Minor nit, your From: line doesn't match this signed-off-by: so
> something has to change (or add a new From: line, like SubmittingPatches
> decribes how to do.)
> 
> thanks,
> 
> greg k-h

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] sysfs, device-tree: aid for debugging device tree boot problems

2014-04-23 Thread Frank Rowand
On 4/22/2014 8:20 PM, Greg Kroah-Hartman wrote:
 On Tue, Apr 22, 2014 at 06:25:25PM -0700, Frank Rowand wrote:
 Create some infrastructure to aid trouble shooting device tree related
 boot issues.

 Add a %driver_name file to each device tree node sysfs directory which has 
 had
 a driver bound to it.  This allows detecting device tree nodes which failed
 to be bound to any driver.
 
 Why is this needed, shouldn't there already be a driver symlink in
 sysfs for these devices when a driver binds to them?  The rest of the
 driver model works that way, why is of devices any different?

Yes, the devices do have a driver symlink in sysfs.

The problem I had was that I could not deterministically determine the
device name in /sysfs that was associated with a device tree node that
the device was created for.  And I couldn't find a link from the device
tree entries to the device tree node.

Grant's reply to your email provided the solution to my problem; the
device uevents file contains the full device tree path of the associated
device tree node.

Grant's reply removes the need for my patch.

 
 Examples of using the %driver_name file (note that /proc/device-tree is a
 link to the base of the device tree sysfs tree):


   1) To find list of device tree nodes with no driver:

   # A few false positives may be reported.  For example,
   #   node_full_path of . is the board.
   #
   # output is: node_full_path compatible_string
   #
   cd /proc/device-tree
   for k in `find . -type d`; do
  if [[ -f ${k}/compatible  ! -f ${k}/%driver_name ]] ; then
 if [[ `cat ${k}/compatible` != simple-bus ]] ; then
echo `echo ${k} | sed -e 's|./||'` `cat ${k}/compatible`
 fi
  fi
   done | sort


   2) To find list of device tree nodes with a bound driver:

   # output is:  node_full_path driver_name
   #
   cd /proc/device-tree
   for k in `find . -name %driver_name` ; do
  echo `echo ${k} | sed -e 's|./||' -e 's|/%driver_name$||'` `cat ${k}`
   done | sort


   3) To find list of device tree nodes with a bound driver:

   # output is:  driver_name node_full_path
   #
   cd /proc/device-tree
   for k in `find . -name %driver_name` ; do
  echo `cat ${k}` `echo ${k} | sed -e 's|./||' -e 's|/%driver_name$||'`
   done | sort
 
 If we take this patch, these examples should be somewhere in the
 documentation to make it easy for others.

That is a good idea.  I'll package up the equivalent shell code from
Grant's email.  Any suggestions on location?

  scripts/debug/devicetree/
  scripts/devicetree/debug/
  Documentation/devicetree/scripts/

If there is no good location in the kernel tree, then I will put them
either on the devicetree wiki, or the devicetree section of the
elinux wiki.

 
 Signed-off-by: Frank Rowand frank.row...@sonymobile.com
 
 Minor nit, your From: line doesn't match this signed-off-by: so
 something has to change (or add a new From: line, like SubmittingPatches
 decribes how to do.)

Oops, thanks for pointing that out.

 
 thanks,
 
 greg k-h

-Frank

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] sysfs, device-tree: aid for debugging device tree boot problems

2014-04-23 Thread Frank Rowand
On 4/23/2014 4:54 AM, Grant Likely wrote:
 On Tue, 22 Apr 2014 20:20:44 -0700, Greg Kroah-Hartman 
 gre...@linuxfoundation.org wrote:
 On Tue, Apr 22, 2014 at 06:25:25PM -0700, Frank Rowand wrote:
 Create some infrastructure to aid trouble shooting device tree related
 boot issues.

 Add a %driver_name file to each device tree node sysfs directory which has 
 had
 a driver bound to it.  This allows detecting device tree nodes which failed
 to be bound to any driver.

 Why is this needed, shouldn't there already be a driver symlink in
 sysfs for these devices when a driver binds to them?  The rest of the
 driver model works that way, why is of devices any different?

 
 Because it hasn't been added yet! I only just committed the change to
 convert device_nodes into kobjects in v3.14. The next step is to add
 driver symlinks.

No need to add a driver symlink.  The device directories in sysfs already
have a driver symlink.

 
 That said, the devicetree node is already exposed in the uevent for a
 device. It should already be possible to find all device tree nodes that
 don't have a device, or devices without a driver:
 
 To get a list of all nodes:
 
 find /proc/device-tree/ -type d | sed -e 's/\/proc\/device-tree//'
 
 or a little more nuanced, only choosing nodes with a compatible property:
 
 for k in `find /proc/device-tree/ -name compatible`; do
   echo $(dirname $k) | sed -e 's/\/proc\/device-tree//'
 done | sort
 
 It can get even more refined than that if need be.
 
 To get a list of all nodes with a device that has been created:
 
 for k in `find devices -name uevent`; do
   grep '^OF_FULLNAME' $k | sed -e 's/OF_FULLNAME=//'
 done | sort

 snip 

Thanks Grant!  I did not realize that uevent contained that
information.

-Frank

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] sysfs, device-tree: aid for debugging device tree boot problems

2014-04-23 Thread Greg Kroah-Hartman
On Wed, Apr 23, 2014 at 03:45:11PM -0700, Frank Rowand wrote:
3) To find list of device tree nodes with a bound driver:
 
# output is:  driver_name node_full_path
#
cd /proc/device-tree
for k in `find . -name %driver_name` ; do
   echo `cat ${k}` `echo ${k} | sed -e 's|./||' -e 's|/%driver_name$||'`
done | sort
  
  If we take this patch, these examples should be somewhere in the
  documentation to make it easy for others.
 
 That is a good idea.  I'll package up the equivalent shell code from
 Grant's email.  Any suggestions on location?
 
   scripts/debug/devicetree/
   scripts/devicetree/debug/
   Documentation/devicetree/scripts/

tools/ is probably the best place for them, or in Documentation/, either
would work.

thanks,

greg k-h
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] sysfs, device-tree: aid for debugging device tree boot problems

2014-04-23 Thread Grant Likely
On Tue, 22 Apr 2014 20:20:44 -0700, Greg Kroah-Hartman 
gre...@linuxfoundation.org wrote:
 On Tue, Apr 22, 2014 at 06:25:25PM -0700, Frank Rowand wrote:
  Create some infrastructure to aid trouble shooting device tree related
  boot issues.
  
  Add a %driver_name file to each device tree node sysfs directory which has 
  had
  a driver bound to it.  This allows detecting device tree nodes which failed
  to be bound to any driver.
 
 Why is this needed, shouldn't there already be a driver symlink in
 sysfs for these devices when a driver binds to them?  The rest of the
 driver model works that way, why is of devices any different?
 

Because it hasn't been added yet! I only just committed the change to
convert device_nodes into kobjects in v3.14. The next step is to add
driver symlinks.

That said, the devicetree node is already exposed in the uevent for a
device. It should already be possible to find all device tree nodes that
don't have a device, or devices without a driver:

To get a list of all nodes:

find /proc/device-tree/ -type d | sed -e 's/\/proc\/device-tree//'

or a little more nuanced, only choosing nodes with a compatible property:

for k in `find /proc/device-tree/ -name compatible`; do
echo $(dirname $k) | sed -e 's/\/proc\/device-tree//'
done | sort

It can get even more refined than that if need be.

To get a list of all nodes with a device that has been created:

for k in `find devices -name uevent`; do
grep '^OF_FULLNAME' $k | sed -e 's/OF_FULLNAME=//'
done | sort

To get a list of all nodes with a device that has been bound to a driver:

for k in `find devices -name uevent`; do
if [[ -d $(dirname $k)/driver ]]; then
grep '^OF_FULLNAME' $k | sed -e 's/OF_FULLNAME=//'
fi
done | sort


The suggestions you have below would be the anything in the first list
that isn't in the second or third:

bound=$(for k in `find /sys/devices -name uevent`; do
if [[ -d $(dirname $k)/driver ]]; then
grep '^OF_FULLNAME' $k | sed -e 's/OF_FULLNAME=//'
fi
done)

nodes=$(for k in `find /proc/device-tree/ -name compatible`; do
echo $(dirname $k) | sed -e 's/\/proc\/device-tree//'
done | sort)

for n in $nodes; do
if ! echo $bound | grep -q $n; then
echo $n $(cat /proc/device-tree/$n/compatible)
fi
done



  Examples of using the %driver_name file (note that /proc/device-tree is a
  link to the base of the device tree sysfs tree):
  
  
1) To find list of device tree nodes with no driver:
  
# A few false positives may be reported.  For example,
#   node_full_path of . is the board.
#
# output is: node_full_path compatible_string
#
cd /proc/device-tree
for k in `find . -type d`; do
   if [[ -f ${k}/compatible  ! -f ${k}/%driver_name ]] ; then
  if [[ `cat ${k}/compatible` != simple-bus ]] ; then
 echo `echo ${k} | sed -e 's|./||'` `cat ${k}/compatible`
  fi
   fi
done | sort
  
  
2) To find list of device tree nodes with a bound driver:
  
# output is:  node_full_path driver_name
#
cd /proc/device-tree
for k in `find . -name %driver_name` ; do
   echo `echo ${k} | sed -e 's|./||' -e 's|/%driver_name$||'` `cat ${k}`
done | sort
  
  
3) To find list of device tree nodes with a bound driver:
  
# output is:  driver_name node_full_path
#
cd /proc/device-tree
for k in `find . -name %driver_name` ; do
   echo `cat ${k}` `echo ${k} | sed -e 's|./||' -e 's|/%driver_name$||'`
done | sort
 
 If we take this patch, these examples should be somewhere in the
 documentation to make it easy for others.
 
  Signed-off-by: Frank Rowand frank.row...@sonymobile.com
 
 Minor nit, your From: line doesn't match this signed-off-by: so
 something has to change (or add a new From: line, like SubmittingPatches
 decribes how to do.)
 
 thanks,
 
 greg k-h

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] sysfs, device-tree: aid for debugging device tree boot problems

2014-04-22 Thread Greg Kroah-Hartman
On Tue, Apr 22, 2014 at 06:25:25PM -0700, Frank Rowand wrote:
> Create some infrastructure to aid trouble shooting device tree related
> boot issues.
> 
> Add a %driver_name file to each device tree node sysfs directory which has had
> a driver bound to it.  This allows detecting device tree nodes which failed
> to be bound to any driver.

Why is this needed, shouldn't there already be a "driver" symlink in
sysfs for these devices when a driver binds to them?  The rest of the
driver model works that way, why is of devices any different?

> Examples of using the %driver_name file (note that /proc/device-tree is a
> link to the base of the device tree sysfs tree):
> 
> 
>   1) To find list of device tree nodes with no driver:
> 
>   # A few false positives may be reported.  For example,
>   #   node_full_path of "." is the board.
>   #
>   # output is: node_full_path compatible_string
>   #
>   cd /proc/device-tree
>   for k in `find . -type d`; do
>  if [[ -f ${k}/compatible && ! -f ${k}/%driver_name ]] ; then
> if [[ "`cat ${k}/compatible`" != "simple-bus" ]] ; then
>echo `echo ${k} | sed -e 's|./||'` `cat ${k}/compatible`
> fi
>  fi
>   done | sort
> 
> 
>   2) To find list of device tree nodes with a bound driver:
> 
>   # output is:  node_full_path driver_name
>   #
>   cd /proc/device-tree
>   for k in `find . -name %driver_name` ; do
>  echo `echo ${k} | sed -e 's|./||' -e 's|/%driver_name$||'` `cat ${k}`
>   done | sort
> 
> 
>   3) To find list of device tree nodes with a bound driver:
> 
>   # output is:  driver_name node_full_path
>   #
>   cd /proc/device-tree
>   for k in `find . -name %driver_name` ; do
>  echo `cat ${k}` `echo ${k} | sed -e 's|./||' -e 's|/%driver_name$||'`
>   done | sort

If we take this patch, these examples should be somewhere in the
documentation to make it easy for others.

> Signed-off-by: Frank Rowand 

Minor nit, your From: line doesn't match this signed-off-by: so
something has to change (or add a new From: line, like SubmittingPatches
decribes how to do.)

thanks,

greg k-h
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] sysfs, device-tree: aid for debugging device tree boot problems

2014-04-22 Thread Greg Kroah-Hartman
On Tue, Apr 22, 2014 at 06:25:25PM -0700, Frank Rowand wrote:
 Create some infrastructure to aid trouble shooting device tree related
 boot issues.
 
 Add a %driver_name file to each device tree node sysfs directory which has had
 a driver bound to it.  This allows detecting device tree nodes which failed
 to be bound to any driver.

Why is this needed, shouldn't there already be a driver symlink in
sysfs for these devices when a driver binds to them?  The rest of the
driver model works that way, why is of devices any different?

 Examples of using the %driver_name file (note that /proc/device-tree is a
 link to the base of the device tree sysfs tree):
 
 
   1) To find list of device tree nodes with no driver:
 
   # A few false positives may be reported.  For example,
   #   node_full_path of . is the board.
   #
   # output is: node_full_path compatible_string
   #
   cd /proc/device-tree
   for k in `find . -type d`; do
  if [[ -f ${k}/compatible  ! -f ${k}/%driver_name ]] ; then
 if [[ `cat ${k}/compatible` != simple-bus ]] ; then
echo `echo ${k} | sed -e 's|./||'` `cat ${k}/compatible`
 fi
  fi
   done | sort
 
 
   2) To find list of device tree nodes with a bound driver:
 
   # output is:  node_full_path driver_name
   #
   cd /proc/device-tree
   for k in `find . -name %driver_name` ; do
  echo `echo ${k} | sed -e 's|./||' -e 's|/%driver_name$||'` `cat ${k}`
   done | sort
 
 
   3) To find list of device tree nodes with a bound driver:
 
   # output is:  driver_name node_full_path
   #
   cd /proc/device-tree
   for k in `find . -name %driver_name` ; do
  echo `cat ${k}` `echo ${k} | sed -e 's|./||' -e 's|/%driver_name$||'`
   done | sort

If we take this patch, these examples should be somewhere in the
documentation to make it easy for others.

 Signed-off-by: Frank Rowand frank.row...@sonymobile.com

Minor nit, your From: line doesn't match this signed-off-by: so
something has to change (or add a new From: line, like SubmittingPatches
decribes how to do.)

thanks,

greg k-h
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/