From patchwork Thu Apr 19 21:27:24 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 10351607 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 2345D6023A for ; Thu, 19 Apr 2018 21:32:38 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 117771FEBA for ; Thu, 19 Apr 2018 21:32:38 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 02D48205D6; Thu, 19 Apr 2018 21:32:37 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 71CC11FEBA for ; Thu, 19 Apr 2018 21:32:37 +0000 (UTC) Received: from localhost ([::1]:50221 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f9HAS-0006nt-Kp for patchwork-qemu-devel@patchwork.kernel.org; Thu, 19 Apr 2018 17:32:36 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:53343) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f9H5g-0002Ui-BE for qemu-devel@nongnu.org; Thu, 19 Apr 2018 17:27:41 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1f9H5f-0007q0-6W for qemu-devel@nongnu.org; Thu, 19 Apr 2018 17:27:40 -0400 Received: from mail-qk0-x243.google.com ([2607:f8b0:400d:c09::243]:41032) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1f9H5f-0007pt-2d for qemu-devel@nongnu.org; Thu, 19 Apr 2018 17:27:39 -0400 Received: by mail-qk0-x243.google.com with SMTP id s78so6875730qkl.8 for ; Thu, 19 Apr 2018 14:27:39 -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=zELgoYDzGU3fDdYNoouzqga/mxuq1p+k7A8ydcrEQIQ=; b=pHRSyd81vZ04cQPFelTK65FBBMFRBsuK36LBFguqwGD10Js6DLc1wg4Y2epjRa+CcK LzBHSno1AAqiLwCqFhZHPQFk+QEFZW+VWddhwCFmrKOb2jzWxBF8eIqnsHCh+4rf1KPB 8o33z/0erDnCWbcWtEJzyVIK/e/MK2w+pC/FBqZi/9Iosrv5lTHwaxf6RCBdSnAhw9K/ 5oLmmvdCXu5fUt31KBGO3VPmcubTBM/fgEEA8oGnjHDrVueBQXX7R8RiD46sYDfuclk8 adhxRyYmouDURfad6xuQTEBK61OiRM9pEDkcLn5Uy7fO7NUY+9GIdtMbX5tYjWgGbQf7 HKAg== 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=zELgoYDzGU3fDdYNoouzqga/mxuq1p+k7A8ydcrEQIQ=; b=jgLtXfi+IHG+sV5rcEvf+1huKZhASP7EhdJOrki9MniGZHeBcr1UBWMJMPeDUh/aWw ReDCRCMOk+zRJY98N9/W8YAqWn26+hNg3H7xa9tNNraVC1H0eh63pTlRZpxM1Xl8u2t0 /AWX/P6bHE4xjSsSJRD3ckPVkC5qoqDu4EYS7CYoAQKuxPI+UfFFtR5bTVvUOec13wJh 9HoUOVMIMRj+0neWO6GpPaSo5boJYo16G1+UHsD2WHmX86USHL0I+U1QpZQa7JMRlcmQ LPEa3vxpFSM/DMJUzE1PNOTl+JMlwRvkQE3qef8cexxQXnKGkKVN2Qxoe7TfmsTsEL3q b5Pg== X-Gm-Message-State: ALQs6tCLGJtzquzvoF6ZGlM9/HpPAYZ2QUSK+oOuaPcNfzG6TH/048IM RsXJjGS+2SxUt0kORMsEfd1umMwq X-Google-Smtp-Source: AB8JxZokJJhj7dMyeTXigbF1CD2QMXqLJNYJA92vgp9tKqa02de0HQtUvvJ+M0++CzLrAcQ0cRIesw== X-Received: by 10.55.185.69 with SMTP id j66mr7859543qkf.216.1524173258625; Thu, 19 Apr 2018 14:27:38 -0700 (PDT) Received: from x1.local ([138.117.48.212]) by smtp.gmail.com with ESMTPSA id c137sm3571570qkb.2.2018.04.19.14.27.36 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 19 Apr 2018 14:27:38 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: Eduardo Habkost , Markus Armbruster Date: Thu, 19 Apr 2018 18:27:24 -0300 Message-Id: <20180419212727.26095-2-f4bug@amsat.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180419212727.26095-1-f4bug@amsat.org> References: <20180419212727.26095-1-f4bug@amsat.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:400d:c09::243 Subject: [Qemu-devel] [PATCH v3 1/4] hw/i2c/smbus: Use DeviceClass::realize instead of SMBusDeviceClass::init 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: Peter Maydell , Paolo Bonzini , Thomas Huth , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP SMBusDeviceClass::init is no more used, remove it. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Markus Armbruster --- include/hw/i2c/smbus.h | 1 - hw/i2c/smbus.c | 9 --------- hw/i2c/smbus_eeprom.c | 5 ++--- 3 files changed, 2 insertions(+), 13 deletions(-) diff --git a/include/hw/i2c/smbus.h b/include/hw/i2c/smbus.h index 544bbc1957..cfe3fa69f3 100644 --- a/include/hw/i2c/smbus.h +++ b/include/hw/i2c/smbus.h @@ -38,7 +38,6 @@ typedef struct SMBusDeviceClass { I2CSlaveClass parent_class; - int (*init)(SMBusDevice *dev); void (*quick_cmd)(SMBusDevice *dev, uint8_t read); void (*send_byte)(SMBusDevice *dev, uint8_t val); uint8_t (*receive_byte)(SMBusDevice *dev); diff --git a/hw/i2c/smbus.c b/hw/i2c/smbus.c index 2d1b79a689..587ce1ab7f 100644 --- a/hw/i2c/smbus.c +++ b/hw/i2c/smbus.c @@ -202,14 +202,6 @@ static int smbus_i2c_send(I2CSlave *s, uint8_t data) return 0; } -static int smbus_device_init(I2CSlave *i2c) -{ - SMBusDevice *dev = SMBUS_DEVICE(i2c); - SMBusDeviceClass *sc = SMBUS_DEVICE_GET_CLASS(dev); - - return sc->init(dev); -} - /* Master device commands. */ int smbus_quick_command(I2CBus *bus, uint8_t addr, int read) { @@ -350,7 +342,6 @@ static void smbus_device_class_init(ObjectClass *klass, void *data) { I2CSlaveClass *sc = I2C_SLAVE_CLASS(klass); - sc->init = smbus_device_init; sc->event = smbus_i2c_event; sc->recv = smbus_i2c_recv; sc->send = smbus_i2c_send; diff --git a/hw/i2c/smbus_eeprom.c b/hw/i2c/smbus_eeprom.c index b13ec0fe7a..125c887d1f 100644 --- a/hw/i2c/smbus_eeprom.c +++ b/hw/i2c/smbus_eeprom.c @@ -97,12 +97,11 @@ static uint8_t eeprom_read_data(SMBusDevice *dev, uint8_t cmd, int n) return eeprom_receive_byte(dev); } -static int smbus_eeprom_initfn(SMBusDevice *dev) +static void smbus_eeprom_realize(DeviceState *dev, Error **errp) { SMBusEEPROMDevice *eeprom = (SMBusEEPROMDevice *)dev; eeprom->offset = 0; - return 0; } static Property smbus_eeprom_properties[] = { @@ -115,7 +114,7 @@ static void smbus_eeprom_class_initfn(ObjectClass *klass, void *data) DeviceClass *dc = DEVICE_CLASS(klass); SMBusDeviceClass *sc = SMBUS_DEVICE_CLASS(klass); - sc->init = smbus_eeprom_initfn; + dc->realize = smbus_eeprom_realize; sc->quick_cmd = eeprom_quick_cmd; sc->send_byte = eeprom_send_byte; sc->receive_byte = eeprom_receive_byte;