* [PATCH] power: lp8788: use PAGE_SIZE for the sysfs read operation
@ 2013-03-15 0:19 Kim, Milo
2013-04-01 6:34 ` Anton Vorontsov
0 siblings, 1 reply; 2+ messages in thread
From: Kim, Milo @ 2013-03-15 0:19 UTC (permalink / raw)
To: Anton Vorontsov; +Cc: David Woodhouse, 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/power/lp8788-charger.c | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)
diff --git a/drivers/power/lp8788-charger.c b/drivers/power/lp8788-charger.c
index 6d1f452..ed49b50 100644
--- a/drivers/power/lp8788-charger.c
+++ b/drivers/power/lp8788-charger.c
@@ -49,7 +49,6 @@
#define LP8788_CHG_START 0x11
#define LP8788_CHG_END 0x1C
-#define LP8788_BUF_SIZE 40
#define LP8788_ISEL_MAX 23
#define LP8788_ISEL_STEP 50
#define LP8788_VTERM_MIN 4100
@@ -633,7 +632,7 @@ static ssize_t lp8788_show_charger_status(struct device *dev,
lp8788_read_byte(pchg->lp, LP8788_CHG_STATUS, &data);
state = (data & LP8788_CHG_STATE_M) >> LP8788_CHG_STATE_S;
- return scnprintf(buf, LP8788_BUF_SIZE, "%s\n", desc[state]);
+ return scnprintf(buf, PAGE_SIZE, "%s\n", desc[state]);
}
static ssize_t lp8788_show_eoc_time(struct device *dev,
@@ -647,7 +646,7 @@ static ssize_t lp8788_show_eoc_time(struct device *dev,
lp8788_read_byte(pchg->lp, LP8788_CHG_EOC, &val);
val = (val & LP8788_CHG_EOC_TIME_M) >> LP8788_CHG_EOC_TIME_S;
- return scnprintf(buf, LP8788_BUF_SIZE, "End Of Charge Time: %s\n",
+ return scnprintf(buf, PAGE_SIZE, "End Of Charge Time: %s\n",
stime[val]);
}
@@ -667,8 +666,7 @@ static ssize_t lp8788_show_eoc_level(struct device *dev,
val = (val & LP8788_CHG_EOC_LEVEL_M) >> LP8788_CHG_EOC_LEVEL_S;
level = mode ? abs_level[val] : relative_level[val];
- return scnprintf(buf, LP8788_BUF_SIZE, "End Of Charge Level: %s\n",
- level);
+ return scnprintf(buf, PAGE_SIZE, "End Of Charge Level: %s\n", level);
}
static DEVICE_ATTR(charger_status, S_IRUSR, lp8788_show_charger_status, NULL);
--
1.7.9.5
Best Regards,
Milo
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] power: lp8788: use PAGE_SIZE for the sysfs read operation
2013-03-15 0:19 [PATCH] power: lp8788: use PAGE_SIZE for the sysfs read operation Kim, Milo
@ 2013-04-01 6:34 ` Anton Vorontsov
0 siblings, 0 replies; 2+ messages in thread
From: Anton Vorontsov @ 2013-04-01 6:34 UTC (permalink / raw)
To: Kim, Milo; +Cc: David Woodhouse, linux-kernel
On Fri, Mar 15, 2013 at 12:19:29AM +0000, Kim, Milo 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>
> ---
Applied, thanks!
Anton
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2013-04-01 6:38 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] power: lp8788: use PAGE_SIZE for the sysfs read operation Kim, Milo
2013-04-01 6:34 ` Anton Vorontsov
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.