2013-03-15 00:19:34

by Kim, Milo

[permalink] [raw]
Subject: [PATCH] backlight: lp855x: use PAGE_SIZE for the sysfs read operation

The sysfs allocates PAGE_SIZE. It is used by each R/W operation method.
Use it instead of another buffer size.

Signed-off-by: Milo(Woogyom) Kim <[email protected]>
---
drivers/video/backlight/lp855x_bl.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/video/backlight/lp855x_bl.c b/drivers/video/backlight/lp855x_bl.c
index 7ae9ae6..d47efe1 100644
--- a/drivers/video/backlight/lp855x_bl.c
+++ b/drivers/video/backlight/lp855x_bl.c
@@ -35,7 +35,6 @@
#define LP8557_EPROM_START 0x10
#define LP8557_EPROM_END 0x1E

-#define BUF_SIZE 20
#define DEFAULT_BL_NAME "lcd-backlight"
#define MAX_BRIGHTNESS 255

@@ -304,7 +303,7 @@ static ssize_t lp855x_get_chip_id(struct device *dev,
struct device_attribute *attr, char *buf)
{
struct lp855x *lp = dev_get_drvdata(dev);
- return scnprintf(buf, BUF_SIZE, "%s\n", lp->chipname);
+ return scnprintf(buf, PAGE_SIZE, "%s\n", lp->chipname);
}

static ssize_t lp855x_get_bl_ctl_mode(struct device *dev,
@@ -319,7 +318,7 @@ static ssize_t lp855x_get_bl_ctl_mode(struct device *dev,
else if (mode == REGISTER_BASED)
strmode = "register based";

- return scnprintf(buf, BUF_SIZE, "%s\n", strmode);
+ return scnprintf(buf, PAGE_SIZE, "%s\n", strmode);
}

static DEVICE_ATTR(chip_id, S_IRUGO, lp855x_get_chip_id, NULL);
--
1.7.9.5


Best Regards,
Milo


2013-03-18 02:54:24

by Jingoo Han

[permalink] [raw]
Subject: Re: [PATCH] backlight: lp855x: use PAGE_SIZE for the sysfs read operation

On Thusday, 14 Mar 2013 17:19:55 -0700, Milo(Woogyom) Kim wrote:
> The sysfs allocates PAGE_SIZE. It is used by each R/W operation method.
> Use it instead of another buffer size.
>
> Signed-off-by: Milo(Woogyom) Kim <[email protected]>

Acked-by: Jingoo Han <[email protected]>

Best regards,
Jingoo Han

> ---
> drivers/video/backlight/lp855x_bl.c | 5 ++---
> 1 file changed, 2 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/video/backlight/lp855x_bl.c b/drivers/video/backlight/lp855x_bl.c
> index 7ae9ae6..d47efe1 100644
> --- a/drivers/video/backlight/lp855x_bl.c
> +++ b/drivers/video/backlight/lp855x_bl.c
> @@ -35,7 +35,6 @@
> #define LP8557_EPROM_START 0x10
> #define LP8557_EPROM_END 0x1E
>
> -#define BUF_SIZE 20
> #define DEFAULT_BL_NAME "lcd-backlight"
> #define MAX_BRIGHTNESS 255
>
> @@ -304,7 +303,7 @@ static ssize_t lp855x_get_chip_id(struct device *dev,
> struct device_attribute *attr, char *buf)
> {
> struct lp855x *lp = dev_get_drvdata(dev);
> - return scnprintf(buf, BUF_SIZE, "%s\n", lp->chipname);
> + return scnprintf(buf, PAGE_SIZE, "%s\n", lp->chipname);
> }
>
> static ssize_t lp855x_get_bl_ctl_mode(struct device *dev,
> @@ -319,7 +318,7 @@ static ssize_t lp855x_get_bl_ctl_mode(struct device *dev,
> else if (mode == REGISTER_BASED)
> strmode = "register based";
>
> - return scnprintf(buf, BUF_SIZE, "%s\n", strmode);
> + return scnprintf(buf, PAGE_SIZE, "%s\n", strmode);
> }
>
> static DEVICE_ATTR(chip_id, S_IRUGO, lp855x_get_chip_id, NULL);
> --
> 1.7.9.5
>
????{.n?+???????+%?????ݶ??w??{.n?+????{??G?????{ay?ʇڙ?,j??f???h?????????z_??(?階?ݢj"???m??????G????????????&???~???iO???z??v?^?m???? ????????I?