<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel/linux.git/drivers/rtc/class.c, branch v5.10.258</title>
<subtitle>Linux kernel stable tree (mirror)</subtitle>
<id>https://git.radix-linux.su/kernel/linux.git/atom?h=v5.10.258</id>
<link rel='self' href='https://git.radix-linux.su/kernel/linux.git/atom?h=v5.10.258'/>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/'/>
<updated>2026-06-01T15:29:41+00:00</updated>
<entry>
<title>rtc: introduce features bitfield</title>
<updated>2026-06-01T15:29:41+00:00</updated>
<author>
<name>Alexandre Belloni</name>
<email>alexandre.belloni@bootlin.com</email>
</author>
<published>2021-01-10T23:17:36+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=384a0c7f9d54eba890e0a42eb3ee1ea603d258c8'/>
<id>urn:sha1:384a0c7f9d54eba890e0a42eb3ee1ea603d258c8</id>
<content type='text'>
[ Upstream commit 7ae41220ef5831674f446baef19bfe1b31358260 ]

Introduce a bitfield to allow the drivers to announce the available
features for an RTC.

The main use case would be to better handle alarms, that could be present
or not or have a minute resolution or may need a correct week day to be set.

Use the newly introduced RTC_FEATURE_ALARM bit to then test whether alarms
are available instead of relying on the presence of ops-&gt;set_alarm.

Signed-off-by: Alexandre Belloni &lt;alexandre.belloni@bootlin.com&gt;
Link: https://lore.kernel.org/r/20210110231752.1418816-2-alexandre.belloni@bootlin.com
Stable-dep-of: 0fedce7244e4 ("rtc: abx80x: Disable alarm feature if no interrupt attached")
Signed-off-by: Sasha Levin &lt;sashal@kernel.org&gt;
</content>
</entry>
<entry>
<title>rtc: Fix offset calculation for .start_secs &lt; 0</title>
<updated>2025-06-27T10:04:06+00:00</updated>
<author>
<name>Alexandre Mergnat</name>
<email>amergnat@baylibre.com</email>
</author>
<published>2025-04-28T10:06:48+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=7482120ffd25b366ef3a29cb136067263aa28d0b'/>
<id>urn:sha1:7482120ffd25b366ef3a29cb136067263aa28d0b</id>
<content type='text'>
[ Upstream commit fe9f5f96cfe8b82d0f24cbfa93718925560f4f8d ]

The comparison

        rtc-&gt;start_secs &gt; rtc-&gt;range_max

has a signed left-hand side and an unsigned right-hand side.
So the comparison might become true for negative start_secs which is
interpreted as a (possibly very large) positive value.

As a negative value can never be bigger than an unsigned value
the correct representation of the (mathematical) comparison

        rtc-&gt;start_secs &gt; rtc-&gt;range_max

in C is:

        rtc-&gt;start_secs &gt;= 0 &amp;&amp; rtc-&gt;start_secs &gt; rtc-&gt;range_max

Use that to fix the offset calculation currently used in the
rtc-mt6397 driver.

Fixes: 989515647e783 ("rtc: Add one offset seconds to expand RTC range")
Signed-off-by: Alexandre Mergnat &lt;amergnat@baylibre.com&gt;
Reviewed-by: Uwe Kleine-König &lt;u.kleine-koenig@baylibre.com&gt;
Link: https://lore.kernel.org/r/20250428-enable-rtc-v4-2-2b2f7e3f9349@baylibre.com
Signed-off-by: Alexandre Belloni &lt;alexandre.belloni@bootlin.com&gt;
Signed-off-by: Sasha Levin &lt;sashal@kernel.org&gt;
</content>
</entry>
<entry>
<title>rtc: fix use-after-free on device removal</title>
<updated>2022-05-25T07:17:52+00:00</updated>
<author>
<name>Vincent Whitchurch</name>
<email>vincent.whitchurch@axis.com</email>
</author>
<published>2021-12-10T16:09:51+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=2b4e5a2d7da04e6c80a5869fe209caee322a65b6'/>
<id>urn:sha1:2b4e5a2d7da04e6c80a5869fe209caee322a65b6</id>
<content type='text'>
[ Upstream commit c8fa17d9f08a448184f03d352145099b5beb618e ]

