Patch "rtc: m41t80: fix m41t80_sqw_round_rate return value" has been added to the 4.14-stable tree
Subsystems (2)
This is a note to let you know that I've just added the patch titled
rtc: m41t80: fix m41t80_sqw_round_rate return value
to the 4.14-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary
The filename of the patch is:
rtc-m41t80-fix-m41t80_sqw_round_rate-return-value.patch
and it can be found in the queue-4.14 subdirectory.
If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.
Quoted 1 line
From
c8384bb04261b9d32fe7402a6068ddaf38913b23Mon Sep 17 00:00:00 2001
From: Troy Kisky <[email protected]>
Date: Thu, 2 Nov 2017 18:58:13 -0700
Subject: rtc: m41t80: fix m41t80_sqw_round_rate return value
From: Troy Kisky <[email protected]>
commit c8384bb04261b9d32fe7402a6068ddaf38913b23 upstream.
Previously it was returning the best of
32768, 8192, 1024, 64, 2, 0
Now, best of
32768, 8192, 4096, 2048, 1024, 512, 256, 128,
64, 32, 16, 8, 4, 2, 1, 0
--- drivers/rtc/rtc-m41t80.c | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-)
drivers/rtc/rtc-m41t80.c +7 -12
@@ -468,18 +468,13 @@ static unsigned long m41t80_sqw_recalc_rstatic long m41t80_sqw_round_rate (struct clk_hw *hw,unsigned long rate,unsigned long *prate) { -int i, freq =M41T80_SQW_MAX_FREQ ; - -if (freq <= rate) -return freq; - -for (i =2 ; i <=ilog2 (M41T80_SQW_MAX_FREQ ); i++) { - freq /=1 << i; -if (freq <= rate) -return freq; - } - -return 0 ; +if (rate >=M41T80_SQW_MAX_FREQ ) +return M41T80_SQW_MAX_FREQ ; +if (rate >=M41T80_SQW_MAX_FREQ /4 ) +return M41T80_SQW_MAX_FREQ /4 ; +if (!rate) +return 0 ; +return 1 <<ilog2 (rate); } static int m41t80_sqw_set_rate(struct clk_hw *hw, unsigned long rate,
Patches currently in stable-queue which might be from [email protected] are
queue-4.14/rtc-m41t80-m41t80_sqw_set_rate-should-return-0-on-success.patch queue-4.14/rtc-m41t80-avoid-i2c-read-in-m41t80_sqw_is_prepared.patch queue-4.14/rtc-m41t80-avoid-i2c-read-in-m41t80_sqw_recalc_rate.patch queue-4.14/rtc-m41t80-remove-unneeded-checks-from-m41t80_sqw_set_rate.patch queue-4.14/rtc-m41t80-fix-m41t80_sqw_round_rate-return-value.patch