From patchwork Mon Feb 19 15:20:05 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Corey Minyard X-Patchwork-Id: 128818 Delivered-To: patch@linaro.org Received: by 10.46.124.24 with SMTP id x24csp3622457ljc; Mon, 19 Feb 2018 07:22:14 -0800 (PST) X-Google-Smtp-Source: AH8x227CTA/1jRarDXLGqoPhh3nZT9Y4pMKxpgtcJQx9ElvNjlWftwhgpPqVMJVC5+DOJ+kNA3H/ X-Received: by 10.129.35.12 with SMTP id j12mr10876673ywj.200.1519053734618; Mon, 19 Feb 2018 07:22:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519053734; cv=none; d=google.com; s=arc-20160816; b=iJyQgArxd6eTdIINcIRkK9jeopVsI3GxKxfPIRBaRfi9jf7gs2apOIZHLMcw9D59Vt oh05EPE54D9AlLd4v/aGih+U7KnjBNYqxnM/S4OWF2r0IUyk2mKYH8wSqrkJ8kAh4NZt nupRxY7jjzjfgqzHK3Yo0vGBcjocZYKp0PgNdpUg1+adnjpJ8SNcP8KdpUBPV79daMU5 H615/GxW2th4RM9ornpDjhTWn+q6i0LOhrnwhU6BfWYS53c8HJA5vdOvZZpOMVpABSJk 7e0cIHwYvfMIGxgAU4xD6hohC5Ai3w2wFTCp2AlkrUjKL23s1BFRUvAan5PVv9daG04Q RO+w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject:references:in-reply-to :message-id:date:to:from:dkim-signature:arc-authentication-results; bh=WLty3MdEjt/HHkvtV23r1UdhxiVMkXWYQTxzyYM+EZo=; b=fSivHa2HqAguslG/kOi3G/cLzLhCnXuEpS3mF1tvd4JDaKes4d1z/ovEkWr1qUu2DF mD4vqOtH3muetS8FWp08O5VyW6rM2lo3LLGgDM+N4LraqXE6MaEpg4z/n1bb86mIo2y4 tlimzZllb8zqVb5OCYLyxrRc/4HtNYxY4T93pEv0mqhF/xIzCC51YxqnOEyA8tAMZeZg iz0RHRciPTGylBn2GZjg3qnMuprauhYxzIXTmzSvtbzgdWwGAn4xteOfnuVjfvBSFwIy CGbHRVQVn9Vc7LokeC0ni03OFoL1OrYOhmnTEXGJf6x4q24b2qC1li6CGqDKEgsODCK0 LgiA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=X/cliwqI; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) smtp.mailfrom=qemu-devel-bounces+patch=linaro.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id v129si2577696ybb.18.2018.02.19.07.22.14 for (version=TLS1 cipher=AES128-SHA bits=128/128); Mon, 19 Feb 2018 07:22:14 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) client-ip=2001:4830:134:3::11; Authentication-Results: mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=X/cliwqI; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) smtp.mailfrom=qemu-devel-bounces+patch=linaro.org@nongnu.org Received: from localhost ([::1]:50793 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ennGg-0003mX-1c for patch@linaro.org; Mon, 19 Feb 2018 10:22:14 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52571) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ennEp-00038q-E6 for qemu-devel@nongnu.org; Mon, 19 Feb 2018 10:20:20 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ennEo-0008Up-F6 for qemu-devel@nongnu.org; Mon, 19 Feb 2018 10:20:19 -0500 Received: from mail-ot0-x243.google.com ([2607:f8b0:4003:c0f::243]:36572) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ennEk-0008SC-9F; Mon, 19 Feb 2018 10:20:14 -0500 Received: by mail-ot0-x243.google.com with SMTP id b15so2796813otf.3; Mon, 19 Feb 2018 07:20:14 -0800 (PST) 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=WLty3MdEjt/HHkvtV23r1UdhxiVMkXWYQTxzyYM+EZo=; b=X/cliwqI3zhuUSCptLwPE3GNWbUVHvAGy8dKH8vIe2lQp45rz4DQf2r2G7ksARGmc3 ljNShhR2rnfViUMpDrbbqq6zi+v+Nk1u2RoRQI8tcrhaQ/Na9oqcPwSfKvQYQStIuax2 6MhJKw1gC90CN0VD3XsixQXqG/11QIJtUzdrEkc9qH+sda6sGxpHW9VY7RUVVddCTG6J 1HP0PAImHkeKqMXqVscMkAvy5KeA9++Esu3v0qLJwDa/1o/lfAldtIWFmLTcwwxY8E1g /jE9npYPzbkWIIr6AKhrPvTcA9tcMKGnALx7k54GMS8FyoJeYwb0U/is1XWDxU1k4xBX UW0Q== 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=WLty3MdEjt/HHkvtV23r1UdhxiVMkXWYQTxzyYM+EZo=; b=RbZ3vhcARIU/vA/zmqUNFydUe2WmGFvOQ1kwQ2wh24G6ke300XXpFRawWOwAbfijQ9 rcSqZnjR1r3fIaCTDzGo/KnqqwezBleSAgkScy6Piw5KqczIRHsmva12D78CchRjyy4+ ck783o5bO9wcz075x5BPdtrsHyWIZr2+/hmVCvWs8hM1LPXC5hSJxMEqfOc0XigRdmdb 3gM722G/jESxEv0G2+BDN/JCXSdF4rAdTWsRtMH65mQeZQx1tFc8htGv+Zu/rqiTQLtQ 0Urhs2U0m6NuYHWo5UJ7TtculXk/lLW+uvPLyL+Nw4Z9xAzEzQoCC+IhR8odASbZRrEL Pybg== X-Gm-Message-State: APf1xPDsUMuMGGp3uC9I/xj6lCev98V29Ck1d+wjdJZTJzB9Y7OlKMoH yjKAuwIkDqjhVhalSxeWyA== X-Received: by 10.157.0.220 with SMTP id 28mr3875otk.201.1519053613517; Mon, 19 Feb 2018 07:20:13 -0800 (PST) Received: from serve.minyard.net ([47.184.168.85]) by smtp.gmail.com with ESMTPSA id s101sm12900305ota.27.2018.02.19.07.20.10 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 19 Feb 2018 07:20:11 -0800 (PST) Received: from t430.minyard.net (t430m.minyard.net [192.168.27.3]) by serve.minyard.net (Postfix) with ESMTPA id 2133AB5D; Mon, 19 Feb 2018 09:20:10 -0600 (CST) Received: by t430.minyard.net (Postfix, from userid 1000) id F1696300081; Mon, 19 Feb 2018 09:20:08 -0600 (CST) From: minyard@acm.org To: Linus Walleij , =?utf-8?q?Philippe_Mathieu-D?= =?utf-8?b?YXVkw6k=?= Date: Mon, 19 Feb 2018 09:20:05 -0600 Message-Id: <1519053606-9817-2-git-send-email-minyard@acm.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1519053606-9817-1-git-send-email-minyard@acm.org> References: <1519053606-9817-1-git-send-email-minyard@acm.org> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4003:c0f::243 Subject: [Qemu-devel] [PATCH 1/2] i2c: Fix some brace style issues 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 , qemu-arm@nongnu.org, qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Corey Minyard Signed-off-by: Corey Minyard --- hw/i2c/core.c | 3 +-- include/hw/i2c/i2c.h | 6 ++---- 2 files changed, 3 insertions(+), 6 deletions(-) -- 2.7.4 Reviewed-by: Peter Maydell Reviewed-by: Linus Walleij diff --git a/hw/i2c/core.c b/hw/i2c/core.c index 59068f1..9a54b61 100644 --- a/hw/i2c/core.c +++ b/hw/i2c/core.c @@ -19,8 +19,7 @@ struct I2CNode { #define I2C_BROADCAST 0x00 -struct I2CBus -{ +struct I2CBus { BusState qbus; QLIST_HEAD(, I2CNode) current_devs; uint8_t saved_address; diff --git a/include/hw/i2c/i2c.h b/include/hw/i2c/i2c.h index 24e95d0..8fd449f 100644 --- a/include/hw/i2c/i2c.h +++ b/include/hw/i2c/i2c.h @@ -25,8 +25,7 @@ typedef struct I2CSlave I2CSlave; #define I2C_SLAVE_GET_CLASS(obj) \ OBJECT_GET_CLASS(I2CSlaveClass, (obj), TYPE_I2C_SLAVE) -typedef struct I2CSlaveClass -{ +typedef struct I2CSlaveClass { DeviceClass parent_class; /* Callbacks provided by the device. */ @@ -50,8 +49,7 @@ typedef struct I2CSlaveClass int (*event)(I2CSlave *s, enum i2c_event event); } I2CSlaveClass; -struct I2CSlave -{ +struct I2CSlave { DeviceState qdev; /* Remaining fields for internal use by the I2C code. */ From patchwork Mon Feb 19 15:20:06 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Corey Minyard X-Patchwork-Id: 128819 Delivered-To: patch@linaro.org Received: by 10.46.124.24 with SMTP id x24csp3622764ljc; Mon, 19 Feb 2018 07:22:35 -0800 (PST) X-Google-Smtp-Source: AH8x227X4XxyLROTALdg8Sxo6MaBFkkke/P9ZRrbBzpi2SO8u/C7UksvFf08fSaqAD59LgTJRhpt X-Received: by 10.129.128.130 with SMTP id q124mr10894785ywf.289.1519053755277; Mon, 19 Feb 2018 07:22:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519053755; cv=none; d=google.com; s=arc-20160816; b=fbAF49Os2+EejeF0mjEX+lGhsDPqmLzmymWrKwnbaAgCdzLxoKMhm9tQMmUx/uTzB1 /aFU12gHj4/gH7+yvu8XVe6oTJdGlZvRFhJdyi03SlU8UVX88wqPmiThj4UsGDpJEfx0 sYxQhF2TXvBAOdXdLC2zaRvm2AbC35bsTD1OKTbQuKHirSEW+hLgD4flHvmkCAcVK2oL f8tcVMZ4+0Iiv9Le9vo/rjkC77cjDRn1PKLb+Nxwge2nf1vUyUzct7GAzB+7u5h9VmMb Sdr1nDOVxFvTHgmmzVcQSmuWkFcTjncUZg2Bycaq0F5cJ3ClIvWlyx5ISF3rzRbFy2NT Cv1g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject:references:in-reply-to :message-id:date:to:from:dkim-signature:arc-authentication-results; bh=cusqc1X4gG/UtlHSinYxpQcggXpVDY6SFgpui8GkcC8=; b=tSOMxLxUeU6VHaqMyj+MTXaDuiEp2hiUNR8Ce9ewTHQY+JNHKI5aWwR41aP7GyywOB WNR34aOofmTYRD6tgGllrqIWV3+wBrxilkKJF7dsEpX+PSbNeqDLcuFj0kojGjyPMAJW Mui5ZIYnmzCsxWu8+IW4NPIZ9mcT040Ckgq/SAk8KqsX3r8yZpDiK6V6FCncrfFwwgRA SoZ0BuKoPkZ9WLTFIPBb/CdjevYeiLfQPJ8Fip/uSMbIzzc946wcr4NxFr+8WE58X1SX GknzYFD/p0uI91Sb0iw1wQORjHxpSs4K5CTNHZY5ahQa1xPplHIUaPfBJ9Kr6RU21rFs 1dXA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=rsPvG29w; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) smtp.mailfrom=qemu-devel-bounces+patch=linaro.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id d190si3998766ywe.175.2018.02.19.07.22.35 for (version=TLS1 cipher=AES128-SHA bits=128/128); Mon, 19 Feb 2018 07:22:35 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) client-ip=2001:4830:134:3::11; Authentication-Results: mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=rsPvG29w; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) smtp.mailfrom=qemu-devel-bounces+patch=linaro.org@nongnu.org Received: from localhost ([::1]:50799 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ennH0-0004QQ-Nj for patch@linaro.org; Mon, 19 Feb 2018 10:22:34 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52601) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ennEu-0003CD-F7 for qemu-devel@nongnu.org; Mon, 19 Feb 2018 10:20:28 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ennEo-0008Uk-E6 for qemu-devel@nongnu.org; Mon, 19 Feb 2018 10:20:24 -0500 Received: from mail-ot0-x242.google.com ([2607:f8b0:4003:c0f::242]:38332) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ennEj-0008Rb-Id; Mon, 19 Feb 2018 10:20:13 -0500 Received: by mail-ot0-x242.google.com with SMTP id 95so7227387ote.5; Mon, 19 Feb 2018 07:20:13 -0800 (PST) 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=cusqc1X4gG/UtlHSinYxpQcggXpVDY6SFgpui8GkcC8=; b=rsPvG29wyiI5Jb1I6nKuLkxnECndRtTkywVXRxlfdxeSq5oyDHyDl50vLmVYlDGTfL DTQwA51zRkRFOAS7N3X1EX5YGbWOY6+QX6PFWQaQaMMJF16XBRAhvalNd0vZ0zQjAAuy KWuUb2t8pri6SV51qsoc1llwI0iczOqneG76PJ2vD/Vsti8962TFdCS2PRSwdZOSf9y8 fg41MIBiJK2aZ5ZOFO9HVq0JukFZljIIjToh84vHdKwnUrEDeJ01pSNruI7UWX237Fz4 m8Vcdq0W/idl5fG8MraI2kqBdWWJ4y4R/37R28FV+iut9bHpoMomvZcmir9gv6KgXzYN I0OQ== 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=cusqc1X4gG/UtlHSinYxpQcggXpVDY6SFgpui8GkcC8=; b=s5CfKgDJq/GM1pe0hHkbGAVushGzF/aTC/aI0tdIPnxzVCamL+4o6BhlXohe5KGWFE Ovd3ROYqeTsk6FSmF4DXwDaekWFWpVnPgHtKuyE3W9AUX/0OaFjs4sqixfSz9PR/8+Yd HGUdvVaWcAcCAZXJBRsHnCqrlYkaIwP1DW+mYjxVP1GRJcdzfNTHYcM8Yy15tMHEcCXO 1rh7mq5BH+qKOgYYuXXSA3L2VNJRAPU1GMuw9p1LnE+gMvQcWsRqs3iVAQ8pJa3Z7TQA 5rQj5BkQgBXHPclJ+/CF7oZYMTPhlOhGnn2RpSxp7nSx6dFfBGYDmyNjboasfup+Pghb Theg== X-Gm-Message-State: APf1xPCmm7FHpOQlR1Fqn6M/2qTebsMhv8C66zmSEOcKTRO28C/IWIMF KaeKqF4fDZ7cjeEUnTCq3w== X-Received: by 10.157.13.165 with SMTP id 34mr11963171ots.313.1519053612751; Mon, 19 Feb 2018 07:20:12 -0800 (PST) Received: from serve.minyard.net ([47.184.168.85]) by smtp.gmail.com with ESMTPSA id s11sm13217447ots.77.2018.02.19.07.20.10 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 19 Feb 2018 07:20:11 -0800 (PST) Received: from t430.minyard.net (t430m.minyard.net [192.168.27.3]) by serve.minyard.net (Postfix) with ESMTPA id F307A6EA; Mon, 19 Feb 2018 09:20:09 -0600 (CST) Received: by t430.minyard.net (Postfix, from userid 1000) id 13CD8300966; Mon, 19 Feb 2018 09:20:08 -0600 (CST) From: minyard@acm.org To: Linus Walleij , =?utf-8?q?Philippe_Mathieu-D?= =?utf-8?b?YXVkw6k=?= Date: Mon, 19 Feb 2018 09:20:06 -0600 Message-Id: <1519053606-9817-3-git-send-email-minyard@acm.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1519053606-9817-1-git-send-email-minyard@acm.org> References: <1519053606-9817-1-git-send-email-minyard@acm.org> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4003:c0f::242 Subject: [Qemu-devel] [PATCH 2/2] 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 , qemu-arm@nongnu.org, qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Corey Minyard Some devices need access to it. Signed-off-by: Corey Minyard --- hw/i2c/core.c | 17 ----------------- include/hw/i2c/i2c.h | 17 +++++++++++++++++ 2 files changed, 17 insertions(+), 17 deletions(-) -- 2.7.4 Reviewed-by: Peter Maydell Reviewed-by: Linus Walleij diff --git a/hw/i2c/core.c b/hw/i2c/core.c index 9a54b61..cfccefc 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 8fd449f..d727379 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);