Received: by 2002:a05:6a10:6744:0:0:0:0 with SMTP id w4csp4664660pxu; Wed, 21 Oct 2020 02:01:32 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxc+2pFo5PHDOT8HN0scetEfaoTTs75qYbgyC42EB96hYoxVmMtvZ030GYL+sdISNgOpuPm X-Received: by 2002:a17:906:9396:: with SMTP id l22mr2414948ejx.36.1603270892348; Wed, 21 Oct 2020 02:01:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603270892; cv=none; d=google.com; s=arc-20160816; b=p/Ghd0M4QzUCFft8nwGIywzx/rYWw6yLUUNvI9c5Crp1m7gE1birMU+rYhZr5SWqk9 auTQoHTxbLhKUq9QyX/4VpKW4G1n6Qi9jVCtjVt4d7pFC1gbjMs4MI7HwRNfzhxBehR6 RPazRoz3UandEUnEmHog8bPfCuXa0tsvRzx7wEyJkYuRhMrL1t7cnPBDYF28l8KhUk07 aBvPCQ0bonkMtgrRrWckhNy+Z29DwMZdSt5IYmgH8KtZp8VhjdcCOCmlN04c/tldR2+S q8m/UfdgDnFv1JhghoKUPYrArv8Uirbw9jsrD0LkA6WYa4UhOY7xoNiArrx0CZFyLhFp /UBw== 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=32y+kkvtkkXZgD3rU6Jn6wO+08DzQJRIJY0vHj1LhXs=; b=dkxI9CyoZbWUbtJNf/u6WyEY/Zx4p6hkVo6KxmkcTNargsH27rxMavgIBKr1zb5ziM npfVmCyH1plrkWWmjBWsy4PZfqmhgNE4fbMVVrWwST5lzkEgYZQRyC8SSZpNvjpc+Bkt HhhXNoYvwhyoqNRVP9E0zTXEF8A95WevtQC4djbrgmD7PEpq1gOWdZaLelGn40FohApf blBIMSiosKAgbK8O8Jkb+DPPqq1b6PO2Wg5tXgKiFMohXOfflkez2Sp9oi5fkhNAiBNQ ONuKvxTuCppwjKvYTAL0JroLg4I8zALw0pBEheeCElrGiW6tAd6tk7n+KToq2DN2NRoS /I9w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=XSqgB+w4; 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.01.10; Wed, 21 Oct 2020 02:01:32 -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=XSqgB+w4; 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 S2391511AbgJTRhF (ORCPT + 99 others); Tue, 20 Oct 2020 13:37:05 -0400 Received: from mail.kernel.org ([198.145.29.99]:36098 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726282AbgJTRhE (ORCPT ); Tue, 20 Oct 2020 13:37:04 -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 9ABEB2222D; Tue, 20 Oct 2020 17:37:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603215423; bh=QOpjHS7bCAquiOFhX0yeTVHhmICVnAJeN2C/qruwuD0=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=XSqgB+w4+Cib8lOLhmp8nMe7UKWWIM/KzlYbUUgYDze4rXIs+97J3t2Wrj6mLWvnv 2M8Rr9+5OlDsSEgojkYUHWWvap9tV4mftQXjruDKm5w7qUx/2EuxSP60e+Wa6H3CJD U3HeidKvfY6IWIpQiMp7QGMCKpR35fYYIi+7T6QY= Date: Tue, 20 Oct 2020 19:37:45 +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: <20201020173745.GA882703@kroah.com> References: <20201020162303.1730562-1-laurent@vivier.eu> <20201020162844.GA865546@kroah.com> <468bbbef-4745-3b16-b6f4-30b46ebcdc33@vivier.eu> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <468bbbef-4745-3b16-b6f4-30b46ebcdc33@vivier.eu> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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? Put it in a .h file and do the #ifdef there. Why is this "special"? thanks, greg k-h