From: Przemo Firszt Date: Sun, 5 Feb 2012 22:35:24 +0000 (+0000) Subject: HID: wacom: Fix invalid power_supply_powers calls X-Git-Tag: v3.3-rc3~13^2~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=d7cb3dbd10c09081fafd05fcbef590ce04e402ff;p=profile%2Fivi%2Fkernel-adaptation-intel-automotive.git HID: wacom: Fix invalid power_supply_powers calls power_supply_powers calls added in 35b4c01e2 ("power_supply: add "powers" links to self-powered HID devices") have to be called after power device is created. This patch also fixes the second call - it has to be "ac" instead of "battery" Signed-off-by: Przemo Firszt Signed-off-by: Chris Bagwell Signed-off-by: Jiri Kosina --- diff --git a/drivers/hid/hid-wacom.c b/drivers/hid/hid-wacom.c index b47e58b..acab74c 100644 --- a/drivers/hid/hid-wacom.c +++ b/drivers/hid/hid-wacom.c @@ -531,7 +531,6 @@ 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) { @@ -540,6 +539,8 @@ static int wacom_probe(struct hid_device *hdev, goto err_battery; } + power_supply_powers(&wdata->battery, &hdev->dev); + wdata->ac.properties = wacom_ac_props; wdata->ac.num_properties = ARRAY_SIZE(wacom_ac_props); wdata->ac.get_property = wacom_ac_get_property; @@ -547,14 +548,14 @@ 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, "can't create ac battery attribute, err: %d\n", ret); goto err_ac; } + + power_supply_powers(&wdata->ac, &hdev->dev); #endif return 0;