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