From patchwork Thu Sep 5 03:08:42 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Oliver O'Halloran X-Patchwork-Id: 1158184 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 46P5Jj6f6Rz9sDB for ; Thu, 5 Sep 2019 13:09:41 +1000 (AEST) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="haYDqcOw"; dkim-atps=neutral Received: from bilbo.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 46P5Jj51HKzDqyv for ; Thu, 5 Sep 2019 13:09:41 +1000 (AEST) X-Original-To: skiboot@lists.ozlabs.org Delivered-To: skiboot@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gmail.com (client-ip=2607:f8b0:4864:20::541; helo=mail-pg1-x541.google.com; envelope-from=oohall@gmail.com; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="haYDqcOw"; dkim-atps=neutral Received: from mail-pg1-x541.google.com (mail-pg1-x541.google.com [IPv6:2607:f8b0:4864:20::541]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 46P5Hx3kL9zDqRm for ; Thu, 5 Sep 2019 13:09:01 +1000 (AEST) Received: by mail-pg1-x541.google.com with SMTP id d1so561282pgp.4 for ; Wed, 04 Sep 2019 20:09:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=quw5kD2V6iZNKO9uAE+RdqbTtQ2SAerLddNaHoQEXLU=; b=haYDqcOwvLJRODvYy9SxFovQaeWaKnVsOSJVEJnuALgO/9CkTls12HSS8Hfsj5tYBd so93ZLJ03fz2Y+TfTUVL9IwxtV9eo3vcnj8Ze4FYT+kCuc300Eq1LGjXVRiXOs5pDuzV prfVfW2C9CVjJ1afKOnQ85YmXhGbSaNah9ysQ82BuBq/kc3/SnNHgTtEAIcoqdige4Cv Lh39dpeBSq8m/AvDIS+pGiR6w9Cs9/tSZARFktPL5umJjbhcq7JHCfl3X90eNAi5F6/F rxivulCodB/86HBJsnacsZQ1sxwIazc/0Oc/EUPuxNbTiB/cDNYjS/smUf3/CIt5LBcB 4VPA== 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=quw5kD2V6iZNKO9uAE+RdqbTtQ2SAerLddNaHoQEXLU=; b=bIx+SintdI/IZPHUbz16C/GhFbxPI/AguIZdE4AE9SzgDO6ypUQMNWdeHwQoabVeOC 8W1BKWdFunjpKONCjJYBt9Quebn+P6MRtIz6/3GBmwCtFVUwXzRnX8Uz+CThmdFo+Zcy iok5nSJ7oXlzayn4DwQKs3cTV1cbiJzTyskPQfPbuUuqL+c8HSfc7nJYd0AzwmJHUFSM 37GNv1dYSkw1+R68/N3885tQxOsscI8c/cCZHyrTAPBLO3TkvAGUz0QggREfwUdTmE3g HHOrSetz7ueJ7qnvDWvRBHHaPZgfvL8TSN0R3B+J8Xt2P2I6/u1dj/ubdTLG3mP1FW0l E2Vg== X-Gm-Message-State: APjAAAXcks6m4IXyUxv9/UhQBfrmZ/nOl3kvPCSQXep+KhVZjFphhfk8 yP3hcnTqEOgj1cVY39xvW+xU9QnL X-Google-Smtp-Source: APXvYqy6NPtR06ZnJmtUoa+ZeSVw3sdgli5u0dERkcsPDNTcGISoYB7+XRJeU/nWohoe9/RS+vmUDA== X-Received: by 2002:a62:e910:: with SMTP id j16mr1133845pfh.123.1567652938694; Wed, 04 Sep 2019 20:08:58 -0700 (PDT) Received: from wafer.ozlabs.ibm.com.ozlabs.ibm.com ([122.99.82.10]) by smtp.gmail.com with ESMTPSA id p189sm545844pfp.163.2019.09.04.20.08.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 04 Sep 2019 20:08:58 -0700 (PDT) From: Oliver O'Halloran To: skiboot@lists.ozlabs.org Date: Thu, 5 Sep 2019 13:08:42 +1000 Message-Id: <20190905030845.15540-2-oohall@gmail.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190905030845.15540-1-oohall@gmail.com> References: <20190905030845.15540-1-oohall@gmail.com> MIME-Version: 1.0 Subject: [Skiboot] [PATCH v2 2/5] hw/psi-p9: Make interrupt name array global X-BeenThere: skiboot@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Mailing list for skiboot development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: skiboot-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Skiboot" The array is currently a static constant inside psi_p9_irq_name() which returns a malloc()ed pointer due to the API required by the interrupt source ops interface. Make the name array a static global and move it further up in the file so we can use it in other functions. Signed-off-by: Oliver O'Halloran Reviewed-by: Cédric Le Goater --- hw/psi.c | 54 +++++++++++++++++++++++++++--------------------------- 1 file changed, 27 insertions(+), 27 deletions(-) diff --git a/hw/psi.c b/hw/psi.c index a74c105ff0ec..99ec06ac488a 100644 --- a/hw/psi.c +++ b/hw/psi.c @@ -509,6 +509,33 @@ static const struct irq_source_ops psi_p8_irq_ops = { .name = psi_p8_irq_name, }; +static const char *p9_psi_int_names[P9_PSI_NUM_IRQS] = { + "psi:fsp", + "psi:occ", + "psi:fsi", + "psi:lpchc", + "psi:local_err", + "psi:global_err", + "psi:external", + "psi:lpc_serirq_mux0", /* Have a callback to get name ? */ + "psi:lpc_serirq_mux1", /* Have a callback to get name ? */ + "psi:lpc_serirq_mux2", /* Have a callback to get name ? */ + "psi:lpc_serirq_mux3", /* Have a callback to get name ? */ + "psi:i2c", + "psi:dio", + "psi:psu" +}; + +static char *psi_p9_irq_name(struct irq_source *is, uint32_t isn) +{ + struct psi *psi = is->data; + uint32_t idx = isn - psi->interrupt; + + if (idx >= ARRAY_SIZE(p9_psi_int_names)) + return NULL; + return strdup(p9_psi_int_names[idx]); +} + static void psihb_p9_interrupt(struct irq_source *is, uint32_t isn) { struct psi *psi = is->data; @@ -583,33 +610,6 @@ static uint64_t psi_p9_irq_attributes(struct irq_source *is __unused, return IRQ_ATTR_TARGET_OPAL | IRQ_ATTR_TYPE_LSI; } -static char *psi_p9_irq_name(struct irq_source *is, uint32_t isn) -{ - struct psi *psi = is->data; - uint32_t idx = isn - psi->interrupt; - - static const char *names[P9_PSI_NUM_IRQS] = { - "psi:fsp", - "psi:occ", - "psi:fsi", - "psi:lpchc", - "psi:local_err", - "psi:global_err", - "psi:external", - "psi:lpc_serirq_mux0", /* Have a callback to get name ? */ - "psi:lpc_serirq_mux1", /* Have a callback to get name ? */ - "psi:lpc_serirq_mux2", /* Have a callback to get name ? */ - "psi:lpc_serirq_mux3", /* Have a callback to get name ? */ - "psi:i2c", - "psi:dio", - "psi:psu" - }; - - if (idx >= P9_PSI_NUM_IRQS) - return NULL; - return strdup(names[idx]); -} - static const struct irq_source_ops psi_p9_irq_ops = { .interrupt = psihb_p9_interrupt, .attributes = psi_p9_irq_attributes,