]> git.proxmox.com Git - mirror_qemu.git/blobdiff - hw/i2c/imx_i2c.c
Merge remote-tracking branch 'remotes/amarkovic/tags/mips-queue-dec-16-2019' into...
[mirror_qemu.git] / hw / i2c / imx_i2c.c
index 6c81b98ebd88460a34cbd39d3d61faa7602725b2..30b9aea2471d5652baa021cd112eb1513e4f2026 100644 (file)
 
 #include "qemu/osdep.h"
 #include "hw/i2c/imx_i2c.h"
+#include "hw/irq.h"
+#include "migration/vmstate.h"
 #include "hw/i2c/i2c.h"
 #include "qemu/log.h"
+#include "qemu/module.h"
 
 #ifndef DEBUG_IMX_I2C
 #define DEBUG_IMX_I2C 0
@@ -120,7 +123,7 @@ static uint64_t imx_i2c_read(void *opaque, hwaddr offset,
         value = s->i2dr_read;
 
         if (imx_i2c_is_master(s)) {
-            int ret = 0xff;
+            uint8_t ret = 0xff;
 
             if (s->address == ADDR_RESET) {
                 /* something is wrong as the address is not set */
@@ -133,15 +136,7 @@ static uint64_t imx_i2c_read(void *opaque, hwaddr offset,
             } else {
                 /* get the next byte */
                 ret = i2c_recv(s->bus);
-
-                if (ret >= 0) {
-                    imx_i2c_raise_interrupt(s);
-                } else {
-                    qemu_log_mask(LOG_GUEST_ERROR, "[%s]%s: read failed "
-                                  "for device 0x%02x\n", TYPE_IMX_I2C,
-                                  __func__, s->address);
-                    ret = 0xff;
-                }
+                imx_i2c_raise_interrupt(s);
             }
 
             s->i2dr_read = ret;