Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What does DEFINE_IDA mean?

I was going through chipidea usb otg driver code and I see such similar definitions numerous times.

static DEFINE_IDA(ci_ida);

I don't get what it meant in the programming world and its purpose. Can someone please explain the same?

like image 614
Adit Ya Avatar asked Feb 19 '26 13:02

Adit Ya


1 Answers

As already noted, DEFINE_IDE(name) is #defined as struct ida name = IDA_INIT(name). You should check out LXR which is very convenient for browsing kernel source.

IDR is a subsystem in the kernel that provides an efficient way to map ids to pointers. Normally you would use the id as an offset into an array of pointers, but this limits how big your ids are. IDR solves this by using radix trees instead for lookup.

Sometimes you just want unique ids without associating them with pointers and that's what IDA is for.

 /* IDA - IDR based ID allocator  
  * 
  * This is id allocator without id -> pointer translation.  Memory
  * usage is much lower than full blown idr because each id only
  * occupies a bit.
like image 167
a3f Avatar answered Feb 21 '26 13:02

a3f



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!