Re: [PATCH 03/12] clocksource: Remove clocksource_max_deferment()

2015-03-07 Thread Ingo Molnar

* John Stultz  wrote:

> clocksource_max_deferment() doesn't do anything useful
> anymore, so zap it.

Well, it does something useful, it encapsulates the max_deferment 
property of the clocksource:

> -static u64 clocksource_max_deferment(struct clocksource *cs)
> -{
> - u64 max_nsecs;
> -
> - max_nsecs = clocks_calc_max_nsecs(cs->mult, cs->shift, cs->maxadj,
> -   cs->mask);
> - return max_nsecs;
> -}

Which could be written in a shorter form, using:

static u64 clocksource_max_deferment(struct clocksource *cs)
{
return clocks_calc_max_nsecs(cs->mult, cs->shift, cs->maxadj, cs->mask);
}

Which all allows short forms of:

cs->max_idle_ns = clocksource_max_deferment(cs);

without writing out all the arguments.

Instead of that, you've introduced:

> + cs->max_idle_ns = clocks_calc_max_nsecs(cs->mult, cs->shift,
> +  cs->maxadj, cs->mask);

> + cs->max_idle_ns = clocks_calc_max_nsecs(cs->mult, cs->shift,
> +  cs->maxadj, cs->mask);

Which in the next patch gets even worse:


>   cs->max_idle_ns = clocks_calc_max_nsecs(cs->mult, cs->shift,
> +  cs->maxadj, cs->mask,
> +  >max_cycles);

>   /* calculate max idle time permitted for this clocksource */
>   cs->max_idle_ns = clocks_calc_max_nsecs(cs->mult, cs->shift,
> +  cs->maxadj, cs->mask,
> +  >max_cycles);

While with the helper function it would still be the same sweet:

cs->max_idle_ns = clocksource_max_deferment(cs);

So I don't think this cleanup is an improvement ...

Thanks,

Ingo
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 03/12] clocksource: Remove clocksource_max_deferment()

2015-03-07 Thread Ingo Molnar

* John Stultz john.stu...@linaro.org wrote:

 clocksource_max_deferment() doesn't do anything useful
 anymore, so zap it.

Well, it does something useful, it encapsulates the max_deferment 
property of the clocksource:

 -static u64 clocksource_max_deferment(struct clocksource *cs)
 -{
 - u64 max_nsecs;
 -
 - max_nsecs = clocks_calc_max_nsecs(cs-mult, cs-shift, cs-maxadj,
 -   cs-mask);
 - return max_nsecs;
 -}

Which could be written in a shorter form, using:

static u64 clocksource_max_deferment(struct clocksource *cs)
{
return clocks_calc_max_nsecs(cs-mult, cs-shift, cs-maxadj, cs-mask);
}

Which all allows short forms of:

cs-max_idle_ns = clocksource_max_deferment(cs);

without writing out all the arguments.

Instead of that, you've introduced:

 + cs-max_idle_ns = clocks_calc_max_nsecs(cs-mult, cs-shift,
 +  cs-maxadj, cs-mask);

 + cs-max_idle_ns = clocks_calc_max_nsecs(cs-mult, cs-shift,
 +  cs-maxadj, cs-mask);

Which in the next patch gets even worse:


   cs-max_idle_ns = clocks_calc_max_nsecs(cs-mult, cs-shift,
 +  cs-maxadj, cs-mask,
 +  cs-max_cycles);

   /* calculate max idle time permitted for this clocksource */
   cs-max_idle_ns = clocks_calc_max_nsecs(cs-mult, cs-shift,
 +  cs-maxadj, cs-mask,
 +  cs-max_cycles);

While with the helper function it would still be the same sweet:

cs-max_idle_ns = clocksource_max_deferment(cs);

So I don't think this cleanup is an improvement ...

Thanks,

Ingo
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 03/12] clocksource: Remove clocksource_max_deferment()

2015-03-06 Thread John Stultz
clocksource_max_deferment() doesn't do anything useful
anymore, so zap it.

Cc: Dave Jones 
Cc: Linus Torvalds 
Cc: Thomas Gleixner 
Cc: Richard Cochran 
Cc: Prarit Bhargava 
Cc: Stephen Boyd 
Cc: Ingo Molnar 
Cc: Peter Zijlstra 
Signed-off-by: John Stultz 
---
 kernel/time/clocksource.c | 20 
 1 file changed, 4 insertions(+), 16 deletions(-)

diff --git a/kernel/time/clocksource.c b/kernel/time/clocksource.c
index e5d00e6..4988411 100644
--- a/kernel/time/clocksource.c
+++ b/kernel/time/clocksource.c
@@ -499,20 +499,6 @@ u64 clocks_calc_max_nsecs(u32 mult, u32 shift, u32 maxadj, 
u64 mask)
return max_nsecs;
 }
 
