X86 platform drivers
 help / color / mirror / Atom feed
From: Hans de Goede <hdegoede@redhat.com>
To: Daniel Dadap <ddadap@nvidia.com>,
	platform-driver-x86@vger.kernel.org, mario.limonciello@dell.com,
	pobrn@protonmail.com
Cc: andy@infradead.org, dvhart@infradead.org, aplattner@nvidia.com
Subject: Re: [PATCH v2 2/2] platform/x86: wmi: fail wmi_driver_register when no GUID is found
Date: Tue, 10 Nov 2020 10:34:16 +0100	[thread overview]
Message-ID: <877ae34b-dcbb-a0a4-7d76-d9d78d12fd00@redhat.com> (raw)
In-Reply-To: <20200731202154.11382-2-ddadap@nvidia.com>

Hi,

On 7/31/20 10:21 PM, Daniel Dadap wrote:
> If a driver registers with WMI, and none of the GUIDs in its ID table
> is present on the system, then that driver will not be probed and
> automatically loaded. However, it is still possible to load such a
> driver explicitly on a system which doesn't include the relevant
> hardware.
> 
> Update wmi_driver_register to test for the presence of at least one
> GUID from the driver's ID table at driver registration time, and
> fail registration if none are found.

This would make the WMI bus different from all the other kernel
bus subsystems where one can happily load drivers even if there
is no hardware using them.

And this would also break being able to manually bind a different
(hopefully compatible but different) guid device through
/sys/bus/wmi/drivers/foo/bind

So NACK to this one from me.

Note please do send a new version of patch 1/2 of this sets addressing
Andy's remarks to the other similar patch you did.

Regards,

Hans





