Received: by 2002:a05:6a10:6744:0:0:0:0 with SMTP id w4csp4668725pxu; Wed, 21 Oct 2020 02:08:30 -0700 (PDT) X-Google-Smtp-Source: ABdhPJydbOXvPKJhNvtS1ItJPdJMJjQJjugO9kKmDWYvnHlVOFJZA8bM5U1ZOjKSM4ep21KZaaVP X-Received: by 2002:a17:906:e116:: with SMTP id gj22mr2567719ejb.313.1603271309943; Wed, 21 Oct 2020 02:08:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603271309; cv=none; d=google.com; s=arc-20160816; b=cFrsP5O5R5JPu2anqzxv73H7X0YJWER6vZlqrr4uunwFdx6xLojesHJAvbDaZyX1S7 YtlqDbjOSKKM3aIGRGs6TNForvttFkVEWG2Ru7SGdFSVlyfcL8rcR2NRjnC0gSH/39FP Epwsyua8PrJaAaGiuI6oL6S0F5c6BpJZzVqt6zwh6skE55bidvAfEaRxERewsCQuvNPb LGD+s13N7hZG3SdzgPbhBxpPBt9ybgjamQwWtWN1Skqd5Uon3p90mQy5YbFfCORVxvya MHmco6lrqFDBFPD20QvIjj0wKMeW3G8vy7l/cZpWw+GBvvClgjJ7zb8w8Whjby1+M2ld JFKw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:subject :autocrypt:from:references:cc:to; bh=anKYWKYv7Xv3VW1K158JM0+vAhs9XgN9eJWlOTnIEKI=; b=qZnRtKIs3PSxukZDPFz72bmLbEVod1CqsHgL9k8Fy8jf7yMKv+w7ZNi9hksLy7WdDa 9nBnqhFRFII86j2W6fNSeggjSdFIbZqkxRzhEIivFnRIsHYVPs6xa9bZsc/blSEWwEk9 IYUo9BYapTYEaaqfVqwvbTTFjwvZfNj286XxCsapH3Hfl5EiIafEOmKpaWtlivV3jur+ TB8ZuLc+iFZGc45HQkwTeQbdl1hcqthP6dILHmjAwWrMRUDBMdoVvW/Apkjivvh0C1qP f2b/I2I1uJDOEAkD+xiE992m6IyvbKIgE/P8ArXYTf2UHF4H653li/2ypUn5LnTNQduq m0KA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id o22si960998ejj.86.2020.10.21.02.08.07; Wed, 21 Oct 2020 02:08:29 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388888AbgJTSTl (ORCPT + 99 others); Tue, 20 Oct 2020 14:19:41 -0400 Received: from mout.kundenserver.de ([212.227.126.135]:43909 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388708AbgJTSTl (ORCPT ); Tue, 20 Oct 2020 14:19:41 -0400 Received: from [192.168.100.1] ([82.252.146.14]) by mrelayeu.kundenserver.de (mreue012 [213.165.67.103]) with ESMTPSA (Nemesis) id 1M60HD-1kWJwH3Fvf-007TTh; Tue, 20 Oct 2020 20:19:31 +0200 To: Greg KH Cc: linux-kernel@vger.kernel.org, Joshua Thompson , linux-serial@vger.kernel.org, Benjamin Herrenschmidt , linux-m68k@lists.linux-m68k.org, Geert Uytterhoeven , Paul Mackerras , linuxppc-dev@lists.ozlabs.org, Michael Ellerman References: <20201020162303.1730562-1-laurent@vivier.eu> <20201020162844.GA865546@kroah.com> <468bbbef-4745-3b16-b6f4-30b46ebcdc33@vivier.eu> <20201020173745.GA882703@kroah.com> From: Laurent Vivier Autocrypt: addr=laurent@vivier.eu; prefer-encr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XMegzlXCrqtzUk+N 8LeipEsnOoAQcEONAWWo1HcgUIgCjhJhBEF0AcELOQzitbJGG5UAEQEAAYkCHwQYAQIACQUC VgUmGQIbDAAKCRDzDDi9Py++PCD3D/9VCtydWDdOyMTJvEMRQGbx0GacqpydMEWbE3kUW0ha US5jz5gyJZHKR3wuf1En/3z+CEAEfP1M3xNGjZvpaKZXrgWaVWfXtGLoWAVTfE231NMQKGoB w2Dzx5ivIqxikXB6AanBSVpRpoaHWb06tPNxDL6SVV9lZpUn03DSR6gZEZvyPheNWkvz7bE6 FcqszV/PNvwm0C5Ju7NlJA8PBAQjkIorGnvN/vonbVh5GsRbhYPOc/JVwNNr63P76rZL8Gk/ hb3xtcIEi5CCzab45+URG/lzc6OV2nTj9Lg0SNcRhFZ2ILE3txrmI+aXmAu26+EkxLLfqCVT ohb2SffQha5KgGlOSBXustQSGH0yzzZVZb+HZPEvx6d/HjQ+t9sO1bCpEgPdZjyMuuMp9N1H ctbwGdQM2Qb5zgXO+8ZSzwC+6rHHIdtcB8PH2j+Nd88dVGYlWFKZ36ELeZxD7iJflsE8E8yg OpKgu3nD0ahBDqANU/ZmNNarBJEwvM2vfusmNnWm3QMIwxNuJghRyuFfx694Im1js0ZY3LEU JGSHFG4ZynA+ZFUPA6Xf0wHeJOxGKCGIyeKORsteIqgnkINW9fnKJw2pgk8qHkwVc3Vu+wGS ZiJK0xFusPQehjWTHn9WjMG1zvQ5TQQHxau/2FkP45+nRPco6vVFQe8JmgtRF8WFJA== Subject: Re: [PATCH] serial: pmac_zilog: don't init if zilog is not available Message-ID: <387fd2aa-b181-c41f-0581-0a7e79a44e41@vivier.eu> Date: Tue, 20 Oct 2020 20:19:26 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.11.0 MIME-Version: 1.0 In-Reply-To: <20201020173745.GA882703@kroah.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit X-Provags-ID: V03:K1:Da9Ze04T1tTCv7g0qhSl051x+9xl8IaNNsO79L10EmJf1+cc9tX eLV9T3PpwPUny+/2lzdLT8OKtpveZdKRmhGcNnOM4UGQ06n6QzJ70OoIc1+J1IMgE/sdH9y lc+WmhQcpaWqZESOkGsbt82CIGz/6gSDmVmxI1xIzwmSmZLFYOO44cPIbbyVE2ulCXU8ZLz W82jC8/6SfhZXyU//cScw== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1;V03:K0:pjIrv7Z31o4=:sGZSgvpTyy9SdD2F4408/0 zGTYPgS4yoHk6tNYP1RretB3frrm6tcLaL7sUC4vBebadWZKuAm/EabfjqMlk4KA98kp8DD2Y FJXIDYshUxIJU91rds8MWdCE1M4k72NRJ0hYvOaWxcwzUkhmw/2L3RzJNydmQpXd0QkS8AoI/ 34QkMRT4FKOh4qKTM+qxPareffmlDXivm0gvaebAsVD8XbdDobId0H9tourFd97J1St547pUU WGdqPwEEtpi0RRgCraWfRs117+AgsOqj0AOhmJrPXdwb4W2J/Mhnr/uEWHl4vpg3RpqO15kF6 gviM38tZEBs8O00nDgf87cVUkZQ/2KwV15OqohRjhBT+gd9tMPC5vnqCZmX1s79tCAEdjltxO YwQp+4Nua2wJLKbkMrXKoskja/lJFPT3uUVe/d5ICD3lbb1V9dhizap/diDM/nTwCJoAqnoVX 93X25gikyw== Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Le 20/10/2020 à 19:37, Greg KH a écrit : > On Tue, Oct 20, 2020 at 06:37:41PM +0200, Laurent Vivier wrote: >> Le 20/10/2020 à 18:28, Greg KH a écrit : >>> On Tue, Oct 20, 2020 at 06:23:03PM +0200, Laurent Vivier wrote: >>>> We can avoid to probe for the Zilog device (and generate ugly kernel warning) >>>> if kernel is built for Mac but not on a Mac. >>>> >>>> Signed-off-by: Laurent Vivier >>>> --- >>>> drivers/tty/serial/pmac_zilog.c | 11 +++++++++++ >>>> 1 file changed, 11 insertions(+) >>>> >>>> diff --git a/drivers/tty/serial/pmac_zilog.c b/drivers/tty/serial/pmac_zilog.c >>>> index 063484b22523..d1d2e55983c3 100644 >>>> --- a/drivers/tty/serial/pmac_zilog.c >>>> +++ b/drivers/tty/serial/pmac_zilog.c >>>> @@ -1867,6 +1867,12 @@ static struct platform_driver pmz_driver = { >>>> static int __init init_pmz(void) >>>> { >>>> int rc, i; >>>> + >>>> +#ifdef CONFIG_MAC >>>> + if (!MACH_IS_MAC) >>>> + return -ENODEV; >>>> +#endif >>> >>> Why is the #ifdef needed? >>> >>> We don't like putting #ifdef in .c files for good reasons. Can you make >>> the api check for this work with and without that #ifdef needed? >> >> The #ifdef is needed because this file can be compiled for PowerMac and >> m68k Mac. For PowerMac, the MACH_IS_MAC is not defined, so we need the >> #ifdef. >> >> We need the MAC_IS_MAC because the same kernel can be used with several >> m68k machines, so the init_pmz can be called on a m68k machine without >> the zilog device (it's a multi-targets kernel). >> >> You can check it's the good way to do by looking inside: >> >> drivers/video/fbdev/valkyriefb.c +317 >> drivers/macintosh/adb.c +316 >> >> That are two files used by both, mac and pmac. > > Why not fix it to work properly like other arch checks are done I would be happy to do the same. > Put it in a .h file and do the #ifdef there. Why is this "special"? I don't know. Do you mean something like: drivers/tty/serial/pmac_zilog.h ... #ifndef MACH_IS_MAC #define MACH_IS_MAC (0) #endif ... drivers/tty/serial/pmac_zilog.c ... static int __init pmz_console_init(void) { if (!MACH_IS_MAC) return -ENODEV; ... Thanks, Laurent