From patchwork Tue Jan 28 23:59:04 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Rafael J. Wysocki" X-Patchwork-Id: 3548951 X-Patchwork-Delegate: bhelgaas@google.com Return-Path: X-Original-To: patchwork-linux-pci@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 32A64C02DD for ; Tue, 28 Jan 2014 23:51:51 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 4C5002017E for ; Tue, 28 Jan 2014 23:51:50 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 7BE9C20176 for ; Tue, 28 Jan 2014 23:51:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755575AbaA1XvE (ORCPT ); Tue, 28 Jan 2014 18:51:04 -0500 Received: from v094114.home.net.pl ([79.96.170.134]:50900 "HELO v094114.home.net.pl" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with SMTP id S1755959AbaA1Xu2 (ORCPT ); Tue, 28 Jan 2014 18:50:28 -0500 Received: from afna194.neoplus.adsl.tpnet.pl [178.42.78.194] (HELO vostro.rjw.lan) by serwer1319399.home.pl [79.96.170.134] with SMTP (IdeaSmtpServer v0.80) id 0965caa2893dec8b; Wed, 29 Jan 2014 00:50:26 +0100 From: "Rafael J. Wysocki" To: ACPI Devel Maling List Cc: Bjorn Helgaas , Aaron Lu , Linux Kernel Mailing List , Linux PCI , Mika Westerberg Subject: [Resend][PATCH 2/5][RFT] ACPI / hotplug: Introduce acpi_install_hotplug_notify_handler() Date: Wed, 29 Jan 2014 00:59:04 +0100 Message-ID: <4728352.8ucNUQddoh@vostro.rjw.lan> User-Agent: KMail/4.11.4 (Linux/3.13.0+; KDE/4.11.4; x86_64; ; ) In-Reply-To: <1693151.2qrLZHyp0o@vostro.rjw.lan> References: <2217793.001RY6hKlo@vostro.rjw.lan> <1508034.JFmpIOzjVZ@vostro.rjw.lan> <1693151.2qrLZHyp0o@vostro.rjw.lan> MIME-Version: 1.0 Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Rafael J. Wysocki Introduce a helper routine for installing acpi_hotplug_notify_cb() as an ACPI notify handler for the given ACPI namespace node and make acpi_scan_init_hotplug() use it. This is to make subsequent changes easier to follow. Signed-off-by: Rafael J. Wysocki --- drivers/acpi/scan.c | 15 +++++++++++++-- include/acpi/acpi_bus.h | 2 ++ 2 files changed, 15 insertions(+), 2 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe linux-pci" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Index: linux-pm/drivers/acpi/scan.c =================================================================== --- linux-pm.orig/drivers/acpi/scan.c +++ linux-pm/drivers/acpi/scan.c @@ -523,6 +523,18 @@ static void acpi_hotplug_notify_cb(acpi_ acpi_evaluate_hotplug_ost(handle, type, ost_code, NULL); } +void acpi_install_hotplug_notify_handler(acpi_handle handle, void *data) +{ + acpi_install_notify_handler(handle, ACPI_SYSTEM_NOTIFY, + acpi_hotplug_notify_cb, data); +} + +void acpi_remove_hotplug_notify_handler(acpi_handle handle) +{ + acpi_remove_notify_handler(handle, ACPI_SYSTEM_NOTIFY, + acpi_hotplug_notify_cb); +} + static ssize_t real_power_state_show(struct device *dev, struct device_attribute *attr, char *buf) { @@ -1961,8 +1973,7 @@ static void acpi_scan_init_hotplug(acpi_ list_for_each_entry(hwid, &pnp.ids, list) { handler = acpi_scan_match_handler(hwid->id, NULL); if (handler) { - acpi_install_notify_handler(handle, ACPI_SYSTEM_NOTIFY, - acpi_hotplug_notify_cb, handler); + acpi_install_hotplug_notify_handler(handle, handler); break; } } Index: linux-pm/include/acpi/acpi_bus.h =================================================================== --- linux-pm.orig/include/acpi/acpi_bus.h +++ linux-pm/include/acpi/acpi_bus.h @@ -434,6 +434,8 @@ static inline bool acpi_device_enumerate typedef void (*acpi_hp_callback)(void *data, u32 src); acpi_status acpi_hotplug_execute(acpi_hp_callback func, void *data, u32 src); +void acpi_install_hotplug_notify_handler(acpi_handle handle, void *data); +void acpi_remove_hotplug_notify_handler(acpi_handle handle); /** * module_acpi_driver(acpi_driver) - Helper macro for registering an ACPI driver