dri-devel.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] drm/i915: use sysfs_emit() to instead of scnprintf()
@ 2022-12-01  2:53 ye.xingchen
  2022-12-05 10:50 ` Jani Nikula
  0 siblings, 1 reply; 3+ messages in thread
From: ye.xingchen @ 2022-12-01  2:53 UTC (permalink / raw)
  To: joonas.lahtinen
  Cc: tvrtko.ursulin, intel-gfx, linux-kernel, dri-devel, rodrigo.vivi

From: ye xingchen <ye.xingchen@zte.com.cn>

Replace the open-code with sysfs_emit() to simplify the code.

Signed-off-by: ye xingchen <ye.xingchen@zte.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;
-- 
2.25.1

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] drm/i915: use sysfs_emit() to instead of scnprintf()
  2022-12-01  2:53 [PATCH] drm/i915: use sysfs_emit() to instead of scnprintf() ye.xingchen
@ 2022-12-05 10:50 ` Jani Nikula
  2022-12-06  4:26   ` Bagas Sanjaya
  0 siblings, 1 reply; 3+ messages in thread
From: Jani Nikula @ 2022-12-05 10:50 UTC (permalink / raw)
  To: ye.xingchen, joonas.lahtinen
  Cc: tvrtko.ursulin, intel-gfx, linux-kernel, dri-devel, rodrigo.vivi

On Thu, 01 Dec 2022, <ye.xingchen@zte.com.cn> wrote:
> From: ye xingchen <ye.xingchen@zte.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@zte.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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] drm/i915: use sysfs_emit() to instead of scnprintf()
  2022-12-05 10:50 ` Jani Nikula
@ 2022-12-06  4:26   ` Bagas Sanjaya
  0 siblings, 0 replies; 3+ messages in thread
From: Bagas Sanjaya @ 2022-12-06  4:26 UTC (permalink / raw)
  To: Jani Nikula
  Cc: tvrtko.ursulin, ye.xingchen, intel-gfx, linux-kernel, dri-devel,
	rodrigo.vivi

[-- Attachment #1: Type: text/plain, Size: 1158 bytes --]

On Mon, Dec 05, 2022 at 12:50:53PM +0200, Jani Nikula wrote:
> On Thu, 01 Dec 2022, <ye.xingchen@zte.com.cn> wrote:
> > From: ye xingchen <ye.xingchen@zte.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.
> 

Hi Jani,

Fortunately you'd NAKed this patch from ZTE people, which are known for
ignoring your (and others) patch review. Remember that they were used to
send from cgel.zte gmail account [1], which after the address was banned
from LKML, they tried to send from their own corporate account but Greg
suspected that emails sent from them are spoofed [2].

Thanks.

[1]: https://lore.kernel.org/lkml/878rn1dd8l.fsf@intel.com/
[2]: https://lore.kernel.org/lkml/Y3NqyDDGz%2FUKPgxM@kroah.com/

-- 
An old man doll... just what I always wanted! - Clara

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-12-06  4:26 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-12-01  2:53 [PATCH] drm/i915: use sysfs_emit() to instead of scnprintf() ye.xingchen
2022-12-05 10:50 ` Jani Nikula
2022-12-06  4:26   ` Bagas Sanjaya

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).