Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp254202rwd; Sat, 13 May 2023 17:52:53 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7mcTdI+eFo8w2hS5HVqSetpSN2/zQtI8wAaP+TKqzOgzzChv5NEZz2ZmAO4tyq0+DNozkL X-Received: by 2002:a05:6a20:7d8d:b0:103:ee82:dcb0 with SMTP id v13-20020a056a207d8d00b00103ee82dcb0mr13642409pzj.13.1684025573049; Sat, 13 May 2023 17:52:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684025573; cv=none; d=google.com; s=arc-20160816; b=Fv6/dlotg1zdCvtikqX1OZ8eIPNF794Q7BKbtwZtZ9d/qnDo6chFlyfSROSe0FrQN7 fyZJmQSrZgR99HyFRWWU19Kr1uNnKjdfC55imTnHAFGIwf65Vu0N5TWAHo2XdXSEINh0 WQxf+a40K93ISiNHWECHtQgyj7AUxuS4BaGkvo0BzVtdpCo/TydLOu4krXQEHyO8GEWg Q7R+ay7961yE6UcQUZQqa5WRu4eNSbqvhbpt2490OMTIuuD3OYBSIambF65NtYSsnfb4 LbCPIoOJS4Cg2r0OtC3cSp/n8BbVNEm4O0/JxMyQ1ORPaArdJNmn1o8jzCqv/7C6VwMh x1eA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=a8DGAZeeNBprHdNt9rHy2MA2uuRgLLByVn0u/B8r0r8=; b=eT163TOC70f3h32WpR7nyJ/C5+eK3dynoGffcDkuc7VoA+G2da6gopaRiq6UULNKzE eemydKqBBxsUn/A3wjHN5+VKPcxVWbel+nJ4odT+Atld3UZgi4fWicVt877M3WdLXlLq MOP3f4AojH7RtwuYNBiyr1Qwi7QqWJOGHQZ3piZLsBi5s7P+Sijzp9OneJkcOyAR01xP 6+XCNAoVKsSZ2OCLXChr80zx71lEhKmK9EkHfbiAKb8BhWPUO7YoZAg6P5e5NdJ7DLhs +IHcZY483EQTJ43SDog+Tv+cKZE1AzOGoOf4j9XANBkXEZ3eDhKxP20q5Qhpho9cah9h RNsw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=tCnekFwZ; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h131-20020a636c89000000b0051f0d0d6343si12160266pgc.688.2023.05.13.17.52.41; Sat, 13 May 2023 17:52:53 -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=tCnekFwZ; 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 S229589AbjEMXFj (ORCPT + 99 others); Sat, 13 May 2023 19:05:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41472 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229447AbjEMXFi (ORCPT ); Sat, 13 May 2023 19:05:38 -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 A9AAC1703 for ; Sat, 13 May 2023 16:05:36 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 3E9EE6148A for ; Sat, 13 May 2023 23:05:36 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 77D38C433D2; Sat, 13 May 2023 23:05:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1684019135; bh=NC/4k6idYM8q5OXvy5ko2aM3jnNAcvzlrnr9hZdq2vY=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=tCnekFwZHAPy4yc+M7eRwfX/4LFgCA2N6JPAH/eFQ+E9jo37+d6elhM580FWxeSpK WqDEkq1jJNh5pPzB0pcJbF0EQiBYh4m3uKx29ezHJR4kAPjJioLETHe7bJAYHnA3u5 MvCwTnlVkO2pllUe90JWjQF263Bgev4ypwNUNx2TnBlH3sHCOvlJCV+ns8tLzTYjb4 J6fyAmjcx0WADvr57oulthmatNgV5uhKbribjbYcKjh1F8lG2yski1vm2azMQKrIVD iSiv92UJkIyP5kiMzUoUUsXyK/1pYPRwNrM/+2hadRJVE7I//Lqf49t9VHDO1dlu7d BrKikUsbpvNPQ== Received: by pali.im (Postfix) id 864537F9; Sun, 14 May 2023 01:05:32 +0200 (CEST) Date: Sun, 14 May 2023 01:05:32 +0200 From: Pali =?utf-8?B?Um9ow6Fy?= To: Randy Dunlap Cc: linux-kernel@vger.kernel.org, Michael Ellerman , Nicholas Piggin , Christophe Leroy , linuxppc-dev@lists.ozlabs.org, Arnd Bergmann Subject: Re: [RFC PATCH] powerpc: udbg: export udbg_putc Message-ID: <20230513230532.ojjf2xkmkx4v4zdo@pali> References: <20230513055804.23775-1-rdunlap@infradead.org> <20230513091358.pzlexqnff5ydhlzf@pali> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: NeoMutt/20180716 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,T_SCC_BODY_TEXT_LINE 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: X-Mailing-List: linux-kernel@vger.kernel.org On Saturday 13 May 2023 15:53:19 Randy Dunlap wrote: > Hi Pali, > > On 5/13/23 02:13, Pali Rohár wrote: > > On Friday 12 May 2023 22:58:04 Randy Dunlap wrote: > >> In a randconfig with CONFIG_SERIAL_CPM=m and > >> CONFIG_PPC_EARLY_DEBUG_CPM=y, there is a build error: > >> ERROR: modpost: "udbg_putc" [drivers/tty/serial/cpm_uart/cpm_uart.ko] undefined! > >> > >> The build can be fixed by exporting "udbg_putc" in udbg.c. > >> > >> OTOH, maybe something like this is more appropriate in > >> arch/powerpc/Kconfig.debug? > >> > >> config PPC_EARLY_DEBUG_CPM > >> bool "Early serial debugging for Freescale CPM-based serial ports" > >> - depends on SERIAL_CPM > >> + depends on SERIAL_CPM=y > >> > >> Signed-off-by: Randy Dunlap > >> Cc: Michael Ellerman > >> Cc: Nicholas Piggin > >> Cc: Christophe Leroy > >> Cc: linuxppc-dev@lists.ozlabs.org > >> Cc: Arnd Bergmann > >> Cc: "Pali Rohár" > >> --- > >> arch/powerpc/kernel/udbg.c | 1 + > >> 1 file changed, 1 insertion(+) > >> > >> diff -- a/arch/powerpc/kernel/udbg.c b/arch/powerpc/kernel/udbg.c > >> --- a/arch/powerpc/kernel/udbg.c > >> +++ b/arch/powerpc/kernel/udbg.c > >> @@ -14,6 +14,7 @@ > >> #include > >> > >> void (*udbg_putc)(char c); > >> +EXPORT_SYMBOL(udbg_putc); > >> void (*udbg_flush)(void); > >> int (*udbg_getc)(void); > >> int (*udbg_getc_poll)(void); > > > > Hello! I do not think that it is a good idea to export udbg functions > > for kernel modules. I have quickly looked at the cpm_uart driver file > > Sure, that was just a conversation starter. > > > drivers/tty/serial/cpm_uart/cpm_uart_core.c and it looks like that once > > udbg from it is registered then there is no code for unregistering it. > > So I have feeling that compiling cpm_uart driver as module should not be > > allowed when CONFIG_SERIAL_CPM_CONSOLE is enabled, and early debug > > should depend on CONFIG_CONSOLE_POLL || CONFIG_SERIAL_CPM_CONSOLE. > > The other change above also fixes the build error: (Option 2) > > >> config PPC_EARLY_DEBUG_CPM > >> bool "Early serial debugging for Freescale CPM-based serial ports" > >> - depends on SERIAL_CPM > >> + depends on SERIAL_CPM=y > > > Also, making SERIAL_CPM (cpm_uart driver) be restricted to not allow it > as a module when SERIAL_CPM_CONSOLE is enabled [how does one express that > in Kconfig language?] will cause a circular dependency since SERIAL_CPM_CONSOLE > depends on SERIAL_CPM=y. It looks like you are suggesting reversing the > dependencies. I see that SERIAL_CPM_CONSOLE has already "depends on SERIAL_CPM=y". Am I right that this already disallow compiling cpm_uart driver as module when SERIAL_CPM_CONSOLE is enabled? > > Any other opinion? > > Yes, please. Otherwise I prefer my option 2. > > -- > ~Randy Option 2 looks like a better solution.