public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Deepthi Dharwar <deepthi@linux.vnet.ibm.com>
To: Robert Lee <rob.lee@linaro.org>
Cc: rjw@sisk.pl, len.brown@intel.com, hpa@linux.intel.com,
	daniel.lezcano@linaro.org, amit.kucheria@linaro.org,
	linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org,
	patches@linaro.org
Subject: Re: [PATCH] pm: remove useless array definition in cpuidle_structure
Date: Fri, 04 Nov 2011 17:51:18 +0530	[thread overview]
Message-ID: <4EB3D8BE.7050600@linux.vnet.ibm.com> (raw)
In-Reply-To: <1320356693-18982-1-git-send-email-rob.lee@linaro.org>

On Friday 04 November 2011 03:14 AM, Robert Lee wrote:
> From: Daniel Lezcano <daniel.lezcano@linaro.org>
> 
> All the modules name are ro-data, it is never copied to the array.
> 
> eg.
> 
> static struct cpuidle_driver intel_idle_driver = {
>         .name = "intel_idle",
>         .owner = THIS_MODULE,
> };
> 
> It safe to assign the pointer of this ro-data to a const char *.
> By this way we save 12 bytes.
> 
> Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
> Signed-off-by: Robert Lee <rob.lee@linaro.org>
> ---
>  include/linux/cpuidle.h |    4 ++--
>  1 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/include/linux/cpuidle.h b/include/linux/cpuidle.h
> index b51629e..16f9dce 100644
> --- a/include/linux/cpuidle.h
> +++ b/include/linux/cpuidle.h
> @@ -117,8 +117,8 @@ static inline int cpuidle_get_last_residency(struct cpuidle_device *dev)
>   ****************************/
> 
>  struct cpuidle_driver {
> -	char			name[CPUIDLE_NAME_LEN];
> -	struct module 		*owner;
> +	const char    *name;
> +	struct module *owner;
>  };
> 
>  #ifdef CONFIG_CPU_IDLE

This looks good, and makes it fool-proof by  not allowing one to tamper the name of the driver.
Tested OK on x86 (both Intel idle and ACPI)

Tested-by: Deepthi Dharwar <deepthi@linux.vnet.ibm.com>
Reviewed-by: Deepthi Dharwar <deepthi@linux.vnet.ibm.com>


  reply	other threads:[~2011-11-04 12:21 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-11-03 21:44 [PATCH] pm: remove useless array definition in cpuidle_structure Robert Lee
2011-11-04 12:21 ` Deepthi Dharwar [this message]
2011-11-04 22:28   ` Rafael J. Wysocki
2011-11-07 18:59     ` Daniel Lezcano

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=4EB3D8BE.7050600@linux.vnet.ibm.com \
    --to=deepthi@linux.vnet.ibm.com \
    --cc=amit.kucheria@linaro.org \
    --cc=daniel.lezcano@linaro.org \
    --cc=hpa@linux.intel.com \
    --cc=len.brown@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=patches@linaro.org \
    --cc=rjw@sisk.pl \
    --cc=rob.lee@linaro.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