From patchwork Wed Jun 7 06:05:27 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: 9770579 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 CA6C760234 for ; Wed, 7 Jun 2017 06:05:43 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AD52B28417 for ; Wed, 7 Jun 2017 06:05:43 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A19E228521; Wed, 7 Jun 2017 06:05:43 +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 9307B28417 for ; Wed, 7 Jun 2017 06:05:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750810AbdFGGFl (ORCPT ); Wed, 7 Jun 2017 02:05:41 -0400 Received: from mail-pf0-f196.google.com ([209.85.192.196]:35983 "EHLO mail-pf0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750730AbdFGGFk (ORCPT ); Wed, 7 Jun 2017 02:05:40 -0400 Received: by mail-pf0-f196.google.com with SMTP id y7so558555pfd.3; Tue, 06 Jun 2017 23:05:40 -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=aemYPJB4a1wlESC+1rCKovFOmTVc3tthEwj+quGB1LY=; b=fEy2oDx5Bugd9CCon9/Wiyuzztbk2DkuIMgjMlUr+SK8KZcfIXrSdZ9NUKRoius+CT 2Dmb7bMbZVlCvxcx5n9gaYCk3rFIemvCDe5/KNRo2FAh+fN0zLfLtoyp/n89s7/KQNZq qYrCnmCggy5EQIk4oquF3Er2Sp4u8t/kkBEqk0DAZztzP6/5VuWOLBwmaEZn3cCatF6C vsuS6Fbo/wPf+fd6g6d2hJSkp+yZFTDbTzOnlgT4WcYGVd7jqQnPnqFpzwu1V9lq5fOS ociDH/fopG2X1Rq5ljllhL6y7d9xK3zjlJG+wvuJBUIZmKvcyoqsA03Qzj7TT9RH/cxO sEhw== 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=aemYPJB4a1wlESC+1rCKovFOmTVc3tthEwj+quGB1LY=; b=j44w8/u/HQb+1wnDjrfE70twDjIbSkBIe2OGNW9xBUo282qMinEMiRJYg4O2iZDPIq dFlp/UqvLmtU6OSSB/WCiEDMQAtxKOrlIO1QG9YoOPxjN5JXvo0tx+crIn7GVttbXo5l DAQNKjEsqasfkNZ5C+saJqnwuZPH9H3YjmVRRhSeu2sfKcoV5IwMyrDPZvfzpQULZ+FT ekjDqMATWflzzhCxnW7HTqSUnNQ9gqowmWlKnh+B0TdqcwTW8CerCjk/DzLpafjKbTog UjXTI7Fc5swO9M9Ai4yOTfNVBIQN75vs03MVnzTQAe87qQgM/dvEGhdxdnTqpf+iquYg yeKg== X-Gm-Message-State: AODbwcC/J8kq2RYSbCA20rzEX4ae3Rn+y14weKC600M1KgvyxaFVzeRq BW75wtM1CdQKHA== X-Received: by 10.84.233.137 with SMTP id l9mr25763290plk.215.1496815539853; Tue, 06 Jun 2017 23:05:39 -0700 (PDT) Received: from linux-l9pv.suse ([45.122.156.254]) by smtp.gmail.com with ESMTPSA id g13sm1281746pgu.54.2017.06.06.23.05.37 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 06 Jun 2017 23:05:38 -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 Subject: [PATCH] acpi: handle the acpi hotplug schedule error Date: Wed, 7 Jun 2017 14:05:27 +0800 Message-Id: <20170607060527.23407-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 scheduling acpi hotplug work is failed, and also evaluates _OST to notify BIOS the failure. Cc: "Rafael J. Wysocki" Cc: Len Brown Signed-off-by: "Lee, Chun-Yi" --- drivers/acpi/bus.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/drivers/acpi/bus.c b/drivers/acpi/bus.c index 34fbe02..2f2cec9 100644 --- a/drivers/acpi/bus.c +++ b/drivers/acpi/bus.c @@ -427,8 +427,14 @@ 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_FAILURE(acpi_hotplug_schedule(adev, type))) { + acpi_bus_put_acpi_device(adev); + goto err; + } else { + return; + } + } acpi_bus_put_acpi_device(adev); return;