* [PATCH 092/182] pinctrl: bcm2835: use gpiochip data pointer
@ 2015-12-09 13:30 Linus Walleij
2015-12-11 5:20 ` Stephen Warren
0 siblings, 1 reply; 5+ messages in thread
From: Linus Walleij @ 2015-12-09 13:30 UTC (permalink / raw)
To: linux-gpio, Johan Hovold, Alexandre Courbot, Michael Welling,
Markus Pargmann
Cc: Linus Walleij, Stephen Warren, Eric Anholt
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: Stephen Warren <swarren@wwwdotorg.org>
Cc: Eric Anholt <eric@anholt.net>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
---
drivers/pinctrl/bcm/pinctrl-bcm2835.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/drivers/pinctrl/bcm/pinctrl-bcm2835.c b/drivers/pinctrl/bcm/pinctrl-bcm2835.c
index 0bc1abcedbae..52c15234eb09 100644
--- a/drivers/pinctrl/bcm/pinctrl-bcm2835.c
+++ b/drivers/pinctrl/bcm/pinctrl-bcm2835.c
@@ -23,7 +23,7 @@
#include <linux/delay.h>
#include <linux/device.h>
#include <linux/err.h>
-#include <linux/gpio.h>
+#include <linux/gpio/driver.h>
#include <linux/interrupt.h>
#include <linux/io.h>
#include <linux/irq.h>
@@ -337,7 +337,7 @@ static int bcm2835_gpio_direction_input(struct gpio_chip *chip, unsigned offset)
static int bcm2835_gpio_get(struct gpio_chip *chip, unsigned offset)
{
- struct bcm2835_pinctrl *pc = dev_get_drvdata(chip->parent);
+ struct bcm2835_pinctrl *pc = gpiochip_get_data(chip);
return bcm2835_gpio_get_bit(pc, GPLEV0, offset);
}
@@ -350,14 +350,14 @@ static int bcm2835_gpio_direction_output(struct gpio_chip *chip,
static void bcm2835_gpio_set(struct gpio_chip *chip, unsigned offset, int value)
{
- struct bcm2835_pinctrl *pc = dev_get_drvdata(chip->parent);
+ struct bcm2835_pinctrl *pc = gpiochip_get_data(chip);
bcm2835_gpio_set_bit(pc, value ? GPSET0 : GPCLR0, offset);
}
static int bcm2835_gpio_to_irq(struct gpio_chip *chip, unsigned offset)
{
- struct bcm2835_pinctrl *pc = dev_get_drvdata(chip->parent);
+ struct bcm2835_pinctrl *pc = gpiochip_get_data(chip);
return irq_linear_revmap(pc->irq_domain, offset);
}
@@ -1020,7 +1020,7 @@ static int bcm2835_pinctrl_probe(struct platform_device *pdev)
}
}
- err = gpiochip_add(&pc->gpio_chip);
+ err = gpiochip_add_data(&pc->gpio_chip, pc);
if (err) {
dev_err(dev, "could not add GPIO chip\n");
return err;
--
2.4.3
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH 092/182] pinctrl: bcm2835: use gpiochip data pointer
2015-12-09 13:30 [PATCH 092/182] pinctrl: bcm2835: use gpiochip data pointer Linus Walleij
@ 2015-12-11 5:20 ` Stephen Warren
2015-12-14 13:57 ` Linus Walleij
0 siblings, 1 reply; 5+ messages in thread
From: Stephen Warren @ 2015-12-11 5:20 UTC (permalink / raw)
To: Linus Walleij
Cc: linux-gpio, Johan Hovold, Alexandre Courbot, Michael Welling,
Markus Pargmann, Eric Anholt
On 12/09/2015 06:30 AM, Linus Walleij wrote:
> 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().
This looks like it's fine, but I wonder what is the justification for
the change? It might be good to mention that in the commit description.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 092/182] pinctrl: bcm2835: use gpiochip data pointer
2015-12-11 5:20 ` Stephen Warren
@ 2015-12-14 13:57 ` Linus Walleij
2015-12-14 18:03 ` Eric Anholt
0 siblings, 1 reply; 5+ messages in thread
From: Linus Walleij @ 2015-12-14 13:57 UTC (permalink / raw)
To: Stephen Warren
Cc: linux-gpio@vger.kernel.org, Johan Hovold, Alexandre Courbot,
Michael Welling, Markus Pargmann, Eric Anholt
On Fri, Dec 11, 2015 at 6:20 AM, Stephen Warren <swarren@wwwdotorg.org> wrote:
> On 12/09/2015 06:30 AM, Linus Walleij wrote:
>> 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().
>
> This looks like it's fine, but I wonder what is the justification for
> the change? It might be good to mention that in the commit description.
It is in patch 000/182:
http://marc.info/?l=linux-gpio&m=144966662402660&w=2
I couldn't CC everyone on patch 000, because the mailing lists
complain if too many people are in the To: and CC fields. Damned if
I do, damned if I don't...
Yours,
Linus Walleij
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 092/182] pinctrl: bcm2835: use gpiochip data pointer
2015-12-14 13:57 ` Linus Walleij
@ 2015-12-14 18:03 ` Eric Anholt
2015-12-17 13:40 ` Linus Walleij
0 siblings, 1 reply; 5+ messages in thread
From: Eric Anholt @ 2015-12-14 18:03 UTC (permalink / raw)
To: Linus Walleij, Stephen Warren
Cc: linux-gpio@vger.kernel.org, Johan Hovold, Alexandre Courbot,
Michael Welling, Markus Pargmann
[-- Attachment #1: Type: text/plain, Size: 795 bytes --]
Linus Walleij <linus.walleij@linaro.org> writes:
> On Fri, Dec 11, 2015 at 6:20 AM, Stephen Warren <swarren@wwwdotorg.org> wrote:
>> On 12/09/2015 06:30 AM, Linus Walleij wrote:
>>> 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().
>>
>> This looks like it's fine, but I wonder what is the justification for
>> the change? It might be good to mention that in the commit description.
>
> It is in patch 000/182:
> http://marc.info/?l=linux-gpio&m=144966662402660&w=2
Thanks, that helps.
I don't think it makes much sense to remove a module for a device that's
opened, but I don't really have any stake in the discussion. So, for
the bcm2835 part:
Acked-by: Eric Anholt <eric@anholt.net>
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 818 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 092/182] pinctrl: bcm2835: use gpiochip data pointer
2015-12-14 18:03 ` Eric Anholt
@ 2015-12-17 13:40 ` Linus Walleij
0 siblings, 0 replies; 5+ messages in thread
From: Linus Walleij @ 2015-12-17 13:40 UTC (permalink / raw)
To: Eric Anholt
Cc: Stephen Warren, linux-gpio@vger.kernel.org, Johan Hovold,
Alexandre Courbot, Michael Welling, Markus Pargmann
On Mon, Dec 14, 2015 at 7:03 PM, Eric Anholt <eric@anholt.net> wrote:
> Linus Walleij <linus.walleij@linaro.org> writes:
>
>> On Fri, Dec 11, 2015 at 6:20 AM, Stephen Warren <swarren@wwwdotorg.org> wrote:
>>> On 12/09/2015 06:30 AM, Linus Walleij wrote:
>>>> 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().
>>>
>>> This looks like it's fine, but I wonder what is the justification for
>>> the change? It might be good to mention that in the commit description.
>>
>> It is in patch 000/182:
>> http://marc.info/?l=linux-gpio&m=144966662402660&w=2
>
> Thanks, that helps.
>
> I don't think it makes much sense to remove a module for a device that's
> opened,
That is not what we're afraid of really. We are afraid of the actual
device going away, like a GPIO on a USB cable that someone
unplugs.
> Acked-by: Eric Anholt <eric@anholt.net>
Thanks.
Yours,
Linus Walleij
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2015-12-17 13:40 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-12-09 13:30 [PATCH 092/182] pinctrl: bcm2835: use gpiochip data pointer Linus Walleij
2015-12-11 5:20 ` Stephen Warren
2015-12-14 13:57 ` Linus Walleij
2015-12-14 18:03 ` Eric Anholt
2015-12-17 13:40 ` Linus Walleij
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).