diff mbox series

[v1,06/13] gpio: dwapb: Use device_get_match_data() to simplify code

Message ID 20200409141228.49561-7-andriy.shevchenko@linux.intel.com
State New
Headers show
Series gpio: dwapb: Clean up the driver and a fix | expand

Commit Message

Andy Shevchenko April 9, 2020, 2:12 p.m. UTC
Use device_get_match_data() here to simplify the code a bit.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/gpio/gpio-dwapb.c | 13 +------------
 1 file changed, 1 insertion(+), 12 deletions(-)

Comments

Serge Semin April 15, 2020, 12:46 p.m. UTC | #1
On Thu, Apr 09, 2020 at 05:12:21PM +0300, Andy Shevchenko wrote:
> Use device_get_match_data() here to simplify the code a bit.

Nice simplification. Thanks.

Reviewed-by: Serge Semin <fancer.lancer@gmail.com>

> 
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> ---
>  drivers/gpio/gpio-dwapb.c | 13 +------------
>  1 file changed, 1 insertion(+), 12 deletions(-)
> 
> diff --git a/drivers/gpio/gpio-dwapb.c b/drivers/gpio/gpio-dwapb.c
> index 3a1f3fae923f..a0a0288bb73e 100644
> --- a/drivers/gpio/gpio-dwapb.c
> +++ b/drivers/gpio/gpio-dwapb.c
> @@ -683,18 +683,7 @@ static int dwapb_gpio_probe(struct platform_device *pdev)
>  		return err;
>  	}
>  
> -	gpio->flags = 0;
> -	if (dev->of_node) {
> -		gpio->flags = (uintptr_t)of_device_get_match_data(dev);
> -	} else if (has_acpi_companion(dev)) {
> -		const struct acpi_device_id *acpi_id;
> -
> -		acpi_id = acpi_match_device(dwapb_acpi_match, dev);
> -		if (acpi_id) {
> -			if (acpi_id->driver_data)
> -				gpio->flags = acpi_id->driver_data;
> -		}
> -	}
> +	gpio->flags = (uintptr_t)device_get_match_data(dev);
>  
>  	for (i = 0; i < gpio->nr_ports; i++) {
>  		err = dwapb_gpio_add_port(gpio, &pdata->properties[i], i);
> -- 
> 2.25.1
>
diff mbox series

Patch

diff --git a/drivers/gpio/gpio-dwapb.c b/drivers/gpio/gpio-dwapb.c
index 3a1f3fae923f..a0a0288bb73e 100644
--- a/drivers/gpio/gpio-dwapb.c
+++ b/drivers/gpio/gpio-dwapb.c
@@ -683,18 +683,7 @@  static int dwapb_gpio_probe(struct platform_device *pdev)
 		return err;
 	}
 
-	gpio->flags = 0;
-	if (dev->of_node) {
-		gpio->flags = (uintptr_t)of_device_get_match_data(dev);
-	} else if (has_acpi_companion(dev)) {
-		const struct acpi_device_id *acpi_id;
-
-		acpi_id = acpi_match_device(dwapb_acpi_match, dev);
-		if (acpi_id) {
-			if (acpi_id->driver_data)
-				gpio->flags = acpi_id->driver_data;
-		}
-	}
+	gpio->flags = (uintptr_t)device_get_match_data(dev);
 
 	for (i = 0; i < gpio->nr_ports; i++) {
 		err = dwapb_gpio_add_port(gpio, &pdata->properties[i], i);