[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <878rjm2kfm.fsf@intel.com>
Date: Mon, 05 Dec 2022 12:50:53 +0200
From: Jani Nikula <jani.nikula@...ux.intel.com>
To: ye.xingchen@....com.cn, joonas.lahtinen@...ux.intel.com
Cc: rodrigo.vivi@...el.com, tvrtko.ursulin@...ux.intel.com,
airlied@...il.com, daniel@...ll.ch,
intel-gfx@...ts.freedesktop.org, dri-devel@...ts.freedesktop.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] drm/i915: use sysfs_emit() to instead of scnprintf()
On Thu, 01 Dec 2022, <ye.xingchen@....com.cn> wrote:
> From: ye xingchen <ye.xingchen@....com.cn>
>
> Replace the open-code with sysfs_emit() to simplify the code.
I was going to push this, but noticed the function has a third
scnprintf(), and the last two play together with count. It would be
confusing to have a mix of sysfs_emit() and scnprintf(). The third one
can't be blindly converted to sysfs_emit() because it writes at an
offset not aligned by PAGE_SIZE.
So I'm not taking this.
BR,
Jani.
>
> Signed-off-by: ye xingchen <ye.xingchen@....com.cn>
> ---
> drivers/gpu/drm/i915/i915_mitigations.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/i915_mitigations.c b/drivers/gpu/drm/i915/i915_mitigations.c
> index def7302ef7fe..2b7aaaefb3a9 100644
> --- a/drivers/gpu/drm/i915/i915_mitigations.c
> +++ b/drivers/gpu/drm/i915/i915_mitigations.c
> @@ -102,10 +102,10 @@ static int mitigations_get(char *buffer, const struct kernel_param *kp)
> bool enable;
>
> if (!local)
> - return scnprintf(buffer, PAGE_SIZE, "%s\n", "off");
> + return sysfs_emit(buffer, "%s\n", "off");
>
> if (local & BIT(BITS_PER_LONG - 1)) {
> - count = scnprintf(buffer, PAGE_SIZE, "%s,", "auto");
> + count = sysfs_emit(buffer, "%s,", "auto");
> enable = false;
> } else {
> enable = true;
--
Jani Nikula, Intel Open Source Graphics Center
Powered by blists - more mailing lists