]> git.proxmox.com Git - qemu.git/commitdiff
i2c: Drop I2C_SLAVE_FROM_QDEV() macro
authorAndreas Färber <afaerber@suse.de>
Fri, 25 Jan 2013 08:12:54 +0000 (09:12 +0100)
committerAnthony Liguori <aliguori@us.ibm.com>
Fri, 1 Feb 2013 16:43:24 +0000 (10:43 -0600)
It is not being used in hot paths and is obsoleted by I2C_SLAVE()
QOM cast macro. Clean it up using a scripted conversion, so that it
doesn't get used in new code.

Some of its callers were combining it with FROM_I2C_SLAVE() macro, which
is equally obsolete but needs to be replaced in a type-specific way.

Signed-off-by: Andreas Färber <afaerber@suse.de>
Cc: Kuo-Jung Su <dantesu@faraday-tech.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
hw/ds1338.c
hw/i2c.c
hw/i2c.h
hw/lm832x.c
hw/max7310.c
hw/pxa2xx.c
hw/wm8750.c

index 379220638e3e581c401cc72f81deda930b56e1f4..6f70538eb3018303fad1d7a4dd62d24b48c14a77 100644 (file)
@@ -198,7 +198,7 @@ static int ds1338_init(I2CSlave *i2c)
 
 static void ds1338_reset(DeviceState *dev)
 {
-    DS1338State *s = FROM_I2C_SLAVE(DS1338State, I2C_SLAVE_FROM_QDEV(dev));
+    DS1338State *s = FROM_I2C_SLAVE(DS1338State, I2C_SLAVE(dev));
 
     /* The clock is running and synchronized with the host */
     s->offset = 0;
index 119e96bc0e4d665e9902321fa75ec3d4ba3adc0e..ec314a40d1f2467f3f630c196094bd11bf730384 100644 (file)
--- a/hw/i2c.c
+++ b/hw/i2c.c
@@ -92,7 +92,7 @@ int i2c_start_transfer(i2c_bus *bus, uint8_t address, int recv)
 
     QTAILQ_FOREACH(kid, &bus->qbus.children, sibling) {
         DeviceState *qdev = kid->child;
-        I2CSlave *candidate = I2C_SLAVE_FROM_QDEV(qdev);
+        I2CSlave *candidate = I2C_SLAVE(qdev);
         if (candidate->address == address) {
             slave = candidate;
             break;
@@ -204,7 +204,7 @@ const VMStateDescription vmstate_i2c_slave = {
 
 static int i2c_slave_qdev_init(DeviceState *dev)
 {
-    I2CSlave *s = I2C_SLAVE_FROM_QDEV(dev);
+    I2CSlave *s = I2C_SLAVE(dev);
     I2CSlaveClass *sc = I2C_SLAVE_GET_CLASS(s);
 
     return sc->init(s);
index 883b5c588d251edfc3f0f6425b0ab1247f79d52e..0e80d5a9cbd25a394f30a99510d4da41447b0e08 100644 (file)
--- a/hw/i2c.h
+++ b/hw/i2c.h
@@ -59,7 +59,6 @@ void i2c_nack(i2c_bus *bus);
 int i2c_send(i2c_bus *bus, uint8_t data);
 int i2c_recv(i2c_bus *bus);
 
-#define I2C_SLAVE_FROM_QDEV(dev) DO_UPCAST(I2CSlave, qdev, dev)
 #define FROM_I2C_SLAVE(type, dev) DO_UPCAST(type, i2c, dev)
 
 DeviceState *i2c_create_slave(i2c_bus *bus, const char *name, uint8_t addr);
index af49dd68bfd1bf773faaee2b631a5cfcccdcbcf2..94b8ae06d8e0a37574f03b005f594fefc3d14850 100644 (file)
@@ -476,7 +476,7 @@ static int lm8323_init(I2CSlave *i2c)
 
 void lm832x_key_event(DeviceState *dev, int key, int state)
 {
-    LM823KbdState *s = FROM_I2C_SLAVE(LM823KbdState, I2C_SLAVE_FROM_QDEV(dev));
+    LM823KbdState *s = FROM_I2C_SLAVE(LM823KbdState, I2C_SLAVE(dev));
 
     if ((s->status & INT_ERROR) && (s->error & ERR_FIFOOVR))
         return;
index de2221ba0124dca4fb297b080b893805553af34f..c2df0b49ebb242b30dccf13c2796338f222d901f 100644 (file)
@@ -25,7 +25,7 @@ typedef struct {
 
 static void max7310_reset(DeviceState *dev)
 {
-    MAX7310State *s = FROM_I2C_SLAVE(MAX7310State, I2C_SLAVE_FROM_QDEV(dev));
+    MAX7310State *s = FROM_I2C_SLAVE(MAX7310State, I2C_SLAVE(dev));
     s->level &= s->direction;
     s->direction = 0xff;
     s->polarity = 0xf0;
index 2367c6a4a4d7107c8fce8487fd33d3688287cadc..373d0616ba09f5ddf0058909686758160e64de03 100644 (file)
@@ -1468,7 +1468,7 @@ PXA2xxI2CState *pxa2xx_i2c_init(hwaddr base,
     s = FROM_SYSBUS(PXA2xxI2CState, i2c_dev);
     /* FIXME: Should the slave device really be on a separate bus?  */
     dev = i2c_create_slave(i2c_init_bus(NULL, "dummy"), "pxa2xx-i2c-slave", 0);
-    s->slave = FROM_I2C_SLAVE(PXA2xxI2CSlaveState, I2C_SLAVE_FROM_QDEV(dev));
+    s->slave = FROM_I2C_SLAVE(PXA2xxI2CSlaveState, I2C_SLAVE(dev));
     s->slave->host = s;
 
     return s;
index bb85064c9b8ef3d7c8eed43ead9efd8d0fc433ac..d3ea5ba8f5fed427bb2d35414828254b121df449 100644 (file)
@@ -632,7 +632,7 @@ static void wm8750_fini(I2CSlave *i2c)
 void wm8750_data_req_set(DeviceState *dev,
                 void (*data_req)(void *, int, int), void *opaque)
 {
-    WM8750State *s = FROM_I2C_SLAVE(WM8750State, I2C_SLAVE_FROM_QDEV(dev));
+    WM8750State *s = FROM_I2C_SLAVE(WM8750State, I2C_SLAVE(dev));
     s->data_req = data_req;
     s->opaque = opaque;
 }