diff mbox

[16/38] ivshmem: Clean up register callbacks

Message ID 1456771254-17511-17-git-send-email-armbru@redhat.com
State New
Headers show

Commit Message

Markus Armbruster Feb. 29, 2016, 6:40 p.m. UTC
Signed-off-by: Markus Armbruster <armbru@redhat.com>
---
 hw/misc/ivshmem.c | 11 ++---------
 1 file changed, 2 insertions(+), 9 deletions(-)

Comments

Marc-André Lureau March 1, 2016, 4:04 p.m. UTC | #1
On Mon, Feb 29, 2016 at 7:40 PM, Markus Armbruster <armbru@redhat.com> wrote:
> Signed-off-by: Markus Armbruster <armbru@redhat.com>
> ---

Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>


>  hw/misc/ivshmem.c | 11 ++---------
>  1 file changed, 2 insertions(+), 9 deletions(-)
>
> diff --git a/hw/misc/ivshmem.c b/hw/misc/ivshmem.c
> index 1392426..7191914 100644
> --- a/hw/misc/ivshmem.c
> +++ b/hw/misc/ivshmem.c
> @@ -121,12 +121,10 @@ static inline uint32_t ivshmem_has_feature(IVShmemState *ivs,
>      return (ivs->features & (1 << feature));
>  }
>
> -/* accessing registers - based on rtl8139 */
>  static void ivshmem_update_irq(IVShmemState *s)
>  {
>      PCIDevice *d = PCI_DEVICE(s);
> -    int isr;
> -    isr = (s->intrstatus & s->intrmask) & 0xffffffff;
> +    uint32_t isr = s->intrstatus & s->intrmask;
>
>      /* don't print ISR resets */
>      if (isr) {
> @@ -134,7 +132,7 @@ static void ivshmem_update_irq(IVShmemState *s)
>                          isr ? 1 : 0, s->intrstatus, s->intrmask);
>      }
>
> -    pci_set_irq(d, (isr != 0));
> +    pci_set_irq(d, isr != 0);
>  }
>
>  static void ivshmem_IntrMask_write(IVShmemState *s, uint32_t val)
> @@ -142,7 +140,6 @@ static void ivshmem_IntrMask_write(IVShmemState *s, uint32_t val)
>      IVSHMEM_DPRINTF("IntrMask write(w) val = 0x%04x\n", val);
>
>      s->intrmask = val;
> -
>      ivshmem_update_irq(s);
>  }
>
> @@ -151,7 +148,6 @@ static uint32_t ivshmem_IntrMask_read(IVShmemState *s)
>      uint32_t ret = s->intrmask;
>
>      IVSHMEM_DPRINTF("intrmask read(w) val = 0x%04x\n", ret);
> -
>      return ret;
>  }
>
> @@ -160,7 +156,6 @@ static void ivshmem_IntrStatus_write(IVShmemState *s, uint32_t val)
>      IVSHMEM_DPRINTF("IntrStatus write(w) val = 0x%04x\n", val);
>
>      s->intrstatus = val;
> -
>      ivshmem_update_irq(s);
>  }
>
> @@ -170,9 +165,7 @@ static uint32_t ivshmem_IntrStatus_read(IVShmemState *s)
>
>      /* reading ISR clears all interrupts */
>      s->intrstatus = 0;
> -
>      ivshmem_update_irq(s);
> -
>      return ret;
>  }
>
> --
> 2.4.3
>
>
diff mbox

Patch

diff --git a/hw/misc/ivshmem.c b/hw/misc/ivshmem.c
index 1392426..7191914 100644
--- a/hw/misc/ivshmem.c
+++ b/hw/misc/ivshmem.c
@@ -121,12 +121,10 @@  static inline uint32_t ivshmem_has_feature(IVShmemState *ivs,
     return (ivs->features & (1 << feature));
 }
 
-/* accessing registers - based on rtl8139 */
 static void ivshmem_update_irq(IVShmemState *s)
 {
     PCIDevice *d = PCI_DEVICE(s);
-    int isr;
-    isr = (s->intrstatus & s->intrmask) & 0xffffffff;
+    uint32_t isr = s->intrstatus & s->intrmask;
 
     /* don't print ISR resets */
     if (isr) {
@@ -134,7 +132,7 @@  static void ivshmem_update_irq(IVShmemState *s)
                         isr ? 1 : 0, s->intrstatus, s->intrmask);
     }
 
-    pci_set_irq(d, (isr != 0));
+    pci_set_irq(d, isr != 0);
 }
 
 static void ivshmem_IntrMask_write(IVShmemState *s, uint32_t val)
@@ -142,7 +140,6 @@  static void ivshmem_IntrMask_write(IVShmemState *s, uint32_t val)
     IVSHMEM_DPRINTF("IntrMask write(w) val = 0x%04x\n", val);
 
     s->intrmask = val;
-
     ivshmem_update_irq(s);
 }
 
@@ -151,7 +148,6 @@  static uint32_t ivshmem_IntrMask_read(IVShmemState *s)
     uint32_t ret = s->intrmask;
 
     IVSHMEM_DPRINTF("intrmask read(w) val = 0x%04x\n", ret);
-
     return ret;
 }
 
@@ -160,7 +156,6 @@  static void ivshmem_IntrStatus_write(IVShmemState *s, uint32_t val)
     IVSHMEM_DPRINTF("IntrStatus write(w) val = 0x%04x\n", val);
 
     s->intrstatus = val;
-
     ivshmem_update_irq(s);
 }
 
@@ -170,9 +165,7 @@  static uint32_t ivshmem_IntrStatus_read(IVShmemState *s)
 
     /* reading ISR clears all interrupts */
     s->intrstatus = 0;
-
     ivshmem_update_irq(s);
-
     return ret;
 }