Skip to content

Commit

Permalink
power_supply: add "powers" links to self-powered HID devices
Browse files Browse the repository at this point in the history
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 <[email protected]>
Cc: Jiri Kosina <[email protected]>
  • Loading branch information
jsgf committed Dec 9, 2011
1 parent 73db881 commit 35b4c01
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
4 changes: 4 additions & 0 deletions drivers/hid/hid-wacom.c
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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,
Expand Down
2 changes: 2 additions & 0 deletions drivers/hid/hid-wiimote.c
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down

0 comments on commit 35b4c01

Please sign in to comment.