summaryrefslogtreecommitdiff
path: root/rust/zerocopy/rustdoc/git@git.tavy.me:linux.git
diff options
context:
space:
mode:
authorFredrik M Olsson <fredrik.m.olsson@axis.com>2026-05-20 16:48:54 +0200
committerAlexandre Belloni <alexandre.belloni@bootlin.com>2026-06-24 23:40:10 +0200
commit6882aab3c66112b33b251be95c09c8ead3e8d580 (patch)
tree7675fafb081be55c5cd4503113039c983be280ac /rust/zerocopy/rustdoc/git@git.tavy.me:linux.git
parentcc387941c0a125fb6730e7270b4bb91edead5407 (diff)
rtc: ds1307: Fix off-by-one issue with wday for rx8130
The RTC represent each weekday with a individual bit set in the WDAY register, where the 0th bit represent the first day of the week and the 6th bit represents the last day of the week. For each passed day the chip performs a rotary-left-shift by one to advance the weekday by one. The tm_wday field represent weekdays by a value in the range of 0-6. The fls() function return the bit index of the last bit set. To handle when there are no bits set it will return 0, and if the 0th bit is set it will return 1, and if the 1st bit is set it will return 2, and so on. In order to make the result of the fls() function fall into the expected range of 0-6 (instead of 1-7) this patch subtracts one from the result (which matches how the value is written in ds1307_set_time()). Fixes: 204756f016726 ("rtc: ds1307: Fix wday settings for rx8130") Reviewed-by: Nobuhiro Iwamatsu <nobuhiro.iwamatsu.x90@mail.toshiba> Signed-off-by: Fredrik M Olsson <fredrik.m.olsson@axis.com> Link: https://patch.msgid.link/20260520-ds1307-rx8901-add-v2-2-e069ea32e1db@axis.com Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Diffstat (limited to 'rust/zerocopy/rustdoc/git@git.tavy.me:linux.git')
0 files changed, 0 insertions, 0 deletions