From patchwork Mon Aug 20 20:26:10 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Corey Minyard X-Patchwork-Id: 144663 Delivered-To: patch@linaro.org Received: by 2002:a2e:9754:0:0:0:0:0 with SMTP id f20-v6csp4412919ljj; Mon, 20 Aug 2018 13:34:27 -0700 (PDT) X-Google-Smtp-Source: AA+uWPwT5cIW+S8Onl8JblfMzfqm+1OofNG0jU8y/drLdpgKVK3DwU32xOUbglA0zRZ9L0kyolcy X-Received: by 2002:a37:c0d3:: with SMTP id v80-v6mr14378958qkv.256.1534797267720; Mon, 20 Aug 2018 13:34:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1534797267; cv=none; d=google.com; s=arc-20160816; b=UiKxAckXi0EU49NkYxv7pre8YPo4P3biEu7Z0oy/aibw3w5V3AvAJZDlkYnzWoiiSF HVDD5L98vyQwEs5Tvw/7qpHMHIaMDNex1qIbgMptfUxh9t+gOwNBxcDgEJQ7BVZHtn37 /6LudP7capWqDC+YIFg4AzMyMDaaPUgg3k0s7t1mdSUYwB5vVxQKZsEpIWII/XKYKvE+ YoHQIbCqudLjF7EAPOa9dQXTiVOc6d6W4QAnvHSBahLaGgOkbmonlAYnSHqYFrqKHJE1 15PW+qmLFwCGb76aCDjBRiZvmkswGAmngachJPH/u3aADsuyO4cyZHUrKAykVnAoU0S3 GWdQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject:references:in-reply-to :message-id:date:to:from:dkim-signature:arc-authentication-results; bh=j+Yp0UZkajf5t3AswMPnhMvJanDi0W7vrct2f1lQk/o=; b=wtTn6ZCfACyh3Bcoxq1lCM/suMXlmTWG0gjdE9mRW7+TFOsU3wkPbpuc5DEr1IW20y FoFVPKoXRNscgFIlpQU4oEkycsjYBFA1x32DVzexLKUCSLNoE4m2dDV8CBiRksO8rEIl o74SBWGj1GhMpGZ9mNCF3LvVVAvYKboBl+pfgyk4HwBqLTS81XrjdBJqrgLHCBELfdq7 wCFPuSGx1jgSvXhYzo1IrusAVHyp5Z2gQ+Sd8tupYC2vcO0k57fjGjKPzLcQE4O/eq5s Md1Fwd+wcLVRsccLD4x25UjrrnmLGSsHSbC8Vs/DYn2ekMxrWg6+nfMEkqwHNr+xKG/1 Sf7w== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=EVND+yG0; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org" Return-Path: Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id l25-v6si4125912qtn.267.2018.08.20.13.34.27 for (version=TLS1 cipher=AES128-SHA bits=128/128); Mon, 20 Aug 2018 13:34:27 -0700 (PDT) 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; Authentication-Results: mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=EVND+yG0; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org" Received: from localhost ([::1]:49164 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1frqsd-0007Z8-3A for patch@linaro.org; Mon, 20 Aug 2018 16:34:27 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51618) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1frqlF-0002rL-1n for qemu-devel@nongnu.org; Mon, 20 Aug 2018 16:26:58 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1frql2-0002WO-BI for qemu-devel@nongnu.org; Mon, 20 Aug 2018 16:26:46 -0400 Received: from mail-oi0-x244.google.com ([2607:f8b0:4003:c06::244]:43036) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1frqkw-0002Km-R7 for qemu-devel@nongnu.org; Mon, 20 Aug 2018 16:26:32 -0400 Received: by mail-oi0-x244.google.com with SMTP id b15-v6so28119896oib.10 for ; Mon, 20 Aug 2018 13:26:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=j+Yp0UZkajf5t3AswMPnhMvJanDi0W7vrct2f1lQk/o=; b=EVND+yG09g50NpeKjLTHIc6nbpBWuwmAoq4K/Rwsg32I690+StXFhFahg4/78zYop/ 0gY1MeSHXl0nCntwxC5Nzqk350haG7wLIOlh8Jqu2P4vQsInhc+xB252Je/ekpEBpwrG xle7u/s9F/PqsiRcxLTO10DwfgKrgRDPGnoUxL+BfHqIop1GX/J6B9D0F37LlX30GJDC eeaGtdTEcVLYvyXPdurIDijGULltvBYvnoz8WF+G9+expKv3lSx00thufbIBxt3zucY6 W3CFdXnv6H9Xaa/GhifX+a/1z3FGDTNl1PKP+X7o2a4HWKTIHdnOv4D38pF5+GviDrns +tHA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=j+Yp0UZkajf5t3AswMPnhMvJanDi0W7vrct2f1lQk/o=; b=XlMJPDrOzgRX4s17tOQPmLFzDs5yi+JGKVMfPH3bs2NjGykQ+AJb5wYrfML2XqnBYD hYfCQSnRQ7N3N3DCS+aW2l+1NGbCw9a01EXovmG8g2nBPlKDDH4tNabIPRVf8Z23NzT3 yMHPNyDw4baC0A9nQmZZosaX9/VXGPk+o+4pAdYAUqfXdSpK2Vl+sLHUlQLkvXsS6KAj zwJq1u0kfIyJrKCLUWBDElXGDYoI8LniYqEmMZYfxnjclPvbXXxcBYUUVXKarCR5yC9N X5JpDQfoOBgq/HSY+sVUD/xW0tupsd5hFNwHY+7u2UIFq52qN15CVyAPzcAEcR+OPR4o NLHQ== X-Gm-Message-State: AOUpUlHZZThe1PmTVg1t3bZbiT6Ac3/TDDHCNM/2i+njFVGx96qXYBGF PEXjZVGck/aYN9xf54kx7A== X-Received: by 2002:aca:b885:: with SMTP id i127-v6mr15817630oif.180.1534796789861; Mon, 20 Aug 2018 13:26:29 -0700 (PDT) Received: from serve.minyard.net ([47.184.170.128]) by smtp.gmail.com with ESMTPSA id 16-v6sm7205849oin.5.2018.08.20.13.26.27 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 20 Aug 2018 13:26:28 -0700 (PDT) Received: from t430.minyard.net (unknown [IPv6:2001:470:b8f6:1b:7d98:76b7:e7fd:495f]) by serve.minyard.net (Postfix) with ESMTPA id D4C2B1453; Mon, 20 Aug 2018 15:26:24 -0500 (CDT) Received: by t430.minyard.net (Postfix, from userid 1000) id 2E88030010D; Mon, 20 Aug 2018 15:26:22 -0500 (CDT) From: minyard@acm.org To: Paolo Bonzini , qemu-devel@nongnu.org Date: Mon, 20 Aug 2018 15:26:10 -0500 Message-Id: <1534796770-10295-11-git-send-email-minyard@acm.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1534796770-10295-1-git-send-email-minyard@acm.org> References: <1534796770-10295-1-git-send-email-minyard@acm.org> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4003:c06::244 Subject: [Qemu-devel] [PATCH v2 10/10] i2c: Add vmstate handling to the smbus eeprom X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Corey Minyard , "Dr . David Alan Gilbert" , "Michael S . Tsirkin" Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Corey Minyard Signed-off-by: Corey Minyard Cc: Paolo Bonzini Cc: "Michael S . Tsirkin" Cc: Dr. David Alan Gilbert --- hw/i2c/smbus_eeprom.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) -- 2.7.4 diff --git a/hw/i2c/smbus_eeprom.c b/hw/i2c/smbus_eeprom.c index f18aa3d..d4430b0 100644 --- a/hw/i2c/smbus_eeprom.c +++ b/hw/i2c/smbus_eeprom.c @@ -29,6 +29,8 @@ //#define DEBUG +#define TYPE_SMBUS_EEPROM_DEVICE "smbus-eeprom" + typedef struct SMBusEEPROMDevice { SMBusDevice smbusdev; void *data; @@ -97,6 +99,17 @@ static uint8_t eeprom_read_data(SMBusDevice *dev, uint8_t cmd, int n) return eeprom_receive_byte(dev); } +static const VMStateDescription vmstate_smbus_eeprom = { + .name = TYPE_SMBUS_EEPROM_DEVICE, + .version_id = 1, + .minimum_version_id = 1, + .fields = (VMStateField[]) { + VMSTATE_SMBUS_DEVICE(smbusdev, SMBusEEPROMDevice), + VMSTATE_UINT8(offset, SMBusEEPROMDevice), + VMSTATE_END_OF_LIST() + } +}; + static void smbus_eeprom_realize(DeviceState *dev, Error **errp) { SMBusEEPROMDevice *eeprom = (SMBusEEPROMDevice *)dev; @@ -121,12 +134,13 @@ static void smbus_eeprom_class_initfn(ObjectClass *klass, void *data) sc->write_data = eeprom_write_data; sc->read_data = eeprom_read_data; dc->props = smbus_eeprom_properties; + dc->vmsd = &vmstate_smbus_eeprom; /* Reason: pointer property "data" */ dc->user_creatable = false; } static const TypeInfo smbus_eeprom_info = { - .name = "smbus-eeprom", + .name = TYPE_SMBUS_EEPROM_DEVICE, .parent = TYPE_SMBUS_DEVICE, .instance_size = sizeof(SMBusEEPROMDevice), .class_init = smbus_eeprom_class_initfn,