Received: by 10.223.176.5 with SMTP id f5csp975919wra; Fri, 2 Feb 2018 09:07:40 -0800 (PST) X-Google-Smtp-Source: AH8x225BbJVt9QPVvgvHcZNJWAVRxwoEKg2CzxVCc8NTK/UksuFBnjrRQSjS4/twZGrhVe1vQGue X-Received: by 10.98.93.65 with SMTP id r62mr40600946pfb.55.1517591260781; Fri, 02 Feb 2018 09:07:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517591260; cv=none; d=google.com; s=arc-20160816; b=azxikLqHHSGBubWa/+zYkLLAdds/4esS4bW0jLm0FJyjnTxdlyLZQFc9O0PbusDbvA v2mAs2Nk7eIdU7VwKD88+mgBOnqL51oNjU0vM5aFhXjRBM8GwGWTDZq13kh8WVdVWxsG fq6N4x/797HuGikyOQLwGJsJg7bBAo6kEwqwTNQ5EzqxVxmjm03k52IZCShUADnfpjPK 1o5blMeNNHUnVEmDPY8CA8iEno0s0DLn2dgZ5mAHyZK8eHclYIgyEyOTyD+20C/4AI/R TemDKTc8i+cXXXxx01Pae8FmoCA/cDBMfFh5Yv3e7ixOrGfVcfGjRvWpqXodkVAzVt7k sTZQ== 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=ecAQxkUcbzvXCANCsw5eSbCrypJ27GBAxLPE8gVxEww=; b=zy/ygYPV8xhknpMPXTQ738ZzKXE+zRurbiYdhP87DrGi2bCzOKcm1XziCO5jx5BJLp wEdV5U5pAdz1XyQbr/zxWcBAsvWNK6HxyyWp4JBgxlStTAqfaydQAB5vGt7nW7mHW4JO sk9tPPzaxCWVWCEg1cd/+SipQx6G+g6MKkD5LrI7JsG7f45W6uu8e4LvSEyj6zPBkQQb cIHVgf8/6mzRcrkfQL6wfBiTrXPC180dZ/MY2ujj33G0hEzdrU0zZSvMq2ovPDFWAfVo IKaXddu6QUzhRE4QKD3qykjQCB5t1WNNzEqy/l9VwlTt9TC/PTg6BqE+y+nQ+H8yHLFF tIeA== 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 101-v6si2179206ple.263.2018.02.02.09.07.25; Fri, 02 Feb 2018 09:07:40 -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 S1752864AbeBBRGl (ORCPT + 99 others); Fri, 2 Feb 2018 12:06:41 -0500 Received: from mail.linuxfoundation.org ([140.211.169.12]:35784 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752373AbeBBRDj (ORCPT ); Fri, 2 Feb 2018 12:03:39 -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 8E8B0EFF; Fri, 2 Feb 2018 17:03:38 +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.9 25/86] ACPI / bus: Leave modalias empty for devices which are not present Date: Fri, 2 Feb 2018 17:57:45 +0100 Message-Id: <20180202140824.942482889@linuxfoundation.org> X-Mailer: git-send-email 2.16.1 In-Reply-To: <20180202140822.679101338@linuxfoundation.org> References: <20180202140822.679101338@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.9-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(+) diff --git a/drivers/acpi/device_sysfs.c b/drivers/acpi/device_sysfs.c index 7b2c48fde4e2..201c7ceb7052 100644 --- a/drivers/acpi/device_sysfs.c +++ b/drivers/acpi/device_sysfs.c @@ -146,6 +146,10 @@ static int create_pnp_modalias(struct acpi_device *acpi_dev, char *modalias, 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 -- 2.16.1