All of lore.kernel.org
 help / color / mirror / Atom feed
From: Greg KH <greg@kroah.com>
To: dtor_core@ameritech.net
Cc: Jean Delvare <khali@linux-fr.org>, LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] Minor change to platform_device_register_simple prototype
Date: Wed, 7 Dec 2005 14:51:26 -0800	[thread overview]
Message-ID: <20051207225126.GA648@kroah.com> (raw)
In-Reply-To: <d120d5000512071418q521d2155r81759ef8993000d8@mail.gmail.com>

On Wed, Dec 07, 2005 at 05:18:40PM -0500, Dmitry Torokhov wrote:
> On 12/7/05, Russell King <rmk+lkml@arm.linux.org.uk> wrote:
> > On Wed, Dec 07, 2005 at 01:23:11PM -0500, Dmitry Torokhov wrote:
> > > On 12/7/05, Russell King <rmk+lkml@arm.linux.org.uk> wrote:
> > > > On Wed, Dec 07, 2005 at 12:59:09PM -0500, Dmitry Torokhov > > I have started moving drivers from the "_simple" interface and I found
> > > > > that I'm missing platform_device_del that would complement
> > > > > platform_device_add. Would you object to having such a function, like
> > > > > we do for other sysfs objects? With it one can write somthing like
> > > > > this:
> > > >
> > > > Greg and myself discussed that, and we decided that it was adding
> > > > unnecessary complexity to the interface.  Maybe Greg's view has
> > > > changed?
> > > >
> > >
> > > How do you write error handling path without the _del function if
> > > platform_device_add is not the last call? you can't call
> > > platform_device_unregister() and then platform_device_put(). And I
> > > don't like to take extra references in error path or assign the
> > > pointer to NULL in teh middle of unwinding...
> >
> > The example code in the commit comments contains a complete example of
> > registering a platform device, and cleaning up should something go
> > wrong with that process.
> >
> 
> The problem with what you proposing is that one will have to code 2
> cleanup code paths - one when platform_device_add fails (in this case
> you just call platform_device_put) and another one when
> platfrom_device_add succeeds but something else fails. In the second
> case you have to use platfrom_device_unregister to release resources
> but can't use platform_device_put because the device will most likely
> be released by plaform_device_unregister. I prefer having single
> cleanup code path, like most other drivers have.
> 
> > Unregistering is just a matter of calling platform_device_unregister().
> > An unregister call is a del + put in exactly the same way as it is
> > throughout the rest of the driver model.
> >
> 
> Yes, and it works just fine everywhere except in initialization code
> when you need to jump in the middle of _del + _put sequence.

So, if you had _del, would it work easier for you?  I just objected to
it if it wasn't necessary.  I didn't want to add functions that aren't
used by anyone, but if is needed, I don't see a problem with it.

thanks,

greg k-h

  reply	other threads:[~2005-12-07 22:52 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 [this message]
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
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=20051207225126.GA648@kroah.com \
    --to=greg@kroah.com \
    --cc=dtor_core@ameritech.net \
    --cc=khali@linux-fr.org \
    --cc=linux-kernel@vger.kernel.org \
    /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.