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

Merge branches 'acpi-battery', 'acpi-fan' and 'acpi-misc'

Merge ACPI battery and fan drivers updates and miscellaneous ACPI
chanages for 6.14:

 - Update messages printed by the ACPI battery driver to always
   refer to driver extensions as "hooks" to avoid confusion with
   similar functionality in the power supply subsystem in the
   future (Thomas Weißschuh).

 - Fix .probe() error path cleanup in the ACPI fan driver to avoid
   memory leaks (Joe Hattori).

 - Constify 'struct bin_attribute' in some places in the ACPI subsystem
   and mark it as __ro_after_init in one place to prevent binary blob
   attributes from being updated (Thomas Weißschuh)

 - Add empty stubs for several ACPI-related symbols so that they can be
   used when CONFIG_ACPI is unset and use them for removing unnecessary
   conditional compilation from the ipu-bridge driver (Ricardo Ribalda).

* acpi-battery:
  ACPI: battery: Rename extensions to hook in messages

* acpi-fan:
  ACPI: fan: cleanup resources in the error path of .probe()

* acpi-misc:
  media: ipu-bridge: Remove unneeded conditional compilations
  ACPI: bus: implement acpi_device_hid when !ACPI
  ACPI: bus: implement for_each_acpi_consumer_dev when !ACPI
  ACPI: header: implement acpi_device_handle when !ACPI
  ACPI: bus: implement acpi_get_physical_device_location when !ACPI
  ACPI: bus: implement for_each_acpi_dev_match when !ACPI
  ACPI: bus: change the prototype for acpi_get_physical_device_location
  ACPI: sysfs: Constify 'struct bin_attribute'
  ACPI: BGRT: Constify 'struct bin_attribute'
  ACPI: BGRT: Mark bin_attribute as __ro_after_init
Loading
Loading
Loading
Loading
+7 −7
Original line number Diff line number Diff line
@@ -717,7 +717,7 @@ static void battery_hook_unregister_unlocked(struct acpi_battery_hook *hook)
	}
	list_del_init(&hook->list);

	pr_info("extension unregistered: %s\n", hook->name);
	pr_info("hook unregistered: %s\n", hook->name);
}

void battery_hook_unregister(struct acpi_battery_hook *hook)
@@ -751,18 +751,18 @@ void battery_hook_register(struct acpi_battery_hook *hook)
		if (hook->add_battery(battery->bat, hook)) {
			/*
			 * If a add-battery returns non-zero,
			 * the registration of the extension has failed,
			 * the registration of the hook has failed,
			 * and we will not add it to the list of loaded
			 * hooks.
			 */
			pr_err("extension failed to load: %s", hook->name);
			pr_err("hook failed to load: %s", hook->name);
			battery_hook_unregister_unlocked(hook);
			goto end;
		}

		power_supply_changed(battery->bat);
	}
	pr_info("new extension: %s\n", hook->name);
	pr_info("new hook: %s\n", hook->name);
end:
	mutex_unlock(&hook_mutex);
}
@@ -805,10 +805,10 @@ static void battery_hook_add_battery(struct acpi_battery *battery)
	list_for_each_entry_safe(hook_node, tmp, &battery_hook_list, list) {
		if (hook_node->add_battery(battery->bat, hook_node)) {
			/*
			 * The notification of the extensions has failed, to
			 * prevent further errors we will unload the extension.
			 * The notification of the hook has failed, to
			 * prevent further errors we will unload the hook.
			 */
			pr_err("error in extension, unloading: %s",
			pr_err("error in hook, unloading: %s",
					hook_node->name);
			battery_hook_unregister_unlocked(hook_node);
		}
+3 −3
Original line number Diff line number Diff line
@@ -29,7 +29,7 @@ BGRT_SHOW(type, image_type);
BGRT_SHOW(xoffset, image_offset_x);
BGRT_SHOW(yoffset, image_offset_y);

static BIN_ATTR_SIMPLE_RO(image);
static __ro_after_init BIN_ATTR_SIMPLE_RO(image);

static struct attribute *bgrt_attributes[] = {
	&bgrt_attr_version.attr,
@@ -40,14 +40,14 @@ static struct attribute *bgrt_attributes[] = {
	NULL,
};

static struct bin_attribute *bgrt_bin_attributes[] = {
static const struct bin_attribute *const bgrt_bin_attributes[] = {
	&bin_attr_image,
	NULL,
};

static const struct attribute_group bgrt_attribute_group = {
	.attrs = bgrt_attributes,
	.bin_attrs = bgrt_bin_attributes,
	.bin_attrs_new = bgrt_bin_attributes,
};

int __init acpi_parse_bgrt(struct acpi_table_header *table)
+8 −2
Original line number Diff line number Diff line
@@ -371,19 +371,25 @@ static int acpi_fan_probe(struct platform_device *pdev)
	result = sysfs_create_link(&pdev->dev.kobj,
				   &cdev->device.kobj,
				   "thermal_cooling");
	if (result)
	if (result) {
		dev_err(&pdev->dev, "Failed to create sysfs link 'thermal_cooling'\n");
		goto err_unregister;
	}

	result = sysfs_create_link(&cdev->device.kobj,
				   &pdev->dev.kobj,
				   "device");
	if (result) {
		dev_err(&pdev->dev, "Failed to create sysfs link 'device'\n");
		goto err_end;
		goto err_remove_link;
	}

	return 0;

err_remove_link:
	sysfs_remove_link(&pdev->dev.kobj, "thermal_cooling");
err_unregister:
	thermal_cooling_device_unregister(cdev);
err_end:
	if (fan->acpi4)
		acpi_fan_delete_attributes(device);
+1 −2
Original line number Diff line number Diff line
@@ -624,8 +624,7 @@ static void init_crs_csi2_swnodes(struct crs_csi2 *csi2)
	if (!fwnode_property_present(adev_fwnode, "rotation")) {
		struct acpi_pld_info *pld;

		status = acpi_get_physical_device_location(handle, &pld);
		if (ACPI_SUCCESS(status)) {
		if (acpi_get_physical_device_location(handle, &pld)) {
			swnodes->dev_props[NEXT_PROPERTY(prop_index, DEV_ROTATION)] =
					PROPERTY_ENTRY_U32("rotation",
							   pld->rotation * 45U);
+1 −3
Original line number Diff line number Diff line
@@ -723,10 +723,8 @@ int acpi_tie_acpi_dev(struct acpi_device *adev)
static void acpi_store_pld_crc(struct acpi_device *adev)
{
	struct acpi_pld_info *pld;
	acpi_status status;

	status = acpi_get_physical_device_location(adev->handle, &pld);
	if (ACPI_FAILURE(status))
	if (!acpi_get_physical_device_location(adev->handle, &pld))
		return;

	adev->pld_crc = crc32(~0, pld, sizeof(*pld));
Loading