Skip to content

Commit 98a83da

Browse files
committed
platform/x86: wmi: Remove custom EC address space handler
The custom EC address space handler in the WMI driver was only needed because the EC driver did not install its address space handler for EC operation regions beyond the EC device scope in the ACPI namespace. That has just changed, so the custom EC address handler is not needed any more and it can be removed. Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Reviewed-by: Armin Wolf <W_Armin@gmx.de> Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com> Reviewed-by: Hans de Goede <hdegoede@redhat.com> Reviewed-by: Mario Limonciello <mario.limonciello@amd.com> Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
1 parent 60fa6ae commit 98a83da

File tree

1 file changed

+0
-92
lines changed
  • drivers/platform/x86

1 file changed

+0
-92
lines changed

drivers/platform/x86/wmi.c

Lines changed: 0 additions & 92 deletions
Original file line numberDiff line numberDiff line change
@@ -1153,77 +1153,6 @@ static int parse_wdg(struct device *wmi_bus_dev, struct platform_device *pdev)
11531153
return 0;
11541154
}
11551155

1156-
static int ec_read_multiple(u8 address, u8 *buffer, size_t bytes)
1157-
{
1158-
size_t i;
1159-
int ret;
1160-
1161-
for (i = 0; i < bytes; i++) {
1162-
ret = ec_read(address + i, &buffer[i]);
1163-
if (ret < 0)
1164-
return ret;
1165-
}
1166-
1167-
return 0;
1168-
}
1169-
1170-
static int ec_write_multiple(u8 address, u8 *buffer, size_t bytes)
1171-
{
1172-
size_t i;
1173-
int ret;
1174-
1175-
for (i = 0; i < bytes; i++) {
1176-
ret = ec_write(address + i, buffer[i]);
1177-
if (ret < 0)
1178-
return ret;
1179-
}
1180-
1181-
return 0;
1182-
}
1183-
1184-
/*
1185-
* WMI can have EmbeddedControl access regions. In which case, we just want to
1186-
* hand these off to the EC driver.
1187-
*/
1188-
static acpi_status
1189-
acpi_wmi_ec_space_handler(u32 function, acpi_physical_address address,
1190-
u32 bits, u64 *value,
1191-
void *handler_context, void *region_context)
1192-
{
1193-
int bytes = bits / BITS_PER_BYTE;
1194-
int ret;
1195-
1196-
if (!value)
1197-
return AE_NULL_ENTRY;
1198-
1199-
if (!bytes || bytes > sizeof(*value))
1200-
return AE_BAD_PARAMETER;
1201-
1202-
if (address > U8_MAX || address + bytes - 1 > U8_MAX)
1203-
return AE_BAD_PARAMETER;
1204-
1205-
if (function != ACPI_READ && function != ACPI_WRITE)
1206-
return AE_BAD_PARAMETER;
1207-
1208-
if (function == ACPI_READ)
1209-
ret = ec_read_multiple(address, (u8 *)value, bytes);
1210-
else
1211-
ret = ec_write_multiple(address, (u8 *)value, bytes);
1212-
1213-
switch (ret) {
1214-
case -EINVAL:
1215-
return AE_BAD_PARAMETER;
1216-
case -ENODEV:
1217-
return AE_NOT_FOUND;
1218-
case -ETIME:
1219-
return AE_TIME;
1220-
case 0:
1221-
return AE_OK;
1222-
default:
1223-
return AE_ERROR;
1224-
}
1225-
}
1226-
12271156
static int wmi_get_notify_data(struct wmi_block *wblock, union acpi_object **obj)
12281157
{
12291158
struct acpi_buffer data = { ACPI_ALLOCATE_BUFFER, NULL };
@@ -1338,14 +1267,6 @@ static void acpi_wmi_remove_notify_handler(void *data)
13381267
acpi_remove_notify_handler(acpi_device->handle, ACPI_ALL_NOTIFY, acpi_wmi_notify_handler);
13391268
}
13401269

1341-
static void acpi_wmi_remove_address_space_handler(void *data)
1342-
{
1343-
struct acpi_device *acpi_device = data;
1344-
1345-
acpi_remove_address_space_handler(acpi_device->handle, ACPI_ADR_SPACE_EC,
1346-
&acpi_wmi_ec_space_handler);
1347-
}
1348-
13491270
static void acpi_wmi_remove_bus_device(void *data)
13501271
{
13511272
struct device *wmi_bus_dev = data;
@@ -1377,19 +1298,6 @@ static int acpi_wmi_probe(struct platform_device *device)
13771298

13781299
dev_set_drvdata(&device->dev, wmi_bus_dev);
13791300

1380-
status = acpi_install_address_space_handler(acpi_device->handle,
1381-
ACPI_ADR_SPACE_EC,
1382-
&acpi_wmi_ec_space_handler,
1383-
NULL, NULL);
1384-
if (ACPI_FAILURE(status)) {
1385-
dev_err(&device->dev, "Error installing EC region handler\n");
1386-
return -ENODEV;
1387-
}
1388-
error = devm_add_action_or_reset(&device->dev, acpi_wmi_remove_address_space_handler,
1389-
acpi_device);
1390-
if (error < 0)
1391-
return error;
1392-
13931301
status = acpi_install_notify_handler(acpi_device->handle, ACPI_ALL_NOTIFY,
13941302
acpi_wmi_notify_handler, wmi_bus_dev);
13951303
if (ACPI_FAILURE(status)) {

0 commit comments

Comments
 (0)