If the irqwork is still scheduled or running while the RTC device is
removed, a use-after-free occurs in rtc_timer_do_work().  Cleanup the
timerqueue and ensure the work is stopped to fix this.

 BUG: KASAN: use-after-free in mutex_lock+0x94/0x110
 Write of size 8 at addr ffffff801d846338 by task kworker/3:1/41

 Workqueue: events rtc_timer_do_work
 Call trace:
  mutex_lock+0x94/0x110
  rtc_timer_do_work+0xec/0x630
  process_one_work+0x5fc/0x1344
  ...

 Allocated by task 551:
  kmem_cache_alloc_trace+0x384/0x6e0
  devm_rtc_allocate_device+0xf0/0x574
  devm_rtc_device_register+0x2c/0x12c
  ...

 Freed by task 572:
  kfree+0x114/0x4d0
  rtc_device_release+0x64/0x80
  device_release+0x8c/0x1f4
  kobject_put+0x1c4/0x4b0
  put_device+0x20/0x30
  devm_rtc_release_device+0x1c/0x30
  devm_action_release+0x54/0x90
  release_nodes+0x124/0x310
  devres_release_group+0x170/0x240
  i2c_device_remove+0xd8/0x314
  ...

 Last potentially related work creation:
  insert_work+0x5c/0x330
  queue_work_on+0xcc/0x154
  rtc_set_time+0x188/0x5bc
  rtc_dev_ioctl+0x2ac/0xbd0
  ...

Signed-off-by: Vincent Whitchurch &lt;vincent.whitchurch@axis.com&gt;
Signed-off-by: Alexandre Belloni &lt;alexandre.belloni@bootlin.com&gt;
Link: https://lore.kernel.org/r/20211210160951.7718-1-vincent.whitchurch@axis.com
Signed-off-by: Sasha Levin &lt;sashal@kernel.org&gt;
</content>
</entry>
<entry>
<title>rtc: class: remove redundant assignment to variable err</title>
<updated>2020-04-02T16:47:30+00:00</updated>
<author>
<name>Colin Ian King</name>
<email>colin.king@canonical.com</email>
</author>
<published>2020-04-02T11:04:11+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=3edf29d9d585237c53f06e44227c4b36c8794222'/>
<id>urn:sha1:3edf29d9d585237c53f06e44227c4b36c8794222</id>
<content type='text'>
The variable err is being initialized with a value that is never read
and it is being updated later with a new value. The initialization
is redundant and can be removed.

Addresses-Coverity: ("Unused value")
Signed-off-by: Colin Ian King &lt;colin.king@canonical.com&gt;
Link: https://lore.kernel.org/r/20200402110411.508534-1-colin.king@canonical.com
Signed-off-by: Alexandre Belloni &lt;alexandre.belloni@bootlin.com&gt;
</content>
</entry>
<entry>
<title>rtc: class: avoid unnecessary lookup in hctosys</title>
<updated>2020-03-24T21:48:04+00:00</updated>
<author>
<name>Alexandre Belloni</name>
<email>alexandre.belloni@bootlin.com</email>
</author>
<published>2020-03-23T21:30:39+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=5614a4a3ca0e8806e144419536f52df419caa14f'/>
<id>urn:sha1:5614a4a3ca0e8806e144419536f52df419caa14f</id>
<content type='text'>
rtc_hctosys is only called when the relevant RTC is found, avoid looking it
up while we already have a pinter to the proper struct rtc_device.

Link: https://lore.kernel.org/r/20200323213039.297458-1-alexandre.belloni@bootlin.com
Signed-off-by: Alexandre Belloni &lt;alexandre.belloni@bootlin.com&gt;
</content>
</entry>
<entry>
<title>rtc: class: support hctosys from modular RTC drivers</title>
<updated>2020-03-23T20:14:34+00:00</updated>
<author>
<name>Steve Muckle</name>
<email>smuckle@google.com</email>
</author>
<published>2019-11-06T19:46:25+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=f9b2a4d6a5f18e0aaf715206a056565c56889d9f'/>
<id>urn:sha1:f9b2a4d6a5f18e0aaf715206a056565c56889d9f</id>
<content type='text'>
Due to distribution constraints it may not be possible to statically
compile the required RTC driver into the kernel.

