Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp731088imm; Thu, 13 Sep 2018 06:58:42 -0700 (PDT) X-Google-Smtp-Source: ANB0VdblMHn1BIhBzveeVWktRbfNmcRWby2w+RdyjXTnD67z9LwtZWmf14PDWY2CZ6bBnuDK8a/Q X-Received: by 2002:a17:902:d881:: with SMTP id b1-v6mr7519159plz.191.1536847122787; Thu, 13 Sep 2018 06:58:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536847122; cv=none; d=google.com; s=arc-20160816; b=hBPok3pgZtNhup+lu1/CdFOkfJbT8yVphiIGZnVKUNJ6dDxue8cMw/cPvYwJiO+3Sc AT5DN3sFlF8uM9/FGTW1vazqZqFQlPVujnULB8/2t5ClvpAvX4LXY7LYcwZT6wXUSJZ7 5DkPjiSHR/rfQxSml9SwXuRu+aap9HUFCk2ZLjXJYFrQeCnh9k8QuoWghfPUUMgUdvMc 87Wmv0wUQhq02cJW41P3BlF1m71k8US0GceV12RdjR0MfcocB3gwNi+xOGAjgPeLll8e lE5dNs80JgrdS3Ru99/a6sRxsDr5uTIOCvOjJp+1cR8fouRV/dQNHCeGDNCsOkRfZTfI urYw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from; bh=1sC1jFyB3nzgcmOD6mF2SHqs9aULTkj0Jp2ZqtaGCSI=; b=SEtStTTVi61Fka38QqK8/P09FhEcrgGylFvmOVbqUDLLYqwpm1AkEd7R4d2KFydlK6 8oaasszslnZAcPGYhfjjXx8KZ/xy0lCN5PoXOH2C7OnFpOpxFGpqOZm+cRSGcEYAAbL5 rh9Qr4jmt9/hHV4N/3LkkFnTycm5tpkl1+z6NTtgji5D2Tyku4+tDnrjHI77+zua93R4 JMmT0cz3hXaNL5TcQc9x8S5gaNa+wgBcgxh14lUTJ3TGCNlcvljD77TRRG7UJYN1imT0 eOgwsHG550K227B6HbZ5tMtv4GhPuVPAIUyiosUW3CAE9XQvzc24LBUFRYB5fV8rA7KE J9CA== 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 x4-v6si3851892plo.459.2018.09.13.06.58.27; Thu, 13 Sep 2018 06:58:42 -0700 (PDT) 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 S1731139AbeIMTHu (ORCPT + 99 others); Thu, 13 Sep 2018 15:07:50 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:34462 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728566AbeIMTHt (ORCPT ); Thu, 13 Sep 2018 15:07:49 -0400 Received: from localhost (ip-213-127-77-73.ip.prioritytelecom.net [213.127.77.73]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id B9545D0E; Thu, 13 Sep 2018 13:58:12 +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.18 105/197] ACPI / scan: Initialize status to ACPI_STA_DEFAULT Date: Thu, 13 Sep 2018 15:30:54 +0200 Message-Id: <20180913131845.745743701@linuxfoundation.org> X-Mailer: git-send-email 2.19.0 In-Reply-To: <20180913131841.568116777@linuxfoundation.org> References: <20180913131841.568116777@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.18-stable review patch. If anyone has any objections, please let me know. ------------------ From: Hans de Goede [ Upstream commit 5971b0c1594d6c34e257101ed5fdffec65205c50 ] Since commit 63347db0affa "ACPI / scan: Use acpi_bus_get_status() to initialize ACPI_TYPE_DEVICE devs" the status field of normal acpi_devices gets set to 0 by acpi_bus_type_and_status() and filled with its actual value later when acpi_add_single_object() calls acpi_bus_get_status(). This means that any acpi_match_device_ids() calls in between will always fail with -ENOENT. We already have a workaround for this, which temporary forces status to ACPI_STA_DEFAULT in drivers/acpi/x86/utils.c: acpi_device_always_present() and the next commit in this series adds another acpi_match_device_ids() call between status being initialized as 0 and the acpi_bus_get_status() call. Rather then adding another workaround, this commit makes acpi_bus_type_and_status() initialize status to ACPI_STA_DEFAULT, this is safe to do as the only code looking at status between the initialization and the acpi_bus_get_status() call is those acpi_match_device_ids() calls. Note this does mean that we need to (re)set status to 0 in case the acpi_bus_get_status() call fails. 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/scan.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) --- a/drivers/acpi/scan.c +++ b/drivers/acpi/scan.c @@ -1612,7 +1612,8 @@ static int acpi_add_single_object(struct * Note this must be done before the get power-/wakeup_dev-flags calls. */ if (type == ACPI_BUS_TYPE_DEVICE) - acpi_bus_get_status(device); + if (acpi_bus_get_status(device) < 0) + acpi_set_device_status(device, 0); acpi_bus_get_power_flags(device); acpi_bus_get_wakeup_device_flags(device); @@ -1690,7 +1691,7 @@ static int acpi_bus_type_and_status(acpi * acpi_add_single_object updates this once we've an acpi_device * so that acpi_bus_get_status' quirk handling can be used. */ - *sta = 0; + *sta = ACPI_STA_DEFAULT; break; case ACPI_TYPE_PROCESSOR: *type = ACPI_BUS_TYPE_PROCESSOR;