[PATCH v1 3/4] ACPI: TAD: Split acpi_tad_rtc_set_time()

Rafael J. Wysocki
2026-03-31T19:39:12Z

Move the code converting a struct acpi_tad_rt into a struct rtc_time
from acpi_tad_rtc_set_time() into a new function, acpi_tad_rt_to_tm(),
to facilitate adding alarm support to the driver's RTC class device
interface going forward.

No intentional functional impact.

Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
---
drivers/acpi/acpi_tad.c | 19 ++++++++++++-------
1 file changed, 12 insertions(+), 7 deletions(-)

--- a/drivers/acpi/acpi_tad.c
+++ b/drivers/acpi/acpi_tad.c
@@ -617,6 +617,17 @@ static const struct attribute_group *acp
#ifdef CONFIG_RTC_CLASS
/* RTC class device interface */

+static void acpi_tad_rt_to_tm(struct acpi_tad_rt *rt, struct rtc_time *tm)
+{
+ tm->tm_year = rt->year - 1900;
+ tm->tm_mon = rt->month - 1;
+ tm->tm_mday = rt->day;
+ tm->tm_hour = rt->hour;
+ tm->tm_min = rt->minute;
+ tm->tm_sec = rt->second;
+ tm->tm_isdst = rt->daylight == ACPI_TAD_TIME_ISDST;
+}
+
static int acpi_tad_rtc_set_time(struct device *dev, struct rtc_time *tm)
{
struct acpi_tad_rt rt;
@@ -642,13 +653,7 @@ static int acpi_tad_rtc_read_time(struct
if (ret)
return ret;

- tm->tm_year = rt.year - 1900;
- tm->tm_mon = rt.month - 1;
- tm->tm_mday = rt.day;
- tm->tm_hour = rt.hour;
- tm->tm_min = rt.minute;
- tm->tm_sec = rt.second;
- tm->tm_isdst = rt.daylight == ACPI_TAD_TIME_ISDST;
+ acpi_tad_rt_to_tm(&rt, tm);

return 0;
}