Message ID | 20230615222152.13250-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 k13csp962513vqr; Thu, 15 Jun 2023 15:57:48 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5UXrPnM/E/72xcU/yKijQXjxV7gS45tRLlHICEsQrFAt/Y+SBHYgkJZZsKW/ezSYLioZU6 X-Received: by 2002:a05:6a00:1ace:b0:64f:835c:a9e5 with SMTP id f14-20020a056a001ace00b0064f835ca9e5mr477979pfv.16.1686869867771; Thu, 15 Jun 2023 15:57:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686869867; cv=none; d=google.com; s=arc-20160816; b=sHgmJIPiQTAOb2R11gadQsvWajnfMESse0GOrQVClSpoVFB1Y5NkglhgsPeWkSwaBY yIfmPyzooquG4AGhNBLlB/sDRXVTIdpaNdoFNJcS7cVynpNapI1YkLNaWvj3T50utVKn x8qK2AOwPlpXO6BbNzowwhWkfItgPssBn+zugyse27lvNLdWnne38jm4Vn3XZgyWBV0+ XaB/Pts3nSaNVSr/YCywicp8iIrEB8rUfCvupO+/z9HZHnq75zsYjoFIO9mVyIXHXt/h 46s/9yteI667RNmk1X6iw1YlTTeqtQlOUQIiPhVB3Cq9omJTe6kY+mymZKmcUJMz67cG bVXA== 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=dPvqZvPWD49EZocndBE+cOq6aWcEwgx21IcCTV3kPWU=; b=WRXtm1+9npop7Jt0qoakMzRXJomX1OHsTU/ewA1DqEYgx6wvVwZXrFkuCj0m2RZHIO iSBk5La+OLo/QUoyQTDVQegEF2SSrWEItHgI63fNEE666pBmMRRPrO1xV7ep92GnTJXt YzYvB9qkaMjCPtvD0H0x8agftEATByxsg46Y7YGMm1LtzVJdVQE3gdL2gmYIeCHs5uGr BAZe7jbNVMkwLJdO05qFdQktf9p6bM5Ot/3vQwH5sjXU0CDhvi4SWL/72kDqn/TA/cdQ SDJX4rfOfXfRgvfzyLAM07LCm9gYPgrTxinmYZHlUE5uVqiz1aJqYK0Le3sPvOOmE4jd rWkA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20210309 header.b=nJ5DGLdP; 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 w8-20020a63f508000000b0054fbd904b6dsi1640244pgh.500.2023.06.15.15.57.31; Thu, 15 Jun 2023 15:57:47 -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=nJ5DGLdP; 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 S237219AbjFOWV6 (ORCPT <rfc822;maxin.john@gmail.com> + 99 others); Thu, 15 Jun 2023 18:21:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56784 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229556AbjFOWV4 (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Thu, 15 Jun 2023 18:21:56 -0400 Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CEF541AA; Thu, 15 Jun 2023 15:21:55 -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: MIME-Version:Message-ID:Date:Subject:Cc:To:From:Sender:Reply-To:Content-Type: Content-ID:Content-Description:In-Reply-To:References; bh=dPvqZvPWD49EZocndBE+cOq6aWcEwgx21IcCTV3kPWU=; b=nJ5DGLdPFffwE/nRtF4TzMX1UU zbGuSTqzi3o+p7SQEQWb4v/wgmb9os811DUaQP4cisvEG+awPlPJuKZELSJ2Dq94TCE7T4HNsHv13 hBl0egJz5Ct+nk9Ds7bvNB3Q0mlzpJXPg//v39x9o22aVkmCxVDFU1KHzpG0lJymj9rdHWAkMQFpM U9nJ2tkgGEC9bZSikUnI+HdR6zlGS91a0weqGJyZacE2EknEjEx+gunCIPecSLLhvY0poayxCA3Yr XW6wbKGlpoDcyDCFeQ5cGYIKuZg3ljaUhIzgHPvhPWxDAkVcxPYS0cgdBy5K1tzJsNFP/6H1QZbnm oqNVar3g==; 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 1q9vLn-00GEwb-1d; Thu, 15 Jun 2023 22:21:55 +0000 From: Randy Dunlap <rdunlap@infradead.org> To: linux-kernel@vger.kernel.org Cc: Randy Dunlap <rdunlap@infradead.org>, Alexandra Winter <wintera@linux.ibm.com>, Wenjia Zhang <wenjia@linux.ibm.com>, linux-s390@vger.kernel.org, netdev@vger.kernel.org, Heiko Carstens <hca@linux.ibm.com>, Vasily Gorbik <gor@linux.ibm.com>, Alexander Gordeev <agordeev@linux.ibm.com>, Christian Borntraeger <borntraeger@linux.ibm.com>, Sven Schnelle <svens@linux.ibm.com> Subject: [PATCH] s390/net: lcs: use IS_ENABLED() for kconfig detection Date: Thu, 15 Jun 2023 15:21:52 -0700 Message-ID: <20230615222152.13250-1-rdunlap@infradead.org> X-Mailer: git-send-email 2.41.0 MIME-Version: 1.0 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 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?1768811258545231249?= X-GMAIL-MSGID: =?utf-8?q?1768811258545231249?= |
Series |
s390/net: lcs: use IS_ENABLED() for kconfig detection
|
|
Commit Message
Randy Dunlap
June 15, 2023, 10:21 p.m. UTC
When CONFIG_ETHERNET=m or CONFIG_FDDI=m, lcs.s has build errors or
warnings:
../drivers/s390/net/lcs.c:40:2: error: #error Cannot compile lcs.c without some net devices switched on.
40 | #error Cannot compile lcs.c without some net devices switched on.
../drivers/s390/net/lcs.c: In function 'lcs_startlan_auto':
../drivers/s390/net/lcs.c:1601:13: warning: unused variable 'rc' [-Wunused-variable]
1601 | int rc;
Solve this by using IS_ENABLED(CONFIG_symbol) instead of ifdef
CONFIG_symbol. The latter only works for builtin (=y) values
while IS_ENABLED() works for builtin or modular values.
Signed-off-by: Randy Dunlap <rdunlap@infradead.org>
Cc: Alexandra Winter <wintera@linux.ibm.com>
Cc: Wenjia Zhang <wenjia@linux.ibm.com>
Cc: linux-s390@vger.kernel.org
Cc: netdev@vger.kernel.org
Cc: Heiko Carstens <hca@linux.ibm.com>
Cc: Vasily Gorbik <gor@linux.ibm.com>
Cc: Alexander Gordeev <agordeev@linux.ibm.com>
Cc: Christian Borntraeger <borntraeger@linux.ibm.com>
Cc: Sven Schnelle <svens@linux.ibm.com>
---
drivers/s390/net/lcs.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
Comments
Hello: This patch was applied to netdev/net-next.git (main) by David S. Miller <davem@davemloft.net>: On Thu, 15 Jun 2023 15:21:52 -0700 you wrote: > When CONFIG_ETHERNET=m or CONFIG_FDDI=m, lcs.s has build errors or > warnings: > > ../drivers/s390/net/lcs.c:40:2: error: #error Cannot compile lcs.c without some net devices switched on. > 40 | #error Cannot compile lcs.c without some net devices switched on. > ../drivers/s390/net/lcs.c: In function 'lcs_startlan_auto': > ../drivers/s390/net/lcs.c:1601:13: warning: unused variable 'rc' [-Wunused-variable] > 1601 | int rc; > > [...] Here is the summary with links: - s390/net: lcs: use IS_ENABLED() for kconfig detection https://git.kernel.org/netdev/net-next/c/128272336120 You are awesome, thank you!
On 16.06.23 10:10, patchwork-bot+netdevbpf@kernel.org wrote: > Hello: > > This patch was applied to netdev/net-next.git (main) > by David S. Miller <davem@davemloft.net>: > > On Thu, 15 Jun 2023 15:21:52 -0700 you wrote: >> When CONFIG_ETHERNET=m or CONFIG_FDDI=m, lcs.s has build errors or >> warnings: >> IIUC, CONFIG_ETHERNET is bool. I reproduced this with CONFIG_ETHERNET=n and CONFIG_FDDI=m, and verified that it does compile with your patch. Thank you Randy for correcting this. >> ../drivers/s390/net/lcs.c:40:2: error: #error Cannot compile lcs.c without some net devices switched on. >> 40 | #error Cannot compile lcs.c without some net devices switched on. >> ../drivers/s390/net/lcs.c: In function 'lcs_startlan_auto': >> ../drivers/s390/net/lcs.c:1601:13: warning: unused variable 'rc' [-Wunused-variable] >> 1601 | int rc; >> >> [...] > > Here is the summary with links: > - s390/net: lcs: use IS_ENABLED() for kconfig detection > https://git.kernel.org/netdev/net-next/c/128272336120 > > You are awesome, thank you!
On 6/19/23 03:04, Alexandra Winter wrote: > > > On 16.06.23 10:10, patchwork-bot+netdevbpf@kernel.org wrote: >> Hello: >> >> This patch was applied to netdev/net-next.git (main) >> by David S. Miller <davem@davemloft.net>: >> >> On Thu, 15 Jun 2023 15:21:52 -0700 you wrote: >>> When CONFIG_ETHERNET=m or CONFIG_FDDI=m, lcs.s has build errors or >>> warnings: >>> > > IIUC, CONFIG_ETHERNET is bool. duh, yes. Thanks. > I reproduced this with CONFIG_ETHERNET=n and CONFIG_FDDI=m, > and verified that it does compile with your patch. > > Thank you Randy for correcting this. > >>> ../drivers/s390/net/lcs.c:40:2: error: #error Cannot compile lcs.c without some net devices switched on. >>> 40 | #error Cannot compile lcs.c without some net devices switched on. >>> ../drivers/s390/net/lcs.c: In function 'lcs_startlan_auto': >>> ../drivers/s390/net/lcs.c:1601:13: warning: unused variable 'rc' [-Wunused-variable] >>> 1601 | int rc; >>> >>> [...] >> >> Here is the summary with links: >> - s390/net: lcs: use IS_ENABLED() for kconfig detection >> https://git.kernel.org/netdev/net-next/c/128272336120 >> >> You are awesome, thank you! >
Hi, On 6/15/23 15:21, Randy Dunlap wrote: > When CONFIG_ETHERNET=m or CONFIG_FDDI=m, lcs.s has build errors or > warnings: > > ../drivers/s390/net/lcs.c:40:2: error: #error Cannot compile lcs.c without some net devices switched on. > 40 | #error Cannot compile lcs.c without some net devices switched on. > ../drivers/s390/net/lcs.c: In function 'lcs_startlan_auto': > ../drivers/s390/net/lcs.c:1601:13: warning: unused variable 'rc' [-Wunused-variable] > 1601 | int rc; > > Solve this by using IS_ENABLED(CONFIG_symbol) instead of ifdef > CONFIG_symbol. The latter only works for builtin (=y) values > while IS_ENABLED() works for builtin or modular values. > > Signed-off-by: Randy Dunlap <rdunlap@infradead.org> > Cc: Alexandra Winter <wintera@linux.ibm.com> > Cc: Wenjia Zhang <wenjia@linux.ibm.com> > Cc: linux-s390@vger.kernel.org > Cc: netdev@vger.kernel.org > Cc: Heiko Carstens <hca@linux.ibm.com> > Cc: Vasily Gorbik <gor@linux.ibm.com> > Cc: Alexander Gordeev <agordeev@linux.ibm.com> > Cc: Christian Borntraeger <borntraeger@linux.ibm.com> > Cc: Sven Schnelle <svens@linux.ibm.com> > --- > drivers/s390/net/lcs.c | 10 +++++----- > 1 file changed, 5 insertions(+), 5 deletions(-) > > diff -- a/drivers/s390/net/lcs.c b/drivers/s390/net/lcs.c > --- a/drivers/s390/net/lcs.c > +++ b/drivers/s390/net/lcs.c > @@ -36,7 +36,7 @@ > #include "lcs.h" > > > -#if !defined(CONFIG_ETHERNET) && !defined(CONFIG_FDDI) > +#if !IS_ENABLED(CONFIG_ETHERNET) && !IS_ENABLED(CONFIG_FDDI) > #error Cannot compile lcs.c without some net devices switched on. > #endif > > @@ -1601,14 +1601,14 @@ lcs_startlan_auto(struct lcs_card *card) > int rc; > > LCS_DBF_TEXT(2, trace, "strtauto"); > -#ifdef CONFIG_ETHERNET > +#if IS_ENABLED(CONFIG_ETHERNET) > card->lan_type = LCS_FRAME_TYPE_ENET; > rc = lcs_send_startlan(card, LCS_INITIATOR_TCPIP); > if (rc == 0) > return 0; > > #endif > -#ifdef CONFIG_FDDI > +#if IS_ENABLED(CONFIG_FDDI) > card->lan_type = LCS_FRAME_TYPE_FDDI; > rc = lcs_send_startlan(card, LCS_INITIATOR_TCPIP); > if (rc == 0) > @@ -2139,13 +2139,13 @@ lcs_new_device(struct ccwgroup_device *c > goto netdev_out; > } > switch (card->lan_type) { > -#ifdef CONFIG_ETHERNET > +#if IS_ENABLED(CONFIG_ETHERNET) > case LCS_FRAME_TYPE_ENET: > card->lan_type_trans = eth_type_trans; > dev = alloc_etherdev(0); > break; > #endif > -#ifdef CONFIG_FDDI > +#if IS_ENABLED(CONFIG_FDDI) > case LCS_FRAME_TYPE_FDDI: > card->lan_type_trans = fddi_type_trans; > dev = alloc_fddidev(0); kernel test robot reports build errors from this patch when ETHERNET=y, FDDI=m, LCS=y: https://lore.kernel.org/all/202306202129.pl0AqK8G-lkp@intel.com/ Since the code before my patch expected (supported) FDDI=y only (by checking for CONFIG_FDDI only and not checking for CONFIG_FDDI_MODULE), the best solution that I can see is to enforce that expectation in drivers/s390/net/Kconfig: diff -- a/drivers/s390/net/Kconfig b/drivers/s390/net/Kconfig --- a/drivers/s390/net/Kconfig +++ b/drivers/s390/net/Kconfig @@ -5,7 +5,7 @@ menu "S/390 network device drivers" config LCS def_tristate m prompt "Lan Channel Station Interface" - depends on CCW && NETDEVICES && (ETHERNET || FDDI) + depends on CCW && NETDEVICES && (ETHERNET || FDDI = y) help Select this option if you want to use LCS networking on IBM System z. This device driver supports FDDI (IEEE 802.7) and Ethernet. What do people think of that change? Any other ideas/suggestions? thanks.
On Tue, Jun 20, 2023 at 07:35:17PM -0700, Randy Dunlap wrote: > Hi, > > On 6/15/23 15:21, Randy Dunlap wrote: > > When CONFIG_ETHERNET=m or CONFIG_FDDI=m, lcs.s has build errors or > > warnings: > > > > ../drivers/s390/net/lcs.c:40:2: error: #error Cannot compile lcs.c without some net devices switched on. > > 40 | #error Cannot compile lcs.c without some net devices switched on. > > ../drivers/s390/net/lcs.c: In function 'lcs_startlan_auto': > > ../drivers/s390/net/lcs.c:1601:13: warning: unused variable 'rc' [-Wunused-variable] > > 1601 | int rc; > > > > Solve this by using IS_ENABLED(CONFIG_symbol) instead of ifdef > > CONFIG_symbol. The latter only works for builtin (=y) values > > while IS_ENABLED() works for builtin or modular values. > > > > Signed-off-by: Randy Dunlap <rdunlap@infradead.org> > > Cc: Alexandra Winter <wintera@linux.ibm.com> > > Cc: Wenjia Zhang <wenjia@linux.ibm.com> > > Cc: linux-s390@vger.kernel.org > > Cc: netdev@vger.kernel.org > > Cc: Heiko Carstens <hca@linux.ibm.com> > > Cc: Vasily Gorbik <gor@linux.ibm.com> > > Cc: Alexander Gordeev <agordeev@linux.ibm.com> > > Cc: Christian Borntraeger <borntraeger@linux.ibm.com> > > Cc: Sven Schnelle <svens@linux.ibm.com> > > --- > > drivers/s390/net/lcs.c | 10 +++++----- > > 1 file changed, 5 insertions(+), 5 deletions(-) > > > > diff -- a/drivers/s390/net/lcs.c b/drivers/s390/net/lcs.c > > --- a/drivers/s390/net/lcs.c > > +++ b/drivers/s390/net/lcs.c > > @@ -36,7 +36,7 @@ > > #include "lcs.h" > > > > > > -#if !defined(CONFIG_ETHERNET) && !defined(CONFIG_FDDI) > > +#if !IS_ENABLED(CONFIG_ETHERNET) && !IS_ENABLED(CONFIG_FDDI) > > #error Cannot compile lcs.c without some net devices switched on. > > #endif > > > > @@ -1601,14 +1601,14 @@ lcs_startlan_auto(struct lcs_card *card) > > int rc; > > > > LCS_DBF_TEXT(2, trace, "strtauto"); > > -#ifdef CONFIG_ETHERNET > > +#if IS_ENABLED(CONFIG_ETHERNET) > > card->lan_type = LCS_FRAME_TYPE_ENET; > > rc = lcs_send_startlan(card, LCS_INITIATOR_TCPIP); > > if (rc == 0) > > return 0; > > > > #endif > > -#ifdef CONFIG_FDDI > > +#if IS_ENABLED(CONFIG_FDDI) > > card->lan_type = LCS_FRAME_TYPE_FDDI; > > rc = lcs_send_startlan(card, LCS_INITIATOR_TCPIP); > > if (rc == 0) > > @@ -2139,13 +2139,13 @@ lcs_new_device(struct ccwgroup_device *c > > goto netdev_out; > > } > > switch (card->lan_type) { > > -#ifdef CONFIG_ETHERNET > > +#if IS_ENABLED(CONFIG_ETHERNET) > > case LCS_FRAME_TYPE_ENET: > > card->lan_type_trans = eth_type_trans; > > dev = alloc_etherdev(0); > > break; > > #endif > > -#ifdef CONFIG_FDDI > > +#if IS_ENABLED(CONFIG_FDDI) > > case LCS_FRAME_TYPE_FDDI: > > card->lan_type_trans = fddi_type_trans; > > dev = alloc_fddidev(0); > > > kernel test robot reports build errors from this patch when > ETHERNET=y, FDDI=m, LCS=y: > > https://lore.kernel.org/all/202306202129.pl0AqK8G-lkp@intel.com/ > > Since the code before my patch expected (supported) FDDI=y only > (by checking for CONFIG_FDDI only and not checking for CONFIG_FDDI_MODULE), > the best solution that I can see is to enforce that expectation in > drivers/s390/net/Kconfig: > > diff -- a/drivers/s390/net/Kconfig b/drivers/s390/net/Kconfig > --- a/drivers/s390/net/Kconfig > +++ b/drivers/s390/net/Kconfig > @@ -5,7 +5,7 @@ menu "S/390 network device drivers" > config LCS > def_tristate m > prompt "Lan Channel Station Interface" > - depends on CCW && NETDEVICES && (ETHERNET || FDDI) > + depends on CCW && NETDEVICES && (ETHERNET || FDDI = y) Hi Randy, Unfortunately I don't think this helps. In the config given at the link above, ETHERNET is y. And the error regarding fddi_type_trans and alloc_fddidev being undefined seems to occur regardless of your change. I did have better luck with this. diff --git a/drivers/s390/net/Kconfig b/drivers/s390/net/Kconfig index 9c67b97faba2..303220251495 100644 --- a/drivers/s390/net/Kconfig +++ b/drivers/s390/net/Kconfig @@ -6,6 +6,7 @@ config LCS def_tristate m prompt "Lan Channel Station Interface" depends on CCW && NETDEVICES && (ETHERNET || FDDI) + depends on FDDI=y || FDDI=n help Select this option if you want to use LCS networking on IBM System z. This device driver supports FDDI (IEEE 802.7) and Ethernet. I am assuming that LCS=m and FDDI=m can't work at runtime because there is no guarantee that FDDI is loaded before LCS. But I could well be wrong here. > help > Select this option if you want to use LCS networking on IBM System z. > This device driver supports FDDI (IEEE 802.7) and Ethernet. > > What do people think of that change? > Any other ideas/suggestions? > > thanks. > -- > ~Randy >
Hi Simon, On 6/21/23 08:53, Simon Horman wrote: > On Tue, Jun 20, 2023 at 07:35:17PM -0700, Randy Dunlap wrote: >> Hi, >> >> On 6/15/23 15:21, Randy Dunlap wrote: >>> When CONFIG_ETHERNET=m or CONFIG_FDDI=m, lcs.s has build errors or >>> warnings: >>> >>> ../drivers/s390/net/lcs.c:40:2: error: #error Cannot compile lcs.c without some net devices switched on. >>> 40 | #error Cannot compile lcs.c without some net devices switched on. >>> ../drivers/s390/net/lcs.c: In function 'lcs_startlan_auto': >>> ../drivers/s390/net/lcs.c:1601:13: warning: unused variable 'rc' [-Wunused-variable] >>> 1601 | int rc; >>> >>> Solve this by using IS_ENABLED(CONFIG_symbol) instead of ifdef >>> CONFIG_symbol. The latter only works for builtin (=y) values >>> while IS_ENABLED() works for builtin or modular values. >>> >>> Signed-off-by: Randy Dunlap <rdunlap@infradead.org> >>> Cc: Alexandra Winter <wintera@linux.ibm.com> >>> Cc: Wenjia Zhang <wenjia@linux.ibm.com> >>> Cc: linux-s390@vger.kernel.org >>> Cc: netdev@vger.kernel.org >>> Cc: Heiko Carstens <hca@linux.ibm.com> >>> Cc: Vasily Gorbik <gor@linux.ibm.com> >>> Cc: Alexander Gordeev <agordeev@linux.ibm.com> >>> Cc: Christian Borntraeger <borntraeger@linux.ibm.com> >>> Cc: Sven Schnelle <svens@linux.ibm.com> >>> --- >>> drivers/s390/net/lcs.c | 10 +++++----- >>> 1 file changed, 5 insertions(+), 5 deletions(-) >>> >>> diff -- a/drivers/s390/net/lcs.c b/drivers/s390/net/lcs.c >>> --- a/drivers/s390/net/lcs.c >>> +++ b/drivers/s390/net/lcs.c >>> @@ -36,7 +36,7 @@ >>> #include "lcs.h" >>> >>> >>> -#if !defined(CONFIG_ETHERNET) && !defined(CONFIG_FDDI) >>> +#if !IS_ENABLED(CONFIG_ETHERNET) && !IS_ENABLED(CONFIG_FDDI) >>> #error Cannot compile lcs.c without some net devices switched on. >>> #endif >>> >>> @@ -1601,14 +1601,14 @@ lcs_startlan_auto(struct lcs_card *card) >>> int rc; >>> >>> LCS_DBF_TEXT(2, trace, "strtauto"); >>> -#ifdef CONFIG_ETHERNET >>> +#if IS_ENABLED(CONFIG_ETHERNET) >>> card->lan_type = LCS_FRAME_TYPE_ENET; >>> rc = lcs_send_startlan(card, LCS_INITIATOR_TCPIP); >>> if (rc == 0) >>> return 0; >>> >>> #endif >>> -#ifdef CONFIG_FDDI >>> +#if IS_ENABLED(CONFIG_FDDI) >>> card->lan_type = LCS_FRAME_TYPE_FDDI; >>> rc = lcs_send_startlan(card, LCS_INITIATOR_TCPIP); >>> if (rc == 0) >>> @@ -2139,13 +2139,13 @@ lcs_new_device(struct ccwgroup_device *c >>> goto netdev_out; >>> } >>> switch (card->lan_type) { >>> -#ifdef CONFIG_ETHERNET >>> +#if IS_ENABLED(CONFIG_ETHERNET) >>> case LCS_FRAME_TYPE_ENET: >>> card->lan_type_trans = eth_type_trans; >>> dev = alloc_etherdev(0); >>> break; >>> #endif >>> -#ifdef CONFIG_FDDI >>> +#if IS_ENABLED(CONFIG_FDDI) >>> case LCS_FRAME_TYPE_FDDI: >>> card->lan_type_trans = fddi_type_trans; >>> dev = alloc_fddidev(0); >> >> >> kernel test robot reports build errors from this patch when >> ETHERNET=y, FDDI=m, LCS=y: >> >> https://lore.kernel.org/all/202306202129.pl0AqK8G-lkp@intel.com/ >> >> Since the code before my patch expected (supported) FDDI=y only >> (by checking for CONFIG_FDDI only and not checking for CONFIG_FDDI_MODULE), >> the best solution that I can see is to enforce that expectation in >> drivers/s390/net/Kconfig: >> >> diff -- a/drivers/s390/net/Kconfig b/drivers/s390/net/Kconfig >> --- a/drivers/s390/net/Kconfig >> +++ b/drivers/s390/net/Kconfig >> @@ -5,7 +5,7 @@ menu "S/390 network device drivers" >> config LCS >> def_tristate m >> prompt "Lan Channel Station Interface" >> - depends on CCW && NETDEVICES && (ETHERNET || FDDI) >> + depends on CCW && NETDEVICES && (ETHERNET || FDDI = y) > > Hi Randy, > > Unfortunately I don't think this helps. > In the config given at the link above, ETHERNET is y. > And the error regarding fddi_type_trans and alloc_fddidev being undefined > seems to occur regardless of your change. Hmph, somehow I missed that. :( > I did have better luck with this. > > diff --git a/drivers/s390/net/Kconfig b/drivers/s390/net/Kconfig > index 9c67b97faba2..303220251495 100644 > --- a/drivers/s390/net/Kconfig > +++ b/drivers/s390/net/Kconfig > @@ -6,6 +6,7 @@ config LCS > def_tristate m > prompt "Lan Channel Station Interface" > depends on CCW && NETDEVICES && (ETHERNET || FDDI) > + depends on FDDI=y || FDDI=n > help > Select this option if you want to use LCS networking on IBM System z. > This device driver supports FDDI (IEEE 802.7) and Ethernet. > > I am assuming that LCS=m and FDDI=m can't work at runtime > because there is no guarantee that FDDI is loaded before LCS. > But I could well be wrong here. There's probably some way to make that work, but I don't know. I think that your patch is acceptable. I would prefer to also add to the help text that if FDDI is used, it must be builtin (=y). >> help >> Select this option if you want to use LCS networking on IBM System z. >> This device driver supports FDDI (IEEE 802.7) and Ethernet. >> >> What do people think of that change? >> Any other ideas/suggestions? >> >> thanks. >> -- >> ~Randy >> Thanks for your help.
On Wed, Jun 21, 2023 at 11:08:05AM -0700, Randy Dunlap wrote: > Hi Simon, > > > On 6/21/23 08:53, Simon Horman wrote: > > On Tue, Jun 20, 2023 at 07:35:17PM -0700, Randy Dunlap wrote: > >> Hi, > >> > >> On 6/15/23 15:21, Randy Dunlap wrote: > >>> When CONFIG_ETHERNET=m or CONFIG_FDDI=m, lcs.s has build errors or > >>> warnings: > >>> > >>> ../drivers/s390/net/lcs.c:40:2: error: #error Cannot compile lcs.c without some net devices switched on. > >>> 40 | #error Cannot compile lcs.c without some net devices switched on. > >>> ../drivers/s390/net/lcs.c: In function 'lcs_startlan_auto': > >>> ../drivers/s390/net/lcs.c:1601:13: warning: unused variable 'rc' [-Wunused-variable] > >>> 1601 | int rc; > >>> > >>> Solve this by using IS_ENABLED(CONFIG_symbol) instead of ifdef > >>> CONFIG_symbol. The latter only works for builtin (=y) values > >>> while IS_ENABLED() works for builtin or modular values. > >>> > >>> Signed-off-by: Randy Dunlap <rdunlap@infradead.org> > >>> Cc: Alexandra Winter <wintera@linux.ibm.com> > >>> Cc: Wenjia Zhang <wenjia@linux.ibm.com> > >>> Cc: linux-s390@vger.kernel.org > >>> Cc: netdev@vger.kernel.org > >>> Cc: Heiko Carstens <hca@linux.ibm.com> > >>> Cc: Vasily Gorbik <gor@linux.ibm.com> > >>> Cc: Alexander Gordeev <agordeev@linux.ibm.com> > >>> Cc: Christian Borntraeger <borntraeger@linux.ibm.com> > >>> Cc: Sven Schnelle <svens@linux.ibm.com> > >>> --- > >>> drivers/s390/net/lcs.c | 10 +++++----- > >>> 1 file changed, 5 insertions(+), 5 deletions(-) > >>> > >>> diff -- a/drivers/s390/net/lcs.c b/drivers/s390/net/lcs.c > >>> --- a/drivers/s390/net/lcs.c > >>> +++ b/drivers/s390/net/lcs.c > >>> @@ -36,7 +36,7 @@ > >>> #include "lcs.h" > >>> > >>> > >>> -#if !defined(CONFIG_ETHERNET) && !defined(CONFIG_FDDI) > >>> +#if !IS_ENABLED(CONFIG_ETHERNET) && !IS_ENABLED(CONFIG_FDDI) > >>> #error Cannot compile lcs.c without some net devices switched on. > >>> #endif > >>> > >>> @@ -1601,14 +1601,14 @@ lcs_startlan_auto(struct lcs_card *card) > >>> int rc; > >>> > >>> LCS_DBF_TEXT(2, trace, "strtauto"); > >>> -#ifdef CONFIG_ETHERNET > >>> +#if IS_ENABLED(CONFIG_ETHERNET) > >>> card->lan_type = LCS_FRAME_TYPE_ENET; > >>> rc = lcs_send_startlan(card, LCS_INITIATOR_TCPIP); > >>> if (rc == 0) > >>> return 0; > >>> > >>> #endif > >>> -#ifdef CONFIG_FDDI > >>> +#if IS_ENABLED(CONFIG_FDDI) > >>> card->lan_type = LCS_FRAME_TYPE_FDDI; > >>> rc = lcs_send_startlan(card, LCS_INITIATOR_TCPIP); > >>> if (rc == 0) > >>> @@ -2139,13 +2139,13 @@ lcs_new_device(struct ccwgroup_device *c > >>> goto netdev_out; > >>> } > >>> switch (card->lan_type) { > >>> -#ifdef CONFIG_ETHERNET > >>> +#if IS_ENABLED(CONFIG_ETHERNET) > >>> case LCS_FRAME_TYPE_ENET: > >>> card->lan_type_trans = eth_type_trans; > >>> dev = alloc_etherdev(0); > >>> break; > >>> #endif > >>> -#ifdef CONFIG_FDDI > >>> +#if IS_ENABLED(CONFIG_FDDI) > >>> case LCS_FRAME_TYPE_FDDI: > >>> card->lan_type_trans = fddi_type_trans; > >>> dev = alloc_fddidev(0); > >> > >> > >> kernel test robot reports build errors from this patch when > >> ETHERNET=y, FDDI=m, LCS=y: > >> > >> https://lore.kernel.org/all/202306202129.pl0AqK8G-lkp@intel.com/ > >> > >> Since the code before my patch expected (supported) FDDI=y only > >> (by checking for CONFIG_FDDI only and not checking for CONFIG_FDDI_MODULE), > >> the best solution that I can see is to enforce that expectation in > >> drivers/s390/net/Kconfig: > >> > >> diff -- a/drivers/s390/net/Kconfig b/drivers/s390/net/Kconfig > >> --- a/drivers/s390/net/Kconfig > >> +++ b/drivers/s390/net/Kconfig > >> @@ -5,7 +5,7 @@ menu "S/390 network device drivers" > >> config LCS > >> def_tristate m > >> prompt "Lan Channel Station Interface" > >> - depends on CCW && NETDEVICES && (ETHERNET || FDDI) > >> + depends on CCW && NETDEVICES && (ETHERNET || FDDI = y) > > > > Hi Randy, > > > > Unfortunately I don't think this helps. > > In the config given at the link above, ETHERNET is y. > > And the error regarding fddi_type_trans and alloc_fddidev being undefined > > seems to occur regardless of your change. > > Hmph, somehow I missed that. :( > > > I did have better luck with this. > > > > diff --git a/drivers/s390/net/Kconfig b/drivers/s390/net/Kconfig > > index 9c67b97faba2..303220251495 100644 > > --- a/drivers/s390/net/Kconfig > > +++ b/drivers/s390/net/Kconfig > > @@ -6,6 +6,7 @@ config LCS > > def_tristate m > > prompt "Lan Channel Station Interface" > > depends on CCW && NETDEVICES && (ETHERNET || FDDI) > > + depends on FDDI=y || FDDI=n > > help > > Select this option if you want to use LCS networking on IBM System z. > > This device driver supports FDDI (IEEE 802.7) and Ethernet. > > > > I am assuming that LCS=m and FDDI=m can't work at runtime > > because there is no guarantee that FDDI is loaded before LCS. > > But I could well be wrong here. > > There's probably some way to make that work, but I don't know. > > I think that your patch is acceptable. > I would prefer to also add to the help text that if FDDI is used, > it must be builtin (=y). Thanks Randy, Feel free to take the snippet above and work it into a proper patch. Else I can take a shot at it. > >> help > >> Select this option if you want to use LCS networking on IBM System z. > >> This device driver supports FDDI (IEEE 802.7) and Ethernet. > >> > >> What do people think of that change? > >> Any other ideas/suggestions? > >> > >> thanks. > >> -- > >> ~Randy > >> > > Thanks for your help. > -- > ~Randy
On 6/21/23 12:37, Simon Horman wrote: > On Wed, Jun 21, 2023 at 11:08:05AM -0700, Randy Dunlap wrote: >> Hi Simon, >> >>> I did have better luck with this. >>> >>> diff --git a/drivers/s390/net/Kconfig b/drivers/s390/net/Kconfig >>> index 9c67b97faba2..303220251495 100644 >>> --- a/drivers/s390/net/Kconfig >>> +++ b/drivers/s390/net/Kconfig >>> @@ -6,6 +6,7 @@ config LCS >>> def_tristate m >>> prompt "Lan Channel Station Interface" >>> depends on CCW && NETDEVICES && (ETHERNET || FDDI) >>> + depends on FDDI=y || FDDI=n >>> help >>> Select this option if you want to use LCS networking on IBM System z. >>> This device driver supports FDDI (IEEE 802.7) and Ethernet. >>> >>> I am assuming that LCS=m and FDDI=m can't work at runtime >>> because there is no guarantee that FDDI is loaded before LCS. >>> But I could well be wrong here. >> >> There's probably some way to make that work, but I don't know. >> >> I think that your patch is acceptable. >> I would prefer to also add to the help text that if FDDI is used, >> it must be builtin (=y). > > Thanks Randy, > > Feel free to take the snippet above and work it into a proper patch. > Else I can take a shot at it. > OK, I'll send that. Thanks.
diff -- a/drivers/s390/net/lcs.c b/drivers/s390/net/lcs.c --- a/drivers/s390/net/lcs.c +++ b/drivers/s390/net/lcs.c @@ -36,7 +36,7 @@ #include "lcs.h" -#if !defined(CONFIG_ETHERNET) && !defined(CONFIG_FDDI) +#if !IS_ENABLED(CONFIG_ETHERNET) && !IS_ENABLED(CONFIG_FDDI) #error Cannot compile lcs.c without some net devices switched on. #endif @@ -1601,14 +1601,14 @@ lcs_startlan_auto(struct lcs_card *card) int rc; LCS_DBF_TEXT(2, trace, "strtauto"); -#ifdef CONFIG_ETHERNET +#if IS_ENABLED(CONFIG_ETHERNET) card->lan_type = LCS_FRAME_TYPE_ENET; rc = lcs_send_startlan(card, LCS_INITIATOR_TCPIP); if (rc == 0) return 0; #endif -#ifdef CONFIG_FDDI +#if IS_ENABLED(CONFIG_FDDI) card->lan_type = LCS_FRAME_TYPE_FDDI; rc = lcs_send_startlan(card, LCS_INITIATOR_TCPIP); if (rc == 0) @@ -2139,13 +2139,13 @@ lcs_new_device(struct ccwgroup_device *c goto netdev_out; } switch (card->lan_type) { -#ifdef CONFIG_ETHERNET +#if IS_ENABLED(CONFIG_ETHERNET) case LCS_FRAME_TYPE_ENET: card->lan_type_trans = eth_type_trans; dev = alloc_etherdev(0); break; #endif -#ifdef CONFIG_FDDI +#if IS_ENABLED(CONFIG_FDDI) case LCS_FRAME_TYPE_FDDI: card->lan_type_trans = fddi_type_trans; dev = alloc_fddidev(0);