[PATCH v5 12/14] firmware: arm_scmi: Create Raw debugfs root dentry

Cristian Marussi cristian.marussi at arm.com
Thu Nov 3 12:52:23 PDT 2022


Create common root debugfs dentry at driver initialization time.

Signed-off-by: Cristian Marussi <cristian.marussi at arm.com>
---
 drivers/firmware/arm_scmi/driver.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/drivers/firmware/arm_scmi/driver.c b/drivers/firmware/arm_scmi/driver.c
index c5bc67a9c103..bbb43b65cbfd 100644
--- a/drivers/firmware/arm_scmi/driver.c
+++ b/drivers/firmware/arm_scmi/driver.c
@@ -14,8 +14,11 @@
  * Copyright (C) 2018-2021 ARM Ltd.
  */
 
+#define pr_fmt(fmt) "SCMI - " fmt
+
 #include <linux/bitmap.h>
 #include <linux/device.h>
+#include <linux/debugfs.h>
 #include <linux/export.h>
 #include <linux/idr.h>
 #include <linux/io.h>
@@ -154,6 +157,8 @@ struct scmi_info {
 	int users;
 };
 
+static struct dentry *scmi_raw_top_dentry;
+
 #define handle_to_scmi_info(h)	container_of(h, struct scmi_info, handle)
 
 void scmi_notification_instance_data_set(const struct scmi_handle *handle,
@@ -2839,6 +2844,14 @@ static int __init scmi_driver_init(void)
 	if (WARN_ON(!IS_ENABLED(CONFIG_ARM_SCMI_HAVE_TRANSPORT)))
 		return -EINVAL;
 
+	if (IS_ENABLED(CONFIG_ARM_SCMI_RAW_MODE_SUPPORT)) {
+		scmi_raw_top_dentry = debugfs_create_dir("scmi_raw", NULL);
+		if (IS_ERR(scmi_raw_top_dentry)) {
+			pr_err("Could NOT create RAW top dentry.\n");
+			scmi_raw_top_dentry = NULL;
+		}
+	}
+
 	scmi_bus_init();
 
 	/* Initialize any compiled-in transport which provided an init/exit */
@@ -2863,6 +2876,9 @@ subsys_initcall(scmi_driver_init);
 
 static void __exit scmi_driver_exit(void)
 {
+	if (IS_ENABLED(CONFIG_ARM_SCMI_RAW_MODE_SUPPORT))
+		debugfs_remove_recursive(scmi_raw_top_dentry);
+
 	scmi_base_unregister();
 
 	scmi_clock_unregister();
-- 
2.34.1




More information about the linux-arm-kernel mailing list