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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Rafael,

On 2022/8/25 0:59, Rafael J. Wysocki wrote:
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?

Thanks
Hanjun



[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux