diff options
-rw-r--r-- | drivers/acpi/glue.c | 10 | ||||
-rw-r--r-- | drivers/ata/libata-acpi.c | 26 | ||||
-rw-r--r-- | drivers/mmc/core/sdio_bus.c | 2 | ||||
-rw-r--r-- | include/acpi/acpi_bus.h | 1 | ||||
-rw-r--r-- | include/linux/acpi.h | 6 |
5 files changed, 21 insertions, 24 deletions
diff --git a/drivers/acpi/glue.c b/drivers/acpi/glue.c index 12b2acbaa116..c0d18b2145c1 100644 --- a/drivers/acpi/glue.c +++ b/drivers/acpi/glue.c | |||
@@ -149,6 +149,7 @@ struct acpi_device *acpi_find_child_device(struct acpi_device *parent, | |||
149 | } | 149 | } |
150 | return ret; | 150 | return ret; |
151 | } | 151 | } |
152 | EXPORT_SYMBOL_GPL(acpi_find_child_device); | ||
152 | 153 | ||
153 | acpi_handle acpi_get_child(acpi_handle handle, u64 addr) | 154 | acpi_handle acpi_get_child(acpi_handle handle, u64 addr) |
154 | { | 155 | { |
@@ -298,15 +299,6 @@ int acpi_unbind_one(struct device *dev) | |||
298 | } | 299 | } |
299 | EXPORT_SYMBOL_GPL(acpi_unbind_one); | 300 | EXPORT_SYMBOL_GPL(acpi_unbind_one); |
300 | 301 | ||
301 | void acpi_preset_companion(struct device *dev, acpi_handle parent, u64 addr) | ||
302 | { | ||
303 | struct acpi_device *adev; | ||
304 | |||
305 | if (!acpi_bus_get_device(acpi_get_child(parent, addr), &adev)) | ||
306 | ACPI_COMPANION_SET(dev, adev); | ||
307 | } | ||
308 | EXPORT_SYMBOL_GPL(acpi_preset_companion); | ||
309 | |||
310 | static int acpi_platform_notify(struct device *dev) | 302 | static int acpi_platform_notify(struct device *dev) |
311 | { | 303 | { |
312 | struct acpi_bus_type *type = acpi_get_bus_type(dev); | 304 | struct acpi_bus_type *type = acpi_get_bus_type(dev); |
diff --git a/drivers/ata/libata-acpi.c b/drivers/ata/libata-acpi.c index 8e22d9762328..9e69a5308693 100644 --- a/drivers/ata/libata-acpi.c +++ b/drivers/ata/libata-acpi.c | |||
@@ -178,12 +178,12 @@ static const struct acpi_dock_ops ata_acpi_ap_dock_ops = { | |||
178 | /* bind acpi handle to pata port */ | 178 | /* bind acpi handle to pata port */ |
179 | void ata_acpi_bind_port(struct ata_port *ap) | 179 | void ata_acpi_bind_port(struct ata_port *ap) |
180 | { | 180 | { |
181 | acpi_handle host_handle = ACPI_HANDLE(ap->host->dev); | 181 | struct acpi_device *host_companion = ACPI_COMPANION(ap->host->dev); |
182 | 182 | ||
183 | if (libata_noacpi || ap->flags & ATA_FLAG_ACPI_SATA || !host_handle) | 183 | if (libata_noacpi || ap->flags & ATA_FLAG_ACPI_SATA || !host_companion) |
184 | return; | 184 | return; |
185 | 185 | ||
186 | acpi_preset_companion(&ap->tdev, host_handle, ap->port_no); | 186 | acpi_preset_companion(&ap->tdev, host_companion, ap->port_no); |
187 | 187 | ||
188 | if (ata_acpi_gtm(ap, &ap->__acpi_init_gtm) == 0) | 188 | if (ata_acpi_gtm(ap, &ap->__acpi_init_gtm) == 0) |
189 | ap->pflags |= ATA_PFLAG_INIT_GTM_VALID; | 189 | ap->pflags |= ATA_PFLAG_INIT_GTM_VALID; |
@@ -196,17 +196,17 @@ void ata_acpi_bind_port(struct ata_port *ap) | |||
196 | void ata_acpi_bind_dev(struct ata_device *dev) | 196 | void ata_acpi_bind_dev(struct ata_device *dev) |
197 | { | 197 | { |
198 | struct ata_port *ap = dev->link->ap; | 198 | struct ata_port *ap = dev->link->ap; |
199 | acpi_handle port_handle = ACPI_HANDLE(&ap->tdev); | 199 | struct acpi_device *port_companion = ACPI_COMPANION(&ap->tdev); |
200 | acpi_handle host_handle = ACPI_HANDLE(ap->host->dev); | 200 | struct acpi_device *host_companion = ACPI_COMPANION(ap->host->dev); |
201 | acpi_handle parent_handle; | 201 | struct acpi_device *parent; |
202 | u64 adr; | 202 | u64 adr; |
203 | 203 | ||
204 | /* | 204 | /* |
205 | * For both sata/pata devices, host handle is required. | 205 | * For both sata/pata devices, host companion device is required. |
206 | * For pata device, port handle is also required. | 206 | * For pata device, port companion device is also required. |
207 | */ | 207 | */ |
208 | if (libata_noacpi || !host_handle || | 208 | if (libata_noacpi || !host_companion || |
209 | (!(ap->flags & ATA_FLAG_ACPI_SATA) && !port_handle)) | 209 | (!(ap->flags & ATA_FLAG_ACPI_SATA) && !port_companion)) |
210 | return; | 210 | return; |
211 | 211 | ||
212 | if (ap->flags & ATA_FLAG_ACPI_SATA) { | 212 | if (ap->flags & ATA_FLAG_ACPI_SATA) { |
@@ -214,13 +214,13 @@ void ata_acpi_bind_dev(struct ata_device *dev) | |||
214 | adr = SATA_ADR(ap->port_no, NO_PORT_MULT); | 214 | adr = SATA_ADR(ap->port_no, NO_PORT_MULT); |
215 | else | 215 | else |
216 | adr = SATA_ADR(ap->port_no, dev->link->pmp); | 216 | adr = SATA_ADR(ap->port_no, dev->link->pmp); |
217 | parent_handle = host_handle; | 217 | parent = host_companion; |
218 | } else { | 218 | } else { |
219 | adr = dev->devno; | 219 | adr = dev->devno; |
220 | parent_handle = port_handle; | 220 | parent = port_companion; |
221 | } | 221 | } |
222 | 222 | ||
223 | acpi_preset_companion(&dev->tdev, parent_handle, adr); | 223 | acpi_preset_companion(&dev->tdev, parent, adr); |
224 | 224 | ||
225 | register_hotplug_dock_device(ata_dev_acpi_handle(dev), | 225 | register_hotplug_dock_device(ata_dev_acpi_handle(dev), |
226 | &ata_acpi_dev_dock_ops, dev, NULL, NULL); | 226 | &ata_acpi_dev_dock_ops, dev, NULL, NULL); |
diff --git a/drivers/mmc/core/sdio_bus.c b/drivers/mmc/core/sdio_bus.c index 157b570ba343..92d1ba8e8153 100644 --- a/drivers/mmc/core/sdio_bus.c +++ b/drivers/mmc/core/sdio_bus.c | |||
@@ -308,7 +308,7 @@ static void sdio_acpi_set_handle(struct sdio_func *func) | |||
308 | struct mmc_host *host = func->card->host; | 308 | struct mmc_host *host = func->card->host; |
309 | u64 addr = (host->slotno << 16) | func->num; | 309 | u64 addr = (host->slotno << 16) | func->num; |
310 | 310 | ||
311 | acpi_preset_companion(&func->dev, ACPI_HANDLE(host->parent), addr); | 311 | acpi_preset_companion(&func->dev, ACPI_COMPANION(host->parent), addr); |
312 | } | 312 | } |
313 | #else | 313 | #else |
314 | static inline void sdio_acpi_set_handle(struct sdio_func *func) {} | 314 | static inline void sdio_acpi_set_handle(struct sdio_func *func) {} |
diff --git a/include/acpi/acpi_bus.h b/include/acpi/acpi_bus.h index a1a48f27933a..918eaab892e1 100644 --- a/include/acpi/acpi_bus.h +++ b/include/acpi/acpi_bus.h | |||
@@ -435,7 +435,6 @@ struct acpi_pci_root { | |||
435 | struct acpi_device *acpi_find_child_device(struct acpi_device *parent, | 435 | struct acpi_device *acpi_find_child_device(struct acpi_device *parent, |
436 | u64 address, bool check_children); | 436 | u64 address, bool check_children); |
437 | acpi_handle acpi_get_child(acpi_handle handle, u64 addr); | 437 | acpi_handle acpi_get_child(acpi_handle handle, u64 addr); |
438 | void acpi_preset_companion(struct device *dev, acpi_handle parent, u64 addr); | ||
439 | int acpi_is_root_bridge(acpi_handle); | 438 | int acpi_is_root_bridge(acpi_handle); |
440 | struct acpi_pci_root *acpi_pci_find_root(acpi_handle handle); | 439 | struct acpi_pci_root *acpi_pci_find_root(acpi_handle handle); |
441 | 440 | ||
diff --git a/include/linux/acpi.h b/include/linux/acpi.h index d9099b15b472..115c610324d1 100644 --- a/include/linux/acpi.h +++ b/include/linux/acpi.h | |||
@@ -53,6 +53,12 @@ static inline acpi_handle acpi_device_handle(struct acpi_device *adev) | |||
53 | #define ACPI_COMPANION_SET(dev, adev) ACPI_COMPANION(dev) = (adev) | 53 | #define ACPI_COMPANION_SET(dev, adev) ACPI_COMPANION(dev) = (adev) |
54 | #define ACPI_HANDLE(dev) acpi_device_handle(ACPI_COMPANION(dev)) | 54 | #define ACPI_HANDLE(dev) acpi_device_handle(ACPI_COMPANION(dev)) |
55 | 55 | ||
56 | static inline void acpi_preset_companion(struct device *dev, | ||
57 | struct acpi_device *parent, u64 addr) | ||
58 | { | ||
59 | ACPI_COMPANION_SET(dev, acpi_find_child_device(parent, addr, NULL)); | ||
60 | } | ||
61 | |||
56 | static inline const char *acpi_dev_name(struct acpi_device *adev) | 62 | static inline const char *acpi_dev_name(struct acpi_device *adev) |
57 | { | 63 | { |
58 | return dev_name(&adev->dev); | 64 | return dev_name(&adev->dev); |