[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <200905082036.26204.dmitry.torokhov@gmail.com>
Date: Fri, 8 May 2009 20:36:25 -0700
From: Dmitry Torokhov <dmitry.torokhov@...il.com>
To: Kim Kyuwon <chammoru@...il.com>
Cc: Kim Kyuwon <q1.kim@...sung.com>,
LKML <linux-kernel@...r.kernel.org>, linux-input@...r.kernel.org,
Kyungmin Park <kyungmin.park@...sung.com>,
Marek Szyprowski <m.szyprowski@...sung.com>
Subject: Re: Input: add MAX7359 key switch controller driver
Hi Kim,
On Friday 08 May 2009 18:58:45 Kim Kyuwon wrote:
> By the way, can I ask the same question which I ask to Trilok.
> Even though I guard suspend/resume with #ifdef CONFIG_PM in the new
> patch, Could I know the good reason for this protection? Because
> '/Documentation/SubmittingPatches' says "ifdefs are ugly"
If kernel is compiled without CONFIG_PM then these functions would
be just dead weight. Generally speaking, #ifdefs are considered ugly
if they are in the middle of function code, affecting logic. But to
to compile out unneeded functionality they are OK. That's why you
often see in the kernel
#ifdef CONFIG_BAZ
void do_baz()
{
.. real code ..
}
#else
void do_baz()
{
}
#endif
and then...
int foo()
{
bar1();
bar2();
do_baz();
bar3();
}
As you can see, foo()'s logic stays the same, there are no #ifdefs
cluttering it, but baz code either executed or not.
Hope this helps.
--
Dmitry
--
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