Message ID | 20230609003328.15008-1-rdunlap@infradead.org |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp632685vqr; Thu, 8 Jun 2023 17:43:49 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ45wl/t97lSZYwM5terFbkuxfWNK8l4TwwPZ4zsU7ejV9YS8z/n7GmGKIQLdWSpeBaGxaWu X-Received: by 2002:a05:6a00:234b:b0:661:a374:7688 with SMTP id j11-20020a056a00234b00b00661a3747688mr6331940pfj.12.1686271429532; Thu, 08 Jun 2023 17:43:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686271429; cv=none; d=google.com; s=arc-20160816; b=T19k6262bQc7E/lZcKsW4m3s+S0DyGpBgRSWsCFF3ju6c3kxhZ2SJJEtaHkKEbUjRS OrZyqZGxS9Aq0S39VMGuGqRutsgphmvEC5tk0PXaQ4DtWm1jZxu+4JZgF0DDo4/tFhiY q/E+oxanvLDGfAHWeyYK1oKDwZvWKOeKWYIJvsl2kJG4nwUAsIGYIQnicNXD+iKZSbsd 1Mj79XR/7UeaftZWJBAxcUXktBertgj62LxExricgPiJi4RKEh9zlK3s3hcMqeMbtwbe jAN0VRQEQSxONWXucb2cfnM/AH2jJieexpgr2ZT6oZOYZM/1g6Hp745XKTaNr4DajJ0K nYHw== 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=07+hV5uSDDJLUm8XLuemkRmQ1/NA1t2O44DKghOBv+g=; b=ZRMziSii9PAHpaOJOrCB9K0QEKLaib+wG8n4RTt8zM9eeVBy1pVUnzrD3ybmpi3s24 IcgyF7eTbWDVWrv3igZDaIpjkKlceJgKO3Jh7gKnJAnSoXoi6hUYUDj2YAQ+RyV607+3 nsVVI4rqfu16Im69DQWbv/Yy3V0pR5fn/liDV0K3ddhajpdkrtW6wIBRVqAIE3mWSQgn 1ZcS0SKctfvvwj+mD1y3N8NrvraeDQbmtqxWhGhEcuwL+hldchY8T07AaV/8MKh2nTUM ObHzyVSy8FV2Nao0eymR+WZbkwwTa7BETZOeo7ZELdZpPfl90Fegbu3x6m9XKrEoejr2 Jgfg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20210309 header.b=IMvII713; 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 Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id c195-20020a6335cc000000b0053ef547263bsi1711692pga.165.2023.06.08.17.43.37; Thu, 08 Jun 2023 17:43:49 -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=@infradead.org header.s=bombadil.20210309 header.b=IMvII713; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229927AbjFIAdg (ORCPT <rfc822;literming00@gmail.com> + 99 others); Thu, 8 Jun 2023 20:33:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46330 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231580AbjFIAdd (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Thu, 8 Jun 2023 20:33:33 -0400 Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 922DE30C8; Thu, 8 Jun 2023 17:33:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Transfer-Encoding: Content-Type:MIME-Version:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To: Content-ID:Content-Description:In-Reply-To:References; bh=07+hV5uSDDJLUm8XLuemkRmQ1/NA1t2O44DKghOBv+g=; b=IMvII713AqfhBro+1bWtv24I/j +na2Q4M5jPhrGex1+xBgwJL0Ky/SKldSBfpsGtbFPiBBFnb9l9+AsqffLboMQR8d0K5iDdoWwDseN gbqCEQytGNAcbJHkCh1mxMQ1cD+5qAOTVF09eFFTAZqj2Fg1MbsYZpd2VNEo//BquYL8hnIf9/2zB b49wKBH8ee/SdPPRUIUSHNUJBkdqBrL7SNx78waCio4SJeHUJ+kol/yEIl8/Pa9UvjlbMmxaFU2Tx mcMdMjwbFnejubjsdY34HDFghHtqnVZ+bfB9ME/YuyMr+QuPwJq9J+oiBdAXcD/ASdhluTmjTHidJ nIgwzJ1Q==; Received: from [2601:1c2:980:9ec0::2764] (helo=bombadil.infradead.org) by bombadil.infradead.org with esmtpsa (Exim 4.96 #2 (Red Hat Linux)) id 1q7Q4I-00B4uV-2L; Fri, 09 Jun 2023 00:33:30 +0000 From: Randy Dunlap <rdunlap@infradead.org> To: linux-kernel@vger.kernel.org Cc: Randy Dunlap <rdunlap@infradead.org>, =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= <u.kleine-koenig@pengutronix.de>, Greg Kroah-Hartman <gregkh@linuxfoundation.org>, linux-serial@vger.kernel.org, Michael Ellerman <mpe@ellerman.id.au>, Nicholas Piggin <npiggin@gmail.com>, Christophe Leroy <christophe.leroy@csgroup.eu>, linuxppc-dev@lists.ozlabs.org Subject: [PATCH] powerpc/legacy_serial: check CONFIG_SERIAL_8250_CONSOLE Date: Thu, 8 Jun 2023 17:33:28 -0700 Message-Id: <20230609003328.15008-1-rdunlap@infradead.org> X-Mailer: git-send-email 2.40.1 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_NONE,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED 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: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1768183750182237415?= X-GMAIL-MSGID: =?utf-8?q?1768183750182237415?= |
Series |
powerpc/legacy_serial: check CONFIG_SERIAL_8250_CONSOLE
|
|
Commit Message
Randy Dunlap
June 9, 2023, 12:33 a.m. UTC
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(-)
Comments
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.
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 {