-/**
- * clocksource_max_deferment - Returns max time the clocksource should be 
deferred
- * @cs: Pointer to clocksource
- *
- */
-static u64 clocksource_max_deferment(struct clocksource *cs)
-{
-   u64 max_nsecs;
-
-   max_nsecs = clocks_calc_max_nsecs(cs->mult, cs->shift, cs->maxadj,
- cs->mask);
-   return max_nsecs;
-}
-
 #ifndef CONFIG_ARCH_USES_GETTIMEOFFSET
 
 static struct clocksource *clocksource_find_best(bool oneshot, bool skipcur)
@@ -684,7 +670,8 @@ void __clocksource_updatefreq_scale(struct clocksource *cs, 
u32 scale, u32 freq)
cs->maxadj = clocksource_max_adjustment(cs);
}
 
-   cs->max_idle_ns = clocksource_max_deferment(cs);
+   cs->max_idle_ns = clocks_calc_max_nsecs(cs->mult, cs->shift,
+cs->maxadj, cs->mask);
 }
 EXPORT_SYMBOL_GPL(__clocksource_updatefreq_scale);
 
@@ -731,7 +718,8 @@ int clocksource_register(struct clocksource *cs)
cs->name);
 
/* calculate max idle time permitted for this clocksource */
-   cs->max_idle_ns = clocksource_max_deferment(cs);
+   cs->max_idle_ns = clocks_calc_max_nsecs(cs->mult, cs->shift,
+cs->maxadj, cs->mask);
 
mutex_lock(_mutex);
clocksource_enqueue(cs);
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 03/12] clocksource: Remove clocksource_max_deferment()

2015-03-06 Thread John Stultz
clocksource_max_deferment() doesn't do anything useful
anymore, so zap it.

Cc: Dave Jones da...@codemonkey.org.uk
Cc: Linus Torvalds torva...@linux-foundation.org
Cc: Thomas Gleixner t...@linutronix.de
Cc: Richard Cochran richardcoch...@gmail.com
Cc: Prarit Bhargava pra...@redhat.com
Cc: Stephen Boyd sb...@codeaurora.org
Cc: Ingo Molnar mi...@kernel.org
Cc: Peter Zijlstra pet...@infradead.org
Signed-off-by: John Stultz john.stu...@linaro.org
---
 kernel/time/clocksource.c | 20 
 1 file changed, 4 insertions(+), 16 deletions(-)

diff --git a/kernel/time/clocksource.c b/kernel/time/clocksource.c
index e5d00e6..4988411 100644
--- a/kernel/time/clocksource.c
+++ b/kernel/time/clocksource.c
@@ -499,20 +499,6 @@ u64 clocks_calc_max_nsecs(u32 mult, u32 shift, u32 maxadj, 
u64 mask)
return max_nsecs;
 }
 
-/**
- * clocksource_max_deferment - Returns max time the clocksource should be 
deferred
- * @cs: Pointer to clocksource
- *
- */
-static u64 clocksource_max_deferment(struct clocksource *cs)
-{
-   u64 max_nsecs;
-
-   max_nsecs = clocks_calc_max_nsecs(cs-mult, cs-shift, cs-maxadj,
- cs-mask);
-   return max_nsecs;
-}
-
 #ifndef CONFIG_ARCH_USES_GETTIMEOFFSET
 
 static struct clocksource *clocksource_find_best(bool oneshot, bool skipcur)
@@ -684,7 +670,8 @@ void __clocksource_updatefreq_scale(struct clocksource *cs, 
u32 scale, u32 freq)
cs-maxadj = clocksource_max_adjustment(cs);
}
 
-   cs-max_idle_ns = clocksource_max_deferment(cs);
+   cs-max_idle_ns = clocks_calc_max_nsecs(cs-mult, cs-shift,
+cs-maxadj, cs-mask);
 }
 EXPORT_SYMBOL_GPL(__clocksource_updatefreq_scale);
 
@@ -731,7 +718,8 @@ int clocksource_register(struct clocksource *cs)
cs-name);
 
/* calculate max idle time permitted for this clocksource */
-   cs-max_idle_ns = clocksource_max_deferment(cs);
+   cs-max_idle_ns = clocks_calc_max_nsecs(cs-mult, cs-shift,
+cs-maxadj, cs-mask);
 
mutex_lock(clocksource_mutex);
clocksource_enqueue(cs);
-- 
1.9.1

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 03/12] clocksource: Remove clocksource_max_deferment()

2015-01-22 Thread John Stultz
clocksource_max_deferment() doesn't do anything useful
anymore, so zap it.

Cc: Dave Jones 
Cc: Linus Torvalds 
Cc: Thomas Gleixner 
Cc: Richard Cochran 
Cc: Prarit Bhargava 
Cc: Stephen Boyd 
Cc: Ingo Molnar 
Cc: Peter Zijlstra 
Signed-off-by: John Stultz 
---
 kernel/time/clocksource.c | 20 
 1 file changed, 4 insertions(+), 16 deletions(-)

