linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v1 1/1] Input: goodix - switch use of acpi_gpio_get_*_resource() APIs
@ 2022-07-05 18:02 Andy Shevchenko
  2022-07-06 20:40 ` Hans de Goede
  2022-07-06 23:33 ` Dmitry Torokhov
  0 siblings, 2 replies; 3+ messages in thread
From: Andy Shevchenko @ 2022-07-05 18:02 UTC (permalink / raw)
  To: Dmitry Torokhov, Hans de Goede, linux-input, linux-kernel
  Cc: Bastien Nocera, Andy Shevchenko

No need to open code functionality that is provided by the
acpi_gpio_get_irq_resource() and acpi_gpio_get_io_resource().

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/input/touchscreen/goodix.c | 22 ++++++++--------------
 1 file changed, 8 insertions(+), 14 deletions(-)

diff --git a/drivers/input/touchscreen/goodix.c b/drivers/input/touchscreen/goodix.c
index 3ad9870db108..cc52f0d21dbb 100644
--- a/drivers/input/touchscreen/goodix.c
+++ b/drivers/input/touchscreen/goodix.c
@@ -822,22 +822,16 @@ static int goodix_resource(struct acpi_resource *ares, void *data)
 	struct device *dev = &ts->client->dev;
 	struct acpi_resource_gpio *gpio;
 
-	switch (ares->type) {
-	case ACPI_RESOURCE_TYPE_GPIO:
-		gpio = &ares->data.gpio;
-		if (gpio->connection_type == ACPI_RESOURCE_GPIO_TYPE_INT) {
-			if (ts->gpio_int_idx == -1) {
-				ts->gpio_int_idx = ts->gpio_count;
-			} else {
-				dev_err(dev, "More then one GpioInt resource, ignoring ACPI GPIO resources\n");
-				ts->gpio_int_idx = -2;
-			}
+	if (acpi_gpio_get_irq_resource(ares, &gpio)) {
+		if (ts->gpio_int_idx == -1) {
+			ts->gpio_int_idx = ts->gpio_count;
+		} else {
+			dev_err(dev, "More then one GpioInt resource, ignoring ACPI GPIO resources\n");
+			ts->gpio_int_idx = -2;
 		}
 		ts->gpio_count++;
-		break;
-	default:
-		break;
-	}
+	} else if (acpi_gpio_get_io_resource(ares, &gpio))
+		ts->gpio_count++;
 
 	return 0;
 }
-- 
2.35.1


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

* Re: [PATCH v1 1/1] Input: goodix - switch use of acpi_gpio_get_*_resource() APIs
  2022-07-05 18:02 [PATCH v1 1/1] Input: goodix - switch use of acpi_gpio_get_*_resource() APIs Andy Shevchenko
@ 2022-07-06 20:40 ` Hans de Goede
  2022-07-06 23:33 ` Dmitry Torokhov
  1 sibling, 0 replies; 3+ messages in thread
From: Hans de Goede @ 2022-07-06 20:40 UTC (permalink / raw)
  To: Andy Shevchenko, Dmitry Torokhov, linux-input, linux-kernel
  Cc: Bastien Nocera

Hi,

On 7/5/22 20:02, Andy Shevchenko wrote:
> No need to open code functionality that is provided by the
> acpi_gpio_get_irq_resource() and acpi_gpio_get_io_resource().
> 
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

Thanks, patch looks good to me:

Reviewed-by: Hans de Goede <hdegoede@redhat.com>

Regards,

Hans


> ---
>  drivers/input/touchscreen/goodix.c | 22 ++++++++--------------
>  1 file changed, 8 insertions(+), 14 deletions(-)
> 
> diff --git a/drivers/input/touchscreen/goodix.c b/drivers/input/touchscreen/goodix.c
> index 3ad9870db108..cc52f0d21dbb 100644
> --- a/drivers/input/touchscreen/goodix.c
> +++ b/drivers/input/touchscreen/goodix.c
> @@ -822,22 +822,16 @@ static int goodix_resource(struct acpi_resource *ares, void *data)
>  	struct device *dev = &ts->client->dev;
>  	struct acpi_resource_gpio *gpio;
>  
> -	switch (ares->type) {
> -	case ACPI_RESOURCE_TYPE_GPIO:
> -		gpio = &ares->data.gpio;
> -		if (gpio->connection_type == ACPI_RESOURCE_GPIO_TYPE_INT) {
> -			if (ts->gpio_int_idx == -1) {
> -				ts->gpio_int_idx = ts->gpio_count;
> -			} else {
> -				dev_err(dev, "More then one GpioInt resource, ignoring ACPI GPIO resources\n");
> -				ts->gpio_int_idx = -2;
> -			}
> +	if (acpi_gpio_get_irq_resource(ares, &gpio)) {
> +		if (ts->gpio_int_idx == -1) {
> +			ts->gpio_int_idx = ts->gpio_count;
> +		} else {
> +			dev_err(dev, "More then one GpioInt resource, ignoring ACPI GPIO resources\n");
> +			ts->gpio_int_idx = -2;
>  		}
>  		ts->gpio_count++;
> -		break;
> -	default:
> -		break;
> -	}
> +	} else if (acpi_gpio_get_io_resource(ares, &gpio))
> +		ts->gpio_count++;
>  
>  	return 0;
>  }


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

* Re: [PATCH v1 1/1] Input: goodix - switch use of acpi_gpio_get_*_resource() APIs
  2022-07-05 18:02 [PATCH v1 1/1] Input: goodix - switch use of acpi_gpio_get_*_resource() APIs Andy Shevchenko
  2022-07-06 20:40 ` Hans de Goede
@ 2022-07-06 23:33 ` Dmitry Torokhov
  1 sibling, 0 replies; 3+ messages in thread
From: Dmitry Torokhov @ 2022-07-06 23:33 UTC (permalink / raw)
  To: Andy Shevchenko; +Cc: Hans de Goede, linux-input, linux-kernel, Bastien Nocera

On Tue, Jul 05, 2022 at 09:02:51PM +0300, Andy Shevchenko wrote:
> No need to open code functionality that is provided by the
> acpi_gpio_get_irq_resource() and acpi_gpio_get_io_resource().
> 
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

Applied, thank you.

-- 
Dmitry

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

end of thread, other threads:[~2022-07-06 23:33 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-05 18:02 [PATCH v1 1/1] Input: goodix - switch use of acpi_gpio_get_*_resource() APIs Andy Shevchenko
2022-07-06 20:40 ` Hans de Goede
2022-07-06 23:33 ` Dmitry Torokhov

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