mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-01-07 13:53:24 +00:00
Merge branches 'acpi-numa', 'acpi-glue', 'acpi-config' and 'acpi-pmic'
* acpi-numa: ACPI: Add LoongArch support for ACPI_PROCESSOR/ACPI_NUMA * acpi-glue: driver core: Split device_platform_notify() software nodes: Split software_node_notify() ACPI: glue: Eliminate acpi_platform_notify() ACPI: bus: Rename functions to avoid name collision ACPI: glue: Change return type of two functions to void ACPI: glue: Rearrange acpi_device_notify() * acpi-config: ACPI: configfs: Make get_header() to return error pointer ACPI: configfs: Use sysfs_emit() in "show" functions * acpi-pmic: ACPI / PMIC: XPower: optimize MIPI PMIQ sequence I2C-bus accesses ACPI / PMIC: XPower: optimize I2C-bus accesses
This commit is contained in:
commit
7c85154643
@ -280,9 +280,9 @@ config ACPI_CPPC_LIB
|
|||||||
|
|
||||||
config ACPI_PROCESSOR
|
config ACPI_PROCESSOR
|
||||||
tristate "Processor"
|
tristate "Processor"
|
||||||
depends on X86 || IA64 || ARM64
|
depends on X86 || IA64 || ARM64 || LOONGARCH
|
||||||
select ACPI_PROCESSOR_IDLE
|
select ACPI_PROCESSOR_IDLE
|
||||||
select ACPI_CPU_FREQ_PSS if X86 || IA64
|
select ACPI_CPU_FREQ_PSS if X86 || IA64 || LOONGARCH
|
||||||
default y
|
default y
|
||||||
help
|
help
|
||||||
This driver adds support for the ACPI Processor package. It is required
|
This driver adds support for the ACPI Processor package. It is required
|
||||||
|
@ -70,7 +70,7 @@ static inline struct acpi_table_header *get_header(struct config_item *cfg)
|
|||||||
if (!table->header)
|
if (!table->header)
|
||||||
pr_err("table not loaded\n");
|
pr_err("table not loaded\n");
|
||||||
|
|
||||||
return table->header;
|
return table->header ?: ERR_PTR(-EINVAL);
|
||||||
}
|
}
|
||||||
|
|
||||||
static ssize_t acpi_table_aml_read(struct config_item *cfg,
|
static ssize_t acpi_table_aml_read(struct config_item *cfg,
|
||||||
@ -78,8 +78,8 @@ static ssize_t acpi_table_aml_read(struct config_item *cfg,
|
|||||||
{
|
{
|
||||||
struct acpi_table_header *h = get_header(cfg);
|
struct acpi_table_header *h = get_header(cfg);
|
||||||
|
|
||||||
if (!h)
|
if (IS_ERR(h))
|
||||||
return -EINVAL;
|
return PTR_ERR(h);
|
||||||
|
|
||||||
if (data)
|
if (data)
|
||||||
memcpy(data, h, h->length);
|
memcpy(data, h, h->length);
|
||||||
@ -100,60 +100,60 @@ static ssize_t acpi_table_signature_show(struct config_item *cfg, char *str)
|
|||||||
{
|
{
|
||||||
struct acpi_table_header *h = get_header(cfg);
|
struct acpi_table_header *h = get_header(cfg);
|
||||||
|
|
||||||
if (!h)
|
if (IS_ERR(h))
|
||||||
return -EINVAL;
|
return PTR_ERR(h);
|
||||||
|
|
||||||
return sprintf(str, "%.*s\n", ACPI_NAMESEG_SIZE, h->signature);
|
return sysfs_emit(str, "%.*s\n", ACPI_NAMESEG_SIZE, h->signature);
|
||||||
}
|
}
|
||||||
|
|
||||||
static ssize_t acpi_table_length_show(struct config_item *cfg, char *str)
|
static ssize_t acpi_table_length_show(struct config_item *cfg, char *str)
|
||||||
{
|
{
|
||||||
struct acpi_table_header *h = get_header(cfg);
|
struct acpi_table_header *h = get_header(cfg);
|
||||||
|
|
||||||
if (!h)
|
if (IS_ERR(h))
|
||||||
return -EINVAL;
|
return PTR_ERR(h);
|
||||||
|
|
||||||
return sprintf(str, "%d\n", h->length);
|
return sysfs_emit(str, "%d\n", h->length);
|
||||||
}
|
}
|
||||||
|
|
||||||
static ssize_t acpi_table_revision_show(struct config_item *cfg, char *str)
|
static ssize_t acpi_table_revision_show(struct config_item *cfg, char *str)
|
||||||
{
|
{
|
||||||
struct acpi_table_header *h = get_header(cfg);
|
struct acpi_table_header *h = get_header(cfg);
|
||||||
|
|
||||||
if (!h)
|
if (IS_ERR(h))
|
||||||
return -EINVAL;
|
return PTR_ERR(h);
|
||||||
|
|
||||||
return sprintf(str, "%d\n", h->revision);
|
return sysfs_emit(str, "%d\n", h->revision);
|
||||||
}
|
}
|
||||||
|
|
||||||
static ssize_t acpi_table_oem_id_show(struct config_item *cfg, char *str)
|
static ssize_t acpi_table_oem_id_show(struct config_item *cfg, char *str)
|
||||||
{
|
{
|
||||||
struct acpi_table_header *h = get_header(cfg);
|
struct acpi_table_header *h = get_header(cfg);
|
||||||
|
|
||||||
if (!h)
|
if (IS_ERR(h))
|
||||||
return -EINVAL;
|
return PTR_ERR(h);
|
||||||
|
|
||||||
return sprintf(str, "%.*s\n", ACPI_OEM_ID_SIZE, h->oem_id);
|
return sysfs_emit(str, "%.*s\n", ACPI_OEM_ID_SIZE, h->oem_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
static ssize_t acpi_table_oem_table_id_show(struct config_item *cfg, char *str)
|
static ssize_t acpi_table_oem_table_id_show(struct config_item *cfg, char *str)
|
||||||
{
|
{
|
||||||
struct acpi_table_header *h = get_header(cfg);
|
struct acpi_table_header *h = get_header(cfg);
|
||||||
|
|
||||||
if (!h)
|
if (IS_ERR(h))
|
||||||
return -EINVAL;
|
return PTR_ERR(h);
|
||||||
|
|
||||||
return sprintf(str, "%.*s\n", ACPI_OEM_TABLE_ID_SIZE, h->oem_table_id);
|
return sysfs_emit(str, "%.*s\n", ACPI_OEM_TABLE_ID_SIZE, h->oem_table_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
static ssize_t acpi_table_oem_revision_show(struct config_item *cfg, char *str)
|
static ssize_t acpi_table_oem_revision_show(struct config_item *cfg, char *str)
|
||||||
{
|
{
|
||||||
struct acpi_table_header *h = get_header(cfg);
|
struct acpi_table_header *h = get_header(cfg);
|
||||||
|
|
||||||
if (!h)
|
if (IS_ERR(h))
|
||||||
return -EINVAL;
|
return PTR_ERR(h);
|
||||||
|
|
||||||
return sprintf(str, "%d\n", h->oem_revision);
|
return sysfs_emit(str, "%d\n", h->oem_revision);
|
||||||
}
|
}
|
||||||
|
|
||||||
static ssize_t acpi_table_asl_compiler_id_show(struct config_item *cfg,
|
static ssize_t acpi_table_asl_compiler_id_show(struct config_item *cfg,
|
||||||
@ -161,10 +161,10 @@ static ssize_t acpi_table_asl_compiler_id_show(struct config_item *cfg,
|
|||||||
{
|
{
|
||||||
struct acpi_table_header *h = get_header(cfg);
|
struct acpi_table_header *h = get_header(cfg);
|
||||||
|
|
||||||
if (!h)
|
if (IS_ERR(h))
|
||||||
return -EINVAL;
|
return PTR_ERR(h);
|
||||||
|
|
||||||
return sprintf(str, "%.*s\n", ACPI_NAMESEG_SIZE, h->asl_compiler_id);
|
return sysfs_emit(str, "%.*s\n", ACPI_NAMESEG_SIZE, h->asl_compiler_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
static ssize_t acpi_table_asl_compiler_revision_show(struct config_item *cfg,
|
static ssize_t acpi_table_asl_compiler_revision_show(struct config_item *cfg,
|
||||||
@ -172,10 +172,10 @@ static ssize_t acpi_table_asl_compiler_revision_show(struct config_item *cfg,
|
|||||||
{
|
{
|
||||||
struct acpi_table_header *h = get_header(cfg);
|
struct acpi_table_header *h = get_header(cfg);
|
||||||
|
|
||||||
if (!h)
|
if (IS_ERR(h))
|
||||||
return -EINVAL;
|
return PTR_ERR(h);
|
||||||
|
|
||||||
return sprintf(str, "%d\n", h->asl_compiler_revision);
|
return sysfs_emit(str, "%d\n", h->asl_compiler_revision);
|
||||||
}
|
}
|
||||||
|
|
||||||
CONFIGFS_ATTR_RO(acpi_table_, signature);
|
CONFIGFS_ATTR_RO(acpi_table_, signature);
|
||||||
|
@ -498,24 +498,24 @@ static void acpi_bus_notify(acpi_handle handle, u32 type, void *data)
|
|||||||
acpi_evaluate_ost(handle, type, ost_code, NULL);
|
acpi_evaluate_ost(handle, type, ost_code, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void acpi_device_notify(acpi_handle handle, u32 event, void *data)
|
static void acpi_notify_device(acpi_handle handle, u32 event, void *data)
|
||||||
{
|
{
|
||||||
struct acpi_device *device = data;
|
struct acpi_device *device = data;
|
||||||
|
|
||||||
device->driver->ops.notify(device, event);
|
device->driver->ops.notify(device, event);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void acpi_device_notify_fixed(void *data)
|
static void acpi_notify_device_fixed(void *data)
|
||||||
{
|
{
|
||||||
struct acpi_device *device = data;
|
struct acpi_device *device = data;
|
||||||
|
|
||||||
/* Fixed hardware devices have no handles */
|
/* Fixed hardware devices have no handles */
|
||||||
acpi_device_notify(NULL, ACPI_FIXED_HARDWARE_EVENT, device);
|
acpi_notify_device(NULL, ACPI_FIXED_HARDWARE_EVENT, device);
|
||||||
}
|
}
|
||||||
|
|
||||||
static u32 acpi_device_fixed_event(void *data)
|
static u32 acpi_device_fixed_event(void *data)
|
||||||
{
|
{
|
||||||
acpi_os_execute(OSL_NOTIFY_HANDLER, acpi_device_notify_fixed, data);
|
acpi_os_execute(OSL_NOTIFY_HANDLER, acpi_notify_device_fixed, data);
|
||||||
return ACPI_INTERRUPT_HANDLED;
|
return ACPI_INTERRUPT_HANDLED;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -536,7 +536,7 @@ static int acpi_device_install_notify_handler(struct acpi_device *device)
|
|||||||
else
|
else
|
||||||
status = acpi_install_notify_handler(device->handle,
|
status = acpi_install_notify_handler(device->handle,
|
||||||
ACPI_DEVICE_NOTIFY,
|
ACPI_DEVICE_NOTIFY,
|
||||||
acpi_device_notify,
|
acpi_notify_device,
|
||||||
device);
|
device);
|
||||||
|
|
||||||
if (ACPI_FAILURE(status))
|
if (ACPI_FAILURE(status))
|
||||||
@ -554,7 +554,7 @@ static void acpi_device_remove_notify_handler(struct acpi_device *device)
|
|||||||
acpi_device_fixed_event);
|
acpi_device_fixed_event);
|
||||||
else
|
else
|
||||||
acpi_remove_notify_handler(device->handle, ACPI_DEVICE_NOTIFY,
|
acpi_remove_notify_handler(device->handle, ACPI_DEVICE_NOTIFY,
|
||||||
acpi_device_notify);
|
acpi_notify_device);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Handle events targeting \_SB device (at present only graceful shutdown) */
|
/* Handle events targeting \_SB device (at present only graceful shutdown) */
|
||||||
|
@ -285,29 +285,27 @@ int acpi_unbind_one(struct device *dev)
|
|||||||
}
|
}
|
||||||
EXPORT_SYMBOL_GPL(acpi_unbind_one);
|
EXPORT_SYMBOL_GPL(acpi_unbind_one);
|
||||||
|
|
||||||
static int acpi_device_notify(struct device *dev)
|
void acpi_device_notify(struct device *dev)
|
||||||
{
|
{
|
||||||
struct acpi_bus_type *type = acpi_get_bus_type(dev);
|
struct acpi_bus_type *type = acpi_get_bus_type(dev);
|
||||||
struct acpi_device *adev;
|
struct acpi_device *adev;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
ret = acpi_bind_one(dev, NULL);
|
ret = acpi_bind_one(dev, NULL);
|
||||||
if (ret && type) {
|
if (ret) {
|
||||||
struct acpi_device *adev;
|
if (!type)
|
||||||
|
goto err;
|
||||||
|
|
||||||
adev = type->find_companion(dev);
|
adev = type->find_companion(dev);
|
||||||
if (!adev) {
|
if (!adev) {
|
||||||
pr_debug("Unable to get handle for %s\n", dev_name(dev));
|
dev_dbg(dev, "ACPI companion not found\n");
|
||||||
ret = -ENODEV;
|
goto err;
|
||||||
goto out;
|
|
||||||
}
|
}
|
||||||
ret = acpi_bind_one(dev, adev);
|
ret = acpi_bind_one(dev, adev);
|
||||||
if (ret)
|
if (ret)
|
||||||
goto out;
|
goto err;
|
||||||
}
|
}
|
||||||
adev = ACPI_COMPANION(dev);
|
adev = ACPI_COMPANION(dev);
|
||||||
if (!adev)
|
|
||||||
goto out;
|
|
||||||
|
|
||||||
if (dev_is_platform(dev))
|
if (dev_is_platform(dev))
|
||||||
acpi_configure_pmsi_domain(dev);
|
acpi_configure_pmsi_domain(dev);
|
||||||
@ -317,27 +315,22 @@ static int acpi_device_notify(struct device *dev)
|
|||||||
else if (adev->handler && adev->handler->bind)
|
else if (adev->handler && adev->handler->bind)
|
||||||
adev->handler->bind(dev);
|
adev->handler->bind(dev);
|
||||||
|
|
||||||
out:
|
acpi_handle_debug(ACPI_HANDLE(dev), "Bound to device %s\n",
|
||||||
if (!ret) {
|
dev_name(dev));
|
||||||
struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL };
|
|
||||||
|
|
||||||
acpi_get_name(ACPI_HANDLE(dev), ACPI_FULL_PATHNAME, &buffer);
|
return;
|
||||||
pr_debug("Device %s -> %s\n", dev_name(dev), (char *)buffer.pointer);
|
|
||||||
kfree(buffer.pointer);
|
err:
|
||||||
} else {
|
dev_dbg(dev, "No ACPI support\n");
|
||||||
pr_debug("Device %s -> No ACPI support\n", dev_name(dev));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return ret;
|
void acpi_device_notify_remove(struct device *dev)
|
||||||
}
|
|
||||||
|
|
||||||
static int acpi_device_notify_remove(struct device *dev)
|
|
||||||
{
|
{
|
||||||
struct acpi_device *adev = ACPI_COMPANION(dev);
|
struct acpi_device *adev = ACPI_COMPANION(dev);
|
||||||
struct acpi_bus_type *type;
|
struct acpi_bus_type *type;
|
||||||
|
|
||||||
if (!adev)
|
if (!adev)
|
||||||
return 0;
|
return;
|
||||||
|
|
||||||
type = acpi_get_bus_type(dev);
|
type = acpi_get_bus_type(dev);
|
||||||
if (type && type->cleanup)
|
if (type && type->cleanup)
|
||||||
@ -346,20 +339,4 @@ static int acpi_device_notify_remove(struct device *dev)
|
|||||||
adev->handler->unbind(dev);
|
adev->handler->unbind(dev);
|
||||||
|
|
||||||
acpi_unbind_one(dev);
|
acpi_unbind_one(dev);
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
int acpi_platform_notify(struct device *dev, enum kobject_action action)
|
|
||||||
{
|
|
||||||
switch (action) {
|
|
||||||
case KOBJ_ADD:
|
|
||||||
acpi_device_notify(dev);
|
|
||||||
break;
|
|
||||||
case KOBJ_REMOVE:
|
|
||||||
acpi_device_notify_remove(dev);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
config ACPI_NUMA
|
config ACPI_NUMA
|
||||||
bool "NUMA support"
|
bool "NUMA support"
|
||||||
depends on NUMA
|
depends on NUMA
|
||||||
depends on (X86 || IA64 || ARM64)
|
depends on (X86 || IA64 || ARM64 || LOONGARCH)
|
||||||
default y if IA64 || ARM64
|
default y if IA64 || ARM64
|
||||||
|
|
||||||
config ACPI_HMAT
|
config ACPI_HMAT
|
||||||
|
@ -206,7 +206,7 @@ int __init srat_disabled(void)
|
|||||||
return acpi_numa < 0;
|
return acpi_numa < 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(CONFIG_X86) || defined(CONFIG_ARM64)
|
#if defined(CONFIG_X86) || defined(CONFIG_ARM64) || defined(CONFIG_LOONGARCH)
|
||||||
/*
|
/*
|
||||||
* Callback for SLIT parsing. pxm_to_node() returns NUMA_NO_NODE for
|
* Callback for SLIT parsing. pxm_to_node() returns NUMA_NO_NODE for
|
||||||
* I/O localities since SRAT does not list them. I/O localities are
|
* I/O localities since SRAT does not list them. I/O localities are
|
||||||
|
@ -178,15 +178,17 @@ static int intel_xpower_pmic_update_power(struct regmap *regmap, int reg,
|
|||||||
{
|
{
|
||||||
int data, ret;
|
int data, ret;
|
||||||
|
|
||||||
/* GPIO1 LDO regulator needs special handling */
|
|
||||||
if (reg == XPOWER_GPI1_CTRL)
|
|
||||||
return regmap_update_bits(regmap, reg, GPI1_LDO_MASK,
|
|
||||||
on ? GPI1_LDO_ON : GPI1_LDO_OFF);
|
|
||||||
|
|
||||||
ret = iosf_mbi_block_punit_i2c_access();
|
ret = iosf_mbi_block_punit_i2c_access();
|
||||||
if (ret)
|
if (ret)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
|
/* GPIO1 LDO regulator needs special handling */
|
||||||
|
if (reg == XPOWER_GPI1_CTRL) {
|
||||||
|
ret = regmap_update_bits(regmap, reg, GPI1_LDO_MASK,
|
||||||
|
on ? GPI1_LDO_ON : GPI1_LDO_OFF);
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
|
|
||||||
if (regmap_read(regmap, reg, &data)) {
|
if (regmap_read(regmap, reg, &data)) {
|
||||||
ret = -EIO;
|
ret = -EIO;
|
||||||
goto out;
|
goto out;
|
||||||
@ -234,6 +236,11 @@ static int intel_xpower_pmic_get_raw_temp(struct regmap *regmap, int reg)
|
|||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
if (adc_ts_pin_ctrl & AXP288_ADC_TS_CURRENT_ON_OFF_MASK) {
|
if (adc_ts_pin_ctrl & AXP288_ADC_TS_CURRENT_ON_OFF_MASK) {
|
||||||
|
/*
|
||||||
|
* AXP288_ADC_TS_PIN_CTRL reads are cached by the regmap, so
|
||||||
|
* this does to a single I2C-transfer, and thus there is no
|
||||||
|
* need to explicitly call iosf_mbi_block_punit_i2c_access().
|
||||||
|
*/
|
||||||
ret = regmap_update_bits(regmap, AXP288_ADC_TS_PIN_CTRL,
|
ret = regmap_update_bits(regmap, AXP288_ADC_TS_PIN_CTRL,
|
||||||
AXP288_ADC_TS_CURRENT_ON_OFF_MASK,
|
AXP288_ADC_TS_CURRENT_ON_OFF_MASK,
|
||||||
AXP288_ADC_TS_CURRENT_ON_ONDEMAND);
|
AXP288_ADC_TS_CURRENT_ON_ONDEMAND);
|
||||||
@ -244,6 +251,10 @@ static int intel_xpower_pmic_get_raw_temp(struct regmap *regmap, int reg)
|
|||||||
usleep_range(6000, 10000);
|
usleep_range(6000, 10000);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ret = iosf_mbi_block_punit_i2c_access();
|
||||||
|
if (ret)
|
||||||
|
return ret;
|
||||||
|
|
||||||
ret = regmap_bulk_read(regmap, AXP288_GP_ADC_H, buf, 2);
|
ret = regmap_bulk_read(regmap, AXP288_GP_ADC_H, buf, 2);
|
||||||
if (ret == 0)
|
if (ret == 0)
|
||||||
ret = (buf[0] << 4) + ((buf[1] >> 4) & 0x0f);
|
ret = (buf[0] << 4) + ((buf[1] >> 4) & 0x0f);
|
||||||
@ -254,6 +265,31 @@ static int intel_xpower_pmic_get_raw_temp(struct regmap *regmap, int reg)
|
|||||||
AXP288_ADC_TS_CURRENT_ON);
|
AXP288_ADC_TS_CURRENT_ON);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
iosf_mbi_unblock_punit_i2c_access();
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int intel_xpower_exec_mipi_pmic_seq_element(struct regmap *regmap,
|
||||||
|
u16 i2c_address, u32 reg_address,
|
||||||
|
u32 value, u32 mask)
|
||||||
|
{
|
||||||
|
int ret;
|
||||||
|
|
||||||
|
if (i2c_address != 0x34) {
|
||||||
|
pr_err("%s: Unexpected i2c-addr: 0x%02x (reg-addr 0x%x value 0x%x mask 0x%x)\n",
|
||||||
|
__func__, i2c_address, reg_address, value, mask);
|
||||||
|
return -ENXIO;
|
||||||
|
}
|
||||||
|
|
||||||
|
ret = iosf_mbi_block_punit_i2c_access();
|
||||||
|
if (ret)
|
||||||
|
return ret;
|
||||||
|
|
||||||
|
ret = regmap_update_bits(regmap, reg_address, mask, value);
|
||||||
|
|
||||||
|
iosf_mbi_unblock_punit_i2c_access();
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -261,6 +297,7 @@ static struct intel_pmic_opregion_data intel_xpower_pmic_opregion_data = {
|
|||||||
.get_power = intel_xpower_pmic_get_power,
|
.get_power = intel_xpower_pmic_get_power,
|
||||||
.update_power = intel_xpower_pmic_update_power,
|
.update_power = intel_xpower_pmic_update_power,
|
||||||
.get_raw_temp = intel_xpower_pmic_get_raw_temp,
|
.get_raw_temp = intel_xpower_pmic_get_raw_temp,
|
||||||
|
.exec_mipi_pmic_seq_element = intel_xpower_exec_mipi_pmic_seq_element,
|
||||||
.power_table = power_table,
|
.power_table = power_table,
|
||||||
.power_table_count = ARRAY_SIZE(power_table),
|
.power_table_count = ARRAY_SIZE(power_table),
|
||||||
.thermal_table = thermal_table,
|
.thermal_table = thermal_table,
|
||||||
|
@ -202,3 +202,6 @@ int devtmpfs_delete_node(struct device *dev);
|
|||||||
static inline int devtmpfs_create_node(struct device *dev) { return 0; }
|
static inline int devtmpfs_create_node(struct device *dev) { return 0; }
|
||||||
static inline int devtmpfs_delete_node(struct device *dev) { return 0; }
|
static inline int devtmpfs_delete_node(struct device *dev) { return 0; }
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
void software_node_notify(struct device *dev);
|
||||||
|
void software_node_notify_remove(struct device *dev);
|
||||||
|
@ -2002,24 +2002,24 @@ static inline int device_is_not_partition(struct device *dev)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static int
|
static void device_platform_notify(struct device *dev)
|
||||||
device_platform_notify(struct device *dev, enum kobject_action action)
|
|
||||||
{
|
{
|
||||||
int ret;
|
acpi_device_notify(dev);
|
||||||
|
|
||||||
ret = acpi_platform_notify(dev, action);
|
software_node_notify(dev);
|
||||||
if (ret)
|
|
||||||
return ret;
|
|
||||||
|
|
||||||
ret = software_node_notify(dev, action);
|
if (platform_notify)
|
||||||
if (ret)
|
|
||||||
return ret;
|
|
||||||
|
|
||||||
if (platform_notify && action == KOBJ_ADD)
|
|
||||||
platform_notify(dev);
|
platform_notify(dev);
|
||||||
else if (platform_notify_remove && action == KOBJ_REMOVE)
|
}
|
||||||
|
|
||||||
|
static void device_platform_notify_remove(struct device *dev)
|
||||||
|
{
|
||||||
|
acpi_device_notify_remove(dev);
|
||||||
|
|
||||||
|
software_node_notify_remove(dev);
|
||||||
|
|
||||||
|
if (platform_notify_remove)
|
||||||
platform_notify_remove(dev);
|
platform_notify_remove(dev);
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -3292,9 +3292,7 @@ int device_add(struct device *dev)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* notify platform of device entry */
|
/* notify platform of device entry */
|
||||||
error = device_platform_notify(dev, KOBJ_ADD);
|
device_platform_notify(dev);
|
||||||
if (error)
|
|
||||||
goto platform_error;
|
|
||||||
|
|
||||||
error = device_create_file(dev, &dev_attr_uevent);
|
error = device_create_file(dev, &dev_attr_uevent);
|
||||||
if (error)
|
if (error)
|
||||||
@ -3397,8 +3395,7 @@ int device_add(struct device *dev)
|
|||||||
SymlinkError:
|
SymlinkError:
|
||||||
device_remove_file(dev, &dev_attr_uevent);
|
device_remove_file(dev, &dev_attr_uevent);
|
||||||
attrError:
|
attrError:
|
||||||
device_platform_notify(dev, KOBJ_REMOVE);
|
device_platform_notify_remove(dev);
|
||||||
platform_error:
|
|
||||||
kobject_uevent(&dev->kobj, KOBJ_REMOVE);
|
kobject_uevent(&dev->kobj, KOBJ_REMOVE);
|
||||||
glue_dir = get_glue_dir(dev);
|
glue_dir = get_glue_dir(dev);
|
||||||
kobject_del(&dev->kobj);
|
kobject_del(&dev->kobj);
|
||||||
@ -3543,7 +3540,7 @@ void device_del(struct device *dev)
|
|||||||
bus_remove_device(dev);
|
bus_remove_device(dev);
|
||||||
device_pm_remove(dev);
|
device_pm_remove(dev);
|
||||||
driver_deferred_probe_del(dev);
|
driver_deferred_probe_del(dev);
|
||||||
device_platform_notify(dev, KOBJ_REMOVE);
|
device_platform_notify_remove(dev);
|
||||||
device_remove_properties(dev);
|
device_remove_properties(dev);
|
||||||
device_links_purge(dev);
|
device_links_purge(dev);
|
||||||
|
|
||||||
|
@ -11,6 +11,8 @@
|
|||||||
#include <linux/property.h>
|
#include <linux/property.h>
|
||||||
#include <linux/slab.h>
|
#include <linux/slab.h>
|
||||||
|
|
||||||
|
#include "base.h"
|
||||||
|
|
||||||
struct swnode {
|
struct swnode {
|
||||||
struct kobject kobj;
|
struct kobject kobj;
|
||||||
struct fwnode_handle fwnode;
|
struct fwnode_handle fwnode;
|
||||||
@ -1053,7 +1055,7 @@ int device_add_software_node(struct device *dev, const struct software_node *nod
|
|||||||
* balance.
|
* balance.
|
||||||
*/
|
*/
|
||||||
if (device_is_registered(dev))
|
if (device_is_registered(dev))
|
||||||
software_node_notify(dev, KOBJ_ADD);
|
software_node_notify(dev);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -1074,7 +1076,8 @@ void device_remove_software_node(struct device *dev)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
if (device_is_registered(dev))
|
if (device_is_registered(dev))
|
||||||
software_node_notify(dev, KOBJ_REMOVE);
|
software_node_notify_remove(dev);
|
||||||
|
|
||||||
set_secondary_fwnode(dev, NULL);
|
set_secondary_fwnode(dev, NULL);
|
||||||
kobject_put(&swnode->kobj);
|
kobject_put(&swnode->kobj);
|
||||||
}
|
}
|
||||||
@ -1117,30 +1120,36 @@ int device_create_managed_software_node(struct device *dev,
|
|||||||
}
|
}
|
||||||
EXPORT_SYMBOL_GPL(device_create_managed_software_node);
|
EXPORT_SYMBOL_GPL(device_create_managed_software_node);
|
||||||
|
|
||||||
int software_node_notify(struct device *dev, unsigned long action)
|
void software_node_notify(struct device *dev)
|
||||||
{
|
{
|
||||||
struct swnode *swnode;
|
struct swnode *swnode;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
swnode = dev_to_swnode(dev);
|
swnode = dev_to_swnode(dev);
|
||||||
if (!swnode)
|
if (!swnode)
|
||||||
return 0;
|
return;
|
||||||
|
|
||||||
switch (action) {
|
|
||||||
case KOBJ_ADD:
|
|
||||||
ret = sysfs_create_link(&dev->kobj, &swnode->kobj, "software_node");
|
ret = sysfs_create_link(&dev->kobj, &swnode->kobj, "software_node");
|
||||||
if (ret)
|
if (ret)
|
||||||
break;
|
return;
|
||||||
|
|
||||||
ret = sysfs_create_link(&swnode->kobj, &dev->kobj,
|
ret = sysfs_create_link(&swnode->kobj, &dev->kobj, dev_name(dev));
|
||||||
dev_name(dev));
|
|
||||||
if (ret) {
|
if (ret) {
|
||||||
sysfs_remove_link(&dev->kobj, "software_node");
|
sysfs_remove_link(&dev->kobj, "software_node");
|
||||||
break;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
kobject_get(&swnode->kobj);
|
kobject_get(&swnode->kobj);
|
||||||
break;
|
}
|
||||||
case KOBJ_REMOVE:
|
|
||||||
|
void software_node_notify_remove(struct device *dev)
|
||||||
|
{
|
||||||
|
struct swnode *swnode;
|
||||||
|
|
||||||
|
swnode = dev_to_swnode(dev);
|
||||||
|
if (!swnode)
|
||||||
|
return;
|
||||||
|
|
||||||
sysfs_remove_link(&swnode->kobj, dev_name(dev));
|
sysfs_remove_link(&swnode->kobj, dev_name(dev));
|
||||||
sysfs_remove_link(&dev->kobj, "software_node");
|
sysfs_remove_link(&dev->kobj, "software_node");
|
||||||
kobject_put(&swnode->kobj);
|
kobject_put(&swnode->kobj);
|
||||||
@ -1149,12 +1158,6 @@ int software_node_notify(struct device *dev, unsigned long action)
|
|||||||
set_secondary_fwnode(dev, NULL);
|
set_secondary_fwnode(dev, NULL);
|
||||||
kobject_put(&swnode->kobj);
|
kobject_put(&swnode->kobj);
|
||||||
}
|
}
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int __init software_node_init(void)
|
static int __init software_node_init(void)
|
||||||
|
@ -249,7 +249,7 @@ void acpi_table_print_madt_entry (struct acpi_subtable_header *madt);
|
|||||||
/* the following numa functions are architecture-dependent */
|
/* the following numa functions are architecture-dependent */
|
||||||
void acpi_numa_slit_init (struct acpi_table_slit *slit);
|
void acpi_numa_slit_init (struct acpi_table_slit *slit);
|
||||||
|
|
||||||
#if defined(CONFIG_X86) || defined(CONFIG_IA64)
|
#if defined(CONFIG_X86) || defined(CONFIG_IA64) || defined(CONFIG_LOONGARCH)
|
||||||
void acpi_numa_processor_affinity_init (struct acpi_srat_cpu_affinity *pa);
|
void acpi_numa_processor_affinity_init (struct acpi_srat_cpu_affinity *pa);
|
||||||
#else
|
#else
|
||||||
static inline void
|
static inline void
|
||||||
@ -1380,13 +1380,11 @@ static inline int find_acpi_cpu_cache_topology(unsigned int cpu, int level)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef CONFIG_ACPI
|
#ifdef CONFIG_ACPI
|
||||||
extern int acpi_platform_notify(struct device *dev, enum kobject_action action);
|
extern void acpi_device_notify(struct device *dev);
|
||||||
|
extern void acpi_device_notify_remove(struct device *dev);
|
||||||
#else
|
#else
|
||||||
static inline int
|
static inline void acpi_device_notify(struct device *dev) { }
|
||||||
acpi_platform_notify(struct device *dev, enum kobject_action action)
|
static inline void acpi_device_notify_remove(struct device *dev) { }
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif /*_LINUX_ACPI_H*/
|
#endif /*_LINUX_ACPI_H*/
|
||||||
|
@ -484,8 +484,6 @@ void software_node_unregister_node_group(const struct software_node **node_group
|
|||||||
int software_node_register(const struct software_node *node);
|
int software_node_register(const struct software_node *node);
|
||||||
void software_node_unregister(const struct software_node *node);
|
void software_node_unregister(const struct software_node *node);
|
||||||
|
|
||||||
int software_node_notify(struct device *dev, unsigned long action);
|
|
||||||
|
|
||||||
struct fwnode_handle *
|
struct fwnode_handle *
|
||||||
fwnode_create_software_node(const struct property_entry *properties,
|
fwnode_create_software_node(const struct property_entry *properties,
|
||||||
const struct fwnode_handle *parent);
|
const struct fwnode_handle *parent);
|
||||||
|
Loading…
Reference in New Issue
Block a user