diff --git a/kernel/time/clocksource.c b/kernel/time/clocksource.c
index e837ffd1..0696559 100644
--- a/kernel/time/clocksource.c
+++ b/kernel/time/clocksource.c
@@ -575,20 +575,6 @@ u64 clocks_calc_max_nsecs(u32 mult, u32 shift, u32 maxadj, 
u64 mask)
return max_nsecs;
 }
 
-/**
- * clocksource_max_deferment - Returns max time the clocksource should be 
deferred
- * @cs: Pointer to clocksource
- *
- */
-static u64 clocksource_max_deferment(struct clocksource *cs)
-{
-   u64 max_nsecs;
-
-   max_nsecs = clocks_calc_max_nsecs(cs->mult, cs->shift, cs->maxadj,
- cs->mask);
-   return max_nsecs;
-}
-
 #ifndef CONFIG_ARCH_USES_GETTIMEOFFSET
 
 static struct clocksource *clocksource_find_best(bool oneshot, bool skipcur)
@@ -760,7 +746,8 @@ void __clocksource_updatefreq_scale(struct clocksource *cs, 
u32 scale, u32 freq)
cs->maxadj = clocksource_max_adjustment(cs);
}
 
-   cs->max_idle_ns = clocksource_max_deferment(cs);
+   cs->max_idle_ns = clocks_calc_max_nsecs(cs->mult, cs->shift,
+cs->maxadj, cs->mask);
 }
 EXPORT_SYMBOL_GPL(__clocksource_updatefreq_scale);
 
@@ -807,7 +794,8 @@ int clocksource_register(struct clocksource *cs)
cs->name);
 
/* calculate max idle time permitted for this clocksource */
-   cs->max_idle_ns = clocksource_max_deferment(cs);
+   cs->max_idle_ns = clocks_calc_max_nsecs(cs->mult, cs->shift,
+cs->maxadj, cs->mask);
 
mutex_lock(_mutex);
clocksource_enqueue(cs);
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 03/12] clocksource: Remove clocksource_max_deferment()

2015-01-22 Thread John Stultz
clocksource_max_deferment() doesn't do anything useful
anymore, so zap it.

Cc: Dave Jones da...@codemonkey.org.uk
Cc: Linus Torvalds torva...@linux-foundation.org
Cc: Thomas Gleixner t...@linutronix.de
Cc: Richard Cochran richardcoch...@gmail.com
Cc: Prarit Bhargava pra...@redhat.com
Cc: Stephen Boyd sb...@codeaurora.org
Cc: Ingo Molnar mi...@kernel.org
Cc: Peter Zijlstra pet...@infradead.org
Signed-off-by: John Stultz john.stu...@linaro.org
---
 kernel/time/clocksource.c | 20 
 1 file changed, 4 insertions(+), 16 deletions(-)

diff --git a/kernel/time/clocksource.c b/kernel/time/clocksource.c
index e837ffd1..0696559 100644
--- a/kernel/time/clocksource.c
+++ b/kernel/time/clocksource.c
@@ -575,20 +575,6 @@ u64 clocks_calc_max_nsecs(u32 mult, u32 shift, u32 maxadj, 
u64 mask)
return max_nsecs;
 }
 
-/**
- * clocksource_max_deferment - Returns max time the clocksource should be 
deferred
- * @cs: Pointer to clocksource
- *
- */
-static u64 clocksource_max_deferment(struct clocksource *cs)
-{
-   u64 max_nsecs;
-
-   max_nsecs = clocks_calc_max_nsecs(cs-mult, cs-shift, cs-maxadj,
- cs-mask);
-   return max_nsecs;
-}
-
 #ifndef CONFIG_ARCH_USES_GETTIMEOFFSET
 
 static struct clocksource *clocksource_find_best(bool oneshot, bool skipcur)
@@ -760,7 +746,8 @@ void __clocksource_updatefreq_scale(struct clocksource *cs, 
u32 scale, u32 freq)
cs-maxadj = clocksource_max_adjustment(cs);
}
 
-   cs-max_idle_ns = clocksource_max_deferment(cs);
+   cs-max_idle_ns = clocks_calc_max_nsecs(cs-mult, cs-shift,
+cs-maxadj, cs-mask);
 }
 EXPORT_SYMBOL_GPL(__clocksource_updatefreq_scale);
 
@@ -807,7 +794,8 @@ int clocksource_register(struct clocksource *cs)
cs-name);
 
/* calculate max idle time permitted for this clocksource */
-   cs-max_idle_ns = clocksource_max_deferment(cs);
+   cs-max_idle_ns = clocks_calc_max_nsecs(cs-mult, cs-shift,
+cs-maxadj, cs-mask);
 
mutex_lock(clocksource_mutex);
clocksource_enqueue(cs);
-- 
1.9.1

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/