On Wed, Nov 12, 2014 at 01:25:31PM -0500, Ashwin Chaugule wrote:
On 11 November 2014 15:25, Arnd Bergmann arnd@arndb.de wrote:
struct pcc_channel { struct list_head node; struct mbox_chan chan; };
Then use list_for_each_entry() to get the subspace id from a struct mbox_chan* , and list_for_each() + list_entry() to get the channel from a subspace index. These lists are not expected to get long in practice so traversing them for lookups is not really expensive and its only done at init.
Does this make sense?
That's how we do it for regulators - even if the list does get a bit long it seems like it's unlikely to get so long that it's going to be a problem in init paths.