[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAHp75Ve3PWgkwncVv5tGxzjWkF+Nodtp=Q3dpCejfSRD1BFMig@mail.gmail.com>
Date: Sat, 21 Jun 2025 21:24:40 +0300
From: Andy Shevchenko <andy.shevchenko@...il.com>
To: Abdelrahman Fekry <abdelrahmanfekry375@...il.com>
Cc: andy@...nel.org, hansg@...nel.org, mchehab@...nel.org,
sakari.ailus@...ux.intel.com, gregkh@...uxfoundation.org,
linux-kernel@...r.kernel.org, linux-media@...r.kernel.org,
linux-staging@...ts.linux.dev, skhan@...uxfoundation.org,
linux-kernel-mentees@...ts.linux.dev
Subject: Re: [PATCH] staging: media: atomisp: Replace scnprintf with
sysfs_emit in bo_show
On Sat, Jun 21, 2025 at 9:30 AM Abdelrahman Fekry
<abdelrahmanfekry375@...il.com> 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.
>
> - 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.
...
> + /* Direct return of accumlated length */
accumulated
Don't forget to run a spell-checker.
--
With Best Regards,
Andy Shevchenko
Powered by blists - more mailing lists