Received: by 2002:a05:7412:e794:b0:fa:551:50a7 with SMTP id o20csp239425rdd; Tue, 9 Jan 2024 02:35:59 -0800 (PST) X-Google-Smtp-Source: AGHT+IGqdbrRNps8f3fv0rFNLKIv9GiQCgdsmDCvd3iDwZD/K5M/10BGYcF1J5WbecbQn7huM5oX X-Received: by 2002:a05:6a20:3f02:b0:199:d092:ae46 with SMTP id az2-20020a056a203f0200b00199d092ae46mr1405833pzb.57.1704796558861; Tue, 09 Jan 2024 02:35:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704796558; cv=none; d=google.com; s=arc-20160816; b=xP1cWM1GFgxzsrQBFKaEj1/XovvuwDVMnyJEFXf6vWj3zYZdqpMNdTcx9sCRgjr96F FSzkszMOsWrTouPEiZ2dDAD71Wva3m+PqeZ43eQ2C9LUBIafp59Y0you93k4zJJJeCrp cXbVcW/zsZuGafC+kroYVAfPGPQR7ojGqNqe73X7KYVb7MluuRz1H5EsJU1eXk1zRFIi Dkuusq3t1UVCr6J7ylvM1WU0w/ToG61g8BOIPwSub7VRh1JBv7XULda3iVJvR64I3+F9 sc/EDPaahl/n49VGCcnsOUFncYiosDH9ZJWjl9doqPegfJvQh2cfMiOzpMQxfoWBpEw1 Pdvw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=subject:cc:to:from:date:references:in-reply-to:message-id :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :user-agent:feedback-id:dkim-signature:dkim-signature; bh=DgG9tCDREyTfxAwH9mDVpC/UFPRAXNZSHBS2vcSJXRU=; fh=OZlLo4kohE39oq+RK/0O5QGqz7Vcs5Kwj8h1PxM/UBE=; b=ssIaEbjlCBWoWi2X3qwkIdDWYpsLxK7aDBsFJRe867aFxOY5Fa8FU/wREGwQG3tMZN XbNQkkjg4dY/ntT31HIdDHeerL9wI+Qjlsa17ySTtxpN+FSyvFpz7SAJD6oINQelvs/w 1486wxXbelj7WSN8LNEt9kO4+19HLxfsoBL3cCAuG+NhTpBAWEFwuvbtLpDdVNDz7ZgH jOWFrkTt7NMtRuELwGpVsT2q7AAs5vA8A0yIA2iUidBl2dwagy9HijfHTqKwGvKWlrVy tvE/rGPoRYk1J6XrHCrGXVXBF7zKwBWt5bm3ALtCQOTzoIJ2bBRPDzeUOX7Hs2a7MgeN EAPA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@arndb.de header.s=fm2 header.b=jWiapSy2; dkim=pass header.i=@messagingengine.com header.s=fm2 header.b=7xYaP8h9; spf=pass (google.com: domain of linux-kernel+bounces-20717-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-20717-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=arndb.de Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id nl8-20020a17090b384800b0028d6da4793asi1361016pjb.72.2024.01.09.02.35.58 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 09 Jan 2024 02:35:58 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-20717-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@arndb.de header.s=fm2 header.b=jWiapSy2; dkim=pass header.i=@messagingengine.com header.s=fm2 header.b=7xYaP8h9; spf=pass (google.com: domain of linux-kernel+bounces-20717-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-20717-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=arndb.de Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 827E62864E8 for ; Tue, 9 Jan 2024 10:35:58 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id CD8CA364B9; Tue, 9 Jan 2024 10:35:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=arndb.de header.i=@arndb.de header.b="jWiapSy2"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="7xYaP8h9" Received: from wout1-smtp.messagingengine.com (wout1-smtp.messagingengine.com [64.147.123.24]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5ECBB13FE0; Tue, 9 Jan 2024 10:35:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arndb.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arndb.de Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailout.west.internal (Postfix) with ESMTP id B579A3200A51; Tue, 9 Jan 2024 05:35:47 -0500 (EST) Received: from imap51 ([10.202.2.101]) by compute5.internal (MEProxy); Tue, 09 Jan 2024 05:35:48 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=arndb.de; h=cc :cc:content-type:content-type:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:subject :subject:to:to; s=fm2; t=1704796547; x=1704882947; bh=DgG9tCDREy TfxAwH9mDVpC/UFPRAXNZSHBS2vcSJXRU=; b=jWiapSy2JW7izbbWmSzVs7RHGy NYrT/mP0CmV2uSUWKFoTiLgU2aLm3HH7zxQbmpqnFerzFFas2LevMfawtBzbA21/ 6v6gS6FV5yzPH19s0wTx/x0H6VGa4wDACgkmQNzYstwJIqGhGzxi4H4N16yfAnUf Pt1Lzs22mpi4artsj9c5FHd6ZBWktc6Hm/WU0+6JRQn2Xj5LqDMU6PScnGpGybyn EWeyT+9uczVokEfqp64mLFxRXE44Y/4Li71gkF2rmJydO3RJRrBSDEP/HbSAoh13 Z+byJFgUoimTjicJGGpUgyZT0Hja9tZj4Ojl1fEFc+BTncvqF2opTFvGNufA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:subject:subject:to :to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm2; t=1704796547; x=1704882947; bh=DgG9tCDREyTfxAwH9mDVpC/UFPRA XNZSHBS2vcSJXRU=; b=7xYaP8h9UrHAJ+SEQA2d0sh8T9lgXKtXfhz7L/ctcO6m o2LC21vB2dwZ+BMW5T51rOTtYk5W2TuWaJt0Q5KEErupShgEUupuRC+EIemJL+2y Uk4P6/8yA+VVvYtaat6upbpwfAkIhs9q+yp+xIn+W5a58IPDfBnIkptEPuDYAh5f vmRx9jwvSyWmWwgy7J+7+o62fWT2TOgZ3Lrv7vtsXBoP3TiG9FmNS/fqtz0M+O4x oUxWnmY0djEj/ogNCfN2gTShnkd7HFvOl78cfBTDOvAzJglXTmIHqeKQhVlcbwKu 3i9uk9fEC4TGGgC8+SCMycak2wmwg2pqedMWW6Yhqg== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvkedrvdehledgudeiucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepofgfggfkjghffffhvfevufgtsehttdertderredtnecuhfhrohhmpedftehr nhguuceuvghrghhmrghnnhdfuceorghrnhgusegrrhhnuggsrdguvgeqnecuggftrfgrth htvghrnhepvefhffeltdegheeffffhtdegvdehjedtgfekueevgfduffettedtkeekueef hedunecuffhomhgrihhnpehkvghrnhgvlhdrohhrghenucevlhhushhtvghrufhiiigvpe dtnecurfgrrhgrmhepmhgrihhlfhhrohhmpegrrhhnugesrghrnhgusgdruggv X-ME-Proxy: Feedback-ID: i56a14606:Fastmail Received: by mailuser.nyi.internal (Postfix, from userid 501) id 973E4B6008F; Tue, 9 Jan 2024 05:35:46 -0500 (EST) X-Mailer: MessagingEngine.com Webmail Interface User-Agent: Cyrus-JMAP/3.9.0-alpha0-1364-ga51d5fd3b7-fm-20231219.001-ga51d5fd3 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <468ce58a-9f4a-4a75-adbf-7beb8fa13580@app.fastmail.com> In-Reply-To: <4c859da1-9551-4d0b-a19c-f20f1133acac@gmail.com> References: <20240109090715.982332-1-arnd@kernel.org> <4c859da1-9551-4d0b-a19c-f20f1133acac@gmail.com> Date: Tue, 09 Jan 2024 11:35:25 +0100 From: "Arnd Bergmann" To: "Heiner Kallweit" , "Arnd Bergmann" , "Pavel Machek" , "Lee Jones" Cc: "Andrew Lunn" , "Hans de Goede" , "Jean-Jacques Hiblot" , linux-leds@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 1/2] leds: remove led_init_default_state_get() and devm_led_classdev_register_ext() stubs Content-Type: text/plain On Tue, Jan 9, 2024, at 11:10, Heiner Kallweit wrote: > On 09.01.2024 10:06, Arnd Bergmann wrote: >> From: Arnd Bergmann >> >> These two functions have stub implementations that are called when >> NEW_LEDS and/or LEDS_CLASS are disabled, theorerically allowing drivers >> to optionally use the LED subsystem. >> >> However, this has never really worked because a built-in driver is >> unable to link against these functions if the LED class is in a loadable >> module. Heiner ran into this problem with a driver that newly gained >> a LEDS_CLASS dependency and suggested using an IS_REACHABLE() check. >> >> This is the reverse approach, removing the stub entirely to acknowledge >> that it is pointless in its current form, and that not having it avoids >> misleading developers into thinking that they can rely on it. >> >> This survived around 1000 randconfig builds to validate that any callers >> of the interface already have the correct Kconfig dependency already, >> with the exception of the one that Heiner just added. >> >> Cc: Heiner Kallweit >> Link: https://lore.kernel.org/linux-leds/0f6f432b-c650-4bb8-a1b5-fe3372804d52@gmail.com/T/#u >> Signed-off-by: Arnd Bergmann >> --- > > For r8169 we have a Kconfig-based solution now, right. I had a brief look > at other drivers using LED functionality, and already the first one I looked > at seems to suffer from the same problem. input/keyboard/qt2160.c has the > following what should result in the same link error if qt2160 is built-in > and CONFIG_LEDS_CLASS=m. qt2160 has a Kconfig dependency only on I2C. > > #ifdef CONFIG_LEDS_CLASS > static int qt2160_register_leds(struct qt2160_data *qt2160) > { > [...] > error = devm_led_classdev_register(&client->dev, &led->cdev); > [...] > } > #else This is a bug, but I think a different one, with a similar effect. Part of the problem in this driver is that it uses #ifdef instead of "#if IS_ENABLED(CONFIG_LEDS_CLASS)". As a result, it just never uses the LEDS when LEDS_CLASS=m, because that would define CONFIG_LEDS_CLASS_MODULE but not CONFIG_LEDS_CLASS. Changing it to IS_ENABLED() would cause the link failure you describe, but would do it regardless of my change. The same bug seems to be present in other files as well. > 2. If stubs are removed (but also in the current situation, see example), > then it seems some drivers need adding proper build dependencies. I don't see any driver that actually relies on the stub, since that would only work a driver that can never be built-in. If a driver can be built-in (like your r8169 code) and uses the stub, we would have seen it fail to link in randconfig kernels and added a LEDS_CLASS dependency. Arnd