backlight: use sysfs_emit() to instead of scnprintf()
Subsystems (2)
PATCH v2 1/1 backlight: use sysfs_emit() to instead of scnprintf()
From: ye xingchen <[email protected]>
Replace the open-code with sysfs_emit() to simplify the code.
Signed-off-by ye xingchen <[email protected]>
---
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(-)
drivers/video/backlight/lm3533_bl.c +5 -5
@@ -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,
drivers/video/backlight/lp855x_bl.c +2 -2
@@ -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);
Signature · 1 line
2.25.1
Quoted 10 lines · On Wed, Sep 28, 2022 at 01:41:15AM +0000, [email protected] wrote:
From: ye xingchen <[email protected]>
Replace the open-code with
sysfs_emit()to simplify the code.Signed-off-by ye xingchen <[email protected]>---
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 ++--
What happened to the lp8788 fixes?
Daniel.
Quoted 77 lines
2 files changed, 7 insertions(+), 7 deletions(-)drivers/video/backlight/lm3533_bl.c +5
-5@@ -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,drivers/video/backlight/lp855x_bl.c +2
-3@@ -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