libqos: Use explicit QTestState for i2c operations

Drop one more client of global_qtest by teaching all i2c test
functionality to pass in an explicit QTestState, adjusting all
callers.

Signed-off-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
This commit is contained in:
Eric Blake 2017-09-11 12:19:59 -05:00 committed by Thomas Huth
parent 9b67af76db
commit f1dfd50732
5 changed files with 66 additions and 65 deletions

View file

@ -9,6 +9,7 @@
#ifndef LIBQOS_I2C_H
#define LIBQOS_I2C_H
#include "libqtest.h"
typedef struct I2CAdapter I2CAdapter;
struct I2CAdapter {
@ -16,6 +17,8 @@ struct I2CAdapter {
const uint8_t *buf, uint16_t len);
void (*recv)(I2CAdapter *adapter, uint8_t addr,
uint8_t *buf, uint16_t len);
QTestState *qts;
};
void i2c_send(I2CAdapter *i2c, uint8_t addr,
@ -24,9 +27,9 @@ void i2c_recv(I2CAdapter *i2c, uint8_t addr,
uint8_t *buf, uint16_t len);
/* libi2c-omap.c */
I2CAdapter *omap_i2c_create(uint64_t addr);
I2CAdapter *omap_i2c_create(QTestState *qts, uint64_t addr);
/* libi2c-imx.c */
I2CAdapter *imx_i2c_create(uint64_t addr);
I2CAdapter *imx_i2c_create(QTestState *qts, uint64_t addr);
#endif