linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v1] i2c-hid: Use ACPI_COMPANION() directly
@ 2018-01-19 14:35 Andy Shevchenko
  2018-01-29 15:48 ` Andy Shevchenko
  2018-02-16 12:21 ` Jiri Kosina
  0 siblings, 2 replies; 3+ messages in thread
From: Andy Shevchenko @ 2018-01-19 14:35 UTC (permalink / raw)
  To: Jiri Kosina, Benjamin Tissoires, linux-input; +Cc: Andy Shevchenko

Instead of doing additional checks and functional calls,
just get ACPI companion device directly.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/hid/i2c-hid/i2c-hid.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/hid/i2c-hid/i2c-hid.c b/drivers/hid/i2c-hid/i2c-hid.c
index 7230243b94d3..0d3ca542e987 100644
--- a/drivers/hid/i2c-hid/i2c-hid.c
+++ b/drivers/hid/i2c-hid/i2c-hid.c
@@ -891,10 +891,10 @@ static int i2c_hid_acpi_pdata(struct i2c_client *client,
 
 static void i2c_hid_acpi_fix_up_power(struct device *dev)
 {
-	acpi_handle handle = ACPI_HANDLE(dev);
 	struct acpi_device *adev;
 
-	if (handle && acpi_bus_get_device(handle, &adev) == 0)
+	adev = ACPI_COMPANION(dev);
+	if (adev)
 		acpi_device_fix_up_power(adev);
 }
 
-- 
2.15.1


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

* Re: [PATCH v1] i2c-hid: Use ACPI_COMPANION() directly
  2018-01-19 14:35 [PATCH v1] i2c-hid: Use ACPI_COMPANION() directly Andy Shevchenko
@ 2018-01-29 15:48 ` Andy Shevchenko
  2018-02-16 12:21 ` Jiri Kosina
  1 sibling, 0 replies; 3+ messages in thread
From: Andy Shevchenko @ 2018-01-29 15:48 UTC (permalink / raw)
  To: Jiri Kosina, Benjamin Tissoires, linux-input

On Fri, 2018-01-19 at 16:35 +0200, Andy Shevchenko wrote:
> Instead of doing additional checks and functional calls,
> just get ACPI companion device directly.
> 

Any comments on this? The rationale is to prevent people copy'n'paste
current approach instead of better one which is presented by this
change.

> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> ---
>  drivers/hid/i2c-hid/i2c-hid.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/hid/i2c-hid/i2c-hid.c b/drivers/hid/i2c-hid/i2c-
> hid.c
> index 7230243b94d3..0d3ca542e987 100644
> --- a/drivers/hid/i2c-hid/i2c-hid.c
> +++ b/drivers/hid/i2c-hid/i2c-hid.c
> @@ -891,10 +891,10 @@ static int i2c_hid_acpi_pdata(struct i2c_client
> *client,
>  
>  static void i2c_hid_acpi_fix_up_power(struct device *dev)
>  {
> -	acpi_handle handle = ACPI_HANDLE(dev);
>  	struct acpi_device *adev;
>  
> -	if (handle && acpi_bus_get_device(handle, &adev) == 0)
> +	adev = ACPI_COMPANION(dev);
> +	if (adev)
>  		acpi_device_fix_up_power(adev);
>  }
>  

-- 
Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Intel Finland Oy

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

* Re: [PATCH v1] i2c-hid: Use ACPI_COMPANION() directly
  2018-01-19 14:35 [PATCH v1] i2c-hid: Use ACPI_COMPANION() directly Andy Shevchenko
  2018-01-29 15:48 ` Andy Shevchenko
@ 2018-02-16 12:21 ` Jiri Kosina
  1 sibling, 0 replies; 3+ messages in thread
From: Jiri Kosina @ 2018-02-16 12:21 UTC (permalink / raw)
  To: Andy Shevchenko; +Cc: Benjamin Tissoires, linux-input

On Fri, 19 Jan 2018, Andy Shevchenko wrote:

> Instead of doing additional checks and functional calls,
> just get ACPI companion device directly.
> 
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> ---
>  drivers/hid/i2c-hid/i2c-hid.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/hid/i2c-hid/i2c-hid.c b/drivers/hid/i2c-hid/i2c-hid.c
> index 7230243b94d3..0d3ca542e987 100644
> --- a/drivers/hid/i2c-hid/i2c-hid.c
> +++ b/drivers/hid/i2c-hid/i2c-hid.c
> @@ -891,10 +891,10 @@ static int i2c_hid_acpi_pdata(struct i2c_client *client,
>  
>  static void i2c_hid_acpi_fix_up_power(struct device *dev)
>  {
> -	acpi_handle handle = ACPI_HANDLE(dev);
>  	struct acpi_device *adev;
>  
> -	if (handle && acpi_bus_get_device(handle, &adev) == 0)
> +	adev = ACPI_COMPANION(dev);
> +	if (adev)
>  		acpi_device_fix_up_power(adev);
>  }

Applied to for-4.17/hid-i2c. Thanks,

-- 
Jiri Kosina
SUSE Labs


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

end of thread, other threads:[~2018-02-16 12:21 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-01-19 14:35 [PATCH v1] i2c-hid: Use ACPI_COMPANION() directly Andy Shevchenko
2018-01-29 15:48 ` Andy Shevchenko
2018-02-16 12:21 ` Jiri Kosina

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).