===================================================================
@@ -1070,10 +1070,30 @@ int acpi_bus_for_each_dev(int (*fn)(stru
}
EXPORT_SYMBOL_GPL(acpi_bus_for_each_dev);
+struct acpi_dev_walk_context {
+ int (*fn)(struct acpi_device *, void *);
+ void *data;
+};
+
+static int acpi_dev_for_one_check(struct device *dev, void *context)
+{
+ struct acpi_dev_walk_context *adwc = context;
+
+ if (dev->bus != &acpi_bus_type)
+ return 0;
+
+ return adwc->fn(to_acpi_device(dev), adwc->data);
+}
+
int acpi_dev_for_each_child(struct acpi_device *adev,
- int (*fn)(struct device *, void *), void *data)
+ int (*fn)(struct acpi_device *, void *), void *data)
{
- return device_for_each_child(&adev->dev, data, fn);
+ struct acpi_dev_walk_context adwc = {
+ .fn = fn,
+ .data = data,
+ };
+
+ return device_for_each_child(&adev->dev, &adwc, acpi_dev_for_one_check);
}
/* --------------------------------------------------------------------------
===================================================================
@@ -482,7 +482,7 @@ extern struct bus_type acpi_bus_type;
int acpi_bus_for_each_dev(int (*fn)(struct device *, void *), void *data);
int acpi_dev_for_each_child(struct acpi_device *adev,
- int (*fn)(struct device *, void *), void *data);
+ int (*fn)(struct acpi_device *, void *), void *data);
/*
* Events
===================================================================
@@ -429,11 +429,8 @@ bool acpi_bus_power_manageable(acpi_hand
}
EXPORT_SYMBOL(acpi_bus_power_manageable);
-static int acpi_power_up_if_adr_present(struct device *dev, void *not_used)
+static int acpi_power_up_if_adr_present(struct acpi_device *adev, void *not_used)
{
- struct acpi_device *adev;
-
- adev = to_acpi_device(dev);
if (!(adev->flags.power_manageable && adev->pnp.type.bus_address))
return 0;