[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20131220195527.GA25927@amd.pavel.ucw.cz>
Date: Fri, 20 Dec 2013 20:55:27 +0100
From: Pavel Machek <pavel@....cz>
To: David Cohen <david.a.cohen@...ux.intel.com>
Cc: rjw@...ysocki.net, len.brown@...el.com,
sarah.a.sharp@...ux.intel.com, gregkh@...uxfoundation.org,
linux-pm@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-usb@...r.kernel.org, santosh.shilimkar@...com
Subject: Re: [RFC/PATCH 1/3] pm: make PM macros more smart
On Sun 2013-12-15 11:25:08, David Cohen wrote:
> On Sun, Dec 15, 2013 at 06:51:12PM +0100, Pavel Machek wrote:
> > On Thu 2013-12-12 21:18:23, David Cohen wrote:
> > > This patch makes SET_SYSTEM_SLEEP_PM_OPS() and SET_RUNTIME_PM_OPS() more
> > > smart.
> > >
> > > Despite those macros check for '#ifdef CONFIG_PM_SLEEP/RUNTIME' to avoid
> > > setting the callbacks when such #ifdef's aren't defined, they don't
> > > handle compiler to avoid messages like that:
> > >
> > > drivers/usb/host/xhci-plat.c:200:12: warning: ???xhci_plat_suspend??? defined but not used [-Wunused-function]
> > > drivers/usb/host/xhci-plat.c:208:12: warning: ???xhci_plat_resume??? defined but not used [-Wunused-function]
> > >
> > > As result, those macros get rid of #ifdef's when setting callbacks but
> > > not when implementing them.
> > >
> > > With this patch, drivers using SET_*_PM_OPS() macros don't need to #ifdef
> > > the callbacks implementation as well.
> >
> > Well... Interesting trickery, but it means that resulting kernel
> > will be bigge due to the dead functions no?
>
> Actually, it doesn't get bigger. Before sending the patch I did this
> dummy test app:
>
> --------------------------------------------------------------------------------
> #include <stdio.h>
>
> #define USE_IT_OR_LOOSE_IT(fn) ((void *)((unsigned long)(fn) - (unsigned long)(fn)))
>
> #ifdef MAKE_ME_NULL
> static int func1(int a)
> {
> printf("Hey!!\n");
> return 0;
> }
> #endif
I thought that point of this patch series was getting rid of the
#ifdefs around the function...? Now I'm confused.
> struct global_data {
> int (*func)(int);
> };
>
> static struct global_data gd = {
> #ifdef MAKE_ME_NULL
> .func = USE_IT_OR_LOOSE_IT(func1),
If you have ifdef around the function, why do you need magic here? Why
not
.func = func1
?
Basically the warning tells you that you want the ifdef around the
function, too... (Otherwise you waste space). That seems like good
warning.
Pavel
--
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists