All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] platform/x86/siemens: simatic-ipc: fix nonsensical condition
@ 2023-08-11 13:09 Arnd Bergmann
  2023-08-11 13:17 ` Ilpo Järvinen
  0 siblings, 1 reply; 5+ messages in thread
From: Arnd Bergmann @ 2023-08-11 13:09 UTC (permalink / raw)
  To: Hans de Goede, Mark Gross, xingtong.wu
  Cc: Arnd Bergmann, Nathan Chancellor, Nick Desaulniers, Tom Rix,
	Henning Schild, Andy Shevchenko, Lee Jones, platform-driver-x86,
	linux-kernel, llvm

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(-)

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";
-- 
2.39.2


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] platform/x86/siemens: simatic-ipc: fix nonsensical condition
  2023-08-11 13:09 [PATCH] platform/x86/siemens: simatic-ipc: fix nonsensical condition Arnd Bergmann
@ 2023-08-11 13:17 ` Ilpo Järvinen
  2023-08-11 15:02   ` Arnd Bergmann
  0 siblings, 1 reply; 5+ messages in thread
From: Ilpo Järvinen @ 2023-08-11 13:17 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Hans de Goede, Mark Gross, xingtong.wu, Arnd Bergmann,
	Nathan Chancellor, Nick Desaulniers, Tom Rix, Henning Schild,
	Andy Shevchenko, Lee Jones, platform-driver-x86, linux-kernel,
	llvm

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>
> ---
>  drivers/platform/x86/siemens/simatic-ipc-batt.c | 3 ++-
>  drivers/platform/x86/siemens/simatic-ipc.c      | 3 ++-
>  2 files changed, 4 insertions(+), 2 deletions(-)
> 
> 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";

Thank you for the patch but these are already fixed by commits:

7abf253afa5c ("platform/x86/siemens: simatic-ipc-batt: fix logical error for BX-59A")
b01c1e022f7f ("platform/x86/siemens: simatic-ipc: fix logical error for BX-59A")


-- 
 i.


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] platform/x86/siemens: simatic-ipc: fix nonsensical condition
  2023-08-11 13:17 ` Ilpo Järvinen
@ 2023-08-11 15:02   ` Arnd Bergmann
  2023-08-13 12:59     ` Hans de Goede
       [not found]     ` <69fbdb7bb4d048bc9c5eb756bbf87f56@siemens.com>
  0 siblings, 2 replies; 5+ messages in thread
From: Arnd Bergmann @ 2023-08-11 15:02 UTC (permalink / raw)
  To: Ilpo Järvinen, Arnd Bergmann
  Cc: Hans de Goede, Mark Gross, xingtong.wu, Nathan Chancellor,
	Nick Desaulniers, Tom Rix, Henning Schild, Andy Shevchenko,
	Lee Jones, platform-driver-x86, linux-kernel, llvm

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] platform/x86/siemens: simatic-ipc: fix nonsensical condition
  2023-08-11 15:02   ` Arnd Bergmann
@ 2023-08-13 12:59     ` Hans de Goede
       [not found]     ` <69fbdb7bb4d048bc9c5eb756bbf87f56@siemens.com>
  1 sibling, 0 replies; 5+ messages in thread
From: Hans de Goede @ 2023-08-13 12:59 UTC (permalink / raw)
  To: Arnd Bergmann, Ilpo Järvinen, Arnd Bergmann
  Cc: Mark Gross, xingtong.wu, Nathan Chancellor, Nick Desaulniers,
	Tom Rix, Henning Schild, Andy Shevchenko, Lee Jones,
	platform-driver-x86, linux-kernel, llvm

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



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: FW: [PATCH] platform/x86/siemens: simatic-ipc: fix nonsensical condition
       [not found]       ` <7aa516e1.1dfc.189f22149f6.Coremail.xingtong_wu@163.com>
@ 2023-08-14  7:40         ` Arnd Bergmann
  0 siblings, 0 replies; 5+ messages in thread
From: Arnd Bergmann @ 2023-08-14  7:40 UTC (permalink / raw)
  To: xingtong.wu
  Cc: xingtong.wu, Ilpo Järvinen, Arnd Bergmann, Hans de Goede,
	Mark Gross, Nathan Chancellor, Nick Desaulniers, Tom Rix,
	Andy Shevchenko, Lee Jones, platform-driver-x86, linux-kernel,
	llvm, gerd.haeussler.ext, tobias.schaffner

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2023-08-14  7:40 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-08-11 13:09 [PATCH] platform/x86/siemens: simatic-ipc: fix nonsensical condition Arnd Bergmann
2023-08-11 13:17 ` Ilpo Järvinen
2023-08-11 15:02   ` Arnd Bergmann
2023-08-13 12:59     ` Hans de Goede
     [not found]     ` <69fbdb7bb4d048bc9c5eb756bbf87f56@siemens.com>
     [not found]       ` <7aa516e1.1dfc.189f22149f6.Coremail.xingtong_wu@163.com>
2023-08-14  7:40         ` FW: " Arnd Bergmann

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.