> 
> Signed-off-by: Daniel Dadap <ddadap@nvidia.com>
> ---
>  drivers/platform/x86/wmi.c | 18 ++++++++++++++++++
>  1 file changed, 18 insertions(+)
> 
> diff --git a/drivers/platform/x86/wmi.c b/drivers/platform/x86/wmi.c
> index 941739db7199..19aa23d1cf8e 100644
> --- a/drivers/platform/x86/wmi.c
> +++ b/drivers/platform/x86/wmi.c
> @@ -130,6 +130,21 @@ static bool find_guid(const char *guid_string, struct wmi_block **out)
>  	return false;
>  }
>  
> +static bool find_driver_guid(const struct wmi_driver *wdriver)
> +{
> +	const struct wmi_device_id *id;
> +
> +	if (wdriver == NULL)
> +		return false;
> +
> +	for (id = wdriver->id_table; *id->guid_string; id++) {
> +		if (find_guid(id->guid_string, NULL))
> +			return true;
> +	}
> +
> +	return false;
> +}
> +
>  static const void *find_guid_context(struct wmi_block *wblock,
>  				      struct wmi_driver *wdriver)
>  {
> @@ -1419,6 +1434,9 @@ static int acpi_wmi_probe(struct platform_device *device)
>  int __must_check __wmi_driver_register(struct wmi_driver *driver,
>  				       struct module *owner)
>  {
> +	if (!find_driver_guid(driver))
> +		return -ENODEV;
> +
>  	driver->driver.owner = owner;
>  	driver->driver.bus = &wmi_bus_type;
>  
> 


       reply	other threads:[~2020-11-10  9:34 UTC|newest]

Thread overview: 52+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <DM6PR19MB2636AB267CD321DE40EF324AFA730@DM6PR19MB2636.namprd19.prod.outlook.com>
     [not found] ` <20200731202154.11382-1-ddadap@nvidia.com>
     [not found]   ` <20200731202154.11382-2-ddadap@nvidia.com>
2020-11-10  9:34     ` Hans de Goede [this message]
2020-11-12 18:54       ` [PATCH v2 2/2] platform/x86: wmi: fail wmi_driver_register when no GUID is found Daniel Dadap
2021-08-24 22:04       ` [PATCH v3] platform/x86: Add driver for ACPI WMAA EC-based backlight control Daniel Dadap
2021-08-24 22:47         ` Barnabás Pőcze
2021-08-25 16:36           ` Daniel Dadap
2021-08-25 22:26           ` Daniel Dadap
2021-08-27 16:47             ` Daniel Dadap
2021-08-27 17:12               ` Daniel Dadap
2021-08-25  9:05         ` Andy Shevchenko
2021-08-25 16:47           ` Daniel Dadap
2021-08-25 22:06             ` Thomas Weißschuh
2021-08-25 22:28               ` Daniel Dadap
2021-08-26 13:35             ` Andy Shevchenko
2021-08-26 15:39               ` Daniel Dadap
2021-08-31 22:49                 ` [PATCH v4] " Daniel Dadap
2021-09-01  9:25                   ` Thomas Weißschuh
2021-09-02  2:12                     ` Daniel Dadap
2021-09-02 10:19                       ` Thomas Weißschuh
2021-09-02 20:15                         ` Daniel Dadap
2021-09-02 20:31                           ` Hans de Goede
2021-09-02 21:47                             ` [PATCH v5] " Daniel Dadap
2021-09-02 23:20                               ` Thomas Weißschuh
2021-09-03  0:22                                 ` Daniel Dadap
2021-09-03  8:14                                   ` Andy Shevchenko
2021-09-03 17:55                                     ` Daniel Dadap
2021-09-03  0:38                                 ` [PATCH v6] " Daniel Dadap
2021-09-13  9:01                                   ` Hans de Goede
2021-09-20 13:29                                     ` Pali Rohár
2021-09-20 13:33                                       ` Hans de Goede
2021-09-20 13:51                                         ` Pali Rohár
2021-09-20 17:34                                           ` Daniel Dadap
2021-09-20 17:55                                             ` Pali Rohár
2021-09-20 19:38                                               ` Daniel Dadap
2021-09-20 19:52                                                 ` Pali Rohár
2021-09-21 13:53                                           ` Hans de Goede
2021-09-21 14:02                                             ` Pali Rohár
2021-09-21 14:29                                             ` Daniel Dadap
2021-09-21 14:58                                               ` Hans de Goede
2021-09-27 20:23                                                 ` [PATCH 1/2] platform/x86: Remove "WMAA" from identifier names in wmaa-backlight-wmi.c Daniel Dadap
2021-09-27 20:23                                                   ` [PATCH 2/2] platform/x86: Rename wmaa-backlight-wmi to nvidia-wmi-ec-backlight Daniel Dadap
2021-10-11 13:00                                                   ` [PATCH 1/2] platform/x86: Remove "WMAA" from identifier names in wmaa-backlight-wmi.c Hans de Goede
2021-09-27 22:52                                                 ` [PATCH v6] platform/x86: Add driver for ACPI WMAA EC-based backlight control Daniel Dadap
2021-09-02  9:28                     ` [PATCH v4] " Andy Shevchenko
2021-09-02  9:33                       ` Thomas Weißschuh
2021-09-02  9:36                         ` Andy Shevchenko
2021-09-01 15:57                   ` Andy Shevchenko
2021-09-01 23:12                     ` Aaron Plattner
2021-09-02  2:37                     ` Daniel Dadap
2021-09-02  9:35                       ` Andy Shevchenko
2021-09-02 20:15                         ` Daniel Dadap
2021-09-03  8:10                           ` Andy Shevchenko
2021-09-02 15:38                   ` Hans de Goede

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=877ae34b-dcbb-a0a4-7d76-d9d78d12fd00@redhat.com \
    --to=hdegoede@redhat.com \
    --cc=andy@infradead.org \
    --cc=aplattner@nvidia.com \
    --cc=ddadap@nvidia.com \
    --cc=dvhart@infradead.org \
    --cc=mario.limonciello@dell.com \
    --cc=platform-driver-x86@vger.kernel.org \
    --cc=pobrn@protonmail.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