| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-or-later |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * Copyright (C) 2015 ST Microelectronics |
|---|
| 3 | 4 | * |
|---|
| 4 | 5 | * 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. |
|---|
| 10 | 6 | */ |
|---|
| 11 | 7 | |
|---|
| 12 | 8 | #include <linux/debugfs.h> |
|---|
| .. | .. |
|---|
| 31 | 27 | (MBOX_MAX_MSG_LEN / MBOX_BYTES_PER_LINE)) |
|---|
| 32 | 28 | |
|---|
| 33 | 29 | static bool mbox_data_ready; |
|---|
| 34 | | -static struct dentry *root_debugfs_dir; |
|---|
| 35 | 30 | |
|---|
| 36 | 31 | struct mbox_test_device { |
|---|
| 37 | 32 | struct device *dev; |
|---|
| .. | .. |
|---|
| 45 | 40 | spinlock_t lock; |
|---|
| 46 | 41 | wait_queue_head_t waitq; |
|---|
| 47 | 42 | struct fasync_struct *async_queue; |
|---|
| 43 | + struct dentry *root_debugfs_dir; |
|---|
| 48 | 44 | }; |
|---|
| 49 | 45 | |
|---|
| 50 | 46 | static ssize_t mbox_test_signal_write(struct file *filp, |
|---|
| .. | .. |
|---|
| 262 | 258 | if (!debugfs_initialized()) |
|---|
| 263 | 259 | return 0; |
|---|
| 264 | 260 | |
|---|
| 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) { |
|---|
| 267 | 263 | dev_err(&pdev->dev, "Failed to create Mailbox debugfs\n"); |
|---|
| 268 | 264 | return -EINVAL; |
|---|
| 269 | 265 | } |
|---|
| 270 | 266 | |
|---|
| 271 | | - debugfs_create_file("message", 0600, root_debugfs_dir, |
|---|
| 267 | + debugfs_create_file("message", 0600, tdev->root_debugfs_dir, |
|---|
| 272 | 268 | tdev, &mbox_test_message_ops); |
|---|
| 273 | 269 | |
|---|
| 274 | | - debugfs_create_file("signal", 0200, root_debugfs_dir, |
|---|
| 270 | + debugfs_create_file("signal", 0200, tdev->root_debugfs_dir, |
|---|
| 275 | 271 | tdev, &mbox_test_signal_ops); |
|---|
| 276 | 272 | |
|---|
| 277 | 273 | return 0; |
|---|
| .. | .. |
|---|
| 418 | 414 | { |
|---|
| 419 | 415 | struct mbox_test_device *tdev = platform_get_drvdata(pdev); |
|---|
| 420 | 416 | |
|---|
| 421 | | - debugfs_remove_recursive(root_debugfs_dir); |
|---|
| 417 | + debugfs_remove_recursive(tdev->root_debugfs_dir); |
|---|
| 422 | 418 | |
|---|
| 423 | 419 | if (tdev->tx_channel) |
|---|
| 424 | 420 | mbox_free_channel(tdev->tx_channel); |
|---|