All of lore.kernel.org
 help / color / mirror / Atom feed
From: Nishanth Menon <nm@ti.com>
To: Dave Gerlach <d-gerlach@ti.com>,
	linux-arm-kernel@lists.infradead.org, linux-omap@vger.kernel.org
Cc: Tony Lindgren <tony@atomide.com>, Paul Walmsley <paul@pwsan.com>
Subject: Re: [PATCH] ARM: OMAP2+: Remove suspend_set_ops from common pm late init
Date: Fri, 9 May 2014 14:04:38 -0500	[thread overview]
Message-ID: <536D26C6.1060903@ti.com> (raw)
In-Reply-To: <1399661580-54599-1-git-send-email-d-gerlach@ti.com>

On 05/09/2014 01:53 PM, Dave Gerlach wrote:
> In omap2_common_pm_late_init suspend_set_ops was called to set common
> suspend handling functions for all omap platforms. This created two
> problems. First, these suspend ops were being set for all platforms,
> regardless of whether or not suspend support has been integrated so in
> the case of AM33XX, suspend to mem was presented as available but
> failed every time. Second, some platforms will need to define a
> completely separate set of suspend ops, such as AM33XX, due to
> differences from previous omap platforms so there is no need to
> always set the common omap ops.
> 
> This patch moves the suspend_set_ops call from omap2_common_pm_late_init
> into a separate function that then gets called in the omap*_pm_init
> functions for each platform.
> 
> Signed-off-by: Dave Gerlach <d-gerlach@ti.com>
> ---
>  arch/arm/mach-omap2/common.h | 8 ++++++++
>  arch/arm/mach-omap2/pm.c     | 8 ++++----
>  arch/arm/mach-omap2/pm24xx.c | 1 +
>  arch/arm/mach-omap2/pm34xx.c | 1 +
>  arch/arm/mach-omap2/pm44xx.c | 1 +
>  5 files changed, 15 insertions(+), 4 deletions(-)
> 
> diff --git a/arch/arm/mach-omap2/common.h b/arch/arm/mach-omap2/common.h
> index d88aff7..091e1c7 100644
> --- a/arch/arm/mach-omap2/common.h
> +++ b/arch/arm/mach-omap2/common.h
> @@ -162,6 +162,14 @@ static inline void omap44xx_restart(enum reboot_mode mode, const char *cmd)
>  }
>  #endif
>  
> +#ifdef CONFIG_SUSPEND
> +void omap_common_suspend_init(void);
> +#else
> +static inline void omap_common_suspend_init(void)
> +{
> +}
> +#endif
> +
push this off to this pm.h?

>  /* This gets called from mach-omap2/io.c, do not call this */
>  void __init omap2_set_globals_tap(u32 class, void __iomem *tap);
>  
> diff --git a/arch/arm/mach-omap2/pm.c b/arch/arm/mach-omap2/pm.c
> index e1b4141..c9b36fb 100644
> --- a/arch/arm/mach-omap2/pm.c
> +++ b/arch/arm/mach-omap2/pm.c
> @@ -243,6 +243,10 @@ static const struct platform_suspend_ops omap_pm_ops = {
>  	.valid		= suspend_valid_only_mem,
>  };
>  
> +void __init omap_common_suspend_init(void)
provide kernel doc please? and do we need __init?

