libqos: rename i2c_send and i2c_recv
The names i2c_send and i2c_recv collide with functions defined in hw/i2c/core.c. This causes an error when linking against libqos and softmmu simultaneously (for example when using qtest inproc). Rename the libqos functions to avoid this. Signed-off-by: Alexander Bulekov <alxndr@bu.edu> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Reviewed-by: Darren Kenny <darren.kenny@oracle.com> Acked-by: Thomas Huth <thuth@redhat.com> Message-id: 20200220041118.23264-10-alxndr@bu.edu Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
This commit is contained in:
parent
0bd9aef89b
commit
39397a9a76
@ -10,12 +10,12 @@
|
||||
#include "libqos/i2c.h"
|
||||
#include "libqtest.h"
|
||||
|
||||
void i2c_send(QI2CDevice *i2cdev, const uint8_t *buf, uint16_t len)
|
||||
void qi2c_send(QI2CDevice *i2cdev, const uint8_t *buf, uint16_t len)
|
||||
{
|
||||
i2cdev->bus->send(i2cdev->bus, i2cdev->addr, buf, len);
|
||||
}
|
||||
|
||||
void i2c_recv(QI2CDevice *i2cdev, uint8_t *buf, uint16_t len)
|
||||
void qi2c_recv(QI2CDevice *i2cdev, uint8_t *buf, uint16_t len)
|
||||
{
|
||||
i2cdev->bus->recv(i2cdev->bus, i2cdev->addr, buf, len);
|
||||
}
|
||||
@ -23,8 +23,8 @@ void i2c_recv(QI2CDevice *i2cdev, uint8_t *buf, uint16_t len)
|
||||
void i2c_read_block(QI2CDevice *i2cdev, uint8_t reg,
|
||||
uint8_t *buf, uint16_t len)
|
||||
{
|
||||
i2c_send(i2cdev, ®, 1);
|
||||
i2c_recv(i2cdev, buf, len);
|
||||
qi2c_send(i2cdev, ®, 1);
|
||||
qi2c_recv(i2cdev, buf, len);
|
||||
}
|
||||
|
||||
void i2c_write_block(QI2CDevice *i2cdev, uint8_t reg,
|
||||
@ -33,7 +33,7 @@ void i2c_write_block(QI2CDevice *i2cdev, uint8_t reg,
|
||||
uint8_t *cmd = g_malloc(len + 1);
|
||||
cmd[0] = reg;
|
||||
memcpy(&cmd[1], buf, len);
|
||||
i2c_send(i2cdev, cmd, len + 1);
|
||||
qi2c_send(i2cdev, cmd, len + 1);
|
||||
g_free(cmd);
|
||||
}
|
||||
|
||||
|
@ -47,8 +47,8 @@ struct QI2CDevice {
|
||||
void *i2c_device_create(void *i2c_bus, QGuestAllocator *alloc, void *addr);
|
||||
void add_qi2c_address(QOSGraphEdgeOptions *opts, QI2CAddress *addr);
|
||||
|
||||
void i2c_send(QI2CDevice *dev, const uint8_t *buf, uint16_t len);
|
||||
void i2c_recv(QI2CDevice *dev, uint8_t *buf, uint16_t len);
|
||||
void qi2c_send(QI2CDevice *dev, const uint8_t *buf, uint16_t len);
|
||||
void qi2c_recv(QI2CDevice *dev, uint8_t *buf, uint16_t len);
|
||||
|
||||
void i2c_read_block(QI2CDevice *dev, uint8_t reg,
|
||||
uint8_t *buf, uint16_t len);
|
||||
|
@ -32,22 +32,22 @@ static void receive_autoinc(void *obj, void *data, QGuestAllocator *alloc)
|
||||
|
||||
pca9552_init(i2cdev);
|
||||
|
||||
i2c_send(i2cdev, ®, 1);
|
||||
qi2c_send(i2cdev, ®, 1);
|
||||
|
||||
/* PCA9552_LS0 */
|
||||
i2c_recv(i2cdev, &resp, 1);
|
||||
qi2c_recv(i2cdev, &resp, 1);
|
||||
g_assert_cmphex(resp, ==, 0x54);
|
||||
|
||||
/* PCA9552_LS1 */
|
||||
i2c_recv(i2cdev, &resp, 1);
|
||||
qi2c_recv(i2cdev, &resp, 1);
|
||||
g_assert_cmphex(resp, ==, 0x55);
|
||||
|
||||
/* PCA9552_LS2 */
|
||||
i2c_recv(i2cdev, &resp, 1);
|
||||
qi2c_recv(i2cdev, &resp, 1);
|
||||
g_assert_cmphex(resp, ==, 0x55);
|
||||
|
||||
/* PCA9552_LS3 */
|
||||
i2c_recv(i2cdev, &resp, 1);
|
||||
qi2c_recv(i2cdev, &resp, 1);
|
||||
g_assert_cmphex(resp, ==, 0x54);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user