Received: by 10.223.176.5 with SMTP id f5csp3422089wra; Mon, 29 Jan 2018 12:58:06 -0800 (PST) X-Google-Smtp-Source: AH8x224Tl3Or0atmkVIzO4oT3Zfz8fR/FZsXznHLAg1myWmwEDcANXsi0wKuJjuA4qXo+u90o57J X-Received: by 2002:a17:902:bf41:: with SMTP id u1-v6mr13583839pls.416.1517259486684; Mon, 29 Jan 2018 12:58:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517259486; cv=none; d=google.com; s=arc-20160816; b=AeSS0d41fZ+5hyCAJB/JUsnAHlgvhzdGOf+OaHoe1ai2NeRfyxABETKec1t6TClW92 /UJNZn+EWVXEPm05D9hdyvYJ6Y3P4bljZ/YMNdAgByj7Nh6oo6lASjDISO0MB27+YcMt JF8dkHg7du4e/Ee2CRTm3NkJQB2FUaSyAKcXBUPB+XM3HiDhmC05mAj5Jx4k1T8EmTr6 jYEUNKxbRosLqodPfGNqrZx8HMpe+rFn9VeUhgEop17+HNCS/a7rtN+bKsCso3Yz2vGO Bjyx6R9+CyXA83J4Iapbk2DQB2GWWpV1ZGOOJsValWozm6CQo0Cj5t2pJ3/PqbpB/OAD XEhw== 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=0jgwwtyj35VJKPDOg7LXS/cNydDYpds2KA1wW8MWFgg=; b=aV3n3G5R5TwhgyYPeVy17Wpq29j6zIb80VqnrpF1Es264z2sQfk9Lt8a8FBGqijbof sSoz6jGigl85w8kHLV6wlOs1PH5M3xfpELdYM2X44fDlq7KyAeZJV2lfv2rCfuQrfh68 AMyZe4DZBddDiyDsrWE4VgVYDh7c95qFkIXk84tHTqqykHyyTfTksnMvif8+7Aax6k65 DygTK05LpKWtfWwlNszxL5tJQ+r7EkicM8men3cvnbNjCWllzWV1R6hqngXeYPWBq+c6 ZQkKHCpGwO5xwyvgy9cQF3XZS4DbQ7htWf3+li5iaM4MQzsoB9IrD40yASBMiLv1/X21 6moQ== 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 g24-v6si9062019plj.50.2018.01.29.12.57.52; Mon, 29 Jan 2018 12:58:06 -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 S1753302AbeA2UJa (ORCPT + 99 others); Mon, 29 Jan 2018 15:09:30 -0500 Received: from mail.linuxfoundation.org ([140.211.169.12]:54954 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752943AbeA2UJ1 (ORCPT ); Mon, 29 Jan 2018 15:09:27 -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 75CF92F6A; Mon, 29 Jan 2018 13:04:45 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Mika Westerberg , "Rafael J. Wysocki" , Hans de Goede , Jiri Slaby Subject: [PATCH 4.9 18/66] ACPI / scan: Prefer devices without _HID/_CID for _ADR matching Date: Mon, 29 Jan 2018 13:56:42 +0100 Message-Id: <20180129123840.789811014@linuxfoundation.org> X-Mailer: git-send-email 2.16.1 In-Reply-To: <20180129123839.842860149@linuxfoundation.org> References: <20180129123839.842860149@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: Rafael J. Wysocki commit c2a6bbaf0c5f90463a7011a295bbdb7e33c80b51 upstream. The way acpi_find_child_device() works currently is that, if there are two (or more) devices with the same _ADR value in the same namespace scope (which is not specifically allowed by the spec and the OS behavior in that case is not defined), the first one of them found to be present (with the help of _STA) will be returned. This covers the majority of cases, but is not sufficient if some of the devices in question have a _HID (or _CID) returning some valid ACPI/PNP device IDs (which is disallowed by the spec) and the ASL writers' expectation appears to be that the OS will match devices without a valid ACPI/PNP device ID against a given bus address first. To cover this special case as well, modify find_child_checks() to prefer devices without ACPI/PNP device IDs over devices that have them. Suggested-by: Mika Westerberg Signed-off-by: Rafael J. Wysocki Tested-by: Hans de Goede Signed-off-by: Jiri Slaby Signed-off-by: Greg Kroah-Hartman --- drivers/acpi/glue.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) --- a/drivers/acpi/glue.c +++ b/drivers/acpi/glue.c @@ -99,13 +99,13 @@ static int find_child_checks(struct acpi return -ENODEV; /* - * If the device has a _HID (or _CID) returning a valid ACPI/PNP - * device ID, it is better to make it look less attractive here, so that - * the other device with the same _ADR value (that may not have a valid - * device ID) can be matched going forward. [This means a second spec - * violation in a row, so whatever we do here is best effort anyway.] + * If the device has a _HID returning a valid ACPI/PNP device ID, it is + * better to make it look less attractive here, so that the other device + * with the same _ADR value (that may not have a valid device ID) can be + * matched going forward. [This means a second spec violation in a row, + * so whatever we do here is best effort anyway.] */ - return sta_present && list_empty(&adev->pnp.ids) ? + return sta_present && !adev->pnp.type.platform_id ? FIND_CHILD_MAX_SCORE : FIND_CHILD_MIN_SCORE; }