From nobody Mon Feb 9 06:36:49 2026 Delivered-To: importer@patchew.org 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; 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=1586727054; cv=none; d=zohomail.com; s=zohoarc; b=ky569Cle3a15XvzEUnPr47OYIeOB6Hscm8ge4mw7zJCfjbih2p2QQBxe3Pga1D8doH5lYH7Mlvj4ph2Sxi9aKNInwILt91GSNSxmnhAaIeqfVHKtVwO/qPJp9sI0or1ZDSMedcCLjvXaTp0eAEuGm5jNKT/i6QupX19tudD/d/k= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1586727054; 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=Ewcdrwwo68JETPKwOfBhBSt7cYAb7QAPUwIknRsZlp4=; b=bk2MiuMUcyWvLR7/X8zz7/qwr1ObjAgRpiZY+L3N0prr1o8kMKxs8r4SdXDmpNql7Xr7qdGtPpPUuvRtPanhkIH5EcrzgK95En6s64jf9p6nNEic/5xq3BX8Fn+yADRQIOXr+qlRYrQxNgw8wdhE7e79P5JuaiivMm15cUIwisI= 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 1586727054818446.86486635260417; Sun, 12 Apr 2020 14:30:54 -0700 (PDT) Received: from localhost ([::1]:37244 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jNkBp-00038t-1X for importer@patchew.org; Sun, 12 Apr 2020 17:30:53 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42923) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jNkAo-0001lJ-1m for qemu-devel@nongnu.org; Sun, 12 Apr 2020 17:29:51 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jNkAn-0006hf-0P for qemu-devel@nongnu.org; Sun, 12 Apr 2020 17:29:49 -0400 Received: from mail-wm1-x342.google.com ([2a00:1450:4864:20::342]:51908) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1jNkAm-0006h2-QB; Sun, 12 Apr 2020 17:29:48 -0400 Received: by mail-wm1-x342.google.com with SMTP id x4so7853013wmj.1; Sun, 12 Apr 2020 14:29:48 -0700 (PDT) Received: from localhost.localdomain (116.red-83-42-57.dynamicip.rima-tde.net. [83.42.57.116]) by smtp.gmail.com with ESMTPSA id r3sm12797798wrm.35.2020.04.12.14.29.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 12 Apr 2020 14:29:47 -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=Ewcdrwwo68JETPKwOfBhBSt7cYAb7QAPUwIknRsZlp4=; b=vX0sjzwtOM9T7Ze0kYcABZ/EWM/ZC/zt4fuE50j4Vdhv7A45UVToTZ0CINzUjUYwzi 3aCmO9A0Wbc+Qsr6wT8TFNVlSWrCeHfrvO4xXrlZt67vluWBM7KQ18BTRR69ty7VFkQe jxMV5RVZ0ivkhVIQH/DdI5VGIgvJ9UHi06zY3/F8sAN7BWmjl0RsTmfg5o3kB844edv+ RztWzWdNT2Gy30ApPyoq8Sq9tQgxG+os9e7JT48j1cyyEsaeveOGyRdYwPHZ0EpTeChD y7MGA04jLKv/7jIgBLFW48Koc52+do/tMLCrndduyQ8Y1JpeWgKNAYzSey3RtPGU3g6l qFRg== 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=Ewcdrwwo68JETPKwOfBhBSt7cYAb7QAPUwIknRsZlp4=; b=GLNyUsfDAyO12sB06RYQLgzY/VTVz/SsymYPm7WbNLA0rBwl5Ur0ohjV/ajmmavCC4 bYcJYmU7DpOQsC+JqlQpnMOIn5Jn+7jOFDm7jFou0SsKqZF3IlCco/sNpokEDaItDIST zXF0yPxL9XQBxatM/zBCvderqHt4/Pw+A6RqZdG7G1PK748K+qseefGObmNyI8iTwlZi c/jQO6lvM/EtUFFvXX3LBOcPq8Umw28EwpvklWUJF+VVzxL9id2XqQz+FG5Y8EBr4Z2i ggaz0LnfxB05+U4Y8AST464nV0aVw8VQ1VYFaXTP/g8AsvWPL2ssG0GnrcLt6sekztVE hQCw== X-Gm-Message-State: AGi0Pua94bZie3CL/tH+G45HDXTnR26qfvG/LtEGzeKCJWTIZsn6AmWC RPL20HyBNK6/guT3kyQ12gURLkey5t8= X-Google-Smtp-Source: APiQypJ7uvY1OfKHnmfgVuIPmfFeQR4KiuWpFQe4z5ivqtk1ziDss6t2u2jp1uojtDSXLJWN8NhGbw== X-Received: by 2002:a7b:c931:: with SMTP id h17mr16703572wml.105.1586726987497; Sun, 12 Apr 2020 14:29:47 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH-for-5.1 1/3] hw/ide/ahci: Use qdev gpio rather than qemu_allocate_irqs() Date: Sun, 12 Apr 2020 23:29:41 +0200 Message-Id: <20200412212943.4117-2-f4bug@amsat.org> X-Mailer: git-send-email 2.21.1 In-Reply-To: <20200412212943.4117-1-f4bug@amsat.org> References: <20200412212943.4117-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 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::342 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: Peter Maydell , qemu-block@nongnu.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Aleksandar Markovic , Stafford Horne , John Snow , Aleksandar Rikalo , Aurelien Jarno Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Switch to using the qdev gpio API which is preferred over qemu_allocate_irqs(). One step to eventually deprecate and remove qemu_allocate_irqs() one day. Patch created mechanically using spatch with this script inspired from commit d6ef883d9d7: @@ typedef qemu_irq; identifier irqs, handler; expression opaque, count, i; @@ - qemu_irq *irqs; ... - irqs =3D qemu_allocate_irqs(handler, opaque, count); + qdev_init_gpio_in(DEVICE(opaque), handler, count); <+... - irqs[i] + qdev_get_gpio_in(DEVICE(opaque), i) ...+> ?- g_free(irqs); Inspired-by: Peter Maydell Signed-off-by: Philippe Mathieu-Daud=C3=A9 Acked-by: John Snow Reviewed-by: Alistair Francis Reviewed-by: John Snow --- hw/ide/ahci.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/hw/ide/ahci.c b/hw/ide/ahci.c index 13d91e109a..ef0a0a22ee 100644 --- a/hw/ide/ahci.c +++ b/hw/ide/ahci.c @@ -1534,19 +1534,18 @@ void ahci_init(AHCIState *s, DeviceState *qdev) =20 void ahci_realize(AHCIState *s, DeviceState *qdev, AddressSpace *as, int p= orts) { - qemu_irq *irqs; int i; =20 s->as =3D as; s->ports =3D ports; s->dev =3D g_new0(AHCIDevice, ports); ahci_reg_init(s); - irqs =3D qemu_allocate_irqs(ahci_irq_set, s, s->ports); + qdev_init_gpio_in(DEVICE(s), ahci_irq_set, s->ports); for (i =3D 0; i < s->ports; i++) { AHCIDevice *ad =3D &s->dev[i]; =20 ide_bus_new(&ad->port, sizeof(ad->port), qdev, i, 1); - ide_init2(&ad->port, irqs[i]); + ide_init2(&ad->port, qdev_get_gpio_in(DEVICE(s), i)); =20 ad->hba =3D s; ad->port_no =3D i; @@ -1554,7 +1553,6 @@ void ahci_realize(AHCIState *s, DeviceState *qdev, Ad= dressSpace *as, int ports) ad->port.dma->ops =3D &ahci_dma_ops; ide_register_restart_cb(&ad->port); } - g_free(irqs); } =20 void ahci_uninit(AHCIState *s) --=20 2.21.1 From nobody Mon Feb 9 06:36:49 2026 Delivered-To: importer@patchew.org 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; 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=amsat.org ARC-Seal: i=1; a=rsa-sha256; t=1586727059; cv=none; d=zohomail.com; s=zohoarc; b=FyV1SI7eGu9XSkiABdWx9O0d+ugMpbMXob9+HO66j1Ff3lkVszCx0p9Hx5mwYeFXZUl2aLV6UmU3CwZuUbuJiOHwL6BzifWiYrgOR2MCxYgr3GQTulyurXQxGGS3htoE4aenPjGuuBZahgstdwXqUi+WEdJsRz27Z+t30z47yeg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1586727059; 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=0Gwk+omGQ520vgI5+JQYZuT2VgvX+0dicPgG2UZcDzk=; b=NUKL6t+LkaIGfYJPKnvoAlW/cEAq/xl/6cCDvn6FHi8cIDPBuzTYwlDbkn9vJPWxgJgmp1XNntnANF28Pzv6gKWznvD4SgPERUXeKwkFjYMBnUDL1xRLvucDMQepacib48WaBuqtwI7NG3VZ2tY3PQddCQ7xzj9B0mBFQmlqeEA= 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 1586727059409373.2185806224626; Sun, 12 Apr 2020 14:30:59 -0700 (PDT) Received: from localhost ([::1]:37256 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jNkBt-0003Lr-10 for importer@patchew.org; Sun, 12 Apr 2020 17:30:57 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42945) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jNkAp-0001lZ-I6 for qemu-devel@nongnu.org; Sun, 12 Apr 2020 17:29:52 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jNkAo-0006kB-Fm for qemu-devel@nongnu.org; Sun, 12 Apr 2020 17:29:51 -0400 Received: from mail-wm1-x341.google.com ([2a00:1450:4864:20::341]:55609) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1jNkAo-0006jD-A5; Sun, 12 Apr 2020 17:29:50 -0400 Received: by mail-wm1-x341.google.com with SMTP id e26so7840227wmk.5; Sun, 12 Apr 2020 14:29:50 -0700 (PDT) Received: from localhost.localdomain (116.red-83-42-57.dynamicip.rima-tde.net. [83.42.57.116]) by smtp.gmail.com with ESMTPSA id r3sm12797798wrm.35.2020.04.12.14.29.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 12 Apr 2020 14:29:48 -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=0Gwk+omGQ520vgI5+JQYZuT2VgvX+0dicPgG2UZcDzk=; b=eVimAW8LJ/3xN40DXev6aOL40qLrsVif/IsVb6ny9/OwZqDC+VMIn70ECpdnTN3uQP F+Xoxh4izpZsb0+NLHgvxk52FzjcDsA52BYsZKrYCTVhwjhV7Z7AZ9CKN1zzWLFOBp+V PIf9Inf9RzZTxq3ClaKllBmEkeP6h2mfm5nJRPVQl1rJ+7uEvwx2iZNo8enFaF4vm3l8 rgsVHfGeor8XCC/UlxbUqg+Ktxbqwi/0N4GElg0l4HH0VxB3FO5PuMqgPx5ZuWOH2n2x psIe7nyIMEqKO6lF0cGuSXfMteMM9c6hWBL3YTZv+Uh2cjkBNMWYdlGUTHM1HRKMsNA8 Zasw== 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=0Gwk+omGQ520vgI5+JQYZuT2VgvX+0dicPgG2UZcDzk=; b=X5TNt+31ZXHAml+0dskDQZH4PFt4fHXKtYCzs/07uBV0tSJcvHLotnmUCzq9oi4Mxl j23wWt1UudVZc0JyeTQhAfgqXoh0CQ6iu1yJmWgaaAMDRUk7uNWmVXjhTUAhfW8Z0eTv DmFq9N0VLDh7pCT45MkGbkhNb8W/+av3y5EOI00H6PpiG3bC6+PTE+Lj4tBd0vY7cbEY b7PC9DZr+ncK+ZwK189pTPUApBjAlkmmOBcTEjQteMheZy9oATA/HqvAxAiiShubZDOS j47PhTnbRUphTRg0K3nkGzoyO+OLcaOSUNQdGaFh6JYsLigoNGYqShZF0C1/6WoYYk73 8bkw== X-Gm-Message-State: AGi0Pub91yTgiPkkRbihQsqvkIpUUrsVwMQsWynfJVGIaWpm94lezGa2 YITRnTawW56H5zvCTpxSS2vM/YUXMhc= X-Google-Smtp-Source: APiQypKfJyIo22oyMsO5+U7aw2dN66I1B2tx9eKMzXjP+oytyf38uq2SIyrHTIR3W8qlyCFOBBHtew== X-Received: by 2002:a1c:750a:: with SMTP id o10mr15561640wmc.161.1586726989044; Sun, 12 Apr 2020 14:29:49 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH-for-5.1 2/3] hw/mips/mips_int: Use qdev gpio rather than qemu_allocate_irqs() Date: Sun, 12 Apr 2020 23:29:42 +0200 Message-Id: <20200412212943.4117-3-f4bug@amsat.org> X-Mailer: git-send-email 2.21.1 In-Reply-To: <20200412212943.4117-1-f4bug@amsat.org> References: <20200412212943.4117-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 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::341 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: Peter Maydell , qemu-block@nongnu.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Aleksandar Markovic , Stafford Horne , John Snow , Aleksandar Rikalo , Aurelien Jarno Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Switch to using the qdev gpio API which is preferred over qemu_allocate_irqs(). One step to eventually deprecate and remove qemu_allocate_irqs() one day. Patch created mechanically using spatch with this script inspired from commit d6ef883d9d7: @@ typedef qemu_irq; identifier irqs, handler; expression opaque, count, i; @@ - qemu_irq *irqs; ... - irqs =3D qemu_allocate_irqs(handler, opaque, count); + qdev_init_gpio_in(DEVICE(opaque), handler, count); <+... - irqs[i] + qdev_get_gpio_in(DEVICE(opaque), i) ...+> ?- g_free(irqs); Inspired-by: Peter Maydell Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- hw/mips/mips_int.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/hw/mips/mips_int.c b/hw/mips/mips_int.c index 796730b11d..91788c51a9 100644 --- a/hw/mips/mips_int.c +++ b/hw/mips/mips_int.c @@ -74,14 +74,12 @@ static void cpu_mips_irq_request(void *opaque, int irq,= int level) void cpu_mips_irq_init_cpu(MIPSCPU *cpu) { CPUMIPSState *env =3D &cpu->env; - qemu_irq *qi; int i; =20 - qi =3D qemu_allocate_irqs(cpu_mips_irq_request, cpu, 8); + qdev_init_gpio_in(DEVICE(cpu), cpu_mips_irq_request, 8); for (i =3D 0; i < 8; i++) { - env->irq[i] =3D qi[i]; + env->irq[i] =3D qdev_get_gpio_in(DEVICE(cpu), i); } - g_free(qi); } =20 void cpu_mips_soft_irq(CPUMIPSState *env, int irq, int level) --=20 2.21.1 From nobody Mon Feb 9 06:36:49 2026 Delivered-To: importer@patchew.org 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; 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=1586727129; cv=none; d=zohomail.com; s=zohoarc; b=iplR8mv6im7LpQeXQM87W3fztNI2JSL50Jqzsb11Xo8S5lj9HVPb7RLJZ26J2lR7MOMzDXqapSahg83Pl9YYhd7GbfFPrxqLxrEdOmm8w5sQbXvpwVOHl5Ri/4sh9M+AXw53SgzNUA8rdI/Co0vIq4BcHgOMB7sjFkXL0oDgUIw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1586727129; 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=9lG55JXMQua8faxEthIzl+F4nOkWKVo0aZHxcdKHaR4=; b=NvMtNRbAn9iJZeHl8I9I/K+Hcm3mQm9SE08Cpm0W3QzacNKLmCswoTdnEnd/32pRo3qRFXWVP/meI3EzLpN79dItn/tHWgHyv0fu1g/Gfltlv+65tYWh3HwINcZOMmiPfS2kZD7cf08nHC0lVUnN65rFpsUrnaSrintJfCodbog= 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 1586727129017568.6602370717972; Sun, 12 Apr 2020 14:32:09 -0700 (PDT) Received: from localhost ([::1]:37270 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jNkD1-000586-SY for importer@patchew.org; Sun, 12 Apr 2020 17:32:07 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42971) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jNkAr-0001nG-5i for qemu-devel@nongnu.org; Sun, 12 Apr 2020 17:29:54 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jNkAp-0006lJ-Ug for qemu-devel@nongnu.org; Sun, 12 Apr 2020 17:29:53 -0400 Received: from mail-wm1-x341.google.com ([2a00:1450:4864:20::341]:39534) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1jNkAp-0006kp-Of; Sun, 12 Apr 2020 17:29:51 -0400 Received: by mail-wm1-x341.google.com with SMTP id y24so8277577wma.4; Sun, 12 Apr 2020 14:29:51 -0700 (PDT) Received: from localhost.localdomain (116.red-83-42-57.dynamicip.rima-tde.net. [83.42.57.116]) by smtp.gmail.com with ESMTPSA id r3sm12797798wrm.35.2020.04.12.14.29.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 12 Apr 2020 14:29:50 -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=9lG55JXMQua8faxEthIzl+F4nOkWKVo0aZHxcdKHaR4=; b=M39Dooprl3wwdtg2b5n978XBAC/jF0BInH3Bg7/oC0gnyGhXOoEfEcSBWZRu4SzdxL HPdd7U1QCUPcWaZGjRvCbbPuA85YbcXG2nM1DNxghcrC1HwS4z9it5p4A9wpxbwTYpwQ rrFf3mwiHuQSRTYpc5Nih5oqTQEhLl7mp0EgCfE4mwUddJAcfZx4Y44DD4WfzKc8KYmX R+A33+zXqxhX12Eg0U8UIA4XkJXjkEeTqBH77cG/O5cQ7UTMnASQaAy7OB+anXNGIypT 7cdXEU0FWVIBZwQ/lGjVrwihiMz0+vUo2N7u6YA6mzBMDjR+lJBDThplXzzJKZf58U4W tY8A== 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=9lG55JXMQua8faxEthIzl+F4nOkWKVo0aZHxcdKHaR4=; b=Kgl/A4o7ybPqZurF1/Gn6kwC1HeVMl/HjNuQBIGIh9dXVAobYzY63K+rZ+Tz2XIs3k dTQg99xmxfqoZriESIPvpYFqEepseAF62HyZP2VllY7vqk2DHl+5FxM99KTcxP4wHsBX xtkixoHE5cJgrkSq143j2XmuRgzGulbaLwyyK3NIzVTHvVPVuLB7EJzBmD4AASuKTL3w 8CCO2Sj3fGouZHRHrX/BZIv+qzRtvJg2dnTIWH17vlKmY6F0QHn2Yf0I14WuW18oysGh GomrxkovUYpuvZpMs+ks06FM4k+K815Tw4tI58jAuOggB+IRl7Yzxa1yW+9IoheUIYb5 grJQ== X-Gm-Message-State: AGi0PuakwOCPdIINE7LR96iQZQ+//QgOz8Heck0BXVDchh0ho4KTwLoE KPKWE+M9TpI2mUTC5IZuaoH8OKJfs/U= X-Google-Smtp-Source: APiQypJc13zYA2Q3cYQT/I1V6ApoG6BuwgCFN3OnrUudz63oz3i+ZdxN2eJgQjk0NZd6VxBKVyzbVw== X-Received: by 2002:a1c:4346:: with SMTP id q67mr15311842wma.162.1586726990649; Sun, 12 Apr 2020 14:29:50 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH-for-5.0? 3/3] hw/openrisc/pic_cpu: Use qdev gpio rather than qemu_allocate_irqs() Date: Sun, 12 Apr 2020 23:29:43 +0200 Message-Id: <20200412212943.4117-4-f4bug@amsat.org> X-Mailer: git-send-email 2.21.1 In-Reply-To: <20200412212943.4117-1-f4bug@amsat.org> References: <20200412212943.4117-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 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::341 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: Peter Maydell , qemu-block@nongnu.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Aleksandar Markovic , Stafford Horne , John Snow , Aleksandar Rikalo , Aurelien Jarno Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Switch to using the qdev gpio API which is preferred over qemu_allocate_irqs(). Doing so we also stop leaking the allocated memory. One step to eventually deprecate and remove qemu_allocate_irqs() one day. Patch created mechanically using spatch with this script inspired from commit d6ef883d9d7: @@ typedef qemu_irq; identifier irqs, handler; expression opaque, count, i; @@ - qemu_irq *irqs; ... - irqs =3D qemu_allocate_irqs(handler, opaque, count); + qdev_init_gpio_in(DEVICE(opaque), handler, count); <+... - irqs[i] + qdev_get_gpio_in(DEVICE(opaque), i) ...+> ?- g_free(irqs); Inspired-by: Peter Maydell Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- hw/openrisc/pic_cpu.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/hw/openrisc/pic_cpu.c b/hw/openrisc/pic_cpu.c index 36f9350830..4b0c92f842 100644 --- a/hw/openrisc/pic_cpu.c +++ b/hw/openrisc/pic_cpu.c @@ -52,10 +52,9 @@ static void openrisc_pic_cpu_handler(void *opaque, int i= rq, int level) void cpu_openrisc_pic_init(OpenRISCCPU *cpu) { int i; - qemu_irq *qi; - qi =3D qemu_allocate_irqs(openrisc_pic_cpu_handler, cpu, NR_IRQS); + qdev_init_gpio_in(DEVICE(cpu), openrisc_pic_cpu_handler, NR_IRQS); =20 for (i =3D 0; i < NR_IRQS; i++) { - cpu->env.irq[i] =3D qi[i]; + cpu->env.irq[i] =3D qdev_get_gpio_in(DEVICE(cpu), i); } } --=20 2.21.1