From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
To: Dan Carpenter <dan.carpenter@linaro.org>
Cc: linux-input@vger.kernel.org
Subject: Re: [bug report] Input: atkbd - restore repeat rate when resuming
Date: Tue, 4 Mar 2025 23:09:35 -0800 [thread overview]
Message-ID: <Z8f4r2AbNX-6EpO7@google.com> (raw)
In-Reply-To: <cd3caca2-607e-4cf4-9262-bc5867b690a7@stanley.mountain>
Hi Dan,
On Mon, Mar 03, 2025 at 11:11:35AM +0300, Dan Carpenter wrote:
> [ This bug seems really ancient. But so far as I can see it really is
> super old. I'm not sure why it's only showing up now. -dan ]
>
> Hello Dmitry Torokhov,
>
> Commit 3d0f0fa0cb55 ("Input: atkbd - restore repeat rate when
> resuming") from Aug 4, 2006 (linux-next), leads to the following
> Smatch static checker warning:
>
> drivers/input/keyboard/atkbd.c:604 atkbd_set_repeat_rate()
> warn: sleeping in atomic context
>
> drivers/input/keyboard/atkbd.c
> 583 static int atkbd_set_repeat_rate(struct atkbd *atkbd)
> 584 {
> 585 const short period[32] =
> 586 { 33, 37, 42, 46, 50, 54, 58, 63, 67, 75, 83, 92, 100, 109, 116, 125,
> 587 133, 149, 167, 182, 200, 217, 232, 250, 270, 303, 333, 370, 400, 435, 470, 500 };
> 588 const short delay[4] =
> 589 { 250, 500, 750, 1000 };
> 590
> 591 struct input_dev *dev = atkbd->dev;
> 592 unsigned char param;
> 593 int i = 0, j = 0;
> 594
> 595 while (i < ARRAY_SIZE(period) - 1 && period[i] < dev->rep[REP_PERIOD])
> 596 i++;
> 597 dev->rep[REP_PERIOD] = period[i];
> 598
> 599 while (j < ARRAY_SIZE(delay) - 1 && delay[j] < dev->rep[REP_DELAY])
> 600 j++;
> 601 dev->rep[REP_DELAY] = delay[j];
> 602
> 603 param = i | (j << 5);
> --> 604 return ps2_command(&atkbd->ps2dev, ¶m, ATKBD_CMD_SETREP);
>
> This fucntion call takes a mutex.
>
> 605 }
>
> The call tree is:
>
> atkbd_reconnect() <- disables preempt
> -> atkbd_set_repeat_rate()
>
> In atkbd_reconnect() it's the atkbd_disable(atkbd) which takes a
> spinlock.
I think your tools are confused by the guard notation. atkbd_disable()
not only takes but also releases the spinlock.
Thanks.
--
Dmitry
next prev parent reply other threads:[~2025-03-05 7:09 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-03 8:11 [bug report] Input: atkbd - restore repeat rate when resuming Dan Carpenter
2025-03-05 7:09 ` Dmitry Torokhov [this message]
2025-03-05 8:49 ` Dan Carpenter
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=Z8f4r2AbNX-6EpO7@google.com \
--to=dmitry.torokhov@gmail.com \
--cc=dan.carpenter@linaro.org \
--cc=linux-input@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.