From patchwork Fri Jun 30 07:25:38 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: 9818589 X-Patchwork-Delegate: rjw@sisk.pl 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 9F651603D7 for ; Fri, 30 Jun 2017 07:26:02 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8C3C128504 for ; Fri, 30 Jun 2017 07:26:02 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 80DDB285DA; Fri, 30 Jun 2017 07:26:02 +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 B46AE28504 for ; Fri, 30 Jun 2017 07:26:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751689AbdF3H0A (ORCPT ); Fri, 30 Jun 2017 03:26:00 -0400 Received: from mail-pg0-f67.google.com ([74.125.83.67]:33361 "EHLO mail-pg0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751637AbdF3H0A (ORCPT ); Fri, 30 Jun 2017 03:26:00 -0400 Received: by mail-pg0-f67.google.com with SMTP id u62so14504503pgb.0; Fri, 30 Jun 2017 00:25:59 -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=nLe4rXWzNeftRWTnEaqkxBJ1gBq8doquu/QMbURtSISNUGzJdmMvZ9Wq+t3+DgXIzU FIUwMnFHid9W9mjRGcUyjMIViJfRBihkxNCfkOSmB32IRZXUqYJ4n/4sSWygBlEh0rue 7x7qH59x4Yp+4cZpUGjcfsFJYQnqK1ldZuAGI2K2hw/J3HmjfH833sl393R6as0Exs3T HIiDnCITST76Xvm58XqD/qrgXJUbCevYBZe5Ra1LkU2Uati7MVTPYPB9qQpgVF9FYvnL L8nMdQqeDLSes6sxoxbPxGrXkANphwI3UmhEYYPaMxIICzcLQ0VbgO43eMuX5CKMRkeV E0/Q== 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=TCcaCznXLe5aOB0u+YhEhPmVBSLXKp0Cv/4DRyH8h2cGCbPRzmJ/kaDSxwXdMPYW35 J81JAjhleJNRpb+85MUxuZH7gC1T+m1haBuoVWWSQmrX74GWixFR2HIw4GUGml1T9oaM YU7DFyNTHTvGhoYCK9a6yC37tMDQhX+qvbHYuobFgtUNxh3gMzu25MURXla2/w8KZFqt tDviEeSPLBACQ+Z/k6GAS5pVgEaCvxIIdd7Q1qAIVfpVr4r18HshtVn+VI23Xv9VUixb BU+MO2rKdA14dNI+VRJ+n2uxmRIgopS5FIrJa8hdk+eVaiVGB5siT2F05meDxHYSOHEM eKkA== X-Gm-Message-State: AKS2vOwRvSI8DTpl708cOOd00wRUWJGWLmK+DI3px/PPkOKmYsFZD7e5 TKnPVuFnhJ8K3g== X-Received: by 10.99.4.6 with SMTP id 6mr20124895pge.126.1498807559453; Fri, 30 Jun 2017 00:25:59 -0700 (PDT) Received: from linux-l9pv.suse ([45.122.156.254]) by smtp.gmail.com with ESMTPSA id e124sm17777920pfc.76.2017.06.30.00.25.57 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 30 Jun 2017 00:25:58 -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, 30 Jun 2017 15:25:38 +0800 Message-Id: <20170630072538.12910-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 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);