From nobody Sat Feb 7 07:11:52 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1579540716; cv=none; d=zohomail.com; s=zohoarc; b=MXBYv0/7ILKaVZGOiMK7Uj7CveYO/7xLi7OgxqLD666CX5eax1wP/LuAUlV+xfNKlvx7KOwmrfuCkYwuk6VGd/xwEym03lny87UWWjnJrGxZ7z58bgG+6sovgx47PdF2bOyWQblkEpsiiRgMW3lPri1GTkLG97kbMHbEGs8lE9I= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1579540716; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=xXgs8aTcQ0uGhBK5sC1zXETwAujk79dljWd/Jt9xxR0=; b=AnK9nRl4ULFwq9Yr8peX+7PYw+fimaJ+Co+650Op4ZW3l4oKYoHNMZ2Xw3ZjT8o9vWiNhEJ3TvdTipOXekdptA96G+qtrQNQsuJQ3vv5FTwndmlb66IYtnbENotuCP9RejLIYvq75mPjXe7hE0vfTBs+VdyY2NEg2IZk4qxcCYY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1579540716556351.0244462696206; Mon, 20 Jan 2020 09:18:36 -0800 (PST) Received: from localhost ([::1]:40434 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1itah8-0000mm-Vj for importer@patchew.org; Mon, 20 Jan 2020 12:18:35 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:36353) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1itaWV-0005rA-Lk for qemu-devel@nongnu.org; Mon, 20 Jan 2020 12:07:36 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1itaWU-0001gx-GL for qemu-devel@nongnu.org; Mon, 20 Jan 2020 12:07:35 -0500 Received: from mail-ot1-x32d.google.com ([2607:f8b0:4864:20::32d]:39485) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1itaWU-0001gJ-BE for qemu-devel@nongnu.org; Mon, 20 Jan 2020 12:07:34 -0500 Received: by mail-ot1-x32d.google.com with SMTP id 77so379028oty.6 for ; Mon, 20 Jan 2020 09:07:33 -0800 (PST) Received: from serve.minyard.net ([47.184.136.59]) by smtp.gmail.com with ESMTPSA id k17sm2597801otl.45.2020.01.20.09.07.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 Jan 2020 09:07:32 -0800 (PST) Received: from t560.minyard.net (unknown [IPv6:2001:470:b8f6:1b:9c9c:d583:ce3d:f87a]) by serve.minyard.net (Postfix) with ESMTPA id 7D0BD180052; Mon, 20 Jan 2020 17:07:31 +0000 (UTC) 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 :mime-version:content-transfer-encoding; bh=xXgs8aTcQ0uGhBK5sC1zXETwAujk79dljWd/Jt9xxR0=; b=uOnCvRWGs6oeu3Jde/XWJaqb20pytL83RVdKJkXyvT73RioKMb45nZk19MqvvYezIc WlgP1atkjvsK44HjXqTarZv2hpwZd9XH0x8WsnNY7BrZzZUaPN2JXMoB2TSc8esmDJXU ntf31FQpKGfe2F1DXaSEdP/RZ+Hajtw1bhUKZICi3u/rithZNUkXJHoWj/nxPAq/mrrX twbDoi6Xb0gVXuzbaoAytHm6BrUG4ROjAIos5Vpx5dyajmK11ljo8dG3sILR5SxtlkXR cvasqKx8HcYRMV/J8zmkkEQPVxulyzraXZNVd35JfdTopeIZPQQcmxNQA7oTbwoTZNK0 TXYw== 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:mime-version:content-transfer-encoding; bh=xXgs8aTcQ0uGhBK5sC1zXETwAujk79dljWd/Jt9xxR0=; b=XOPM4orJMPrGi2fZpCPgj+N9u/5zsenFga7NeAf4RSW3ZRAsJemrAJqbHnDHHzNhhv SZwhkQ9YTFaDo57RJpsEsuPU6X7LjQ1J1hBqfaSuUR/f12k4qIn5n2nRAEPy1rS7Xk65 e8sJqtz1IVkEz1XUZvPWoSTMt0D2h4eDFmLNKXgt14Bx3iahudCV0JFhs21Q4BB5GW6e AtY9ep8b+vc+096AIiI0AFWWCqiw/oV8ef+e6RcESFOU6g0XQfqQLdm8Ryfn5V7N/Gwt XrxAf2s73wdgvAHsaXsTBdZs2XLbiO5GyVEUBR50Msk5yKAwD+zVZVYbhxn7Ovl6nMtO ho6g== X-Gm-Message-State: APjAAAUgKAmY+qQ3qrBNpU4ZboIZVUWFJVb0BQlZn/u+3CNQp0rCmfMq VWBD20tl4GkrBRYdglnj9A== X-Google-Smtp-Source: APXvYqyKvU4FF1l+DMGylGFkQ76jnSmRhzrYP4In1sH3GWqwYOmv02NRVJrc45EqzzSq12RBWTytzA== X-Received: by 2002:a9d:6f07:: with SMTP id n7mr353777otq.112.1579540052529; Mon, 20 Jan 2020 09:07:32 -0800 (PST) From: minyard@acm.org To: QEMU Developers Subject: [PATCH 2/5] smbus-eeprom: remove PROP_PTR Date: Mon, 20 Jan 2020 11:07:22 -0600 Message-Id: <20200120170725.24935-3-minyard@acm.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200120170725.24935-1-minyard@acm.org> References: <20200120170725.24935-1-minyard@acm.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::32d X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Corey Minyard Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) From: Marc-Andr=C3=A9 Lureau Instead, set the initial data field directly. (the initial data is an array of 256 bytes. As I don't know if it may change over time, I keep the pointer to original buffer as is, but it might be worth to consider to copy it instead) Signed-off-by: Marc-Andr=C3=A9 Lureau Message-Id: <20191120152442.26657-32-marcandre.lureau@redhat.com> Signed-off-by: Corey Minyard --- hw/i2c/smbus_eeprom.c | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/hw/i2c/smbus_eeprom.c b/hw/i2c/smbus_eeprom.c index 54c86a0112..533c728b3b 100644 --- a/hw/i2c/smbus_eeprom.c +++ b/hw/i2c/smbus_eeprom.c @@ -44,7 +44,7 @@ typedef struct SMBusEEPROMDevice { SMBusDevice smbusdev; uint8_t data[SMBUS_EEPROM_SIZE]; - void *init_data; + uint8_t *init_data; uint8_t offset; bool accessed; } SMBusEEPROMDevice; @@ -129,14 +129,14 @@ static void smbus_eeprom_reset(DeviceState *dev) =20 static void smbus_eeprom_realize(DeviceState *dev, Error **errp) { + SMBusEEPROMDevice *eeprom =3D SMBUS_EEPROM(dev); + smbus_eeprom_reset(dev); + if (eeprom->init_data =3D=3D NULL) { + error_setg(errp, "init_data cannot be NULL"); + } } =20 -static Property smbus_eeprom_properties[] =3D { - DEFINE_PROP_PTR("data", SMBusEEPROMDevice, init_data), - DEFINE_PROP_END_OF_LIST(), -}; - static void smbus_eeprom_class_initfn(ObjectClass *klass, void *data) { DeviceClass *dc =3D DEVICE_CLASS(klass); @@ -146,9 +146,8 @@ static void smbus_eeprom_class_initfn(ObjectClass *klas= s, void *data) 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; dc->vmsd =3D &vmstate_smbus_eeprom; - /* Reason: pointer property "data" */ + /* Reason: init_data */ dc->user_creatable =3D false; } =20 @@ -172,7 +171,7 @@ void smbus_eeprom_init_one(I2CBus *smbus, uint8_t addre= ss, uint8_t *eeprom_buf) =20 dev =3D qdev_create((BusState *) smbus, TYPE_SMBUS_EEPROM); qdev_prop_set_uint8(dev, "address", address); - qdev_prop_set_ptr(dev, "data", eeprom_buf); + SMBUS_EEPROM(dev)->init_data =3D eeprom_buf; qdev_init_nofail(dev); } =20 --=20 2.17.1