From patchwork Tue Jun 13 11:11:34 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: 9783665 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 79C8160325 for ; Tue, 13 Jun 2017 11:11:46 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6C22B2853A for ; Tue, 13 Jun 2017 11:11:46 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 60B5B2863E; Tue, 13 Jun 2017 11:11:46 +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.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, 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 DB31A2853A for ; Tue, 13 Jun 2017 11:11:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752236AbdFMLLp (ORCPT ); Tue, 13 Jun 2017 07:11:45 -0400 Received: from mail-pg0-f65.google.com ([74.125.83.65]:35538 "EHLO mail-pg0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752211AbdFMLLo (ORCPT ); Tue, 13 Jun 2017 07:11:44 -0400 Received: by mail-pg0-f65.google.com with SMTP id f127so18107562pgc.2; Tue, 13 Jun 2017 04:11:43 -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=TT1treFP2yuIX4Yels2Z290h5Wozrhtm6xRjlOPC9RI=; b=OxPG2zmkuhaAsEy9UKcbK9kO57Tj6EczqU0pW7GlftVXEiZu7auiFQ7hnKOYLXDgdX yeAMJlJrO5JYocUgMd893Te2J0NEzYvMNKrFveY3VVrGJeVz3tvGRb3habOQMrMcw1cQ NW5zYatdJva3osWa/EL4yumx2yOOFeKSalEyi/sTpqmRvfB5w1EbnswqrS9IZ5YXZv/G P79TSXbDb6qKgesdOTODfIaaGwuU9P7RS51IFw5WXuUN/fgTm9SzJkhHMEh89++XUaR9 s/9jS9ne0enncVYjTVHkhWK7CHZsZJdQ3fxyM9zLzslxTvsjQPtCM1VVE2/F+ljTzgPW zZbQ== 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=TT1treFP2yuIX4Yels2Z290h5Wozrhtm6xRjlOPC9RI=; b=Az/yE2lKKCJ+jbYB8BJ1Ofk0vyo63yv0fksTyhxov2mBezOJgBEXdMXwgxucVy15Ad 3uKssd3utWvNQ7Zpe+BRZIUV+2QJxklH/W552s2w7VzBkDrTAQR6H5nGrUkgoreU0/3G ekOGFPxybZj3Pb4OyH1geHaYD3lNwUVglPLZoCsNv4o38pNrrlNMqZJWsO5eFMGr1UCv 7Atx1F9vguUHqQkSEm6eSG7gl9VViNjK+vwmUgNJojkaDjs7QwRNXQr35Ovq47ji4CaE CEadh8XcgJxE0IbBB78Rw6GAx/VVzlY7N044FWt065LQArr+Sy3S1uDOlfD076/nyAEj atig== X-Gm-Message-State: AODbwcDCwM9Nua0qeHn0BS+iCT44fhRrodqgQGQiial0rAPOjJ+hvN10 7l4HXAjNvAeidA== X-Received: by 10.99.104.69 with SMTP id d66mr62597802pgc.12.1497352303493; Tue, 13 Jun 2017 04:11:43 -0700 (PDT) Received: from linux-l9pv.suse ([45.122.156.254]) by smtp.gmail.com with ESMTPSA id s88sm5427592pfk.16.2017.06.13.04.11.41 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 13 Jun 2017 04:11:42 -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 v2] acpi: handle the acpi hotplug schedule error Date: Tue, 13 Jun 2017 19:11:34 +0800 Message-Id: <20170613111134.13703-1-jlee@suse.com> X-Mailer: git-send-email 2.12.0 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 is failed, and evaluates _OST to notify BIOS the failure. 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 | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/drivers/acpi/bus.c b/drivers/acpi/bus.c index 34fbe02..91adb71 100644 --- a/drivers/acpi/bus.c +++ b/drivers/acpi/bus.c @@ -427,12 +427,17 @@ 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))) - return; + if (hotplug_event) { + if (ACPI_SUCCESS(acpi_hotplug_schedule(adev, type))) + return; + goto err_put_device; + } acpi_bus_put_acpi_device(adev); return; + err_put_device: + acpi_bus_put_acpi_device(adev); err: acpi_evaluate_ost(handle, type, ost_code, NULL); }