From patchwork Fri Jun 9 04:33:45 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: 9777093 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 1D23E6034B for ; Fri, 9 Jun 2017 04:34:32 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0DFE322B39 for ; Fri, 9 Jun 2017 04:34:32 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 029B4285E2; Fri, 9 Jun 2017 04:34:31 +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 86AA322B39 for ; Fri, 9 Jun 2017 04:34:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751499AbdFIEea (ORCPT ); Fri, 9 Jun 2017 00:34:30 -0400 Received: from mail-it0-f65.google.com ([209.85.214.65]:33647 "EHLO mail-it0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750934AbdFIEe3 (ORCPT ); Fri, 9 Jun 2017 00:34:29 -0400 Received: by mail-it0-f65.google.com with SMTP id l6so5285804iti.0; Thu, 08 Jun 2017 21:34:28 -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=hQX3r6dc1TFKdEsAeCua2xALg0Hd1p+AONnpt/JSYuo=; b=ebrnK7+LDh4dP+Czj4FKBA7Tynux6dEq4pVQzVMtrT0JfTpV+8WdpvC+zkEly4aqoP NzmZ/9NdWnss7gqUoMzDPlXhiFMNkUL/8AzUtCK3SJ4pDOgL3vLwW3AoAj9s+8D/hMio yG7p+AnC+kA6meEDuuz7xTcy8t80xmy8ZkI761XY35uTTAS1oEslGi1vjzCdIg2Zaddc N0tX2DrG0wwRwjQny5t+i6eKIrVSv+cyolbPI14xI+LDPRIiUlaKlF/n65HWDtyNwNPC m31HnceBExt4OH0Pp2Kn9gm36kvUIDjJR24you0pllh/tbgv6L9kGN1TUKPg6OoF4tsq +FGQ== 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=hQX3r6dc1TFKdEsAeCua2xALg0Hd1p+AONnpt/JSYuo=; b=WPkANQm7fDqO6aW0JEidVzSC+J6x8pOR/6h9RGcnSFuqf+7cOv+P8VB+iPyfDhYlmK 7MDHomUL07ygSZ7bB6co+z3749RU64z3isrLsMwltIekQZHMTJ19845omhn2dyfwRfKc n6Si/Er7I9QgvBqaScEPkfEEqxMDBkNhV33k4ni+9PjL6SvVf94DDVe0BgG54M3piE65 es/4T+Az6fkiM70NQbXIF7WQTa2wLVjaTZmotUEl+vA+Sn4Bvq4crI2cL0Ce2NizgRuj G5HJvo59IWzcdV7pu/7u86rOEphToynsnDXHoIAm0w43UM1P4JAJ6yA1ukneONJed8QX fbVA== X-Gm-Message-State: AODbwcC0cmtse5bV3C89zmc8zA1EhYguXwnJK2aXGxKhGGoGbnFDSAue x/i2qfBqD6tD4g== X-Received: by 10.36.181.4 with SMTP id v4mr9114816ite.103.1496982867898; Thu, 08 Jun 2017 21:34:27 -0700 (PDT) Received: from linux-l9pv.suse ([45.122.156.254]) by smtp.gmail.com with ESMTPSA id h89sm3366665ioi.18.2017.06.08.21.34.25 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 08 Jun 2017 21:34:27 -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 , Andy Shevchenko Subject: [PATCH v2] acpi: handle the acpi hotplug schedule error Date: Fri, 9 Jun 2017 12:33:45 +0800 Message-Id: <20170609043345.14561-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: Andy Shevchenko Signed-off-by: "Lee, Chun-Yi" Reviewed-by: Andy Shevchenko --- 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); }