[Qemu-devel] [PATCH v3 03/16] arm:i2c: Don't mask return from i2c_recv()

minyard@acm.org posted 16 patches 7 years, 2 months ago
There is a newer version of this series
[Qemu-devel] [PATCH v3 03/16] arm:i2c: Don't mask return from i2c_recv()
Posted by minyard@acm.org 7 years, 2 months ago
From: Corey Minyard <cminyard@mvista.com>

It can't fail, and now that it returns a uint8_t a 0xff mask
is unnecessary.

Signed-off-by: Corey Minyard <cminyard@mvista.com>
Suggested-by: Peter Maydell <peter.maydell@linaro.org>
---
 hw/arm/stellaris.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/hw/arm/stellaris.c b/hw/arm/stellaris.c
index 6c69ce79b2..638b649911 100644
--- a/hw/arm/stellaris.c
+++ b/hw/arm/stellaris.c
@@ -811,7 +811,7 @@ static void stellaris_i2c_write(void *opaque, hwaddr offset,
             /* TODO: Handle errors.  */
             if (s->msa & 1) {
                 /* Recv */
-                s->mdr = i2c_recv(s->bus) & 0xff;
+                s->mdr = i2c_recv(s->bus);
             } else {
                 /* Send */
                 i2c_send(s->bus, s->mdr);
-- 
2.17.1


Re: [Qemu-devel] [PATCH v3 03/16] arm:i2c: Don't mask return from i2c_recv()
Posted by Philippe Mathieu-Daudé 7 years, 2 months ago
On 26/11/18 21:04, minyard@acm.org wrote:
> From: Corey Minyard <cminyard@mvista.com>
> 
> It can't fail, and now that it returns a uint8_t a 0xff mask
> is unnecessary.
> 
> Signed-off-by: Corey Minyard <cminyard@mvista.com>
> Suggested-by: Peter Maydell <peter.maydell@linaro.org>
> ---
>  hw/arm/stellaris.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/hw/arm/stellaris.c b/hw/arm/stellaris.c
> index 6c69ce79b2..638b649911 100644
> --- a/hw/arm/stellaris.c
> +++ b/hw/arm/stellaris.c
> @@ -811,7 +811,7 @@ static void stellaris_i2c_write(void *opaque, hwaddr offset,
>              /* TODO: Handle errors.  */
>              if (s->msa & 1) {
>                  /* Recv */
> -                s->mdr = i2c_recv(s->bus) & 0xff;
> +                s->mdr = i2c_recv(s->bus);
>              } else {
>                  /* Send */
>                  i2c_send(s->bus, s->mdr);
> 

This could be squashed in the previous patch.

Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Tested-by: Philippe Mathieu-Daudé <philmd@redhat.com>

Re: [Qemu-devel] [PATCH v3 03/16] arm:i2c: Don't mask return from i2c_recv()
Posted by Peter Maydell 7 years, 2 months ago
On Mon, 26 Nov 2018 at 20:04, <minyard@acm.org> wrote:
>
> From: Corey Minyard <cminyard@mvista.com>
>
> It can't fail, and now that it returns a uint8_t a 0xff mask
> is unnecessary.
>
> Signed-off-by: Corey Minyard <cminyard@mvista.com>
> Suggested-by: Peter Maydell <peter.maydell@linaro.org>
> ---
>  hw/arm/stellaris.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/hw/arm/stellaris.c b/hw/arm/stellaris.c
> index 6c69ce79b2..638b649911 100644
> --- a/hw/arm/stellaris.c
> +++ b/hw/arm/stellaris.c
> @@ -811,7 +811,7 @@ static void stellaris_i2c_write(void *opaque, hwaddr offset,
>              /* TODO: Handle errors.  */
>              if (s->msa & 1) {
>                  /* Recv */
> -                s->mdr = i2c_recv(s->bus) & 0xff;
> +                s->mdr = i2c_recv(s->bus);
>              } else {
>                  /* Send */

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>

thanks
-- PMM