From: Alexandre Belloni <alexandre.belloni@bootlin.com>
To: "Rafael J. Wysocki" <rafael@kernel.org>
Cc: Linux ACPI <linux-acpi@vger.kernel.org>,
Danilo Krummrich <dakr@kernel.org>,
LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v0 5/6] ACPI: TAD: Add RTC class device interface
Date: Fri, 27 Feb 2026 11:37:34 +0100 [thread overview]
Message-ID: <202602271037341ec1378a@mail.local> (raw)
In-Reply-To: <10819001.nUPlyArG6x@rafael.j.wysocki>
Hello,
On 22/02/2026 15:18:29+0100, Rafael J. Wysocki wrote:
> +static int acpi_tad_rtc_procfs(struct device *dev, struct seq_file *seq)
> +{
> + struct acpi_tad_rt rt;
> + int ret;
> +
> + ret = acpi_tad_get_real_time(dev, &rt);
> + if (ret)
> + return ret;
> +
> + seq_printf(seq,
> + "Time\t\t: %u:%u:%u\n"
> + "Date\t\t: %u-%u-%u\n"
> + "Daylight\t: %s\n",
> + rt.hour, rt.minute, rt.second,
> + rt.year, rt.month, rt.day,
> + str_yes_no(rt.daylight == ACPI_TAD_TIME_ISDST));
> +
> + if (rt.tz == ACPI_TAD_TZ_UNSPEC)
> + seq_puts(seq, "Timezone\t: unspecified\n");
> + else
> + seq_printf(seq, "Timezone\t: %d\n", rt.tz);
> +
> + return 0;
> +}
> +
> +static const struct rtc_class_ops acpi_tad_rtc_ops = {
> + .read_time = acpi_tad_rtc_read_time,
> + .set_time = acpi_tad_rtc_set_time,
> + .proc = acpi_tad_rtc_procfs,
I would avoid implementing .proc, it has been deprecated for a while and
doesn't bring much.
> +};
> +
> +/* Platform driver interface */
> +
> static int acpi_tad_disable_timer(struct device *dev, u32 timer_id)
> {
> return acpi_tad_wake_set(dev, "_STV", timer_id, ACPI_TAD_WAKE_DISABLED);
> @@ -655,10 +730,16 @@ static int acpi_tad_probe(struct platfor
> pm_runtime_suspend(dev);
>
> ret = sysfs_create_group(&dev->kobj, &acpi_tad_attr_group);
> - if (ret)
> + if (ret) {
> acpi_tad_remove(pdev);
> + return ret;
> + }
>
> - return ret;
> + if (caps & ACPI_TAD_RT)
> + devm_rtc_device_register(dev, "acpi-tad-rtc", &acpi_tad_rtc_ops,
> + THIS_MODULE);
> +
Please use devm_rtc_allocate_device() and devm_rtc_register_device() so
you can set range_min and range_max. I get you don't need the rtc_device
later so we could have a helper that takes the range and registers the
rtc.
> + return 0;
> }
>
> static const struct acpi_device_id acpi_tad_ids[] = {
>
>
>
--
Alexandre Belloni, co-owner and COO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
next prev parent reply other threads:[~2026-02-27 10:37 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-22 14:14 [PATCH v0 0/6] ACPI: TAD: Assorted improvements and RTC class device interface Rafael J. Wysocki
2026-02-22 14:15 ` [PATCH v0 1/6] ACPI: TAD: Create one attribute group Rafael J. Wysocki
2026-02-22 14:16 ` [PATCH v0 2/6] ACPI: TAD: Use __free() for cleanup in time_store() Rafael J. Wysocki
2026-02-22 14:17 ` [PATCH v0 3/6] ACPI: TAD: Update RT data validation checking Rafael J. Wysocki
2026-02-22 14:17 ` [PATCH v0 4/6] ACPI: TAD: Clear unused RT data in acpi_tad_set_real_time() Rafael J. Wysocki
2026-02-22 14:18 ` [PATCH v0 5/6] ACPI: TAD: Add RTC class device interface Rafael J. Wysocki
2026-02-27 10:37 ` Alexandre Belloni [this message]
2026-02-27 11:26 ` Rafael J. Wysocki
2026-02-22 14:19 ` [PATCH v0 6/6] ACPI: TAD: Update the driver description comment Rafael J. Wysocki
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=202602271037341ec1378a@mail.local \
--to=alexandre.belloni@bootlin.com \
--cc=dakr@kernel.org \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=rafael@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox