From: Laurent Vivier <laurent@vivier.eu>
To: Finn Thain <fthain@telegraphics.com.au>, Brad Boyer <brad@allandria.com>
Cc: Greg KH <gregkh@linuxfoundation.org>,
linux-kernel@vger.kernel.org, linux-m68k@lists.linux-m68k.org,
Geert Uytterhoeven <geert@linux-m68k.org>,
linux-serial@vger.kernel.org, Paul Mackerras <paulus@samba.org>,
linuxppc-dev@lists.ozlabs.org, Joshua Thompson <funaho@jurai.org>
Subject: Re: [PATCH] serial: pmac_zilog: don't init if zilog is not available
Date: Wed, 21 Oct 2020 09:54:17 +0200 [thread overview]
Message-ID: <311d17ed-75fa-a7fe-6c70-177a6eec4519@vivier.eu> (raw)
In-Reply-To: <alpine.LNX.2.23.453.2010211038390.6@nippy.intranet>
Le 21/10/2020 à 01:43, Finn Thain a écrit :
> On Tue, 20 Oct 2020, Brad Boyer wrote:
>
>>
>> Wouldn't it be better to rearrange this code to only run if the devices
>> are present? This is a macio driver on pmac and a platform driver on
>> mac, so shouldn't it be possible to only run this code when the
>> appropriate entries are present in the right data structures?
>>
>> I didn't look at a lot of the other serial drivers, but some other mac
>> drivers have recently been updated to no longer have MACH_IS_MAC checks
>> due to being converted to platform drivers.
>>
>
> Actually, it's not simply a platform driver or macio driver. I think the
> console is supposed to be registered before the normal bus matching takes
> place. Hence this comment in pmac_zilog.c,
>
> /*
> * First, we need to do a direct OF-based probe pass. We
> * do that because we want serial console up before the
> * macio stuffs calls us back, and since that makes it
> * easier to pass the proper number of channels to
> * uart_register_driver()
> */
>
> Laurent, can we avoid the irq == 0 warning splat like this?
>
> diff --git a/drivers/tty/serial/pmac_zilog.c b/drivers/tty/serial/pmac_zilog.c
> index 96e7aa479961..7db600cd8cc7 100644
> --- a/drivers/tty/serial/pmac_zilog.c
> +++ b/drivers/tty/serial/pmac_zilog.c
> @@ -1701,8 +1701,10 @@ static int __init pmz_init_port(struct uart_pmac_port *uap)
> int irq;
>
> r_ports = platform_get_resource(uap->pdev, IORESOURCE_MEM, 0);
> + if (!r_ports)
> + return -ENODEV;
> irq = platform_get_irq(uap->pdev, 0);
> - if (!r_ports || irq <= 0)
> + if (irq <= 0)
> return -ENODEV;
>
> uap->port.mapbase = r_ports->start;
>
No, this doesn't fix the problem.
The message is still:
[ 0.000000] ------------[ cut here ]------------
[ 0.000000] WARNING: CPU: 0 PID: 0 at drivers/base/platform.c:224
platform_get_irq_optional+0x7a/0x80
[ 0.000000] 0 is an invalid IRQ number
[ 0.000000] Modules linked in:
[ 0.000000] CPU: 0 PID: 0 Comm: swapper Not tainted 5.9.0+ #324
[ 0.000000] Stack from 004e7f24:
004e7f24 0046c1d3 0046c1d3 0002cb26 004985fb
000000e0 00000009 00000000
0002cb6a 004985fb 000000e0 002a5b86 00000009
00000000 004e7f70 00553cc4
00000000 00000000 00000000 004985df 004e7f90
004e7ff8 002a5b86 004985fb
000000e0 00000009 004985df 004eb290 002a5bd2
004eb290 00000000 00553cc4
0057bb66 00553cc4 00573d6e 004eb290 00000000
00573d38 0021c42c 00573e06
00553cc4 0046df15 00583a7c 00573e58 00564b74
0005299a 0055ce34 00000000
[ 0.000000] Call Trace: [<0002cb26>] __warn+0xb2/0xb4
[ 0.000000] [<0002cb6a>] warn_slowpath_fmt+0x42/0x64
[ 0.000000] [<002a5b86>] platform_get_irq_optional+0x7a/0x80
[ 0.000000] [<002a5b86>] platform_get_irq_optional+0x7a/0x80
[ 0.000000] [<002a5bd2>] platform_get_irq+0x16/0x42
[ 0.000000] [<00573d6e>] pmz_init_port+0x36/0x9e
[ 0.000000] [<00573d38>] pmz_init_port+0x0/0x9e
[ 0.000000] [<0021c42c>] strlen+0x0/0x14
[ 0.000000] [<00573e06>] pmz_probe+0x30/0x7e
[ 0.000000] [<00573e58>] pmz_console_init+0x4/0x22
[ 0.000000] [<00564b74>] console_init+0x1e/0x20
[ 0.000000] [<0005299a>] printk+0x0/0x18
[ 0.000000] [<0055ce34>] start_kernel+0x332/0x4c4
[ 0.000000] [<0055b8c6>] _sinittext+0x8c6/0x1268
[ 0.000000] ---[ end trace 32d780b8cd50b829 ]---
Thanks,
Laurent
next prev parent reply other threads:[~2020-10-21 8:02 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-10-20 16:23 [PATCH] serial: pmac_zilog: don't init if zilog is not available Laurent Vivier
2020-10-20 16:28 ` Greg KH
2020-10-20 16:37 ` Laurent Vivier
2020-10-20 17:37 ` Greg KH
2020-10-20 18:19 ` Laurent Vivier
2020-10-20 18:32 ` Greg KH
2020-10-20 18:42 ` Laurent Vivier
2020-10-20 22:44 ` Brad Boyer
2020-10-20 23:43 ` Finn Thain
2020-10-21 7:54 ` Laurent Vivier [this message]
2020-10-22 3:23 ` Finn Thain
2020-10-22 7:16 ` Laurent Vivier
2020-10-22 7:26 ` Geert Uytterhoeven
2020-10-23 3:21 ` Finn Thain
2020-10-22 2:52 ` Michael Ellerman
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=311d17ed-75fa-a7fe-6c70-177a6eec4519@vivier.eu \
--to=laurent@vivier.eu \
--cc=brad@allandria.com \
--cc=fthain@telegraphics.com.au \
--cc=funaho@jurai.org \
--cc=geert@linux-m68k.org \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-m68k@lists.linux-m68k.org \
--cc=linux-serial@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=paulus@samba.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).