Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp25844863rwd; Mon, 3 Jul 2023 01:40:01 -0700 (PDT) X-Google-Smtp-Source: APBJJlHdZn4Vr9TKs5jJp83Fe3R1ItD2FU86bwvSqiPRaXAMN2uD2kavgFqPS4qzuaKTahYaDddV X-Received: by 2002:a17:90a:1946:b0:263:ac11:c6d2 with SMTP id 6-20020a17090a194600b00263ac11c6d2mr4757717pjh.25.1688373601236; Mon, 03 Jul 2023 01:40:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688373601; cv=none; d=google.com; s=arc-20160816; b=v0Gv0P8EHV2mJ1hLmQaIG2g85grK+F+jiNsfOdE/eopfTAxc77jLpfMumFJfuzjRxe GVBGYxJ9FziOJi63rgZNMs50zBMOwjuETrVLRDdvjPmeAVOaTsmbtZnFqtiY8SGDyErT yT1eZLGfN/7ciAv3J8sVt0XAF8xNuwe4bGYiEPF7gNx3zQR1c36tevsd0JwVW/1Xhjn7 5WnXxWTyoBKP5rYA0HBfdyF9a/WgRFcCC1a3X8rGbLmyzzQjhTUhpNJujC337yy98QOG BrB8eLig8Tgl0Ys57gErwbFg0dVkID10kRAUz5lk8n+d52HOVBf1wXXaWjkmGUD1g7dQ BGlQ== 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=RV+pbOOEAw96/ZKsVA4ziku2MEcbaLjuf5SKH5DBbio=; fh=BmoNGikZ0c0jFVvZ2YLzmoZUwDhNTkpAEx4ktuFUIgk=; b=cISGm8Um7WWwEgFFsv+VZg/1a58YhN/UkF9Ig+/MvrBMFpt2vzHX3wSdBxh6OO7mWF yPkuupwo5M8zAZW5XsvOV5Y+e5jX7oK3O8wxd38LyzIrCqlUXBfhJ6JVeQQOzQsOXDyg ElmFRp0jegt0WfaTU+gd3dGAmUJk7QjDMZ2TXrSxV5ZW7boYpuCZdyvCWv2Vg1BxSMmd FWjW0hxB5/nyhi7SQG71L6xSfPN5GUnBXwfsUFdnj4sjXhLVSrD6SoG2o4aIeytyY49b joYaBNe/0BzCGaKVbe3OVHBFXKyK60UwXGcSYIMHZVW2wJSlJcgFpgzxr1bgiOUEhNpd VZfg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=SOgw3j+J; 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 p11-20020a17090a428b00b0025c287f697asi17576812pjg.35.2023.07.03.01.39.49; Mon, 03 Jul 2023 01:40:01 -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=SOgw3j+J; 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 S231271AbjGCIDm (ORCPT + 99 others); Mon, 3 Jul 2023 04:03:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48998 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231200AbjGCIDa (ORCPT ); Mon, 3 Jul 2023 04:03:30 -0400 Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5226310D1; Mon, 3 Jul 2023 01:03:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1688371398; x=1719907398; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=Lc4+OfSbvvX57NjX05OtAekCe3S3QQ2eQi+GYzBA354=; b=SOgw3j+JCTy1KkHYHcJD0NRdaHrmf7mf8Q1lE3eRlJestsUBHczpFQRA /2102VbmwmvoLaDJ0aiEkJnAkGlwOQ6PtOZQh4hwDSl1aa2p234NrUhSF +IsjfOMK0z8B5TlH+qmf7hd/PBNLfkpp+njyVTWz0SsUus8GHlCce1EJm 6PHjng7iwCsCaI8Nv3Xc/WyJn7oeJEKEqRpN9xSCFu44IIFaCm43JpUZj Q7KteGF/nAe6+t4T/sktnb4wZ/Z8iUa+LCPmfmp2NAkywNhTGfUQW+EQV ZEAj4dkZFshSrE56I9pQXCzGV49nM3VteoM0lkaPzdoPVZQBaihfU+uN6 g==; X-IronPort-AV: E=McAfee;i="6600,9927,10759"; a="366304007" X-IronPort-AV: E=Sophos;i="6.01,177,1684825200"; d="scan'208";a="366304007" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Jul 2023 01:03:17 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10759"; a="862994510" X-IronPort-AV: E=Sophos;i="6.01,177,1684825200"; d="scan'208";a="862994510" Received: from powerlab.fi.intel.com ([10.237.71.25]) by fmsmga001-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Jul 2023 01:03:14 -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 v7 1/9] acpi/bus: Introduce wrappers for ACPICA event handler install/remove Date: Mon, 3 Jul 2023 11:02:44 +0300 Message-ID: <20230703080252.2899090-2-michal.wilczynski@intel.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230703080252.2899090-1-michal.wilczynski@intel.com> References: <20230703080252.2899090-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 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 20cdfb37da79..2d6f1f45d44e 100644 --- a/drivers/acpi/bus.c +++ b/drivers/acpi/bus.c @@ -554,6 +554,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