All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Derek J. Clark" <derekjohn.clark@gmail.com>
Cc: linux-input@vger.kernel.org, dmitry.torokhov@gmail.com
Subject: Re: [PATCH v2 09/11] HID: hid-lenovo-go-s: Move static led_classdev_mc to drvdata struct
Date: Sat, 17 Oct 2026 02:14:39 +0000	[thread overview]
Message-ID: <sashiko-outbox-175197@kernel.org> (raw)
In-Reply-To: <20261017013956.2440130-10-derekjohn.clark@gmail.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] HID: hid-lenovo-go-s: sleeping in atomic context in hid_gos_brightness_set()
--

commit ce257492c69717cfbc87ce4b7e8049536c911d19
Author: Derek J. Clark <derekjohn.clark@gmail.com>

HID: hid-lenovo-go-s: Move static led_classdev_mc to drvdata struct

This commit moves the static gos_cdev_rgb multicolor LED structure into
struct gos_cfg_drvdata and initializes it in hid_gos_cfg_probe() in
preparation for dynamically allocating drvdata.

> diff --git a/drivers/hid/hid-lenovo-go-s.c b/drivers/hid/hid-lenovo-go-s.c
> index 136372eb6e6bf..2e938dd5e77c5 100644
> --- a/drivers/hid/hid-lenovo-go-s.c
> +++ b/drivers/hid/hid-lenovo-go-s.c

[ ... ]

> @@ -1593,6 +1580,18 @@ static int hid_gos_cfg_probe(struct hid_device *hdev,
>  	mutex_init(&drvdata.cfg_mutex);
>  	init_completion(&drvdata.send_cmd_complete);
>  
> +	/* Device is hardwired and name is guaranteed to be unique */
> +	drvdata.led_mc.led_cdev.name = "go_s:rgb:joystick_rings";
> +	drvdata.led_mc.led_cdev.brightness = 0x50;
> +	drvdata.led_mc.led_cdev.max_brightness = 0x64;
> +	drvdata.led_mc.led_cdev.color = LED_COLOR_ID_RGB;
> +	drvdata.led_mc.led_cdev.brightness_set = hid_gos_brightness_set;
> +	drvdata.led_mc.num_colors = 3;
> +	drvdata.led_mc.subled_info = devm_kmemdup(&hdev->dev, gos_rgb_subled_info,
> +						  sizeof(gos_rgb_subled_info), GFP_KERNEL);
> +	if (!drvdata.led_mc.subled_info)
> +		return -ENOMEM;

[Severity: High]
Can registering hid_gos_brightness_set() as the non-blocking
brightness_set callback sleep in atomic context?

In the LED core, brightness_set is invoked directly from atomic contexts
such as software blink timers and LED triggers via:

  led_timer_function()
    -> led_set_brightness_nosleep()
      -> led_set_brightness_nopm()
        -> __led_set_brightness()
          -> led_cdev->brightness_set()

However, hid_gos_brightness_set() calls rgb_cfg_call() ->
mcu_property_out(), which sleeps:

  drivers/hid/hid-lenovo-go-s.c:mcu_property_out() {
      ...
      guard(mutex)(&drvdata.cfg_mutex);
      ...
      if (drvdata.orphan_ack_pending) {
          wait_for_completion_timeout(&drvdata.send_cmd_complete, msecs_to_jiffies(25));
      ...
      dmabuf = kzalloc(GO_S_PACKET_SIZE, GFP_KERNEL);
      ...
      ret = hid_hw_output_report(hdev, dmabuf, GO_S_PACKET_SIZE);
      ...
      t_remaining = wait_for_completion_interruptible_timeout(&drvdata.send_cmd_complete,
                                                              msecs_to_jiffies(timeout));
      ...
  }

Should hid_gos_brightness_set() be wired up to brightness_set_blocking
instead of brightness_set so that the LED core defers atomic updates to
set_brightness_work?

> +
>  	/* Executing calls prior to returning from probe will lock the MCU. Schedule
>  	 * initial data call after probe has completed and MCU can accept calls.
>  	 */

[ ... ]

>

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261017013956.2440130-1-derekjohn.clark@gmail.com?part=9

  reply	other threads:[~2026-10-17  2:14 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-17  1:39 [PATCH v2 00/11] HID: hid-lenovo-go-s: Fix various bugs Derek J. Clark
2026-10-17  1:39 ` [PATCH v2 01/11] HID: hid-lenovo-go-s: Return ret instead of 0 in mcu_property_out() Derek J. Clark
2026-10-17  1:39 ` [PATCH v2 02/11] HID: hid-lenovo-go-s: Bound stale reply window before reusing send_cmd_complete Derek J. Clark
2026-10-17  1:39 ` [PATCH v2 03/11] HID: hid-lenovo-go-s: Prevent deadlock if device removed during setup Derek J. Clark
2026-10-17  1:39 ` [PATCH v2 04/11] HID: hid-lenovo-go-s: Use pm_ptr for reset_resume callback Derek J. Clark
2026-10-17  1:39 ` [PATCH v2 05/11] HID: hid-lenovo-go-s: Add kobject_uevent notify during reset-resume Derek J. Clark
2026-10-17  1:39 ` [PATCH v2 06/11] HID: hid-lenovo-go-s: Add suspend function and gate access under bool Derek J. Clark
2026-10-17  2:03   ` sashiko-bot
2026-10-17  1:39 ` [PATCH v2 07/11] HID: hid-lenovo-go-s: Move attribute init to after device query Derek J. Clark
2026-10-17  2:07   ` sashiko-bot
2026-10-17  1:39 ` [PATCH v2 08/11] HID: hid-lenovo-go-s: Reorganize and rename hid_gos_cfg Derek J. Clark
2026-10-17  1:39 ` [PATCH v2 09/11] HID: hid-lenovo-go-s: Move static led_classdev_mc to drvdata struct Derek J. Clark
2026-10-17  2:14   ` sashiko-bot [this message]
2026-10-17  1:39 ` [PATCH v2 10/11] HID: hid-lenovo-go-s: Use devm_kzalloc for drvdata Derek J. Clark
2026-10-17  2:23   ` sashiko-bot
2026-10-17  1:39 ` [PATCH v2 11/11] HID: hid-lenovo-go-s: Stop and close device on probe failure Derek J. Clark

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=sashiko-outbox-175197@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=derekjohn.clark@gmail.com \
    --cc=dmitry.torokhov@gmail.com \
    --cc=linux-input@vger.kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /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.