Received: by 2002:a05:6a10:6744:0:0:0:0 with SMTP id w4csp4669771pxu; Wed, 21 Oct 2020 02:10:22 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxdO5HV3P5VeSoYkU+4Wcstvp42EJQV2tTyPqwbPkiePY9y6pQnKYMqdbeRyMCaNv1Nh1d1 X-Received: by 2002:a17:906:7157:: with SMTP id z23mr2556160ejj.474.1603271421848; Wed, 21 Oct 2020 02:10:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603271421; cv=none; d=google.com; s=arc-20160816; b=D24kC5QyXdymmJN7TABAiDf1ZhB7AtH13YTnBO3HcYL4cvlk2TVQZrZW80qux0wzYq JlK0SDEla4Uu+WtLCgW4PurU+xaMOE5tWB/ycOiKv6ciuPmn+qiZO1AXpwW8e5mUEvid ACMzMdJusc9sTFCV2LN4uLc2QD1lXWSswErHaQQVuM2rJmhhRF1VygTtI1hzt1OEeu4Z N3Ar5bybhTQvKO5p7BP4mCzrHNVxMps+jFg8lLzVKRuaWES+485VUZ+pzDxGoCHezupS 7dX8hrXhhX01A0U4PBp+IRqmtlSPFNCyA06IzKiZWXoDCVYWkAjzamcGsmN+d4y5xCfQ kw+w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=YAXkHoX+nye2EJwCgsz4p/5+0ufauY7DMzzsen2kshg=; b=EvOEkAlfhckThDbRgkeilq6aZ+KTCu0Jec1TPRfaceGhIi2pp+P8sgikqzflyjdlTI BvYgNvSuDXMPowfKkJT3NZ24PxgfUMsCm1s+VGTsRCpPRCp78yvGaeh4Dtgnj9P3iqgj DxCOrLpnH+slffR5fyZ1ZbhxBZ4+GserZSRlryzduIoImpYPEHCFxBKB5x5vrg0SZmgS A8Wd4K96cFixZejP3c9wVnoy8yNo+Zz4m1vd3vb0dpFFFp/7L/0LZx5PC4CU61SO4aDF odeqz7CWv+SS44nQdQWxUIy4N3waZnyIaOyzFmCtHTZyQnziA8itJBGtLxEeG1cn9fgS EGeg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=JYdQL3Wq; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id z93si996741ede.272.2020.10.21.02.09.59; Wed, 21 Oct 2020 02:10:21 -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; dkim=pass header.i=@kernel.org header.s=default header.b=JYdQL3Wq; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2390365AbgJTScG (ORCPT + 99 others); Tue, 20 Oct 2020 14:32:06 -0400 Received: from mail.kernel.org ([198.145.29.99]:48814 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2390270AbgJTScG (ORCPT ); Tue, 20 Oct 2020 14:32:06 -0400 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id AA27B21534; Tue, 20 Oct 2020 18:32:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603218725; bh=rYkBj1ZJWTczz5/r0ofs7bNB91o9zGiASSEmBN2me+w=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=JYdQL3WqM7p6HeQ0EeMAIo5Q2YOfnLuT4iVy5ZEoFobMfwLlGD4IAPVmgw+BUTYAb EqhiJi5sA+fXVSNRzB+d6NDWeOqxt4Y137jjticPgIoqKRJ55sa6oAYaWiKzjhDLiV tkHoaxu4fBh4Yu4mpzIN7rlSt59KQPCq8o4o/hCw= Date: Tue, 20 Oct 2020 20:32:46 +0200 From: Greg KH To: Laurent Vivier 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 Subject: Re: [PATCH] serial: pmac_zilog: don't init if zilog is not available Message-ID: <20201020183246.GA912431@kroah.com> References: <20201020162303.1730562-1-laurent@vivier.eu> <20201020162844.GA865546@kroah.com> <468bbbef-4745-3b16-b6f4-30b46ebcdc33@vivier.eu> <20201020173745.GA882703@kroah.com> <387fd2aa-b181-c41f-0581-0a7e79a44e41@vivier.eu> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <387fd2aa-b181-c41f-0581-0a7e79a44e41@vivier.eu> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Oct 20, 2020 at 08:19:26PM +0200, Laurent Vivier wrote: > 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; > ... Yup, that would be a good start, but why is the pmac_zilog.h file responsible for this? Shouldn't this be in some arch-specific file somewhere? thanks, greg k-h