summaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorJeremy Fitzhardinge <jeremy@goop.org>2011-12-09 09:35:00 -0800
committerJeremy Fitzhardinge <jeremy@goop.org>2011-12-09 09:54:17 -0800
commit35b4c01e29bdd9632dabf9784ed3486333f00427 (patch)
treed189be2bec132117aefff67a3d17f7414ac1199c /drivers
parent73db88137bc732d01b615af9a9cdb24f3e47e78d (diff)
power_supply: add "powers" links to self-powered HID devices
Make the relationship between the Wiimote and Wacom self-powered HID devices and their power supply explicit by adding a "powers" link. Signed-off-by: Jeremy Fitzhardinge <jeremy@goop.org> Cc: Jiri Kosina <jkosina@suse.cz>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/hid/hid-wacom.c4
-rw-r--r--drivers/hid/hid-wiimote.c2
2 files changed, 6 insertions, 0 deletions
diff --git a/drivers/hid/hid-wacom.c b/drivers/hid/hid-wacom.c
index ad39777d111..3d28e4988f6 100644
--- a/drivers/hid/hid-wacom.c
+++ b/drivers/hid/hid-wacom.c
@@ -397,6 +397,8 @@ static int wacom_probe(struct hid_device *hdev,
wdata->battery.type = POWER_SUPPLY_TYPE_BATTERY;
wdata->battery.use_for_apm = 0;
+ power_supply_powers(&wdata->battery, &hdev->dev);
+
ret = power_supply_register(&hdev->dev, &wdata->battery);
if (ret) {
hid_warn(hdev, "can't create sysfs battery attribute, err: %d\n",
@@ -411,6 +413,8 @@ static int wacom_probe(struct hid_device *hdev,
wdata->ac.type = POWER_SUPPLY_TYPE_MAINS;
wdata->ac.use_for_apm = 0;
+ power_supply_powers(&wdata->battery, &hdev->dev);
+
ret = power_supply_register(&hdev->dev, &wdata->ac);
if (ret) {
hid_warn(hdev,
diff --git a/drivers/hid/hid-wiimote.c b/drivers/hid/hid-wiimote.c
index 98e48281c0b..fc0b4db5dab 100644
--- a/drivers/hid/hid-wiimote.c
+++ b/drivers/hid/hid-wiimote.c
@@ -1263,6 +1263,8 @@ static int wiimote_hid_probe(struct hid_device *hdev,
wdata->battery.type = POWER_SUPPLY_TYPE_BATTERY;
wdata->battery.use_for_apm = 0;
+ power_supply_powers(&wdata->battery, &hdev->dev);
+
ret = power_supply_register(&wdata->hdev->dev, &wdata->battery);
if (ret) {
hid_err(hdev, "Cannot register battery device\n");