1 From f34c01773d5dbd2db04200079bb4d32ecb0cd847 Mon Sep 17 00:00:00 2001
2 From: Roy Pledge <roy.pledge@nxp.com>
3 Date: Tue, 18 Feb 2020 14:02:21 -0500
4 Subject: [PATCH] sdk_qbman: Only create debugfs entries when QBMan is part of
7 Only create debugfs entries if the QBMan nodes exist in the device
10 Signed-off-by: Roy Pledge <roy.pledge@nxp.com>
11 Acked-by: Madalin Bucur <madalin.bucur@nxp.com>
12 Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
14 drivers/staging/fsl_qbman/bman_debugfs.c | 8 +++++++-
15 drivers/staging/fsl_qbman/qman_debugfs.c | 17 ++++++++++-------
16 2 files changed, 17 insertions(+), 8 deletions(-)
18 --- a/drivers/staging/fsl_qbman/bman_debugfs.c
19 +++ b/drivers/staging/fsl_qbman/bman_debugfs.c
21 #include <linux/debugfs.h>
22 #include <linux/seq_file.h>
23 #include <linux/uaccess.h>
24 +#include <linux/of.h>
26 static struct dentry *dfs_root; /* debugfs root directory */
28 @@ -83,9 +84,14 @@ static int __init bman_debugfs_module_in
32 + struct device_node *dn;
34 + dn = of_find_compatible_node(NULL, NULL, "fsl,bman");
36 + pr_debug("No fsl,bman node\n");
39 dfs_root = debugfs_create_dir("bman", NULL);
41 if (dfs_root == NULL) {
43 pr_err("Cannot create bman debugfs dir\n");
44 --- a/drivers/staging/fsl_qbman/qman_debugfs.c
45 +++ b/drivers/staging/fsl_qbman/qman_debugfs.c
46 @@ -1457,13 +1457,16 @@ static int __init qman_debugfs_module_in
50 - if (qman_ccsr_start) {
51 - if (!qman_ccsrmempeek(®, QM_FQD_AR)) {
52 - /* extract the size of the FQD window */
54 - /* calculate valid frame queue descriptor range */
55 - fqid_max = (1 << (reg + 1)) / QM_FQD_BLOCK_SIZE;
57 + if (!qman_ccsr_start) {
58 + /* No QMan node found in device tree */
62 + if (!qman_ccsrmempeek(®, QM_FQD_AR)) {
63 + /* extract the size of the FQD window */
65 + /* calculate valid frame queue descriptor range */
66 + fqid_max = (1 << (reg + 1)) / QM_FQD_BLOCK_SIZE;
68 dfs_root = debugfs_create_dir("qman", NULL);
69 fqd_root = debugfs_create_dir("fqd", dfs_root);