From patchwork Fri Jul 7 06:22:42 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chun-Yi Lee X-Patchwork-Id: 9829615 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 18673602BD for ; Fri, 7 Jul 2017 06:23:18 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 08EED28408 for ; Fri, 7 Jul 2017 06:23:18 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id EE611285D8; Fri, 7 Jul 2017 06:23:17 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.3 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3151A28408 for ; Fri, 7 Jul 2017 06:23:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751707AbdGGGXQ (ORCPT ); Fri, 7 Jul 2017 02:23:16 -0400 Received: from mail-it0-f68.google.com ([209.85.214.68]:35688 "EHLO mail-it0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750905AbdGGGXP (ORCPT ); Fri, 7 Jul 2017 02:23:15 -0400 Received: by mail-it0-f68.google.com with SMTP id v193so3961912itc.2; Thu, 06 Jul 2017 23:23:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=PzqLeOKWP1XbpLg+uZ5Os8IoVa0m9JAyRjlaMdnfQx0=; b=swkXiYlmARCx7jCxkZMG6sg3IahUYSW2xKhrZJqbZ3roMl2pTDFjg7s6s6rzu+cPH/ FUFP5e+IxH1EGtjux5dJahyjXRlYQ+1zGmwg99q6HiU7EAu7RtcZDk3zahwDSmdcUdRQ A1bd8K++igAiwrvHAIyEe2vnXpY2mjJBzVtuJ17TO4NSM8o7EePsOD1z3thoBKm5vU1W IIBzNom3fKIp46Iqe4JdigZBrLB5au8BMrZqozlCEUMF8QmHl2YGAsfsWzOdE20RgkId JyDPMnI0793lJDCoGtTpOzcgzy+Q3eVQHtRIAIPIg/X1oqbKcP1qSTAQTWFAFlsHWMQX xSqQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=PzqLeOKWP1XbpLg+uZ5Os8IoVa0m9JAyRjlaMdnfQx0=; b=LKyFgwTgl9BthFVupmQh3u9hIJoP+QQQwlcOvo1mDn6ANLibRCH77cg2mybzTrsQ85 /vAtWWfZTog0/70DSTVxxWsgcblJvs8QLValUB6p3oEt/PVjAkkTgxH+b3tNi7XdQDe4 qF3gP/InAELh4YRWM/dPek17T6629tJWKVO3WY4D5NuhaqKbbg0CFghuzBWgYfc1OMRk dlfvdKBcHHXrkM/Jkewz3elGHtuWhD0/OOvNtHVqYxP9QgW/butRQlQh/wbzDBGWKIgv CGd6dP9qc1RtKam4XDUKrv4BP4AWmxcjl3SAuIVVfo8KVLWv9EGw6vXqPDfZ70h7bVAv 4LaQ== X-Gm-Message-State: AIVw110ejxOWUHL8yrPDtricapfIU7PWGjVTNTqm/P+gXHdkXvDypFWT ZA6T1pvGuQJq+g== X-Received: by 10.36.86.197 with SMTP id o188mr1418352itb.50.1499408594229; Thu, 06 Jul 2017 23:23:14 -0700 (PDT) Received: from linux-l9pv.suse ([45.122.156.254]) by smtp.gmail.com with ESMTPSA id c190sm1393172itc.24.2017.07.06.23.23.11 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 06 Jul 2017 23:23:13 -0700 (PDT) From: "Lee, Chun-Yi" X-Google-Original-From: "Lee, Chun-Yi" To: "Rafael J . Wysocki" Cc: linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org, "Lee, Chun-Yi" , Len Brown , Michal Hocko Subject: [PATCH v3] acpi: handle the acpi hotplug schedule error Date: Fri, 7 Jul 2017 14:22:42 +0800 Message-Id: <20170707062242.29588-1-jlee@suse.com> X-Mailer: git-send-email 2.12.3 Sender: linux-acpi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Kernel should decrements the reference count of acpi device when the scheduling of acpi hotplug work failed, and evaluates _OST to notify BIOS the failure. v3: More simplify the code. (Rafael J. Wysocki) v2: To simplify the code. (Andy Shevchenko) Cc: "Rafael J. Wysocki" Cc: Len Brown Cc: Michal Hocko Reviewed-by: Andy Shevchenko Signed-off-by: "Lee, Chun-Yi" --- drivers/acpi/bus.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/acpi/bus.c b/drivers/acpi/bus.c index 784bda6..9d4fea6 100644 --- a/drivers/acpi/bus.c +++ b/drivers/acpi/bus.c @@ -432,11 +432,15 @@ static void acpi_bus_notify(acpi_handle handle, u32 type, void *data) (driver->flags & ACPI_DRIVER_ALL_NOTIFY_EVENTS)) driver->ops.notify(adev, type); - if (hotplug_event && ACPI_SUCCESS(acpi_hotplug_schedule(adev, type))) + if (!hotplug_event) { + acpi_bus_put_acpi_device(adev); + return; + } + + if (ACPI_SUCCESS(acpi_hotplug_schedule(adev, type))) return; acpi_bus_put_acpi_device(adev); - return; err: acpi_evaluate_ost(handle, type, ost_code, NULL);