mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v1] ACPI: bus: Drop two fields from struct acpi_device_pnp
@ 2026-08-31 20:07 Rafael J. Wysocki
  2026-08-31 20:11 ` Hans de Goede
  2026-09-01  7:45 ` Andy Shevchenko
  0 siblings, 2 replies; 4+ messages in thread
From: Rafael J. Wysocki @ 2026-08-31 20:07 UTC (permalink / raw)
  To: Linux ACPI
  Cc: LKML, Ilpo Järvinen, Hans de Goede, platform-driver-x86,
	Andy Shevchenko

From: "Rafael J. Wysocki" <rafael.j.wysocki@intel.com>

There are two fields in struct acpi_device_pnp, device_name and
device_class, that were supposed to be populated and used by device
drivers, but they have never been used consistently and now they
are only set for the bus object in acpi_set_pnp_ids() (and never
read afterward).

Drop them along with all of the associated symbols except for
MAX_ACPI_CLASS_NAME_LEN and the acpi_device_class typedef that
are used by the ACPI netlink messaging code.  Move those two
definitions closer to the struct acpi_bus_event that refers to
the acpi_device_class type.

No intentional functional impact.

Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
---
 drivers/acpi/scan.c     |    4 ----
 include/acpi/acpi_bus.h |   11 +++--------
 2 files changed, 3 insertions(+), 12 deletions(-)

--- a/drivers/acpi/scan.c
+++ b/drivers/acpi/scan.c
@@ -28,9 +28,7 @@
 #include "internal.h"
 #include "sleep.h"
 
-#define ACPI_BUS_CLASS			"system_bus"
 #define ACPI_BUS_HID			"LNXSYBUS"
-#define ACPI_BUS_DEVICE_NAME		"System Bus"
 
 #define INVALID_ACPI_HANDLE	((acpi_handle)ZERO_PAGE(0))
 
@@ -1446,8 +1444,6 @@ static void acpi_set_pnp_ids(acpi_handle
 			 acpi_object_is_system_bus(handle)) {
 			/* \_SB, \_TZ, LNXSYBUS */
 			acpi_add_id(pnp, ACPI_BUS_HID);
-			strscpy(pnp->device_name, ACPI_BUS_DEVICE_NAME);
-			strscpy(pnp->device_class, ACPI_BUS_CLASS);
 		}
 
 		break;
