From: Rafael J. Wysocki Date: Tue, 31 Mar 2026 19:25:40 +0000 (+0200) Subject: ACPI: TAD: Relocate two functions X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=9bcdd4ef4cd24ff360c6d0df3b8efad35d82bd94;p=thirdparty%2Fkernel%2Flinux.git ACPI: TAD: Relocate two functions Move two functions introduced previously, __acpi_tad_wake_set() and __acpi_tad_wake_read(), to the part of the code preceding the sysfs interface implementation, since subsequently they will be used by the RTC device interface too. No intentional functional impact. Signed-off-by: Rafael J. Wysocki Reviewed-by: Alexandre Belloni Link: https://patch.msgid.link/3960639.kQq0lBPeGt@rafael.j.wysocki --- diff --git a/drivers/acpi/acpi_tad.c b/drivers/acpi/acpi_tad.c index 7b422904e45b4..a0857a7904df0 100644 --- a/drivers/acpi/acpi_tad.c +++ b/drivers/acpi/acpi_tad.c @@ -174,6 +174,53 @@ static int acpi_tad_get_real_time(struct device *dev, struct acpi_tad_rt *rt) return __acpi_tad_get_real_time(dev, rt); } +static int __acpi_tad_wake_set(struct device *dev, char *method, u32 timer_id, + u32 value) +{ + acpi_handle handle = ACPI_HANDLE(dev); + union acpi_object args[] = { + { .type = ACPI_TYPE_INTEGER, }, + { .type = ACPI_TYPE_INTEGER, }, + }; + struct acpi_object_list arg_list = { + .pointer = args, + .count = ARRAY_SIZE(args), + }; + unsigned long long retval; + acpi_status status; + + args[0].integer.value = timer_id; + args[1].integer.value = value; + + status = acpi_evaluate_integer(handle, method, &arg_list, &retval); + if (ACPI_FAILURE(status) || retval) + return -EIO; + + return 0; +} + +static int __acpi_tad_wake_read(struct device *dev, char *method, u32 timer_id, + unsigned long long *retval) +{ + acpi_handle handle = ACPI_HANDLE(dev); + union acpi_object args[] = { + { .type = ACPI_TYPE_INTEGER, }, + }; + struct acpi_object_list arg_list = { + .pointer = args, + .count = ARRAY_SIZE(args), + }; + acpi_status status; + + args[0].integer.value = timer_id; + + status = acpi_evaluate_integer(handle, method, &arg_list, retval); + if (ACPI_FAILURE(status)) + return -EIO; + + return 0; +} + /* sysfs interface */ static char *acpi_tad_rt_next_field(char *s, int *val) @@ -273,31 +320,6 @@ static ssize_t time_show(struct device *dev, struct device_attribute *attr, static DEVICE_ATTR_RW(time); -static int __acpi_tad_wake_set(struct device *dev, char *method, u32 timer_id, - u32 value) -{ - acpi_handle handle = ACPI_HANDLE(dev); - union acpi_object args[] = { - { .type = ACPI_TYPE_INTEGER, }, - { .type = ACPI_TYPE_INTEGER, }, - }; - struct acpi_object_list arg_list = { - .pointer = args, - .count = ARRAY_SIZE(args), - }; - unsigned long long retval; - acpi_status status; - - args[0].integer.value = timer_id; - args[1].integer.value = value; - - status = acpi_evaluate_integer(handle, method, &arg_list, &retval); - if (ACPI_FAILURE(status) || retval) - return -EIO; - - return 0; -} - static int acpi_tad_wake_set(struct device *dev, char *method, u32 timer_id, u32 value) { @@ -328,28 +350,6 @@ static int acpi_tad_wake_write(struct device *dev, const char *buf, char *method return acpi_tad_wake_set(dev, method, timer_id, value); } -static int __acpi_tad_wake_read(struct device *dev, char *method, u32 timer_id, - unsigned long long *retval) -{ - acpi_handle handle = ACPI_HANDLE(dev); - union acpi_object args[] = { - { .type = ACPI_TYPE_INTEGER, }, - }; - struct acpi_object_list arg_list = { - .pointer = args, - .count = ARRAY_SIZE(args), - }; - acpi_status status; - - args[0].integer.value = timer_id; - - status = acpi_evaluate_integer(handle, method, &arg_list, retval); - if (ACPI_FAILURE(status)) - return -EIO; - - return 0; -} - static ssize_t acpi_tad_wake_read(struct device *dev, char *buf, char *method, u32 timer_id, const char *specval) {