Problem registering the Platform ADC driver

Joachim Holst jocke at holstenhof.se
Tue May 24 05:57:35 EDT 2011


> On Tue, May 24, 2011 at 1:42 PM, Joachim Holst <jocke at holstenhof.se>
> wrote:
>
>>
>> Thanks Jocke, for your reply. As you said in your example of
> board-msm7x30.c file which uses platform_add_devices, my board file
> board-icnova_adb4000.c uses platform_device_register for the registration
> of
> all peripherals initialized under function __init ek_board_init(void). I
> found that platform_add_device or platform_register_device can be used for
> device registration.

You are quite correct. I previously failed to read your code as good as I
should have :-( Sorry about that.

>
> Here is board-icnova_adb4000.c http://pastebin.com/dr0QzsyQ
> <http://pastebin.com/dr0QzsyQ%20>Linux#390. The functions called under
> ek_board_init are defined under
> http://lxr.linux.no/#linux+v2.6.38/arch/arm/mach-at91/at91sam9g45_devices.c.
> All of them uses platform_device_register. In my case also it should work.
>
> Still I am not sure why it is not working, any further thoughts or
> suggestions?

First, are you sure that platform_device_register actually succeeds?

The times this has happened to me, it has always been a problem with the
"name" between the platform device and the platform driver.

To avoid those problems, I usually use a #define for the name. That way,
I'm sure that a spelling problem (which can be _really_ hard to spot)  is
not the problem. Also, I usually don't care about setting the .id and the
.num_resources variables.

Otherwise, as far as I can tell, your code should work.

BRs,
/Jocke!


-- 
If it can't be fixed with duct-tape, it's definitely borken...




More information about the Kernelnewbies mailing list