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

Merge branches 'acpi-battery', 'acpi-ec', 'acpi-pfr' and 'acpi-osl'

Merge updates of the ACPI battery and EC drivers, an ACPI Platform
Firmware Runtime (PFR) telemetry driver update and an ACPI OS support
layer change for 6.13-rc1:

 - Use DEFINE_SIMPLE_DEV_PM_OPS in the ACPI battery driver, make it use
   devm_ for initializing mutexes and allocating driver data, and make
   it check the register_pm_notifier() return value (Thomas Weißschuh,
   Andy Shevchenko).

 - Make the ACPI EC driver support compile-time conditional and allow
   ACPI to be built without CONFIG_HAS_IOPORT (Arnd Bergmann).

 - Remove a redundant error check from the pfr_telemetry driver (Colin
   Ian King).

* acpi-battery:
  ACPI: battery: Check for error code from devm_mutex_init() call
  ACPI: battery: use DEFINE_SIMPLE_DEV_PM_OPS
  ACPI: battery: initialize mutexes through devm_ APIs
  ACPI: battery: allocate driver data through devm_ APIs
  ACPI: battery: check result of register_pm_notifier()

* acpi-ec:
  ACPI: EC: make EC support compile-time conditional

* acpi-pfr:
  ACPI: pfr_telemetry: remove redundant error check on ret

* acpi-osl:
  ACPI: allow building without CONFIG_HAS_IOPORT
Loading
Loading
Loading
Loading
+10 −1
Original line number Diff line number Diff line
@@ -132,8 +132,17 @@ config ACPI_REV_OVERRIDE_POSSIBLE
	  makes it possible to force the kernel to return "5" as the supported
	  ACPI revision via the "acpi_rev_override" command line switch.

config ACPI_EC
	bool "Embedded Controller"
	depends on HAS_IOPORT
	default X86
	help
	  This driver handles communication with the microcontroller
	  on many x86 laptops and other machines.

config ACPI_EC_DEBUGFS
	tristate "EC read/write access through /sys/kernel/debug/ec"
	depends on ACPI_EC
	help
	  Say N to disable Embedded Controller /sys/kernel/debug interface

@@ -433,7 +442,7 @@ config ACPI_HOTPLUG_IOAPIC

config ACPI_SBS
	tristate "Smart Battery System"
	depends on X86
	depends on X86 && ACPI_EC
	select POWER_SUPPLY
	help
	  This driver supports the Smart Battery System, another
+1 −1
Original line number Diff line number Diff line
@@ -41,7 +41,7 @@ acpi-y += resource.o
acpi-y				+= acpi_processor.o
acpi-y				+= processor_core.o
acpi-$(CONFIG_ARCH_MIGHT_HAVE_ACPI_PDC) += processor_pdc.o
acpi-y				+= ec.o
acpi-$(CONFIG_ACPI_EC)		+= ec.o
acpi-$(CONFIG_ACPI_DOCK)	+= dock.o
acpi-$(CONFIG_PCI)		+= pci_root.o pci_link.o pci_irq.o
obj-$(CONFIG_ACPI_MCFG)		+= pci_mcfg.o
+14 −17
Original line number Diff line number Diff line
@@ -1218,15 +1218,21 @@ static int acpi_battery_add(struct acpi_device *device)
	if (device->dep_unmet)
		return -EPROBE_DEFER;

	battery = kzalloc(sizeof(struct acpi_battery), GFP_KERNEL);
	battery = devm_kzalloc(&device->dev, sizeof(*battery), GFP_KERNEL);
	if (!battery)
		return -ENOMEM;
	battery->device = device;
	strscpy(acpi_device_name(device), ACPI_BATTERY_DEVICE_NAME);
	strscpy(acpi_device_class(device), ACPI_BATTERY_CLASS);
	device->driver_data = battery;
	mutex_init(&battery->lock);
	mutex_init(&battery->sysfs_lock);
	result = devm_mutex_init(&device->dev, &battery->lock);
	if (result)
		return result;

	result = devm_mutex_init(&device->dev, &battery->sysfs_lock);
	if (result)
		return result;

	if (acpi_has_method(battery->device->handle, "_BIX"))
		set_bit(ACPI_BATTERY_XINFO_PRESENT, &battery->flags);

@@ -1238,7 +1244,9 @@ static int acpi_battery_add(struct acpi_device *device)
		device->status.battery_present ? "present" : "absent");

	battery->pm_nb.notifier_call = battery_notify;
	register_pm_notifier(&battery->pm_nb);
	result = register_pm_notifier(&battery->pm_nb);
	if (result)
		goto fail;

	device_init_wakeup(&device->dev, 1);

