Received: by 10.223.176.5 with SMTP id f5csp3376790wra; Mon, 29 Jan 2018 12:19:38 -0800 (PST) X-Google-Smtp-Source: AH8x227ZYEaci64G7n8EuHDW/jbYIGE62S/3BHHGUUcjAh+HHFHAEjxYNE9i8NXwvn1UaDTK+7qv X-Received: by 10.101.100.132 with SMTP id e4mr5155506pgv.398.1517257178258; Mon, 29 Jan 2018 12:19:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517257178; cv=none; d=google.com; s=arc-20160816; b=NWdya9L0DxJaGHEVfaaA86an+MLXuCGjwzWdJkPwsFy75w2PAt9jxEattsck/a1zhR 08ydpeWWhaG7wCUa/jJOkNnTuZ02xsSAFHxVZPLfSiDCadFpyIhAcPBcH0lwG4fDo/Dp 8qalFKG30fuiDZl4N8z4vseuk8bVtocj9BsmTPnoOPK378hx11ypKVjV7JM0D7ytzoad AkSId3TTIo25KwCl9TmxahykqAJtm/XxPxRlqYOixEUT5gh3Wli9oZhNSN7CH2DJdi5K bpO/jkK67zbFhzE1QXVEI62B+kYP1Qx+0TKmjIaNe3XUQm7b7pIuGHaoLqTvvL34t3zd isBg== 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=U/kBuXv8CFdjZ82FvjLn+/96bjglg5SGz1Goo/W0t7A=; b=cNzKGP6Y4KGZbjKi7PLInoXPpMkENmhMrK/RXAU8QeMnz+wMezn2Q0PF0m59dZ1xFq t/KrLZooIiOESQDnq61krp1xXFT1Nt725golDcVY9q4MT9MV/dndLj3XNrvPVnHSppCF zVGESk5sEVp4AmGmkbX4wAH65NwtGU1H7/inwukNMmIWAxrZA4hmpCXDYu6KcoTF0v+9 NB/LQeycDBD5lCOnr2Z1trISNnbGbFsEDfs11IiDLM9AkeuiZlyCKZErsE8g2Ao5sC1Z sgHUBRPJ8qk+kh3pbCswMPvuk5Ca/wMEMaBImfV3aALNGrhzUbahRhMXvpbuOMUFBwFL 3yQg== 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 a3-v6si1635811plc.552.2018.01.29.12.19.23; Mon, 29 Jan 2018 12:19:38 -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 S1754769AbeA2USg (ORCPT + 99 others); Mon, 29 Jan 2018 15:18:36 -0500 Received: from mail.linuxfoundation.org ([140.211.169.12]:46974 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754317AbeA2UR1 (ORCPT ); Mon, 29 Jan 2018 15:17: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 D40DC2ED6; Mon, 29 Jan 2018 13:01:35 +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.4 28/74] ACPI / scan: Prefer devices without _HID/_CID for _ADR matching Date: Mon, 29 Jan 2018 13:56:33 +0100 Message-Id: <20180129123848.888319573@linuxfoundation.org> X-Mailer: git-send-email 2.16.1 In-Reply-To: <20180129123847.507563674@linuxfoundation.org> References: <20180129123847.507563674@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: 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; }