[lkml]   [2005]   [Dec]   [10]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: [PATCH] Minor change to platform_device_register_simple prototype
Hi Russell,

> On Thu, Dec 08, 2005 at 09:52:57PM +0100, Jean Delvare wrote:
> > BTW, doesn't this suggest that the error path in
> > platform_device_register_simple() is currently broken as well? If
> > platform_device_add() fails therein, I take it that the resources
> > previously allocated by platform_device_add_resources() will never be
> > freed.
> No. If platform_device_add() fails then you platform_device_put()
> it with no other action. If it's been added, with the current
> available interfaces, your only option is to
> platform_device_unregister() it.
> So:
> - error during platform_device_alloc, no additional action necessary
> - error returned by platform_device_add, you have a structure allocated
> and initialised, you platform_device_put it.
> - subsequently you want to get rid of it, platform_device_unregister it,
> or alternatively platform_device_del + platform_device_put it (where
> provided.)
> This is actually a generic driver model rule which can be applied to
> all driver model interfaces which have the alloc/init, add, del, put,
> register, unregister methods.

I was fine with the sequence you are describing above. The only thing
which was worrying me was platform_device_add_resources(), until I
realized that this function was really only preparing the resources for
reservation. For some reason I was erroneously thinking that it was
also requesting the resources "for real", so I was worried that
platform_device_put wouldn't release these if platform_device_add was

This all makes sense to me now. Thanks for the clarification, and sorry
for being a bit slow to figure out how the platform stuff works.

I'll post the platform driver I am currently working on later today for
comments. I'm pretty sure I'm still not using the platform
infrastructure the way it was meant to be, and would appreciate hints on
how I can do it better.

Thanks again,
Jean Delvare
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
More majordomo info at
Please read the FAQ at

 \ /
  Last update: 2005-12-10 16:53    [W:0.060 / U:3.820 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site