@@ -1254,9 +1262,6 @@ static int acpi_battery_add(struct acpi_device *device)
	unregister_pm_notifier(&battery->pm_nb);
fail:
	sysfs_remove_battery(battery);
	mutex_destroy(&battery->lock);
	mutex_destroy(&battery->sysfs_lock);
	kfree(battery);

	return result;
}
@@ -1276,13 +1281,8 @@ static void acpi_battery_remove(struct acpi_device *device)
	device_init_wakeup(&device->dev, 0);
	unregister_pm_notifier(&battery->pm_nb);
	sysfs_remove_battery(battery);

	mutex_destroy(&battery->lock);
	mutex_destroy(&battery->sysfs_lock);
	kfree(battery);
}

#ifdef CONFIG_PM_SLEEP
/* this is needed to learn about changes made in suspended state */
static int acpi_battery_resume(struct device *dev)
{
@@ -1299,11 +1299,8 @@ static int acpi_battery_resume(struct device *dev)
	acpi_battery_update(battery, true);
	return 0;
}
#else
#define acpi_battery_resume NULL
#endif

static SIMPLE_DEV_PM_OPS(acpi_battery_pm, NULL, acpi_battery_resume);
static DEFINE_SIMPLE_DEV_PM_OPS(acpi_battery_pm, NULL, acpi_battery_resume);

static struct acpi_driver acpi_battery_driver = {
	.name = "battery",
@@ -1313,7 +1310,7 @@ static struct acpi_driver acpi_battery_driver = {
		.add = acpi_battery_add,
		.remove = acpi_battery_remove,
		},
	.drv.pm = &acpi_battery_pm,
	.drv.pm = pm_sleep_ptr(&acpi_battery_pm),
	.drv.probe_type = PROBE_PREFER_ASYNCHRONOUS,
};

+4 −2
Original line number Diff line number Diff line
@@ -1011,7 +1011,8 @@ static int cpc_read(int cpu, struct cpc_register_resource *reg_res, u64 *val)
	*val = 0;
	size = GET_BIT_WIDTH(reg);

	if (reg->space_id == ACPI_ADR_SPACE_SYSTEM_IO) {
	if (IS_ENABLED(CONFIG_HAS_IOPORT) &&
	    reg->space_id == ACPI_ADR_SPACE_SYSTEM_IO) {
		u32 val_u32;
		acpi_status status;

@@ -1085,7 +1086,8 @@ static int cpc_write(int cpu, struct cpc_register_resource *reg_res, u64 val)

	size = GET_BIT_WIDTH(reg);

	if (reg->space_id == ACPI_ADR_SPACE_SYSTEM_IO) {
	if (IS_ENABLED(CONFIG_HAS_IOPORT) &&
	    reg->space_id == ACPI_ADR_SPACE_SYSTEM_IO) {
		acpi_status status;

		status = acpi_os_write_port((acpi_io_address)reg->address,
+25 −0
Original line number Diff line number Diff line
@@ -215,6 +215,8 @@ extern struct acpi_ec *first_ec;
/* External interfaces use first EC only, so remember */
typedef int (*acpi_ec_query_func) (void *data);

#ifdef CONFIG_ACPI_EC

void acpi_ec_init(void);
void acpi_ec_ecdt_probe(void);
void acpi_ec_dsdt_probe(void);
@@ -231,6 +233,29 @@ void acpi_ec_flush_work(void);
bool acpi_ec_dispatch_gpe(void);
#endif

#else

static inline void acpi_ec_init(void) {}
static inline void acpi_ec_ecdt_probe(void) {}
static inline void acpi_ec_dsdt_probe(void) {}
static inline void acpi_ec_block_transactions(void) {}
static inline void acpi_ec_unblock_transactions(void) {}
static inline int acpi_ec_add_query_handler(struct acpi_ec *ec, u8 query_bit,
			      acpi_handle handle, acpi_ec_query_func func,
			      void *data)
{
	return -ENXIO;
}
static inline void acpi_ec_remove_query_handler(struct acpi_ec *ec, u8 query_bit) {}
static inline void acpi_ec_register_opregions(struct acpi_device *adev) {}

static inline void acpi_ec_flush_work(void) {}
static inline bool acpi_ec_dispatch_gpe(void)
{
	return false;
}

#endif

/*--------------------------------------------------------------------------
                                  Suspend/Resume
Loading