forked from ~ljy/RK356X_SDK_RELEASE

hc
2023-12-11 072de836f53be56a70cecf70b43ae43b7ce17376
kernel/drivers/mailbox/mailbox-test.c
....@@ -1,12 +1,8 @@
1
+// SPDX-License-Identifier: GPL-2.0-or-later
12 /*
23 * Copyright (C) 2015 ST Microelectronics
34 *
45 * Author: Lee Jones <lee.jones@linaro.org>
5
- *
6
- * This program is free software; you can redistribute it and/or modify
7
- * it under the terms of the GNU General Public License as published by
8
- * the Free Software Foundation; either version 2 of the License, or
9
- * (at your option) any later version.
106 */
117
128 #include <linux/debugfs.h>
....@@ -31,7 +27,6 @@
3127 (MBOX_MAX_MSG_LEN / MBOX_BYTES_PER_LINE))
3228
3329 static bool mbox_data_ready;
34
-static struct dentry *root_debugfs_dir;
3530
3631 struct mbox_test_device {
3732 struct device *dev;
....@@ -45,6 +40,7 @@
4540 spinlock_t lock;
4641 wait_queue_head_t waitq;
4742 struct fasync_struct *async_queue;
43
+ struct dentry *root_debugfs_dir;
4844 };
4945
5046 static ssize_t mbox_test_signal_write(struct file *filp,
....@@ -262,16 +258,16 @@
262258 if (!debugfs_initialized())
263259 return 0;
264260
265
- root_debugfs_dir = debugfs_create_dir("mailbox", NULL);
266
- if (!root_debugfs_dir) {
261
+ tdev->root_debugfs_dir = debugfs_create_dir(dev_name(&pdev->dev), NULL);
262
+ if (!tdev->root_debugfs_dir) {
267263 dev_err(&pdev->dev, "Failed to create Mailbox debugfs\n");
268264 return -EINVAL;
269265 }
270266
271
- debugfs_create_file("message", 0600, root_debugfs_dir,
267
+ debugfs_create_file("message", 0600, tdev->root_debugfs_dir,
272268 tdev, &mbox_test_message_ops);
273269
274
- debugfs_create_file("signal", 0200, root_debugfs_dir,
270
+ debugfs_create_file("signal", 0200, tdev->root_debugfs_dir,
275271 tdev, &mbox_test_signal_ops);
276272
277273 return 0;
....@@ -418,7 +414,7 @@
418414 {
419415 struct mbox_test_device *tdev = platform_get_drvdata(pdev);
420416
421
- debugfs_remove_recursive(root_debugfs_dir);
417
+ debugfs_remove_recursive(tdev->root_debugfs_dir);
422418
423419 if (tdev->tx_channel)
424420 mbox_free_channel(tdev->tx_channel);