From patchwork Mon Apr 23 08:28:34 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 133982 Delivered-To: patch@linaro.org Received: by 10.46.151.6 with SMTP id r6csp724559lji; Mon, 23 Apr 2018 01:28:52 -0700 (PDT) X-Google-Smtp-Source: AIpwx49WnfgTUE8W4SYQ731eZm3ZGSzO7xbu0h71BfB7C5iI6AapvDw6gtmq6Vy3F4fsHMDd2TNe X-Received: by 10.99.117.12 with SMTP id q12mr15770330pgc.395.1524472132045; Mon, 23 Apr 2018 01:28:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524472132; cv=none; d=google.com; s=arc-20160816; b=NFdhJHAxpCAG8zOokANx3N0jgRnyfKvL4E5iqZfKiQfV1mMPCHxOrW/Nn3TWoKLUF6 R29CrkNewwYP3rfuLJY3VdtNctFRZ+BJ9Dvzdt0iYeiYjlmH5BI/QnbR/nbnHgd6Sy48 sck8IEbnXAvbEJonZpGlxXkkltJsDNEK8vvw33PUWE5vsbNR7+0XQ7XwWaHy06wjjLr4 6enQIuzTXtyXuF2jlGdhmF7G3v+3NbdoOVrq2uqxCdxhydWZGZ399Ua6R58+BhSwTLbz WDUqr5MVVueBJSTKPIwcx/0pEwibezTOD9XnHrJU6WGifgRP6SPOlXY9i3eHJDyZPICD ufLw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature:arc-authentication-results; bh=WQ31uLLQ9wetScW6Kijm98GU2pof1OTngnNXuNrXsMc=; b=hjPsOFKE9CMn4gXKsRW8i4t5LJNuG1gVqnz1BiMBsOGGrgas2bewOatzBAnR1QzN/4 OglSqRHzvjdOARlw13loSpZtmFitV9Ztx54xlA/fBi2rZt2qcOgrtKgYjuDUwFQoFPbn c15urepkrgKYIFycxSKc6rFlQ2I9NJNuA7taVM/cc3DsaaS0FJPr3dAenOMUXkj0lI0j oRVn8orBxZ76trwNBdKNj2iCUiEhGymVOeoxsn+G5to0neFm29JlwbVIJvsuZntZ7DCk dnpTxBS9H7IINBXhN44G2yivVRnWU71xkxVIOHAhQZWdjMM/1v1YssvZzOa5/FMrVXKZ OqMg== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=Fxf1ZoKA; spf=pass (google.com: best guess record for domain of linux-acpi-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-acpi-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k9-v6si1313940pll.393.2018.04.23.01.28.51; Mon, 23 Apr 2018 01:28:52 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-acpi-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=Fxf1ZoKA; spf=pass (google.com: best guess record for domain of linux-acpi-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-acpi-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754452AbeDWI2u (ORCPT + 8 others); Mon, 23 Apr 2018 04:28:50 -0400 Received: from mail-wr0-f193.google.com ([209.85.128.193]:42656 "EHLO mail-wr0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754367AbeDWI2r (ORCPT ); Mon, 23 Apr 2018 04:28:47 -0400 Received: by mail-wr0-f193.google.com with SMTP id s18-v6so38681806wrg.9 for ; Mon, 23 Apr 2018 01:28:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=IPubFlq0RIU3F5nmOKeksmJK22vMYzrP019It9Qpr5I=; b=Fxf1ZoKAOyZpAIIBqEsbTGb1lkWUsDBIGOutWxxQv2dWNJq7b60wvPKfMT83uXyPH+ VVY8KGrCoZ25JtDZ99pRdWi3Brh4Rrk6afU8kBPQb+G8LhkTT6G0qOTBpPCRBUDW19nf AhitS0RIrguv/ZCnfN3f6fdiHfbxA8b8aBnxI= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=IPubFlq0RIU3F5nmOKeksmJK22vMYzrP019It9Qpr5I=; b=oCqmXayKYQb8a/JHdV7ljJ/wBddS2qvFa/H359W8a3nEgBY1HU0PixkhB76qK7BcRN lgHUwWp6NMsk+ARmdF9+gNw9k1LUokWrVFlulWFLvqkU4kngOK+GPZ2IsFL7W8Z1BBUK zLq5zIAG4FZUYflNP1cVh2hflStPMeSuT59rTPDWzJM6nEkzpjfolI/F4w8GxiSTDKaT 6zpz3HzdxpyYqQnl8xgbZT5BpssV4uBg3R6OLGzbVSFoMzxGw7rGA77+zubc0IZhFzyY Y3voWd8tVjyNl8eReNxFvPkItxcdIno5T7HO+TZryrxCyireKZj/lq3JY22QiItMDVyk yTIg== X-Gm-Message-State: ALQs6tATOmw6jVGytEuF8U8VUvNv9SHfxBURylLEmZbkzsY9G5CXQMwL hvxjpYSXOtCgGoInfqCCUvTatA== X-Received: by 10.28.69.86 with SMTP id s83mr8316687wma.156.1524472125821; Mon, 23 Apr 2018 01:28:45 -0700 (PDT) Received: from localhost.localdomain ([2a01:e35:3995:5470:200:1aff:fe1b:b328]) by smtp.gmail.com with ESMTPSA id d28sm13590382wmh.29.2018.04.23.01.28.43 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 23 Apr 2018 01:28:45 -0700 (PDT) From: Ard Biesheuvel To: rjw@rjwysocki.net Cc: lenb@kernel.org, linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org, arnd@arndb.de, broonie@kernel.org, lorenzo.pieralisi@arm.com, bill.fletcher@linaro.org, linux-arm-kernel@lists.infradead.org, graeme.gregory@linaro.org, Ard Biesheuvel Subject: [PATCH] ACPI / button: make module loadable when booted in non-ACPI mode Date: Mon, 23 Apr 2018 10:28:34 +0200 Message-Id: <20180423082834.24617-1-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.17.0 Sender: linux-acpi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org Modules such as nouveau.ko and i915.ko have a link time dependency on acpi_lid_open(), and due to its use of acpi_bus_register_driver(), the button.ko module that provides it is only loadable when booted in ACPI mode. However, the ACPI button driver can be built into the core kernel as well, in which case the dependency can always be satisfied, and the dependent modules can be loaded regardless of whether the system was booted in ACPI mode or not. So let's fix this asymmetry by making the ACPI button driver loadable as a module even if not booted in ACPI mode, so it can provide the acpi_lid_open() symbol in the same way as when built into the kernel. Signed-off-by: Ard Biesheuvel --- Could we perhaps get this into -stable as well? It is not a classic regression, but it completely breaks, e.g., Fedora when booting in DT mode on an ARM system. drivers/acpi/button.c | 23 +++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) -- 2.17.0 -- To unsubscribe from this list: send the line "unsubscribe linux-acpi" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/acpi/button.c b/drivers/acpi/button.c index e1eee7a60fad..0506ca56c615 100644 --- a/drivers/acpi/button.c +++ b/drivers/acpi/button.c @@ -635,4 +635,25 @@ module_param_call(lid_init_state, NULL, 0644); MODULE_PARM_DESC(lid_init_state, "Behavior for reporting LID initial state"); -module_acpi_driver(acpi_button_driver); +/* + * Modules such as nouveau.ko and i915.ko have a link time dependency on + * acpi_lid_open(), and would therefore not be loadable on ACPI capable kernels + * booted in non-ACPI mode if we use the ordinary acpi_bus_[un]register_driver + * routines here (which only work when booted in ACPI mode) and build this + * driver as a module. So provide our own versions instead. + */ +static int __acpi_bus_register_driver(struct acpi_driver *driver) +{ + if (!acpi_disabled) + return acpi_bus_register_driver(driver); + return 0; +} + +static void __acpi_bus_unregister_driver(struct acpi_driver *driver) +{ + if (!acpi_disabled) + acpi_bus_unregister_driver(driver); +} + +module_driver(acpi_button_driver, __acpi_bus_register_driver, + __acpi_bus_unregister_driver);