From: Dan Carpenter <dan.carpenter@oracle.com>
To: Mark Laws <mdl@60hz.org>
Cc: kys@microsoft.com, haiyangz@microsoft.com,
devel@linuxdriverproject.org, linux-input@vger.kernel.org
Subject: Re: [PATCH] Input: i8042 - Fix console keyboard support on Gen2 Hyper-V VMs
Date: Mon, 18 Apr 2016 19:54:57 +0300 [thread overview]
Message-ID: <20160418165456.GG4298@mwanda> (raw)
In-Reply-To: <341e0bb72d58c1c7d72ad5352f4bb364d939c0a8.1460985538.git.mdl@60hz.org>
So if the user inserts the module without a keyboard then in the
original code they would just put a keyboard in and try again. Now they
have to do an extra rmmod. What about if we just removed the test for
if the keyboard is present?
On Tue, Apr 19, 2016 at 12:23:36AM +0900, Mark Laws wrote:
> As explained in 1407814240-4275-1-git-send-email-decui@microsoft.com:
>
> > hyperv_keyboard invokes serio_interrupt(), which needs a valid serio
> > driver like atkbd.c. atkbd.c depends on libps2.c because it invokes
> > ps2_command(). libps2.c depends on i8042.c because it invokes
> > i8042_check_port_owner(). As a result, hyperv_keyboard actually
> > depends on i8042.c.
> >
> > For a Generation 2 Hyper-V VM (meaning no i8042 device emulated), if a
> > Linux VM (like Arch Linux) happens to configure CONFIG_SERIO_I8042=m
> > rather than =y, atkbd.ko can't load because i8042.ko can't load(due to
> > no i8042 device emulated) and finally hyperv_keyboard can't work and
> > the user can't input: https://bugs.archlinux.org/task/39820
> > (Ubuntu/RHEL/SUSE aren't affected since they use CONFIG_SERIO_I8042=y)
>
> The transitive dependency on i8042.c is non-trivial--there appears to be
> no obvious way to untangle it other than by duplicating much of atkbd.c
> within hyperv-keyboard--so we employ a simple workaround: keep i8042.ko
> loaded even if no i8042 device is detected, but set a flag so that any
> calls into the module simply return (since we don't want to try to
> interact with the non-existent i8042). This allows atkbd.c and libps2.c
> to load, solving the problem.
>
> Signed-off-by: Mark Laws <mdl@60hz.org>
> ---
> drivers/input/serio/i8042.c | 41 ++++++++++++++++++++++++++++++++++-------
> 1 file changed, 34 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/input/serio/i8042.c b/drivers/input/serio/i8042.c
> index 4541957..4d49496 100644
> --- a/drivers/input/serio/i8042.c
> +++ b/drivers/input/serio/i8042.c
> @@ -132,6 +132,7 @@ struct i8042_port {
>
> static struct i8042_port i8042_ports[I8042_NUM_PORTS];
>
> +static bool i8042_present;
> static unsigned char i8042_initial_ctr;
> static unsigned char i8042_ctr;
> static bool i8042_mux_present;
> @@ -163,6 +164,9 @@ int i8042_install_filter(bool (*filter)(unsigned char data, unsigned char str,
> unsigned long flags;
> int ret = 0;
>
> + if (!i8042_present)
> + return ret;
Don't obfuscate the literal. Just "return 0;". Also if it's goto out
just change that to "return 0;" because it's simpler for the reader.
regards,
dan carpenter
next prev parent reply other threads:[~2016-04-18 16:55 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-08-12 3:30 [PATCH] Input: serio: make HYPERV_KEYBOARD depend on SERIO_I8042=y Dexuan Cui
2014-08-12 3:21 ` Greg KH
2014-08-12 5:51 ` Dexuan Cui
2014-08-12 6:01 ` Greg KH
2014-08-12 7:15 ` Dexuan Cui
2014-08-12 17:54 ` Dmitry Torokhov
2014-08-12 18:01 ` KY Srinivasan
2014-08-13 5:27 ` Dexuan Cui
2014-08-13 5:24 ` Dexuan Cui
2014-08-13 15:56 ` Dmitry Torokhov
2014-08-14 6:07 ` Dexuan Cui
2016-04-18 15:23 ` [PATCH] Input: i8042 - Fix console keyboard support on Gen2 Hyper-V VMs Mark Laws
2016-04-18 15:23 ` Mark Laws
2016-04-18 16:54 ` Dan Carpenter [this message]
2016-04-18 17:24 ` Mark Laws
2016-04-18 20:36 ` Dan Carpenter
2016-04-18 22:00 ` Mark Laws
2016-04-19 8:22 ` Dan Carpenter
2016-04-19 10:46 ` Mark Laws
2016-04-22 13:00 ` Mark Laws
2016-04-22 13:01 ` Mark Laws
2016-04-22 13:17 ` Dan Carpenter
2016-04-22 17:30 ` Mark Laws
2016-04-22 17:30 ` Mark Laws
-- strict thread matches above, loose matches on Subject: below --
2016-06-13 14:38 Mark Laws
2016-06-13 14:38 ` Mark Laws
2016-06-13 20:45 ` [PATCH] [PATCH] Input: i8042 - Fix console keyboard support on Mark Laws
2016-06-13 20:45 ` [PATCH] Input: i8042 - Fix console keyboard support on Gen2 Hyper-V VMs Mark Laws
[not found] <CADemMPNEv+kq21rXQMmB_BjgTsnEjscOCS5A02VAapOOM-ryMA@mail.gmail.com>
2016-07-25 21:01 ` Dmitry Torokhov
2016-07-25 22:15 ` Mark Laws
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=20160418165456.GG4298@mwanda \
--to=dan.carpenter@oracle.com \
--cc=devel@linuxdriverproject.org \
--cc=haiyangz@microsoft.com \
--cc=kys@microsoft.com \
--cc=linux-input@vger.kernel.org \
--cc=mdl@60hz.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).