2023-06-09 15:56:38

by Andy Shevchenko

[permalink] [raw]
Subject: [PATCH v2 1/3] ACPI: Move ACPI_DEVICE_CLASS() to mod_devicetable.h

The data type of struct acpi_device_id is defined in the
mod_devicetable.h. It's suboptimal to require user with
the almost agnostic code to include acpi.h solely for the
macro that affects the data type defined elsewhere.

Taking into account the above and for the sake of consistency
move ACPI_DEVICE_CLASS() to mod_devicetable.h.

Note, that with CONFIG_ACPI=n the ID table will be filed with data
but it does not really matter because either it won't be used, or
won't be compiled in some cases (when guarded by respective ifdeffery).

Signed-off-by: Andy Shevchenko <[email protected]>
---
include/linux/acpi.h | 14 --------------
include/linux/mod_devicetable.h | 13 +++++++++++++
2 files changed, 13 insertions(+), 14 deletions(-)

diff --git a/include/linux/acpi.h b/include/linux/acpi.h
index d41a05d68166..640f1c07c894 100644
--- a/include/linux/acpi.h
+++ b/include/linux/acpi.h
@@ -70,19 +70,6 @@ static inline void acpi_free_fwnode_static(struct fwnode_handle *fwnode)
kfree(fwnode);
}

