aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLan Tianyu <tianyu.lan@intel.com>2013-11-12 22:27:42 -0500
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2013-11-14 17:23:14 -0500
commit86b0cc12bba9cb9cc3c20974dec565f44c961fc3 (patch)
treec15eceef4afd84dea49c8f40ae9b45349ce350a8
parente13ac47bec20797fa9262cffcae9cf0e3aa1b9b2 (diff)
ACPI / AC: Remove struct acpi_device pointer from struct acpi_ac
Now the pointer of struct acpi_device can be got by ACPI_COMPANION(struct acpi_ac->pdev->dev). So the pointer is not necessary and remove it. Signed-off-by: Lan Tianyu <tianyu.lan@intel.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
-rw-r--r--drivers/acpi/ac.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/drivers/acpi/ac.c b/drivers/acpi/ac.c
index b9f0d5f4bba5..8711e3797165 100644
--- a/drivers/acpi/ac.c
+++ b/drivers/acpi/ac.c
@@ -56,7 +56,6 @@ static int ac_sleep_before_get_state_ms;
56 56
57struct acpi_ac { 57struct acpi_ac {
58 struct power_supply charger; 58 struct power_supply charger;
59 struct acpi_device *adev;
60 struct platform_device *pdev; 59 struct platform_device *pdev;
61 unsigned long long state; 60 unsigned long long state;
62}; 61};
@@ -70,8 +69,9 @@ struct acpi_ac {
70static int acpi_ac_get_state(struct acpi_ac *ac) 69static int acpi_ac_get_state(struct acpi_ac *ac)
71{ 70{
72 acpi_status status; 71 acpi_status status;
72 acpi_handle handle = ACPI_HANDLE(&ac->pdev->dev);
73 73
74 status = acpi_evaluate_integer(ac->adev->handle, "_PSR", NULL, 74 status = acpi_evaluate_integer(handle, "_PSR", NULL,
75 &ac->state); 75 &ac->state);
76 if (ACPI_FAILURE(status)) { 76 if (ACPI_FAILURE(status)) {
77 ACPI_EXCEPTION((AE_INFO, status, 77 ACPI_EXCEPTION((AE_INFO, status,
@@ -119,6 +119,7 @@ static enum power_supply_property ac_props[] = {
119static void acpi_ac_notify_handler(acpi_handle handle, u32 event, void *data) 119static void acpi_ac_notify_handler(acpi_handle handle, u32 event, void *data)
120{ 120{
121 struct acpi_ac *ac = data; 121 struct acpi_ac *ac = data;
122 struct acpi_device *adev;
122 123
123 if (!ac) 124 if (!ac)
124 return; 125 return;
@@ -141,10 +142,11 @@ static void acpi_ac_notify_handler(acpi_handle handle, u32 event, void *data)
141 msleep(ac_sleep_before_get_state_ms); 142 msleep(ac_sleep_before_get_state_ms);
142 143
143 acpi_ac_get_state(ac); 144 acpi_ac_get_state(ac);
144 acpi_bus_generate_netlink_event(ac->adev->pnp.device_class, 145 adev = ACPI_COMPANION(&ac->pdev->dev);
146 acpi_bus_generate_netlink_event(adev->pnp.device_class,
145 dev_name(&ac->pdev->dev), 147 dev_name(&ac->pdev->dev),
146 event, (u32) ac->state); 148 event, (u32) ac->state);
147 acpi_notifier_call_chain(ac->adev, event, (u32) ac->state); 149 acpi_notifier_call_chain(adev, event, (u32) ac->state);
148 kobject_uevent(&ac->charger.dev->kobj, KOBJ_CHANGE); 150 kobject_uevent(&ac->charger.dev->kobj, KOBJ_CHANGE);
149 } 151 }
150 152
@@ -178,8 +180,8 @@ static int acpi_ac_probe(struct platform_device *pdev)
178 if (!pdev) 180 if (!pdev)
179 return -EINVAL; 181 return -EINVAL;
180 182
181 result = acpi_bus_get_device(ACPI_HANDLE(&pdev->dev), &adev); 183 adev = ACPI_COMPANION(&pdev->dev);
182 if (result) 184 if (!adev)
183 return -ENODEV; 185 return -ENODEV;
184 186
185 ac = kzalloc(sizeof(struct acpi_ac), GFP_KERNEL); 187 ac = kzalloc(sizeof(struct acpi_ac), GFP_KERNEL);
@@ -188,7 +190,6 @@ static int acpi_ac_probe(struct platform_device *pdev)
188 190
189 strcpy(acpi_device_name(adev), ACPI_AC_DEVICE_NAME); 191 strcpy(acpi_device_name(adev), ACPI_AC_DEVICE_NAME);
190 strcpy(acpi_device_class(adev), ACPI_AC_CLASS); 192 strcpy(acpi_device_class(adev), ACPI_AC_CLASS);
191 ac->adev = adev;
192 ac->pdev = pdev; 193 ac->pdev = pdev;
193 platform_set_drvdata(pdev, ac); 194 platform_set_drvdata(pdev, ac);
194 195