smtiic_i2c_acquire_bus gets used as iic_acquire_bus()

Which is code like this -- found throughout the tree --

void
smtpmic_reg_write(struct smtpmic_softc *sc, int reg, uint8_t val)
{
        uint8_t cmd = reg;
        int error;

        iic_acquire_bus(sc->sc_tag, I2C_F_POLL);
        error = iic_exec(sc->sc_tag, I2C_OP_WRITE_WITH_STOP, sc->sc_addr,
            &cmd, sizeof cmd, &val, sizeof val, I2C_F_POLL);

Noone looks at the error from iic_acquire_bus().

How does this error return help?  Code encountering an error needs
to give up and do something else, or jca's original proposal for a
delay, or this code should spin-and-wait in some way.


Also notice that the example function above returns void, so if the
wait fails with EIO, this cannot return an error to an upper layer
to retry, and the write operation is simply skipped silently.

So what will happen is smtiic_i2c_acquire_bus -> smtiic_wait_state()
return EIO.  Do not ICR_IUE.  Then still call the exec function.

Isn't the *acquire_bus layer completely broken in every driver?

Reply via email to