Re: [PATCH] staging: media: atomisp: Replace scnprintf with sysfs_emit in bo_show

From: Abdelrahman Fekry
Date: Sun Jun 22 2025 - 02:36:31 EST


Thanks for the review
On Sat, Jun 21, 2025 at 9:25 PM Andy Shevchenko
<andy.shevchenko@xxxxxxxxx> wrote:
>
> On Sat, Jun 21, 2025 at 9:30 AM Abdelrahman Fekry
> <abdelrahmanfekry375@xxxxxxxxx> wrote:
> >
> > Convert buffer output to use sysfs_emit/sysfs_emit_at API for safer
> > PAGE_SIZE handling and standardized sysfs output.
>
> ...
>
> > - ssize_t ret = 0;
> > + ssize_t offset = 0;
>
> It would be good to move this...
>
> > struct hmm_buffer_object *bo;
> > unsigned long flags;
> > int i;
> > long total[HMM_BO_LAST] = { 0 };
> > long count[HMM_BO_LAST] = { 0 };
> > - int index1 = 0;
> > - int index2 = 0;
>
> ...to be here.

noted , thanks.

> >
> > - ret = scnprintf(buf, PAGE_SIZE, "type pgnr\n");
> > - if (ret <= 0)
> > - return 0;
> > -
> > - index1 += ret;
> > + offset += sysfs_emit(buf, "type pgnr\n");
>
> This changes the behaviour in case the sysfs_emit() fails. Not that
> this is a big issue, but it should be pointed out somewhere.

noted , will make a comment about it.
> ...
>
> > + /* Direct return of accumlated length */
>
> accumulated
>
> Don't forget to run a spell-checker.
>
noted .
> --
> With Best Regards,
> Andy Shevchenko