From: Ingo Molnar <mingo@kernel.org>
To: David Herrmann <dh.herrmann@gmail.com>
Cc: linux-kernel@vger.kernel.org, "H. Peter Anvin" <hpa@zytor.com>,
Thomas Gleixner <tglx@linutronix.de>,
x86@kernel.org, linux-fbdev@vger.kernel.org,
stable@vger.kernel.org
Subject: Re: [PATCH v4] x86: sysfb: remove sysfb when probing real hw
Date: Thu, 19 Dec 2013 18:33:10 +0000 [thread overview]
Message-ID: <20131219183310.GF32508@gmail.com> (raw)
In-Reply-To: <1387473881-26179-1-git-send-email-dh.herrmann@gmail.com>
* David Herrmann <dh.herrmann@gmail.com> wrote:
> +/*
> + * Unregister the sysfb and prevent new sysfbs from getting registered. Can be
> + * called from any context except recursively or from sysfb_register().
> + * Used by remove_conflicting_framebuffers() and friends.
> + */
> +void sysfb_unregister(const struct apertures_struct *apert, bool primary)
> +{
> + mutex_lock(&sysfb_lock);
> + if (!IS_ERR(sysfb_dev) && sysfb_dev) {
> + if (sysfb_match(apert, primary)) {
> + platform_device_unregister(sysfb_dev);
> + sysfb_dev = ERR_PTR(-EALREADY);
> + }
> + } else {
> + /* if !sysfb_dev, set err so no new sysfb is probed later */
> + sysfb_dev = ERR_PTR(-EALREADY);
Just a small detail: we can get into this 'else' branch not just with
NULL, but also with IS_ERR(sysfb_dev). In that case we override
whatever error code is contained in sysfb_dev and overwrite it with
ERR_PTR(-EALREADY).
(Probably not a big deal, because we don't actually ever seem to
extract the error code from the pointer, but wanted to mention it.)
> +#ifdef CONFIG_X86_SYSFB
> +#include <asm/sysfb.h>
> +#endif
Pet peeve, this looks sexier:
#ifdef CONFIG_X86_SYSFB
# include <asm/sysfb.h>
#endif
> @@ -1604,6 +1607,17 @@ static void do_remove_conflicting_framebuffers(struct apertures_struct *a,
> }
> }
>
> +static void remove_conflicting_sysfb(const struct apertures_struct *apert,
> + bool primary)
> +{
> + if (!apert)
> + return;
> +
> +#ifdef CONFIG_X86_SYSFB
> + sysfb_unregister(apert, primary);
> +#endif
> +}
So why not make sysfb_unregister() accept a !apert parameter (it would
simply return), at which point remove_conflicting_sysfb() could be
eliminated and just be replaced with a direct sysfb_unregister() call
- with no #ifdefs.
We only need #ifdefs for the sysfb_unregister() declaration in the .h
file.
At first sight this looks simpler and cleaner for the fix itself - no
need for extra cleanups for this detail.
Thanks,
Ingo
next prev parent reply other threads:[~2013-12-19 18:33 UTC|newest]
Thread overview: 40+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-12-18 7:42 cirrusdrmfb broken with simplefb Takashi Iwai
2013-12-18 8:21 ` David Herrmann
2013-12-18 8:44 ` Takashi Iwai
2013-12-18 8:48 ` Geert Uytterhoeven
2013-12-18 10:17 ` Takashi Iwai
2013-12-18 10:21 ` David Herrmann
2013-12-18 11:39 ` Takashi Iwai
2013-12-18 11:48 ` [RFC] x86: sysfb: remove sysfb when probing real hw David Herrmann
2013-12-18 11:54 ` Ingo Molnar
2013-12-18 13:03 ` Takashi Iwai
2013-12-18 13:34 ` David Herrmann
2013-12-18 14:02 ` Takashi Iwai
2013-12-18 13:50 ` [PATCH v2] " David Herrmann
2013-12-18 14:15 ` David Herrmann
2013-12-18 14:21 ` Takashi Iwai
2013-12-19 10:13 ` [PATCH v3] " David Herrmann
2013-12-19 16:36 ` Ingo Molnar
2013-12-19 17:03 ` David Herrmann
2013-12-19 17:09 ` Ingo Molnar
2013-12-19 17:18 ` David Herrmann
2013-12-19 17:24 ` [PATCH v4] " David Herrmann
2013-12-19 18:33 ` Ingo Molnar [this message]
2013-12-20 14:46 ` David Herrmann
2013-12-19 18:54 ` [PATCH v3] " Stephen Warren
2013-12-19 18:55 ` Ingo Molnar
2013-12-19 19:09 ` Stephen Warren
2013-12-19 19:19 ` Ingo Molnar
2013-12-18 9:29 ` cirrusdrmfb broken with simplefb Ingo Molnar
2013-12-19 0:03 ` One Thousand Gnomes
2013-12-19 10:46 ` David Herrmann
2013-12-19 11:06 ` Takashi Iwai
2013-12-19 12:36 ` David Herrmann
2013-12-19 13:22 ` Takashi Iwai
2013-12-19 13:37 ` David Herrmann
2013-12-19 14:03 ` Takashi Iwai
2013-12-19 14:13 ` David Herrmann
2013-12-19 14:22 ` Takashi Iwai
2013-12-19 12:31 ` Ingo Molnar
2013-12-19 12:39 ` David Herrmann
2013-12-19 12:44 ` Ingo Molnar
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=20131219183310.GF32508@gmail.com \
--to=mingo@kernel.org \
--cc=dh.herrmann@gmail.com \
--cc=hpa@zytor.com \
--cc=linux-fbdev@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=stable@vger.kernel.org \
--cc=tglx@linutronix.de \
--cc=x86@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 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).