Yes, you could do that. But then you have to test either before calling
gpio_set_value_cansleep() or inside it. And the test you have to perform
_is_ the validity check, so, you need it anyway.
Actually three times. The one before gpio_free() is not actually needed,
right, it is anyway checked inside. But gpio_set_value_cansleep() doesn't
check, so, it would be rude to call it with an invalid value.
Which arch is it? As I said, you could simplify the two specific camera
drivers by removing the checks where they are redundant. But on other
occasions the checks have to be done anyway, so, it is not a question of
runtime performance (apart from maybe the difference between calling a
function and executing inline), but just of an extra API member, which you
can have different opinions about:-)
Thanks
Guennadi
---
Guennadi Liakhovetski
--