[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAJZ5v0j1qvJYXqo96eMmtD4JnGh4Mu2ESdri5cGAqL-4bK0geA@mail.gmail.com>
Date: Mon, 29 Jan 2024 14:08:54 +0100
From: "Rafael J. Wysocki" <rafael@...nel.org>
To: Hans de Goede <hdegoede@...hat.com>
Cc: Armin Wolf <W_Armin@....de>, ilpo.jarvinen@...ux.intel.com,
"Rafael J. Wysocki" <rafael@...nel.org>, platform-driver-x86@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] platform/x86: wmi: Initialize ACPI device class
On Mon, Jan 29, 2024 at 1:51 PM Hans de Goede <hdegoede@...hat.com> wrote:
>
> Hi,
>
> On 1/24/24 20:07, Armin Wolf wrote:
> > When an ACPI netlink event is received by acpid, the ACPI device
> > class is passed as its first argument. But since the class string
> > is not initialized, an empty string is being passed:
> >
> > netlink: PNP0C14:01 000000d0 00000000
> >
> > Fix this by initializing the ACPI device class during probe.
> >
> > Signed-off-by: Armin Wolf <W_Armin@....de>
> > ---
> > Note: This patch is based on commit 3f399b5d7189 ("platform/x86: wmi: Use ACPI device name in netlink event")
> > ---
> > drivers/platform/x86/wmi.c | 6 +++++-
> > 1 file changed, 5 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/platform/x86/wmi.c b/drivers/platform/x86/wmi.c
> > index 7ef1e82dc61c..b92425c30a50 100644
> > --- a/drivers/platform/x86/wmi.c
> > +++ b/drivers/platform/x86/wmi.c
> > @@ -32,6 +32,8 @@
> > #include <linux/wmi.h>
> > #include <linux/fs.h>
> >
> > +#define ACPI_WMI_DEVICE_CLASS "wmi"
> > +
> > MODULE_AUTHOR("Carlos Corbacho");
> > MODULE_DESCRIPTION("ACPI-WMI Mapping Driver");
> > MODULE_LICENSE("GPL");
> > @@ -1202,7 +1204,7 @@ static int wmi_notify_device(struct device *dev, void *data)
> > wblock->handler(*event, wblock->handler_data);
> > }
> >
> > - acpi_bus_generate_netlink_event(wblock->acpi_device->pnp.device_class,
> > + acpi_bus_generate_netlink_event(acpi_device_class(wblock->acpi_device),
> > acpi_dev_name(wblock->acpi_device), *event, 0);
> >
> > return -EBUSY;
> > @@ -1267,6 +1269,8 @@ static int acpi_wmi_probe(struct platform_device *device)
> > return -ENODEV;
> > }
> >
> > + strscpy(acpi_device_class(acpi_device), ACPI_WMI_DEVICE_CLASS, sizeof(acpi_device_class));
> > +
>
> Hmm, I'm not sure if you are supposed to do this when you are not an
> acpi_driver's add() function.
You aren't.
> Rafael, do you have any comments on this ?
I'm not quite sure why this is done here.
Powered by blists - more mailing lists