linux-i2c.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v1 3/7] i2c: i2c-amd-mp2-plat: ACPI: Use ACPI_COMPANION() directly
       [not found] <4369779.LvFx2qVVIh@kreacher>
@ 2021-10-12 17:44 ` Rafael J. Wysocki
  2021-10-12 18:12   ` Shyam Sundar S K
  2021-10-13 16:09   ` [PATCH v2 " Rafael J. Wysocki
  0 siblings, 2 replies; 4+ messages in thread
From: Rafael J. Wysocki @ 2021-10-12 17:44 UTC (permalink / raw)
  To: Linux ACPI; +Cc: LKML, Elie Morisse, Nehal Shah, Shyam Sundar S K, linux-i2c

From: Rafael J. Wysocki <rafael@kernel.org>

The ACPI_HANDLE() macro is a wrapper arond the ACPI_COMPANION()
macro and the ACPI handle produced by the former comes from the
ACPI device object produced by the latter, so it is way more
straightforward to evaluate the latter directly instead of passing
the handle produced by the former to acpi_bus_get_device().

Modify i2c_amd_probe() accordingly (no intentional functional impact).

Signed-off-by: Rafael J. Wysocki <rafael@kernel.org>
---
 drivers/i2c/busses/i2c-amd-mp2-plat.c |    5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

Index: linux-pm/drivers/i2c/busses/i2c-amd-mp2-plat.c
===================================================================
--- linux-pm.orig/drivers/i2c/busses/i2c-amd-mp2-plat.c
+++ linux-pm/drivers/i2c/busses/i2c-amd-mp2-plat.c
@@ -246,12 +246,11 @@ static int i2c_amd_probe(struct platform
 {
 	int ret;
 	struct amd_i2c_dev *i2c_dev;
-	acpi_handle handle = ACPI_HANDLE(&pdev->dev);
-	struct acpi_device *adev;
+	struct acpi_device *adev = ACPI_COMPANION(&pdev->dev);
 	struct amd_mp2_dev *mp2_dev;
 	const char *uid;
 
-	if (acpi_bus_get_device(handle, &adev))
+	if (!adev)
 		return -ENODEV;
 
 	/* The ACPI namespace doesn't contain information about which MP2 PCI




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

* Re: [PATCH v1 3/7] i2c: i2c-amd-mp2-plat: ACPI: Use ACPI_COMPANION() directly
  2021-10-12 17:44 ` [PATCH v1 3/7] i2c: i2c-amd-mp2-plat: ACPI: Use ACPI_COMPANION() directly Rafael J. Wysocki
