From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932262AbcKHQMv (ORCPT ); Tue, 8 Nov 2016 11:12:51 -0500 Received: from mout.kundenserver.de ([212.227.17.10]:58309 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752995AbcKHQMq (ORCPT ); Tue, 8 Nov 2016 11:12:46 -0500 From: Arnd Bergmann To: Lukas Wunner Cc: Ilia Mirkin , "nouveau@lists.freedesktop.org" , Ben Skeggs , "dri-devel@lists.freedesktop.org" , "linux-kernel@vger.kernel.org" Subject: Re: [Nouveau] [PATCH] drm/nouveau: fix LEDS_CLASS=m configuration Date: Tue, 08 Nov 2016 17:12:30 +0100 Message-ID: <7299445.oinG8ujhC7@wuerfel> User-Agent: KMail/5.1.3 (Linux/4.4.0-34-generic; KDE/5.18.0; x86_64; ; ) In-Reply-To: <20161108160701.GC6983@wunner.de> References: <20161108135721.2142330-1-arnd@arndb.de> <12373137.2mgsQIhOfV@wuerfel> <20161108160701.GC6983@wunner.de> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Provags-ID: V03:K0:XlPTDgRN7j4c1pA8H8ZsI9s2lzPWi1SNcUFbbtwTC6xlDIg/Avk i6lZ+NOXscq4Jj3zLDjEFQTRF7+rRFeDtl6TEEjADFHdyGI40JA+LAQP7AqeOkP+no/t3rn da1E5+wGb+i43bS5oAuLrjctmYooncr5QkzHQamYFyTePXnefNtW62jk3R4oPoX36oDzzb0 e8N0v80tNTKudgLD+qhYg== X-UI-Out-Filterresults: notjunk:1;V01:K0:yL2r85cKF0Q=:pxYtnEIfoOSHOB1hFIeatI jun70Epluh1RRgu7i4GWRNM3Cfd5vlY+NqQtHO6rrvL8+LSGTB9cmwSzY8tDb5qhUPMZ+LNIn Is+faHZ0TVZm8teplW9xQK59WNpAUggIaGTcNWK/kXChEWBWHfENhNeAUfqNcIZP3Caj8Fw59 WWmCYdsr1cwxt6UnA6ehiFJxxIo5BV907UuwLQFsBbBSVTJjtvXULdLAhSo8erabof+ZDXpSw igcxnS12UTu2G+LnfrxSpCtVPOxIj2eVlo3S4D/8aESi4eLCjxA5Mh23Vnf/o5uBX0dQ6Pyoh qRJMwmZ81ArUys9nuhIDkMbruLw23SnJOwCi5F3qtCRhTvuOjoEu947d7RC4xdDnv/cqysQ7l Q/MA/khIiF7T6KkEebgECq7R+Ae2sUuvZMZG+9Wm31FKsCXY9L/sxZ4ALCQACRs59BHj/C9vC 2GexQnA6+U/IZ/UgvDzG7T6P3jwNO8WCaWxGT+Jvi1Uht4lrlAGlyATaY3Zv/N9x15yeB0mn5 YcRhOhOXGI8xV12LBtTGEAAvVIchwH8C1E9EjLby7AHlY85VYhQLMMsQMRQ1gtUzOocDhXIo8 KJoK5zVznzA+t4hklJ/IYWKhUevUEr5IDx498a2EnCCrVbjaJ2XnjBtuyCcWRVX0ZJ/8PQq6J id/q0yOJ9sn9R8R4BEI/HNQLlcGkPfHu9exWZiUi/l/eV/O9yBNCoqevj8mjx/8RAKtCDOQsu /9Ipd1zsLfdPunl3 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tuesday, November 8, 2016 5:07:01 PM CET Lukas Wunner wrote: > On Tue, Nov 08, 2016 at 04:52:49PM +0100, Arnd Bergmann wrote: > > The underlying problem is that we already have a number of other > > symbols that either have "depends on LEDS_CLASS" or > > "select LEDS_CLASS". To clean that up properly, we should either > > make the symbol itself hidden and only select it from other drivers, > > or use "depends on LEDS_CLASS" everywhere. > > > > Another option is to use the IS_REACHABLE() macro instead of IS_ENABLED() > > in the header file, to stub out the calls into the new file, but > > that can be a bit confusing. > > Why don't you just add empty inline stubs for nouveau_led_init / _fini / > _suspend / _resume? > That's what I was suggesting: diff --git a/drivers/gpu/drm/nouveau/nouveau_led.h b/drivers/gpu/drm/nouveau/nouveau_led.h index 9c9bb6ac938e..bc5f47cb516b 100644 --- a/drivers/gpu/drm/nouveau/nouveau_led.h +++ b/drivers/gpu/drm/nouveau/nouveau_led.h @@ -35,21 +35,21 @@ struct nouveau_led { struct led_classdev led; }; static inline struct nouveau_led * nouveau_led(struct drm_device *dev) { return nouveau_drm(dev)->led; } /* nouveau_led.c */ -#if IS_ENABLED(CONFIG_LEDS_CLASS) +#if IS_REACHABLE(CONFIG_LEDS_CLASS) int nouveau_led_init(struct drm_device *dev); void nouveau_led_suspend(struct drm_device *dev); void nouveau_led_resume(struct drm_device *dev); void nouveau_led_fini(struct drm_device *dev); #else static inline int nouveau_led_init(struct drm_device *dev) { return 0; }; static inline void nouveau_led_suspend(struct drm_device *dev) { }; static inline void nouveau_led_resume(struct drm_device *dev) { }; static inline void nouveau_led_fini(struct drm_device *dev) { }; #endif The downside is that now the nouveau_led_init() just won't be called if CONFIG_LEDS_CLASS=m and CONFIG_DRM_NOUVEAU=y, which can be surprising to users. Arnd