Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ARM: mvebu: switch to using gpiod API in pm-board code

This switches PM code to use the newer gpiod API instead of legacy
gpio API that we want to retire.

Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: Gregory CLEMENT <gregory.clement@bootlin.com>

authored by

Dmitry Torokhov and committed by
Gregory CLEMENT
4839e77b d10886a4

+9 -19
+9 -19
arch/arm/mach-mvebu/pm-board.c
··· 8 8 */ 9 9 10 10 #include <linux/delay.h> 11 - #include <linux/gpio.h> 11 + #include <linux/err.h> 12 + #include <linux/gpio/consumer.h> 12 13 #include <linux/init.h> 13 14 #include <linux/io.h> 14 15 #include <linux/of.h> 15 16 #include <linux/of_address.h> 16 - #include <linux/of_gpio.h> 17 17 #include <linux/slab.h> 18 18 #include "common.h" 19 19 20 20 #define ARMADA_PIC_NR_GPIOS 3 21 21 22 22 static void __iomem *gpio_ctrl; 23 - static int pic_gpios[ARMADA_PIC_NR_GPIOS]; 23 + static struct gpio_desc *pic_gpios[ARMADA_PIC_NR_GPIOS]; 24 24 static int pic_raw_gpios[ARMADA_PIC_NR_GPIOS]; 25 25 26 26 static void mvebu_armada_pm_enter(void __iomem *sdram_reg, u32 srcmd) ··· 90 90 char *name; 91 91 struct of_phandle_args args; 92 92 93 - pic_gpios[i] = of_get_named_gpio(np, "ctrl-gpios", i); 94 - if (pic_gpios[i] < 0) { 95 - ret = -ENODEV; 96 - goto out; 97 - } 98 - 99 93 name = kasprintf(GFP_KERNEL, "pic-pin%d", i); 100 94 if (!name) { 101 95 ret = -ENOMEM; 102 96 goto out; 103 97 } 104 98 105 - ret = gpio_request(pic_gpios[i], name); 106 - if (ret < 0) { 107 - kfree(name); 108 - goto out; 109 - } 110 - 111 - ret = gpio_direction_output(pic_gpios[i], 0); 112 - if (ret < 0) { 113 - gpio_free(pic_gpios[i]); 99 + pic_gpios[i] = fwnode_gpiod_get_index(of_fwnode_handle(np), 100 + "ctrl", i, GPIOD_OUT_HIGH, 101 + name); 102 + ret = PTR_ERR_OR_ZERO(pic_gpios[i]); 103 + if (ret) { 114 104 kfree(name); 115 105 goto out; 116 106 } ··· 108 118 ret = of_parse_phandle_with_fixed_args(np, "ctrl-gpios", 2, 109 119 i, &args); 110 120 if (ret < 0) { 111 - gpio_free(pic_gpios[i]); 121 + gpiod_put(pic_gpios[i]); 112 122 kfree(name); 113 123 goto out; 114 124 }