Re: [PATCH v6 2/2] MIPS: optional floating point support

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Apr 8, 2014 at 12:54 PM, Manuel Lauss <manuel.lauss@xxxxxxxxx> wrote:
> This small patch makes the floating point support and the FPU-emulator
> optional.  A Warning will be printed once when first use of floating
> point is detected.
>
> Disabling fpu support shrinks vmlinux by about 54kBytes (32bit,
> optimizing for size), and it is mainly useful for embedded devices
> which have no need for float math (e.g. routers).
>
> Signed-off-by: Manuel Lauss <manuel.lauss@xxxxxxxxx>
> ---

(snip)

> diff --git a/arch/mips/include/asm/fpu.h b/arch/mips/include/asm/fpu.h
> index 4d86b72..c3d418d 100644
> --- a/arch/mips/include/asm/fpu.h
> +++ b/arch/mips/include/asm/fpu.h
> @@ -154,17 +154,26 @@ static inline void lose_fpu(int save)
>  static inline int init_fpu(void)
>  {
>         int ret = 0;
> +       static int first = 1;

This one could go into the else branch of (IS_ENABLED(CONFIG_MIPS_FPU_SUPPORT)).

>
> -       preempt_disable();
> -       if (cpu_has_fpu) {
> -               ret = __own_fpu();
> -               if (!ret)
> -                       _init_fpu();
> +       if (IS_ENABLED(CONFIG_MIPS_FPU_SUPPORT)) {
> +               preempt_disable();
> +               if (cpu_has_fpu) {
> +                       ret = __own_fpu();
> +                       if (!ret)
> +                               _init_fpu();
> +               } else
> +                       fpu_emulator_init_fpu();

Braces belong on all branches of a conditional, see Chapter 3 of CodingStyle.

> +               preempt_enable();
>         } else {
> -               fpu_emulator_init_fpu();
> +               if (likely(first)) {
> +                       first = 0;
> +                       pr_err("FPU support disabled, but FPU use "
> +                              "detected! Make sure you have a "
> +                              "softfloat userspace!\n");

Don't split strings, it makes it hard to grep for and they have a
special exception to exceed the normal 80 characters per line limit
(Checkpatch does not complain about it). See also Chapter 2 of
CodingStyle.

Apart from that it looks okay to me.


Regards

Jonas


[Index of Archives]     [Linux MIPS Home]     [LKML Archive]     [Linux ARM Kernel]     [Linux ARM]     [Linux]     [Git]     [Yosemite News]     [Linux SCSI]     [Linux Hams]

  Powered by Linux