-/**
- * ACPI_DEVICE_CLASS - macro used to describe an ACPI device with
- * the PCI-defined class-code information
- *
- * @_cls : the class, subclass, prog-if triple for this device
- * @_msk : the class mask for this device
- *
- * This macro is used to create a struct acpi_device_id that matches a
- * specific PCI class. The .id and .driver_data fields will be left
- * initialized with the default value.
- */
-#define ACPI_DEVICE_CLASS(_cls, _msk) .cls = (_cls), .cls_msk = (_msk),
-
static inline bool has_acpi_companion(struct device *dev)
{
return is_acpi_device_node(dev->fwnode);
@@ -782,7 +769,6 @@ const char *acpi_get_subsystem_id(acpi_handle handle);
#define ACPI_COMPANION_SET(dev, adev) do { } while (0)
#define ACPI_HANDLE(dev) (NULL)
#define ACPI_HANDLE_FWNODE(fwnode) (NULL)
-#define ACPI_DEVICE_CLASS(_cls, _msk) .cls = (0), .cls_msk = (0),

#include <acpi/acpi_numa.h>

diff --git a/include/linux/mod_devicetable.h b/include/linux/mod_devicetable.h
index ccaaeda792c0..486747518aae 100644
--- a/include/linux/mod_devicetable.h
+++ b/include/linux/mod_devicetable.h
@@ -221,6 +221,19 @@ struct acpi_device_id {
__u32 cls_msk;
};

+/**
+ * ACPI_DEVICE_CLASS - macro used to describe an ACPI device with
+ * the PCI-defined class-code information
+ *
+ * @_cls : the class, subclass, prog-if triple for this device
+ * @_msk : the class mask for this device
+ *
+ * This macro is used to create a struct acpi_device_id that matches a
+ * specific PCI class. The .id and .driver_data fields will be left
+ * initialized with the default value.
+ */
+#define ACPI_DEVICE_CLASS(_cls, _msk) .cls = (_cls), .cls_msk = (_msk),
+
#define PNP_ID_LEN 8
#define PNP_MAX_DEVICES 8

--
2.40.0.1.gaa8946217a0b



2023-06-09 17:44:43

by Rafael J. Wysocki

[permalink] [raw]
Subject: Re: [PATCH v2 1/3] ACPI: Move ACPI_DEVICE_CLASS() to mod_devicetable.h

On Fri, Jun 9, 2023 at 5:49 PM Andy Shevchenko
<[email protected]> wrote:
>
> The data type of struct acpi_device_id is defined in the
> mod_devicetable.h. It's suboptimal to require user with
> the almost agnostic code to include acpi.h solely for the
> macro that affects the data type defined elsewhere.
>
> Taking into account the above and for the sake of consistency
> move ACPI_DEVICE_CLASS() to mod_devicetable.h.
>
> Note, that with CONFIG_ACPI=n the ID table will be filed with data
> but it does not really matter because either it won't be used, or
> won't be compiled in some cases (when guarded by respective ifdeffery).
>
> Signed-off-by: Andy Shevchenko <[email protected]>

Acked-by: Rafael J. Wysocki <[email protected]>

or please let me know if you want me to apply this.

> ---
> include/linux/acpi.h | 14 --------------
> include/linux/mod_devicetable.h | 13 +++++++++++++
> 2 files changed, 13 insertions(+), 14 deletions(-)
>
> diff --git a/include/linux/acpi.h b/include/linux/acpi.h
> index d41a05d68166..640f1c07c894 100644
> --- a/include/linux/acpi.h
> +++ b/include/linux/acpi.h
> @@ -70,19 +70,6 @@ static inline void acpi_free_fwnode_static(struct fwnode_handle *fwnode)
> kfree(fwnode);
> }
>
> -/**
> - * ACPI_DEVICE_CLASS - macro used to describe an ACPI device with
> - * the PCI-defined class-code information
> - *
> - * @_cls : the class, subclass, prog-if triple for this device
> - * @_msk : the class mask for this device
> - *
> - * This macro is used to create a struct acpi_device_id that matches a
> - * specific PCI class. The .id and .driver_data fields will be left
> - * initialized with the default value.
> - */
> -#define ACPI_DEVICE_CLASS(_cls, _msk) .cls = (_cls), .cls_msk = (_msk),
> -
> static inline bool has_acpi_companion(struct device *dev)
> {
> return is_acpi_device_node(dev->fwnode);
> @@ -782,7 +769,6 @@ const char *acpi_get_subsystem_id(acpi_handle handle);
> #define ACPI_COMPANION_SET(dev, adev) do { } while (0)
> #define ACPI_HANDLE(dev) (NULL)
> #define ACPI_HANDLE_FWNODE(fwnode) (NULL)
> -#define ACPI_DEVICE_CLASS(_cls, _msk) .cls = (0), .cls_msk = (0),
>
> #include <acpi/acpi_numa.h>
>
> diff --git a/include/linux/mod_devicetable.h b/include/linux/mod_devicetable.h
> index ccaaeda792c0..486747518aae 100644
> --- a/include/linux/mod_devicetable.h
> +++ b/include/linux/mod_devicetable.h
> @@ -221,6 +221,19 @@ struct acpi_device_id {
> __u32 cls_msk;
> };
>
> +/**
> + * ACPI_DEVICE_CLASS - macro used to describe an ACPI device with
> + * the PCI-defined class-code information
> + *
> + * @_cls : the class, subclass, prog-if triple for this device
> + * @_msk : the class mask for this device
> + *
> + * This macro is used to create a struct acpi_device_id that matches a
> + * specific PCI class. The .id and .driver_data fields will be left
> + * initialized with the default value.
> + */
> +#define ACPI_DEVICE_CLASS(_cls, _msk) .cls = (_cls), .cls_msk = (_msk),
> +
> #define PNP_ID_LEN 8
> #define PNP_MAX_DEVICES 8
>
> --
> 2.40.0.1.gaa8946217a0b
>

2023-06-12 15:50:27

by Andy Shevchenko

[permalink] [raw]
Subject: Re: [PATCH v2 1/3] ACPI: Move ACPI_DEVICE_CLASS() to mod_devicetable.h

On Fri, Jun 09, 2023 at 07:32:53PM +0200, Rafael J. Wysocki wrote:
> On Fri, Jun 9, 2023 at 5:49 PM Andy Shevchenko
> <[email protected]> wrote:
> >
> > The data type of struct acpi_device_id is defined in the
> > mod_devicetable.h. It's suboptimal to require user with
> > the almost agnostic code to include acpi.h solely for the
> > macro that affects the data type defined elsewhere.
> >
> > Taking into account the above and for the sake of consistency
> > move ACPI_DEVICE_CLASS() to mod_devicetable.h.
> >
> > Note, that with CONFIG_ACPI=n the ID table will be filed with data
> > but it does not really matter because either it won't be used, or
> > won't be compiled in some cases (when guarded by respective ifdeffery).
> >
> > Signed-off-by: Andy Shevchenko <[email protected]>
>
> Acked-by: Rafael J. Wysocki <[email protected]>
>
> or please let me know if you want me to apply this.

The first patch can be applied independently. But it may be better to apply
all three via one tree (linux-pm was mentioned in the cover letter) as it
shows the point.

--
With Best Regards,
Andy Shevchenko



2023-06-12 22:48:34

by Damien Le Moal

[permalink] [raw]
Subject: Re: [PATCH v2 1/3] ACPI: Move ACPI_DEVICE_CLASS() to mod_devicetable.h

On 6/10/23 02:32, Rafael J. Wysocki wrote:
> On Fri, Jun 9, 2023 at 5:49 PM Andy Shevchenko
> <[email protected]> wrote:
>>
>> The data type of struct acpi_device_id is defined in the
>> mod_devicetable.h. It's suboptimal to require user with
>> the almost agnostic code to include acpi.h solely for the
>> macro that affects the data type defined elsewhere.
>>
>> Taking into account the above and for the sake of consistency
>> move ACPI_DEVICE_CLASS() to mod_devicetable.h.
>>
>> Note, that with CONFIG_ACPI=n the ID table will be filed with data
>> but it does not really matter because either it won't be used, or
>> won't be compiled in some cases (when guarded by respective ifdeffery).
>>
>> Signed-off-by: Andy Shevchenko <[email protected]>
>
> Acked-by: Rafael J. Wysocki <[email protected]>
>
> or please let me know if you want me to apply this.

Probably better if you take the whole thing. But if needed, I can take this
through the ata tree.


--
Damien Le Moal
Western Digital Research