All of lore.kernel.org
 help / color / mirror / Atom feed
From: Thierry Reding <thierry.reding-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
To: Arnd Bergmann <arnd-r2nGTMty4D4@public.gmane.org>
Cc: linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org,
	Olof Johansson <olof-nZhT3qVonbNeoWH0uzbU5w@public.gmane.org>,
	linux-tegra-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	Stephen Warren <swarren-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>
Subject: Re: [PATCH 12/12] ARM: tegra: Convert PMC to a driver
Date: Wed, 16 Jul 2014 17:14:29 +0200	[thread overview]
Message-ID: <20140716151427.GA22027@ulmo> (raw)
In-Reply-To: <17053542.QUGvfkeRmc@wuerfel>

[-- Attachment #1: Type: text/plain, Size: 5661 bytes --]

On Wed, Jul 16, 2014 at 04:12:29PM +0200, Arnd Bergmann wrote:
> On Wednesday 16 July 2014 15:22:41 Thierry Reding wrote:
> > On Wed, Jul 16, 2014 at 01:56:44PM +0200, Arnd Bergmann wrote:
> > > On Friday 11 July 2014, Thierry Reding wrote:
> > > > +/*
> > > > + * PMC
> > > > + */
> > > > +enum tegra_suspend_mode {
> > > > +       TEGRA_SUSPEND_NONE = 0,
> > > > +       TEGRA_SUSPEND_LP2, /* CPU voltage off */
> > > > +       TEGRA_SUSPEND_LP1, /* CPU voltage off, DRAM self-refresh */
> > > > +       TEGRA_SUSPEND_LP0, /* CPU + core voltage off, DRAM self-refresh */
> > > > +       TEGRA_MAX_SUSPEND_MODE,
> > > > +};
> > > > +
> > > > +#ifdef CONFIG_PM_SLEEP
> > > > +enum tegra_suspend_mode tegra_pmc_get_suspend_mode(void);
> > > > +void tegra_pmc_set_suspend_mode(enum tegra_suspend_mode mode);
> > > > +void tegra_pmc_enter_suspend_mode(enum tegra_suspend_mode mode);
> > > > +
> > > > +bool tegra_pmc_cpu_is_powered(int cpuid);
> > > > +int tegra_pmc_cpu_power_on(int cpuid);
> > > > +int tegra_pmc_cpu_remove_clamping(int cpuid);
> > > > +
> > > > +void tegra_pmc_restart(enum reboot_mode mode, const char *cmd);
> > > > +#endif
> > > > +
> > > > +/*
> > > 
> > > This part is causing multiple build failures in the randconfig tests.
> > > You can avoid them by removing the #ifdef.
> > 
> > How is this causing build failures? I only see them used wherever
> > CONFIG_PM_SLEEP is defined.
> > 
> > Although I guess tegra-pmc.c could cause sparse warnings since it
> > implements these functions regardless of CONFIG_PM_SLEEP, which probably
> > is the bug that should be fixed.
> > 
> > Do you have a randconfig that I can use to reproduce this and come up
> > with a fix?
> 
> I got this error (always):
> 
> /git/arm-soc/arch/arm/mach-tegra/tegra.c:165:13: error: 'tegra_pmc_restart' undeclared here (not in a function)
>   .restart = tegra_pmc_restart,
>              ^
> make[3]: *** [arch/arm/mach-tegra/tegra.o] Error 1
> 
> when CONFIG_PM_SLEEP is disabled, and also this one when SMP is
> turned on in addition:
> 
> 
> /git/arm-soc/arch/arm/mach-tegra/platsmp.c: In function 'tegra30_boot_secondary':
> /git/arm-soc/arch/arm/mach-tegra/platsmp.c:97:4: error: implicit declaration of function 'tegra_pmc_cpu_is_powered' [-Werror=implicit-function-declaration]
>     if (tegra_pmc_cpu_is_powered(cpu))
>     ^
> /git/arm-soc/arch/arm/mach-tegra/platsmp.c:110:3: error: implicit declaration of function 'tegra_pmc_cpu_power_on' [-Werror=implicit-function-declaration]
>    ret = tegra_pmc_cpu_power_on(cpu);
>    ^
> /git/arm-soc/arch/arm/mach-tegra/platsmp.c:129:2: error: implicit declaration of function 'tegra_pmc_cpu_remove_clamping' [-Werror=implicit-function-declaration]
>   ret = tegra_pmc_cpu_remove_clamping(cpu);
>   ^
> cc1: some warnings being treated as errors
> 
> I applied this hack locally to work around that:
> 
> diff --git a/include/linux/tegra-soc.h b/include/linux/tegra-soc.h
> index 70a612442cda..a89fe9e588ac 100644
> --- a/include/linux/tegra-soc.h
> +++ b/include/linux/tegra-soc.h
> @@ -73,7 +73,6 @@ enum tegra_suspend_mode {
>  	TEGRA_MAX_SUSPEND_MODE,
>  };
>  
> -#ifdef CONFIG_PM_SLEEP
>  enum tegra_suspend_mode tegra_pmc_get_suspend_mode(void);
>  void tegra_pmc_set_suspend_mode(enum tegra_suspend_mode mode);
>  void tegra_pmc_enter_suspend_mode(enum tegra_suspend_mode mode);
> @@ -83,7 +82,6 @@ int tegra_pmc_cpu_power_on(int cpuid);
>  int tegra_pmc_cpu_remove_clamping(int cpuid);
>  
>  void tegra_pmc_restart(enum reboot_mode mode, const char *cmd);
> -#endif
>  
>  /*
>   * PM

I pushed fixes for these to Tegra's for-next branch (and for-3.17/soc).

> 
> > > On a more general note, why are you adding this stuff into a global
> > > header file in the first place? All users are in the same directory
> > > in which the functions are defined.
> > 
> > That's mostly preparatory work. We'll need to move tegra-pmc.c out of
> > arch/arm/mach-tegra at some point. I've proposed two patches already to
> > do that, one move the driver to drivers/soc/tegra and was massively
> > NAK'ed (I'm still not sure I agree) and people requested that this be
> > moved into drivers/power. I then posted a 2 patch series to move power
> > supply drivers into a subdirectory (drivers/power/supply) so that
> > drivers in drivers/power didn't have to depend on CONFIG_POWER_SUPPLY
> > for no good reason.
> > 
> > The latter series didn't receive any comments whatsoever in over a week,
> > so in order to keep things moving forward I respun the PMC patch to do
> > the conversion without moving the code out of arch/arm/mach-tegra yet.
> > That way moving the driver out of arch/arm/mach-tegra will be a simple
> > matter of moving and the rework will already be done. You were Cc'ed on
> > the second series, so if you want to take a look (and maybe help get
> > things moving) the patches are called:
> > 
> > 	[PATCH 0/2] Restructure driver/power and add Tegra PMC driver
> > 	[PATCH 1/2] power: Move power-supply drivers to subdirectory
> > 	[PATCH 2/2] ARM: tegra: Convert PMC to a driver
> 
> Ok, I'll have a look. I think when this becomes a separate driver, it
> should also have its own header file, so maybe you can in the meantime
> make it a local header file in mach-tegra until we have found a good
> place for it.

Why do you think it should be a separate header? We already have a
couple in include/linux and I'm not sure it's useful to add even more.
If anything I would've thought it made sense to move the content of the
other headers into tegra-soc.h.

Thierry

[-- Attachment #2: Type: application/pgp-signature, Size: 819 bytes --]

WARNING: multiple messages have this Message-ID (diff)
From: thierry.reding@gmail.com (Thierry Reding)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 12/12] ARM: tegra: Convert PMC to a driver
Date: Wed, 16 Jul 2014 17:14:29 +0200	[thread overview]
Message-ID: <20140716151427.GA22027@ulmo> (raw)
In-Reply-To: <17053542.QUGvfkeRmc@wuerfel>

On Wed, Jul 16, 2014 at 04:12:29PM +0200, Arnd Bergmann wrote:
> On Wednesday 16 July 2014 15:22:41 Thierry Reding wrote:
> > On Wed, Jul 16, 2014 at 01:56:44PM +0200, Arnd Bergmann wrote:
> > > On Friday 11 July 2014, Thierry Reding wrote:
> > > > +/*
> > > > + * PMC
> > > > + */
> > > > +enum tegra_suspend_mode {
> > > > +       TEGRA_SUSPEND_NONE = 0,
> > > > +       TEGRA_SUSPEND_LP2, /* CPU voltage off */
> > > > +       TEGRA_SUSPEND_LP1, /* CPU voltage off, DRAM self-refresh */
> > > > +       TEGRA_SUSPEND_LP0, /* CPU + core voltage off, DRAM self-refresh */
> > > > +       TEGRA_MAX_SUSPEND_MODE,
> > > > +};
> > > > +
> > > > +#ifdef CONFIG_PM_SLEEP
> > > > +enum tegra_suspend_mode tegra_pmc_get_suspend_mode(void);
> > > > +void tegra_pmc_set_suspend_mode(enum tegra_suspend_mode mode);
> > > > +void tegra_pmc_enter_suspend_mode(enum tegra_suspend_mode mode);
> > > > +
> > > > +bool tegra_pmc_cpu_is_powered(int cpuid);
> > > > +int tegra_pmc_cpu_power_on(int cpuid);
> > > > +int tegra_pmc_cpu_remove_clamping(int cpuid);
> > > > +
> > > > +void tegra_pmc_restart(enum reboot_mode mode, const char *cmd);
> > > > +#endif
> > > > +
> > > > +/*
> > > 
> > > This part is causing multiple build failures in the randconfig tests.
> > > You can avoid them by removing the #ifdef.
> > 
> > How is this causing build failures? I only see them used wherever
> > CONFIG_PM_SLEEP is defined.
> > 
> > Although I guess tegra-pmc.c could cause sparse warnings since it
> > implements these functions regardless of CONFIG_PM_SLEEP, which probably
> > is the bug that should be fixed.
> > 
> > Do you have a randconfig that I can use to reproduce this and come up
> > with a fix?
> 
> I got this error (always):
> 
> /git/arm-soc/arch/arm/mach-tegra/tegra.c:165:13: error: 'tegra_pmc_restart' undeclared here (not in a function)
>   .restart = tegra_pmc_restart,
>              ^
> make[3]: *** [arch/arm/mach-tegra/tegra.o] Error 1
> 
> when CONFIG_PM_SLEEP is disabled, and also this one when SMP is
> turned on in addition:
> 
> 
> /git/arm-soc/arch/arm/mach-tegra/platsmp.c: In function 'tegra30_boot_secondary':
> /git/arm-soc/arch/arm/mach-tegra/platsmp.c:97:4: error: implicit declaration of function 'tegra_pmc_cpu_is_powered' [-Werror=implicit-function-declaration]
>     if (tegra_pmc_cpu_is_powered(cpu))
>     ^
> /git/arm-soc/arch/arm/mach-tegra/platsmp.c:110:3: error: implicit declaration of function 'tegra_pmc_cpu_power_on' [-Werror=implicit-function-declaration]
>    ret = tegra_pmc_cpu_power_on(cpu);
>    ^
> /git/arm-soc/arch/arm/mach-tegra/platsmp.c:129:2: error: implicit declaration of function 'tegra_pmc_cpu_remove_clamping' [-Werror=implicit-function-declaration]
>   ret = tegra_pmc_cpu_remove_clamping(cpu);
>   ^
> cc1: some warnings being treated as errors
> 
> I applied this hack locally to work around that:
> 
> diff --git a/include/linux/tegra-soc.h b/include/linux/tegra-soc.h
> index 70a612442cda..a89fe9e588ac 100644
> --- a/include/linux/tegra-soc.h
> +++ b/include/linux/tegra-soc.h
> @@ -73,7 +73,6 @@ enum tegra_suspend_mode {
>  	TEGRA_MAX_SUSPEND_MODE,
>  };
>  
> -#ifdef CONFIG_PM_SLEEP
>  enum tegra_suspend_mode tegra_pmc_get_suspend_mode(void);
>  void tegra_pmc_set_suspend_mode(enum tegra_suspend_mode mode);
>  void tegra_pmc_enter_suspend_mode(enum tegra_suspend_mode mode);
> @@ -83,7 +82,6 @@ int tegra_pmc_cpu_power_on(int cpuid);
>  int tegra_pmc_cpu_remove_clamping(int cpuid);
>  
>  void tegra_pmc_restart(enum reboot_mode mode, const char *cmd);
> -#endif
>  
>  /*
>   * PM

I pushed fixes for these to Tegra's for-next branch (and for-3.17/soc).

> 
> > > On a more general note, why are you adding this stuff into a global
> > > header file in the first place? All users are in the same directory
> > > in which the functions are defined.
> > 
> > That's mostly preparatory work. We'll need to move tegra-pmc.c out of
> > arch/arm/mach-tegra at some point. I've proposed two patches already to
> > do that, one move the driver to drivers/soc/tegra and was massively
> > NAK'ed (I'm still not sure I agree) and people requested that this be
> > moved into drivers/power. I then posted a 2 patch series to move power
> > supply drivers into a subdirectory (drivers/power/supply) so that
> > drivers in drivers/power didn't have to depend on CONFIG_POWER_SUPPLY
> > for no good reason.
> > 
> > The latter series didn't receive any comments whatsoever in over a week,
> > so in order to keep things moving forward I respun the PMC patch to do
> > the conversion without moving the code out of arch/arm/mach-tegra yet.
> > That way moving the driver out of arch/arm/mach-tegra will be a simple
> > matter of moving and the rework will already be done. You were Cc'ed on
> > the second series, so if you want to take a look (and maybe help get
> > things moving) the patches are called:
> > 
> > 	[PATCH 0/2] Restructure driver/power and add Tegra PMC driver
> > 	[PATCH 1/2] power: Move power-supply drivers to subdirectory
> > 	[PATCH 2/2] ARM: tegra: Convert PMC to a driver
> 
> Ok, I'll have a look. I think when this becomes a separate driver, it
> should also have its own header file, so maybe you can in the meantime
> make it a local header file in mach-tegra until we have found a good
> place for it.

Why do you think it should be a separate header? We already have a
couple in include/linux and I'm not sure it's useful to add even more.
If anything I would've thought it made sense to move the content of the
other headers into tegra-soc.h.

Thierry
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20140716/1f01ff94/attachment.sig>

  reply	other threads:[~2014-07-16 15:14 UTC|newest]

Thread overview: 76+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-11 12:15 [PATCH 00/12] Add NVIDIA Tegra FUSE driver Thierry Reding
2014-07-11 12:15 ` Thierry Reding
2014-07-11 12:16 ` [PATCH 02/12] ARM: tegra: Use a function to get the chip ID Thierry Reding
2014-07-11 12:16   ` Thierry Reding
2014-07-11 12:16 ` [PATCH 05/12] soc/tegra: Add efuse driver for Tegra Thierry Reding
2014-07-11 12:16   ` Thierry Reding
     [not found]   ` <1405080971-7609-6-git-send-email-thierry.reding-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2014-10-19  3:12     ` Shawn Guo
2014-10-19  3:12       ` Shawn Guo
2014-11-10 15:10       ` Thierry Reding
2014-11-10 15:10         ` Thierry Reding
     [not found] ` <1405080971-7609-1-git-send-email-thierry.reding-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2014-07-11 12:16   ` [PATCH 01/12] ARM: tegra: Sort includes alphabetically Thierry Reding
2014-07-11 12:16     ` Thierry Reding
2014-07-11 12:16   ` [PATCH 03/12] ARM: tegra: export apb dma readl/writel Thierry Reding
2014-07-11 12:16     ` Thierry Reding
2014-07-11 12:16   ` [PATCH 04/12] ARM: tegra: move fuse exports to tegra-soc.h Thierry Reding
2014-07-11 12:16     ` Thierry Reding
2014-07-11 12:16   ` [PATCH 06/12] soc/tegra: Add efuse and apbmisc bindings Thierry Reding
2014-07-11 12:16     ` Thierry Reding
2014-07-11 12:16   ` [PATCH 07/12] soc/tegra: fuse: move APB DMA into Tegra20 fuse driver Thierry Reding
2014-07-11 12:16     ` Thierry Reding
2014-07-11 12:16   ` [PATCH 08/12] misc: fuse: fix dummy functions Thierry Reding
2014-07-11 12:16     ` Thierry Reding
2014-07-11 12:16   ` [PATCH 09/12] ARM: tegra: Setup CPU hotplug in a pure initcall Thierry Reding
2014-07-11 12:16     ` Thierry Reding
2014-07-11 12:16   ` [PATCH 10/12] ARM: tegra: Always lock the CPU reset vector Thierry Reding
2014-07-11 12:16     ` Thierry Reding
2014-07-11 12:16   ` [PATCH 11/12] soc/tegra: fuse: Set up in early initcall Thierry Reding
2014-07-11 12:16     ` Thierry Reding
2014-07-11 12:16   ` [PATCH 12/12] ARM: tegra: Convert PMC to a driver Thierry Reding
2014-07-11 12:16     ` Thierry Reding
     [not found]     ` <1405080971-7609-13-git-send-email-thierry.reding-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2014-07-11 13:58       ` Peter De Schrijver
2014-07-11 13:58         ` Peter De Schrijver
     [not found]         ` <20140711135800.GD23218-Rysk9IDjsxmJz7etNGeUX8VPkgjIgRvpAL8bYrjMMd8@public.gmane.org>
2014-07-14  8:06           ` Thierry Reding
2014-07-14  8:06             ` Thierry Reding
2014-07-16 11:56       ` Arnd Bergmann
2014-07-16 11:56         ` Arnd Bergmann
     [not found]         ` <201407161356.44693.arnd-r2nGTMty4D4@public.gmane.org>
2014-07-16 13:22           ` Thierry Reding
2014-07-16 13:22             ` Thierry Reding
2014-07-16 14:12             ` Arnd Bergmann
2014-07-16 14:12               ` Arnd Bergmann
2014-07-16 15:14               ` Thierry Reding [this message]
2014-07-16 15:14                 ` Thierry Reding
2014-07-16 15:22                 ` Arnd Bergmann
2014-07-16 15:22                   ` Arnd Bergmann
2014-07-16 18:57                   ` Thierry Reding
2014-07-16 18:57                     ` Thierry Reding
2014-07-16 19:34                     ` Olof Johansson
2014-07-16 19:34                       ` Olof Johansson
     [not found]                       ` <CAOesGMi=UrLS3OuFb9SAaf9dPBojYrqp4VE0YhGiX1hkLvYanw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2014-07-17  8:54                         ` Arnd Bergmann
2014-07-17  8:54                           ` Arnd Bergmann
2014-07-17 11:06                           ` Thierry Reding
2014-07-17 11:06                             ` Thierry Reding
2014-07-21 12:06                             ` Arnd Bergmann
2014-07-21 12:06                               ` Arnd Bergmann
2014-07-21 13:12                               ` Thierry Reding
2014-07-21 13:12                                 ` Thierry Reding
2014-07-21 13:16                                 ` Tejun Heo
2014-07-21 13:16                                   ` Tejun Heo
     [not found]                                   ` <20140721131619.GE12921-Gd/HAXX7CRxy/B6EtB590w@public.gmane.org>
2014-07-21 13:39                                     ` Thierry Reding
2014-07-21 13:39                                       ` Thierry Reding
2014-07-17  8:53                     ` Peter De Schrijver
2014-07-17  8:53                       ` Peter De Schrijver
2014-07-17  9:01                       ` Peter De Schrijver
2014-07-17  9:01                         ` Peter De Schrijver
     [not found]                         ` <20140717090156.GR23218-Rysk9IDjsxmJz7etNGeUX8VPkgjIgRvpAL8bYrjMMd8@public.gmane.org>
2014-07-17 11:01                           ` Thierry Reding
2014-07-17 11:01                             ` Thierry Reding
2014-07-21  7:09                             ` Vince Hsu
2014-07-21  7:09                               ` Vince Hsu
     [not found]                               ` <53CCBCA9.7020907-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2014-07-21  9:02                                 ` Thierry Reding
2014-07-21  9:02                                   ` Thierry Reding
2014-07-22  3:34                                   ` Vince Hsu
2014-07-22  3:34                                     ` Vince Hsu
2014-07-13  6:38   ` [PATCH 00/12] Add NVIDIA Tegra FUSE driver Olof Johansson
2014-07-13  6:38     ` Olof Johansson
     [not found]     ` <20140713063815.GA24843-O5ziIzlqnXUVNXGz7ipsyg@public.gmane.org>
2014-07-14  6:57       ` Thierry Reding
2014-07-14  6:57         ` Thierry Reding

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=20140716151427.GA22027@ulmo \
    --to=thierry.reding-re5jqeeqqe8avxtiumwx3w@public.gmane.org \
    --cc=arnd-r2nGTMty4D4@public.gmane.org \
    --cc=linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org \
    --cc=linux-tegra-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=olof-nZhT3qVonbNeoWH0uzbU5w@public.gmane.org \
    --cc=swarren-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.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.