linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] backlight: lp855x: use PAGE_SIZE for the sysfs read operation
@ 2013-03-15  0:19 Kim, Milo
  0 siblings, 0 replies; 2+ messages in thread
From: Kim, Milo @ 2013-03-15  0:19 UTC (permalink / raw)
  To: Andrew Morton; +Cc: Richard Purdie, linux-kernel

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 <milo.kim@ti.com>
---
 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


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

* Re: [PATCH] backlight: lp855x: use PAGE_SIZE for the sysfs read operation
@ 2013-03-18  2:54 Jingoo Han
  0 siblings, 0 replies; 2+ messages in thread
From: Jingoo Han @ 2013-03-18  2:54 UTC (permalink / raw)
  To: milo.kim; +Cc: akpm, linux-kernel, jg1.han

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset=euc-kr, Size: 1705 bytes --]

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 <milo.kim@ti.com>

Acked-by: Jingoo Han <jg1.han@samsung.com>

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Ç+‰·Ÿ®‰­†+%ŠËÿ±éݶ\x17¥Šwÿº{.nÇ+‰·¥Š{±þG«éÿŠ{ayº\x1dʇڙë,j\a­¢f£¢·hšïêÿ‘êçz_è®\x03(­éšŽŠÝ¢j"ú\x1a¶^[m§ÿÿ¾\a«þG«éÿ¢¸?™¨è­Ú&£ø§~á¶iO•æ¬z·švØ^\x14\x04\x1a¶^[m§ÿÿÃ\fÿ¶ìÿ¢¸?–I¥

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

end of thread, other threads:[~2013-03-18  2:54 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-03-15  0:19 [PATCH] backlight: lp855x: use PAGE_SIZE for the sysfs read operation Kim, Milo
2013-03-18  2:54 Jingoo Han

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).