diff mbox series

[1/2] ACPI: Add helper acpi_use_parent_companion

Message ID 6e935761-5b36-411a-ac82-cbc394bba7b6@gmail.com
State New
Headers show
Series Add and use new helper acpi_use_parent_companion | expand

Commit Message

Heiner Kallweit Oct. 15, 2023, 9:34 p.m. UTC
In several drivers devices use the ACPI companion of the parent.
Add a helper for this use case to avoid code duplication.

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
---
 include/linux/acpi.h | 5 +++++
 1 file changed, 5 insertions(+)

Comments

Rafael J. Wysocki Oct. 18, 2023, 10:51 a.m. UTC | #1
On Sun, Oct 15, 2023 at 11:34 PM Heiner Kallweit <hkallweit1@gmail.com> wrote:
>
> In several drivers devices use the ACPI companion of the parent.
> Add a helper for this use case to avoid code duplication.
>
> Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>

Acked-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>

or do you want me to apply it?

> ---
>  include/linux/acpi.h | 5 +++++
>  1 file changed, 5 insertions(+)
>
> diff --git a/include/linux/acpi.h b/include/linux/acpi.h
> index ba3f601b6..89efb1658 100644
> --- a/include/linux/acpi.h
> +++ b/include/linux/acpi.h
> @@ -1541,4 +1541,9 @@ static inline void acpi_device_notify(struct device *dev) { }
>  static inline void acpi_device_notify_remove(struct device *dev) { }
>  #endif
>
> +static inline void acpi_use_parent_companion(struct device *dev)
> +{
> +       ACPI_COMPANION_SET(dev, ACPI_COMPANION(dev->parent));
> +}
> +
>  #endif /*_LINUX_ACPI_H*/
> --
> 2.42.0
>
>
Heiner Kallweit Oct. 18, 2023, 12:19 p.m. UTC | #2
On 18.10.2023 12:51, Rafael J. Wysocki wrote:
> On Sun, Oct 15, 2023 at 11:34 PM Heiner Kallweit <hkallweit1@gmail.com> wrote:
>>
>> In several drivers devices use the ACPI companion of the parent.
>> Add a helper for this use case to avoid code duplication.
>>
>> Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
> 
> Acked-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> 
> or do you want me to apply it?
> 
Patch 2 of the series will apply cleanly only after the following
patch that has been reviewed/acked, but not applied yet.
https://patchwork.ozlabs.org/project/linux-i2c/patch/2192294e-99ab-4c7d-86b1-edff058d82f3@gmail.com/
So my preference is to apply the series through the i2c tree.
+Wolfram

>> ---
>>  include/linux/acpi.h | 5 +++++
>>  1 file changed, 5 insertions(+)
>>
>> diff --git a/include/linux/acpi.h b/include/linux/acpi.h
>> index ba3f601b6..89efb1658 100644
>> --- a/include/linux/acpi.h
>> +++ b/include/linux/acpi.h
>> @@ -1541,4 +1541,9 @@ static inline void acpi_device_notify(struct device *dev) { }
>>  static inline void acpi_device_notify_remove(struct device *dev) { }
>>  #endif
>>
>> +static inline void acpi_use_parent_companion(struct device *dev)
>> +{
>> +       ACPI_COMPANION_SET(dev, ACPI_COMPANION(dev->parent));
>> +}
>> +
>>  #endif /*_LINUX_ACPI_H*/
>> --
>> 2.42.0
>>
>>
Andi Shyti Oct. 24, 2023, 5:33 p.m. UTC | #3
Hi Heiner,

On Sun, Oct 15, 2023 at 11:34:25PM +0200, Heiner Kallweit wrote:
> In several drivers devices use the ACPI companion of the parent.
> Add a helper for this use case to avoid code duplication.
> 
> Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>

Reviewed-by: Andi Shyti <andi.shyti@kernel.org>

Wolfram, can we take this in i2c? Otherwise this will take two
release rounds to get in.

Andi
Wolfram Sang Oct. 26, 2023, 5:26 p.m. UTC | #4
> Wolfram, can we take this in i2c? Otherwise this will take two
> release rounds to get in.

In general, I can, no problem. But there is still on-going discussion
regarding patch 2. So, I will wait for a conclusion there. I am not
familiar enough with ACPI to have an own opinion about that topic.
Heiner Kallweit Oct. 26, 2023, 8:17 p.m. UTC | #5
On 26.10.2023 19:26, Wolfram Sang wrote:
> 
>> Wolfram, can we take this in i2c? Otherwise this will take two
>> release rounds to get in.
> 
> In general, I can, no problem. But there is still on-going discussion
> regarding patch 2. So, I will wait for a conclusion there. I am not
> familiar enough with ACPI to have an own opinion about that topic.
> 
Not sure whether the discussion is ongoing, my impression is it stalled.
Rafael as ACPI maintainer thinks the helper makes sense and therefore
acked it. Andi shares this opinion, and others like Jean have doubts.
For sure I won't receive a Turing award for this helper, but it's IMO
better than the cascaded macros.
Wolfram Sang Oct. 28, 2023, 1:30 p.m. UTC | #6
On Sun, Oct 15, 2023 at 11:34:25PM +0200, Heiner Kallweit wrote:
> In several drivers devices use the ACPI companion of the parent.
> Add a helper for this use case to avoid code duplication.
> 
> Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>

Applied to for-next, thanks!
diff mbox series

Patch

diff --git a/include/linux/acpi.h b/include/linux/acpi.h
index ba3f601b6..89efb1658 100644
--- a/include/linux/acpi.h
+++ b/include/linux/acpi.h
@@ -1541,4 +1541,9 @@  static inline void acpi_device_notify(struct device *dev) { }
 static inline void acpi_device_notify_remove(struct device *dev) { }
 #endif
 
+static inline void acpi_use_parent_companion(struct device *dev)
+{
+	ACPI_COMPANION_SET(dev, ACPI_COMPANION(dev->parent));
+}
+
 #endif	/*_LINUX_ACPI_H*/