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

staging: nvec: convert to use GPIO descriptors

Use GPIO descriptors instead of relying on the old method.

Cc: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Marc Dietrich <marvin24@gmx.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Marc Dietrich and committed by
Greg Kroah-Hartman
40fbffd9 d4381795

+11 -33
+10 -32
drivers/staging/nvec/nvec.c
··· 17 17 #include <linux/completion.h> 18 18 #include <linux/delay.h> 19 19 #include <linux/err.h> 20 - #include <linux/gpio.h> 20 + #include <linux/gpio/consumer.h> 21 21 #include <linux/interrupt.h> 22 22 #include <linux/io.h> 23 23 #include <linux/irq.h> 24 24 #include <linux/of.h> 25 - #include <linux/of_gpio.h> 26 25 #include <linux/list.h> 27 26 #include <linux/mfd/core.h> 28 27 #include <linux/mutex.h> ··· 235 236 static void nvec_gpio_set_value(struct nvec_chip *nvec, int value) 236 237 { 237 238 dev_dbg(nvec->dev, "GPIO changed from %u to %u\n", 238 - gpio_get_value(nvec->gpio), value); 239 - gpio_set_value(nvec->gpio, value); 239 + gpiod_get_value(nvec->gpiod), value); 240 + gpiod_set_value(nvec->gpiod, value); 240 241 } 241 242 242 243 /** ··· 760 761 nvec_write_async(nvec_power_handle, ap_pwr_down, 2); 761 762 } 762 763 763 - /* 764 - * Parse common device tree data 765 - */ 766 - static int nvec_i2c_parse_dt_pdata(struct nvec_chip *nvec) 767 - { 768 - nvec->gpio = of_get_named_gpio(nvec->dev->of_node, "request-gpios", 0); 769 - 770 - if (nvec->gpio < 0) { 771 - dev_err(nvec->dev, "no gpio specified"); 772 - return -ENODEV; 773 - } 774 - 775 - if (of_property_read_u32(nvec->dev->of_node, "slave-addr", 776 - &nvec->i2c_addr)) { 777 - dev_err(nvec->dev, "no i2c address specified"); 778 - return -ENODEV; 779 - } 780 - 781 - return 0; 782 - } 783 - 784 764 static int tegra_nvec_probe(struct platform_device *pdev) 785 765 { 786 766 int err, ret; ··· 785 807 platform_set_drvdata(pdev, nvec); 786 808 nvec->dev = dev; 787 809 788 - err = nvec_i2c_parse_dt_pdata(nvec); 789 - if (err < 0) 790 - return err; 810 + if (of_property_read_u32(dev->of_node, "slave-addr", &nvec->i2c_addr)) { 811 + dev_err(dev, "no i2c address specified"); 812 + return -ENODEV; 813 + } 791 814 792 815 res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 793 816 base = devm_ioremap_resource(dev, res); ··· 829 850 INIT_WORK(&nvec->rx_work, nvec_dispatch); 830 851 INIT_WORK(&nvec->tx_work, nvec_request_master); 831 852 832 - err = devm_gpio_request_one(dev, nvec->gpio, GPIOF_OUT_INIT_HIGH, 833 - "nvec gpio"); 834 - if (err < 0) { 853 + nvec->gpiod = devm_gpiod_get(dev, "request", GPIOD_OUT_HIGH); 854 + if (IS_ERR(nvec->gpiod)) { 835 855 dev_err(dev, "couldn't request gpio\n"); 836 - return -ENODEV; 856 + return PTR_ERR(nvec->gpiod); 837 857 } 838 858 839 859 err = devm_request_irq(dev, nvec->irq, nvec_interrupt, 0,
+1 -1
drivers/staging/nvec/nvec.h
··· 132 132 */ 133 133 struct nvec_chip { 134 134 struct device *dev; 135 - int gpio; 135 + struct gpio_desc *gpiod; 136 136 int irq; 137 137 u32 i2c_addr; 138 138 void __iomem *base;