* [PATCH] powerpc/legacy_serial: check CONFIG_SERIAL_8250_CONSOLE
@ 2023-06-09 0:33 Randy Dunlap
2023-06-09 8:08 ` Uwe Kleine-König
0 siblings, 1 reply; 2+ messages in thread
From: Randy Dunlap @ 2023-06-09 0:33 UTC (permalink / raw)
To: linux-kernel
Cc: Greg Kroah-Hartman, Randy Dunlap, Nicholas Piggin, linux-serial,
Uwe Kleine-König, linuxppc-dev
When SERIAL_8250_CONSOLE is not set but PPC_UDBG_16550=y,
the legacy_serial code references fsl8250_handle_irq, which is
only built when SERIAL_8250_CONSOLE is set.
Be consistent in referencing the used CONFIG_SERIAL_8250*
symbols so that the build errors do not happen.
Prevents these build errors:
powerpc-linux-ld: arch/powerpc/kernel/legacy_serial.o: in function `serial_dev_init':
legacy_serial.c:(.init.text+0x2aa): undefined reference to `fsl8250_handle_irq'
powerpc-linux-ld: legacy_serial.c:(.init.text+0x2b2): undefined reference to `fsl8250_handle_irq'
Fixes: 66eff0ef528b ("powerpc/legacy_serial: Warn about 8250 devices operated without active FSL workarounds")
Signed-off-by: Randy Dunlap <rdunlap@infradead.org>
Cc: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: linux-serial@vger.kernel.org
Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: Nicholas Piggin <npiggin@gmail.com>
Cc: Christophe Leroy <christophe.leroy@csgroup.eu>
Cc: linuxppc-dev@lists.ozlabs.org
---
arch/powerpc/kernel/legacy_serial.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff -- a/arch/powerpc/kernel/legacy_serial.c b/arch/powerpc/kernel/legacy_serial.c
--- a/arch/powerpc/kernel/legacy_serial.c
+++ b/arch/powerpc/kernel/legacy_serial.c
@@ -508,9 +508,9 @@ static void __init fixup_port_irq(int in
port->irq = virq;
- if (IS_ENABLED(CONFIG_SERIAL_8250) &&
+ if (IS_ENABLED(CONFIG_SERIAL_8250_CONSOLE) &&
of_device_is_compatible(np, "fsl,ns16550")) {
- if (IS_REACHABLE(CONFIG_SERIAL_8250)) {
+ if (IS_REACHABLE(CONFIG_SERIAL_8250_CONSOLE)) {
port->handle_irq = fsl8250_handle_irq;
port->has_sysrq = IS_ENABLED(CONFIG_SERIAL_8250_CONSOLE);
} else {
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] powerpc/legacy_serial: check CONFIG_SERIAL_8250_CONSOLE
2023-06-09 0:33 [PATCH] powerpc/legacy_serial: check CONFIG_SERIAL_8250_CONSOLE Randy Dunlap
@ 2023-06-09 8:08 ` Uwe Kleine-König
0 siblings, 0 replies; 2+ messages in thread
From: Uwe Kleine-König @ 2023-06-09 8:08 UTC (permalink / raw)
To: Randy Dunlap
Cc: Greg Kroah-Hartman, linux-kernel, Nicholas Piggin, linux-serial,
linuxppc-dev
[-- Attachment #1: Type: text/plain, Size: 3692 bytes --]
Hello Randy,
On Thu, Jun 08, 2023 at 05:33:28PM -0700, Randy Dunlap wrote:
> When SERIAL_8250_CONSOLE is not set but PPC_UDBG_16550=y,
> the legacy_serial code references fsl8250_handle_irq, which is
> only built when SERIAL_8250_CONSOLE is set.
>
> Be consistent in referencing the used CONFIG_SERIAL_8250*
> symbols so that the build errors do not happen.
>
> Prevents these build errors:
>
> powerpc-linux-ld: arch/powerpc/kernel/legacy_serial.o: in function `serial_dev_init':
> legacy_serial.c:(.init.text+0x2aa): undefined reference to `fsl8250_handle_irq'
> powerpc-linux-ld: legacy_serial.c:(.init.text+0x2b2): undefined reference to `fsl8250_handle_irq'
>
> Fixes: 66eff0ef528b ("powerpc/legacy_serial: Warn about 8250 devices operated without active FSL workarounds")
> Signed-off-by: Randy Dunlap <rdunlap@infradead.org>
> Cc: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> Cc: linux-serial@vger.kernel.org
> Cc: Michael Ellerman <mpe@ellerman.id.au>
> Cc: Nicholas Piggin <npiggin@gmail.com>
> Cc: Christophe Leroy <christophe.leroy@csgroup.eu>
> Cc: linuxppc-dev@lists.ozlabs.org
> ---
> arch/powerpc/kernel/legacy_serial.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff -- a/arch/powerpc/kernel/legacy_serial.c b/arch/powerpc/kernel/legacy_serial.c
> --- a/arch/powerpc/kernel/legacy_serial.c
> +++ b/arch/powerpc/kernel/legacy_serial.c
> @@ -508,9 +508,9 @@ static void __init fixup_port_irq(int in
>
> port->irq = virq;
>
> - if (IS_ENABLED(CONFIG_SERIAL_8250) &&
> + if (IS_ENABLED(CONFIG_SERIAL_8250_CONSOLE) &&
> of_device_is_compatible(np, "fsl,ns16550")) {
> - if (IS_REACHABLE(CONFIG_SERIAL_8250)) {
> + if (IS_REACHABLE(CONFIG_SERIAL_8250_CONSOLE)) {
> port->handle_irq = fsl8250_handle_irq;
> port->has_sysrq = IS_ENABLED(CONFIG_SERIAL_8250_CONSOLE);
> } else {
Argh, indeed there is a problem. Your patch however defeats the idea of
66eff0ef528b[1] which is still valid. And with your patch the else
branch that starts at the end of the above hunk is never taken.
With the feedback I got on
https://lore.kernel.org/linux-serial/20230605130857.85543-3-u.kleine-koenig@pengutronix.de
the probable outcome is that CONFIG_SERIAL_8250_FSL becomes tristate and
so the fix that is more future proof and keeps the warning, looks as
follows:
diff --git a/arch/powerpc/kernel/legacy_serial.c b/arch/powerpc/kernel/legacy_serial.c
index fdbd85aafeb1..6ee65741dbd5 100644
--- a/arch/powerpc/kernel/legacy_serial.c
+++ b/arch/powerpc/kernel/legacy_serial.c
@@ -510,7 +510,7 @@ static void __init fixup_port_irq(int index,
if (IS_ENABLED(CONFIG_SERIAL_8250) &&
of_device_is_compatible(np, "fsl,ns16550")) {
- if (IS_REACHABLE(CONFIG_SERIAL_8250)) {
+ if (IS_REACHABLE(CONFIG_SERIAL_8250_FSL)) {
port->handle_irq = fsl8250_handle_irq;
port->has_sysrq = IS_ENABLED(CONFIG_SERIAL_8250_CONSOLE);
} else {
This should to the right thing now (while CONFIG_SERIAL_8250_FSL is
still bool and only on if CONFIG_SERIAL_8250 is =y) and also once
CONFIG_SERIAL_8250_FSL can be =m (which would make fsl8250_handle_irq
not available for powerpc platform code).
But given that I screwed this up several times now, I will think about
this some more and do some more tests before submitting that as a proper
patch.
Best regards
Uwe
[1] Warn if the 8250 device is used but the required FSL workarounds are
not.
--
Pengutronix e.K. | Uwe Kleine-König |
Industrial Linux Solutions | https://www.pengutronix.de/ |
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2023-06-09 8:10 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-06-09 0:33 [PATCH] powerpc/legacy_serial: check CONFIG_SERIAL_8250_CONSOLE Randy Dunlap
2023-06-09 8:08 ` Uwe Kleine-König
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).