From patchwork Wed Jan 1 21:56:57 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 22853 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-pb0-f71.google.com (mail-pb0-f71.google.com [209.85.160.71]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 85869218DC for ; Wed, 1 Jan 2014 21:57:02 +0000 (UTC) Received: by mail-pb0-f71.google.com with SMTP id uo5sf42666150pbc.10 for ; Wed, 01 Jan 2014 13:57:01 -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:cc:subject :date:message-id:x-original-sender:x-original-authentication-results :precedence:mailing-list:list-id:list-post:list-help:list-archive :list-unsubscribe; bh=G5TVnOwGvs1mE331Xt5vWZ7H7A69TGs3AAG4EoAkTQo=; b=PiYBbHlfVNTjQ6BBI6rLyiSBc2BIyH12Oz03Kg4nyLCqOAGqh8wefZJURntzRNCJw6 jLzzHbNgxLNCRCKxC+4hQX2u6DCcHNA0VolBRTo4c+ARO1iaJVKRaFAqO+W+XV0Yo1Fh z05GIIFJsWbU76HS9Z3k1AqE7TOaGM5Y+ekc9sdM0dqUaRyl2RzQyzjCbGAxiwXgw3S3 F+DbNfmxMi0Q79v4eb3ihEsBhu93vW7NtBvtfDLOO/QBh6Y74aJKSv7e3TgTeJvqZ2a9 YM93wCwOAIvp7SBtkbt6klHIaxlDG1h4Zd6jZL6MHqjHhBnmFWI/fZ1DwTXenoJFbNkm svmA== X-Gm-Message-State: ALoCoQmfbciEcA/L+pNzgubbVlRzuqvvXY8wKVzkOqUcA8ocxhfQOn5C/L5qWKqnX0Z7+mBw5P5c X-Received: by 10.66.231.74 with SMTP id te10mr36384065pac.16.1388613421502; Wed, 01 Jan 2014 13:57:01 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.37.163 with SMTP id z3ls4335570qej.1.gmail; Wed, 01 Jan 2014 13:57:01 -0800 (PST) X-Received: by 10.58.133.137 with SMTP id pc9mr49375veb.53.1388613421329; Wed, 01 Jan 2014 13:57:01 -0800 (PST) Received: from mail-vc0-f170.google.com (mail-vc0-f170.google.com [209.85.220.170]) by mx.google.com with ESMTPS id ef6si21458396ved.123.2014.01.01.13.57.01 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 01 Jan 2014 13:57:01 -0800 (PST) Received-SPF: neutral (google.com: 209.85.220.170 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.220.170; Received: by mail-vc0-f170.google.com with SMTP id la4so7051325vcb.1 for ; Wed, 01 Jan 2014 13:57:01 -0800 (PST) X-Received: by 10.221.19.71 with SMTP id qj7mr52841vcb.49.1388613420977; Wed, 01 Jan 2014 13:57:00 -0800 (PST) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.59.13.131 with SMTP id ey3csp739472ved; Wed, 1 Jan 2014 13:57:00 -0800 (PST) X-Received: by 10.180.106.134 with SMTP id gu6mr51960971wib.31.1388613420054; Wed, 01 Jan 2014 13:57:00 -0800 (PST) Received: from mnementh.archaic.org.uk (mnementh.archaic.org.uk. [2001:8b0:1d0::1]) by mx.google.com with ESMTPS id uk10si20388622wjc.165.2014.01.01.13.56.58 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Wed, 01 Jan 2014 13:56:59 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of pm215@archaic.org.uk designates 2001:8b0:1d0::1 as permitted sender) client-ip=2001:8b0:1d0::1; Received: from pm215 by mnementh.archaic.org.uk with local (Exim 4.80) (envelope-from ) id 1VyTmb-0001U3-Kq; Wed, 01 Jan 2014 21:56:57 +0000 From: Peter Maydell To: qemu-devel@nongnu.org Cc: patches@linaro.org, Juan Quintela Subject: [PATCH] vmstate: Make VMSTATE_STRUCT_POINTER take type, not ptr-to-type Date: Wed, 1 Jan 2014 21:56:57 +0000 Message-Id: <1388613417-5678-1-git-send-email-peter.maydell@linaro.org> X-Mailer: git-send-email 1.7.10.4 X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: peter.maydell@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.220.170 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 Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , 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 --- Juan: would you be willing to add an entry to MAINTAINERS for the migration code? I keep having to look your email address up in the git history :-) 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) {\