summaryrefslogtreecommitdiffstats
path: root/drivers/pinctrl/sirf
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2016-01-17 15:32:01 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2016-01-17 15:32:01 -0500
commit58cf279acac3080ce03eeea5ca268210b3165fe1 (patch)
tree54997706fbfea2cd9fd4c4044edbd8ecdc154dfb /drivers/pinctrl/sirf
parent6606b342febfd470b4a33acb73e360eeaca1d9bb (diff)
parentc474e348778bdf5b453a2cdff4b2b1f9e000f343 (diff)
Merge tag 'gpio-v4.5-1' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-gpio
Pull GPIO updates from Linus Walleij: "Here is the bulk of GPIO changes for v4.5. Notably there are big refactorings mostly by myself, aimed at getting the gpio_chip into a shape that makes me believe I can proceed to preserve state for a proper userspace ABI (character device) that has already been proposed once, but resulted in the feedback that I need to go back and restructure stuff. So I've been restructuring stuff. On the way I ran into brokenness (return code from the get_value() callback) and had to fix it. Also, refactored generic GPIO to be simpler. Some of that is still waiting to trickle down from the subsystems all over the kernel that provide random gpio_chips, I've touched every single GPIO driver in the kernel now, oh man I didn't know I was responsible for so much... Apart from that we're churning along as usual. I took some effort to test and retest so it should merge nicely and we shook out a couple of bugs in -next. Infrastructural changes: - In struct gpio_chip, rename the .dev node to .parent to better reflect the fact that this is not the GPIO struct device abstraction. We will add that soon so this would be totallt confusing. - It was noted that the driver .get_value() callbacks was sometimes reporting negative -ERR values to the gpiolib core, expecting them to be propagated to consumer gpiod_get_value() and gpio_get_value() calls. This was not happening, so as there was a mess of drivers returning negative errors and some returning "anything else than zero" to indicate that a line was active. As some would have bit 31 set to indicate "line active" it clashed with negative error codes. This is fixed by the largeish series clamping values in all drivers with !!value to [0,1] and then augmenting the code to propagate error codes to consumers. (Includes some ACKed patches in other subsystems.) - Add a void *data pointer to struct gpio_chip. The container_of() design pattern is indeed very nice, but we want to reform the struct gpio_chip to be a non-volative, stateless business, and keep states internal to the gpiolib to be able to hold on to the state when adding a proper userspace ABI (character device) further down the road. To achieve this, drivers need a handle at the internal state that is not dependent on their struct gpio_chip() so we add gpiochip_add_data() and gpiochip_get_data() following the pattern of many other subsystems. All the "use gpiochip data pointer" patches transforms drivers to this scheme. - The Generic GPIO chip header has been merged into the general <linux/gpio/driver.h> header, and the custom header for that removed. Instead of having a separate mm_gpio_chip struct for these generic drivers, merge that into struct gpio_chip, simplifying the code and removing the need for separate and confusing includes. Misc improvements: - Stabilize the way GPIOs are looked up from the ACPI legacy specification. - Incremental driver features for PXA, PCA953X, Lantiq (patches from the OpenWRT community), RCAR, Zynq, PL061, 104-idi-48 New drivers: - Add a GPIO chip to the ALSA SoC AC97 driver. - Add a new Broadcom NSP SoC driver (this lands in the pinctrl dir, but the branch is merged here too to account for infrastructural changes). - The sx150x driver now supports the sx1502" * tag 'gpio-v4.5-1' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-gpio: (220 commits) gpio: generic: make bgpio_pdata always visible gpiolib: fix chip order in gpio list gpio: mpc8xxx: Do not use gpiochip_get_data() in mpc8xxx_gpio_save_regs() gpio: mm-lantiq: Do not use gpiochip_get_data() in ltq_mm_save_regs() gpio: brcmstb: Allow building driver for BMIPS_GENERIC gpio: brcmstb: Set endian flags for big-endian MIPS gpio: moxart: fix build regression gpio: xilinx: Do not use gpiochip_get_data() in xgpio_save_regs() leds: pca9532: use gpiochip data pointer leds: tca6507: use gpiochip data pointer hid: cp2112: use gpiochip data pointer bcma: gpio: use gpiochip data pointer avr32: gpio: use gpiochip data pointer video: fbdev: via: use gpiochip data pointer gpio: pch: Optimize pch_gpio_get() Revert "pinctrl: lantiq: Implement gpio_chip.to_irq" pinctrl: nsp-gpio: use gpiochip data pointer pinctrl: vt8500-wmt: use gpiochip data pointer pinctrl: exynos5440: use gpiochip data pointer pinctrl: at91-pio4: use gpiochip data pointer ...
Diffstat (limited to 'drivers/pinctrl/sirf')
-rw-r--r--drivers/pinctrl/sirf/pinctrl-atlas7.c31
-rw-r--r--drivers/pinctrl/sirf/pinctrl-sirf.c31
2 files changed, 26 insertions, 36 deletions
diff --git a/drivers/pinctrl/sirf/pinctrl-atlas7.c b/drivers/pinctrl/sirf/pinctrl-atlas7.c
index 053d98e33944..beb024c31a5d 100644
--- a/drivers/pinctrl/sirf/pinctrl-atlas7.c
+++ b/drivers/pinctrl/sirf/pinctrl-atlas7.c
@@ -358,11 +358,6 @@ struct atlas7_gpio_chip {
358 struct atlas7_gpio_bank banks[0]; 358 struct atlas7_gpio_bank banks[0];
359}; 359};
360 360
361static inline struct atlas7_gpio_chip *to_atlas7_gpio(struct gpio_chip *gc)
362{
363 return container_of(gc, struct atlas7_gpio_chip, chip);
364}
365
366/** 361/**
367 * @dev: a pointer back to containing device 362 * @dev: a pointer back to containing device
368 * @virtbase: the offset to the controller in virtual memory 363 * @virtbase: the offset to the controller in virtual memory
@@ -5642,7 +5637,7 @@ static int __atlas7_gpio_to_pin(struct atlas7_gpio_chip *a7gc, u32 gpio)
5642static void atlas7_gpio_irq_ack(struct irq_data *d) 5637static void atlas7_gpio_irq_ack(struct irq_data *d)
5643{ 5638{
5644 struct gpio_chip *gc = irq_data_get_irq_chip_data(d); 5639 struct gpio_chip *gc = irq_data_get_irq_chip_data(d);
5645 struct atlas7_gpio_chip *a7gc = to_atlas7_gpio(gc); 5640 struct atlas7_gpio_chip *a7gc = gpiochip_get_data(gc);
5646 struct atlas7_gpio_bank *bank; 5641 struct atlas7_gpio_bank *bank;
5647 void __iomem *ctrl_reg; 5642 void __iomem *ctrl_reg;
5648 u32 val, pin_in_bank; 5643 u32 val, pin_in_bank;
@@ -5680,7 +5675,7 @@ static void __atlas7_gpio_irq_mask(struct atlas7_gpio_chip *a7gc, int idx)
5680static void atlas7_gpio_irq_mask(struct irq_data *d) 5675static void atlas7_gpio_irq_mask(struct irq_data *d)
5681{ 5676{
5682 struct gpio_chip *gc = irq_data_get_irq_chip_data(d); 5677 struct gpio_chip *gc = irq_data_get_irq_chip_data(d);
5683 struct atlas7_gpio_chip *a7gc = to_atlas7_gpio(gc); 5678 struct atlas7_gpio_chip *a7gc = gpiochip_get_data(gc);
5684 unsigned long flags; 5679 unsigned long flags;
5685 5680
5686 spin_lock_irqsave(&a7gc->lock, flags); 5681 spin_lock_irqsave(&a7gc->lock, flags);
@@ -5693,7 +5688,7 @@ static void atlas7_gpio_irq_mask(struct irq_data *d)
5693static void atlas7_gpio_irq_unmask(struct irq_data *d) 5688static void atlas7_gpio_irq_unmask(struct irq_data *d)
5694{ 5689{
5695 struct gpio_chip *gc = irq_data_get_irq_chip_data(d); 5690 struct gpio_chip *gc = irq_data_get_irq_chip_data(d);
5696 struct atlas7_gpio_chip *a7gc = to_atlas7_gpio(gc); 5691 struct atlas7_gpio_chip *a7gc = gpiochip_get_data(gc);
5697 struct atlas7_gpio_bank *bank; 5692 struct atlas7_gpio_bank *bank;
5698 void __iomem *ctrl_reg; 5693 void __iomem *ctrl_reg;
5699 u32 val, pin_in_bank; 5694 u32 val, pin_in_bank;
@@ -5717,7 +5712,7 @@ static int atlas7_gpio_irq_type(struct irq_data *d,
5717 unsigned int type) 5712 unsigned int type)
5718{ 5713{
5719 struct gpio_chip *gc = irq_data_get_irq_chip_data(d); 5714 struct gpio_chip *gc = irq_data_get_irq_chip_data(d);
5720 struct atlas7_gpio_chip *a7gc = to_atlas7_gpio(gc); 5715 struct atlas7_gpio_chip *a7gc = gpiochip_get_data(gc);
5721 struct atlas7_gpio_bank *bank; 5716 struct atlas7_gpio_bank *bank;
5722 void __iomem *ctrl_reg; 5717 void __iomem *ctrl_reg;
5723 u32 val, pin_in_bank; 5718 u32 val, pin_in_bank;
@@ -5786,7 +5781,7 @@ static struct irq_chip atlas7_gpio_irq_chip = {
5786static void atlas7_gpio_handle_irq(struct irq_desc *desc) 5781static void atlas7_gpio_handle_irq(struct irq_desc *desc)
5787{ 5782{
5788 struct gpio_chip *gc = irq_desc_get_handler_data(desc); 5783 struct gpio_chip *gc = irq_desc_get_handler_data(desc);
5789 struct atlas7_gpio_chip *a7gc = to_atlas7_gpio(gc); 5784 struct atlas7_gpio_chip *a7gc = gpiochip_get_data(gc);
5790 struct atlas7_gpio_bank *bank = NULL; 5785 struct atlas7_gpio_bank *bank = NULL;
5791 u32 status, ctrl; 5786 u32 status, ctrl;
5792 int pin_in_bank = 0, idx; 5787 int pin_in_bank = 0, idx;
@@ -5854,7 +5849,7 @@ static void __atlas7_gpio_set_input(struct atlas7_gpio_chip *a7gc,
5854static int atlas7_gpio_request(struct gpio_chip *chip, 5849static int atlas7_gpio_request(struct gpio_chip *chip,
5855 unsigned int gpio) 5850 unsigned int gpio)
5856{ 5851{
5857 struct atlas7_gpio_chip *a7gc = to_atlas7_gpio(chip); 5852 struct atlas7_gpio_chip *a7gc = gpiochip_get_data(chip);
5858 int ret; 5853 int ret;
5859 unsigned long flags; 5854 unsigned long flags;
5860 5855
@@ -5882,7 +5877,7 @@ static int atlas7_gpio_request(struct gpio_chip *chip,
5882static void atlas7_gpio_free(struct gpio_chip *chip, 5877static void atlas7_gpio_free(struct gpio_chip *chip,
5883 unsigned int gpio) 5878 unsigned int gpio)
5884{ 5879{
5885 struct atlas7_gpio_chip *a7gc = to_atlas7_gpio(chip); 5880 struct atlas7_gpio_chip *a7gc = gpiochip_get_data(chip);
5886 unsigned long flags; 5881 unsigned long flags;
5887 5882
5888 spin_lock_irqsave(&a7gc->lock, flags); 5883 spin_lock_irqsave(&a7gc->lock, flags);
@@ -5898,7 +5893,7 @@ static void atlas7_gpio_free(struct gpio_chip *chip,
5898static int atlas7_gpio_direction_input(struct gpio_chip *chip, 5893static int atlas7_gpio_direction_input(struct gpio_chip *chip,
5899 unsigned int gpio) 5894 unsigned int gpio)
5900{ 5895{
5901 struct atlas7_gpio_chip *a7gc = to_atlas7_gpio(chip); 5896 struct atlas7_gpio_chip *a7gc = gpiochip_get_data(chip);
5902 unsigned long flags; 5897 unsigned long flags;
5903 5898
5904 spin_lock_irqsave(&a7gc->lock, flags); 5899 spin_lock_irqsave(&a7gc->lock, flags);
@@ -5935,7 +5930,7 @@ static void __atlas7_gpio_set_output(struct atlas7_gpio_chip *a7gc,
5935static int atlas7_gpio_direction_output(struct gpio_chip *chip, 5930static int atlas7_gpio_direction_output(struct gpio_chip *chip,
5936 unsigned int gpio, int value) 5931 unsigned int gpio, int value)
5937{ 5932{
5938 struct atlas7_gpio_chip *a7gc = to_atlas7_gpio(chip); 5933 struct atlas7_gpio_chip *a7gc = gpiochip_get_data(chip);
5939 unsigned long flags; 5934 unsigned long flags;
5940 5935
5941 spin_lock_irqsave(&a7gc->lock, flags); 5936 spin_lock_irqsave(&a7gc->lock, flags);
@@ -5950,7 +5945,7 @@ static int atlas7_gpio_direction_output(struct gpio_chip *chip,
5950static int atlas7_gpio_get_value(struct gpio_chip *chip, 5945static int atlas7_gpio_get_value(struct gpio_chip *chip,
5951 unsigned int gpio) 5946 unsigned int gpio)
5952{ 5947{
5953 struct atlas7_gpio_chip *a7gc = to_atlas7_gpio(chip); 5948 struct atlas7_gpio_chip *a7gc = gpiochip_get_data(chip);
5954 struct atlas7_gpio_bank *bank; 5949 struct atlas7_gpio_bank *bank;
5955 u32 val, pin_in_bank; 5950 u32 val, pin_in_bank;
5956 unsigned long flags; 5951 unsigned long flags;
@@ -5970,7 +5965,7 @@ static int atlas7_gpio_get_value(struct gpio_chip *chip,
5970static void atlas7_gpio_set_value(struct gpio_chip *chip, 5965static void atlas7_gpio_set_value(struct gpio_chip *chip,
5971 unsigned int gpio, int value) 5966 unsigned int gpio, int value)
5972{ 5967{
5973 struct atlas7_gpio_chip *a7gc = to_atlas7_gpio(chip); 5968 struct atlas7_gpio_chip *a7gc = gpiochip_get_data(chip);
5974 struct atlas7_gpio_bank *bank; 5969 struct atlas7_gpio_bank *bank;
5975 void __iomem *ctrl_reg; 5970 void __iomem *ctrl_reg;
5976 u32 ctrl, pin_in_bank; 5971 u32 ctrl, pin_in_bank;
@@ -6054,10 +6049,10 @@ static int atlas7_gpio_probe(struct platform_device *pdev)
6054 chip->label = kstrdup(np->name, GFP_KERNEL); 6049 chip->label = kstrdup(np->name, GFP_KERNEL);
6055 chip->of_node = np; 6050 chip->of_node = np;
6056 chip->of_gpio_n_cells = 2; 6051 chip->of_gpio_n_cells = 2;
6057 chip->dev = &pdev->dev; 6052 chip->parent = &pdev->dev;
6058 6053
6059 /* Add gpio chip to system */ 6054 /* Add gpio chip to system */
6060 ret = gpiochip_add(chip); 6055 ret = gpiochip_add_data(chip, a7gc);
6061 if (ret) { 6056 if (ret) {
6062 dev_err(&pdev->dev, 6057 dev_err(&pdev->dev,
6063 "%s: error in probe function with status %d\n", 6058 "%s: error in probe function with status %d\n",
diff --git a/drivers/pinctrl/sirf/pinctrl-sirf.c b/drivers/pinctrl/sirf/pinctrl-sirf.c
index edf40df05ec0..762c0c9c1278 100644
--- a/drivers/pinctrl/sirf/pinctrl-sirf.c
+++ b/drivers/pinctrl/sirf/pinctrl-sirf.c
@@ -403,11 +403,6 @@ static int __init sirfsoc_pinmux_init(void)
403} 403}
404arch_initcall(sirfsoc_pinmux_init); 404arch_initcall(sirfsoc_pinmux_init);
405 405
406static inline struct sirfsoc_gpio_chip *to_sirfsoc_gpio(struct gpio_chip *gc)
407{
408 return container_of(gc, struct sirfsoc_gpio_chip, chip.gc);
409}
410
411static inline struct sirfsoc_gpio_bank * 406static inline struct sirfsoc_gpio_bank *
412sirfsoc_gpio_to_bank(struct sirfsoc_gpio_chip *sgpio, unsigned int offset) 407sirfsoc_gpio_to_bank(struct sirfsoc_gpio_chip *sgpio, unsigned int offset)
413{ 408{
@@ -422,7 +417,7 @@ static inline int sirfsoc_gpio_to_bankoff(unsigned int offset)
422static void sirfsoc_gpio_irq_ack(struct irq_data *d) 417static void sirfsoc_gpio_irq_ack(struct irq_data *d)
423{ 418{
424 struct gpio_chip *gc = irq_data_get_irq_chip_data(d); 419 struct gpio_chip *gc = irq_data_get_irq_chip_data(d);
425 struct sirfsoc_gpio_chip *sgpio = to_sirfsoc_gpio(gc); 420 struct sirfsoc_gpio_chip *sgpio = gpiochip_get_data(gc);
426 struct sirfsoc_gpio_bank *bank = sirfsoc_gpio_to_bank(sgpio, d->hwirq); 421 struct sirfsoc_gpio_bank *bank = sirfsoc_gpio_to_bank(sgpio, d->hwirq);
427 int idx = sirfsoc_gpio_to_bankoff(d->hwirq); 422 int idx = sirfsoc_gpio_to_bankoff(d->hwirq);
428 u32 val, offset; 423 u32 val, offset;
@@ -461,7 +456,7 @@ static void __sirfsoc_gpio_irq_mask(struct sirfsoc_gpio_chip *sgpio,
461static void sirfsoc_gpio_irq_mask(struct irq_data *d) 456static void sirfsoc_gpio_irq_mask(struct irq_data *d)
462{ 457{
463 struct gpio_chip *gc = irq_data_get_irq_chip_data(d); 458 struct gpio_chip *gc = irq_data_get_irq_chip_data(d);
464 struct sirfsoc_gpio_chip *sgpio = to_sirfsoc_gpio(gc); 459 struct sirfsoc_gpio_chip *sgpio = gpiochip_get_data(gc);
465 struct sirfsoc_gpio_bank *bank = sirfsoc_gpio_to_bank(sgpio, d->hwirq); 460 struct sirfsoc_gpio_bank *bank = sirfsoc_gpio_to_bank(sgpio, d->hwirq);
466 461
467 __sirfsoc_gpio_irq_mask(sgpio, bank, d->hwirq % SIRFSOC_GPIO_BANK_SIZE); 462 __sirfsoc_gpio_irq_mask(sgpio, bank, d->hwirq % SIRFSOC_GPIO_BANK_SIZE);
@@ -470,7 +465,7 @@ static void sirfsoc_gpio_irq_mask(struct irq_data *d)
470static void sirfsoc_gpio_irq_unmask(struct irq_data *d) 465static void sirfsoc_gpio_irq_unmask(struct irq_data *d)
471{ 466{
472 struct gpio_chip *gc = irq_data_get_irq_chip_data(d); 467 struct gpio_chip *gc = irq_data_get_irq_chip_data(d);
473 struct sirfsoc_gpio_chip *sgpio = to_sirfsoc_gpio(gc); 468 struct sirfsoc_gpio_chip *sgpio = gpiochip_get_data(gc);
474 struct sirfsoc_gpio_bank *bank = sirfsoc_gpio_to_bank(sgpio, d->hwirq); 469 struct sirfsoc_gpio_bank *bank = sirfsoc_gpio_to_bank(sgpio, d->hwirq);
475 int idx = sirfsoc_gpio_to_bankoff(d->hwirq); 470 int idx = sirfsoc_gpio_to_bankoff(d->hwirq);
476 u32 val, offset; 471 u32 val, offset;
@@ -491,7 +486,7 @@ static void sirfsoc_gpio_irq_unmask(struct irq_data *d)
491static int sirfsoc_gpio_irq_type(struct irq_data *d, unsigned type) 486static int sirfsoc_gpio_irq_type(struct irq_data *d, unsigned type)
492{ 487{
493 struct gpio_chip *gc = irq_data_get_irq_chip_data(d); 488 struct gpio_chip *gc = irq_data_get_irq_chip_data(d);
494 struct sirfsoc_gpio_chip *sgpio = to_sirfsoc_gpio(gc); 489 struct sirfsoc_gpio_chip *sgpio = gpiochip_get_data(gc);
495 struct sirfsoc_gpio_bank *bank = sirfsoc_gpio_to_bank(sgpio, d->hwirq); 490 struct sirfsoc_gpio_bank *bank = sirfsoc_gpio_to_bank(sgpio, d->hwirq);
496 int idx = sirfsoc_gpio_to_bankoff(d->hwirq); 491 int idx = sirfsoc_gpio_to_bankoff(d->hwirq);
497 u32 val, offset; 492 u32 val, offset;
@@ -553,7 +548,7 @@ static void sirfsoc_gpio_handle_irq(struct irq_desc *desc)
553{ 548{
554 unsigned int irq = irq_desc_get_irq(desc); 549 unsigned int irq = irq_desc_get_irq(desc);
555 struct gpio_chip *gc = irq_desc_get_handler_data(desc); 550 struct gpio_chip *gc = irq_desc_get_handler_data(desc);
556 struct sirfsoc_gpio_chip *sgpio = to_sirfsoc_gpio(gc); 551 struct sirfsoc_gpio_chip *sgpio = gpiochip_get_data(gc);
557 struct sirfsoc_gpio_bank *bank; 552 struct sirfsoc_gpio_bank *bank;
558 u32 status, ctrl; 553 u32 status, ctrl;
559 int idx = 0; 554 int idx = 0;
@@ -611,7 +606,7 @@ static inline void sirfsoc_gpio_set_input(struct sirfsoc_gpio_chip *sgpio,
611 606
612static int sirfsoc_gpio_request(struct gpio_chip *chip, unsigned offset) 607static int sirfsoc_gpio_request(struct gpio_chip *chip, unsigned offset)
613{ 608{
614 struct sirfsoc_gpio_chip *sgpio = to_sirfsoc_gpio(chip); 609 struct sirfsoc_gpio_chip *sgpio = gpiochip_get_data(chip);
615 struct sirfsoc_gpio_bank *bank = sirfsoc_gpio_to_bank(sgpio, offset); 610 struct sirfsoc_gpio_bank *bank = sirfsoc_gpio_to_bank(sgpio, offset);
616 unsigned long flags; 611 unsigned long flags;
617 612
@@ -634,7 +629,7 @@ static int sirfsoc_gpio_request(struct gpio_chip *chip, unsigned offset)
634 629
635static void sirfsoc_gpio_free(struct gpio_chip *chip, unsigned offset) 630static void sirfsoc_gpio_free(struct gpio_chip *chip, unsigned offset)
636{ 631{
637 struct sirfsoc_gpio_chip *sgpio = to_sirfsoc_gpio(chip); 632 struct sirfsoc_gpio_chip *sgpio = gpiochip_get_data(chip);
638 struct sirfsoc_gpio_bank *bank = sirfsoc_gpio_to_bank(sgpio, offset); 633 struct sirfsoc_gpio_bank *bank = sirfsoc_gpio_to_bank(sgpio, offset);
639 unsigned long flags; 634 unsigned long flags;
640 635
@@ -650,7 +645,7 @@ static void sirfsoc_gpio_free(struct gpio_chip *chip, unsigned offset)
650 645
651static int sirfsoc_gpio_direction_input(struct gpio_chip *chip, unsigned gpio) 646static int sirfsoc_gpio_direction_input(struct gpio_chip *chip, unsigned gpio)
652{ 647{
653 struct sirfsoc_gpio_chip *sgpio = to_sirfsoc_gpio(chip); 648 struct sirfsoc_gpio_chip *sgpio = gpiochip_get_data(chip);
654 struct sirfsoc_gpio_bank *bank = sirfsoc_gpio_to_bank(sgpio, gpio); 649 struct sirfsoc_gpio_bank *bank = sirfsoc_gpio_to_bank(sgpio, gpio);
655 int idx = sirfsoc_gpio_to_bankoff(gpio); 650 int idx = sirfsoc_gpio_to_bankoff(gpio);
656 unsigned long flags; 651 unsigned long flags;
@@ -693,7 +688,7 @@ static inline void sirfsoc_gpio_set_output(struct sirfsoc_gpio_chip *sgpio,
693static int sirfsoc_gpio_direction_output(struct gpio_chip *chip, 688static int sirfsoc_gpio_direction_output(struct gpio_chip *chip,
694 unsigned gpio, int value) 689 unsigned gpio, int value)
695{ 690{
696 struct sirfsoc_gpio_chip *sgpio = to_sirfsoc_gpio(chip); 691 struct sirfsoc_gpio_chip *sgpio = gpiochip_get_data(chip);
697 struct sirfsoc_gpio_bank *bank = sirfsoc_gpio_to_bank(sgpio, gpio); 692 struct sirfsoc_gpio_bank *bank = sirfsoc_gpio_to_bank(sgpio, gpio);
698 int idx = sirfsoc_gpio_to_bankoff(gpio); 693 int idx = sirfsoc_gpio_to_bankoff(gpio);
699 u32 offset; 694 u32 offset;
@@ -712,7 +707,7 @@ static int sirfsoc_gpio_direction_output(struct gpio_chip *chip,
712 707
713static int sirfsoc_gpio_get_value(struct gpio_chip *chip, unsigned offset) 708static int sirfsoc_gpio_get_value(struct gpio_chip *chip, unsigned offset)
714{ 709{
715 struct sirfsoc_gpio_chip *sgpio = to_sirfsoc_gpio(chip); 710 struct sirfsoc_gpio_chip *sgpio = gpiochip_get_data(chip);
716 struct sirfsoc_gpio_bank *bank = sirfsoc_gpio_to_bank(sgpio, offset); 711 struct sirfsoc_gpio_bank *bank = sirfsoc_gpio_to_bank(sgpio, offset);
717 u32 val; 712 u32 val;
718 unsigned long flags; 713 unsigned long flags;
@@ -729,7 +724,7 @@ static int sirfsoc_gpio_get_value(struct gpio_chip *chip, unsigned offset)
729static void sirfsoc_gpio_set_value(struct gpio_chip *chip, unsigned offset, 724static void sirfsoc_gpio_set_value(struct gpio_chip *chip, unsigned offset,
730 int value) 725 int value)
731{ 726{
732 struct sirfsoc_gpio_chip *sgpio = to_sirfsoc_gpio(chip); 727 struct sirfsoc_gpio_chip *sgpio = gpiochip_get_data(chip);
733 struct sirfsoc_gpio_bank *bank = sirfsoc_gpio_to_bank(sgpio, offset); 728 struct sirfsoc_gpio_bank *bank = sirfsoc_gpio_to_bank(sgpio, offset);
734 u32 ctrl; 729 u32 ctrl;
735 unsigned long flags; 730 unsigned long flags;
@@ -815,10 +810,10 @@ static int sirfsoc_gpio_probe(struct device_node *np)
815 sgpio->chip.gc.of_node = np; 810 sgpio->chip.gc.of_node = np;
816 sgpio->chip.gc.of_xlate = sirfsoc_gpio_of_xlate; 811 sgpio->chip.gc.of_xlate = sirfsoc_gpio_of_xlate;
817 sgpio->chip.gc.of_gpio_n_cells = 2; 812 sgpio->chip.gc.of_gpio_n_cells = 2;
818 sgpio->chip.gc.dev = &pdev->dev; 813 sgpio->chip.gc.parent = &pdev->dev;
819 sgpio->chip.regs = regs; 814 sgpio->chip.regs = regs;
820 815
821 err = gpiochip_add(&sgpio->chip.gc); 816 err = gpiochip_add_data(&sgpio->chip.gc, sgpio);
822 if (err) { 817 if (err) {
823 dev_err(&pdev->dev, "%s: error in probe function with status %d\n", 818 dev_err(&pdev->dev, "%s: error in probe function with status %d\n",
824 np->full_name, err); 819 np->full_name, err);