From patchwork Tue Feb 4 15:19:38 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Juan Quintela X-Patchwork-Id: 24107 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ob0-f197.google.com (mail-ob0-f197.google.com [209.85.214.197]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 5B72A202FA for ; Tue, 4 Feb 2014 15:39:47 +0000 (UTC) Received: by mail-ob0-f197.google.com with SMTP id gq1sf34947367obb.4 for ; Tue, 04 Feb 2014 07:39:46 -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=ezNCVA4YbWlGwA8+HT6Jb9F4kBMp/yyZLfZ8jzazgaBrM3A8bWqNg9C0TfnLiw0TVS 6O8mXyN+IvWfeYO9fupRqJ/nesRfau7VkqjdN3xCkD+LoDovWX2VAomaihYKKvsf/C+D Vf+LDcVAMxgN+wFogTUzBC4uRNrx09r0mIT+5ySX7pK+X9XxKOt6BacU34XO9Z0tWiLX 56+mCk/aY1TgTKkZwwZj0a6QP4ufiJcjJqwsKb28948W8ecmweiwMCiMeljfiwzkgDdm ow104qzcV7NkyzJ0TTTWUgxRg3rJbR4fT7R799ltfqED/yfejLVPuYY6KIetIfN3JhC6 adbA== X-Gm-Message-State: ALoCoQlYSI8r05lfEjlLWt+gIYTpByguW3l6nFp0oPr1MOrB2qzYsS43FBPUUKg4vpaVyYafRsEv X-Received: by 10.182.66.193 with SMTP id h1mr4502683obt.47.1391528386234; Tue, 04 Feb 2014 07:39:46 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.109.101 with SMTP id k92ls57029qgf.78.gmail; Tue, 04 Feb 2014 07:39:46 -0800 (PST) X-Received: by 10.220.103.141 with SMTP id k13mr6454605vco.25.1391528386119; Tue, 04 Feb 2014 07:39:46 -0800 (PST) Received: from mail-vc0-f176.google.com (mail-vc0-f176.google.com [209.85.220.176]) by mx.google.com with ESMTPS id ny8si1024053vcb.144.2014.02.04.07.39.46 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 04 Feb 2014 07:39:46 -0800 (PST) Received-SPF: neutral (google.com: 209.85.220.176 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.176; Received: by mail-vc0-f176.google.com with SMTP id la4so5931454vcb.35 for ; Tue, 04 Feb 2014 07:39:46 -0800 (PST) X-Received: by 10.52.251.232 with SMTP id zn8mr581466vdc.41.1391528386040; Tue, 04 Feb 2014 07:39:46 -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 u4csp243903vcz; Tue, 4 Feb 2014 07:39:45 -0800 (PST) X-Received: by 10.140.94.214 with SMTP id g80mr64092929qge.19.1391528385249; Tue, 04 Feb 2014 07:39:45 -0800 (PST) Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id z7si7889975qcg.65.2014.02.04.07.39.45 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Tue, 04 Feb 2014 07:39:45 -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]:53080 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WAi6C-0000sA-RQ for patch@linaro.org; Tue, 04 Feb 2014 10:39:44 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40256) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WAi57-0001xX-3Y for qemu-devel@nongnu.org; Tue, 04 Feb 2014 10:38:53 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WAhn0-0000XO-5l for qemu-devel@nongnu.org; Tue, 04 Feb 2014 10:20:32 -0500 Received: from mx1.redhat.com ([209.132.183.28]:41968) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WAhmz-0000XC-U3 for qemu-devel@nongnu.org; Tue, 04 Feb 2014 10:19:54 -0500 Received: from int-mx12.intmail.prod.int.phx2.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.25]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s14FJnfw022523 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Tue, 4 Feb 2014 10:19:50 -0500 Received: from trasno.mitica (ovpn-113-124.phx2.redhat.com [10.3.113.124]) by int-mx12.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id s14FJjDf022682; Tue, 4 Feb 2014 10:19:47 -0500 From: Juan Quintela To: qemu-devel@nongnu.org Date: Tue, 4 Feb 2014 16:19:38 +0100 Message-Id: <1391527185-28349-2-git-send-email-quintela@redhat.com> In-Reply-To: <1391527185-28349-1-git-send-email-quintela@redhat.com> References: <1391527185-28349-1-git-send-email-quintela@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.25 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: Peter Maydell , 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.220.176 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) {\