From nobody Tue Feb 10 03:38:10 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; dmarc=fail(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1593354993; cv=none; d=zohomail.com; s=zohoarc; b=YZeg444C5PITg9KTdl2vhOXbNtpn/BXQ2rsMfay2zk2W4v+eb71Dcsh3meY3IgayO3gZc6UH3TWVD8LNxUDWVZv1eZEvBB6Bv0VKSd2UCSuJdHlwPwBamQuyakh1Mgw3HEV06L0tvXXVwc6rxql7sCQ+v4AUT0TLhgo1bXLee7Q= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1593354993; h=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=03unWo1zzivuM0us7q7fEwDLp9zh0qzy8bL3l2XLj/Q=; b=SFoMbwP3rsji0VVRryRUg2qSCDWJSdtDl+vEHGHG3s3Q0xr93zn3FBC6N6gwdC8mNgV55A3E3zcfnpiacCBXeU7SrumhDnbORlvn0EyULbuAiaPLma5Z8oQ1+vuSYKUqwTEPa/DcD+u0WTKSauZjkmNTN1OBwvjRWAC4oSF5kgs= 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; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1593354993242264.8208522259449; Sun, 28 Jun 2020 07:36:33 -0700 (PDT) Received: from localhost ([::1]:59328 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jpYQ4-0007rz-25 for importer@patchew.org; Sun, 28 Jun 2020 10:36:32 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38628) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jpYEo-0006cb-6H for qemu-devel@nongnu.org; Sun, 28 Jun 2020 10:24:54 -0400 Received: from mail-wr1-x441.google.com ([2a00:1450:4864:20::441]:37458) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jpYEm-0004mr-9W for qemu-devel@nongnu.org; Sun, 28 Jun 2020 10:24:53 -0400 Received: by mail-wr1-x441.google.com with SMTP id a6so14056245wrm.4 for ; Sun, 28 Jun 2020 07:24:51 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148]) by smtp.gmail.com with ESMTPSA id h13sm5321555wml.42.2020.06.28.07.24.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 28 Jun 2020 07:24:50 -0700 (PDT) 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 :mime-version:content-transfer-encoding; bh=03unWo1zzivuM0us7q7fEwDLp9zh0qzy8bL3l2XLj/Q=; b=vIG40ChMwd+or/bA4R5r5eLZUe/PJkf3HFq4v0eQIabjB9atprSGbg9BhRFM7VJHZk Ym12zj0fkeq5PAxQAQB4KKKfwCBYpDEBYwRYuYucy5av0oqbVCG802ioymly1YZfkSZq TYXcan5ztzcuNYK/k3nNQRmvRd+dfwtuLQw/4ev0VuhT9iZ6VkjzHq5nSYkxVxg6JQdD bfxQ9hUiShCa4JG18aTorTT1Qfwss05aRkph+OMZuxwytnzLRnsyo264lvXI9Pueb6Z/ O51cdc0W77/Oct0MAobp0KmjNgk0zer4JHHOXGUd953xZAxgfB2hizMNC8Eu7d9mNdsb 0mkg== 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:mime-version:content-transfer-encoding; bh=03unWo1zzivuM0us7q7fEwDLp9zh0qzy8bL3l2XLj/Q=; b=p5TlAaoV7+0i/O32fNk97Xbl5zxKCdfSLOccJXWabMw1LVSl787jq5sbXYfe3rPbgb 3e9U7m2t6dNuclGCXhJ7LsftBRZ+zWL+gXPJSU0h7/7A1IEX/SjVPG2gnhULhZa8+Cmb hl/odiwGML0k1+MSGfG46UkPKj4ab6Iq1tLluRV513+A34vVw+/Q/BDcLU3Y7WZD2739 eZDaF0SI00pe1PAan9PqejFnd4KYDw+rNqMYOvc+3pOXCBIsm5S9TyXOQ5+kA8F0hFx+ c8lCNPKkedKqlzQe9Pbcor0DcMfMDd6roppUlOKDl5w/ZQpnC0cgaSUq5P9V9kwMveYD LVrQ== X-Gm-Message-State: AOAM532PjcRHZ5z2jYwBCjUnQGyUJN74Pjd3ixrnowGaQocq5YaNbYMp bsxTOHhGfaxVeTh3ySH3ZWdxbA== X-Google-Smtp-Source: ABdhPJwD8fLhGsbc4MM96c19nSQ9n/lU7R+BjqFPmUWdQtxhYntTMH7wtQp1h3GfWSwkRyuqav0btg== X-Received: by 2002:a5d:4986:: with SMTP id r6mr12594556wrq.424.1593354291023; Sun, 28 Jun 2020 07:24:51 -0700 (PDT) From: Peter Maydell To: qemu-arm@nongnu.org, qemu-devel@nongnu.org Subject: [PATCH 16/17] hw/arm/spitz: Provide usual QOM macros for corgi-ssp and spitz-lcdtg Date: Sun, 28 Jun 2020 15:24:28 +0100 Message-Id: <20200628142429.17111-17-peter.maydell@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200628142429.17111-1-peter.maydell@linaro.org> References: <20200628142429.17111-1-peter.maydell@linaro.org> MIME-Version: 1.0 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::441; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x441.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: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.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: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Alistair Francis Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" The QOM types "spitz-lcdtg" and "corgi-ssp" are missing the usual QOM TYPE and casting macros; provide and use them. In particular, we can safely use the QOM cast macros instead of FROM_SSI_SLAVE() because in both cases the 'ssidev' field of the instance state struct is the first field in it. Signed-off-by: Peter Maydell Reviewed-by: Alistair Francis Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- hw/arm/spitz.c | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/hw/arm/spitz.c b/hw/arm/spitz.c index 49eae3fce4e..f020aff9747 100644 --- a/hw/arm/spitz.c +++ b/hw/arm/spitz.c @@ -579,6 +579,9 @@ static void spitz_keyboard_realize(DeviceState *dev, Er= ror **errp) #define LCDTG_PICTRL 0x06 #define LCDTG_POLCTRL 0x07 =20 +#define TYPE_SPITZ_LCDTG "spitz-lcdtg" +#define SPITZ_LCDTG(obj) OBJECT_CHECK(SpitzLCDTG, (obj), TYPE_SPITZ_LCDTG) + typedef struct { SSISlave ssidev; uint32_t bl_intensity; @@ -616,7 +619,7 @@ static inline void spitz_bl_power(void *opaque, int lin= e, int level) =20 static uint32_t spitz_lcdtg_transfer(SSISlave *dev, uint32_t value) { - SpitzLCDTG *s =3D FROM_SSI_SLAVE(SpitzLCDTG, dev); + SpitzLCDTG *s =3D SPITZ_LCDTG(dev); int addr; addr =3D value >> 5; value &=3D 0x1f; @@ -645,7 +648,7 @@ static uint32_t spitz_lcdtg_transfer(SSISlave *dev, uin= t32_t value) =20 static void spitz_lcdtg_realize(SSISlave *ssi, Error **errp) { - SpitzLCDTG *s =3D FROM_SSI_SLAVE(SpitzLCDTG, ssi); + SpitzLCDTG *s =3D SPITZ_LCDTG(ssi); DeviceState *dev =3D DEVICE(s); =20 s->bl_power =3D 0; @@ -664,6 +667,9 @@ static void spitz_lcdtg_realize(SSISlave *ssi, Error **= errp) #define SPITZ_GPIO_MAX1111_CS 20 #define SPITZ_GPIO_TP_INT 11 =20 +#define TYPE_CORGI_SSP "corgi-ssp" +#define CORGI_SSP(obj) OBJECT_CHECK(CorgiSSPState, (obj), TYPE_CORGI_SSP) + /* "Demux" the signal based on current chipselect */ typedef struct { SSISlave ssidev; @@ -673,7 +679,7 @@ typedef struct { =20 static uint32_t corgi_ssp_transfer(SSISlave *dev, uint32_t value) { - CorgiSSPState *s =3D FROM_SSI_SLAVE(CorgiSSPState, dev); + CorgiSSPState *s =3D CORGI_SSP(dev); int i; =20 for (i =3D 0; i < 3; i++) { @@ -702,7 +708,7 @@ static void corgi_ssp_gpio_cs(void *opaque, int line, i= nt level) static void corgi_ssp_realize(SSISlave *d, Error **errp) { DeviceState *dev =3D DEVICE(d); - CorgiSSPState *s =3D FROM_SSI_SLAVE(CorgiSSPState, d); + CorgiSSPState *s =3D CORGI_SSP(d); =20 qdev_init_gpio_in(dev, corgi_ssp_gpio_cs, 3); s->bus[0] =3D ssi_create_bus(dev, "ssi0"); @@ -714,10 +720,11 @@ static void spitz_ssp_attach(SpitzMachineState *sms) { void *bus; =20 - sms->mux =3D ssi_create_slave(sms->mpu->ssp[CORGI_SSP_PORT - 1], "corg= i-ssp"); + sms->mux =3D ssi_create_slave(sms->mpu->ssp[CORGI_SSP_PORT - 1], + TYPE_CORGI_SSP); =20 bus =3D qdev_get_child_bus(sms->mux, "ssi0"); - sms->lcdtg =3D ssi_create_slave(bus, "spitz-lcdtg"); + sms->lcdtg =3D ssi_create_slave(bus, TYPE_SPITZ_LCDTG); =20 bus =3D qdev_get_child_bus(sms->mux, "ssi1"); sms->ads7846 =3D ssi_create_slave(bus, "ads7846"); @@ -1220,7 +1227,7 @@ static void corgi_ssp_class_init(ObjectClass *klass, = void *data) } =20 static const TypeInfo corgi_ssp_info =3D { - .name =3D "corgi-ssp", + .name =3D TYPE_CORGI_SSP, .parent =3D TYPE_SSI_SLAVE, .instance_size =3D sizeof(CorgiSSPState), .class_init =3D corgi_ssp_class_init, @@ -1249,7 +1256,7 @@ static void spitz_lcdtg_class_init(ObjectClass *klass= , void *data) } =20 static const TypeInfo spitz_lcdtg_info =3D { - .name =3D "spitz-lcdtg", + .name =3D TYPE_SPITZ_LCDTG, .parent =3D TYPE_SSI_SLAVE, .instance_size =3D sizeof(SpitzLCDTG), .class_init =3D spitz_lcdtg_class_init, --=20 2.20.1