From patchwork Tue Feb 27 10:49:00 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 878446 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="gsFOflii"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3zrFp71D5Pz9s1n for ; Tue, 27 Feb 2018 21:50:06 +1100 (AEDT) Received: from localhost ([::1]:36160 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eqcpf-0006Kj-On for incoming@patchwork.ozlabs.org; Tue, 27 Feb 2018 05:50:03 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:54711) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eqcos-0006Jh-Gr for qemu-devel@nongnu.org; Tue, 27 Feb 2018 05:49:16 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eqcor-0004BV-Gv for qemu-devel@nongnu.org; Tue, 27 Feb 2018 05:49:14 -0500 Received: from mail-lf0-x241.google.com ([2a00:1450:4010:c07::241]:40229) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eqcor-0004Ah-8D for qemu-devel@nongnu.org; Tue, 27 Feb 2018 05:49:13 -0500 Received: by mail-lf0-x241.google.com with SMTP id 37so26791850lfs.7 for ; Tue, 27 Feb 2018 02:49:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=Twqxi8BDJv63Fx0OmA4mzSxVFDLjBcftrJ1XbHyLRmQ=; b=gsFOfliisx+w6qA4RO3mVDUwM5nSPZShAx3JM5hCUcVT9Pg9+HQLROmqmEGRsaxIuz K26oAFpzc29d/UgKbOn2AngiH5oRtGhWGDCE08T6w9dIlPQVfLLjkOZuBz+j9ByYKu2s GOLVy5iuIzcNTNcC638XvoQ8vKAq9pVmIUUG0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=Twqxi8BDJv63Fx0OmA4mzSxVFDLjBcftrJ1XbHyLRmQ=; b=rqO2jGSkmYbYOrYzQjQZXT25D+qarCY7EDpuD3zyyf1mjDlHgz2vENV1EjViHrNNdt WL0M0Q3yoQXOMEv1xpO4thDvvyyQKtjv0F2E9fzB0jSxsmu7SjtC7KLylZf+124KQasj 0dlgMN/5j8IDzE/rT7XESw1/uLkEVG3FiehHOkGgQUI/lGpFQQ4DEE5k0WG/9yEp+G02 Qt9OB/TrjsnUX49NoEOiua6hL8eVwc4es3+VPaUI71oUfcRboZgEk44c8c0NJT6Eo2KC JVG9E53zCxDgaRMQz6mmi8+Osv3RKt18We74kuxKZK78luqBukPC1ZZDegHQ+MNiI5DF AmIQ== X-Gm-Message-State: APf1xPC185/zPvXQ7WkLRbsv3qAW7AArdtDnCiiGtK3nHqLEUSty6IKi wQu+DlmVHE9gLAcz1SeFlrtg/IfqjYw= X-Google-Smtp-Source: AG47ELsRQaOGeqA95fOUNMLkmO8uI94cYvXYIE+I+PNqVfmIJoJhJzghFAIk/cXGdCIRX3o187j6+Q== X-Received: by 10.25.43.136 with SMTP id r130mr10141019lfr.48.1519728551677; Tue, 27 Feb 2018 02:49:11 -0800 (PST) Received: from genomnajs.ideon.se ([85.235.10.227]) by smtp.gmail.com with ESMTPSA id 74sm2484148ljq.32.2018.02.27.02.49.10 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 27 Feb 2018 02:49:10 -0800 (PST) From: Linus Walleij To: qemu-devel@nongnu.org, Peter Maydell Date: Tue, 27 Feb 2018 11:49:00 +0100 Message-Id: <20180227104903.21353-3-linus.walleij@linaro.org> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180227104903.21353-1-linus.walleij@linaro.org> References: <20180227104903.21353-1-linus.walleij@linaro.org> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4010:c07::241 Subject: [Qemu-devel] [PATCH 2/5] i2c: Move the bus class to i2c.h 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 , Linus Walleij , qemu-arm@nongnu.org, =?utf-8?q?Philippe_M?= =?utf-8?q?athieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Corey Minyard Some devices need access to it. Signed-off-by: Corey Minyard Reviewed-by: Peter Maydell Signed-off-by: Linus Walleij --- hw/i2c/core.c | 17 ----------------- include/hw/i2c/i2c.h | 17 +++++++++++++++++ 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/hw/i2c/core.c b/hw/i2c/core.c index 9a54b61c1dbd..cfccefca3d6c 100644 --- a/hw/i2c/core.c +++ b/hw/i2c/core.c @@ -10,30 +10,13 @@ #include "qemu/osdep.h" #include "hw/i2c/i2c.h" -typedef struct I2CNode I2CNode; - -struct I2CNode { - I2CSlave *elt; - QLIST_ENTRY(I2CNode) next; -}; - #define I2C_BROADCAST 0x00 -struct I2CBus { - BusState qbus; - QLIST_HEAD(, I2CNode) current_devs; - uint8_t saved_address; - bool broadcast; -}; - static Property i2c_props[] = { DEFINE_PROP_UINT8("address", struct I2CSlave, address, 0), DEFINE_PROP_END_OF_LIST(), }; -#define TYPE_I2C_BUS "i2c-bus" -#define I2C_BUS(obj) OBJECT_CHECK(I2CBus, (obj), TYPE_I2C_BUS) - static const TypeInfo i2c_bus_info = { .name = TYPE_I2C_BUS, .parent = TYPE_BUS, diff --git a/include/hw/i2c/i2c.h b/include/hw/i2c/i2c.h index 8fd449f645f0..d727379b487a 100644 --- a/include/hw/i2c/i2c.h +++ b/include/hw/i2c/i2c.h @@ -56,6 +56,23 @@ struct I2CSlave { uint8_t address; }; +#define TYPE_I2C_BUS "i2c-bus" +#define I2C_BUS(obj) OBJECT_CHECK(I2CBus, (obj), TYPE_I2C_BUS) + +typedef struct I2CNode I2CNode; + +struct I2CNode { + I2CSlave *elt; + QLIST_ENTRY(I2CNode) next; +}; + +struct I2CBus { + BusState qbus; + QLIST_HEAD(, I2CNode) current_devs; + uint8_t saved_address; + bool broadcast; +}; + I2CBus *i2c_init_bus(DeviceState *parent, const char *name); void i2c_set_slave_address(I2CSlave *dev, uint8_t address); int i2c_bus_busy(I2CBus *bus);