diff options
author | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2013-11-29 10:27:43 -0500 |
---|---|---|
committer | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2013-12-06 19:05:50 -0500 |
commit | 24dee1fc99fd6d38fc859d7f6dda1dab21493bef (patch) | |
tree | 1377d90f45c045fdae001a580008cddcb03e4c8d /drivers/acpi | |
parent | e3f02c5228c4b600abf6ca243301176f25553bd5 (diff) |
ACPI / bind: Pass struct acpi_device pointer to acpi_bind_one()
There is no reason to pass an ACPI handle to acpi_bind_one() instead
of a struct acpi_device pointer to the target device object, so
modify that function to take a struct acpi_device pointer as its
second argument and update all code depending on it accordingly.
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Tested-by: Lan Tianyu <tianyu.lan@intel.com> # for USB/ACPI
Diffstat (limited to 'drivers/acpi')
-rw-r--r-- | drivers/acpi/acpi_memhotplug.c | 15 | ||||
-rw-r--r-- | drivers/acpi/acpi_processor.c | 2 | ||||
-rw-r--r-- | drivers/acpi/glue.c | 9 | ||||
-rw-r--r-- | drivers/acpi/internal.h | 2 |
4 files changed, 12 insertions, 16 deletions
diff --git a/drivers/acpi/acpi_memhotplug.c b/drivers/acpi/acpi_memhotplug.c index 551dad712ffe..9aeacdfca410 100644 --- a/drivers/acpi/acpi_memhotplug.c +++ b/drivers/acpi/acpi_memhotplug.c | |||
@@ -180,14 +180,14 @@ static unsigned long acpi_meminfo_end_pfn(struct acpi_memory_info *info) | |||
180 | 180 | ||
181 | static int acpi_bind_memblk(struct memory_block *mem, void *arg) | 181 | static int acpi_bind_memblk(struct memory_block *mem, void *arg) |
182 | { | 182 | { |
183 | return acpi_bind_one(&mem->dev, (acpi_handle)arg); | 183 | return acpi_bind_one(&mem->dev, arg); |
184 | } | 184 | } |
185 | 185 | ||
186 | static int acpi_bind_memory_blocks(struct acpi_memory_info *info, | 186 | static int acpi_bind_memory_blocks(struct acpi_memory_info *info, |
187 | acpi_handle handle) | 187 | struct acpi_device *adev) |
188 | { | 188 | { |
189 | return walk_memory_range(acpi_meminfo_start_pfn(info), | 189 | return walk_memory_range(acpi_meminfo_start_pfn(info), |
190 | acpi_meminfo_end_pfn(info), (void *)handle, | 190 | acpi_meminfo_end_pfn(info), adev, |
191 | acpi_bind_memblk); | 191 | acpi_bind_memblk); |
192 | } | 192 | } |
193 | 193 | ||
@@ -197,8 +197,7 @@ static int acpi_unbind_memblk(struct memory_block *mem, void *arg) | |||
197 | return 0; | 197 | return 0; |
198 | } | 198 | } |
199 | 199 | ||
200 | static void acpi_unbind_memory_blocks(struct acpi_memory_info *info, | 200 | static void acpi_unbind_memory_blocks(struct acpi_memory_info *info) |
201 | acpi_handle handle) | ||
202 | { | 201 | { |
203 | walk_memory_range(acpi_meminfo_start_pfn(info), | 202 | walk_memory_range(acpi_meminfo_start_pfn(info), |
204 | acpi_meminfo_end_pfn(info), NULL, acpi_unbind_memblk); | 203 | acpi_meminfo_end_pfn(info), NULL, acpi_unbind_memblk); |
@@ -242,9 +241,9 @@ static int acpi_memory_enable_device(struct acpi_memory_device *mem_device) | |||
242 | if (result && result != -EEXIST) | 241 | if (result && result != -EEXIST) |
243 | continue; | 242 | continue; |
244 | 243 | ||
245 | result = acpi_bind_memory_blocks(info, handle); | 244 | result = acpi_bind_memory_blocks(info, mem_device->device); |
246 | if (result) { | 245 | if (result) { |
247 | acpi_unbind_memory_blocks(info, handle); | 246 | acpi_unbind_memory_blocks(info); |
248 | return -ENODEV; | 247 | return -ENODEV; |
249 | } | 248 | } |
250 | 249 | ||
@@ -285,7 +284,7 @@ static void acpi_memory_remove_memory(struct acpi_memory_device *mem_device) | |||
285 | if (nid == NUMA_NO_NODE) | 284 | if (nid == NUMA_NO_NODE) |
286 | nid = memory_add_physaddr_to_nid(info->start_addr); | 285 | nid = memory_add_physaddr_to_nid(info->start_addr); |
287 | 286 | ||
288 | acpi_unbind_memory_blocks(info, handle); | 287 | acpi_unbind_memory_blocks(info); |
289 | remove_memory(nid, info->start_addr, info->length); | 288 | remove_memory(nid, info->start_addr, info->length); |
290 | list_del(&info->list); | 289 | list_del(&info->list); |
291 | kfree(info); | 290 | kfree(info); |
diff --git a/drivers/acpi/acpi_processor.c b/drivers/acpi/acpi_processor.c index 3c1d6b0c09a4..d58a2aba0930 100644 --- a/drivers/acpi/acpi_processor.c +++ b/drivers/acpi/acpi_processor.c | |||
@@ -395,7 +395,7 @@ static int acpi_processor_add(struct acpi_device *device, | |||
395 | goto err; | 395 | goto err; |
396 | } | 396 | } |
397 | 397 | ||
398 | result = acpi_bind_one(dev, pr->handle); | 398 | result = acpi_bind_one(dev, device); |
399 | if (result) | 399 | if (result) |
400 | goto err; | 400 | goto err; |
401 | 401 | ||
diff --git a/drivers/acpi/glue.c b/drivers/acpi/glue.c index 7608d66f289b..896351b9d483 100644 --- a/drivers/acpi/glue.c +++ b/drivers/acpi/glue.c | |||
@@ -172,9 +172,8 @@ static void acpi_physnode_link_name(char *buf, unsigned int node_id) | |||
172 | strcpy(buf, PHYSICAL_NODE_STRING); | 172 | strcpy(buf, PHYSICAL_NODE_STRING); |
173 | } | 173 | } |
174 | 174 | ||
175 | int acpi_bind_one(struct device *dev, acpi_handle handle) | 175 | int acpi_bind_one(struct device *dev, struct acpi_device *acpi_dev) |
176 | { | 176 | { |
177 | struct acpi_device *acpi_dev = NULL; | ||
178 | struct acpi_device_physical_node *physical_node, *pn; | 177 | struct acpi_device_physical_node *physical_node, *pn; |
179 | char physical_node_name[PHYSICAL_NODE_NAME_SIZE]; | 178 | char physical_node_name[PHYSICAL_NODE_NAME_SIZE]; |
180 | struct list_head *physnode_list; | 179 | struct list_head *physnode_list; |
@@ -182,14 +181,12 @@ int acpi_bind_one(struct device *dev, acpi_handle handle) | |||
182 | int retval = -EINVAL; | 181 | int retval = -EINVAL; |
183 | 182 | ||
184 | if (ACPI_COMPANION(dev)) { | 183 | if (ACPI_COMPANION(dev)) { |
185 | if (handle) { | 184 | if (acpi_dev) { |
186 | dev_warn(dev, "ACPI companion already set\n"); | 185 | dev_warn(dev, "ACPI companion already set\n"); |
187 | return -EINVAL; | 186 | return -EINVAL; |
188 | } else { | 187 | } else { |
189 | acpi_dev = ACPI_COMPANION(dev); | 188 | acpi_dev = ACPI_COMPANION(dev); |
190 | } | 189 | } |
191 | } else { | ||
192 | acpi_bus_get_device(handle, &acpi_dev); | ||
193 | } | 190 | } |
194 | if (!acpi_dev) | 191 | if (!acpi_dev) |
195 | return -EINVAL; | 192 | return -EINVAL; |
@@ -314,7 +311,7 @@ static int acpi_platform_notify(struct device *dev) | |||
314 | ret = -ENODEV; | 311 | ret = -ENODEV; |
315 | goto out; | 312 | goto out; |
316 | } | 313 | } |
317 | ret = acpi_bind_one(dev, adev->handle); | 314 | ret = acpi_bind_one(dev, adev); |
318 | if (ret) | 315 | if (ret) |
319 | goto out; | 316 | goto out; |
320 | } | 317 | } |
diff --git a/drivers/acpi/internal.h b/drivers/acpi/internal.h index f4aa467c407e..b125fdb0b30c 100644 --- a/drivers/acpi/internal.h +++ b/drivers/acpi/internal.h | |||
@@ -86,7 +86,7 @@ void acpi_init_device_object(struct acpi_device *device, acpi_handle handle, | |||
86 | int type, unsigned long long sta); | 86 | int type, unsigned long long sta); |
87 | void acpi_device_add_finalize(struct acpi_device *device); | 87 | void acpi_device_add_finalize(struct acpi_device *device); |
88 | void acpi_free_pnp_ids(struct acpi_device_pnp *pnp); | 88 | void acpi_free_pnp_ids(struct acpi_device_pnp *pnp); |
89 | int acpi_bind_one(struct device *dev, acpi_handle handle); | 89 | int acpi_bind_one(struct device *dev, struct acpi_device *adev); |
90 | int acpi_unbind_one(struct device *dev); | 90 | int acpi_unbind_one(struct device *dev); |
91 | bool acpi_device_is_present(struct acpi_device *adev); | 91 | bool acpi_device_is_present(struct acpi_device *adev); |
92 | 92 | ||