From patchwork Wed Jun 21 07:04: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: 9800925 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 2CA5460329 for ; Wed, 21 Jun 2017 07:05:07 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1D24B2854F for ; Wed, 21 Jun 2017 07:05:07 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1BF1428575; Wed, 21 Jun 2017 07:05:07 +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 384EA2857D for ; Wed, 21 Jun 2017 07:05:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751067AbdFUHFE (ORCPT ); Wed, 21 Jun 2017 03:05:04 -0400 Received: from mail-io0-f195.google.com ([209.85.223.195]:33346 "EHLO mail-io0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750927AbdFUHFD (ORCPT ); Wed, 21 Jun 2017 03:05:03 -0400 Received: by mail-io0-f195.google.com with SMTP id j200so1004441ioe.0; Wed, 21 Jun 2017 00:05:03 -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=gkddzapdRp5Ce9jL29OxDE4oMqjjsdqPcHE9HxOMLkqhgO7K4zmtJ2PdD1rB+JO4g9 JvHz3rTuCTjn/U0f5o5Mav3vM0Pt4J8ZP7NnMZz9Q3po+iA/x9uq643mshz/3jWsUmvp Qk1olwwd/SpjNMynwrBqu2e8SWh7pldCUS8/bjunsfcJQUWe8f7GlPQ2jrawCeittuJq 4NWVeFwAp/DJJFIiaIqEKhuKqLjerrDdATvOkFY/ZwI9MOFFrnjMz5hlLg/IS8aPUmJV 3iLKnGfYTNROU8AHpiQjExHLfmQ81oUfZKM5MuHCPYZQdGfXHjTLPFvgfIkM6rZdKyav Lp6A== 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=Bkb7bmx9UTYXgyHg/Ysmw6if15uke763EsbaP/rh62RL+pcyZ8UVoJbZ7vNJrW/0wi W5BER98nWR5FnjvMjv3erjTn8wz6HBDmmCpObNmDCSsgQqLrv8mVZzSqO7TIbHfJ1J90 u/ZBP0jUdAelsIh/vblEgFymueweK5wfThGIIlBO5iuR/w24iSIAxSQEF/Ph2hkNHrgr 4bNTW25Kjjj3DvwB6UZN+jGGDhSRFu8iHskIclBW2NUKC4ZIgwR42bCpW+ywFUx8AN07 1/TkjsPqP8F5CqOyxt3KKy5VIu0fLoSEBjAjtSXCMgQlLdsH/NL7ElWiukQjg28eNPDu 2TCA== X-Gm-Message-State: AKS2vOzM8NSJD6YI4Ir/IlpKd0yTUGFqg3+pbj3ZT+k4K/Li/EASSKd3 knrm2VnfeZbivI1y X-Received: by 10.107.11.160 with SMTP id 32mr31937499iol.222.1498028702909; Wed, 21 Jun 2017 00:05:02 -0700 (PDT) Received: from linux-l9pv.suse ([45.122.156.254]) by smtp.gmail.com with ESMTPSA id v75sm1372799ita.20.2017.06.21.00.05.00 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 21 Jun 2017 00:05:02 -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: Wed, 21 Jun 2017 15:04:34 +0800 Message-Id: <20170621070434.16570-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); }