Re: Device driver configuration and driver_data distinction.


Marcus Shawcroft <marcus.shawcroft@...>
 

Hi,

On 6 October 2016 at 17:55, Marcus Shawcroft <marcus.shawcroft(a)gmail.com> wrote:

Switching to const config_info will require the following:
1) Update ~50 drivers with an explicit const in any pointers they
construct when accessing their config_info structure. This change is
safe to make even when struct device {} has a a non const *config_info
2) Update a small subset of the above 50 to make their config
structures static. Not strictly necessary, but seems like the right
thing to do for all those drivers that are self contained within one
file.
3) Update ~12 drivers that currently have RW data within their RO
config data structure. This should be a straight forward mechanical
move of each RW object within config to the corresponding driver_data
structure.
4) Update ~12 drivers to put explict const in any pointers they
construct when accessing config_info
All of the patches to achieve the above are all now on gerrit, most
have been merged already.

.. with the exception of the DW PWM driver, which so far as I can tell
does not compile for any board at this point in time,
https://jira.zephyrproject.org/browse/ZEP-1040. Is there a board that
this driver should work for?

5) Update device {} to make config_info const
Once the above patches have been merged I'll post this one line patch.
Once this patch is applied all new drivers will need to consume their
config_info via a const * or they will get a build error.

6) Update all ~60 odd drivers to add const to their config structure
definitions.
Followed by these patches, 1 per driver, these patches are trivial,
they literally just add const to each definition of a drivers config
structure.

Cheers
/Marcus

Join devel@lists.zephyrproject.org to automatically receive all group messages.