mailbox: mailbox-test: fix debugfs in multi-instances
Create one debug entry directory per instance to support the multi instantiation. Signed-off-by: Ludovic Barre <ludovic.barre@st.com> Signed-off-by: Fabien Dessenne <fabien.dessenne@st.com> Signed-off-by: Jassi Brar <jaswinder.singh@linaro.org>
This commit is contained in:
Родитель
a904327e98
Коммит
10cfc5a92e
|
@ -31,7 +31,6 @@
|
||||||
(MBOX_MAX_MSG_LEN / MBOX_BYTES_PER_LINE))
|
(MBOX_MAX_MSG_LEN / MBOX_BYTES_PER_LINE))
|
||||||
|
|
||||||
static bool mbox_data_ready;
|
static bool mbox_data_ready;
|
||||||
static struct dentry *root_debugfs_dir;
|
|
||||||
|
|
||||||
struct mbox_test_device {
|
struct mbox_test_device {
|
||||||
struct device *dev;
|
struct device *dev;
|
||||||
|
@ -45,6 +44,7 @@ struct mbox_test_device {
|
||||||
spinlock_t lock;
|
spinlock_t lock;
|
||||||
wait_queue_head_t waitq;
|
wait_queue_head_t waitq;
|
||||||
struct fasync_struct *async_queue;
|
struct fasync_struct *async_queue;
|
||||||
|
struct dentry *root_debugfs_dir;
|
||||||
};
|
};
|
||||||
|
|
||||||
static ssize_t mbox_test_signal_write(struct file *filp,
|
static ssize_t mbox_test_signal_write(struct file *filp,
|
||||||
|
@ -262,16 +262,16 @@ static int mbox_test_add_debugfs(struct platform_device *pdev,
|
||||||
if (!debugfs_initialized())
|
if (!debugfs_initialized())
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
root_debugfs_dir = debugfs_create_dir("mailbox", NULL);
|
tdev->root_debugfs_dir = debugfs_create_dir(dev_name(&pdev->dev), NULL);
|
||||||
if (!root_debugfs_dir) {
|
if (!tdev->root_debugfs_dir) {
|
||||||
dev_err(&pdev->dev, "Failed to create Mailbox debugfs\n");
|
dev_err(&pdev->dev, "Failed to create Mailbox debugfs\n");
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
debugfs_create_file("message", 0600, root_debugfs_dir,
|
debugfs_create_file("message", 0600, tdev->root_debugfs_dir,
|
||||||
tdev, &mbox_test_message_ops);
|
tdev, &mbox_test_message_ops);
|
||||||
|
|
||||||
debugfs_create_file("signal", 0200, root_debugfs_dir,
|
debugfs_create_file("signal", 0200, tdev->root_debugfs_dir,
|
||||||
tdev, &mbox_test_signal_ops);
|
tdev, &mbox_test_signal_ops);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -416,7 +416,7 @@ static int mbox_test_remove(struct platform_device *pdev)
|
||||||
{
|
{
|
||||||
struct mbox_test_device *tdev = platform_get_drvdata(pdev);
|
struct mbox_test_device *tdev = platform_get_drvdata(pdev);
|
||||||
|
|
||||||
debugfs_remove_recursive(root_debugfs_dir);
|
debugfs_remove_recursive(tdev->root_debugfs_dir);
|
||||||
|
|
||||||
if (tdev->tx_channel)
|
if (tdev->tx_channel)
|
||||||
mbox_free_channel(tdev->tx_channel);
|
mbox_free_channel(tdev->tx_channel);
|
||||||
|
|
Загрузка…
Ссылка в новой задаче