Message ID | 20210928235635.1348330-3-willmcvicker@google.com (mailing list archive) |
---|---|
State | Changes Requested |
Headers | show |
Series | arm64: Kconfig: Update ARCH_EXYNOS select configs | expand |
On Tue, Sep 28, 2021 at 4:56 PM Will McVicker <willmcvicker@google.com> wrote: > > This allows modules to access the value of timekeeping_suspended without > giving them write access to the variable. > It's important to cover "the why" not "the what" in these commit messages, so you might add a note as to what code will be the user of this (the samsung/clk-pll.c code changed later in this series). thanks -john
On Tue, Sep 28, 2021 at 8:42 PM John Stultz <john.stultz@linaro.org> wrote: > > On Tue, Sep 28, 2021 at 4:56 PM Will McVicker <willmcvicker@google.com> wrote: > > > > This allows modules to access the value of timekeeping_suspended without > > giving them write access to the variable. > > > > It's important to cover "the why" not "the what" in these commit > messages, so you might add a note as to what code will be the user of > this (the samsung/clk-pll.c code changed later in this series). > > thanks > -john Thanks John for the tip. I will try to be better at that in the followup. For this specific patch, I am adding this new API because the Samsung PLL driver (drivers/clk/samsung/clk-pll.c) currently is using the variable 'timekeeping_suspended' to detect timeouts before the clocksource is initialized or timekeeping itself is suspended. My patch series aims to modularize the Samsung PLL driver. So to keep the driver's functionality intact, I need to add this additional API. --Will
On Wed, Sep 29, 2021 at 1:01 PM Will McVicker <willmcvicker@google.com> wrote: > On Tue, Sep 28, 2021 at 8:42 PM John Stultz <john.stultz@linaro.org> wrote: > > On Tue, Sep 28, 2021 at 4:56 PM Will McVicker <willmcvicker@google.com> wrote: > > > > > > This allows modules to access the value of timekeeping_suspended without > > > giving them write access to the variable. > > > > > > > It's important to cover "the why" not "the what" in these commit > > messages, so you might add a note as to what code will be the user of > > this (the samsung/clk-pll.c code changed later in this series). > > > > thanks > > -john > > Thanks John for the tip. I will try to be better at that in the followup. I have to remind myself regularly as well. :) Apologies if my quick reply above seemed curt (as it does to me re-reading it now). Wasn't my intent. > For this specific patch, I am adding this new API because the Samsung > PLL driver (drivers/clk/samsung/clk-pll.c) currently is using the > variable 'timekeeping_suspended' to detect timeouts before the > clocksource is initialized or timekeeping itself is suspended. My > patch series aims to modularize the Samsung PLL driver. So to keep the > driver's functionality intact, I need to add this additional API. Sounds good! Another small/medium suggestion: Since you're adding a new interface for non-core users of timekeeping_suspended, it might be good to switch the other users as well (seems like just drivers/clk/ti/clkctrl.c and kernel/sched/clock.c), then also remove the extern in include/linux/timekeeping.h (so there's one consistent method to access it)? I know it's a sort of scope creep, so apologies for asking, but it would make the series more attractive if it's not leaving something for others to clean up later. thanks -john
Thanks for the suggestion. That makes sense. I'll look into that for the next version. --Will On Wed, Sep 29, 2021 at 1:46 PM John Stultz <john.stultz@linaro.org> wrote: > > On Wed, Sep 29, 2021 at 1:01 PM Will McVicker <willmcvicker@google.com> wrote: > > On Tue, Sep 28, 2021 at 8:42 PM John Stultz <john.stultz@linaro.org> wrote: > > > On Tue, Sep 28, 2021 at 4:56 PM Will McVicker <willmcvicker@google.com> wrote: > > > > > > > > This allows modules to access the value of timekeeping_suspended without > > > > giving them write access to the variable. > > > > > > > > > > It's important to cover "the why" not "the what" in these commit > > > messages, so you might add a note as to what code will be the user of > > > this (the samsung/clk-pll.c code changed later in this series). > > > > > > thanks > > > -john > > > > Thanks John for the tip. I will try to be better at that in the followup. > > I have to remind myself regularly as well. :) Apologies if my quick > reply above seemed curt (as it does to me re-reading it now). Wasn't > my intent. > > > For this specific patch, I am adding this new API because the Samsung > > PLL driver (drivers/clk/samsung/clk-pll.c) currently is using the > > variable 'timekeeping_suspended' to detect timeouts before the > > clocksource is initialized or timekeeping itself is suspended. My > > patch series aims to modularize the Samsung PLL driver. So to keep the > > driver's functionality intact, I need to add this additional API. > > Sounds good! > > Another small/medium suggestion: Since you're adding a new interface > for non-core users of timekeeping_suspended, it might be good to > switch the other users as well (seems like just > drivers/clk/ti/clkctrl.c and kernel/sched/clock.c), then also remove > the extern in include/linux/timekeeping.h (so there's one consistent > method to access it)? I know it's a sort of scope creep, so apologies > for asking, but it would make the series more attractive if it's not > leaving something for others to clean up later. > > thanks > -john
diff --git a/include/linux/timekeeping.h b/include/linux/timekeeping.h index 78a98bdff76d..cdc84421d77b 100644 --- a/include/linux/timekeeping.h +++ b/include/linux/timekeeping.h @@ -8,6 +8,7 @@ /* Included from linux/ktime.h */ void timekeeping_init(void); +extern bool timekeeping_is_suspended(void); extern int timekeeping_suspended; /* Architecture timer tick functions: */ diff --git a/kernel/time/timekeeping.c b/kernel/time/timekeeping.c index b348749a9fc6..27873c052e57 100644 --- a/kernel/time/timekeeping.c +++ b/kernel/time/timekeeping.c @@ -57,6 +57,17 @@ static struct timekeeper shadow_timekeeper; /* flag for if timekeeping is suspended */ int __read_mostly timekeeping_suspended; +/** + * timekeeping_is_suspended - query for timekeeping_suspended + * + * Returns the true/false based on the value of timekeeping_suspened. + */ +bool timekeeping_is_suspended(void) +{ + return timekeeping_suspended ? true : false; +} +EXPORT_SYMBOL_GPL(timekeeping_is_suspended); + /** * struct tk_fast - NMI safe timekeeper * @seq: Sequence counter for protecting updates. The lowest bit
This allows modules to access the value of timekeeping_suspended without giving them write access to the variable. Signed-off-by: Will McVicker <willmcvicker@google.com> --- include/linux/timekeeping.h | 1 + kernel/time/timekeeping.c | 11 +++++++++++ 2 files changed, 12 insertions(+)