LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Anton Vorontsov <cbouatmailru@gmail.com>
To: Arjan van de Ven <arjan@infradead.org>
Cc: linux-kernel@vger.kernel.org, linux-pm@lists.linux-foundation.org
Subject: Re: [PATCH RFC] introduce pm_call() macro to get rid of most #ifdef CONFIG_PM
Date: Tue, 4 Mar 2008 02:26:58 +0300	[thread overview]
Message-ID: <20080303232658.GB27395@zarina> (raw)
In-Reply-To: <20080302160820.1930a770@laptopd505.fenrus.org>

On Sun, Mar 02, 2008 at 04:08:20PM -0800, Arjan van de Ven wrote:
> On Mon, 3 Mar 2008 02:43:08 +0300
> Anton Vorontsov <cbouatmailru@gmail.com> wrote:
> 
> > Currently drivers handle CONFIG_PM this way:
> > 
> > #ifdef CONFIG_PM
> > drv_suspend() {}
> > drv_resume() {}
> > #else
> > #define drv_suspend NULL
> > #define drv_resume NULL
> > #endif
> > 
> > struct driver drv = {
> > 	.suspend = drv_suspend,
> > 	.resume = drv_resume,
> > };
> > 
> > With this patch, the code above converts into:
> > 
> > drv_suspend() {}
> > drv_resume() {}
> > 
> > struct driver drv = {
> > 	.suspend = pm_call(drv_suspend),
> > 	.resume = pm_call(drv_resume),
> > };
> > 
> > GCC will optimize away suspend/resume calls if they're really
> > not used.
> > 
> 
> 
> to be honest, at this point I would think it's time to remove
> CONFIG_PM, or rather,
> just make it always be there and just get rid of the ifdefs.

Don't be so CONFIG_PM-centric :-)

$ zcat /proc/config.gz | grep CONFIG_PM
# CONFIG_PM is not set

This is machine I use at home.

> We're saving 2 words and a bit of code,
> but only a case that not even the embedded guys use. 

Well, on my ARM machine, with CONFIG_PM=y vmlinux grows by 30KB, half
of that is in drivers/. 30KB is 1% of the vmlinux. Is it enough to
worth saving? I don't know.

On a x86 box, CONFIG_PM=y grows the vmlinux by 400KB (yeah, it's
including ACPI and stuff), though here I didn't count drivers'
suspend/resume hooks contribution share.

-- 
Anton Vorontsov
email: cbouatmailru@gmail.com
irc://irc.freenode.net/bd2

  parent reply	other threads:[~2008-03-03 23:48 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-03-02 23:43 Anton Vorontsov
2008-03-03  0:08 ` Arjan van de Ven
2008-03-03  0:29   ` Rafael J. Wysocki
2008-03-03 23:26   ` Anton Vorontsov [this message]
2008-03-03 14:18 ` Pavel Machek
2008-03-03 22:42   ` Anton Vorontsov
2008-03-03 22:56   ` [linux-pm] " David Brownell
2008-03-03 23:16     ` Pavel Machek

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=20080303232658.GB27395@zarina \
    --to=cbouatmailru@gmail.com \
    --cc=arjan@infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@lists.linux-foundation.org \
    --subject='Re: [PATCH RFC] introduce pm_call() macro to get rid of most #ifdef CONFIG_PM' \
    /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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).