On Tue, Mar 30, 2021 at 08:40:07PM +0800, tanghui20 wrote:
> 
> 
> On 2021/3/30 20:23, Greg KH wrote:
> > On Tue, Mar 30, 2021 at 08:09:46PM +0800, tanghui20 wrote:
> > > 
> > > 
> > > On 2021/3/28 23:09, Greg KH wrote:
> > > > On Sat, Mar 27, 2021 at 04:33:00PM +0800, Hui Tang wrote:
> > > > > 'xx_debugfs_init' check if debugfs opened.
> > > > > 
> > > > > Signed-off-by: Hui Tang <tanghu...@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;
> > > > 
> > > > Why?  What does this help with?  Why does the code care if debugfs is
> > > > running or not?
> > > > 
> > > When !CONFIG_DEBUG_FS, there is no problem if debugfs is not checked,
> > > but if checking debugfs, a series of stub functions of debugfs can be
> > > skipped and 'xx_debugfs_init' will be return immediately.
> > 
> > And have you measured an actual speed difference for that?  I would be
> > amazed if you could...
> > 
> 
> I think what you said makes sense.
> I am confused when to use 'debugfs_initialized'.

Never, you should not care about that at all.

thanks,

greg k-h

Reply via email to