Re: Changes to of_device ?

2011-06-17 Thread Philipp Ittershagen
On 06/17/2011 11:19 AM, Guillaume Dargaud wrote:
> [I'm on the latest Xilinx tree, FWIW, so that's 2.6.25 still ?]

Not answering your primary question here, but in order to print the most
recent tag (along with a uniqe suffix, see man page) that is reachable
from your current branch, you can use "git describe". It will print out
the kernel version on your latest Xilinx tree.


Greetings,

  Philipp
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


Re: Changes to of_device ?

2011-06-17 Thread Guillaume Dargaud
> Not answering your primary question here, but in order to print the most
> recent tag (along with a uniqe suffix, see man page) that is reachable
> from your current branch, you can use "git describe". It will print out
> the kernel version on your latest Xilinx tree.

$ git describe
v2.6.37-719-gecf08a4

$ cat ./include/linux/version.h
#define LINUX_VERSION_CODE 132645
#define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))

$ printf "%x\n" 132645
20625

Something doesn't quite match here... But my original question about how do you 
declare a probe function in the latest 
kernels still stand...
-- 
Guillaume Dargaud
http://www.gdargaud.net/
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


Re: Changes to of_device ?

2011-06-17 Thread Philipp Ittershagen
On 06/17/2011 01:22 PM, Guillaume Dargaud wrote:
>> Not answering your primary question here, but in order to print the most
>> recent tag (along with a uniqe suffix, see man page) that is reachable
>> from your current branch, you can use "git describe". It will print out
>> the kernel version on your latest Xilinx tree.
> 
> $ git describe
> v2.6.37-719-gecf08a4
> 
> $ cat ./include/linux/version.h
> #define LINUX_VERSION_CODE 132645
> #define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))
> 
> $ printf "%x\n" 132645
> 20625
> Something doesn't quite match here... 

It is hexadecimal. 0x25 = 37.

> But my original question about how do you declare a probe function in
> the latest kernels still stand...

The struct device_node was moved to struct device in order to make the
CONFIG_OF more generic. See

commit d706c1b050274b3bf97d7cb0542c0d070c9ccb8b
Author: Grant Likely 
Date:   Tue Apr 13 16:12:28 2010 -0700

driver-core: Add device node pointer to struct device


Hope this helps,

  Philipp
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


Re: Changes to of_device ?

2011-06-17 Thread Philipp Ittershagen
On 06/17/2011 02:57 PM, Philipp Ittershagen wrote:
> The struct device_node was moved to struct device in order to make the
> CONFIG_OF more generic. See
> 
> commit d706c1b050274b3bf97d7cb0542c0d070c9ccb8b
> Author: Grant Likely 
> Date:   Tue Apr 13 16:12:28 2010 -0700
> 
> driver-core: Add device node pointer to struct device
> 

I'm sorry, I should have mentioned that struct of_device was replaced by
struct platform_device. So in order to get your code compiled, you have
to change the probe function to

static int xad_driver_probe(struct platform_device* dev, const struct
of_device_id *match) {

The change was introduced by

commit 2dc11581376829303b98eadb2de253bee065a56a
Author: Grant Likely 
Date:   Fri Aug 6 09:25:50 2010 -0600

of/device: Replace struct of_device with struct platform_device


Greetings,

  Philipp
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


Re: Changes to of_device ?

2011-06-17 Thread Guillaume Dargaud
> I'm sorry, I should have mentioned that struct of_device was replaced by
> struct platform_device. So in order to get your code compiled, you have
> to change the probe function to
> 
> static int xad_driver_probe(struct platform_device* dev, const struct
> of_device_id *match) {

Thanks, that worked...

Side question: how do you guy find your way inside the kernel ? I spent hours 
trying to find the declarations of various 
basic structs like device, of_node, etc even with ack-grep and ctags (which I 
probably don't know how to use very well).
-- 
Guillaume Dargaud
http://www.gdargaud.net/
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


Re: Changes to of_device ?

2011-06-17 Thread Grant Likely
On Fri, Jun 17, 2011 at 7:53 AM, Guillaume Dargaud
 wrote:
>> I'm sorry, I should have mentioned that struct of_device was replaced by
>> struct platform_device. So in order to get your code compiled, you have
>> to change the probe function to
>>
>> static int xad_driver_probe(struct platform_device* dev, const struct
>> of_device_id *match) {
>
> Thanks, that worked...
>
> Side question: how do you guy find your way inside the kernel ? I spent hours 
> trying to find the declarations of various
> basic structs like device, of_node, etc even with ack-grep and ctags (which I 
> probably don't know how to use very well).

For finding structures, the following pattern tends to work well:

git grep 'struct device_node {'

I used to use cscope (make cscope in the kernel tree), but stopped
because the tags go out of date every time I change branches.

g.
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


RE: Changes to of_device ?

2011-06-17 Thread David Laight
 
> For finding structures, the following pattern tends to work well:
> 
> git grep 'struct device_node {'

In general 'typedef.*\' will find types.
eg: grep -r -n --include '*.h' 'typedef.*\'
base_of_source_tree

Finding functions (in .c files) is easy if names start in
column 1 '^function_name\>' will work.
But I ended up with: '^[^="]*[^ =][^="]*function_name\>' to find
some where the type was on the same line.

If you get really desparate, the definitions of functions can
be found by grepping through the namelists of the .o files.

David


___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev