Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752417AbdGaOPD (ORCPT ); Mon, 31 Jul 2017 10:15:03 -0400 Received: from mx2.suse.de ([195.135.220.15]:39958 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752379AbdGaOPC (ORCPT ); Mon, 31 Jul 2017 10:15:02 -0400 Date: Mon, 31 Jul 2017 16:14:58 +0200 From: Jean Delvare To: Kevin Brodsky Cc: Arnd Bergmann , Lorenzo Pieralisi , Olof Johansson , Tero Kristo , Thierry Reding , Carlo Caione , Nishanth Menon , linux-kernel@vger.kernel.org Subject: Re: [PATCH] psci: add CPU_IDLE dependency Message-ID: <20170731161458.08c34088@endymion> In-Reply-To: References: <20170731085523.320244-1-arnd@arndb.de> Organization: SUSE Linux X-Mailer: Claws Mail 3.13.2 (GTK+ 2.24.31; x86_64-suse-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2040 Lines: 49 Hi Kevin, On Mon, 31 Jul 2017 11:19:39 +0100, Kevin Brodsky wrote: > On 31/07/17 09:55, Arnd Bergmann wrote: > > I ran into a build error for the psci_checker: > > > > drivers/firmware/psci_checker.o: In function `psci_checker': > > psci_checker.c:(.init.text+0x528): undefined reference to `cpuidle_devices' > > > > As far as I can tell, this is simply a very rare combination of options, > > but the problem has existed since the code was initially added. > > Adding a Kconfig dependency makes it build properly. > > Good catch! For some reason I missed this config option when figuring out the > dependencies... I wonder though, shouldn't cpuidle.h declare cpuidle_devices > conditionally on CONFIG_CPU_IDLE? Such conditional declarations only make sense if there is a legitimate use of the disabled case and if they make the disabled case fully transparent to the users. This is typically done by replacing function declarations by inline stubs doing nothing in the right way when the feature is disabled. It avoids having to put the condition checks on the side of all users. In this case however, you can't stub out cpuidle_devices alone. If you omit the declaration when CONFIG_CPU_IDLE isn't set, all you'll get is a failure at compilation time, instead of at linkage time. This barely helps. For it to be useful, you would additionally have to provide wrappers around this_cpu_read(cpuidle_devices) and per_cpu(cpuidle_devices, cpu) and stub out these wrappers when CONFIG_CPU_IDLE is disabled (so you don't refer to cpuidle_devices at all when it isn't available.) But then again this would only make sense if the psci_checker still serves a purpose when CONFIG_CPU_IDLE isn't set. Not my area, but after a quick look at the code I strongly suspect this is not the case. > > Fixes: ea8b1c4a6019 ("drivers: psci: PSCI checker module") > > Signed-off-by: Arnd Bergmann > > Acked-by: Kevin Brodsky Reviewed-by: Jean Delvare -- Jean Delvare SUSE L3 Support