On Sun, Dec 27, 2015 at 8:47 AM, Laurent Pinchart <laurent.pinchart@xxxxxxxxxxxxxxxx> wrote: > Would something like the following make sense ? > > value = chip->get ? chip->get(chip, offset) : -EIO; > value = IS_ERR_VALUE(value) ? value : !!value; Yeah that makes sense, I didn't think about using IS_ERR_VALUE() to mitigate the situation. Patches welcome :) > Granted, GPIO drivers would still need to make sure that the value they return > from register reads don't get considered as an error code, but any val & (1 << > offset) would be fine, which is the most common case. > > If you still think that patching all GPIO drivers is better I won't oppose to > that. I have already patches all the drivers with this problem, merged the larger part of it and will merge the remainders for v4.6. The above is still more elegant than the code we have so I'd take it to put some nice robustness icing on top... Yours, Linus Walleij -- To unsubscribe from this list: send the line "unsubscribe linux-gpio" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html