X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=drivers%2Fpower%2Fpower_supply_sysfs.c;h=49215da5249b1b96d540574d580f3322dc35e0b4;hb=450c622e9ff19888818d4e2c4d31adb97a5242b2;hp=249f61bae6396105b2466739c504dd2b6557b775;hpb=6a84258e5f5bb8b9bd72e06a5837fa6fdacaf5c5;p=linux-2.6 diff --git a/drivers/power/power_supply_sysfs.c b/drivers/power/power_supply_sysfs.c index 249f61bae6..49215da524 100644 --- a/drivers/power/power_supply_sysfs.c +++ b/drivers/power/power_supply_sysfs.c @@ -14,6 +14,8 @@ #include #include +#include "power_supply.h" + /* * This is because the name "current" breaks the device attr macro. * The "current" word resolves to "(get_current())" so instead of @@ -46,10 +48,8 @@ static ssize_t power_supply_show_property(struct device *dev, "Unspecified failure" }; static char *technology_text[] = { - "Unknown", "NiMH", "Li-ion", "Li-poly", "LiFe", "NiCd" - }; - static char *capacity_level_text[] = { - "Unknown", "Critical", "Low", "Normal", "High", "Full" + "Unknown", "NiMH", "Li-ion", "Li-poly", "LiFe", "NiCd", + "LiMn" }; ssize_t ret; struct power_supply *psy = dev_get_drvdata(dev); @@ -71,9 +71,6 @@ static ssize_t power_supply_show_property(struct device *dev, return sprintf(buf, "%s\n", health_text[value.intval]); else if (off == POWER_SUPPLY_PROP_TECHNOLOGY) return sprintf(buf, "%s\n", technology_text[value.intval]); - else if (off == POWER_SUPPLY_PROP_CAPACITY_LEVEL) - return sprintf(buf, "%s\n", - capacity_level_text[value.intval]); else if (off >= POWER_SUPPLY_PROP_MODEL_NAME) return sprintf(buf, "%s\n", value.strval); @@ -88,6 +85,8 @@ static struct device_attribute power_supply_attrs[] = { POWER_SUPPLY_ATTR(present), POWER_SUPPLY_ATTR(online), POWER_SUPPLY_ATTR(technology), + POWER_SUPPLY_ATTR(voltage_max), + POWER_SUPPLY_ATTR(voltage_min), POWER_SUPPLY_ATTR(voltage_max_design), POWER_SUPPLY_ATTR(voltage_min_design), POWER_SUPPLY_ATTR(voltage_now), @@ -107,7 +106,6 @@ static struct device_attribute power_supply_attrs[] = { POWER_SUPPLY_ATTR(energy_now), POWER_SUPPLY_ATTR(energy_avg), POWER_SUPPLY_ATTR(capacity), - POWER_SUPPLY_ATTR(capacity_level), POWER_SUPPLY_ATTR(temp), POWER_SUPPLY_ATTR(temp_ambient), POWER_SUPPLY_ATTR(time_to_empty_now), @@ -117,6 +115,7 @@ static struct device_attribute power_supply_attrs[] = { /* Properties of type `const char *' */ POWER_SUPPLY_ATTR(model_name), POWER_SUPPLY_ATTR(manufacturer), + POWER_SUPPLY_ATTR(serial_number), }; static ssize_t power_supply_show_static_attrs(struct device *dev, @@ -159,8 +158,7 @@ dynamics_failed: &power_supply_attrs[psy->properties[j]]); statics_failed: while (i--) - device_remove_file(psy->dev, - &power_supply_static_attrs[psy->properties[i]]); + device_remove_file(psy->dev, &power_supply_static_attrs[i]); succeed: return rc; } @@ -170,8 +168,7 @@ void power_supply_remove_attrs(struct power_supply *psy) int i; for (i = 0; i < ARRAY_SIZE(power_supply_static_attrs); i++) - device_remove_file(psy->dev, - &power_supply_static_attrs[i]); + device_remove_file(psy->dev, &power_supply_static_attrs[i]); for (i = 0; i < psy->num_properties; i++) device_remove_file(psy->dev, @@ -204,7 +201,7 @@ int power_supply_uevent(struct device *dev, struct kobj_uevent_env *env) dev_dbg(dev, "uevent\n"); - if (!psy) { + if (!psy || !psy->dev) { dev_dbg(dev, "No power supply yet\n"); return ret; }