Thread (10 messages) 10 messages, 8 authors, 2022-08-30

Re: [PATCH v2 5/5] ACPI: Drop parent field from struct acpi_device

From: Rafael J. Wysocki <hidden>
Date: 2022-08-29 15:54:16
Also in: linux-acpi, linux-arm-kernel, linux-arm-msm, linux-pm, linux-spi, linux-usb, lkml

On Saturday, August 27, 2022 3:19:33 PM CEST Hanjun Guo wrote:
Hi Rafael,

On 2022/8/25 0:59, Rafael J. Wysocki wrote:
quoted
Index: linux-pm/include/acpi/acpi_bus.h
===================================================================
--- linux-pm.orig/include/acpi/acpi_bus.h
+++ linux-pm/include/acpi/acpi_bus.h
@@ -365,7 +365,6 @@ struct acpi_device {
  	int device_type;
  	acpi_handle handle;		/* no handle for fixed hardware */
  	struct fwnode_handle fwnode;
-	struct acpi_device *parent;
  	struct list_head wakeup_list;
  	struct list_head del_list;
  	struct acpi_device_status status;
@@ -458,6 +457,14 @@ static inline void *acpi_driver_data(str
  #define to_acpi_device(d)	container_of(d, struct acpi_device, dev)
  #define to_acpi_driver(d)	container_of(d, struct acpi_driver, drv)
  
+static inline struct acpi_device *acpi_dev_parent(struct acpi_device *adev)
+{
+	if (adev->dev.parent)
+		return to_acpi_device(adev->dev.parent);
+
+	return NULL;
+}
+
  static inline void acpi_set_device_status(struct acpi_device *adev, u32 sta)
  {
  	*((u32 *)&adev->status) = sta;
@@ -478,6 +485,7 @@ void acpi_initialize_hp_context(struct a
  /* acpi_device.dev.bus == &acpi_bus_type */
  extern struct bus_type acpi_bus_type;
  
+struct acpi_device *acpi_dev_parent(struct acpi_device *adev);
We have a static inline function above, is it duplicated here?
Or did I miss some use cases?
No, you didn't, it is redundant.

I've just sent a fix for this.

Thanks!


Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help