Re: [PATCH v3 10/13] hw/misc/auxbus: Replace i2c_send_recv() by i2c_recv() & i2c_send()

2021-06-16 Thread BALATON Zoltan
On Wed, 16 Jun 2021, Philippe Mathieu-Daudé wrote: On 6/16/21 8:46 PM, Richard Henderson wrote: On 6/16/21 9:14 AM, Philippe Mathieu-Daudé wrote: @@ -161,12 +157,11 @@ AUXReply aux_request(AUXBus *bus, AUXCommand cmd, uint32_t address,   }     ret = AUX_I2C_ACK; -    while (

Re: [PATCH v3 10/13] hw/misc/auxbus: Replace i2c_send_recv() by i2c_recv() & i2c_send()

2021-06-16 Thread Philippe Mathieu-Daudé
On 6/16/21 8:46 PM, Richard Henderson wrote: > On 6/16/21 9:14 AM, Philippe Mathieu-Daudé wrote: >> @@ -161,12 +157,11 @@ AUXReply aux_request(AUXBus *bus, AUXCommand >> cmd, uint32_t address, >>   } >>     ret = AUX_I2C_ACK; >> -    while (len > 0) { >> -    if (i2c_sen

Re: [PATCH v3 10/13] hw/misc/auxbus: Replace i2c_send_recv() by i2c_recv() & i2c_send()

2021-06-16 Thread Richard Henderson
On 6/16/21 9:14 AM, Philippe Mathieu-Daudé wrote: @@ -161,12 +157,11 @@ AUXReply aux_request(AUXBus *bus, AUXCommand cmd, uint32_t address, } ret = AUX_I2C_ACK; -while (len > 0) { -if (i2c_send_recv(i2c_bus, data++, true) < 0) { +for (i = 0; i

[PATCH v3 10/13] hw/misc/auxbus: Replace i2c_send_recv() by i2c_recv() & i2c_send()

2021-06-16 Thread Philippe Mathieu-Daudé
Instead of using the confuse i2c_send_recv(), replace i2c_send_recv(send = true) by i2c_send() and i2c_send_recv(send = false) by i2c_recv(). During the replacement we also change a while() statement by for(). The resulting code is easier to review. Signed-off-by: Philippe Mathieu-Daudé ---