Expand RTC_HCTOSYS support to cover all RTC devices (statically compiled
or not) by checking at the end of RTC device registration whether the
time should be synced.

Signed-off-by: Steve Muckle &lt;smuckle@google.com&gt;
Link: https://lore.kernel.org/r/20191106194625.116692-1-smuckle@google.com
Signed-off-by: Alexandre Belloni &lt;alexandre.belloni@bootlin.com&gt;
</content>
</entry>
<entry>
<title>rtc: class: add debug message when registration fails</title>
<updated>2019-08-20T19:44:45+00:00</updated>
<author>
<name>Alexandre Belloni</name>
<email>alexandre.belloni@bootlin.com</email>
</author>
<published>2019-08-18T22:00:40+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=924068e50a6ca426b8fda1d2c06d6d2bde212136'/>
<id>urn:sha1:924068e50a6ca426b8fda1d2c06d6d2bde212136</id>
<content type='text'>
Add a message when __rtc_register_device fails because rtc-&gt;ops is NULL.
This may only happen when developing a new driver so use dev_dbg to avoid
compiling it in by default.

Signed-off-by: Alexandre Belloni &lt;alexandre.belloni@bootlin.com&gt;
Link: https://lore.kernel.org/r/20190818220041.17833-1-alexandre.belloni@bootlin.com
Signed-off-by: Alexandre Belloni &lt;alexandre.belloni@bootlin.com&gt;
</content>
</entry>
<entry>
<title>rtc: core: correct trivial checkpatch warnings</title>
<updated>2019-04-04T08:07:08+00:00</updated>
<author>
<name>Alexandre Belloni</name>
<email>alexandre.belloni@bootlin.com</email>
</author>
<published>2019-03-20T11:59:09+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=606cc43c720bdef01a22c9d221434c635139d84e'/>
<id>urn:sha1:606cc43c720bdef01a22c9d221434c635139d84e</id>
<content type='text'>
Correct trivial checkpatch warnings, mostly whitespace issues and
unbalanced braces.

Signed-off-by: Alexandre Belloni &lt;alexandre.belloni@bootlin.com&gt;
</content>
</entry>
<entry>
<title>rtc: convert core to SPDX identifier</title>
<updated>2019-03-18T02:36:01+00:00</updated>
<author>
<name>Alexandre Belloni</name>
<email>alexandre.belloni@bootlin.com</email>
</author>
<published>2019-03-13T22:02:48+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=cdf7545aef65c47c17afdd3bed90410b3fd33bfd'/>
<id>urn:sha1:cdf7545aef65c47c17afdd3bed90410b3fd33bfd</id>
<content type='text'>
Use SPDX-License-Identifier instead of a verbose license text. Also fix the
block comment alignment.

Signed-off-by: Alexandre Belloni &lt;alexandre.belloni@bootlin.com&gt;
</content>
</entry>
<entry>
<title>rtc: class: reimplement devm_rtc_device_register</title>
<updated>2018-12-18T21:53:32+00:00</updated>
<author>
<name>Alexandre Belloni</name>
<email>alexandre.belloni@bootlin.com</email>
</author>
<published>2018-12-18T21:15:58+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=a26944149374c19d92f785108b6980f2e54bb517'/>
<id>urn:sha1:a26944149374c19d92f785108b6980f2e54bb517</id>
<content type='text'>
Implement devm_rtc_device_register using devm_rtc_allocate_device and
__rtc_register_device so there is only one path left to register rtc
devices.

Also mark it as deprecated so new drivers will hopefully use
devm_rtc_allocate_device and rtc_register_device that are less race prone
and allow avoiding the 2038, 2070, 2100 and 2106 bugs properly.

Signed-off-by: Alexandre Belloni &lt;alexandre.belloni@bootlin.com&gt;
</content>
</entry>
</feed>
