Re: [PATCH v2 07/13] trinity: Add sysfs module
From: Jiho Chu
Date: Mon Sep 19 2022 - 02:44:33 EST
On Sun, 18 Sep 2022 12:33:06 +0200
Greg KH <gregkh@xxxxxxxxxxxxxxxxxxx> wrote:
> On Sat, Sep 17, 2022 at 04:23:50PM +0900, Jiho Chu wrote:
> > This patch includes sysfs interfaces.
> >
> > sysfs interface provides NPU's internal statistics, status and control
> > attribes.
> >
> > The sysfs information provided by the Trinity are:
> > - IDU version
> > - profiling result
> > - allocated debugfs buffer
> >
> > The control attributes are including:
> > - initialize profile operation
> > - NPU control (suspend/resume/stop)
> >
> > Signed-off-by: Jiho Chu <jiho.chu@xxxxxxxxxxx>
> > Signed-off-by: Yelin Jeong <yelini.jeong@xxxxxxxxxxx>
> > Signed-off-by: Dongju Chae <dongju.chae@xxxxxxxxxxx>
> > Signed-off-by: MyungJoo Ham <myungjoo.ham@xxxxxxxxxxx>
> > ---
> > .../ABI/testing/sysfs-driver-trinity | 55 ++
> > drivers/misc/trinity/Makefile | 1 +
> > drivers/misc/trinity/trinity_sysfs.c | 667 ++++++++++++++++++
> > 3 files changed, 723 insertions(+)
> > create mode 100644 Documentation/ABI/testing/sysfs-driver-trinity
> > create mode 100644 drivers/misc/trinity/trinity_sysfs.c
> >
> > diff --git a/Documentation/ABI/testing/sysfs-driver-trinity b/Documentation/ABI/testing/sysfs-driver-trinity
> > new file mode 100644
> > index 000000000000..754e6f36a1dc
> > --- /dev/null
> > +++ b/Documentation/ABI/testing/sysfs-driver-trinity
> > @@ -0,0 +1,55 @@
> > +What: /sys/devices/platform/trinity/*.triv2/debug/debugfs_max
> > +Date: July 2022
> > +KernelVersion: 5.19-rc8
> > +Contact: Jiho Chu <jiho.chu@xxxxxxxxxxx>
> > +Description: Shows current allocated debugfs entry size.
> > + Note that, Writing max entry size allocates NPU's hardware
> > + memory for debugfs entries.
>
> Why are debugfs things being mentioned in sysfs entries?
>
> That's not needed, nor is it allowed, sorry.
>
> Please put all debugfs stuff in debugfs.
>
> Also, sysfs is "one value per file", you violate that in lots of ways
> with this patch. Please fix all of that, and use the sysfs_emit() calls
> instead of snprintf() for your sysfs show calls.
>
> thanks,
>
> greg k-h
>
Thanks for checking.
I'll fix sysfs entries.
Best regards,
Jiho Chu