Getting the IRQ number (Was: Basic driver devel questions ?)

Guillaume Dargaud dargaud at lpsc.in2p3.fr
Tue Dec 7 01:44:39 EST 2010


Hello all,

> OK, that should be all pretty straight forward, and covered by the
> material in LDD and similar references. You just need to get your device
> probed.

I'm not sure what you mean with that term: simply identifying that the device 
works using device specific code ?
I've looked at several *_probe functions from other drivers and they are all 
completely different with no common code...

Or do you mean calling of_platform_bus_probe() ? What does that function do ?

> No it's just that platform_drivers are now able to do all the things an
> of_platform_driver can do, so new code should just use platform_driver.
> 
> I'm not sure if of_platform_bus_probe() will go away eventually, but for
> now it is the only way to achieve what you need.

I assume the kernel needs to be compiled with CONFIG_OF.
...hmm I had to "git pull" in order for this to compile your snippet. That's 
really recent! Unfortunately i need to reflash my device with the new kernel 
before i can begin testing my module.

When I try to compile your (adapted) snippet, I got this minor problems:

  .probe = foo_driver_probe,
^ warning: initialization from incompatible pointer type
Shouldn't foo_driver_probe be:
static int foo_driver_probe(struct platform_device *pdev)
instead of:
static int foo_driver_probe(struct platform_device *device,
                            const struct of_device_id *device_id)


Also:
       struct foo_device *foo;
That's where I put my own content, right ?
And needs to be kfreed in a foo_driver_remove() function, right ?

> > I still need a platform_device_register() after your sample init, right ?
> 
> I had one in there already, in foo_driver_init(), didn't I?

You had platform_driver_register(), not that I'm all clear yet on the 
distinction...


Another question: I just spent 10 minutes trying to find where "struct device" 
was defined. (ack-)grep was absolutely no use. Isn't there a way to cross-
reference my own kernel, the way I've compiled it ?
-- 
Guillaume Dargaud
http://www.gdargaud.net/Climbing/


More information about the Linuxppc-dev mailing list