linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH RFC 0/3] Implement refcounting for OF GPIO chips
@ 2010-02-05 20:49 Anton Vorontsov
  2010-02-05 20:50 ` [PATCH 1/3] of platforms: Move common static initialization to of_node_init() Anton Vorontsov
                   ` (3 more replies)
  0 siblings, 4 replies; 16+ messages in thread
From: Anton Vorontsov @ 2010-02-05 20:49 UTC (permalink / raw)
  To: Grant Likely, David Brownell
  Cc: Michal Simek, devicetree-discuss, linux-kernel, linuxppc-dev,
	microblaze-uclinux, David Miller

Hi all,

OF GPIO infrastructure is using dynamic GPIO bases, so it is possible
that of_get_gpio()'s returned GPIO number will be no longer valid, or
worse, it may point to an unexpected GPIO controller.

This scenario is possible:

driver A:               driver B:              driver C:
---------               ---------              ---------
                        gpiochip_add()
gpio = of_get_gpio()
                        gpiochip_remove()
                                               gpiochip_add()
gpio_request(gpio);
gpio_set_value(gpio);

That is, driver A assumes that it is working with GPIO from driver B,
but in practice it may disappear and driver C will take its GPIO base
number, so it will provide the same GPIO numbers.

The above situation is hard to trigger, but the issue is there
nonetheless, and so needs fixing.

Thanks,

p.s. The patches are based on top of
     '[PATCH v2 0/4] OF GPIO integration for I2C/SPI GPIO chips'
     http://lkml.org/lkml/2010/2/5/243

-- 
Anton Vorontsov
email: cbouatmailru@gmail.com
irc://irc.freenode.net/bd2

^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2010-02-15 20:59 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-02-05 20:49 [PATCH RFC 0/3] Implement refcounting for OF GPIO chips Anton Vorontsov
2010-02-05 20:50 ` [PATCH 1/3] of platforms: Move common static initialization to of_node_init() Anton Vorontsov
2010-02-09 17:22   ` Grant Likely
2010-02-05 20:50 ` [PATCH 2/3] of: Introduce safe accessors for node->data Anton Vorontsov
2010-02-09 17:25   ` Grant Likely
2010-02-09 19:10     ` Anton Vorontsov
2010-02-05 20:50 ` [PATCH 3/3] of/gpio: Introduce of_put_gpio(), add ref counting for OF GPIO chips Anton Vorontsov
2010-02-09  9:15   ` Michal Simek
2010-02-09  9:20     ` Michal Simek
2010-02-09 17:28   ` Grant Likely
2010-02-09 19:14     ` Anton Vorontsov
2010-02-15 19:49       ` Grant Likely
2010-02-15 20:59         ` Anton Vorontsov
2010-02-09  9:40 ` [PATCH RFC 0/3] Implement refcounting " Michal Simek
2010-02-09 17:29   ` Grant Likely
2010-02-09 19:06   ` Anton Vorontsov

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).