From: Lee Jones <lee.jones@linaro.org>
To: "Heiko Stübner" <heiko@sntech.de>
Cc: Jingoo Han <jg1.han@samsung.com>,
"'Bryan Wu'" <cooloney@gmail.com>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] backlight: use of_find_backlight_by_node stub when backlight class disabled
Date: Tue, 4 Nov 2014 17:15:32 +0000 [thread overview]
Message-ID: <20141104171532.GS17577@x1> (raw)
In-Reply-To: <28305505.Hd0ru0QyPE@diego>
On Tue, 04 Nov 2014, Heiko Stübner wrote:
> Am Dienstag, 4. November 2014, 14:42:20 schrieb Lee Jones:
> > On Tue, 04 Nov 2014, Jingoo Han wrote:
> > > On Tuesday, November 04, 2014 6:08 PM, Heiko Stübner wrote:
> > > > On Mon, 03 Nov 2014, Lee Jones wrote:
> > > > > On Wed, 29 Oct 2014, Heiko Stübner wrote:
> > > > > > Drivers may want to search for an optional backlight even when the
> > > > > > backlight class is disabled. In this case the linker would miss the
> > > > > > function referenced in the backlight header.
> > > > > >
> > > > > > Therefore use the stub function also when the backlight class is
> > > > > > disabled.
> > > > > >
> > > > > > Signed-off-by: Heiko Stuebner <heiko@sntech.de>
> > > > > > ---
> > > > > >
> > > > > > include/linux/backlight.h | 2 +-
> > > > > > 1 file changed, 1 insertion(+), 1 deletion(-)
> > > > >
> > > > > Applied to Backlight -next with Jingoo's Ack.
> > > >
> > > > I've removed this patch, as it causes unexpected:
> > > > Redefinition of of_find_backlight_by_node()
> > >
> > > I reproduced the same build error.
> > >
> > > Then, how about folding the following two patches into
> > > one single patch? These two patches were already sent by Heiko Stübner.
> > >
> > > [PATCH] backlight: use of_find_backlight_by_node stub when backlight
> > > class disabled [PATCH] backlight: extend of_find_backlight_by_node
> > > stub-check to modules>
> > > Then, the one single patch will do as follows.
> > >
> > > -#ifdef CONFIG_OF
> > > +#if defined(CONFIG_OF) && (defined(CONFIG_BACKLIGHT_CLASS_DEVICE) || \
> > > + defined(CONFIG_BACKLIGHT_CLASS_DEVICE_MODULE))
> > >
> > > In this case, I cannot find any build errors.
> >
> > That's a neat trick. I didn't know you could do that.
> >
> > However, it's bit messy consider different formatting, or a nested
> > #ifdef instead please.
>
> I guess it is a matter of me "not seeing the forrest for the trees", but how
> would a nested ifdef look like, as this would result in 3 possible results
> when for CONFIG_OF first and then for one of the BACKLIGHT_CLASS defines?
>
> Formatting wise, when applied both defined(CONFIG_BACKLIGHT_foo) parts
> are exactly below each other, making it (hopefully) clear where the "or" is
> part of. What would look better?
Actually there is a better way still:
#ifdef CONFIG_OF && IS_ENABLED(CONFIG_BACKLIGHT_CLASS_DEVICE)
struct backlight_device *of_find_backlight_by_node(struct device_node *node);
#else
static inline struct backlight_device *
of_find_backlight_by_node(struct device_node *node)
{
return NULL;
}
#endif
--
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
next prev parent reply other threads:[~2014-11-04 17:15 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-10-29 0:20 [PATCH] backlight: use of_find_backlight_by_node stub when backlight class disabled Heiko Stübner
2014-10-30 4:44 ` Jingoo Han
2014-11-03 17:17 ` Lee Jones
2014-11-04 9:07 ` Lee Jones
2014-11-04 10:18 ` Jingoo Han
2014-11-04 14:42 ` Lee Jones
2014-11-04 15:02 ` Heiko Stübner
2014-11-04 17:15 ` Lee Jones [this message]
2014-11-10 23:41 ` Heiko Stübner
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=20141104171532.GS17577@x1 \
--to=lee.jones@linaro.org \
--cc=cooloney@gmail.com \
--cc=heiko@sntech.de \
--cc=jg1.han@samsung.com \
--cc=linux-kernel@vger.kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.