[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <200906151633.03217.david-b@pacbell.net>
Date: Mon, 15 Jun 2009 16:33:02 -0700
From: David Brownell <david-b@...bell.net>
To: Baruch Siach <baruch@...s.co.il>
Cc: Andrew Morton <akpm@...ux-foundation.org>,
linux-kernel@...r.kernel.org,
linux-arm-kernel@...ts.arm.linux.org.uk, linux@....linux.org.uk
Subject: Re: [PATCH v4] gpio: driver for PrimeCell PL061 GPIO controller
On Wednesday 10 June 2009, Baruch Siach wrote:
> > Should the gpio core provide a primitive to check that a gpio has been
> > properly requested rathe rthan open-coding it here?
>
> Probably.
I happen to strongly dislike primitives that are fundamentally
MT-unsafe, except in non-threaded environments ... so I would
disagree about that. :)
If you want to see if a GPIO is available, allocate it.
The only answer you can really depend on is "yes, it's
mine now". You can't rely on other threads not allocating,
or not de-allocating, the GPIO later ... unless they can't,
because it's not theirs.
But that's beside the point, since GPIO drivers shouldn't
be in the business of requesting the GPIOs they manage.
Such layer violations are another sign that you may not be
thinking very clearly about things.
In this case, whoever allocated that GPIO for IRQ purposes
should have done the gpio_request() before handing out
the gpio_to_irq() results to however many drivers ended
up needing to use it.
- Dave
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists