mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-05-16 02:01:18 -04:00
platform/x86: intel: Add notifiers support
In some cases a driver using services of vsec_tpmi driver requires some
processing before vsec_tpmi exits. For example a children using debugfs
can't use debugfs as this will be deleted by the vsec_tpmi driver.
This is the case when unbind using PCI driver interface. In this case
the remove callback of vsec_tpmi driver is called first, then remove
callback of its children.
Add support of blocking chain notifiers support. Notify on successful probe
and before clean up in the remove callback.
Fixes: 811f67c516 ("platform/x86/intel/tpmi: Add new auxiliary driver for performance limits")
Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Cc: Stable@vger.kernel.org
Link: https://patch.msgid.link/20260430151103.1549733-3-srinivas.pandruvada@linux.intel.com
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
This commit is contained in:
committed by
Ilpo Järvinen
parent
ad3bff944c
commit
57c347a2e2
@@ -56,6 +56,7 @@
|
||||
#include <linux/io.h>
|
||||
#include <linux/iopoll.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/notifier.h>
|
||||
#include <linux/pci.h>
|
||||
#include <linux/security.h>
|
||||
#include <linux/sizes.h>
|
||||
@@ -188,6 +189,20 @@ struct tpmi_feature_state {
|
||||
/* Used during auxbus device creation */
|
||||
static DEFINE_IDA(intel_vsec_tpmi_ida);
|
||||
|
||||
static BLOCKING_NOTIFIER_HEAD(tpmi_notify_list);
|
||||
|
||||
int tpmi_register_notifier(struct notifier_block *nb)
|
||||
{
|
||||
return blocking_notifier_chain_register(&tpmi_notify_list, nb);
|
||||
}
|
||||
EXPORT_SYMBOL_NS_GPL(tpmi_register_notifier, "INTEL_TPMI");
|
||||
|
||||
int tpmi_unregister_notifier(struct notifier_block *nb)
|
||||
{
|
||||
return blocking_notifier_chain_unregister(&tpmi_notify_list, nb);
|
||||
}
|
||||
EXPORT_SYMBOL_NS_GPL(tpmi_unregister_notifier, "INTEL_TPMI");
|
||||
|
||||
struct oobmsm_plat_info *tpmi_get_platform_data(struct auxiliary_device *auxdev)
|
||||
{
|
||||
struct intel_vsec_device *vsec_dev = auxdev_to_ivdev(auxdev);
|
||||
@@ -832,6 +847,8 @@ static int intel_vsec_tpmi_init(struct auxiliary_device *auxdev)
|
||||
return ret;
|
||||
}
|
||||
|
||||
blocking_notifier_call_chain(&tpmi_notify_list, TPMI_CORE_INIT, auxdev);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -845,6 +862,8 @@ static void tpmi_remove(struct auxiliary_device *auxdev)
|
||||
{
|
||||
struct intel_tpmi_info *tpmi_info = auxiliary_get_drvdata(auxdev);
|
||||
|
||||
blocking_notifier_call_chain(&tpmi_notify_list, TPMI_CORE_EXIT, auxdev);
|
||||
|
||||
debugfs_remove_recursive(tpmi_info->dbgfs_dir);
|
||||
}
|
||||
|
||||
|
||||
@@ -28,6 +28,12 @@ enum intel_tpmi_id {
|
||||
TPMI_INFO_ID = 0x81, /* Special ID for PCI BDF and Package ID information */
|
||||
};
|
||||
|
||||
#define TPMI_CORE_INIT 0
|
||||
#define TPMI_CORE_EXIT 1
|
||||
|
||||
int tpmi_register_notifier(struct notifier_block *nb);
|
||||
int tpmi_unregister_notifier(struct notifier_block *nb);
|
||||
|
||||
struct oobmsm_plat_info *tpmi_get_platform_data(struct auxiliary_device *auxdev);
|
||||
struct resource *tpmi_get_resource_at_index(struct auxiliary_device *auxdev, int index);
|
||||
int tpmi_get_resource_count(struct auxiliary_device *auxdev);
|
||||
|
||||
Reference in New Issue
Block a user