From: Jean Delvare <khali@linux-fr.org>
To: Dmitry Torokhov <dtor_core@ameritech.net>,
Greg KH <greg@kroah.com>,
Russell King <rmk+lkml@arm.linux.org.uk>
Cc: LKML <linux-kernel@vger.kernel.org>,
Alessandro Zummo <alessandro.zummo@towertech.it>
Subject: Re: [PATCH] Minor change to platform_device_register_simple prototype
Date: Sun, 11 Dec 2005 20:44:58 +0100 [thread overview]
Message-ID: <20051211204458.22c60123.khali@linux-fr.org> (raw)
In-Reply-To: <20051208215257.78d7c67a.khali@linux-fr.org>
Hi Dmirty, Russell, Greg,
Quoting myself:
> I second Dmitry's request here. I can't seem to possibly build a valid
> error path during device registration with the current API. Having
> platform_device_del() would make it possible.
I since modified the platform driver I am working on, thanks to the
guidance of Alessandro Zummo, and found that the new implementation no
longer needs platform_device_del().
My original code was registering a platform_driver, but wasn't actually
using it. In particular, the driver had no probe and remove functions.
Everything was done directly through the init and exit functions of the
module.
The new code makes proper use of platform_driver's probe and remove
function pointers. This means that the initial platform_device
registration ends with a call to platform_device_add(), and as a
consequence, the error path doesn't need platform_device_del().
So, provided that my case can be extended to others, I'd guess that
platform drivers using platform_driver.probe are likely not to need
platform_device_del(), while drivers not using platform_driver.probe
may need it. This may explain why platform_device_del wasn't needed so
far.
This raises a question. For a module which registers both the
platform_device and the matching platform_driver (as is the case for
mine), is it considered better to rely on platform_driver.probe
and .remove (as my new code does)? Or is it OK to omit these and handle
initialization and cleanup phases more direclty (as my old code did),
as this is technically possible? Using .probe and .remove looks cleaner
with regards to the driver model, but it also makes things a little
more complex.
If the goal is to always use .probe and .remove, then
platform_device_del() might become unneeded again in the long run.
Thanks,
--
Jean Delvare
next prev parent reply other threads:[~2005-12-11 19:42 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
2005-12-11 19:44 ` Jean Delvare [this message]
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=20051211204458.22c60123.khali@linux-fr.org \
--to=khali@linux-fr.org \
--cc=alessandro.zummo@towertech.it \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox