From: "Thierry Reding" <thierry.reding@gmail.com>
To: "Marc Dietrich" <marvin24@gmx.de>, <linux-staging@lists.linux.dev>
Cc: <linux-tegra@vger.kernel.org>, <gregkh@linuxfoundation.org>
Subject: Re: [PATCH 1/4] staging: nvec: make keyboard init synchronous
Date: Fri, 05 Apr 2024 16:38:23 +0200 [thread overview]
Message-ID: <D0C9KZB6GHD9.252SEU8KRCIMT@gmail.com> (raw)
In-Reply-To: <20240405140906.77831-2-marvin24@gmx.de>
[-- Attachment #1: Type: text/plain, Size: 2067 bytes --]
On Fri Apr 5, 2024 at 4:09 PM CEST, Marc Dietrich wrote:
> Improve initialization stability by waiting for command completion before
> sending the next one.
>
> Signed-off-by: Marc Dietrich <marvin24@gmx.de>
> ---
> drivers/staging/nvec/nvec_kbd.c | 14 ++++++++++----
> 1 file changed, 10 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/staging/nvec/nvec_kbd.c b/drivers/staging/nvec/nvec_kbd.c
> index f9a1da952c0a..6b203d28b8a9 100644
> --- a/drivers/staging/nvec/nvec_kbd.c
> +++ b/drivers/staging/nvec/nvec_kbd.c
> @@ -113,6 +113,7 @@ static int nvec_kbd_probe(struct platform_device *pdev)
> cnfg_wake[] = { NVEC_KBD, CNFG_WAKE, true, true },
> cnfg_wake_key_reporting[] = { NVEC_KBD, CNFG_WAKE_KEY_REPORTING,
> true };
> + struct nvec_msg *msg;
>
> j = 0;
>
> @@ -148,15 +149,20 @@ static int nvec_kbd_probe(struct platform_device *pdev)
> nvec_register_notifier(nvec, &keys_dev.notifier, 0);
>
> /* Enable keyboard */
> - nvec_write_async(nvec, enable_kbd, 2);
> + nvec_write_sync(nvec, enable_kbd, 2, &msg);
> + nvec_msg_free(nvec, msg);
>
> /* configures wake on special keys */
> - nvec_write_async(nvec, cnfg_wake, 4);
> + nvec_write_sync(nvec, cnfg_wake, 4, &msg);
> + nvec_msg_free(nvec, msg);
> +
> /* enable wake key reporting */
> - nvec_write_async(nvec, cnfg_wake_key_reporting, 3);
> + nvec_write_sync(nvec, cnfg_wake_key_reporting, 3, &msg);
> + nvec_msg_free(nvec, msg);
>
> /* Disable caps lock LED */
> - nvec_write_async(nvec, clear_leds, sizeof(clear_leds));
> + nvec_write_sync(nvec, clear_leds, sizeof(clear_leds), &msg);
> + nvec_msg_free(nvec, msg);
I wonder if perhaps some of this duplication can be folded into
nvec_write_sync(). It seems a bit unnecessary to have to first get hold
of the last message only to immediately free it.
If nvec_write_sync() were allowed to take a NULL as msg parameter, then
we could check if this special case and simply do the nvec_msg_free()
from there directly. Not sure if it's really worth it, though.
Thierry
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
next prev parent reply other threads:[~2024-04-05 14:38 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-05 14:09 [PATCH 0/4] Improve robustnes during initialization Marc Dietrich
2024-04-05 14:09 ` [PATCH 1/4] staging: nvec: make keyboard init synchronous Marc Dietrich
2024-04-05 14:38 ` Thierry Reding [this message]
2024-04-05 15:15 ` Dan Carpenter
2024-04-05 15:19 ` Dan Carpenter
2024-04-06 12:26 ` Marc Dietrich
2024-04-05 14:09 ` [PATCH 2/4] staging: nvec: make touchpad " Marc Dietrich
2024-04-05 14:40 ` Thierry Reding
2024-04-06 12:24 ` Marc Dietrich
2024-04-05 14:09 ` [PATCH 3/4] staging: nvec: make i2c controller register writes robust Marc Dietrich
2024-04-05 14:33 ` Thierry Reding
2024-04-05 15:21 ` Dan Carpenter
2024-04-05 14:09 ` [PATCH 4/4] staging: nvec: update TODO Marc Dietrich
2024-04-05 14:41 ` [PATCH 0/4] Improve robustnes during initialization Thierry Reding
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=D0C9KZB6GHD9.252SEU8KRCIMT@gmail.com \
--to=thierry.reding@gmail.com \
--cc=gregkh@linuxfoundation.org \
--cc=linux-staging@lists.linux.dev \
--cc=linux-tegra@vger.kernel.org \
--cc=marvin24@gmx.de \
/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