greybus: battery-gb: provide accessors for a few more functions
authorGreg Kroah-Hartman <greg@kroah.com>
Mon, 20 Oct 2014 07:09:49 +0000 (15:09 +0800)
committerGreg Kroah-Hartman <greg@kroah.com>
Mon, 20 Oct 2014 07:09:49 +0000 (15:09 +0800)
Put the hard coded values in a function to make it easier to see what
needs to be done here.

Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
drivers/staging/greybus/battery-gb.c

index eaced9ab39d8e404aa6fc206445ed13cc8e9b25f..685cff5ff9e89da1417807b083444de44ab7c284 100644 (file)
@@ -27,12 +27,24 @@ static const struct greybus_module_id id_table[] = {
        { },    /* terminating NULL entry */
 };
 
+static int get_tech(struct gb_battery *gb)
+{
+       // FIXME - guess!
+       return POWER_SUPPLY_TECHNOLOGY_NiMH;
+}
+
 static int get_status(struct gb_battery *gb)
 {
        // FIXME!!!
        return 0;
 }
 
+static int get_max_voltage(struct gb_battery *gb)
+{
+       // FIXME!!!
+       return 4700000;
+}
+
 static int get_capacity(struct gb_battery *gb)
 {
        // FIXME!!!
@@ -59,8 +71,7 @@ static int get_property(struct power_supply *b,
 
        switch (psp) {
        case POWER_SUPPLY_PROP_TECHNOLOGY:
-               // FIXME - guess!
-               val->intval = POWER_SUPPLY_TECHNOLOGY_NiMH;
+               val->intval = get_tech(gb);
                break;
 
        case POWER_SUPPLY_PROP_STATUS:
@@ -68,7 +79,7 @@ static int get_property(struct power_supply *b,
                break;
 
        case POWER_SUPPLY_PROP_VOLTAGE_MAX_DESIGN:
-               val->intval = 4700000;  // FIXME - guess???
+               val->intval = get_max_voltage(gb);
                break;
 
        case POWER_SUPPLY_PROP_CAPACITY: