All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH linux-next v2] backlight: use sysfs_emit() to instead of scnprintf()
@ 2022-09-28  1:41 ` yexingchen116
  0 siblings, 0 replies; 5+ messages in thread
From: yexingchen116 @ 2022-09-28  1:41 UTC (permalink / raw)
  To: jingoohan1
  Cc: lee, daniel.thompson, deller, dri-devel, linux-fbdev,
	linux-kernel, ye xingchen

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>
---
v1 -> v2
Add the rest of this fixes for this pattern in the 'drivers/video/backlight' directory.
 drivers/video/backlight/lm3533_bl.c | 10 +++++-----
 drivers/video/backlight/lp855x_bl.c |  4 ++--
 2 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/drivers/video/backlight/lm3533_bl.c b/drivers/video/backlight/lm3533_bl.c
index 1df1b6643c0b..5e2ce9285245 100644
--- a/drivers/video/backlight/lm3533_bl.c
+++ b/drivers/video/backlight/lm3533_bl.c
@@ -66,7 +66,7 @@ static ssize_t show_id(struct device *dev,
 {
 	struct lm3533_bl *bl = dev_get_drvdata(dev);
 
-	return scnprintf(buf, PAGE_SIZE, "%d\n", bl->id);
+	return sysfs_emit(buf, "%d\n", bl->id);
 }
 
 static ssize_t show_als_channel(struct device *dev,
@@ -75,7 +75,7 @@ static ssize_t show_als_channel(struct device *dev,
 	struct lm3533_bl *bl = dev_get_drvdata(dev);
 	unsigned channel = lm3533_bl_get_ctrlbank_id(bl);
 
-	return scnprintf(buf, PAGE_SIZE, "%u\n", channel);
+	return sysfs_emit(buf, "%u\n", channel);
 }
 
 static ssize_t show_als_en(struct device *dev,
@@ -95,7 +95,7 @@ static ssize_t show_als_en(struct device *dev,
 	mask = 1 << (2 * ctrlbank);
 	enable = val & mask;
 
-	return scnprintf(buf, PAGE_SIZE, "%d\n", enable);
+	return sysfs_emit(buf, "%d\n", enable);
 }
 
 static ssize_t store_als_en(struct device *dev,
@@ -147,7 +147,7 @@ static ssize_t show_linear(struct device *dev,
 	else
 		linear = 0;
 
-	return scnprintf(buf, PAGE_SIZE, "%x\n", linear);
+	return sysfs_emit(buf, "%x\n", linear);
 }
 
 static ssize_t store_linear(struct device *dev,
@@ -190,7 +190,7 @@ static ssize_t show_pwm(struct device *dev,
 	if (ret)
 		return ret;
 
-	return scnprintf(buf, PAGE_SIZE, "%u\n", val);
+	return sysfs_emit(buf, "%u\n", val);
 }
 
 static ssize_t store_pwm(struct device *dev,
diff --git a/drivers/video/backlight/lp855x_bl.c b/drivers/video/backlight/lp855x_bl.c
index bd0bdeae23a4..fafc1a9e76ef 100644
--- a/drivers/video/backlight/lp855x_bl.c
+++ b/drivers/video/backlight/lp855x_bl.c
@@ -293,7 +293,7 @@ static ssize_t lp855x_get_chip_id(struct device *dev,
 {
 	struct lp855x *lp = dev_get_drvdata(dev);
 
-	return scnprintf(buf, PAGE_SIZE, "%s\n", lp->chipname);
+	return sysfs_emit(buf, "%s\n", lp->chipname);
 }
 
 static ssize_t lp855x_get_bl_ctl_mode(struct device *dev,
@@ -307,7 +307,7 @@ static ssize_t lp855x_get_bl_ctl_mode(struct device *dev,
 	else if (lp->mode == REGISTER_BASED)
 		strmode = "register based";
 
-	return scnprintf(buf, PAGE_SIZE, "%s\n", strmode);
+	return sysfs_emit(buf, "%s\n", strmode);
 }
 
 static DEVICE_ATTR(chip_id, S_IRUGO, lp855x_get_chip_id, NULL);
-- 
2.25.1



^ permalink raw reply related	[flat|nested] 5+ messages in thread
* Re: [PATCH linux-next v2] backlight: use sysfs_emit() to instead of scnprintf()
@ 2022-09-29  5:54 葉星辰
  0 siblings, 0 replies; 5+ messages in thread
From: 葉星辰 @ 2022-09-29  5:54 UTC (permalink / raw)
  To: daniel.thompson
  Cc: linux-fbdev, jingoohan1, deller, lee, linux-kernel, dri-devel,
	ye.xingchen, yexingchen116

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

Thanks for your reply.

This patch about lp8788 fixes have already applied in:
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/?id=61e86018aebffd172c9da967f284469924d5e947

So this patch just fixed the rest.

Best Regards,
YE XINGCHEN

[-- Attachment #2: Type: text/html, Size: 583 bytes --]

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

end of thread, other threads:[~2022-09-29  5:54 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-09-28  1:41 [PATCH linux-next v2] backlight: use sysfs_emit() to instead of scnprintf() yexingchen116
2022-09-28  1:41 ` yexingchen116
2022-09-28  8:27 ` Daniel Thompson
2022-09-28  8:27   ` Daniel Thompson
  -- strict thread matches above, loose matches on Subject: below --
2022-09-29  5:54 葉星辰

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.