Commit 3340ec49 authored by Maíra Canal's avatar Maíra Canal Committed by Mark Brown

spi: at91-usart: replacing legacy gpio interface for gpiod

Removing dependency of linux/of_gpio.h and replacing it for
linux/gpio/consumer.h
Signed-off-by: default avatarMaíra Canal <maira.canal@usp.br>
Link: https://lore.kernel.org/r/YW8I5Emdc3t0cqhz@fedoraSigned-off-by: default avatarMark Brown <broonie@kernel.org>
parent 08411e34
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/of_platform.h> #include <linux/of_platform.h>
#include <linux/of_gpio.h> #include <linux/gpio/consumer.h>
#include <linux/pinctrl/consumer.h> #include <linux/pinctrl/consumer.h>
#include <linux/platform_device.h> #include <linux/platform_device.h>
#include <linux/pm_runtime.h> #include <linux/pm_runtime.h>
...@@ -482,29 +482,12 @@ static void at91_usart_spi_init(struct at91_usart_spi *aus) ...@@ -482,29 +482,12 @@ static void at91_usart_spi_init(struct at91_usart_spi *aus)
static int at91_usart_gpio_setup(struct platform_device *pdev) static int at91_usart_gpio_setup(struct platform_device *pdev)
{ {
struct device_node *np = pdev->dev.parent->of_node; struct gpio_descs *cs_gpios;
int i;
int ret;
int nb;
if (!np)
return -EINVAL;
nb = of_gpio_named_count(np, "cs-gpios");
for (i = 0; i < nb; i++) {
int cs_gpio = of_get_named_gpio(np, "cs-gpios", i);
if (cs_gpio < 0) cs_gpios = devm_gpiod_get_array_optional(&pdev->dev, "cs", GPIOD_OUT_LOW);
return cs_gpio;
if (gpio_is_valid(cs_gpio)) { if (IS_ERR(cs_gpios))
ret = devm_gpio_request_one(&pdev->dev, cs_gpio, return PTR_ERR(cs_gpios);
GPIOF_DIR_OUT,
dev_name(&pdev->dev));
if (ret)
return ret;
}
}
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment