From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Google-Smtp-Source: AH8x227E6anzTwVmC5POQPisg7ePx4TSf8IRJKW1HRsXNJRVaKunHf9IqFQDSNQ6QHm+vgSiGuMj ARC-Seal: i=1; a=rsa-sha256; t=1517256568; cv=none; d=google.com; s=arc-20160816; b=qTBuiXTDXNfOIn3Iy9MVS/4se/9pQDTHKCP4vQdPiHWark3vGloEM4xLGvihpxw1nz 36/DeITANG1CdnBDw5hOFp4J7GlJH3+nmUjUiVlaQnh1LUoNyarBIF1kMSQmAu7tTXXw ThvdUEADWG+XcPyCRh3hgRh9yXWGOP0jdH1Zcgz3pl44IIZMYLIKywmzR9uqjWwGrRk/ Tw1UlehDSHNSSUevX+iDaQs0He0cydFPB21UtCwkUX9sopvLxFX7WK6nTR5DPzgsMeAs DEaS3f5oIwrGf1GmDU7BIIkw6Ygz8pVng4igqFIV8xcRuyFxf0veg0RxHW4yx6snStme cdxA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:user-agent:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=0jgwwtyj35VJKPDOg7LXS/cNydDYpds2KA1wW8MWFgg=; b=DD8ZNH4eDyz196CKW2FBhDJuShNWd2iOXf8vmmynNDvILMnLobIPkQAefpAFx1a/2p iX7WlSeqTuvgvhIYfQSRdJJRz8hpQkas7yYv1QJ739/dF2rMiit66TYRGjhOOBBCPqC/ S8QaMHTE/BDAz5aN4Gz0ntDXuBEbcDqKNubgqk0YT8m4Oa+twENLqkAn4WGYMrFKsUP3 o+Cz+uKJnuXMPDMv9uujKza7owMAmlhnOK5WDSHeazdXKtrBOer3R//AMepF1Gr9F6Fe YyQd5RU0N2u/Fvr8PiLJnGOMlSo947pckGoyv6d0gipVsz45RlMIQc/HQhfzHsOVBz8+ 1org== ARC-Authentication-Results: i=1; mx.google.com; spf=softfail (google.com: domain of transitioning gregkh@linuxfoundation.org does not designate 90.92.71.90 as permitted sender) smtp.mailfrom=gregkh@linuxfoundation.org Authentication-Results: mx.google.com; spf=softfail (google.com: domain of transitioning gregkh@linuxfoundation.org does not designate 90.92.71.90 as permitted sender) smtp.mailfrom=gregkh@linuxfoundation.org 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 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-LABELS: =?utf-8?b?IlxcU2VudCI=?= X-GMAIL-THRID: =?utf-8?q?1590958823030430116?= X-GMAIL-MSGID: =?utf-8?q?1590958823030430116?= X-Mailing-List: linux-kernel@vger.kernel.org List-ID: 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; }