From patchwork Fri Jan 25 08:12:54 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Andreas_F=C3=A4rber?= X-Patchwork-Id: 215572 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 5FE8C2C008E for ; Fri, 25 Jan 2013 19:13:24 +1100 (EST) Received: from localhost ([::1]:39663 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TyePa-0000Is-FB for incoming@patchwork.ozlabs.org; Fri, 25 Jan 2013 03:13:22 -0500 Received: from eggs.gnu.org ([208.118.235.92]:42779) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TyePQ-0000HV-4F for qemu-devel@nongnu.org; Fri, 25 Jan 2013 03:13:15 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TyePK-0005k8-Qg for qemu-devel@nongnu.org; Fri, 25 Jan 2013 03:13:12 -0500 Received: from cantor2.suse.de ([195.135.220.15]:49379 helo=mx2.suse.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TyePK-0005k1-H8 for qemu-devel@nongnu.org; Fri, 25 Jan 2013 03:13:06 -0500 Received: from relay1.suse.de (unknown [195.135.220.254]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx2.suse.de (Postfix) with ESMTP id 9A4C3A4E82; Fri, 25 Jan 2013 09:13:02 +0100 (CET) From: =?UTF-8?q?Andreas=20F=C3=A4rber?= To: qemu-devel@nongnu.org Date: Fri, 25 Jan 2013 09:12:54 +0100 Message-Id: <1359101574-7025-1-git-send-email-afaerber@suse.de> X-Mailer: git-send-email 1.7.10.4 MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x X-Received-From: 195.135.220.15 Cc: =?UTF-8?q?Andreas=20F=C3=A4rber?= , anthony@codemonkey.ws, Kuo-Jung Su Subject: [Qemu-devel] [PATCH for-1.4?] i2c: Drop I2C_SLAVE_FROM_QDEV() macro X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org 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 Cc: Kuo-Jung Su --- hw/ds1338.c | 2 +- hw/i2c.c | 4 ++-- hw/i2c.h | 1 - hw/lm832x.c | 2 +- hw/max7310.c | 2 +- hw/pxa2xx.c | 2 +- hw/wm8750.c | 2 +- 7 Dateien geändert, 7 Zeilen hinzugefügt(+), 8 Zeilen entfernt(-) diff --git a/hw/ds1338.c b/hw/ds1338.c index 3792206..6f70538 100644 --- a/hw/ds1338.c +++ b/hw/ds1338.c @@ -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; diff --git a/hw/i2c.c b/hw/i2c.c index 119e96b..ec314a4 100644 --- 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); diff --git a/hw/i2c.h b/hw/i2c.h index 883b5c5..0e80d5a 100644 --- 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); diff --git a/hw/lm832x.c b/hw/lm832x.c index af49dd6..94b8ae0 100644 --- a/hw/lm832x.c +++ b/hw/lm832x.c @@ -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; diff --git a/hw/max7310.c b/hw/max7310.c index de2221b..c2df0b4 100644 --- a/hw/max7310.c +++ b/hw/max7310.c @@ -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; diff --git a/hw/pxa2xx.c b/hw/pxa2xx.c index 2367c6a..373d061 100644 --- a/hw/pxa2xx.c +++ b/hw/pxa2xx.c @@ -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; diff --git a/hw/wm8750.c b/hw/wm8750.c index bb85064..d3ea5ba 100644 --- a/hw/wm8750.c +++ b/hw/wm8750.c @@ -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; }