Thread (12 messages) flat view 12 messages, 5 authors, 2011-06-29

[PATCH 1/2] PWM: add pwm framework support

From: arnd@arndb.de (Arnd Bergmann)
Date: 2011-06-28 17:04:56
Also in: lkml

On Tuesday 28 June 2011, Sascha Hauer wrote:
quoted
How about using idr? It provides you a fast lookup and handles giving
out unique numbers.
Sounds like a good idea, but is idr compatible with the pwmchip_reserve
function below? idr gives no guarantee that the first id is zero, but I
need exactly this to make the ids for the internal PWMs known at compile
time.
You can certainly use ida_get_new_above to guarantee that implicit
number allocation doesn't interfere with the reserved numbers. Whether
that guarantees that you get the reserved numbers when you ask for them,
I don't know.

A possible way to deal with that would be to allocate an array of pointers
for the reserved space but use IDR for the rest, but at that point the
complexity is probably higher than what you have now ;-)

Another question is whether the dynamic allocation even makes sense. How
does a driver that wants to use a PWM find out what number to ask for
when it's not reserved for the platform to start with. Maybe the
answer is to just use an array or tree for the lookup and refuse to
register multiple PWMs to the same number.

	Arnd
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help