[02/10] cpufreq: Re-arrange declarations in cpufreq.h

Message ID CAKohpomVKac+1c7rNseUKM_RCVaNiFsaioJuW98oLJP5atSaSg@mail.gmail.com
State New
Headers show

Commit Message

Viresh Kumar Aug. 3, 2013, 5:13 p.m.
On 3 August 2013 17:19, Viresh Kumar <viresh.kumar@linaro.org> wrote:
> They are pretty much mixed up. Although generic headers are present but
> definitions/declarations are present outside them too..
>
> This patch just moves stuff up and down to make it look better and consistent.
>
> Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
> ---
>  include/linux/cpufreq.h | 370 +++++++++++++++++++++++-------------------------
>  1 file changed, 177 insertions(+), 193 deletions(-)

Fixup due to compilation reported by Fengguang's kbuild system:
[Will post the series again once I receive more comments on it]

  * safe)
@@ -282,32 +295,16 @@ static inline unsigned long
cpufreq_scale(unsigned long old, u_int div,
                u_int mult)
 {
 #if BITS_PER_LONG == 32
-
        u64 result = ((u64) old) * ((u64) mult);
        do_div(result, div);
        return (unsigned long) result;

 #elif BITS_PER_LONG == 64
-
        unsigned long result = old * ((u64) mult);
        result /= div;
        return result;
-
 #endif
-};
-
-#else /* CONFIG_CPU_FREQ */
-static inline int cpufreq_register_notifier(struct notifier_block *nb,
-                                               unsigned int list)
-{
-       return 0;
 }
-static inline int cpufreq_unregister_notifier(struct notifier_block *nb,
-                                               unsigned int list)
-{
-       return 0;
-}
-#endif /* !CONFIG_CPU_FREQ */

 /*********************************************************************
  *                          CPUFREQ GOVERNORS                        *

Comments

Rafael J. Wysocki Aug. 3, 2013, 9:43 p.m. | #1
On Saturday, August 03, 2013 10:43:45 PM Viresh Kumar wrote:
> On 3 August 2013 17:19, Viresh Kumar <viresh.kumar@linaro.org> wrote:
> > They are pretty much mixed up. Although generic headers are present but
> > definitions/declarations are present outside them too..
> >
> > This patch just moves stuff up and down to make it look better and consistent.
> >
> > Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
> > ---
> >  include/linux/cpufreq.h | 370 +++++++++++++++++++++++-------------------------
> >  1 file changed, 177 insertions(+), 193 deletions(-)
> 
> Fixup due to compilation reported by Fengguang's kbuild system:
> [Will post the series again once I receive more comments on it]

OK, thanks.  I'm waiting for the update of the whole series, then.

> diff --git a/include/linux/cpufreq.h b/include/linux/cpufreq.h
> index a6b97e2..d568f39 100644
> --- a/include/linux/cpufreq.h
> +++ b/include/linux/cpufreq.h
> @@ -268,6 +268,19 @@ int cpufreq_unregister_notifier(struct
> notifier_block *nb, unsigned int list);
>  void cpufreq_notify_transition(struct cpufreq_policy *policy,
>                 struct cpufreq_freqs *freqs, unsigned int state);
> 
> +#else /* CONFIG_CPU_FREQ */
> +static inline int cpufreq_register_notifier(struct notifier_block *nb,
> +                                               unsigned int list)
> +{
> +       return 0;
> +}
> +static inline int cpufreq_unregister_notifier(struct notifier_block *nb,
> +                                               unsigned int list)
> +{
> +       return 0;
> +}
> +#endif /* !CONFIG_CPU_FREQ */
> +
>  /**
>   * cpufreq_scale - "old * mult / div" calculation for large values (32-bit-arch
>   * safe)
> @@ -282,32 +295,16 @@ static inline unsigned long
> cpufreq_scale(unsigned long old, u_int div,
>                 u_int mult)
>  {
>  #if BITS_PER_LONG == 32
> -
>         u64 result = ((u64) old) * ((u64) mult);
>         do_div(result, div);
>         return (unsigned long) result;
> 
>  #elif BITS_PER_LONG == 64
> -
>         unsigned long result = old * ((u64) mult);
>         result /= div;
>         return result;
> -
>  #endif
> -};
> -
> -#else /* CONFIG_CPU_FREQ */
> -static inline int cpufreq_register_notifier(struct notifier_block *nb,
> -                                               unsigned int list)
> -{
> -       return 0;
>  }
> -static inline int cpufreq_unregister_notifier(struct notifier_block *nb,
> -                                               unsigned int list)
> -{
> -       return 0;
> -}
> -#endif /* !CONFIG_CPU_FREQ */
> 
>  /*********************************************************************
>   *                          CPUFREQ GOVERNORS                        *

Patch

diff --git a/include/linux/cpufreq.h b/include/linux/cpufreq.h
index a6b97e2..d568f39 100644
--- a/include/linux/cpufreq.h
+++ b/include/linux/cpufreq.h
@@ -268,6 +268,19 @@  int cpufreq_unregister_notifier(struct
notifier_block *nb, unsigned int list);
 void cpufreq_notify_transition(struct cpufreq_policy *policy,
                struct cpufreq_freqs *freqs, unsigned int state);

+#else /* CONFIG_CPU_FREQ */
+static inline int cpufreq_register_notifier(struct notifier_block *nb,
+                                               unsigned int list)
+{
+       return 0;
+}
+static inline int cpufreq_unregister_notifier(struct notifier_block *nb,
+                                               unsigned int list)
+{
+       return 0;
+}
+#endif /* !CONFIG_CPU_FREQ */
+
 /**
  * cpufreq_scale - "old * mult / div" calculation for large values (32-bit-arch