Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp2950987rwd; Fri, 16 Jun 2023 10:11:08 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6PLNg1Akz0orMvXbnK0KVjs4ZjefTQTNRdZhqFOx2hAJXGx1Fwn/G2xnDE2LvYyEvRPDiv X-Received: by 2002:a17:90a:6b46:b0:25e:b3f6:a352 with SMTP id x6-20020a17090a6b4600b0025eb3f6a352mr2300222pjl.28.1686935467678; Fri, 16 Jun 2023 10:11:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686935467; cv=none; d=google.com; s=arc-20160816; b=gyDdt45L7R1Pq3W5zYTO7heJmSPtnfEQpeERcnd+ufxLaJifndw9IP15/73qP6S6Ny 9tk9V8bawPdkk2j9rmXDSijU7Nct6EcLR88MgD/jvLxCD5umaYepcRL2R1eKni5HO8Uc G8B/ZMoE0pcTn421W61KuyB2HLrE742Sk4tpdjnhcFkUzzREp57tcHdIpA6jPvoubnFz UCLj6hjtafT3kzLKybfqGhjh3oDGlLysGF9OGt/2s5VeVmy9noNiO+awRgrsgWH7S8hl 3d9D7KGpQY8nLn97KANd9kKbanDONr1rpQ6vQfIpZULXQZSahlvKLEK6AIuaiCAHZw0i N5VQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=PQ7DPswKxrOIaZp8HeSjEZuHRACT0bN753u0Gj2F6U0=; b=yKOnGJojEPjKSoLUaQ06JTUtSO5B9mJifZEeHYRr4dHnbpAXF8ay29GxCVjjfQHG8g sEJ1BBg85XGKxjTxLONA8NrrW8+i6Kq1mXB5vOW/fI1KUvMMHjh0hrNvy07+Cd2+qi5f s4zVCzPQwuVp3zXHHrrhbY7K45HvC3kwdfgcgDjX3HJBaTAWaQCBTvl2bxmuH8kEO+gE NOa/Bk0tXpdAOgYB3MtoyDeU4pV//rU+TPVLVG8yLEN6L4bSGZ/+lTJvb94vsInG3LJj FfSxb9H4Q6jdwjl5jEYYqm3PKULcVeT6l87L7r6Ty+HpUV9Hzx2ORbMlxXX8z0oGT953 nw8A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=VGeUntbe; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s2-20020a17090ad48200b00256ae6cfd31si1933754pju.101.2023.06.16.10.10.29; Fri, 16 Jun 2023 10:11:07 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=VGeUntbe; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344185AbjFPQvD (ORCPT + 99 others); Fri, 16 Jun 2023 12:51:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37194 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343594AbjFPQu7 (ORCPT ); Fri, 16 Jun 2023 12:50:59 -0400 Received: from mga06.intel.com (mga06b.intel.com [134.134.136.31]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A9D53E4B; Fri, 16 Jun 2023 09:50:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1686934257; x=1718470257; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=8UvyzPcfXTAF64SpSK/iQMRURHuN5IiuY8+/vdbpQTg=; b=VGeUntbeYs6L4U9yD9ODOzD7AVAYB7Uo1At2/BqcWvlhSsSUTXd/HcVn jPmPB48OCu5XqPRDZIzzmlkV+iLMNbzl55GXFB6hq60UNckBHQSYgQVSJ hkbFd6ZfoBNxtroAc+NCO+3+wozcJ7BXLZ+H7LnvFhivq1xxDeNykKC9E Pf1aYo3kodeufOiKGm/rp6632YJyZF1wGWH6s6p0rAikHtCfJVlpMORgV asZXq0yPIj6mgpSoUirr0W3n+yN/GI+8Rnzt13G8pZj9J82rpOrb4PmDV YTwZ5c9g0qZa6oBt+ncfDTWbO5uPO95vZCx3CD7wRZqSz+1PZ8oh5ZN28 A==; X-IronPort-AV: E=McAfee;i="6600,9927,10743"; a="422912944" X-IronPort-AV: E=Sophos;i="6.00,248,1681196400"; d="scan'208";a="422912944" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Jun 2023 09:50:57 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10743"; a="707154086" X-IronPort-AV: E=Sophos;i="6.00,248,1681196400"; d="scan'208";a="707154086" Received: from powerlab.fi.intel.com ([10.237.71.25]) by orsmga007-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Jun 2023 09:50:53 -0700 From: Michal Wilczynski To: linux-acpi@vger.kernel.org Cc: rafael@kernel.org, dan.j.williams@intel.com, vishal.l.verma@intel.com, lenb@kernel.org, dave.jiang@intel.com, ira.weiny@intel.com, rui.zhang@intel.com, linux-kernel@vger.kernel.org, nvdimm@lists.linux.dev, Michal Wilczynski , "Rafael J . Wysocki" Subject: [PATCH v5 01/10] acpi/bus: Introduce wrappers for ACPICA event handler install/remove Date: Fri, 16 Jun 2023 19:50:25 +0300 Message-ID: <20230616165034.3630141-2-michal.wilczynski@intel.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230616165034.3630141-1-michal.wilczynski@intel.com> References: <20230616165034.3630141-1-michal.wilczynski@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Introduce new acpi_dev_install_notify_handler() and acpi_dev_remove_notify_handler(). Those functions are replacing old installers, and after all drivers switch to the new model, old installers will be removed. Make acpi_dev_install_notify_handler() and acpi_dev_remove_notify_handler() non-static, and export symbols. This will allow the drivers to call them directly, instead of relying on .notify callback. Suggested-by: Rafael J. Wysocki Signed-off-by: Michal Wilczynski --- drivers/acpi/bus.c | 26 ++++++++++++++++++++++++++ include/acpi/acpi_bus.h | 6 ++++++ 2 files changed, 32 insertions(+) diff --git a/drivers/acpi/bus.c b/drivers/acpi/bus.c index b6ab3608d782..22468589c551 100644 --- a/drivers/acpi/bus.c +++ b/drivers/acpi/bus.c @@ -557,6 +557,32 @@ static void acpi_device_remove_notify_handler(struct acpi_device *device, acpi_os_wait_events_complete(); } +int acpi_dev_install_notify_handler(struct acpi_device *adev, + u32 handler_type, + acpi_notify_handler handler) +{ + acpi_status status; + + status = acpi_install_notify_handler(adev->handle, + handler_type, + handler, + adev); + if (ACPI_FAILURE(status)) + return -ENODEV; + + return 0; +} +EXPORT_SYMBOL(acpi_dev_install_notify_handler); + +void acpi_dev_remove_notify_handler(struct acpi_device *adev, + u32 handler_type, + acpi_notify_handler handler) +{ + acpi_remove_notify_handler(adev->handle, handler_type, handler); + acpi_os_wait_events_complete(); +} +EXPORT_SYMBOL(acpi_dev_remove_notify_handler); + /* Handle events targeting \_SB device (at present only graceful shutdown) */ #define ACPI_SB_NOTIFY_SHUTDOWN_REQUEST 0x81 diff --git a/include/acpi/acpi_bus.h b/include/acpi/acpi_bus.h index c941d99162c0..23fbe4a16972 100644 --- a/include/acpi/acpi_bus.h +++ b/include/acpi/acpi_bus.h @@ -515,6 +515,12 @@ void acpi_bus_private_data_handler(acpi_handle, void *); int acpi_bus_get_private_data(acpi_handle, void **); int acpi_bus_attach_private_data(acpi_handle, void *); void acpi_bus_detach_private_data(acpi_handle); +int acpi_dev_install_notify_handler(struct acpi_device *adev, + u32 handler_type, + acpi_notify_handler handler); +void acpi_dev_remove_notify_handler(struct acpi_device *adev, + u32 handler_type, + acpi_notify_handler handler); extern int acpi_notifier_call_chain(struct acpi_device *, u32, u32); extern int register_acpi_notifier(struct notifier_block *); extern int unregister_acpi_notifier(struct notifier_block *); -- 2.41.0