Topics

RFC: Change returning type from Pinmux APIs


Andre Guedes <andre.guedes@...>
 

Hi all,

While I was working on the errno transition patchset, I realized all driver
APIs (i2c, spi, gpio, etc.) return 'int' type, but pinmux APIs. For the sake
of consistency, I think we should change the returning type from 'uint32_t'
to 'int' in include/pinmux.h APIs.

Besides keeping consistency between all drivers APIs, this change would also
be aligned with the errno.h code transition we're discussing in the other
thread. Pinmux drivers will return negative errno.h codes in case of error
so returning 'int' is more suitable than 'uint32_t'.

I sent a patch [1] as draft so you can have a idea of the changes required
(basically, API and drivers).

This change conflicts with the pinmux patchset from Vinicius. We talked
offline and we are both fine to whatever patch gets merged first.

Regards,

Andre

[1] https://gerrit.zephyrproject.org/r/#/c/881/


Kalowsky, Daniel <daniel.kalowsky@...>
 

Short version +1

-----Original Message-----
From: Andre Guedes [mailto:andre.guedes(a)intel.com]
Sent: Tuesday, March 15, 2016 2:58 PM
To: devel(a)lists.zephyrproject.org
Subject: [devel] RFC: Change returning type from Pinmux APIs

Hi all,

While I was working on the errno transition patchset, I realized all driver
APIs (i2c, spi, gpio, etc.) return 'int' type, but pinmux APIs. For the sake
of consistency, I think we should change the returning type from 'uint32_t'
to 'int' in include/pinmux.h APIs.
Another case of history and not properly updating the API after it has changed. Nice find.

Besides keeping consistency between all drivers APIs, this change would also
be aligned with the errno.h code transition we're discussing in the other
thread. Pinmux drivers will return negative errno.h codes in case of error
so returning 'int' is more suitable than 'uint32_t'.

I sent a patch [1] as draft so you can have a idea of the changes required
(basically, API and drivers).

This change conflicts with the pinmux patchset from Vinicius. We talked
offline and we are both fine to whatever patch gets merged first.
Good.


Regards,

Andre

[1] https://gerrit.zephyrproject.org/r/#/c/881/