From: Pavel Machek <pavel@ucw.cz>
To: David Cohen <david.a.cohen@linux.intel.com>
Cc: rjw@rjwysocki.net, len.brown@intel.com,
sarah.a.sharp@linux.intel.com, gregkh@linuxfoundation.org,
linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-usb@vger.kernel.org, santosh.shilimkar@ti.com
Subject: Re: [RFC/PATCH 1/3] pm: make PM macros more smart
Date: Fri, 20 Dec 2013 20:55:27 +0100 [thread overview]
Message-ID: <20131220195527.GA25927@amd.pavel.ucw.cz> (raw)
In-Reply-To: <20131215192508.GA10514@psi-dev26.jf.intel.com>
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
next prev parent reply other threads:[~2013-12-20 19:55 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-12-13 5:18 [RFC/PATCH 0/3] pm: Make SET_*_PM_OPS() macros more smart David Cohen
2013-12-13 5:18 ` [RFC/PATCH 1/3] pm: make PM " David Cohen
2013-12-15 17:51 ` Pavel Machek
2013-12-15 19:25 ` David Cohen
2013-12-20 19:55 ` Pavel Machek [this message]
2013-12-20 20:23 ` David Cohen
2014-01-14 22:42 ` David Cohen
2014-01-22 21:21 ` David Cohen
2013-12-13 5:18 ` [RFC/PATCH 2/3] usb/xhci: implement proper static inline stubs when !CONFIG_PM David Cohen
2013-12-13 5:18 ` [RFC/PATCH 3/3] usb/xhci-plat: remove unnecessary #ifdef checks for CONFIG_PM_SLEEP David Cohen
2013-12-13 8:19 ` Ulf Hansson
2013-12-13 15:46 ` David Cohen
[not found] ` <1386911905-2366-1-git-send-email-david.a.cohen-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
2013-12-19 5:12 ` [RFC/PATCH 0/3] pm: Make SET_*_PM_OPS() macros more smart David Cohen
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=20131220195527.GA25927@amd.pavel.ucw.cz \
--to=pavel@ucw.cz \
--cc=david.a.cohen@linux.intel.com \
--cc=gregkh@linuxfoundation.org \
--cc=len.brown@intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=rjw@rjwysocki.net \
--cc=santosh.shilimkar@ti.com \
--cc=sarah.a.sharp@linux.intel.com \
/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;
as well as URLs for NNTP newsgroup(s).