Received: by 10.223.176.5 with SMTP id f5csp1035474wra; Fri, 2 Feb 2018 10:04:05 -0800 (PST) X-Google-Smtp-Source: AH8x224tpOMq4TXVSb/hdjb/laNTakXMKCT8Mxm+N1Z/P/9mol38oycDh6SCfEne1psU0VpINQ5I X-Received: by 2002:a17:902:b2c2:: with SMTP id x2-v6mr5443463plw.414.1517594645346; Fri, 02 Feb 2018 10:04:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517594645; cv=none; d=google.com; s=arc-20160816; b=SOGWWR52mZlbvu1rIBeei9L9zvS6lWmA7Gb7A0d1l6KgH41bfPuU+N7ipA0oeP2vqS PLE8LRo3jlHaxPzAiSAWonshu7xZTDaLffIGhDbJeGJcti7C0OJBMQYaiVmnu9AJLk1w iE7px5y1RrUFKONLRKYPCfCVseaA/73eG9on4dVkWr89Dk0IX/OteFtc/8Z/tTPjRxZC x7FRtAgJdcomjS15ZzrrrBsKVWoY+wPlO1JRgYLK1VA6x5K3+ThjcC+ZnZgUSCBMyk6w 5gKbWMkg5QuiHvXhA2YZ1DJecJKzo6x9Q1LP1HalIdvQl53+BvTTB7HwUr6goZPOlK8V 04kQ== 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=cVTxaWPiT1zXyRxPdKpC5YpnQ6nTJcISHOpgJerucC0=; b=g/D0UbEhLhh/gM56gG/sILx9QfAX5WKuTTZv8sb0uOpVrELeWgCMc85hvdyXBNYWpd i2qsGnS8+o/1kHieHgQdtrxxOCSbaHpDCGUAwx5d9uj4VcJooliqsabfmPb23p8iLlLS Y6CUGOem/lunc5fPcdRnDYnNUgVJbS9ESR1CPwVox4/oFrTNH7YQbjubHFbI7CXQrkGR 86Eoxue1jinEdoB+UttCrkRLTsTgtmLJxmVKfRxnRWxTgzb2s/aYP+DYM2txX/evJgDH kLuHuwWh5BuQUpZGNcaAceitmzKiHA8xBcjvpB56vD7lYEAaodubIsd125YpAcfn/1hV wIUA== 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 67-v6si2160915ple.609.2018.02.02.10.03.50; Fri, 02 Feb 2018 10:04:05 -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 S1753585AbeBBSC2 (ORCPT + 99 others); Fri, 2 Feb 2018 13:02:28 -0500 Received: from mail.linuxfoundation.org ([140.211.169.12]:37932 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753182AbeBBRJZ (ORCPT ); Fri, 2 Feb 2018 12:09:25 -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 37107D31; Fri, 2 Feb 2018 17:09:24 +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.14 054/156] ACPI / bus: Leave modalias empty for devices which are not present Date: Fri, 2 Feb 2018 17:57:15 +0100 Message-Id: <20180202140842.725279573@linuxfoundation.org> X-Mailer: git-send-email 2.16.1 In-Reply-To: <20180202140840.242829545@linuxfoundation.org> References: <20180202140840.242829545@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.14-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