Skip to content
Snippets Groups Projects
  • mario.six@gdsys.cc's avatar
    059fce9f
    i2c: mvtwsi: Get rid of status parameter · 059fce9f
    mario.six@gdsys.cc authored
    
    The twsi_stop function contains a parameter "status," which is used to
    pass in the current exit status of the function calling twsi_stop, and
    either return this status unchanged if it indicates an error, or return
    twsi_stop's exit status if it does not indicate an error.
    
    While not massively complicated, this adds another purpose to the
    twsi_stop function, which should have the sole purpose of asserting a
    STOP condition on the bus (and not manage the exit status of its
    caller).
    
    Therefore, we move the exit status management into the caller functions
    by introducing a "stop_status" variable and returning either the status
    before the twsi_stop call (kept in the "status" variable), or the status
    from the twsi_stop call, depending on which indicates an error.
    
    Signed-off-by: default avatarMario Six <mario.six@gdsys.cc>
    Reviewed-by: default avatarStefan Roese <sr@denx.de>
    059fce9f
    History
    i2c: mvtwsi: Get rid of status parameter
    mario.six@gdsys.cc authored
    
    The twsi_stop function contains a parameter "status," which is used to
    pass in the current exit status of the function calling twsi_stop, and
    either return this status unchanged if it indicates an error, or return
    twsi_stop's exit status if it does not indicate an error.
    
    While not massively complicated, this adds another purpose to the
    twsi_stop function, which should have the sole purpose of asserting a
    STOP condition on the bus (and not manage the exit status of its
    caller).
    
    Therefore, we move the exit status management into the caller functions
    by introducing a "stop_status" variable and returning either the status
    before the twsi_stop call (kept in the "status" variable), or the status
    from the twsi_stop call, depending on which indicates an error.
    
    Signed-off-by: default avatarMario Six <mario.six@gdsys.cc>
    Reviewed-by: default avatarStefan Roese <sr@denx.de>