From patchwork Tue Feb 4 15:55:27 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Juan Quintela X-Patchwork-Id: 24147 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-pd0-f198.google.com (mail-pd0-f198.google.com [209.85.192.198]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 3504E202FA for ; Tue, 4 Feb 2014 20:46:15 +0000 (UTC) Received: by mail-pd0-f198.google.com with SMTP id v10sf21731959pde.5 for ; Tue, 04 Feb 2014 12:46:14 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:date :message-id:in-reply-to:references:cc:subject:precedence:list-id :list-unsubscribe:list-archive:list-post:list-help:list-subscribe :errors-to:sender:x-original-sender :x-original-authentication-results:mailing-list; bh=kTFBmleHz0ntgaG/mI2PDHHHymUSxlze1MWkI/iwKTg=; b=OHRKXxdNBVR3ZYfxG/ChhRakY41+1jFi044sqBO4+cvL2Gk10YczklUXeGqJVjDKDb oOzt35zlmM8BovtR/ssfHf8DHNinthEf8HAlzQBF5qScKQUACNgLFogkJpUYiZ+9dgeU 3LJUAp2iQEw4Wr67MbZUpHnvYixXdNxJJIuBFUb1ggspRDLaVN/ua8eJyl+GVcydGiFD OPDchiM+X+GKVu68fatuxO3htywfp0yVJ15mEojDQfpH+guO3zIR4jOKjUpvVanM8l2u xDQTmEDzqfvBUyudb9RTP9rGmLcpU8Y7fT8GooXxuJn+Yp1eG4dwAGPieKR3Ij2fpoBv 2FYQ== X-Gm-Message-State: ALoCoQmolb727QcfhEvQ3gpXrY9V/1hfmSmcHg5IwjTm6jUe0sKWT7d12GMrIzZiqJ4s5CxGgzLk X-Received: by 10.66.150.106 with SMTP id uh10mr16455015pab.13.1391546774397; Tue, 04 Feb 2014 12:46:14 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.27.239 with SMTP id 102ls2560545qgx.23.gmail; Tue, 04 Feb 2014 12:46:14 -0800 (PST) X-Received: by 10.220.106.84 with SMTP id w20mr34463640vco.18.1391546774272; Tue, 04 Feb 2014 12:46:14 -0800 (PST) Received: from mail-ve0-f180.google.com (mail-ve0-f180.google.com [209.85.128.180]) by mx.google.com with ESMTPS id x16si8720554vct.30.2014.02.04.12.46.14 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 04 Feb 2014 12:46:14 -0800 (PST) Received-SPF: neutral (google.com: 209.85.128.180 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.128.180; Received: by mail-ve0-f180.google.com with SMTP id db12so6293914veb.25 for ; Tue, 04 Feb 2014 12:46:14 -0800 (PST) X-Received: by 10.58.235.129 with SMTP id um1mr35319633vec.17.1391546774184; Tue, 04 Feb 2014 12:46:14 -0800 (PST) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.220.174.196 with SMTP id u4csp274003vcz; Tue, 4 Feb 2014 12:46:13 -0800 (PST) X-Received: by 10.224.70.84 with SMTP id c20mr69242313qaj.48.1391546773472; Tue, 04 Feb 2014 12:46:13 -0800 (PST) Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id t7si18735584qav.68.2014.02.04.12.46.13 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Tue, 04 Feb 2014 12:46:13 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) client-ip=2001:4830:134:3::11; Received: from localhost ([::1]:54031 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WAksj-0006Xd-4H for patch@linaro.org; Tue, 04 Feb 2014 13:38:01 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55369) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WAkrt-0005rf-Pw for qemu-devel@nongnu.org; Tue, 04 Feb 2014 13:37:14 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WAkro-0001ye-Vl for qemu-devel@nongnu.org; Tue, 04 Feb 2014 13:37:09 -0500 Received: from mx1.redhat.com ([209.132.183.28]:60186) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WAiLe-0002sz-3c for qemu-devel@nongnu.org; Tue, 04 Feb 2014 10:55:42 -0500 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s14FtcLp009022 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Tue, 4 Feb 2014 10:55:38 -0500 Received: from trasno.mitica (ovpn-113-124.phx2.redhat.com [10.3.113.124]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id s14FtYaA020346; Tue, 4 Feb 2014 10:55:37 -0500 From: Juan Quintela To: qemu-devel@nongnu.org Date: Tue, 4 Feb 2014 16:55:27 +0100 Message-Id: <1391529334-30526-2-git-send-email-quintela@redhat.com> In-Reply-To: <1391529334-30526-1-git-send-email-quintela@redhat.com> References: <1391529334-30526-1-git-send-email-quintela@redhat.com> X-Scanned-By: MIMEDefang 2.67 on 10.5.11.11 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: peter.maydell@linaro.org, anthony@codemonkey.ws Subject: [Qemu-devel] [PATCH 1/8] vmstate: Make VMSTATE_STRUCT_POINTER take type, not ptr-to-type 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: quintela@redhat.com X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.128.180 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 From: Peter Maydell The VMSTATE_STRUCT_POINTER macros are a bit odd in that they must be passed an argument "FooType *" rather than just taking the FooType. They're only used in one place, so it's easy to tidy this up. This also lets us use the macro to replace the hand-rolled VMSTATE_PTIMER. Signed-off-by: Peter Maydell Signed-off-by: Juan Quintela --- hw/arm/pxa2xx.c | 2 +- include/hw/ptimer.h | 10 ++-------- include/migration/vmstate.h | 8 ++++---- 3 files changed, 7 insertions(+), 13 deletions(-) diff --git a/hw/arm/pxa2xx.c b/hw/arm/pxa2xx.c index 02b7016..25ec549 100644 --- a/hw/arm/pxa2xx.c +++ b/hw/arm/pxa2xx.c @@ -1448,7 +1448,7 @@ static const VMStateDescription vmstate_pxa2xx_i2c = { VMSTATE_UINT8(ibmr, PXA2xxI2CState), VMSTATE_UINT8(data, PXA2xxI2CState), VMSTATE_STRUCT_POINTER(slave, PXA2xxI2CState, - vmstate_pxa2xx_i2c_slave, PXA2xxI2CSlaveState *), + vmstate_pxa2xx_i2c_slave, PXA2xxI2CSlaveState), VMSTATE_END_OF_LIST() } }; diff --git a/include/hw/ptimer.h b/include/hw/ptimer.h index a33edf4..8ebacbb 100644 --- a/include/hw/ptimer.h +++ b/include/hw/ptimer.h @@ -27,14 +27,8 @@ void ptimer_stop(ptimer_state *s); extern const VMStateDescription vmstate_ptimer; -#define VMSTATE_PTIMER(_field, _state) { \ - .name = (stringify(_field)), \ - .version_id = (1), \ - .vmsd = &vmstate_ptimer, \ - .size = sizeof(ptimer_state *), \ - .flags = VMS_STRUCT|VMS_POINTER, \ - .offset = vmstate_offset_pointer(_state, _field, ptimer_state), \ -} +#define VMSTATE_PTIMER(_field, _state) \ + VMSTATE_STRUCT_POINTER_V(_field, _state, 1, vmstate_ptimer, ptimer_state) #define VMSTATE_PTIMER_ARRAY(_f, _s, _n) \ VMSTATE_ARRAY_OF_POINTER_TO_STRUCT(_f, _s, _n, 0, \ diff --git a/include/migration/vmstate.h b/include/migration/vmstate.h index be193ba..fbd16a0 100644 --- a/include/migration/vmstate.h +++ b/include/migration/vmstate.h @@ -314,9 +314,9 @@ extern const VMStateInfo vmstate_info_bitmap; .name = (stringify(_field)), \ .version_id = (_version), \ .vmsd = &(_vmsd), \ - .size = sizeof(_type), \ + .size = sizeof(_type *), \ .flags = VMS_STRUCT|VMS_POINTER, \ - .offset = vmstate_offset_value(_state, _field, _type), \ + .offset = vmstate_offset_pointer(_state, _field, _type), \ } #define VMSTATE_STRUCT_POINTER_TEST_V(_field, _state, _test, _version, _vmsd, _type) { \ @@ -324,9 +324,9 @@ extern const VMStateInfo vmstate_info_bitmap; .version_id = (_version), \ .field_exists = (_test), \ .vmsd = &(_vmsd), \ - .size = sizeof(_type), \ + .size = sizeof(_type *), \ .flags = VMS_STRUCT|VMS_POINTER, \ - .offset = vmstate_offset_value(_state, _field, _type), \ + .offset = vmstate_offset_pointer(_state, _field, _type), \ } #define VMSTATE_ARRAY_OF_POINTER(_field, _state, _num, _version, _info, _type) {\