From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751377AbeDVJ5z (ORCPT ); Sun, 22 Apr 2018 05:57:55 -0400 Received: from mail-io0-f194.google.com ([209.85.223.194]:38396 "EHLO mail-io0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751028AbeDVJ5w (ORCPT ); Sun, 22 Apr 2018 05:57:52 -0400 X-Google-Smtp-Source: AB8JxZqyz/yz/tfa4mJ+DanjhEIm8Jg3KAbzaxCdjJIUbu0T5BuMyfQ8Esk2RiIpCfKwxwbza4nOf5Kbaz3TMcNamh0= MIME-Version: 1.0 In-Reply-To: References: <20180419165825.13008-1-ard.biesheuvel@linaro.org> From: Ard Biesheuvel Date: Sun, 22 Apr 2018 11:57:51 +0200 Message-ID: Subject: Re: [PATCH] ACPI / bus: ignore rather than fail bus driver registrations on non-ACPI boot To: "Rafael J. Wysocki" Cc: "Rafael J. Wysocki" , Len Brown , ACPI Devel Maling List , Linux Kernel Mailing List , Arnd Bergmann , Mark Brown , Lorenzo Pieralisi , Bill Fletcher , linux-arm-kernel Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 22 April 2018 at 11:27, Rafael J. Wysocki wrote: > On Thu, Apr 19, 2018 at 6:58 PM, Ard Biesheuvel > wrote: >> When building ACPI bus drivers such as button.ko into the core kernel, >> other drivers that depend on its symbols are loadable even when booting >> with ACPI disabled. For instance, nouveau.ko has a link time dependency >> on acpi_lid_open() on ACPI capable kernels, and calls it regardless of >> whether the system booted via ACPI. >> >> However, when building button.ko as a module, it will refuse to load if >> the system did not boot in ACPI mode, which subsequently prevents the >> nouveau driver from loading as well, resulting in broken graphics. >> >> Given that returning an error from an initcall() is ignored for drivers >> that are built into the kernel, > > Which makes sense, because they are present in the kernel anyway. > >> let's align the module case with this, >> and not return an error when registering an ACPI bus driver on a system >> that did not boot via ACPI. > > But why is loading a module that's never going to be used actually OK? > > Isn't this a problem with the assumptions made by the nouveau driver > that need not be met depending on what configuration the kernel is run > in? > > Honestly, it doesn't appear quite right to try to change the rest of > the kernel to follow the nouveau's expectations. > I don't disagree here, I am just unsure whether other options are any better. I think the alternative is to make acpi_lid_open() a non-modular function of the ACPI core that invokes the button ACPI bus driver if it was loaded, and always returns false otherwise. Would that work for you?