> +{
> +	suspend_set_ops(&omap_pm_ops);
> +}
>  #endif /* CONFIG_SUSPEND */
>  
>  static void __init omap3_init_voltages(void)
> @@ -310,9 +314,5 @@ int __init omap2_common_pm_late_init(void)
>  	/* cpufreq dummy device instantiation */
>  	omap_init_cpufreq();
>  
> -#ifdef CONFIG_SUSPEND
> -	suspend_set_ops(&omap_pm_ops);
> -#endif
> -
>  	return 0;
>  }
> diff --git a/arch/arm/mach-omap2/pm24xx.c b/arch/arm/mach-omap2/pm24xx.c
> index 8c07594..8cd2408 100644
> --- a/arch/arm/mach-omap2/pm24xx.c
> +++ b/arch/arm/mach-omap2/pm24xx.c
> @@ -231,6 +231,7 @@ static void __init prcm_setup_regs(void)
>  
>  #ifdef CONFIG_SUSPEND
>  	omap_pm_suspend = omap2_enter_full_retention;
> +	omap_common_suspend_init();
>  #endif
>  
>  	/* REVISIT: Configure number of 32 kHz clock cycles for sys_clk
> diff --git a/arch/arm/mach-omap2/pm34xx.c b/arch/arm/mach-omap2/pm34xx.c
> index 87099bb..32b2597 100644
> --- a/arch/arm/mach-omap2/pm34xx.c
> +++ b/arch/arm/mach-omap2/pm34xx.c
> @@ -707,6 +707,7 @@ int __init omap3_pm_init(void)
>  
>  #ifdef CONFIG_SUSPEND
>  	omap_pm_suspend = omap3_pm_suspend;
> +	omap_common_suspend_init();
>  #endif
>  
>  	arm_pm_idle = omap3_pm_idle;
> diff --git a/arch/arm/mach-omap2/pm44xx.c b/arch/arm/mach-omap2/pm44xx.c
> index eefb30c..58d7cd7 100644
> --- a/arch/arm/mach-omap2/pm44xx.c
> +++ b/arch/arm/mach-omap2/pm44xx.c
> @@ -253,6 +253,7 @@ int __init omap4_pm_init(void)
>  
>  #ifdef CONFIG_SUSPEND
>  	omap_pm_suspend = omap4_pm_suspend;
> +	omap_common_suspend_init();

do we need to expose omap_pm_suspend anymore with this since the
original purpose was to make pm.c know about the suspend function?
How about:
omap_common_suspend_init(omap4_pm_suspend);
should do the job, right? and with that, you dont need the #ifdef
CONFIG_SUSPEND either in each of the pmxxx.c files since you already
deal with it in header.

>  #endif
>  
>  	/* Overwrite the default cpu_do_idle() */
> 


-- 
Regards,
Nishanth Menon

WARNING: multiple messages have this Message-ID (diff)
From: nm@ti.com (Nishanth Menon)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] ARM: OMAP2+: Remove suspend_set_ops from common pm late init
Date: Fri, 9 May 2014 14:04:38 -0500	[thread overview]
Message-ID: <536D26C6.1060903@ti.com> (raw)
In-Reply-To: <1399661580-54599-1-git-send-email-d-gerlach@ti.com>

On 05/09/2014 01:53 PM, Dave Gerlach wrote:
> In omap2_common_pm_late_init suspend_set_ops was called to set common
> suspend handling functions for all omap platforms. This created two
> problems. First, these suspend ops were being set for all platforms,
> regardless of whether or not suspend support has been integrated so in
> the case of AM33XX, suspend to mem was presented as available but
> failed every time. Second, some platforms will need to define a
> completely separate set of suspend ops, such as AM33XX, due to
> differences from previous omap platforms so there is no need to
> always set the common omap ops.
> 
> This patch moves the suspend_set_ops call from omap2_common_pm_late_init
> into a separate function that then gets called in the omap*_pm_init
> functions for each platform.
> 
> Signed-off-by: Dave Gerlach <d-gerlach@ti.com>
> ---
>  arch/arm/mach-omap2/common.h | 8 ++++++++
>  arch/arm/mach-omap2/pm.c     | 8 ++++----
>  arch/arm/mach-omap2/pm24xx.c | 1 +
>  arch/arm/mach-omap2/pm34xx.c | 1 +
>  arch/arm/mach-omap2/pm44xx.c | 1 +
>  5 files changed, 15 insertions(+), 4 deletions(-)
> 
> diff --git a/arch/arm/mach-omap2/common.h b/arch/arm/mach-omap2/common.h
> index d88aff7..091e1c7 100644
> --- a/arch/arm/mach-omap2/common.h
> +++ b/arch/arm/mach-omap2/common.h
> @@ -162,6 +162,14 @@ static inline void omap44xx_restart(enum reboot_mode mode, const char *cmd)
>  }
>  #endif
>  
> +#ifdef CONFIG_SUSPEND
> +void omap_common_suspend_init(void);
> +#else
> +static inline void omap_common_suspend_init(void)
> +{
> +}
> +#endif
> +
push this off to this pm.h?

