mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@osdl.org>
To: "Paolo 'Blaisorblade' Giarrusso" <blaisorblade@yahoo.it>
Cc: gregkh@suse.de, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] device core: remove redundant call to device_initialize.
Date: Fri, 5 May 2006 19:35:42 -0700	[thread overview]
Message-ID: <20060505193542.0332557b.akpm@osdl.org> (raw)
In-Reply-To: <20060505153907.12756.23295.stgit@zion.home.lan>

On Fri, 05 May 2006 17:39:08 +0200
"Paolo 'Blaisorblade' Giarrusso" <blaisorblade@yahoo.it> wrote:

> From: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
> 
> platform_device_add calls device_register which calls then again
> device_initialize, redundantly.
> 
> Cc: Greg Kroah-Hartman <gregkh@suse.de>
> Signed-off-by: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
> ---
> 
>  drivers/base/platform.c |    1 -
>  1 files changed, 0 insertions(+), 1 deletions(-)
> 
> diff --git a/drivers/base/platform.c b/drivers/base/platform.c
> index 83f5c59..b0d9bd4 100644
> --- a/drivers/base/platform.c
> +++ b/drivers/base/platform.c
> @@ -317,7 +317,6 @@ EXPORT_SYMBOL_GPL(platform_device_del);
>   */
>  int platform_device_register(struct platform_device * pdev)
>  {
> -	device_initialize(&pdev->dev);
>  	return platform_device_add(pdev);
>  }
>  EXPORT_SYMBOL_GPL(platform_device_register);

platform_device_add() initialises a bunch of things in pdev->dev and _then_
calls device_register(&pdev->dev) which calls device_initialize() to "init
device structure".  This happens after we've already done some
initialisation on the thing.   This is not nice.

A better design would be to rip out all the device_initialize() calls and
require that the caller run device_initialize() before "add"ing or
"register"ing the platform_device.

And indeed platform_device_alloc() already does that.  If that is
sufficient then we're in good shape.

If it is not sufficient then more thought would be needed.  We could at
least run device_initialize() at the _start_ of platform_device_add(),
rather than towards the end.

icky stuff.

  parent reply	other threads:[~2006-05-06  2:35 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-05-05 15:39 Paolo 'Blaisorblade' Giarrusso
2006-05-05 22:14 ` Russell King
2006-05-06  2:35 ` Andrew Morton [this message]
2006-05-06  7:10   ` Russell King
2006-05-06  7:15     ` 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=20060505193542.0332557b.akpm@osdl.org \
    --to=akpm@osdl.org \
    --cc=blaisorblade@yahoo.it \
    --cc=gregkh@suse.de \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome