public inbox for linux-omap@vger.kernel.org
 help / color / mirror / Atom feed
From: Igor Grinberg <grinberg@compulab.co.il>
To: Igor Grinberg <grinberg@compulab.co.il>
Cc: Tony Lindgren <tony@atomide.com>,
	Mike Rapoport <mike@compulab.co.il>,
	Tim Nordell <tim.nordell@logicpd.com>,
	linux-omap@vger.kernel.org, linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH v2 1/2] arm: omap: fix bug with multiple smsc911x devices
Date: Tue, 03 May 2011 09:27:12 +0300	[thread overview]
Message-ID: <4DBFA040.9060305@compulab.co.il> (raw)
In-Reply-To: <1303633675-18589-1-git-send-email-grinberg@compulab.co.il>

ping!


Tony, there are already people who need that bug fix.


On 04/24/11 11:27, Igor Grinberg wrote:

> kobject (c06a4250): tried to init an initialized object, something is
> seriously wrong.
>
> introduced by commit 66293989:
> (omap: convert boards that use SMSC911x to use gpmc-smsc911x)
>
> fixed by allocating struct platform_device dynamically.
>
> Signed-off-by: Igor Grinberg <grinberg@compulab.co.il>
> ---
> This has been boot tested with nfs root on cm-t35,
> and build tested on all other affected boards.
>
> v2:	keep the id field uninitialized (0) on boards with
> 	only one smsc911x controller (thanks Mike)
>
>
>  arch/arm/mach-omap2/board-cm-t35.c              |    2 ++
>  arch/arm/mach-omap2/board-overo.c               |    2 ++
>  arch/arm/mach-omap2/gpmc-smsc911x.c             |   16 +++++-----------
>  arch/arm/plat-omap/include/plat/gpmc-smsc911x.h |    1 +
>  4 files changed, 10 insertions(+), 11 deletions(-)
>
> diff --git a/arch/arm/mach-omap2/board-cm-t35.c b/arch/arm/mach-omap2/board-cm-t35.c
> index b5772c1..7c70f56 100644
> --- a/arch/arm/mach-omap2/board-cm-t35.c
> +++ b/arch/arm/mach-omap2/board-cm-t35.c
> @@ -69,6 +69,7 @@
>  #include <plat/gpmc-smsc911x.h>
>  
>  static struct omap_smsc911x_platform_data cm_t35_smsc911x_cfg = {
> +	.id		= 0,
>  	.cs             = CM_T35_SMSC911X_CS,
>  	.gpio_irq       = CM_T35_SMSC911X_GPIO,
>  	.gpio_reset     = -EINVAL,
> @@ -76,6 +77,7 @@ static struct omap_smsc911x_platform_data cm_t35_smsc911x_cfg = {
>  };
>  
>  static struct omap_smsc911x_platform_data sb_t35_smsc911x_cfg = {
> +	.id		= 1,
>  	.cs             = SB_T35_SMSC911X_CS,
>  	.gpio_irq       = SB_T35_SMSC911X_GPIO,
>  	.gpio_reset     = -EINVAL,
> diff --git a/arch/arm/mach-omap2/board-overo.c b/arch/arm/mach-omap2/board-overo.c
> index 4016166..165e1fa 100644
> --- a/arch/arm/mach-omap2/board-overo.c
> +++ b/arch/arm/mach-omap2/board-overo.c
> @@ -149,6 +149,7 @@ static inline void __init overo_ads7846_init(void) { return; }
>  #include <plat/gpmc-smsc911x.h>
>  
>  static struct omap_smsc911x_platform_data smsc911x_cfg = {
> +	.id		= 0,
>  	.cs             = OVERO_SMSC911X_CS,
>  	.gpio_irq       = OVERO_SMSC911X_GPIO,
>  	.gpio_reset     = -EINVAL,
> @@ -156,6 +157,7 @@ static struct omap_smsc911x_platform_data smsc911x_cfg = {
>  };
>  
>  static struct omap_smsc911x_platform_data smsc911x2_cfg = {
> +	.id		= 1,
>  	.cs             = OVERO_SMSC911X2_CS,
>  	.gpio_irq       = OVERO_SMSC911X2_GPIO,
>  	.gpio_reset     = -EINVAL,
> diff --git a/arch/arm/mach-omap2/gpmc-smsc911x.c b/arch/arm/mach-omap2/gpmc-smsc911x.c
> index b331f3c..d30293a 100644
> --- a/arch/arm/mach-omap2/gpmc-smsc911x.c
> +++ b/arch/arm/mach-omap2/gpmc-smsc911x.c
> @@ -41,16 +41,6 @@ static struct smsc911x_platform_config gpmc_smsc911x_config = {
>  	.flags		= SMSC911X_USE_16BIT,
>  };
>  
> -static struct platform_device gpmc_smsc911x_device = {
> -	.name		= "smsc911x",
> -	.id		= -1,
> -	.num_resources	= ARRAY_SIZE(gpmc_smsc911x_resources),
> -	.resource	= gpmc_smsc911x_resources,
> -	.dev		= {
> -		.platform_data = &gpmc_smsc911x_config,
> -	},
> -};
> -
>  /*
>   * Initialize smsc911x device connected to the GPMC. Note that we
>   * assume that pin multiplexing is done in the board-*.c file,
> @@ -58,6 +48,7 @@ static struct platform_device gpmc_smsc911x_device = {
>   */
>  void __init gpmc_smsc911x_init(struct omap_smsc911x_platform_data *board_data)
>  {
> +	struct platform_device *pdev;
>  	unsigned long cs_mem_base;
>  	int ret;
>  
> @@ -97,7 +88,10 @@ void __init gpmc_smsc911x_init(struct omap_smsc911x_platform_data *board_data)
>  	if (gpmc_cfg->flags)
>  		gpmc_smsc911x_config.flags = gpmc_cfg->flags;
>  
> -	if (platform_device_register(&gpmc_smsc911x_device) < 0) {
> +	pdev = platform_device_register_resndata(NULL, "smsc911x", gpmc_cfg->id,
> +		 gpmc_smsc911x_resources, ARRAY_SIZE(gpmc_smsc911x_resources),
> +		 &gpmc_smsc911x_config, sizeof(gpmc_smsc911x_config));
> +	if (!pdev) {
>  		printk(KERN_ERR "Unable to register smsc911x device\n");
>  		gpio_free(gpmc_cfg->gpio_reset);
>  		goto free2;
> diff --git a/arch/arm/plat-omap/include/plat/gpmc-smsc911x.h b/arch/arm/plat-omap/include/plat/gpmc-smsc911x.h
> index 872de0bf..d3f1579 100644
> --- a/arch/arm/plat-omap/include/plat/gpmc-smsc911x.h
> +++ b/arch/arm/plat-omap/include/plat/gpmc-smsc911x.h
> @@ -14,6 +14,7 @@
>  #ifndef __ASM_ARCH_OMAP_GPMC_SMSC911X_H__
>  
>  struct omap_smsc911x_platform_data {
> +	int	id;
>  	int	cs;
>  	int	gpio_irq;
>  	int	gpio_reset;

-- 
Regards,
Igor.


  reply	other threads:[~2011-05-03  6:27 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-04-21 14:50 [PATCH 1/2] arm: omap: fix bug with multiple smsc911x devices Igor Grinberg
2011-04-21 14:50 ` [PATCH 2/2] arm: omap: gpmc-smsc911x: minor style fixes Igor Grinberg
2011-04-26 13:45   ` Menon, Nishanth
2011-04-26 14:40     ` Igor Grinberg
2011-04-26 14:49       ` Menon, Nishanth
2011-04-26 15:48         ` Igor Grinberg
2011-04-26 16:25           ` [PATCH v2 " Igor Grinberg
2011-04-26 21:08             ` Menon, Nishanth
2011-05-03  7:42               ` Tony Lindgren
2011-04-22 12:51 ` [PATCH 1/2] arm: omap: fix bug with multiple smsc911x devices Mike Rapoport
2011-04-24  8:27   ` [PATCH v2 " Igor Grinberg
2011-05-03  6:27     ` Igor Grinberg [this message]
2011-05-03  7:37       ` Tony Lindgren

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=4DBFA040.9060305@compulab.co.il \
    --to=grinberg@compulab.co.il \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=mike@compulab.co.il \
    --cc=tim.nordell@logicpd.com \
    --cc=tony@atomide.com \
    /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