From: s.hauer@pengutronix.de (Sascha Hauer)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 1/3] ARM: imx: Add common imx cpuidle init functionality.
Date: Tue, 17 Apr 2012 09:43:01 +0200 [thread overview]
Message-ID: <20120417074301.GM20478@pengutronix.de> (raw)
In-Reply-To: <1334620214-25803-2-git-send-email-rob.lee@linaro.org>
On Mon, Apr 16, 2012 at 06:50:12PM -0500, Robert Lee wrote:
> Add common cpuidle init functionality that can be used by various
> imx platforms.
>
> Signed-off-by: Robert Lee <rob.lee@linaro.org>
> ---
> diff --git a/arch/arm/plat-mxc/Makefile b/arch/arm/plat-mxc/Makefile
> index e81290c..7c9e05f 100644
> --- a/arch/arm/plat-mxc/Makefile
> +++ b/arch/arm/plat-mxc/Makefile
> @@ -16,6 +16,8 @@ obj-$(CONFIG_MXC_ULPI) += ulpi.o
> obj-$(CONFIG_MXC_USE_EPIT) += epit.o
> obj-$(CONFIG_MXC_DEBUG_BOARD) += 3ds_debugboard.o
> obj-$(CONFIG_CPU_FREQ_IMX) += cpufreq.o
> +obj-$(CONFIG_CPU_IDLE) += cpuidle.o
> +
> ifdef CONFIG_SND_IMX_SOC
> obj-y += ssi-fiq.o
> obj-y += ssi-fiq-ksym.o
> diff --git a/arch/arm/plat-mxc/cpuidle.c b/arch/arm/plat-mxc/cpuidle.c
> new file mode 100644
> index 0000000..d1c9301
> --- /dev/null
> +++ b/arch/arm/plat-mxc/cpuidle.c
> @@ -0,0 +1,89 @@
> +/*
> + * Copyright 2012 Freescale Semiconductor, Inc.
> + * Copyright 2012 Linaro Ltd.
> + *
> + * The code contained herein is licensed under the GNU General Public
> + * License. You may obtain a copy of the GNU General Public License
> + * Version 2 or later at the following locations:
> + *
> + * http://www.opensource.org/licenses/gpl-license.html
> + * http://www.gnu.org/copyleft/gpl.html
> + */
> +
> +#include <linux/kernel.h>
> +#include <linux/io.h>
> +#include <linux/cpuidle.h>
> +#include <linux/hrtimer.h>
> +#include <linux/err.h>
> +#include <linux/slab.h>
> +
> +static struct cpuidle_device __percpu * imx_cpuidle_devices;
> +static struct cpuidle_driver *drv;
> +
> +void __init imx_cpuidle_set_driver(struct cpuidle_driver *p)
> +{
> + drv = p;
> +}
You like it complicated, eh? Why do you introduce a function which sets
a variable...
> +
> +void imx_cpuidle_devices_uninit(void)
> +{
> + int cpu_id;
> + struct cpuidle_device *dev;
> +
> + for_each_possible_cpu(cpu_id) {
> + dev = per_cpu_ptr(imx_cpuidle_devices, cpu_id);
> + cpuidle_unregister_device(dev);
> + }
> +
> + free_percpu(imx_cpuidle_devices);
> +}
> +
> +static int __init imx_cpuidle_init(void)
... instead of passing it directly to the function which uses it?
> +{
> + struct cpuidle_device *dev;
> + int cpu_id, ret;
> +
> + if (!drv || drv->state_count > CPUIDLE_STATE_MAX) {
> + pr_err("%s: Invalid Input\n", __func__);
You introduce a pointless error message on SoCs not setting a cpuidle
driver. When will people learn that initcalls do not only run on
machines they have on their desk?
> + return -EINVAL;
> + }
> +
> + ret = cpuidle_register_driver(drv);
> +
> + if (ret) {
> + pr_err("%s: Failed to register cpuidle driver\n", __func__);
It's always nice to add the return value to the error message to get a
clue *what* went wrong. The function name though is rather
uninteresting.
Sascha
--
Pengutronix e.K. | |
Industrial Linux Solutions | http://www.pengutronix.de/ |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
WARNING: multiple messages have this Message-ID (diff)
From: Sascha Hauer <s.hauer@pengutronix.de>
To: Robert Lee <rob.lee@linaro.org>
Cc: kernel@pengutronix.de, linaro-dev@lists.linaro.org,
patches@linaro.org, daniel.lezcano@linaro.org,
linux-kernel@vger.kernel.org, amit.kucheria@linaro.org,
shawn.guo@linaro.org, linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH 1/3] ARM: imx: Add common imx cpuidle init functionality.
Date: Tue, 17 Apr 2012 09:43:01 +0200 [thread overview]
Message-ID: <20120417074301.GM20478@pengutronix.de> (raw)
In-Reply-To: <1334620214-25803-2-git-send-email-rob.lee@linaro.org>
On Mon, Apr 16, 2012 at 06:50:12PM -0500, Robert Lee wrote:
> Add common cpuidle init functionality that can be used by various
> imx platforms.
>
> Signed-off-by: Robert Lee <rob.lee@linaro.org>
> ---
> diff --git a/arch/arm/plat-mxc/Makefile b/arch/arm/plat-mxc/Makefile
> index e81290c..7c9e05f 100644
> --- a/arch/arm/plat-mxc/Makefile
> +++ b/arch/arm/plat-mxc/Makefile
> @@ -16,6 +16,8 @@ obj-$(CONFIG_MXC_ULPI) += ulpi.o
> obj-$(CONFIG_MXC_USE_EPIT) += epit.o
> obj-$(CONFIG_MXC_DEBUG_BOARD) += 3ds_debugboard.o
> obj-$(CONFIG_CPU_FREQ_IMX) += cpufreq.o
> +obj-$(CONFIG_CPU_IDLE) += cpuidle.o
> +
> ifdef CONFIG_SND_IMX_SOC
> obj-y += ssi-fiq.o
> obj-y += ssi-fiq-ksym.o
> diff --git a/arch/arm/plat-mxc/cpuidle.c b/arch/arm/plat-mxc/cpuidle.c
> new file mode 100644
> index 0000000..d1c9301
> --- /dev/null
> +++ b/arch/arm/plat-mxc/cpuidle.c
> @@ -0,0 +1,89 @@
> +/*
> + * Copyright 2012 Freescale Semiconductor, Inc.
> + * Copyright 2012 Linaro Ltd.
> + *
> + * The code contained herein is licensed under the GNU General Public
> + * License. You may obtain a copy of the GNU General Public License
> + * Version 2 or later at the following locations:
> + *
> + * http://www.opensource.org/licenses/gpl-license.html
> + * http://www.gnu.org/copyleft/gpl.html
> + */
> +
> +#include <linux/kernel.h>
> +#include <linux/io.h>
> +#include <linux/cpuidle.h>
> +#include <linux/hrtimer.h>
> +#include <linux/err.h>
> +#include <linux/slab.h>
> +
> +static struct cpuidle_device __percpu * imx_cpuidle_devices;
> +static struct cpuidle_driver *drv;
> +
> +void __init imx_cpuidle_set_driver(struct cpuidle_driver *p)
> +{
> + drv = p;
> +}
You like it complicated, eh? Why do you introduce a function which sets
a variable...
> +
> +void imx_cpuidle_devices_uninit(void)
> +{
> + int cpu_id;
> + struct cpuidle_device *dev;
> +
> + for_each_possible_cpu(cpu_id) {
> + dev = per_cpu_ptr(imx_cpuidle_devices, cpu_id);
> + cpuidle_unregister_device(dev);
> + }
> +
> + free_percpu(imx_cpuidle_devices);
> +}
> +
> +static int __init imx_cpuidle_init(void)
... instead of passing it directly to the function which uses it?
> +{
> + struct cpuidle_device *dev;
> + int cpu_id, ret;
> +
> + if (!drv || drv->state_count > CPUIDLE_STATE_MAX) {
> + pr_err("%s: Invalid Input\n", __func__);
You introduce a pointless error message on SoCs not setting a cpuidle
driver. When will people learn that initcalls do not only run on
machines they have on their desk?
> + return -EINVAL;
> + }
> +
> + ret = cpuidle_register_driver(drv);
> +
> + if (ret) {
> + pr_err("%s: Failed to register cpuidle driver\n", __func__);
It's always nice to add the return value to the error message to get a
clue *what* went wrong. The function name though is rather
uninteresting.
Sascha
--
Pengutronix e.K. | |
Industrial Linux Solutions | http://www.pengutronix.de/ |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
next prev parent reply other threads:[~2012-04-17 7:43 UTC|newest]
Thread overview: 56+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-04-16 23:50 [PATCH 0/3] Add imx cpuidle Robert Lee
2012-04-16 23:50 ` Robert Lee
2012-04-16 23:50 ` [PATCH 1/3] ARM: imx: Add common imx cpuidle init functionality Robert Lee
2012-04-16 23:50 ` Robert Lee
2012-04-16 23:56 ` Jesper Juhl
2012-04-16 23:56 ` Jesper Juhl
2012-04-17 7:43 ` Sascha Hauer [this message]
2012-04-17 7:43 ` Sascha Hauer
2012-04-17 13:54 ` Rob Lee
2012-04-17 13:54 ` Rob Lee
2012-04-17 14:13 ` Christian Robottom Reis
2012-04-17 14:13 ` Christian Robottom Reis
2012-04-17 14:32 ` Rob Lee
2012-04-17 14:32 ` Rob Lee
2012-04-17 17:42 ` Sascha Hauer
2012-04-17 17:42 ` Sascha Hauer
2012-04-17 19:32 ` Rob Lee
2012-04-17 19:32 ` Rob Lee
2012-04-19 4:18 ` Rob Lee
2012-04-19 4:18 ` Rob Lee
2012-04-19 6:43 ` Sascha Hauer
2012-04-19 6:43 ` Sascha Hauer
2012-04-20 2:08 ` Shawn Guo
2012-04-20 2:08 ` Shawn Guo
2012-04-23 4:44 ` Rob Lee
2012-04-23 4:44 ` Rob Lee
2012-04-23 5:18 ` Shawn Guo
2012-04-23 5:18 ` Shawn Guo
2012-04-23 6:27 ` Sascha Hauer
2012-04-23 6:27 ` Sascha Hauer
2012-04-23 6:53 ` Shawn Guo
2012-04-23 6:53 ` Shawn Guo
2012-04-23 6:56 ` Sascha Hauer
2012-04-23 6:56 ` Sascha Hauer
2012-04-23 7:10 ` Shawn Guo
2012-04-23 7:10 ` Shawn Guo
2012-04-23 7:48 ` Sascha Hauer
2012-04-23 7:48 ` Sascha Hauer
2012-04-23 15:45 ` Rob Lee
2012-04-23 15:45 ` Rob Lee
2012-04-24 1:38 ` Shawn Guo
2012-04-24 1:38 ` Shawn Guo
2012-04-24 7:54 ` Russell King - ARM Linux
2012-04-24 7:54 ` Russell King - ARM Linux
2012-04-24 8:36 ` Shawn Guo
2012-04-24 8:36 ` Shawn Guo
2012-04-24 15:40 ` Rob Lee
2012-04-24 15:40 ` Rob Lee
2012-04-24 19:51 ` Russell King - ARM Linux
2012-04-24 19:51 ` Russell King - ARM Linux
2012-04-25 2:06 ` Shawn Guo
2012-04-25 2:06 ` Shawn Guo
2012-04-16 23:50 ` [PATCH 2/3] ARM: imx: Add imx5 cpuidle driver Robert Lee
2012-04-16 23:50 ` Robert Lee
2012-04-16 23:50 ` [PATCH 3/3] ARM: imx: Add imx6q " Robert Lee
2012-04-16 23:50 ` Robert Lee
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=20120417074301.GM20478@pengutronix.de \
--to=s.hauer@pengutronix.de \
--cc=linux-arm-kernel@lists.infradead.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.