summaryrefslogtreecommitdiffstats
path: root/drivers/staging/greybus/battery-gb.c
diff options
context:
space:
mode:
authorGreg Kroah-Hartman2014-10-20 09:24:57 +0200
committerGreg Kroah-Hartman2014-10-20 09:24:57 +0200
commit2bb7eae8be12e8510fdb00aca6886b91ce72cb25 (patch)
tree70d2e4f460038bb6594842942c130632a512e407 /drivers/staging/greybus/battery-gb.c
parentgreybus: gpio-gb: remove unused status field from struct gb_gpio_get_value_re... (diff)
downloadkernel-qcow2-linux-2bb7eae8be12e8510fdb00aca6886b91ce72cb25.tar.gz
kernel-qcow2-linux-2bb7eae8be12e8510fdb00aca6886b91ce72cb25.tar.xz
kernel-qcow2-linux-2bb7eae8be12e8510fdb00aca6886b91ce72cb25.zip
greybus: battery: some hooking up to the greybus core
Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
Diffstat (limited to 'drivers/staging/greybus/battery-gb.c')
-rw-r--r--drivers/staging/greybus/battery-gb.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/drivers/staging/greybus/battery-gb.c b/drivers/staging/greybus/battery-gb.c
index 685cff5ff9e8..3288101c6319 100644
--- a/drivers/staging/greybus/battery-gb.c
+++ b/drivers/staging/greybus/battery-gb.c
@@ -18,7 +18,10 @@ struct gb_battery {
// we will want to keep the battery stats in here as we will be getting
// updates from the SVC "on the fly" so we don't have to always go ask
// the battery for some information. Hopefully...
- struct gb_module *gmod;
+ struct gb_connection *connection;
+ u8 version_major;
+ u8 version_minor;
+
};
#define to_gb_battery(x) container_of(x, struct gb_battery, bat)
@@ -111,8 +114,7 @@ static enum power_supply_property battery_props[] = {
POWER_SUPPLY_PROP_VOLTAGE_NOW,
};
-int gb_battery_probe(struct gb_module *gmod,
- const struct greybus_module_id *id)
+int gb_battery_device_init(struct gb_connection *connection)
{
struct gb_battery *gb;
struct power_supply *b;
@@ -122,6 +124,8 @@ int gb_battery_probe(struct gb_module *gmod,
if (!gb)
return -ENOMEM;
+ gb->connection = connection; // FIXME refcount!
+
b = &gb->bat;
// FIXME - get a better (i.e. unique) name
// FIXME - anything else needs to be set?
@@ -131,12 +135,11 @@ int gb_battery_probe(struct gb_module *gmod,
b->num_properties = ARRAY_SIZE(battery_props),
b->get_property = get_property,
- retval = power_supply_register(&gmod->dev, b);
+ retval = power_supply_register(&connection->interface->gmod->dev, b);
if (retval) {
kfree(gb);
return retval;
}
- gmod->gb_battery = gb;
return 0;
}