cpu: fix returns of i2c_acquire and i2c_release#10856
cpu: fix returns of i2c_acquire and i2c_release#10856smlng wants to merge 7 commits intoRIOT-OS:masterfrom
Conversation
|
@MrKevinWeiss @gschorcht @gebart I think this is related to #10673 ;) |
|
Maybe link to #10673. You could give your opinion there as well ? |
|
NACK, we've had this discussion many times. periph device args get checked on Adding this error here would basically force any user to actually check for the error, which is just overkill for embedded use. |
Indeed. As stated in #10673, 95 % of our drivers do not check these return values. An BTW, I would rather add a further |
|
Any movement on this front? Can we agree asserts are enough? |
|
This almost looks like a rough consensus to me: Those who disagree closing this PR (+related) should speak up asap. |
|
closing ... as discussed, this should be addressed differently. |
Contribution description
This PR replaces
assertswithifstatements inperiph/i2cfor all CPUs to return proper error codes according to the API spec. The rational behind this is that (theoretically) one could write a driver and simply link against RIOT without recompiling theperiph/i2c, henceassertswill not work but according to the API specsacquireandreleaseshould return-1on error, which in this case mostly means: wrong deviceTesting procedure
run
tests/periph_i2c(or any drivers requiring I2C) for different boards to match all CPUs, it should still work.Issues/PRs references