Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754236AbbHHL1K (ORCPT ); Sat, 8 Aug 2015 07:27:10 -0400 Received: from mout.kundenserver.de ([212.227.126.130]:51161 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754176AbbHHL1H (ORCPT ); Sat, 8 Aug 2015 07:27:07 -0400 From: Arnd Bergmann To: linux-arm-kernel@lists.infradead.org Cc: Robert Richter , Tomasz Nowicki , linux-mips@linux-mips.org, David Daney , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-acpi@vger.kernel.org, David Daney , Sunil Goutham , "David S. Miller" Subject: Re: [PATCH 2/2] net, thunder, bgx: Add support for ACPI binding. Date: Sat, 08 Aug 2015 13:26:23 +0200 Message-ID: <2414262.jivbxTLuUW@wuerfel> User-Agent: KMail/4.11.5 (Linux/3.16.0-10-generic; KDE/4.11.5; x86_64; ; ) In-Reply-To: <20150807104320.GQ1820@rric.localhost> References: <1438907590-29649-1-git-send-email-ddaney.cavm@gmail.com> <55C467A0.4020601@linaro.org> <20150807104320.GQ1820@rric.localhost> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Provags-ID: V03:K0:ngwOWlh6U5rmCmjpmPat7MfXSuqz6+M7HE+AE1ReOaKc2WD+Gku ZMTVON6lJtS+ji68LWLJzMA2cjFB5gVQzOiIlsq4q9y9rR2nmtzruxsUhtsUrk/bTNPE+HK 2ayJCgY/8xONZx4VyyRuG4+45xNTmZDCkuHwYhEseGYwb87KBVomRPdaLSHPicJ5h3qwZRC mY2fYT/zsHBM04r7ve3Uw== X-UI-Out-Filterresults: notjunk:1;V01:K0:Zc8F4WS4RUY=:rxHDZoUigrMugXopqyiFVP uAPMuBFNqAeXyTHuPYvGU7fzc7oMcnK02Kq5A41fKSXEelEgllcjZzy6tXtWcX8Q6rRAQUEIs OkYmBc7fTSVf6EPxQ+uN9ods6i2Ej1U/wZ+WRXPqW3+Ch5Vedt9AlQc6j/mvz9fwPtgOhwmlx N3HsXPYROwdXmpQsAJW0M2+GlYv5zgjFgt4SwdsTtlAluV5a7fJPxlv/nN4JmaO08XcPlvnXs iE3FCZLfZMKy0UVU9a/MtrhWJ4wH7w6dVBDgP17aH0YcohOxMEGEBGYvHFuIv08Odl/VhAANO 21E0oadBeU/O0eQqSv2gIs4A4V+y0O47fCnIpuhd282VixFgKv1QYwz7evki5seV2MJ1XKbS5 ZatE47NWuSjaMHgTi0bOTO+bKueTfz7eYsF79nrAOCLAfy2yj4Vwe4tvL/Mf0YJj1HyXTIx67 PBXROF8SNf76zuISqZGkIcLu0FChGWC6/YRlExLtmlFrj00YKWpoAYAQl+zZFcA1G0rCy4j8i KPVhusOUkDPQqHYbbYxDiURS36h0MwqQJYJKGlChlsDagQDDf+OKLW/6tltVw2DZzKOfH0d0z abLIuEKU5Nw+gZmQ6GHhuAkrVhsmTPQiKU8efIDHqVHwUv5TkTcmb+SGS1sQZAGsoxciQqY/4 yXaR5zWpCyAjIsl88Ticjfz0cZ2zkei7eCzAhMQOg6/iJKTZYcH8QvZLlLahH5Il+J+1Ov68G utVtzDxj2MnVCYrW Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1233 Lines: 35 On Friday 07 August 2015 12:43:20 Robert Richter wrote: > > I would not pollute bgx_probe() with acpi and dt specifics, and instead > keep bgx_init_phy(). The typical design pattern for this is: > > static int bgx_init_phy(struct bgx *bgx) > { > #ifdef CONFIG_ACPI > if (!acpi_disabled) > return bgx_init_acpi_phy(bgx); > #endif > return bgx_init_of_phy(bgx); > } > > This adds acpi runtime detection (acpi=no), does not call dt code in > case of acpi, and saves the #else for bgx_init_acpi_phy(). > What you should really do is to use the same function for both, using the generic device properties API. If that is not possible, explain in a comment why not. Aside from that, if you do have to use compile-time conditionals, use 'if (IS_ENABLED(CONFIG_ACPI) && !acpi_disabled)' instead of #ifdef, for readability. The compiler will produce the same binary, but also give helpful warnings about incorrect code that you don't get with #ifdef. Arnd -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/