--- a/include/acpi/acpi_bus.h
+++ b/include/acpi/acpi_bus.h
@@ -206,12 +206,8 @@ struct acpi_device_dir {
 
 /* Plug and Play */
 
-#define MAX_ACPI_DEVICE_NAME_LEN	40
-#define MAX_ACPI_CLASS_NAME_LEN		20
 typedef char acpi_bus_id[8];
 typedef u64 acpi_bus_address;
-typedef char acpi_device_name[MAX_ACPI_DEVICE_NAME_LEN];
-typedef char acpi_device_class[MAX_ACPI_CLASS_NAME_LEN];
 
 struct acpi_hardware_id {
 	struct list_head list;
@@ -233,16 +229,12 @@ struct acpi_device_pnp {
 	acpi_bus_address bus_address;	/* _ADR */
 	char *unique_id;		/* _UID */
 	struct list_head ids;		/* _HID and _CIDs */
-	acpi_device_name device_name;	/* Driver-determined */
-	acpi_device_class device_class;	/*        "          */
 };
 
 #define acpi_device_bid(d)	((d)->pnp.bus_id)
 #define acpi_device_adr(d)	((d)->pnp.bus_address)
 const char *acpi_device_hid(struct acpi_device *device);
 #define acpi_device_uid(d)	((d)->pnp.unique_id)
-#define acpi_device_name(d)	((d)->pnp.device_name)
-#define acpi_device_class(d)	((d)->pnp.device_class)
 
 /* Power Management */
 
@@ -582,6 +574,9 @@ int acpi_dev_for_each_child_reverse(stru
  * ------
  */
 
+#define MAX_ACPI_CLASS_NAME_LEN		20
+typedef char acpi_device_class[MAX_ACPI_CLASS_NAME_LEN];
+
 struct acpi_bus_event {
 	struct list_head node;
 	acpi_device_class device_class;




^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v1] ACPI: bus: Drop two fields from struct acpi_device_pnp
  2026-08-31 20:07 [PATCH v1] ACPI: bus: Drop two fields from struct acpi_device_pnp Rafael J. Wysocki
@ 2026-08-31 20:11 ` Hans de Goede
  2026-09-01  7:45 ` Andy Shevchenko
  1 sibling, 0 replies; 4+ messages in thread
From: Hans de Goede @ 2026-08-31 20:11 UTC (permalink / raw)
  To: Rafael J. Wysocki, Linux ACPI
  Cc: LKML, Ilpo Järvinen, platform-driver-x86, Andy Shevchenko

Hi,

On 31-Aug-26 22:07, Rafael J. Wysocki wrote:
> From: "Rafael J. Wysocki" <rafael.j.wysocki@intel.com>
> 
> There are two fields in struct acpi_device_pnp, device_name and
> device_class, that were supposed to be populated and used by device
> drivers, but they have never been used consistently and now they
> are only set for the bus object in acpi_set_pnp_ids() (and never
> read afterward).
> 
> Drop them along with all of the associated symbols except for
> MAX_ACPI_CLASS_NAME_LEN and the acpi_device_class typedef that
> are used by the ACPI netlink messaging code.  Move those two
> definitions closer to the struct acpi_bus_event that refers to
> the acpi_device_class type.
> 
> No intentional functional impact.
> 
> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>

Nice :)  Patch looks good to me:

Reviewed-by: Hans de Goede <johannes.goede@oss.qualcomm.com>

Regards,

Hans



> ---
>  drivers/acpi/scan.c     |    4 ----
>  include/acpi/acpi_bus.h |   11 +++--------
>  2 files changed, 3 insertions(+), 12 deletions(-)
> 
> --- a/drivers/acpi/scan.c
> +++ b/drivers/acpi/scan.c
> @@ -28,9 +28,7 @@
>  #include "internal.h"
>  #include "sleep.h"
>  
> -#define ACPI_BUS_CLASS			"system_bus"
>  #define ACPI_BUS_HID			"LNXSYBUS"
> -#define ACPI_BUS_DEVICE_NAME		"System Bus"
>  
>  #define INVALID_ACPI_HANDLE	((acpi_handle)ZERO_PAGE(0))
>  
> @@ -1446,8 +1444,6 @@ static void acpi_set_pnp_ids(acpi_handle
>  			 acpi_object_is_system_bus(handle)) {
>  			/* \_SB, \_TZ, LNXSYBUS */
>  			acpi_add_id(pnp, ACPI_BUS_HID);
> -			strscpy(pnp->device_name, ACPI_BUS_DEVICE_NAME);
> -			strscpy(pnp->device_class, ACPI_BUS_CLASS);
>  		}
>  
>  		break;
> --- a/include/acpi/acpi_bus.h
> +++ b/include/acpi/acpi_bus.h
> @@ -206,12 +206,8 @@ struct acpi_device_dir {
>  
>  /* Plug and Play */
>  
> -#define MAX_ACPI_DEVICE_NAME_LEN	40
> -#define MAX_ACPI_CLASS_NAME_LEN		20
>  typedef char acpi_bus_id[8];
>  typedef u64 acpi_bus_address;
> -typedef char acpi_device_name[MAX_ACPI_DEVICE_NAME_LEN];
> -typedef char acpi_device_class[MAX_ACPI_CLASS_NAME_LEN];
>  
>  struct acpi_hardware_id {
>  	struct list_head list;
> @@ -233,16 +229,12 @@ struct acpi_device_pnp {
>  	acpi_bus_address bus_address;	/* _ADR */
>  	char *unique_id;		/* _UID */
>  	struct list_head ids;		/* _HID and _CIDs */
> -	acpi_device_name device_name;	/* Driver-determined */
> -	acpi_device_class device_class;	/*        "          */
>  };
>  
>  #define acpi_device_bid(d)	((d)->pnp.bus_id)
>  #define acpi_device_adr(d)	((d)->pnp.bus_address)
>  const char *acpi_device_hid(struct acpi_device *device);
>  #define acpi_device_uid(d)	((d)->pnp.unique_id)
> -#define acpi_device_name(d)	((d)->pnp.device_name)
> -#define acpi_device_class(d)	((d)->pnp.device_class)
>  
>  /* Power Management */
>  
> @@ -582,6 +574,9 @@ int acpi_dev_for_each_child_reverse(stru
>   * ------
>   */
>  
> +#define MAX_ACPI_CLASS_NAME_LEN		20
> +typedef char acpi_device_class[MAX_ACPI_CLASS_NAME_LEN];
> +
>  struct acpi_bus_event {
>  	struct list_head node;
>  	acpi_device_class device_class;
> 
> 
> 


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v1] ACPI: bus: Drop two fields from struct acpi_device_pnp
  2026-08-31 20:07 [PATCH v1] ACPI: bus: Drop two fields from struct acpi_device_pnp Rafael J. Wysocki
  2026-08-31 20:11 ` Hans de Goede
@ 2026-09-01  7:45 ` Andy Shevchenko
  2026-09-01 16:31   ` Rafael J. Wysocki (Intel)
  1 sibling, 1 reply; 4+ messages in thread
From: Andy Shevchenko @ 2026-09-01  7:45 UTC (permalink / raw)
  To: Rafael J. Wysocki
  Cc: Linux ACPI, LKML, Ilpo Järvinen, Hans de Goede, platform-driver-x86

On Mon, Aug 31, 2026 at 10:07:10PM +0200, Rafael J. Wysocki wrote:

> There are two fields in struct acpi_device_pnp, device_name and
> device_class, that were supposed to be populated and used by device
> drivers, but they have never been used consistently and now they
> are only set for the bus object in acpi_set_pnp_ids() (and never
> read afterward).
> 
> Drop them along with all of the associated symbols except for
> MAX_ACPI_CLASS_NAME_LEN and the acpi_device_class typedef that
> are used by the ACPI netlink messaging code.  Move those two
> definitions closer to the struct acpi_bus_event that refers to
> the acpi_device_class type.

Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

...

> +#define MAX_ACPI_CLASS_NAME_LEN		20
> +typedef char acpi_device_class[MAX_ACPI_CLASS_NAME_LEN];

Are you planning to use this in some future code?

>  struct acpi_bus_event {
>  	struct list_head node;
>  	acpi_device_class device_class;

Otherwise I would go with complete replacement of the above to simple

	char acpi_device_class[20];

here.

-- 
With Best Regards,
Andy Shevchenko



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v1] ACPI: bus: Drop two fields from struct acpi_device_pnp
  2026-09-01  7:45 ` Andy Shevchenko
@ 2026-09-01 16:31   ` Rafael J. Wysocki (Intel)
  0 siblings, 0 replies; 4+ messages in thread
From: Rafael J. Wysocki (Intel) @ 2026-09-01 16:31 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: Rafael J. Wysocki, Linux ACPI, LKML, Ilpo Järvinen,
	Hans de Goede, platform-driver-x86

On Tue, Sep 1, 2026 at 9:45 AM Andy Shevchenko
<andriy.shevchenko@linux.intel.com> wrote:
>
> On Mon, Aug 31, 2026 at 10:07:10PM +0200, Rafael J. Wysocki wrote:
>
> > There are two fields in struct acpi_device_pnp, device_name and
> > device_class, that were supposed to be populated and used by device
> > drivers, but they have never been used consistently and now they
> > are only set for the bus object in acpi_set_pnp_ids() (and never
> > read afterward).
> >
> > Drop them along with all of the associated symbols except for
> > MAX_ACPI_CLASS_NAME_LEN and the acpi_device_class typedef that
> > are used by the ACPI netlink messaging code.  Move those two
> > definitions closer to the struct acpi_bus_event that refers to
> > the acpi_device_class type.
>
> Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
>
> ...
>
> > +#define MAX_ACPI_CLASS_NAME_LEN              20
> > +typedef char acpi_device_class[MAX_ACPI_CLASS_NAME_LEN];
>
> Are you planning to use this in some future code?
>
> >  struct acpi_bus_event {
> >       struct list_head node;
> >       acpi_device_class device_class;
>
> Otherwise I would go with complete replacement of the above to simple
>
>         char acpi_device_class[20];
>
> here.

This is in use in the Thinkpad driver.

It might be replaced with something else, but that would be a separate patch.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-09-01 16:32 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-08-31 20:07 [PATCH v1] ACPI: bus: Drop two fields from struct acpi_device_pnp Rafael J. Wysocki
2026-08-31 20:11 ` Hans de Goede
2026-09-01  7:45 ` Andy Shevchenko
2026-09-01 16:31   ` Rafael J. Wysocki (Intel)

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®