All of lore.kernel.org
 help / color / mirror / Atom feed
From: Michal Simek <michal.simek@petalogix.com>
To: avorontsov@ru.mvista.com
Cc: Michal Simek <monstr@monstr.eu>,
	David Brownell <dbrownell@users.sourceforge.net>,
	devicetree-discuss@lists.ozlabs.org,
	linux-kernel@vger.kernel.org, linuxppc-dev@ozlabs.org,
	microblaze-uclinux@itee.uq.edu.au,
	David Miller <davem@davemloft.net>
Subject: Re: [PATCH RFC 0/3] Implement refcounting for OF GPIO chips
Date: Tue, 09 Feb 2010 10:40:53 +0100	[thread overview]
Message-ID: <4B712DA5.4000802@petalogix.com> (raw)
In-Reply-To: <20100205204949.GA2575@oksana.dev.rtsoft.ru>

Anton Vorontsov wrote:
> 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.


I tested xilinx gpio driver, heartbeat trigger and access through sysfs 
and I haven't found any problem. There is only small part of code for 
Microblaze and it is the same with PowerPC. If is Ben OK with it, I am 
ok too.

Thanks,
Michal


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


-- 
Michal Simek, Ing. (M.Eng)
PetaLogix - Linux Solutions for a Reconfigurable World
w: www.petalogix.com p: +61-7-30090663,+42-0-721842854 f: +61-7-30090663

WARNING: multiple messages have this Message-ID (diff)
From: Michal Simek <michal.simek@petalogix.com>
To: avorontsov@ru.mvista.com
Cc: Grant Likely <grant.likely@secretlab.ca>,
	David Brownell <dbrownell@users.sourceforge.net>,
	Benjamin Herrenschmidt <benh@kernel.crashing.org>,
	David Miller <davem@davemloft.net>,
	Michal Simek <monstr@monstr.eu>,
	linuxppc-dev@ozlabs.org, linux-kernel@vger.kernel.org,
	devicetree-discuss@lists.ozlabs.org,
	microblaze-uclinux@itee.uq.edu.au
Subject: Re: [PATCH RFC 0/3] Implement refcounting for OF GPIO chips
Date: Tue, 09 Feb 2010 10:40:53 +0100	[thread overview]
Message-ID: <4B712DA5.4000802@petalogix.com> (raw)
In-Reply-To: <20100205204949.GA2575@oksana.dev.rtsoft.ru>

Anton Vorontsov wrote:
> 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.


I tested xilinx gpio driver, heartbeat trigger and access through sysfs 
and I haven't found any problem. There is only small part of code for 
Microblaze and it is the same with PowerPC. If is Ben OK with it, I am 
ok too.

Thanks,
Michal


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


-- 
Michal Simek, Ing. (M.Eng)
PetaLogix - Linux Solutions for a Reconfigurable World
w: www.petalogix.com p: +61-7-30090663,+42-0-721842854 f: +61-7-30090663

  parent reply	other threads:[~2010-02-09  9:43 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-02-05 20:49 [PATCH RFC 0/3] Implement refcounting for OF GPIO chips Anton Vorontsov
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
2010-02-05 20:50   ` Anton Vorontsov
2010-02-09 17:22   ` Grant Likely
2010-02-09 17:22     ` Grant Likely
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-05 20:50   ` Anton Vorontsov
2010-02-09 17:25   ` Grant Likely
2010-02-09 17:25     ` Grant Likely
2010-02-09 19:10     ` Anton Vorontsov
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-05 20:50   ` Anton Vorontsov
2010-02-09  9:15   ` Michal Simek
2010-02-09  9:15     ` Michal Simek
2010-02-09  9:20     ` Michal Simek
2010-02-09  9:20       ` Michal Simek
2010-02-09 17:28   ` Grant Likely
2010-02-09 17:28     ` Grant Likely
2010-02-09 17:28     ` Grant Likely
2010-02-09 19:14     ` Anton Vorontsov
2010-02-09 19:14       ` Anton Vorontsov
2010-02-15 19:49       ` Grant Likely
2010-02-15 19:49         ` Grant Likely
2010-02-15 20:59         ` Anton Vorontsov
2010-02-15 20:59           ` Anton Vorontsov
2010-02-15 20:59           ` Anton Vorontsov
2010-02-09  9:40 ` Michal Simek [this message]
2010-02-09  9:40   ` [PATCH RFC 0/3] Implement refcounting " Michal Simek
2010-02-09 17:29   ` Grant Likely
2010-02-09 17:29     ` Grant Likely
2010-02-09 19:06   ` Anton Vorontsov
2010-02-09 19:06     ` Anton Vorontsov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4B712DA5.4000802@petalogix.com \
    --to=michal.simek@petalogix.com \
    --cc=avorontsov@ru.mvista.com \
    --cc=davem@davemloft.net \
    --cc=dbrownell@users.sourceforge.net \
    --cc=devicetree-discuss@lists.ozlabs.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linuxppc-dev@ozlabs.org \
    --cc=microblaze-uclinux@itee.uq.edu.au \
    --cc=monstr@monstr.eu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.