Commit 7c851546 authored by Rafael J. Wysocki's avatar Rafael J. Wysocki
Browse files

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
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -280,9 +280,9 @@ config ACPI_CPPC_LIB

config ACPI_PROCESSOR
	tristate "Processor"
	depends on X86 || IA64 || ARM64
	depends on X86 || IA64 || ARM64 || LOONGARCH
	select ACPI_PROCESSOR_IDLE
	select ACPI_CPU_FREQ_PSS if X86 || IA64
	select ACPI_CPU_FREQ_PSS if X86 || IA64 || LOONGARCH
	default y
	help
	  This driver adds support for the ACPI Processor package. It is required
+27 −27
Original line number Diff line number Diff line
@@ -70,7 +70,7 @@ static inline struct acpi_table_header *get_header(struct config_item *cfg)
	if (!table->header)
		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,
@@ -78,8 +78,8 @@ static ssize_t acpi_table_aml_read(struct config_item *cfg,
{
	struct acpi_table_header *h = get_header(cfg);

	if (!h)
		return -EINVAL;
	if (IS_ERR(h))
		return PTR_ERR(h);

	if (data)
		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);

	if (!h)
		return -EINVAL;
	if (IS_ERR(h))
		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)
{
	struct acpi_table_header *h = get_header(cfg);

	if (!h)
		return -EINVAL;
	if (IS_ERR(h))
		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)
{
	struct acpi_table_header *h = get_header(cfg);

	if (!h)
		return -EINVAL;
	if (IS_ERR(h))
		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)
{
	struct acpi_table_header *h = get_header(cfg);

	if (!h)
		return -EINVAL;
	if (IS_ERR(h))
		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)
{
	struct acpi_table_header *h = get_header(cfg);

	if (!h)
		return -EINVAL;
	if (IS_ERR(h))
		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)
{
	struct acpi_table_header *h = get_header(cfg);

	if (!h)
		return -EINVAL;
	if (IS_ERR(h))
		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,
@@ -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);

	if (!h)
		return -EINVAL;
	if (IS_ERR(h))
		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,
@@ -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);

	if (!h)
		return -EINVAL;
	if (IS_ERR(h))
		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);
+6 −6
Original line number Diff line number Diff line
@@ -498,24 +498,24 @@ static void acpi_bus_notify(acpi_handle handle, u32 type, void *data)
	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;

	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;

	/* 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)
{
	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;
}

@@ -536,7 +536,7 @@ static int acpi_device_install_notify_handler(struct acpi_device *device)
	else
		status = acpi_install_notify_handler(device->handle,
						     ACPI_DEVICE_NOTIFY,
						     acpi_device_notify,
						     acpi_notify_device,
						     device);

	if (ACPI_FAILURE(status))
@@ -554,7 +554,7 @@ static void acpi_device_remove_notify_handler(struct acpi_device *device)
						acpi_device_fixed_event);
	else
		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) */
+14 −37
Original line number Diff line number Diff line
@@ -285,29 +285,27 @@ int acpi_unbind_one(struct device *dev)
}
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_device *adev;
	int ret;

	ret = acpi_bind_one(dev, NULL);
	if (ret && type) {
		struct acpi_device *adev;
	if (ret) {
		if (!type)
			goto err;

		adev = type->find_companion(dev);
		if (!adev) {
			pr_debug("Unable to get handle for %s\n", dev_name(dev));
			ret = -ENODEV;
			goto out;
			dev_dbg(dev, "ACPI companion not found\n");
			goto err;
		}
		ret = acpi_bind_one(dev, adev);
		if (ret)
			goto out;
			goto err;
	}
	adev = ACPI_COMPANION(dev);
	if (!adev)
		goto out;

	if (dev_is_platform(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)
		adev->handler->bind(dev);

 out:
	if (!ret) {
		struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL };
	acpi_handle_debug(ACPI_HANDLE(dev), "Bound to device %s\n",
			  dev_name(dev));

		acpi_get_name(ACPI_HANDLE(dev), ACPI_FULL_PATHNAME, &buffer);
		pr_debug("Device %s -> %s\n", dev_name(dev), (char *)buffer.pointer);
		kfree(buffer.pointer);
	} else {
		pr_debug("Device %s -> No ACPI support\n", dev_name(dev));
	}
	return;

	return ret;
err:
	dev_dbg(dev, "No ACPI support\n");
}

static int acpi_device_notify_remove(struct device *dev)
void acpi_device_notify_remove(struct device *dev)
{
	struct acpi_device *adev = ACPI_COMPANION(dev);
	struct acpi_bus_type *type;

	if (!adev)
		return 0;
		return;

	type = acpi_get_bus_type(dev);
	if (type && type->cleanup)
@@ -346,20 +339,4 @@ static int acpi_device_notify_remove(struct device *dev)
		adev->handler->unbind(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;
}
+1 −1
Original line number Diff line number Diff line
@@ -2,7 +2,7 @@
config ACPI_NUMA
	bool "NUMA support"
	depends on NUMA
	depends on (X86 || IA64 || ARM64)
	depends on (X86 || IA64 || ARM64 || LOONGARCH)
	default y if IA64 || ARM64

config ACPI_HMAT
Loading