Skip to content

Commit

Permalink
lp8788-charger: Use PAGE_SIZE for the sysfs read operation
Browse files Browse the repository at this point in the history
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>
Signed-off-by: Anton Vorontsov <anton@enomsg.org>
  • Loading branch information
Kim, Milo authored and Anton Vorontsov committed Apr 1, 2013
1 parent feeb3a9 commit 4b44a1e
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions drivers/power/lp8788-charger.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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,
Expand All @@ -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]);
}

Expand All @@ -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);
Expand Down

0 comments on commit 4b44a1e

Please sign in to comment.