Skip to content

Commit 10cfc5a

Browse files
FDESTMJassiBrar
authored andcommitted
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>
1 parent a904327 commit 10cfc5a

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

drivers/mailbox/mailbox-test.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@
3131
(MBOX_MAX_MSG_LEN / MBOX_BYTES_PER_LINE))
3232

3333
static bool mbox_data_ready;
34-
static struct dentry *root_debugfs_dir;
3534

3635
struct mbox_test_device {
3736
struct device *dev;
@@ -45,6 +44,7 @@ struct mbox_test_device {
4544
spinlock_t lock;
4645
wait_queue_head_t waitq;
4746
struct fasync_struct *async_queue;
47+
struct dentry *root_debugfs_dir;
4848
};
4949

5050
static ssize_t mbox_test_signal_write(struct file *filp,
@@ -262,16 +262,16 @@ static int mbox_test_add_debugfs(struct platform_device *pdev,
262262
if (!debugfs_initialized())
263263
return 0;
264264

265-
root_debugfs_dir = debugfs_create_dir("mailbox", NULL);
266-
if (!root_debugfs_dir) {
265+
tdev->root_debugfs_dir = debugfs_create_dir(dev_name(&pdev->dev), NULL);
266+
if (!tdev->root_debugfs_dir) {
267267
dev_err(&pdev->dev, "Failed to create Mailbox debugfs\n");
268268
return -EINVAL;
269269
}
270270

271-
debugfs_create_file("message", 0600, root_debugfs_dir,
271+
debugfs_create_file("message", 0600, tdev->root_debugfs_dir,
272272
tdev, &mbox_test_message_ops);
273273

274-
debugfs_create_file("signal", 0200, root_debugfs_dir,
274+
debugfs_create_file("signal", 0200, tdev->root_debugfs_dir,
275275
tdev, &mbox_test_signal_ops);
276276

277277
return 0;
@@ -416,7 +416,7 @@ static int mbox_test_remove(struct platform_device *pdev)
416416
{
417417
struct mbox_test_device *tdev = platform_get_drvdata(pdev);
418418

419-
debugfs_remove_recursive(root_debugfs_dir);
419+
debugfs_remove_recursive(tdev->root_debugfs_dir);
420420

421421
if (tdev->tx_channel)
422422
mbox_free_channel(tdev->tx_channel);

0 commit comments

Comments
 (0)