Subject: [PATCH] [acpi video] Add set_int() helper to dev-device.c Signed-off-by: Patrick Mochel --- drivers/acpi/drivers/video/dev-device.c | 25 +++++++++++++++++++++++++ 1 files changed, 25 insertions(+), 0 deletions(-) applies-to: 13917aa52c196409b98e3fa001d0c7f205628772 6e4c51e69dbf808959220bb12c0ea91345a7c258 diff --git a/drivers/acpi/drivers/video/dev-device.c b/drivers/acpi/drivers/video/dev-device.c index 658d080..2b297c7 100644 --- a/drivers/acpi/drivers/video/dev-device.c +++ b/drivers/acpi/drivers/video/dev-device.c @@ -23,6 +23,31 @@ static int get_int(struct acpi_dev * ad, return ACPI_SUCCESS(status) ? 0 : -ENODEV; } +static int set_int(struct acpi_dev * ad, char * method, u32 val) +{ + union acpi_object obj = { + .type = ACPI_TYPE_INTEGER, + .integer = { + .value = val, + }, + }; + struct acpi_object_list arg_list = { + .count = 1, + .pointer = &obj, + }; + acpi_status status; + unsigned long acpi_ret; + int ret; + + status = acpi_evaluate_integer(ad->acpi_device->handle, method, + &arg_list, &acpi_ret); + if (ACPI_SUCCESS(status)) + ret = acpi_ret ? -EINVAL : 0; + else + ret = -ENODEV; + return ret; +} + static int get_package(struct acpi_dev * ad, char * method, union acpi_object ** package) --- 0.99.9.GIT