linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jiri Slaby <jirislaby@kernel.org>
To: Stuart Hayhurst <stuart.a.hayhurst@gmail.com>,
	linux-input@vger.kernel.org
Cc: Jiri Kosina <jikos@kernel.org>,
	Benjamin Tissoires <bentiss@kernel.org>,
	linux-kernel@vger.kernel.org, stable@vger.kernel.org
Subject: Re: [PATCH v3] HID: corsair-void: Update power supply values with a unified work handler
Date: Fri, 14 Feb 2025 07:36:49 +0100	[thread overview]
Message-ID: <d1e07053-8f0a-40b2-a473-941e8180c570@kernel.org> (raw)
In-Reply-To: <20250213133854.100866-3-stuart.a.hayhurst@gmail.com>

On 13. 02. 25, 14:38, Stuart Hayhurst wrote:
> corsair_void_process_receiver can be called from an interrupt context,
> locking battery_mutex in it was causing a kernel panic.
> Fix it by moving the critical section into its own work, sharing this
> work with battery_add_work and battery_remove_work to remove the need
> for any locking
> 
> Closes: https://bugzilla.suse.com/show_bug.cgi?id=1236843
> Fixes: 6ea2a6fd3872 ("HID: corsair-void: Add Corsair Void headset family driver")
> Cc: stable@vger.kernel.org
> Signed-off-by: Stuart Hayhurst <stuart.a.hayhurst@gmail.com>
> ---
> 
> v2 -> v3:
>   - Use an enum instead of a define for battery flag values
>   - Use an integer instead of BIT() for the bit index
>   - Drop unhelpful comments
>   - Simplify corsair_void_battery_work_handler logic
>   - Remove extra newline in commit message
> v1 -> v2:
>   - Actually remove the mutex
> 
> ---
>   drivers/hid/hid-corsair-void.c | 83 ++++++++++++++++++----------------
>   1 file changed, 43 insertions(+), 40 deletions(-)
> 
> diff --git a/drivers/hid/hid-corsair-void.c b/drivers/hid/hid-corsair-void.c
> index 56e858066c3c..afbd67aa9719 100644
> --- a/drivers/hid/hid-corsair-void.c
> +++ b/drivers/hid/hid-corsair-void.c
> @@ -71,11 +71,9 @@
>   
>   #include <linux/bitfield.h>
>   #include <linux/bitops.h>
> -#include <linux/cleanup.h>
>   #include <linux/device.h>
>   #include <linux/hid.h>
>   #include <linux/module.h>
> -#include <linux/mutex.h>
>   #include <linux/power_supply.h>
>   #include <linux/usb.h>
>   #include <linux/workqueue.h>
> @@ -120,6 +118,12 @@ enum {
>   	CORSAIR_VOID_BATTERY_CHARGING	= 5,
>   };
>   
> +enum {
> +	CORSAIR_VOID_ADD_BATTERY	= 0,
> +	CORSAIR_VOID_REMOVE_BATTERY	= 1,
> +	CORSAIR_VOID_UPDATE_BATTERY	= 2,

BTW numbering these explicitly is superfluous.

-- 
js
suse labs

  parent reply	other threads:[~2025-02-14  6:36 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-13 13:38 [PATCH v3] HID: corsair-void: Update power supply values with a unified work handler Stuart Hayhurst
2025-02-14  6:34 ` Jiri Slaby
2025-02-14 13:32   ` Stuart
2025-02-14  6:36 ` Jiri Slaby [this message]
2025-02-18 20:21 ` Jiri Kosina

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=d1e07053-8f0a-40b2-a473-941e8180c570@kernel.org \
    --to=jirislaby@kernel.org \
    --cc=bentiss@kernel.org \
    --cc=jikos@kernel.org \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=stable@vger.kernel.org \
    --cc=stuart.a.hayhurst@gmail.com \
    /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).