All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Kurt Borja" <kuurtb@gmail.com>
To: "Armin Wolf" <W_Armin@gmx.de>, <xy-jackie@139.com>,
	<alireza.bestboyy@gmail.com>, <atescula@gmail.com>
Cc: <mpearson-lenovo@squebb.ca>, <hdegoede@redhat.com>,
	<ilpo.jarvinen@linux.intel.com>,
	<platform-driver-x86@vger.kernel.org>,
	<linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] platform/x86: lenovo-hotkey: Handle missing hardware features gracefully
Date: Fri, 27 Jun 2025 17:38:19 -0300	[thread overview]
Message-ID: <DAXLSMRH9E6Y.3Q8Z59YG2B50C@gmail.com> (raw)
In-Reply-To: <20250627195436.3877-1-W_Armin@gmx.de>

[-- Attachment #1: Type: text/plain, Size: 1946 bytes --]

Hi Armin,

On Fri Jun 27, 2025 at 4:54 PM -03, Armin Wolf wrote:
> Not all devices support audio mute and microphone mute LEDs, so the
> explicitly checks for hardware support while probing. However missing
> hardware features are treated as errors, causing the driver so fail
> probing on devices that do not support both LEDs.
>
> Fix this by simply ignoring hardware features that are not present.
> This way the driver will properly load on devices not supporting both
> LEDs and will stop throwing error messages on devices with no LEDS
> at all.

This patch makes me wonder what is the policy around issues like this.
In fact I've submitted and changes that do the exact opposite :p
Like commit: 4630b99d2e93 ("platform/x86: dell-pc: Propagate errors when
detecting feature support")

IMO missing features should be treated as errors. i.e. The probe should
fail.

Quoting documentation [1]:

	If a match is found, the device’s driver field is set to the
	driver and the driver’s probe callback is called. This gives the
	driver a chance to verify that it really does support the
	hardware, and that it’s in a working state.

And again [2]:

	This callback holds the driver-specific logic to bind the driver
	to a given device. That includes verifying that the device is
	present, that it’s a version the driver can handle, that driver
	data structures can be allocated and initialized, and that any
	hardware can be initialized.

Both of these makes me wonder if such a "fail" or error message should
be fixed in the first place. In this case the probe correctly checks for
device support and fails if it's not found, which is suggested to be the
correct behavior.

BTW this also leaks `wpriv`, which would remain allocated for no reason.


[1] https://docs.kernel.org/driver-api/driver-model/binding.html
[2] https://docs.kernel.org/driver-api/driver-model/driver.html

-- 
 ~ Kurt

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

  reply	other threads:[~2025-06-27 20:38 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-06-27 19:54 [PATCH] platform/x86: lenovo-hotkey: Handle missing hardware features gracefully Armin Wolf
2025-06-27 20:38 ` Kurt Borja [this message]
2025-06-27 21:17   ` Armin Wolf
2025-06-27 21:29     ` Kurt Borja
2025-06-27 23:01       ` Armin Wolf
2025-06-29 20:36         ` Mark Pearson
2025-06-29 22:52           ` Armin Wolf
2025-07-07  3:03           ` [PATCH] platform/x86: lenovo-hotkey: Handle missing hardware featuresgracefully Jackie Dong
2025-07-07  9:22             ` Hans de Goede
2025-07-08  6:44               ` [PATCH] platform/x86: lenovo-hotkey: Handle missing hardwarefeaturesgracefully Jackie Dong

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=DAXLSMRH9E6Y.3Q8Z59YG2B50C@gmail.com \
    --to=kuurtb@gmail.com \
    --cc=W_Armin@gmx.de \
    --cc=alireza.bestboyy@gmail.com \
    --cc=atescula@gmail.com \
    --cc=hdegoede@redhat.com \
    --cc=ilpo.jarvinen@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mpearson-lenovo@squebb.ca \
    --cc=platform-driver-x86@vger.kernel.org \
    --cc=xy-jackie@139.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 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.