From: Jean Delvare <khali@linux-fr.org>
To: Russell King <rmk+lkml@arm.linux.org.uk>
Cc: Dmitry Torokhov <dtor_core@ameritech.net>,
Greg KH <greg@kroah.com>, LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] Minor change to platform_device_register_simple prototype
Date: Sat, 10 Dec 2005 16:49:28 +0100 [thread overview]
Message-ID: <20051210164928.3a7f57fb.khali@linux-fr.org> (raw)
In-Reply-To: <20051208232254.GC9357@flint.arm.linux.org.uk>
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
failing.
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
next prev parent reply other threads:[~2005-12-10 15:47 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-12-05 20:23 [PATCH] Minor change to platform_device_register_simple prototype Jean Delvare
2005-12-05 20:27 ` Russell King
2005-12-07 6:05 ` Dmitry Torokhov
2005-12-07 17:04 ` Greg KH
2005-12-08 21:21 ` Dmitry Torokhov
2005-12-08 21:37 ` Jean Delvare
2005-12-08 21:49 ` Dmitry Torokhov
2005-12-08 23:26 ` Russell King
2005-12-07 17:59 ` Dmitry Torokhov
2005-12-07 18:08 ` Russell King
2005-12-07 18:23 ` Dmitry Torokhov
2005-12-07 19:03 ` Russell King
2005-12-07 22:18 ` Dmitry Torokhov
2005-12-07 22:51 ` Greg KH
2005-12-07 22:59 ` Dmitry Torokhov
2005-12-07 23:06 ` Greg KH
2005-12-07 23:21 ` Russell King
2005-12-08 20:58 ` Jean Delvare
2005-12-08 21:06 ` Dmitry Torokhov
2005-12-08 23:17 ` Russell King
2005-12-08 20:52 ` Jean Delvare
2005-12-08 23:22 ` Russell King
2005-12-10 15:49 ` Jean Delvare [this message]
2005-12-11 19:44 ` Jean Delvare
2005-12-12 2:08 ` Dmitry Torokhov
2005-12-07 18:11 ` Dmitry Torokhov
2005-12-07 18:39 ` Randy.Dunlap
2005-12-07 19:05 ` Russell King
2005-12-07 6:50 ` Jean Delvare
2005-12-07 9:24 ` Russell King
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20051210164928.3a7f57fb.khali@linux-fr.org \
--to=khali@linux-fr.org \
--cc=dtor_core@ameritech.net \
--cc=greg@kroah.com \
--cc=linux-kernel@vger.kernel.org \
--cc=rmk+lkml@arm.linux.org.uk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.