diff options
author | Anton Vorontsov <cbouatmailru@gmail.com> | 2012-01-04 00:09:35 -0500 |
---|---|---|
committer | Anton Vorontsov <cbouatmailru@gmail.com> | 2012-01-04 00:09:35 -0500 |
commit | 251f39fe42dae863bd24e30864e6b66076ba076d (patch) | |
tree | c804944bc17f3836d19cc8b5bc611dd1fb0ea915 /drivers/power/power_supply_sysfs.c | |
parent | 9b8872273af6983b246252a6508fa7cf34c69d6e (diff) | |
parent | 35b4c01e29bdd9632dabf9784ed3486333f00427 (diff) |
Merge branch 'power-supply-scope' of git://git.kernel.org/pub/scm/linux/kernel/git/jeremy/xen
Diffstat (limited to 'drivers/power/power_supply_sysfs.c')
-rw-r--r-- | drivers/power/power_supply_sysfs.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/drivers/power/power_supply_sysfs.c b/drivers/power/power_supply_sysfs.c index 939e2e432553..5faf7ae9b81f 100644 --- a/drivers/power/power_supply_sysfs.c +++ b/drivers/power/power_supply_sysfs.c | |||
@@ -14,6 +14,7 @@ | |||
14 | #include <linux/ctype.h> | 14 | #include <linux/ctype.h> |
15 | #include <linux/power_supply.h> | 15 | #include <linux/power_supply.h> |
16 | #include <linux/slab.h> | 16 | #include <linux/slab.h> |
17 | #include <linux/stat.h> | ||
17 | 18 | ||
18 | #include "power_supply.h" | 19 | #include "power_supply.h" |
19 | 20 | ||
@@ -62,6 +63,9 @@ static ssize_t power_supply_show_property(struct device *dev, | |||
62 | static char *capacity_level_text[] = { | 63 | static char *capacity_level_text[] = { |
63 | "Unknown", "Critical", "Low", "Normal", "High", "Full" | 64 | "Unknown", "Critical", "Low", "Normal", "High", "Full" |
64 | }; | 65 | }; |
66 | static char *scope_text[] = { | ||
67 | "Unknown", "System", "Device" | ||
68 | }; | ||
65 | ssize_t ret = 0; | 69 | ssize_t ret = 0; |
66 | struct power_supply *psy = dev_get_drvdata(dev); | 70 | struct power_supply *psy = dev_get_drvdata(dev); |
67 | const ptrdiff_t off = attr - power_supply_attrs; | 71 | const ptrdiff_t off = attr - power_supply_attrs; |
@@ -94,6 +98,8 @@ static ssize_t power_supply_show_property(struct device *dev, | |||
94 | return sprintf(buf, "%s\n", capacity_level_text[value.intval]); | 98 | return sprintf(buf, "%s\n", capacity_level_text[value.intval]); |
95 | else if (off == POWER_SUPPLY_PROP_TYPE) | 99 | else if (off == POWER_SUPPLY_PROP_TYPE) |
96 | return sprintf(buf, "%s\n", type_text[value.intval]); | 100 | return sprintf(buf, "%s\n", type_text[value.intval]); |
101 | else if (off == POWER_SUPPLY_PROP_SCOPE) | ||
102 | return sprintf(buf, "%s\n", scope_text[value.intval]); | ||
97 | else if (off >= POWER_SUPPLY_PROP_MODEL_NAME) | 103 | else if (off >= POWER_SUPPLY_PROP_MODEL_NAME) |
98 | return sprintf(buf, "%s\n", value.strval); | 104 | return sprintf(buf, "%s\n", value.strval); |
99 | 105 | ||
@@ -166,6 +172,7 @@ static struct device_attribute power_supply_attrs[] = { | |||
166 | POWER_SUPPLY_ATTR(time_to_full_now), | 172 | POWER_SUPPLY_ATTR(time_to_full_now), |
167 | POWER_SUPPLY_ATTR(time_to_full_avg), | 173 | POWER_SUPPLY_ATTR(time_to_full_avg), |
168 | POWER_SUPPLY_ATTR(type), | 174 | POWER_SUPPLY_ATTR(type), |
175 | POWER_SUPPLY_ATTR(scope), | ||
169 | /* Properties of type `const char *' */ | 176 | /* Properties of type `const char *' */ |
170 | POWER_SUPPLY_ATTR(model_name), | 177 | POWER_SUPPLY_ATTR(model_name), |
171 | POWER_SUPPLY_ATTR(manufacturer), | 178 | POWER_SUPPLY_ATTR(manufacturer), |