@ 2021-10-12 18:12   ` Shyam Sundar S K
  2021-10-13 16:09   ` [PATCH v2 " Rafael J. Wysocki
  1 sibling, 0 replies; 4+ messages in thread
From: Shyam Sundar S K @ 2021-10-12 18:12 UTC (permalink / raw)
  To: Rafael J. Wysocki, Linux ACPI; +Cc: LKML, Elie Morisse, Nehal Shah, linux-i2c



On 10/12/2021 11:14 PM, Rafael J. Wysocki wrote:
> From: Rafael J. Wysocki <rafael@kernel.org>
> 
> The ACPI_HANDLE() macro is a wrapper arond the ACPI_COMPANION()
> macro and the ACPI handle produced by the former comes from the
> ACPI device object produced by the latter, so it is way more
> straightforward to evaluate the latter directly instead of passing
> the handle produced by the former to acpi_bus_get_device().
> 
> Modify i2c_amd_probe() accordingly (no intentional functional impact).
> 
> Signed-off-by: Rafael J. Wysocki <rafael@kernel.org>

Looks good to me.

Acked-by: Shyam Sundar S K <Shyam-sundar.S-k@amd.com>

> ---
>  drivers/i2c/busses/i2c-amd-mp2-plat.c |    5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)
> 
> Index: linux-pm/drivers/i2c/busses/i2c-amd-mp2-plat.c
> ===================================================================
> --- linux-pm.orig/drivers/i2c/busses/i2c-amd-mp2-plat.c
> +++ linux-pm/drivers/i2c/busses/i2c-amd-mp2-plat.c
> @@ -246,12 +246,11 @@ static int i2c_amd_probe(struct platform
>  {
>  	int ret;
>  	struct amd_i2c_dev *i2c_dev;
> -	acpi_handle handle = ACPI_HANDLE(&pdev->dev);
> -	struct acpi_device *adev;
> +	struct acpi_device *adev = ACPI_COMPANION(&pdev->dev);
>  	struct amd_mp2_dev *mp2_dev;
>  	const char *uid;
>  
> -	if (acpi_bus_get_device(handle, &adev))
> +	if (!adev)
>  		return -ENODEV;
>  
>  	/* The ACPI namespace doesn't contain information about which MP2 PCI
> 
> 
> 

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

* [PATCH v2 3/7] i2c: i2c-amd-mp2-plat: ACPI: Use ACPI_COMPANION() directly
  2021-10-12 17:44 ` [PATCH v1 3/7] i2c: i2c-amd-mp2-plat: ACPI: Use ACPI_COMPANION() directly Rafael J. Wysocki
  2021-10-12 18:12   ` Shyam Sundar S K
@ 2021-10-13 16:09   ` Rafael J. Wysocki
  2021-10-17 14:22     ` Wolfram Sang
  1 sibling, 1 reply; 4+ messages in thread
From: Rafael J. Wysocki @ 2021-10-13 16:09 UTC (permalink / raw)
  To: Linux ACPI; +Cc: LKML, Elie Morisse, Nehal Shah, Shyam Sundar S K, linux-i2c

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

The ACPI_HANDLE() macro is a wrapper arond the ACPI_COMPANION()
macro and the ACPI handle produced by the former comes from the
ACPI device object produced by the latter, so it is way more
straightforward to evaluate the latter directly instead of passing
the handle produced by the former to acpi_bus_get_device().

Modify i2c_amd_probe() accordingly (no intentional functional impact).

Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Acked-by: Shyam Sundar S K <Shyam-sundar.S-k@amd.com>
---

v1 -> v2:
   * Resend with a different From and S-o-b address and with maintainer ACK.
     No other changes.

---
 drivers/i2c/busses/i2c-amd-mp2-plat.c |    5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

Index: linux-pm/drivers/i2c/busses/i2c-amd-mp2-plat.c
===================================================================
--- linux-pm.orig/drivers/i2c/busses/i2c-amd-mp2-plat.c
+++ linux-pm/drivers/i2c/busses/i2c-amd-mp2-plat.c
@@ -246,12 +246,11 @@ static int i2c_amd_probe(struct platform
 {
 	int ret;
 	struct amd_i2c_dev *i2c_dev;
-	acpi_handle handle = ACPI_HANDLE(&pdev->dev);
-	struct acpi_device *adev;
+	struct acpi_device *adev = ACPI_COMPANION(&pdev->dev);
 	struct amd_mp2_dev *mp2_dev;
 	const char *uid;
 
-	if (acpi_bus_get_device(handle, &adev))
+	if (!adev)
 		return -ENODEV;
 
 	/* The ACPI namespace doesn't contain information about which MP2 PCI




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

* Re: [PATCH v2 3/7] i2c: i2c-amd-mp2-plat: ACPI: Use ACPI_COMPANION() directly
  2021-10-13 16:09   ` [PATCH v2 " Rafael J. Wysocki
@ 2021-10-17 14:22     ` Wolfram Sang
  0 siblings, 0 replies; 4+ messages in thread
From: Wolfram Sang @ 2021-10-17 14:22 UTC (permalink / raw)
  To: Rafael J. Wysocki
  Cc: Linux ACPI, LKML, Elie Morisse, Nehal Shah, Shyam Sundar S K,
	linux-i2c

[-- Attachment #1: Type: text/plain, Size: 697 bytes --]

On Wed, Oct 13, 2021 at 06:09:39PM +0200, Rafael J. Wysocki wrote:
> From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> 
> The ACPI_HANDLE() macro is a wrapper arond the ACPI_COMPANION()
> macro and the ACPI handle produced by the former comes from the
> ACPI device object produced by the latter, so it is way more
> straightforward to evaluate the latter directly instead of passing
> the handle produced by the former to acpi_bus_get_device().
> 
> Modify i2c_amd_probe() accordingly (no intentional functional impact).
> 
> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> Acked-by: Shyam Sundar S K <Shyam-sundar.S-k@amd.com>

Applied to for-next, thanks!


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

end of thread, other threads:[~2021-10-17 14:22 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <4369779.LvFx2qVVIh@kreacher>
2021-10-12 17:44 ` [PATCH v1 3/7] i2c: i2c-amd-mp2-plat: ACPI: Use ACPI_COMPANION() directly Rafael J. Wysocki
2021-10-12 18:12   ` Shyam Sundar S K
2021-10-13 16:09   ` [PATCH v2 " Rafael J. Wysocki
2021-10-17 14:22     ` Wolfram Sang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).