On 4/24/24 7:00 PM, Doug Anderson wrote:
I worry a little bit about keying just off of -EREMOTEIO. If I'm
skimming the code properly it's up to the different i2c bus controller
to decide which error code to return here. Looking at, for instance,
"i2c-qcom-geni.c", I see:
[NACK] = {-ENXIO, "NACK: slv unresponsive, check its power/reset-ln"},
Hmm, good point. I decided to go through the drivers and check their
behavior on NACK, and based on my quick glance I found (insert accuracy
disclaimer):
- 52 drivers emitting ENXIO
- 14 drivers emitting EREMOTEIO
- 11 driver emitting EIO
- 5 drivers emitting ETIMEDOUT
- 1 driver emitting EAGAIN
- 1 driver emitting I2C_ERR_BERR (???)
So just EREMOTEIO is definitely not good enough. Looking at the drivers,
it seems like the majority of drivers emitting generic error codes could
just as well emit ENXIO on NACK. Room for improvement.
Maybe we should just use dev_dbg() in all cases here when we fail to
fetch the descriptor? ...otherwise I think some boards will start
getting a noisy error message.
I'm okay with that. I don't like hiding a useful error message, but the
smbus probe would also have hidden bus errors.
I'll send a v3 with just dev_dbg, then if I (or someone else) end up
aligning more i2c drivers on their NACK error we can go to the stricter
check and incentivize the drivers to give meaningful error values...