mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Ali Ahmet Memis <ali@iusegentoo.com>
To: Wilken Gottwalt <wilken.gottwalt@posteo.net>,
	Guenter Roeck <linux@roeck-us.net>
Cc: linux-hwmon@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] hwmon: (corsair-psu) serialize debugfs access against hwmon
Date: Tue,  4 Aug 2026 09:47:53 +0000	[thread overview]
Message-ID: <20260804094753.230500-1-ali@iusegentoo.com> (raw)
In-Reply-To: <20260804061110.575adfc2@posteo.net>

On Tue, 04 Aug 2026 04:11:11 +0000 Wilken Gottwalt wrote:
> I was playing with the idea to (1) remove the raw HID mode completely or
> (2) make the driver switchable, raw HID or normal HID, but not both at the
> same time.

Two different things are getting mixed together here, which may be why the
answers you got do not agree with each other.

->raw_event is not the userspace side. It is how the driver receives its
replies: corsairpsu_usb_cmd() sends the report and then blocks on
wait_completion, and corsairpsu_raw_event() is what fills cmd_buffer and
completes it. Take that away and no command ever returns.

The raw HID mode you can actually drop is HID_CONNECT_HIDRAW in
hid_hw_start(), which is what creates /dev/hidrawN. That one is allowed to
go: hid_connect() only refuses a device with no listeners if the driver has
no ->raw_event, and this driver has one.

Dropping it does not fix the cmd_buffer problem though, it only removes one
way to trigger it. The window is internal: usb_cmd() times out, the reply
arrives late anyway, the next command's reinit_completion() re-arms the
guard at the top of raw_event, and that stale reply is taken as the answer
to the new command. Nothing in userspace is needed for that.

One thing worth checking before going with (1): if your libhidapi tool uses
the hidraw backend it goes through /dev/hidrawN, so removing
HID_CONNECT_HIDRAW would take that tool's access away as well.

  reply	other threads:[~2026-08-04  9:48 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-02 12:36 Ali Ahmet Memis
2026-08-02 12:57 ` Wilken Gottwalt
2026-08-02 14:07   ` Guenter Roeck
2026-08-03 23:19   ` Guenter Roeck
2026-08-03 23:56     ` Ali Ahmet Memis
2026-08-04  2:54       ` Guenter Roeck
2026-08-04  4:11         ` Wilken Gottwalt
2026-08-04  9:47           ` Ali Ahmet Memis [this message]
2026-08-04 10:06             ` Ali Ahmet Memis
2026-08-04 16:34           ` Guenter Roeck
2026-08-04 17:53             ` Wilken Gottwalt
2026-08-04 18:37             ` Wilken Gottwalt
2026-08-04 20:14               ` Guenter Roeck
2026-08-06  5:23 ` Wilken Gottwalt
2026-08-06  9:23   ` Guenter Roeck
2026-08-06 12:19     ` Wilken Gottwalt
2026-08-06 14:10 ` Wilken Gottwalt
2026-08-06 14:21 ` [PATCH v2] " Ali Ahmet Memis
2026-08-06 15:41   ` Guenter Roeck

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=20260804094753.230500-1-ali@iusegentoo.com \
    --to=ali@iusegentoo.com \
    --cc=linux-hwmon@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@roeck-us.net \
    --cc=wilken.gottwalt@posteo.net \
    /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

all inboxes | Powered by JetHome®