From nobody Tue Feb 10 03:38:40 2026 Delivered-To: importer@patchew.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=1593989036; cv=none; d=zohomail.com; s=zohoarc; b=kK7Yw/bnl+3kEsi4mfvnq1RTkoJbJ8UMI+AklPvk8/Ttsp6T2wDBDoxRHpk47dj0f65qDEFUCkRp61sXxy1etTECbiegJSl0k4c11qhLXFu8RZ46jbF/XGScqjywAnIaGAyWOaUB7umPkgMGbw9U5a7ILu9oQpZE5Y0FEs9pAws= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1593989036; 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=RJorkYK71XuxeJn/MmaQaqEtLEUwVuOASL3pI8dX4DM=; b=Lu/1Hd+H0bPBnmuQ2LhrAEtmJUzmjaBndwnY1l5yI06eq5ZxVrjCse+lRMP9gfElE/auXrMEiMSMC08NWIk+3Dx8AfAsnu/qj3Kd/ZWAoQAJzfXs7zxOvqKgjLNzpVu9hZDigqa5Z9TvBqhQvQBT/w0ZVj5vl7J6uoSy5Oy6qKc= 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 1593989036743380.09532605597246; Sun, 5 Jul 2020 15:43:56 -0700 (PDT) Received: from localhost ([::1]:47268 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jsDMZ-0007wj-II for importer@patchew.org; Sun, 05 Jul 2020 18:43:55 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42474) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jsDKm-0004Hy-CZ; Sun, 05 Jul 2020 18:42:04 -0400 Received: from mail-wr1-x42d.google.com ([2a00:1450:4864:20::42d]:44116) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jsDKk-0002hv-Q8; Sun, 05 Jul 2020 18:42:04 -0400 Received: by mail-wr1-x42d.google.com with SMTP id b6so38915949wrs.11; Sun, 05 Jul 2020 15:42:01 -0700 (PDT) Received: from localhost.localdomain (1.red-83-51-162.dynamicip.rima-tde.net. [83.51.162.1]) by smtp.gmail.com with ESMTPSA id v6sm9151467wrr.85.2020.07.05.15.41.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 05 Jul 2020 15:42:00 -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 :mime-version:content-transfer-encoding; bh=RJorkYK71XuxeJn/MmaQaqEtLEUwVuOASL3pI8dX4DM=; b=tkrHuxjAVfaJchGbSaeE5rbW8n2tB/xcKjLYaHFqPVcoR6gPUum+c7QX8zvWOhDTqS JHoFY+LKmo9Oei4kNKGFVJtVtiskzfwL7H6tmim+IhVv2GyhnaU3iRgeq22npWU9GM3j VYWbUgj0vzhzpo3K38f/1/T4rzmwxK1v/HunH3H58J6If91tVq6Svs0zO0Pb4sURGzc7 HT833FRXH+RrkPSN9ng6SPbVPJb9sT9tOeQ88JFLBU5b2cTKk6JY5keGxi/cN08fRbB5 FT3CWwn5z/9tEdLiHDQ/ZnfYA96tEBCsFzTPM/FAk21xtS7CshK1hFuxtOtTAWNrrvgB zRQQ== 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=RJorkYK71XuxeJn/MmaQaqEtLEUwVuOASL3pI8dX4DM=; b=IEmy2m20uAsm1uJXJrC1fHALhjmGoK96qnLZD1wDt98IrnV4lVnzaGRyo49PlkjCFu 60Lfzi3jRLJahDEK4fROfEnCS+zIM3KgxUrHRChAunHLSUSYI5YGo3WSjsH6k+6dxCin Qjbi0wwF3TagZjeR01DyUch0k7erUQlZlT5LZo0R8wS1MQ3CMgHgHI+q1fULm5IAkVGC lI02P5ehOZWU+4iabhwa9iX5yrxOhN/WQh3H5P0nVa1frqxtTQfa1PGuPL7I2C56yNHQ kxuEpNRGNWaZNlqUHcEtCjUYx0ECOjwF10aBxP94scM8VnLzzChOBijDkf1jBIERX2b0 DKuQ== X-Gm-Message-State: AOAM530mM/hVut+GTuSpJ8jqJzZnrjzftTHYl8+V/xiw6bqZEQdLCGUC zw6aFuZgClWfxU6HKvJ8SCXPFBiyIYA= X-Google-Smtp-Source: ABdhPJyynVJotrId2R/nneiiyxoSSjqSejsDVq9KR/lJVr2WL6nTSVjLo7A9hCtbW4P7GWKcYkxMSA== X-Received: by 2002:adf:b608:: with SMTP id f8mr49757881wre.363.1593988920564; Sun, 05 Jul 2020 15:42:00 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH v2 2/5] hw/i2c: Rename i2c_try_create_slave() as i2c_slave_new() Date: Mon, 6 Jul 2020 00:41:51 +0200 Message-Id: <20200705224154.16917-3-f4bug@amsat.org> X-Mailer: git-send-email 2.21.3 In-Reply-To: <20200705224154.16917-1-f4bug@amsat.org> References: <20200705224154.16917-1-f4bug@amsat.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable 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; Received-SPF: pass client-ip=2a00:1450:4864:20::42d; envelope-from=philippe.mathieu.daude@gmail.com; helo=mail-wr1-x42d.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: 0 X-Spam_score: 0.0 X-Spam_bar: / X-Spam_report: (0.0 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=1, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=_AUTOLEARN X-Spam_action: no action 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: Corey Minyard , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Peter Maydell , Andrew Jeffery , Markus Armbruster , qemu-arm@nongnu.org, qemu-ppc@nongnu.org, Joel Stanley , Jan Kiszka , David Gibson , =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) We use "new" names for functions that allocate and initialize device objects: pci_new(), isa_new(), usb_new(). Let's call this one i2c_slave_new(). Since we have to update all the callers, also let it return a I2CSlave object. Suggested-by: Markus Armbruster Reviewed-by: Markus Armbruster Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- include/hw/i2c/i2c.h | 2 +- hw/arm/aspeed.c | 4 ++-- hw/i2c/core.c | 11 +++++------ 3 files changed, 8 insertions(+), 9 deletions(-) diff --git a/include/hw/i2c/i2c.h b/include/hw/i2c/i2c.h index d6e3d85faf..18efc668f1 100644 --- a/include/hw/i2c/i2c.h +++ b/include/hw/i2c/i2c.h @@ -79,8 +79,8 @@ int i2c_send_recv(I2CBus *bus, uint8_t *data, bool send); int i2c_send(I2CBus *bus, uint8_t data); uint8_t i2c_recv(I2CBus *bus); =20 +I2CSlave *i2c_slave_new(const char *name, uint8_t addr); DeviceState *i2c_create_slave(I2CBus *bus, const char *name, uint8_t addr); -DeviceState *i2c_try_create_slave(const char *name, uint8_t addr); bool i2c_realize_and_unref(DeviceState *dev, I2CBus *bus, Error **errp); =20 /* lm832x.c */ diff --git a/hw/arm/aspeed.c b/hw/arm/aspeed.c index 1285bf82c0..54ca36e0b6 100644 --- a/hw/arm/aspeed.c +++ b/hw/arm/aspeed.c @@ -513,7 +513,7 @@ static void witherspoon_bmc_i2c_init(AspeedMachineState= *bmc) /* Bus 3: TODO bmp280@77 */ /* Bus 3: TODO max31785@52 */ /* Bus 3: TODO dps310@76 */ - dev =3D i2c_try_create_slave(TYPE_PCA9552, 0x60); + dev =3D DEVICE(i2c_slave_new(TYPE_PCA9552, 0x60)); qdev_prop_set_string(dev, "description", "pca1"); i2c_realize_and_unref(dev, aspeed_i2c_get_bus(&soc->i2c, 3), &error_fatal); @@ -531,7 +531,7 @@ static void witherspoon_bmc_i2c_init(AspeedMachineState= *bmc) =20 smbus_eeprom_init_one(aspeed_i2c_get_bus(&soc->i2c, 11), 0x51, eeprom_buf); - dev =3D i2c_try_create_slave(TYPE_PCA9552, 0x60); + dev =3D DEVICE(i2c_slave_new(TYPE_PCA9552, 0x60)); qdev_prop_set_string(dev, "description", "pca0"); i2c_realize_and_unref(dev, aspeed_i2c_get_bus(&soc->i2c, 11), &error_fatal); diff --git a/hw/i2c/core.c b/hw/i2c/core.c index acf34a12d6..144786f17a 100644 --- a/hw/i2c/core.c +++ b/hw/i2c/core.c @@ -267,13 +267,13 @@ const VMStateDescription vmstate_i2c_slave =3D { } }; =20 -DeviceState *i2c_try_create_slave(const char *name, uint8_t addr) +I2CSlave *i2c_slave_new(const char *name, uint8_t addr) { DeviceState *dev; =20 dev =3D qdev_new(name); qdev_prop_set_uint8(dev, "address", addr); - return dev; + return I2C_SLAVE(dev); } =20 bool i2c_realize_and_unref(DeviceState *dev, I2CBus *bus, Error **errp) @@ -283,12 +283,11 @@ bool i2c_realize_and_unref(DeviceState *dev, I2CBus *= bus, Error **errp) =20 DeviceState *i2c_create_slave(I2CBus *bus, const char *name, uint8_t addr) { - DeviceState *dev; + I2CSlave *dev =3D i2c_slave_new(name, addr); =20 - dev =3D i2c_try_create_slave(name, addr); - i2c_realize_and_unref(dev, bus, &error_fatal); + i2c_realize_and_unref(DEVICE(dev), bus, &error_fatal); =20 - return dev; + return DEVICE(dev); } =20 static void i2c_slave_class_init(ObjectClass *klass, void *data) --=20 2.21.3