Received: by 10.223.176.5 with SMTP id f5csp1140490wra; Fri, 2 Feb 2018 11:55:43 -0800 (PST) X-Google-Smtp-Source: AH8x227F2V2syo5dLJ1ViPIhfbnGf9KFecPIFJGs2fEnPMeTbx//B5q4XGzc0uv6mQUYI1B79hVP X-Received: by 2002:a17:902:208:: with SMTP id 8-v6mr36291347plc.359.1517601342975; Fri, 02 Feb 2018 11:55:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517601342; cv=none; d=google.com; s=arc-20160816; b=uCb99v+ll+dB9B72LLDai/kl1V7/6E64mtixZ6NazfpFC0grw5hqDaqtj+86oVlXm/ sGbs/t2Iet7vUBxy1yCB0MtzS9lXrCALb75oGbIDRtJ+tX7Q4FLb/H4hl/zoahz56n4M WvNl3qmrCcYxx2nJkXkrd4+hNSpe2bSsMAZkxjOzGuV5AZOfyVNyB6kIUZ75IX6T88zt LlaEtriKoEbN1BOFoGNhM4yb+ZvXLfUM96/fAbax733bEoPxaOVrVfCdAK8tJMwgIdhl hyEG5LYVd0jdZO1dJocv8DQIEYt2l7vLOMcegjWjzZDIqatk07r/flE9eFTtOICU/QEm CFXg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=anY1jnHIeEaO+IJrGw+9F/nHCEDh2Ld/qMQhNr6AvUI=; b=nxb1VV1qngsiiA4FV7Jbx0E4mFjLFOwfIjF44BHy5rKjb/CjqjBI+kfw+YZhejMQ0t lwb0Ao+glPG0aN1uYs+FCCJlB4l4mrIAsYzqOFn1uu5ULykqd5Olm8y95TDFmL7kMF1N G35Eo43asKtqVoEMak5lJCDJs6otSMEiE/B3X2MvYBR7mv+PMgJhRQ/6LsfPUftkUeYl CBb2jmujN/AXaUlbwMlQfRhke/8U45gQdYnvTq3PN/1WCIe2F5UYboAjX5a0MSMmfSe9 W4zsBQSiFNwHANVz9NPS/eHzn27nVHT5KRqRfH5swmG38UmtKWH8VGRgpUdUTxDYVBzm hEpw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r5si1894434pgt.92.2018.02.02.11.55.27; Fri, 02 Feb 2018 11:55:42 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754774AbeBBS0Z (ORCPT + 99 others); Fri, 2 Feb 2018 13:26:25 -0500 Received: from mail.linuxfoundation.org ([140.211.169.12]:35234 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752727AbeBBRBq (ORCPT ); Fri, 2 Feb 2018 12:01:46 -0500 Received: from localhost (LFbn-1-12258-90.w90-92.abo.wanadoo.fr [90.92.71.90]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id F0CC9DFF; Fri, 2 Feb 2018 17:01:45 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hans de Goede , "Rafael J. Wysocki" , Sasha Levin Subject: [PATCH 4.4 27/67] ACPI / bus: Leave modalias empty for devices which are not present Date: Fri, 2 Feb 2018 17:57:56 +0100 Message-Id: <20180202140818.525948379@linuxfoundation.org> X-Mailer: git-send-email 2.16.1 In-Reply-To: <20180202140815.091718203@linuxfoundation.org> References: <20180202140815.091718203@linuxfoundation.org> User-Agent: quilt/0.65 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.4-stable review patch. If anyone has any objections, please let me know. ------------------ From: Hans de Goede [ Upstream commit 10809bb976648ac58194a629e3d7af99e7400297 ] Most Bay and Cherry Trail devices use a generic DSDT with all possible peripheral devices present in the DSDT, with their _STA returning 0x00 or 0x0f based on AML variables which describe what is actually present on the board. Since ACPI device objects with a 0x00 status (not present) still get an entry under /sys/bus/acpi/devices, and those entry had an acpi:PNPID modalias, userspace would end up loading modules for non present hardware. This commit fixes this by leaving the modalias empty for non present devices. This results in 10 modules less being loaded with a generic distro kernel config on my Cherry Trail test-device (a GPD pocket). Signed-off-by: Hans de Goede Signed-off-by: Rafael J. Wysocki Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- drivers/acpi/device_sysfs.c | 4 ++++ 1 file changed, 4 insertions(+) --- a/drivers/acpi/device_sysfs.c +++ b/drivers/acpi/device_sysfs.c @@ -146,6 +146,10 @@ static int create_pnp_modalias(struct ac int count; struct acpi_hardware_id *id; + /* Avoid unnecessarily loading modules for non present devices. */ + if (!acpi_device_is_present(acpi_dev)) + return 0; + /* * Since we skip ACPI_DT_NAMESPACE_HID from the modalias below, 0 should * be returned if ACPI_DT_NAMESPACE_HID is the only ACPI/PNP ID in the