From patchwork Thu Jun 1 15:56:14 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Antonio Borneo X-Patchwork-Id: 102071 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp459329vqr; Thu, 1 Jun 2023 09:31:43 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4Nyfxhl+RowUls2zHyH5OWoM+0vG3kmBZx5Qo2xuMAUP+h3vIpZiCX7IIk6IwVvhgbGGc+ X-Received: by 2002:a17:90a:6888:b0:255:99bc:9310 with SMTP id a8-20020a17090a688800b0025599bc9310mr2068pjd.3.1685637103494; Thu, 01 Jun 2023 09:31:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685637103; cv=none; d=google.com; s=arc-20160816; b=lIZKr/GYf9fpWn2Zy65E0hpf43KY+zzz4VQhkcrROzQpOydyqwZXSuJt7LXNG+6c9A txpMxMJ+bB9k2P5NQUCUlgPkVGrnE65PZ7xdykaWErAyUCBYaERkH4QOhiposdBoOUZj wNdrW54Mz5m6WHCbfcZS3XrhMmG6BvcItfYJ/dlTw8Bo3bhp5QXqjsXVvSUbDoAclLBx vmOZO7XfgtjSPv6tTXdFz+CgVbhKXqBm49B+a3yr5bcY4d6XGNpIlJZN4heV5dtbvuLi l0lC5DqZXdCgpXBtSRDEtpHCfhhhxj8O7uV1Eb2rNaFCgdoUL7obgFBoY0uekThmvvdv UQLw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=J2XhhDlTFWe9QBoqWhVSk0LMiIjX30rM1uG7DPXXW5A=; b=aGpXlDg+ROGPrSB0d3PojnSNnoiPeSQyEP+SririBsXmOKMUIbB8BafrOYzhRvmk0a 1wNjYgJvQP2717zqvUjDpf1tIU7jj9mK2TpAyo0ofPGxG7kR3lq9bLFJR0NTzo9Y/o8i 6G6vcb1PsgXJsZ++KlXDKT6gvJSypZvbUDUNmQx6Jdjt31IGc8PtuM8Uhb6rS7WGQgs6 L0Kl5jTrDK34quFnEbQzjVIpoNzCVnWugRBY1JB0MSaF1HKxSwWcPcKFmVXjdBAmjg6c 9RieqsY0NUxPzX5oUt6VBqap98E8lmj4o72WuMaXtfJpZqzQtdvq81S1+mH9NjaMGXod M0zw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@foss.st.com header.s=selector1 header.b=klyqao+E; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=foss.st.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id a30-20020a63705e000000b0053f26705a25si3246407pgn.321.2023.06.01.09.31.29; Thu, 01 Jun 2023 09:31:43 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@foss.st.com header.s=selector1 header.b=klyqao+E; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=foss.st.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233439AbjFAP5W (ORCPT + 99 others); Thu, 1 Jun 2023 11:57:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56200 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229589AbjFAP5U (ORCPT ); Thu, 1 Jun 2023 11:57:20 -0400 Received: from mx07-00178001.pphosted.com (mx07-00178001.pphosted.com [185.132.182.106]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CA30AB3 for ; Thu, 1 Jun 2023 08:57:19 -0700 (PDT) Received: from pps.filterd (m0241204.ppops.net [127.0.0.1]) by mx07-00178001.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 351FHZik010627; Thu, 1 Jun 2023 17:56:32 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foss.st.com; h=from : to : cc : subject : date : message-id : mime-version : content-transfer-encoding : content-type; s=selector1; bh=J2XhhDlTFWe9QBoqWhVSk0LMiIjX30rM1uG7DPXXW5A=; b=klyqao+EHAhU8SFZOwnVtxMsM6VugNVH/EObvuG5duZlvFM74gJ285xS8cuur170CBNc 2UHC6W0gWtouEYboUdW/5CjV9XWv7lk2ipt7DjdAsSk2naih4ChgFu9ykAL2q7Utv+Lt bm/JHqZOYdU9pVct3SmDtZGUh/ftCglDjL62ZCgCbsMkP9liRq9FUB97R/l7uSV4dSu1 s/4LI9tzJP3x4X09dFF7PCPDBbqaxltt1iCKePet8ENQyfe52vJsZJHp+MidNHE4EQVA Vh2GE46fICar2lG87CQ8E38xPM9BaVjSin7h5q+XTTlxRniBUEfu0WsrPQBYNtjU6SZM Kw== Received: from beta.dmz-eu.st.com (beta.dmz-eu.st.com [164.129.1.35]) by mx07-00178001.pphosted.com (PPS) with ESMTPS id 3qx31524mj-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 01 Jun 2023 17:56:32 +0200 Received: from euls16034.sgp.st.com (euls16034.sgp.st.com [10.75.44.20]) by beta.dmz-eu.st.com (STMicroelectronics) with ESMTP id A2FA310002A; Thu, 1 Jun 2023 17:56:30 +0200 (CEST) Received: from Webmail-eu.st.com (shfdag1node1.st.com [10.75.129.69]) by euls16034.sgp.st.com (STMicroelectronics) with ESMTP id 97D6325AEE2; Thu, 1 Jun 2023 17:56:30 +0200 (CEST) Received: from localhost (10.48.0.39) by SHFDAG1NODE1.st.com (10.75.129.69) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.21; Thu, 1 Jun 2023 17:56:30 +0200 From: Antonio Borneo To: Thomas Gleixner , Marc Zyngier , Maxime Coquelin , Alexandre Torgue , Nathan Chancellor , Nick Desaulniers , Tom Rix , , , , CC: Antonio Borneo Subject: [PATCH] irqchip/stm32-exti: Fix warning on initialized field overwritten Date: Thu, 1 Jun 2023 17:56:14 +0200 Message-ID: <20230601155614.34490-1-antonio.borneo@foss.st.com> X-Mailer: git-send-email 2.40.1 MIME-Version: 1.0 X-Originating-IP: [10.48.0.39] X-ClientProxiedBy: SHFCAS1NODE1.st.com (10.75.129.72) To SHFDAG1NODE1.st.com (10.75.129.69) X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.957,Hydra:6.0.573,FMLib:17.11.176.26 definitions=2023-06-01_08,2023-05-31_03,2023-05-22_02 X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,RCVD_IN_DNSWL_LOW,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1767518611458884442?= X-GMAIL-MSGID: =?utf-8?q?1767518611458884442?= While compiling with W=1, both gcc and clang complain about a tricky way to initialize an array by filling it with a non-zero value and then overrride some of the array elements. In this case the override is intentional, so just disable the specific warning for only this part of the code. Note: the flag "-Woverride-init" is recognized by both compilers, but the warning msg from clang reports "-Winitializer-overrides". The doc of clang clarifies that the two flags are synonyms, so use here only the flag name common on both compilers. Signed-off-by: Antonio Borneo Fixes: c297493336b7 ("irqchip/stm32-exti: Simplify irq description table") --- drivers/irqchip/irq-stm32-exti.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) base-commit: 7877cb91f1081754a1487c144d85dc0d2e2e7fc4 diff --git a/drivers/irqchip/irq-stm32-exti.c b/drivers/irqchip/irq-stm32-exti.c index 6a3f7498ea8e..8bbb2b114636 100644 --- a/drivers/irqchip/irq-stm32-exti.c +++ b/drivers/irqchip/irq-stm32-exti.c @@ -173,6 +173,16 @@ static struct irq_chip stm32_exti_h_chip_direct; #define EXTI_INVALID_IRQ U8_MAX #define STM32MP1_DESC_IRQ_SIZE (ARRAY_SIZE(stm32mp1_exti_banks) * IRQS_PER_BANK) +/* + * Use some intentionally tricky logic here to initialize the whole array to + * EXTI_INVALID_IRQ, but then override certain fields, requiring us to indicate + * that we "know" that there are overrides in this structure, and we'll need to + * disable that warning from W=1 builds. + */ +__diag_push(); +__diag_ignore_all("-Woverride-init", + "logic to initialize all and then override some is OK"); + static const u8 stm32mp1_desc_irq[] = { /* default value */ [0 ... (STM32MP1_DESC_IRQ_SIZE - 1)] = EXTI_INVALID_IRQ, @@ -266,6 +276,8 @@ static const u8 stm32mp13_desc_irq[] = { [70] = 98, }; +__diag_pop(); + static const struct stm32_exti_drv_data stm32mp1_drv_data = { .exti_banks = stm32mp1_exti_banks, .bank_nr = ARRAY_SIZE(stm32mp1_exti_banks),