Message ID | 20230811130948.2211800-1-arnd@kernel.org |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b824:0:b0:3f2:4152:657d with SMTP id z4csp1114114vqi; Fri, 11 Aug 2023 06:59:54 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGsVm/ir/VKEzd+Q/8+v8mlUbLrz0a1aPVCXhIvzb6i8u2tgm3booYnIsrm9NXOX6JGOlam X-Received: by 2002:a05:6870:638b:b0:1ba:c3a2:fb71 with SMTP id t11-20020a056870638b00b001bac3a2fb71mr2188872oap.31.1691762394537; Fri, 11 Aug 2023 06:59:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691762394; cv=none; d=google.com; s=arc-20160816; b=S7PWW3OAs4LHqCxoX1AYtHvVY/B0DKgW7wlH80Oj095Yc7QVE5aWgmANx1jMViy2Jk Lja58/KwV4UneJ3/RY9G7QG15h+b2gp44eohw86eNi1iDNrVA8TRt+Unh1zukpHK2G/i vJM8GniJRfGYT8XLwVYtKnUohWpTouMVomLSvWcUyFDLbzyA+m2WMFkWgnB9kkrkL9ty iDuOBH6lMncz/svonoUdJAgHTmx+h9u3MahNUgtvnTwm+qvbhetGVXvv/OE/MocAp3xv Ka5HxCp3r2nEec2udQXLhwMbN+WbwNISs7saiKaeW3zuLj+ODSThF3qUkgL7qj4kphxD wwsQ== 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=ViZwdji7bcerGZCtZSB7Fr8jaoBbs7gnrOPOfzZStNA=; fh=HgFVN0UVhJqpvcfbgrkrqHctofRnzNlKuiTF5f4u5DU=; b=LpiuPQ730lKtEHP0pOPTc0YnWnJ0p4O5rezYBnZluHsYp2J/kTNRifV9ol/H1KsT3A VwnCKFPRcriEI90uzOp1hBGsPMT7PcwF3vAH/oSS45+5LyahYAWsS5x4FDz+EcW+uUDG My4K0WK4OloZwOWN+eGVKVTvuzB5ewOb1w0d5K+G4AN39UqtuXSJjbu0wo1+gN9mt46P qeGODGBYeHWobfxCxLYNaAvia/zKKpP7tBfjqhv9L4o9gLzbifLEMGATyO5PHD4dNVbz 9XVm7rKNSKmomyEU4wdggbQJ95vSguOwQ+AWDxbyMQGboaBO7eJNt1oNGmlVgoUPyCVq VOTA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="KMd5/yq/"; 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=kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id l2-20020a17090ab70200b0025027e0ad3dsi3368739pjr.81.2023.08.11.06.59.41; Fri, 11 Aug 2023 06:59:54 -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=@kernel.org header.s=k20201202 header.b="KMd5/yq/"; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230266AbjHKNKI (ORCPT <rfc822;lanlanxiyiji@gmail.com> + 99 others); Fri, 11 Aug 2023 09:10:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45264 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234270AbjHKNJ6 (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Fri, 11 Aug 2023 09:09:58 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 09DFE3C1F; Fri, 11 Aug 2023 06:09:56 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 9437467295; Fri, 11 Aug 2023 13:09:55 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 288A8C433C7; Fri, 11 Aug 2023 13:09:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1691759395; bh=CV4wAGvRkjepbUTkalcJWPc/2oFP4dLVTcUCixdAodI=; h=From:To:Cc:Subject:Date:From; b=KMd5/yq/KlkT3JiCOLEwWROCjAVlvG0Bdh5KsKwgU4+4FLtpGzFIPS1I0NnN8aERC mzSf1EamTYcpYPQAqNsFqljdmPll8PF+Y1jOtDd+4YPL9fOiwEQkq9Y+u+wE5F/RGT VDHcT7Rk1T/PTNhkr9zbt353jdxV4HpV7xr93sjDLbiXHKE2iVnzx0djSdVCeO6wE+ qD9Dp7eq2rHWnMfWMrzKqoi6eeKzoOMosd2K+Y5Gej1LmMBwT10aYOG4YrFzOTxQPP l6/zjRHojkOImfwvYTHrqYhs61Hu0XaAXwj1Cd1R8TBNQ93p86woOUBmDWjjxfiNA0 sXqkgSqfDSIWg== From: Arnd Bergmann <arnd@kernel.org> To: Hans de Goede <hdegoede@redhat.com>, Mark Gross <markgross@kernel.org>, "xingtong.wu" <xingtong.wu@siemens.com> Cc: Arnd Bergmann <arnd@arndb.de>, Nathan Chancellor <nathan@kernel.org>, Nick Desaulniers <ndesaulniers@google.com>, Tom Rix <trix@redhat.com>, Henning Schild <henning.schild@siemens.com>, Andy Shevchenko <andriy.shevchenko@linux.intel.com>, Lee Jones <lee@kernel.org>, platform-driver-x86@vger.kernel.org, linux-kernel@vger.kernel.org, llvm@lists.linux.dev Subject: [PATCH] platform/x86/siemens: simatic-ipc: fix nonsensical condition Date: Fri, 11 Aug 2023 15:09:34 +0200 Message-Id: <20230811130948.2211800-1-arnd@kernel.org> X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS 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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1773941421163206178 X-GMAIL-MSGID: 1773941444452993601 |
Series |
platform/x86/siemens: simatic-ipc: fix nonsensical condition
|
|
Commit Message
Arnd Bergmann
Aug. 11, 2023, 1:09 p.m. UTC
From: Arnd Bergmann <arnd@arndb.de> The condition checking for a constant SIMATIC_IPC_DEVICE_BX_59A value clearly makes no sense, as clang warns: drivers/platform/x86/siemens/simatic-ipc.c:132:42: error: use of logical '||' with constant operand [-Werror,-Wconstant-logical-operand] if (ledmode == SIMATIC_IPC_DEVICE_227G || SIMATIC_IPC_DEVICE_BX_59A) ^ ~~~~~~~~~~~~~~~~~~~~~~~~~ drivers/platform/x86/siemens/simatic-ipc-batt.c:197:49: error: use of logical '||' with constant operand [-Werror,-Wconstant-logical-operand] if (priv.devmode == SIMATIC_IPC_DEVICE_BX_21A || SIMATIC_IPC_DEVICE_BX_59A) ^ ~~~~~~~~~~~~~~~~~~~~~~~~~ Most likely, this was meant to check ledmode to be one of the two values, so change it to that. Fixes: b8af77951941e ("platform/x86/siemens: simatic-ipc: add new models BX-56A/BX-59A") Fixes: c56beff203754 ("platform/x86/siemens: simatic-ipc-batt: add support for module BX-59A") Signed-off-by: Arnd Bergmann <arnd@arndb.de> --- drivers/platform/x86/siemens/simatic-ipc-batt.c | 3 ++- drivers/platform/x86/siemens/simatic-ipc.c | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-)
Comments
On Fri, Aug 11, 2023, at 15:17, Ilpo Järvinen wrote: > On Fri, 11 Aug 2023, Arnd Bergmann wrote: > >> From: Arnd Bergmann <arnd@arndb.de> >> >> The condition checking for a constant SIMATIC_IPC_DEVICE_BX_59A value >> clearly makes no sense, as clang warns: >> >> drivers/platform/x86/siemens/simatic-ipc.c:132:42: error: use of logical '||' with constant operand [-Werror,-Wconstant-logical-operand] >> if (ledmode == SIMATIC_IPC_DEVICE_227G || SIMATIC_IPC_DEVICE_BX_59A) >> ^ ~~~~~~~~~~~~~~~~~~~~~~~~~ >> drivers/platform/x86/siemens/simatic-ipc-batt.c:197:49: error: use of logical '||' with constant operand [-Werror,-Wconstant-logical-operand] >> if (priv.devmode == SIMATIC_IPC_DEVICE_BX_21A || SIMATIC_IPC_DEVICE_BX_59A) >> ^ ~~~~~~~~~~~~~~~~~~~~~~~~~ >> >> Most likely, this was meant to check ledmode to be one of the two values, >> so change it to that. >> >> Fixes: b8af77951941e ("platform/x86/siemens: simatic-ipc: add new models BX-56A/BX-59A") >> Fixes: c56beff203754 ("platform/x86/siemens: simatic-ipc-batt: add support for module BX-59A") >> Signed-off-by: Arnd Bergmann <arnd@arndb.de> Ok, I see. I missed those as there is hasn't been a new linux-next in a few days. I suppose this one is also fixed then? WARNING: unmet direct dependencies detected for P2SB Depends on [n]: PCI [=n] && X86 [=y] Selected by [m]: - SIEMENS_SIMATIC_IPC_WDT [=m] && WATCHDOG [=y] && SIEMENS_SIMATIC_IPC [=y] drivers/platform/x86/p2sb.c:68:9: error: call to undeclared function 'pci_scan_single_device'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration] Arnd
Hi, On 8/11/23 17:02, Arnd Bergmann wrote: > On Fri, Aug 11, 2023, at 15:17, Ilpo Järvinen wrote: >> On Fri, 11 Aug 2023, Arnd Bergmann wrote: >> >>> From: Arnd Bergmann <arnd@arndb.de> >>> >>> The condition checking for a constant SIMATIC_IPC_DEVICE_BX_59A value >>> clearly makes no sense, as clang warns: >>> >>> drivers/platform/x86/siemens/simatic-ipc.c:132:42: error: use of logical '||' with constant operand [-Werror,-Wconstant-logical-operand] >>> if (ledmode == SIMATIC_IPC_DEVICE_227G || SIMATIC_IPC_DEVICE_BX_59A) >>> ^ ~~~~~~~~~~~~~~~~~~~~~~~~~ >>> drivers/platform/x86/siemens/simatic-ipc-batt.c:197:49: error: use of logical '||' with constant operand [-Werror,-Wconstant-logical-operand] >>> if (priv.devmode == SIMATIC_IPC_DEVICE_BX_21A || SIMATIC_IPC_DEVICE_BX_59A) >>> ^ ~~~~~~~~~~~~~~~~~~~~~~~~~ >>> >>> Most likely, this was meant to check ledmode to be one of the two values, >>> so change it to that. >>> >>> Fixes: b8af77951941e ("platform/x86/siemens: simatic-ipc: add new models BX-56A/BX-59A") >>> Fixes: c56beff203754 ("platform/x86/siemens: simatic-ipc-batt: add support for module BX-59A") >>> Signed-off-by: Arnd Bergmann <arnd@arndb.de> > > Ok, I see. I missed those as there is hasn't been a new linux-next in > a few days. > > I suppose this one is also fixed then? > > WARNING: unmet direct dependencies detected for P2SB > Depends on [n]: PCI [=n] && X86 [=y] > Selected by [m]: > - SIEMENS_SIMATIC_IPC_WDT [=m] && WATCHDOG [=y] && SIEMENS_SIMATIC_IPC [=y] > drivers/platform/x86/p2sb.c:68:9: error: call to undeclared function 'pci_scan_single_device'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration] No that one has not been fixed yet. This is the first time I've heard of this one. It seems to not have been caught by the LKP bot. Regards, Hans
On Mon, Aug 14, 2023, at 05:40, xingtong.wu wrote: >>From: Arnd Bergmann <arnd@arndb.de> > >>Sent: Friday, August 11, 2023 11:02 PM >> >>Ok, I see. I missed those as there is hasn't been a new linux-next in a few days. >> >>I suppose this one is also fixed then? >> >>WARNING: unmet direct dependencies detected for P2SB >> Depends on [n]: PCI [=n] && X86 [=y] >> Selected by [m]: >> - SIEMENS_SIMATIC_IPC_WDT [=m] && WATCHDOG [=y] && SIEMENS_SIMATIC_IPC [=y] >>drivers/platform/x86/p2sb.c:68:9: error: call to undeclared function 'pci_scan_single_device'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration] > > I’m pretty sure your .config file is error to compile the kernel, > you must have changed the .config file manually, and there will be no > possibility that option SIEMENS_SIMATIC_IPC is [y] while PCI is [n]. > reason: > https://elixir.bootlin.com/linux/v6.5-rc6/source/drivers/platform/x86/Kconfig#L1079 > > if the PCI option is [n], the "p2sb.c" should never compile pass. > > I suggest you make menuconfig to build kernel and check your .config > carefully. It was broken in linux-next by commit b72da71ce24b0 ("platform/x86: simatic-ipc: drop PCI runtime depends and header"), I sent a fix now. Arnd
diff --git a/drivers/platform/x86/siemens/simatic-ipc-batt.c b/drivers/platform/x86/siemens/simatic-ipc-batt.c index d66b9969234bf..e6c12c52843ca 100644 --- a/drivers/platform/x86/siemens/simatic-ipc-batt.c +++ b/drivers/platform/x86/siemens/simatic-ipc-batt.c @@ -194,7 +194,8 @@ int simatic_ipc_batt_probe(struct platform_device *pdev, struct gpiod_lookup_tab if (table->table[2].key) { flags = GPIOD_OUT_HIGH; - if (priv.devmode == SIMATIC_IPC_DEVICE_BX_21A || SIMATIC_IPC_DEVICE_BX_59A) + if (priv.devmode == SIMATIC_IPC_DEVICE_BX_21A || + priv.devmode == SIMATIC_IPC_DEVICE_BX_59A) flags = GPIOD_OUT_LOW; priv.gpios[2] = devm_gpiod_get_index(dev, "CMOSBattery meter", 2, flags); if (IS_ERR(priv.gpios[2])) { diff --git a/drivers/platform/x86/siemens/simatic-ipc.c b/drivers/platform/x86/siemens/simatic-ipc.c index 02c540cf40702..e11d28ffac604 100644 --- a/drivers/platform/x86/siemens/simatic-ipc.c +++ b/drivers/platform/x86/siemens/simatic-ipc.c @@ -129,7 +129,8 @@ static int register_platform_devices(u32 station_id) pdevname = KBUILD_MODNAME "_leds"; if (ledmode == SIMATIC_IPC_DEVICE_127E) pdevname = KBUILD_MODNAME "_leds_gpio_apollolake"; - if (ledmode == SIMATIC_IPC_DEVICE_227G || SIMATIC_IPC_DEVICE_BX_59A) + if (ledmode == SIMATIC_IPC_DEVICE_227G || + ledmode == SIMATIC_IPC_DEVICE_BX_59A) pdevname = KBUILD_MODNAME "_leds_gpio_f7188x"; if (ledmode == SIMATIC_IPC_DEVICE_BX_21A) pdevname = KBUILD_MODNAME "_leds_gpio_elkhartlake";