aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Walleij <linus.walleij@linaro.org>2015-12-08 04:27:16 -0500
committerLinus Walleij <linus.walleij@linaro.org>2016-01-05 08:15:05 -0500
commit9420023a5327f29a37cf0a6198bd7d8d80f9634c (patch)
treeee56f7252f22d50171cff2dc221d45183dd73f82
parent7cb093c4bce3a145cc1586d4464cd362376c2cc6 (diff)
pinctrl: sirf-atlas7: use gpiochip data pointer
This makes the driver use the data pointer added to the gpio_chip to store a pointer to the state container instead of relying on container_of(). Cc: Barry Song <baohua@kernel.org> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
-rw-r--r--drivers/pinctrl/sirf/pinctrl-atlas7.c29
1 files changed, 12 insertions, 17 deletions
diff --git a/drivers/pinctrl/sirf/pinctrl-atlas7.c b/drivers/pinctrl/sirf/pinctrl-atlas7.c
index 1850dc1b3863..3a95ffdbaa72 100644
--- a/drivers/pinctrl/sirf/pinctrl-atlas7.c
+++ b/drivers/pinctrl/sirf/pinctrl-atlas7.c
@@ -355,11 +355,6 @@ struct atlas7_gpio_chip {
355 struct atlas7_gpio_bank banks[0]; 355 struct atlas7_gpio_bank banks[0];
356}; 356};
357 357
358static inline struct atlas7_gpio_chip *to_atlas7_gpio(struct gpio_chip *gc)
359{
360 return container_of(gc, struct atlas7_gpio_chip, chip);
361}
362
363/** 358/**
364 * @dev: a pointer back to containing device 359 * @dev: a pointer back to containing device
365 * @virtbase: the offset to the controller in virtual memory 360 * @virtbase: the offset to the controller in virtual memory
@@ -5600,7 +5595,7 @@ static int __atlas7_gpio_to_pin(struct atlas7_gpio_chip *a7gc, u32 gpio)
5600static void atlas7_gpio_irq_ack(struct irq_data *d) 5595static void atlas7_gpio_irq_ack(struct irq_data *d)
5601{ 5596{
5602 struct gpio_chip *gc = irq_data_get_irq_chip_data(d); 5597 struct gpio_chip *gc = irq_data_get_irq_chip_data(d);
5603 struct atlas7_gpio_chip *a7gc = to_atlas7_gpio(gc); 5598 struct atlas7_gpio_chip *a7gc = gpiochip_get_data(gc);
5604 struct atlas7_gpio_bank *bank; 5599 struct atlas7_gpio_bank *bank;
5605 void __iomem *ctrl_reg; 5600 void __iomem *ctrl_reg;
5606 u32 val, pin_in_bank; 5601 u32 val, pin_in_bank;
@@ -5638,7 +5633,7 @@ static void __atlas7_gpio_irq_mask(struct atlas7_gpio_chip *a7gc, int idx)
5638static void atlas7_gpio_irq_mask(struct irq_data *d) 5633static void atlas7_gpio_irq_mask(struct irq_data *d)
5639{ 5634{
5640 struct gpio_chip *gc = irq_data_get_irq_chip_data(d); 5635 struct gpio_chip *gc = irq_data_get_irq_chip_data(d);
5641 struct atlas7_gpio_chip *a7gc = to_atlas7_gpio(gc); 5636 struct atlas7_gpio_chip *a7gc = gpiochip_get_data(gc);
5642 unsigned long flags; 5637 unsigned long flags;
5643 5638
5644 spin_lock_irqsave(&a7gc->lock, flags); 5639 spin_lock_irqsave(&a7gc->lock, flags);
@@ -5651,7 +5646,7 @@ static void atlas7_gpio_irq_mask(struct irq_data *d)
5651static void atlas7_gpio_irq_unmask(struct irq_data *d) 5646static void atlas7_gpio_irq_unmask(struct irq_data *d)
5652{ 5647{
5653 struct gpio_chip *gc = irq_data_get_irq_chip_data(d); 5648 struct gpio_chip *gc = irq_data_get_irq_chip_data(d);
5654 struct atlas7_gpio_chip *a7gc = to_atlas7_gpio(gc); 5649 struct atlas7_gpio_chip *a7gc = gpiochip_get_data(gc);
5655 struct atlas7_gpio_bank *bank; 5650 struct atlas7_gpio_bank *bank;
5656 void __iomem *ctrl_reg; 5651 void __iomem *ctrl_reg;
5657 u32 val, pin_in_bank; 5652 u32 val, pin_in_bank;
@@ -5675,7 +5670,7 @@ static int atlas7_gpio_irq_type(struct irq_data *d,
5675 unsigned int type) 5670 unsigned int type)
5676{ 5671{
5677 struct gpio_chip *gc = irq_data_get_irq_chip_data(d); 5672 struct gpio_chip *gc = irq_data_get_irq_chip_data(d);
5678 struct atlas7_gpio_chip *a7gc = to_atlas7_gpio(gc); 5673 struct atlas7_gpio_chip *a7gc = gpiochip_get_data(gc);
5679 struct atlas7_gpio_bank *bank; 5674 struct atlas7_gpio_bank *bank;
5680 void __iomem *ctrl_reg; 5675 void __iomem *ctrl_reg;
5681 u32 val, pin_in_bank; 5676 u32 val, pin_in_bank;
@@ -5744,7 +5739,7 @@ static struct irq_chip atlas7_gpio_irq_chip = {
5744static void atlas7_gpio_handle_irq(struct irq_desc *desc) 5739static void atlas7_gpio_handle_irq(struct irq_desc *desc)
5745{ 5740{
5746 struct gpio_chip *gc = irq_desc_get_handler_data(desc); 5741 struct gpio_chip *gc = irq_desc_get_handler_data(desc);
5747 struct atlas7_gpio_chip *a7gc = to_atlas7_gpio(gc); 5742 struct atlas7_gpio_chip *a7gc = gpiochip_get_data(gc);
5748 struct atlas7_gpio_bank *bank = NULL; 5743 struct atlas7_gpio_bank *bank = NULL;
5749 u32 status, ctrl; 5744 u32 status, ctrl;
5750 int pin_in_bank = 0, idx; 5745 int pin_in_bank = 0, idx;
@@ -5812,7 +5807,7 @@ static void __atlas7_gpio_set_input(struct atlas7_gpio_chip *a7gc,
5812static int atlas7_gpio_request(struct gpio_chip *chip, 5807static int atlas7_gpio_request(struct gpio_chip *chip,
5813 unsigned int gpio) 5808 unsigned int gpio)
5814{ 5809{
5815 struct atlas7_gpio_chip *a7gc = to_atlas7_gpio(chip); 5810 struct atlas7_gpio_chip *a7gc = gpiochip_get_data(chip);
5816 int ret; 5811 int ret;
5817 unsigned long flags; 5812 unsigned long flags;
5818 5813
@@ -5840,7 +5835,7 @@ static int atlas7_gpio_request(struct gpio_chip *chip,
5840static void atlas7_gpio_free(struct gpio_chip *chip, 5835static void atlas7_gpio_free(struct gpio_chip *chip,
5841 unsigned int gpio) 5836 unsigned int gpio)
5842{ 5837{
5843 struct atlas7_gpio_chip *a7gc = to_atlas7_gpio(chip); 5838 struct atlas7_gpio_chip *a7gc = gpiochip_get_data(chip);
5844 unsigned long flags; 5839 unsigned long flags;
5845 5840
5846 spin_lock_irqsave(&a7gc->lock, flags); 5841 spin_lock_irqsave(&a7gc->lock, flags);
@@ -5856,7 +5851,7 @@ static void atlas7_gpio_free(struct gpio_chip *chip,
5856static int atlas7_gpio_direction_input(struct gpio_chip *chip, 5851static int atlas7_gpio_direction_input(struct gpio_chip *chip,
5857 unsigned int gpio) 5852 unsigned int gpio)
5858{ 5853{
5859 struct atlas7_gpio_chip *a7gc = to_atlas7_gpio(chip); 5854 struct atlas7_gpio_chip *a7gc = gpiochip_get_data(chip);
5860 unsigned long flags; 5855 unsigned long flags;
5861 5856
5862 spin_lock_irqsave(&a7gc->lock, flags); 5857 spin_lock_irqsave(&a7gc->lock, flags);
@@ -5893,7 +5888,7 @@ static void __atlas7_gpio_set_output(struct atlas7_gpio_chip *a7gc,
5893static int atlas7_gpio_direction_output(struct gpio_chip *chip, 5888static int atlas7_gpio_direction_output(struct gpio_chip *chip,
5894 unsigned int gpio, int value) 5889 unsigned int gpio, int value)
5895{ 5890{
5896 struct atlas7_gpio_chip *a7gc = to_atlas7_gpio(chip); 5891 struct atlas7_gpio_chip *a7gc = gpiochip_get_data(chip);
5897 unsigned long flags; 5892 unsigned long flags;
5898 5893
5899 spin_lock_irqsave(&a7gc->lock, flags); 5894 spin_lock_irqsave(&a7gc->lock, flags);
@@ -5908,7 +5903,7 @@ static int atlas7_gpio_direction_output(struct gpio_chip *chip,
5908static int atlas7_gpio_get_value(struct gpio_chip *chip, 5903static int atlas7_gpio_get_value(struct gpio_chip *chip,
5909 unsigned int gpio) 5904 unsigned int gpio)
5910{ 5905{
5911 struct atlas7_gpio_chip *a7gc = to_atlas7_gpio(chip); 5906 struct atlas7_gpio_chip *a7gc = gpiochip_get_data(chip);
5912 struct atlas7_gpio_bank *bank; 5907 struct atlas7_gpio_bank *bank;
5913 u32 val, pin_in_bank; 5908 u32 val, pin_in_bank;
5914 unsigned long flags; 5909 unsigned long flags;
@@ -5928,7 +5923,7 @@ static int atlas7_gpio_get_value(struct gpio_chip *chip,
5928static void atlas7_gpio_set_value(struct gpio_chip *chip, 5923static void atlas7_gpio_set_value(struct gpio_chip *chip,
5929 unsigned int gpio, int value) 5924 unsigned int gpio, int value)
5930{ 5925{
5931 struct atlas7_gpio_chip *a7gc = to_atlas7_gpio(chip); 5926 struct atlas7_gpio_chip *a7gc = gpiochip_get_data(chip);
5932 struct atlas7_gpio_bank *bank; 5927 struct atlas7_gpio_bank *bank;
5933 void __iomem *ctrl_reg; 5928 void __iomem *ctrl_reg;
5934 u32 ctrl, pin_in_bank; 5929 u32 ctrl, pin_in_bank;
@@ -6015,7 +6010,7 @@ static int atlas7_gpio_probe(struct platform_device *pdev)
6015 chip->parent = &pdev->dev; 6010 chip->parent = &pdev->dev;
6016 6011
6017 /* Add gpio chip to system */ 6012 /* Add gpio chip to system */
6018 ret = gpiochip_add(chip); 6013 ret = gpiochip_add_data(chip, a7gc);
6019 if (ret) { 6014 if (ret) {
6020 dev_err(&pdev->dev, 6015 dev_err(&pdev->dev,
6021 "%s: error in probe function with status %d\n", 6016 "%s: error in probe function with status %d\n",