File tree Expand file tree Collapse file tree 1 file changed +5
-22
lines changed Expand file tree Collapse file tree 1 file changed +5
-22
lines changed Original file line number Diff line number Diff line change 14
14
#include <linux/kernel.h>
15
15
#include <linux/module.h>
16
16
#include <linux/of_platform.h>
17
- #include <linux/of_gpio .h>
17
+ #include <linux/gpio/consumer .h>
18
18
#include <linux/pinctrl/consumer.h>
19
19
#include <linux/platform_device.h>
20
20
#include <linux/pm_runtime.h>
@@ -482,29 +482,12 @@ static void at91_usart_spi_init(struct at91_usart_spi *aus)
482
482
483
483
static int at91_usart_gpio_setup (struct platform_device * pdev )
484
484
{
485
- struct device_node * np = pdev -> dev .parent -> of_node ;
486
- int i ;
487
- int ret ;
488
- int nb ;
489
-
490
- if (!np )
491
- return - EINVAL ;
492
-
493
- nb = of_gpio_named_count (np , "cs-gpios" );
494
- for (i = 0 ; i < nb ; i ++ ) {
495
- int cs_gpio = of_get_named_gpio (np , "cs-gpios" , i );
485
+ struct gpio_descs * cs_gpios ;
496
486
497
- if (cs_gpio < 0 )
498
- return cs_gpio ;
487
+ cs_gpios = devm_gpiod_get_array_optional (& pdev -> dev , "cs" , GPIOD_OUT_LOW );
499
488
500
- if (gpio_is_valid (cs_gpio )) {
501
- ret = devm_gpio_request_one (& pdev -> dev , cs_gpio ,
502
- GPIOF_DIR_OUT ,
503
- dev_name (& pdev -> dev ));
504
- if (ret )
505
- return ret ;
506
- }
507
- }
489
+ if (IS_ERR (cs_gpios ))
490
+ return PTR_ERR (cs_gpios );
508
491
509
492
return 0 ;
510
493
}
You can’t perform that action at this time.
0 commit comments