Hacker News new | past | comments | ask | show | jobs | submit login

I could see this introducing a performance hit...

Previously a register address was a hardcoded constant. Very small,very fast.

Now, looking up a register ina map involves string matching on the name across every possible register in the map till you find a match. That is much slower, but also makes the kernel quite a lot larger, because you're effectively shipping half the device datasheet in the form of names for every flag bit.




At runtime this is all just a couple of pointer indirections so the impact is minimal. There are also special functions for bulk transfer so regmap shouldn't be called in tight loops.


There's no string matching that I can see in the linked article?


" .name = "dw-mipi-dsi","

Looks like a string in the structure to me. And when you have an array of such structures, you end up scanning through them checking for the name you need.


That's the name of the regmap. Clicking through to the definition of the structure says it's optional and thus there for descriptive purposes.

     *
     * @name: Optional name of the regmap. Useful when a device has multiple
     *        register regions.


Look at the usage example a couple of lines below; it's passing a pointer to that structure. There's no scanning necessary, it already knows where the structure is.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: