From: Hui Tang <tanghui20@huawei.com>
To: <herbert@gondor.apana.org.au>, <davem@davemloft.net>
Cc: <linux-crypto@vger.kernel.org>, <xuzaibo@huawei.com>,
<wangzhou1@hisilicon.com>, <linux-kernel@vger.kernel.org>
Subject: [PATCH] crypto: hisilicon - check if debugfs opened
Date: Sat, 27 Mar 2021 16:33:00 +0800 [thread overview]
Message-ID: <1616833980-11006-1-git-send-email-tanghui20@huawei.com> (raw)
'xx_debugfs_init' check if debugfs opened.
Signed-off-by: Hui Tang <tanghui20@huawei.com>
---
drivers/crypto/hisilicon/hpre/hpre_main.c | 5 ++++-
drivers/crypto/hisilicon/qm.c | 3 +++
drivers/crypto/hisilicon/sec2/sec_main.c | 5 ++++-
drivers/crypto/hisilicon/zip/zip_main.c | 3 +++
4 files changed, 14 insertions(+), 2 deletions(-)
diff --git a/drivers/crypto/hisilicon/hpre/hpre_main.c b/drivers/crypto/hisilicon/hpre/hpre_main.c
index c7ab06d..f2605c4 100644
--- a/drivers/crypto/hisilicon/hpre/hpre_main.c
+++ b/drivers/crypto/hisilicon/hpre/hpre_main.c
@@ -779,6 +779,9 @@ static int hpre_debugfs_init(struct hisi_qm *qm)
struct device *dev = &qm->pdev->dev;
int ret;
+ if (!debugfs_initialized())
+ return -ENOENT;
+
qm->debug.debug_root = debugfs_create_dir(dev_name(dev),
hpre_debugfs_root);
@@ -949,7 +952,7 @@ static int hpre_probe(struct pci_dev *pdev, const struct pci_device_id *id)
ret = hpre_debugfs_init(qm);
if (ret)
- dev_warn(&pdev->dev, "init debugfs fail!\n");
+ dev_warn(&pdev->dev, "init debugfs fail (%d)!\n", ret);
ret = hisi_qm_alg_register(qm, &hpre_devices);
if (ret < 0) {
diff --git a/drivers/crypto/hisilicon/qm.c b/drivers/crypto/hisilicon/qm.c
index bc23174..14f2656 100644
--- a/drivers/crypto/hisilicon/qm.c
+++ b/drivers/crypto/hisilicon/qm.c
@@ -2926,6 +2926,9 @@ void hisi_qm_debug_init(struct hisi_qm *qm)
void *data;
int i;
+ if (!debugfs_initialized())
+ return;
+
qm_d = debugfs_create_dir("qm", qm->debug.debug_root);
qm->debug.qm_d = qm_d;
diff --git a/drivers/crypto/hisilicon/sec2/sec_main.c b/drivers/crypto/hisilicon/sec2/sec_main.c
index 78a6043..226475d 100644
--- a/drivers/crypto/hisilicon/sec2/sec_main.c
+++ b/drivers/crypto/hisilicon/sec2/sec_main.c
@@ -695,6 +695,9 @@ static int sec_debugfs_init(struct hisi_qm *qm)
struct device *dev = &qm->pdev->dev;
int ret;
+ if (!debugfs_initialized())
+ return -ENOENT;
+
qm->debug.debug_root = debugfs_create_dir(dev_name(dev),
sec_debugfs_root);
qm->debug.sqe_mask_offset = SEC_SQE_MASK_OFFSET;
@@ -928,7 +931,7 @@ static int sec_probe(struct pci_dev *pdev, const struct pci_device_id *id)
ret = sec_debugfs_init(qm);
if (ret)
- pci_warn(pdev, "Failed to init debugfs!\n");
+ pci_warn(pdev, "Failed to init debugfs (%d)!\n", ret);
ret = hisi_qm_alg_register(qm, &sec_devices);
if (ret < 0) {
diff --git a/drivers/crypto/hisilicon/zip/zip_main.c b/drivers/crypto/hisilicon/zip/zip_main.c
index 02c44572..4b111c0 100644
--- a/drivers/crypto/hisilicon/zip/zip_main.c
+++ b/drivers/crypto/hisilicon/zip/zip_main.c
@@ -600,6 +600,9 @@ static int hisi_zip_debugfs_init(struct hisi_qm *qm)
struct dentry *dev_d;
int ret;
+ if (!debugfs_initialized())
+ return -ENOENT;
+
dev_d = debugfs_create_dir(dev_name(dev), hzip_debugfs_root);
qm->debug.sqe_mask_offset = HZIP_SQE_MASK_OFFSET;
--
2.8.1
next reply other threads:[~2021-03-27 8:36 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-03-27 8:33 Hui Tang [this message]
2021-03-28 15:09 ` [PATCH] crypto: hisilicon - check if debugfs opened Greg KH
2021-03-30 12:09 ` tanghui20
2021-03-30 12:23 ` Greg KH
2021-03-30 12:40 ` tanghui20
2021-03-30 12:45 ` Greg KH
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1616833980-11006-1-git-send-email-tanghui20@huawei.com \
--to=tanghui20@huawei.com \
--cc=davem@davemloft.net \
--cc=herbert@gondor.apana.org.au \
--cc=linux-crypto@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=wangzhou1@hisilicon.com \
--cc=xuzaibo@huawei.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).