mirror of
https://github.com/torvalds/linux.git
synced 2024-11-22 12:11:40 +00:00
Merge back earlier ACPI device enumeration changes for 6.10.
This commit is contained in:
commit
829b75d483
@ -88,43 +88,29 @@ static void dock_hotplug_event(struct dock_dependent_device *dd, u32 event,
|
||||
enum dock_callback_type cb_type)
|
||||
{
|
||||
struct acpi_device *adev = dd->adev;
|
||||
acpi_hp_fixup fixup = NULL;
|
||||
acpi_hp_uevent uevent = NULL;
|
||||
acpi_hp_notify notify = NULL;
|
||||
|
||||
acpi_lock_hp_context();
|
||||
|
||||
if (!adev->hp)
|
||||
goto out;
|
||||
|
||||
if (cb_type == DOCK_CALL_FIXUP) {
|
||||
void (*fixup)(struct acpi_device *);
|
||||
|
||||
fixup = adev->hp->fixup;
|
||||
if (fixup) {
|
||||
acpi_unlock_hp_context();
|
||||
fixup(adev);
|
||||
return;
|
||||
}
|
||||
} else if (cb_type == DOCK_CALL_UEVENT) {
|
||||
void (*uevent)(struct acpi_device *, u32);
|
||||
|
||||
uevent = adev->hp->uevent;
|
||||
if (uevent) {
|
||||
acpi_unlock_hp_context();
|
||||
uevent(adev, event);
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
int (*notify)(struct acpi_device *, u32);
|
||||
|
||||
notify = adev->hp->notify;
|
||||
if (notify) {
|
||||
acpi_unlock_hp_context();
|
||||
notify(adev, event);
|
||||
return;
|
||||
}
|
||||
if (adev->hp) {
|
||||
if (cb_type == DOCK_CALL_FIXUP)
|
||||
fixup = adev->hp->fixup;
|
||||
else if (cb_type == DOCK_CALL_UEVENT)
|
||||
uevent = adev->hp->uevent;
|
||||
else
|
||||
notify = adev->hp->notify;
|
||||
}
|
||||
|
||||
out:
|
||||
acpi_unlock_hp_context();
|
||||
|
||||
if (fixup)
|
||||
fixup(adev);
|
||||
else if (uevent)
|
||||
uevent(adev, event);
|
||||
else if (notify)
|
||||
notify(adev, event);
|
||||
}
|
||||
|
||||
static struct dock_station *find_dock_station(acpi_handle handle)
|
||||
|
@ -73,8 +73,7 @@ void acpi_unlock_hp_context(void)
|
||||
|
||||
void acpi_initialize_hp_context(struct acpi_device *adev,
|
||||
struct acpi_hotplug_context *hp,
|
||||
int (*notify)(struct acpi_device *, u32),
|
||||
void (*uevent)(struct acpi_device *, u32))
|
||||
acpi_hp_notify notify, acpi_hp_uevent uevent)
|
||||
{
|
||||
acpi_lock_hp_context();
|
||||
hp->notify = notify;
|
||||
@ -428,7 +427,7 @@ void acpi_device_hotplug(struct acpi_device *adev, u32 src)
|
||||
} else if (adev->flags.hotplug_notify) {
|
||||
error = acpi_generic_hotplug_event(adev, src);
|
||||
} else {
|
||||
int (*notify)(struct acpi_device *, u32);
|
||||
acpi_hp_notify notify;
|
||||
|
||||
acpi_lock_hp_context();
|
||||
notify = adev->hp ? adev->hp->notify : NULL;
|
||||
@ -1298,10 +1297,10 @@ const char *acpi_device_hid(struct acpi_device *device)
|
||||
{
|
||||
struct acpi_hardware_id *hid;
|
||||
|
||||
if (list_empty(&device->pnp.ids))
|
||||
hid = list_first_entry_or_null(&device->pnp.ids, struct acpi_hardware_id, list);
|
||||
if (!hid)
|
||||
return dummy_hid;
|
||||
|
||||
hid = list_first_entry(&device->pnp.ids, struct acpi_hardware_id, list);
|
||||
return hid->id;
|
||||
}
|
||||
EXPORT_SYMBOL(acpi_device_hid);
|
||||
@ -1581,12 +1580,13 @@ int acpi_iommu_fwspec_init(struct device *dev, u32 id,
|
||||
struct fwnode_handle *fwnode,
|
||||
const struct iommu_ops *ops)
|
||||
{
|
||||
int ret = iommu_fwspec_init(dev, fwnode, ops);
|
||||
int ret;
|
||||
|
||||
if (!ret)
|
||||
ret = iommu_fwspec_add_ids(dev, &id, 1);
|
||||
ret = iommu_fwspec_init(dev, fwnode, ops);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
return ret;
|
||||
return iommu_fwspec_add_ids(dev, &id, 1);
|
||||
}
|
||||
|
||||
static inline const struct iommu_ops *acpi_iommu_fwspec_ops(struct device *dev)
|
||||
@ -1625,12 +1625,11 @@ static int acpi_iommu_configure_id(struct device *dev, const u32 *id_in)
|
||||
if (!err && dev->bus)
|
||||
err = iommu_probe_device(dev);
|
||||
|
||||
/* Ignore all other errors apart from EPROBE_DEFER */
|
||||
if (err == -EPROBE_DEFER) {
|
||||
if (err == -EPROBE_DEFER)
|
||||
return err;
|
||||
} else if (err) {
|
||||
if (err) {
|
||||
dev_dbg(dev, "Adding to IOMMU failed: %d\n", err);
|
||||
return -ENODEV;
|
||||
return err;
|
||||
}
|
||||
if (!acpi_iommu_fwspec_ops(dev))
|
||||
return -ENODEV;
|
||||
@ -1671,13 +1670,14 @@ int acpi_dma_configure_id(struct device *dev, enum dev_dma_attr attr,
|
||||
|
||||
acpi_arch_dma_setup(dev);
|
||||
|
||||
/* Ignore all other errors apart from EPROBE_DEFER */
|
||||
ret = acpi_iommu_configure_id(dev, input_id);
|
||||
if (ret == -EPROBE_DEFER)
|
||||
return -EPROBE_DEFER;
|
||||
|
||||
/*
|
||||
* Historically this routine doesn't fail driver probing due to errors
|
||||
* in acpi_iommu_configure_id()
|
||||
* in acpi_iommu_configure_id().
|
||||
*/
|
||||
|
||||
arch_setup_dma_ops(dev, 0, U64_MAX, attr == DEV_DMA_COHERENT);
|
||||
|
@ -9,8 +9,13 @@
|
||||
#ifndef __ACPI_BUS_H__
|
||||
#define __ACPI_BUS_H__
|
||||
|
||||
#include <linux/completion.h>
|
||||
#include <linux/container_of.h>
|
||||
#include <linux/device.h>
|
||||
#include <linux/kobject.h>
|
||||
#include <linux/mutex.h>
|
||||
#include <linux/property.h>
|
||||
#include <linux/types.h>
|
||||
|
||||
struct acpi_handle_list {
|
||||
u32 count;
|
||||
@ -124,8 +129,8 @@ static inline struct acpi_hotplug_profile *to_acpi_hotplug_profile(
|
||||
}
|
||||
|
||||
struct acpi_scan_handler {
|
||||
const struct acpi_device_id *ids;
|
||||
struct list_head list_node;
|
||||
const struct acpi_device_id *ids;
|
||||
bool (*match)(const char *idstr, const struct acpi_device_id **matchid);
|
||||
int (*attach)(struct acpi_device *dev, const struct acpi_device_id *id);
|
||||
void (*detach)(struct acpi_device *dev);
|
||||
@ -139,11 +144,15 @@ struct acpi_scan_handler {
|
||||
* --------------------
|
||||
*/
|
||||
|
||||
typedef int (*acpi_hp_notify) (struct acpi_device *, u32);
|
||||
typedef void (*acpi_hp_uevent) (struct acpi_device *, u32);
|
||||
typedef void (*acpi_hp_fixup) (struct acpi_device *);
|
||||
|
||||
struct acpi_hotplug_context {
|
||||
struct acpi_device *self;
|
||||
int (*notify)(struct acpi_device *, u32);
|
||||
void (*uevent)(struct acpi_device *, u32);
|
||||
void (*fixup)(struct acpi_device *);
|
||||
acpi_hp_notify notify;
|
||||
acpi_hp_uevent uevent;
|
||||
acpi_hp_fixup fixup;
|
||||
};
|
||||
|
||||
/*
|
||||
@ -269,6 +278,7 @@ struct acpi_device_power_flags {
|
||||
};
|
||||
|
||||
struct acpi_device_power_state {
|
||||
struct list_head resources; /* Power resources referenced */
|
||||
struct {
|
||||
u8 valid:1;
|
||||
u8 explicit_set:1; /* _PSx present? */
|
||||
@ -276,7 +286,6 @@ struct acpi_device_power_state {
|
||||
} flags;
|
||||
int power; /* % Power (compared to D0) */
|
||||
int latency; /* Dx->D0 time (microseconds) */
|
||||
struct list_head resources; /* Power resources referenced */
|
||||
};
|
||||
|
||||
struct acpi_device_power {
|
||||
@ -342,16 +351,16 @@ struct acpi_device_wakeup {
|
||||
};
|
||||
|
||||
struct acpi_device_physical_node {
|
||||
unsigned int node_id;
|
||||
struct list_head node;
|
||||
struct device *dev;
|
||||
unsigned int node_id;
|
||||
bool put_online:1;
|
||||
};
|
||||
|
||||
struct acpi_device_properties {
|
||||
struct list_head list;
|
||||
const guid_t *guid;
|
||||
union acpi_object *properties;
|
||||
struct list_head list;
|
||||
void **bufs;
|
||||
};
|
||||
|
||||
@ -488,12 +497,12 @@ struct acpi_device {
|
||||
|
||||
/* Non-device subnode */
|
||||
struct acpi_data_node {
|
||||
struct list_head sibling;
|
||||
const char *name;
|
||||
acpi_handle handle;
|
||||
struct fwnode_handle fwnode;
|
||||
struct fwnode_handle *parent;
|
||||
struct acpi_device_data data;
|
||||
struct list_head sibling;
|
||||
struct kobject kobj;
|
||||
struct completion kobj_done;
|
||||
};
|
||||
@ -578,8 +587,7 @@ static inline void acpi_set_hp_context(struct acpi_device *adev,
|
||||
|
||||
void acpi_initialize_hp_context(struct acpi_device *adev,
|
||||
struct acpi_hotplug_context *hp,
|
||||
int (*notify)(struct acpi_device *, u32),
|
||||
void (*uevent)(struct acpi_device *, u32));
|
||||
acpi_hp_notify notify, acpi_hp_uevent uevent);
|
||||
|
||||
/* acpi_device.dev.bus == &acpi_bus_type */
|
||||
extern const struct bus_type acpi_bus_type;
|
||||
|
Loading…
Reference in New Issue
Block a user