From nobody Mon Feb 9 10:29:39 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1543264847281250.78178184043554; Mon, 26 Nov 2018 12:40:47 -0800 (PST) Received: from localhost ([::1]:38774 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gRNgT-0001DZ-N1 for importer@patchew.org; Mon, 26 Nov 2018 15:40:45 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55385) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gRNE4-0007Vs-LD for qemu-devel@nongnu.org; Mon, 26 Nov 2018 15:11:26 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gRNE0-0002kA-Ne for qemu-devel@nongnu.org; Mon, 26 Nov 2018 15:11:24 -0500 Received: from mail-ot1-x342.google.com ([2607:f8b0:4864:20::342]:43052) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gRNE0-0002k2-DV for qemu-devel@nongnu.org; Mon, 26 Nov 2018 15:11:20 -0500 Received: by mail-ot1-x342.google.com with SMTP id a11so17858431otr.10 for ; Mon, 26 Nov 2018 12:11:20 -0800 (PST) Received: from serve.minyard.net ([47.184.128.64]) by smtp.gmail.com with ESMTPSA id 21sm405168oie.24.2018.11.26.12.11.17 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 26 Nov 2018 12:11:17 -0800 (PST) Received: from t430.minyard.net (t430m.minyard.net [192.168.27.3]) by serve.minyard.net (Postfix) with ESMTPA id 128381F90; Mon, 26 Nov 2018 14:04:50 -0600 (CST) Received: by t430.minyard.net (Postfix, from userid 1000) id F0F04301471; Mon, 26 Nov 2018 14:04:46 -0600 (CST) 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=Yw6EKNcC1y/dHBmPzkzOpSFON0gZns1Zjs8Jkp8E5Hk=; b=gYYSGioNLAfV30Y2ftIBmNo2jbtqcvVW09U4RgXLikkqzR5nfMhgQgs9EguwBJXSKX ufAaB+JW1puRXHk2ABOLMpLQsnKRVcJEsSjvxcZPxoPGm25vS8wfBRzT/vg77J7qZF9p 1Gdn55QsWedSHjDET0OE9v/MpWhZjZeM1fCwBI++b1bOoa/gc0lmUPXn4TYvk1b91g7U lq0muRkeR20gTjbeZaXbyIBZuL+9SDE9ZZUJ+IPf4Tl8SBCneDbUHslS5DBLyxWpKdoM W0dbA3tY2K1knzGJKLi9mfQnz1IdyNhzwLbd6iGw0e/AXVz9320GZV9xY3FYIiS7r3R3 O+9Q== 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=Yw6EKNcC1y/dHBmPzkzOpSFON0gZns1Zjs8Jkp8E5Hk=; b=KXfXu9DxgyN8ZYOTUEtrhOscC1wQ4owBWHe69OxRv6M6lzesSH4Y4pbXW0m65YQJlt AssyuDup7NI782/8z/bagdoERfhaC9zmtcL97cek18wlX61LFbHgXVSb6WtRkbYCrFVp S8vRGeEdlV0xLYB+LDKyXkd67pHT4BlBUj/XKwkt6gmWJ1riEPER/bmkX9DfBd47oicU 44nHWhQ9vsg+/0XULNE0jXjDImuUR2MoNdSN2ZDyDR06v0gsujoKoRM+ktf+u3MbndNK cip4n01PoHeoeqaPPZqiwHwr8HdsUMqYYznXPkRMMA6WT9z7b+XTE2ODXjN8hD1/FGi0 DvNw== X-Gm-Message-State: AA+aEWaT42wvvcPsAW2bdbD8IrAxIp7lMdOoAH0OKsnbEUI7AaCBYoXN Ns+UVEZsPCHhNp1n3ZzIfA== X-Google-Smtp-Source: AFSGD/Xt/nd07Pofy8N/8vvmdaBZYDKuuOmIY5ya7gemJ59Sqe+n9PAosiUBor/cVJ52ziHX7MrmOg== X-Received: by 2002:a9d:4b17:: with SMTP id q23mr16833166otf.121.1543263078758; Mon, 26 Nov 2018 12:11:18 -0800 (PST) From: minyard@acm.org To: qemu-devel@nongnu.org, "Dr . David Alan Gilbert" , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Peter Maydell Date: Mon, 26 Nov 2018 14:04:35 -0600 Message-Id: <20181126200435.23408-17-minyard@acm.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181126200435.23408-1-minyard@acm.org> References: <20181126200435.23408-1-minyard@acm.org> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::342 Subject: [Qemu-devel] [PATCH v3 16/16] i2c:smbus_eeprom: Add a reset function to 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: Paolo Bonzini , Corey Minyard , Corey Minyard , "Michael S . Tsirkin" Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Corey Minyard Reset the contents to init data and reset the offset on a machine reset. Signed-off-by: Corey Minyard Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- hw/i2c/smbus_eeprom.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/hw/i2c/smbus_eeprom.c b/hw/i2c/smbus_eeprom.c index a0dcadbd60..de3a492df4 100644 --- a/hw/i2c/smbus_eeprom.c +++ b/hw/i2c/smbus_eeprom.c @@ -107,7 +107,7 @@ static const VMStateDescription vmstate_smbus_eeprom = =3D { } }; =20 -static void smbus_eeprom_realize(DeviceState *dev, Error **errp) +static void smbus_eeprom_reset(DeviceState *dev) { SMBusEEPROMDevice *eeprom =3D SMBUS_EEPROM(dev); =20 @@ -115,6 +115,11 @@ static void smbus_eeprom_realize(DeviceState *dev, Err= or **errp) eeprom->offset =3D 0; } =20 +static void smbus_eeprom_realize(DeviceState *dev, Error **errp) +{ + smbus_eeprom_reset(dev); +} + static Property smbus_eeprom_properties[] =3D { DEFINE_PROP_PTR("data", SMBusEEPROMDevice, init_data), DEFINE_PROP_END_OF_LIST(), @@ -126,6 +131,7 @@ static void smbus_eeprom_class_initfn(ObjectClass *klas= s, void *data) SMBusDeviceClass *sc =3D SMBUS_DEVICE_CLASS(klass); =20 dc->realize =3D smbus_eeprom_realize; + dc->reset =3D smbus_eeprom_reset; sc->receive_byte =3D eeprom_receive_byte; sc->write_data =3D eeprom_write_data; dc->props =3D smbus_eeprom_properties; --=20 2.17.1