>  /* This gets called from mach-omap2/io.c, do not call this */
>  void __init omap2_set_globals_tap(u32 class, void __iomem *tap);
>  
> diff --git a/arch/arm/mach-omap2/pm.c b/arch/arm/mach-omap2/pm.c
> index e1b4141..c9b36fb 100644
> --- a/arch/arm/mach-omap2/pm.c
> +++ b/arch/arm/mach-omap2/pm.c
> @@ -243,6 +243,10 @@ static const struct platform_suspend_ops omap_pm_ops = {
>  	.valid		= suspend_valid_only_mem,
>  };
>  
> +void __init omap_common_suspend_init(void)
provide kernel doc please? and do we need __init?

> +{
> +	suspend_set_ops(&omap_pm_ops);
> +}
>  #endif /* CONFIG_SUSPEND */
>  
>  static void __init omap3_init_voltages(void)
> @@ -310,9 +314,5 @@ int __init omap2_common_pm_late_init(void)
>  	/* cpufreq dummy device instantiation */
>  	omap_init_cpufreq();
>  
> -#ifdef CONFIG_SUSPEND
> -	suspend_set_ops(&omap_pm_ops);
> -#endif
> -
>  	return 0;
>  }
> diff --git a/arch/arm/mach-omap2/pm24xx.c b/arch/arm/mach-omap2/pm24xx.c
> index 8c07594..8cd2408 100644
> --- a/arch/arm/mach-omap2/pm24xx.c
> +++ b/arch/arm/mach-omap2/pm24xx.c
> @@ -231,6 +231,7 @@ static void __init prcm_setup_regs(void)
>  
>  #ifdef CONFIG_SUSPEND
>  	omap_pm_suspend = omap2_enter_full_retention;
> +	omap_common_suspend_init();
>  #endif
>  
>  	/* REVISIT: Configure number of 32 kHz clock cycles for sys_clk
> diff --git a/arch/arm/mach-omap2/pm34xx.c b/arch/arm/mach-omap2/pm34xx.c
> index 87099bb..32b2597 100644
> --- a/arch/arm/mach-omap2/pm34xx.c
> +++ b/arch/arm/mach-omap2/pm34xx.c
> @@ -707,6 +707,7 @@ int __init omap3_pm_init(void)
>  
>  #ifdef CONFIG_SUSPEND
>  	omap_pm_suspend = omap3_pm_suspend;
> +	omap_common_suspend_init();
>  #endif
>  
>  	arm_pm_idle = omap3_pm_idle;
> diff --git a/arch/arm/mach-omap2/pm44xx.c b/arch/arm/mach-omap2/pm44xx.c
> index eefb30c..58d7cd7 100644
> --- a/arch/arm/mach-omap2/pm44xx.c
> +++ b/arch/arm/mach-omap2/pm44xx.c
> @@ -253,6 +253,7 @@ int __init omap4_pm_init(void)
>  
>  #ifdef CONFIG_SUSPEND
>  	omap_pm_suspend = omap4_pm_suspend;
> +	omap_common_suspend_init();

do we need to expose omap_pm_suspend anymore with this since the
original purpose was to make pm.c know about the suspend function?
How about:
omap_common_suspend_init(omap4_pm_suspend);
should do the job, right? and with that, you dont need the #ifdef
CONFIG_SUSPEND either in each of the pmxxx.c files since you already
deal with it in header.

>  #endif
>  
>  	/* Overwrite the default cpu_do_idle() */
> 


-- 
Regards,
Nishanth Menon

  reply	other threads:[~2014-05-09 19:05 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-09 18:53 [PATCH] ARM: OMAP2+: Remove suspend_set_ops from common pm late init Dave Gerlach
2014-05-09 18:53 ` Dave Gerlach
2014-05-09 19:04 ` Nishanth Menon [this message]
2014-05-09 19:04   ` Nishanth Menon
2014-05-09 20:17   ` Dave Gerlach
2014-05-09 20:17     ` Dave Gerlach
2014-05-09 20:38     ` Nishanth Menon
2014-05-09 20:38       ` Nishanth Menon

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=536D26C6.1060903@ti.com \
    --to=nm@ti.com \
    --cc=d-gerlach@ti.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=paul@pwsan.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 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.