From: Jeremy Fitzhardinge Date: Fri, 9 Dec 2011 17:35:00 +0000 (-0800) Subject: power_supply: add "powers" links to self-powered HID devices X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=35b4c01e29b;p=linux-beck.git 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 Cc: Jiri Kosina --- diff --git a/drivers/hid/hid-wacom.c b/drivers/hid/hid-wacom.c index ad39777d1111..3d28e4988f69 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 98e48281c0b2..fc0b4db5dab3 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");