From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MXzaJ-0002bK-5M for qemu-devel@nongnu.org; Mon, 03 Aug 2009 11:36:23 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MXza0-0002AA-53 for qemu-devel@nongnu.org; Mon, 03 Aug 2009 11:36:10 -0400 Received: from [199.232.76.173] (port=39453 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MXzZz-00029O-P0 for qemu-devel@nongnu.org; Mon, 03 Aug 2009 11:36:03 -0400 Received: from mx2.redhat.com ([66.187.237.31]:42786) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1MXzZz-0004g4-A8 for qemu-devel@nongnu.org; Mon, 03 Aug 2009 11:36:03 -0400 Received: from int-mx2.corp.redhat.com (int-mx2.corp.redhat.com [172.16.27.26]) by mx2.redhat.com (8.13.8/8.13.8) with ESMTP id n73Fa2p0001540 for ; Mon, 3 Aug 2009 11:36:02 -0400 From: Gerd Hoffmann Date: Mon, 3 Aug 2009 17:35:33 +0200 Message-Id: <1249313748-6459-18-git-send-email-kraxel@redhat.com> In-Reply-To: <1249313748-6459-1-git-send-email-kraxel@redhat.com> References: <1249313748-6459-1-git-send-email-kraxel@redhat.com> Subject: [Qemu-devel] [PATCH 17/32] qdev/prop: convert smbus_eeprom.c to helper macros. List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Gerd Hoffmann Signed-off-by: Gerd Hoffmann --- hw/smbus_eeprom.c | 13 +++++-------- 1 files changed, 5 insertions(+), 8 deletions(-) diff --git a/hw/smbus_eeprom.c b/hw/smbus_eeprom.c index c071fb1..9785cc2 100644 --- a/hw/smbus_eeprom.c +++ b/hw/smbus_eeprom.c @@ -30,7 +30,7 @@ typedef struct SMBusEEPROMDevice { SMBusDevice smbusdev; - uint8_t *data; + void *data; uint8_t offset; } SMBusEEPROMDevice; @@ -54,7 +54,8 @@ static void eeprom_send_byte(SMBusDevice *dev, uint8_t val) static uint8_t eeprom_receive_byte(SMBusDevice *dev) { SMBusEEPROMDevice *eeprom = (SMBusEEPROMDevice *) dev; - uint8_t val = eeprom->data[eeprom->offset++]; + uint8_t *data = eeprom->data; + uint8_t val = data[eeprom->offset++]; #ifdef DEBUG printf("eeprom_receive_byte: addr=0x%02x val=0x%02x\n", dev->i2c.address, val); @@ -106,12 +107,8 @@ static SMBusDeviceInfo smbus_eeprom_info = { .i2c.qdev.name = "smbus-eeprom", .i2c.qdev.size = sizeof(SMBusEEPROMDevice), .i2c.qdev.props = (Property[]) { - { - .name = "data", - .info = &qdev_prop_ptr, - .offset = offsetof(SMBusEEPROMDevice, data), - }, - {/* end of list */} + DEFINE_PROP_PTR("data", SMBusEEPROMDevice, data), + DEFINE_PROP_END_OF_LIST(), }, .init = smbus_eeprom_init, .quick_cmd = eeprom_quick_cmd, -- 1.6.2.5