Re: [PATCH V2] LoongArch: Provide kernel fpu functions
From: Randy Dunlap
Date: Sun Mar 05 2023 - 22:15:52 EST
Hi,
On 3/5/23 19:12, Huacai Chen wrote:
> +void kernel_fpu_begin(void)
> +{
> + if(this_cpu_read(in_kernel_fpu))
if (
> + return;
> +
> + preempt_disable();
> + this_cpu_write(in_kernel_fpu, true);
> +
> + if (!is_fpu_owner())
> + enable_fpu();
> + else
> + _save_fp(¤t->thread.fpu);
> +}
> +EXPORT_SYMBOL(kernel_fpu_begin);
> +
> +void kernel_fpu_end(void)
> +{
> + if(!this_cpu_read(in_kernel_fpu))
if (
i.e., add a space after "if".
> + return;
> +
> + if (!is_fpu_owner())
> + disable_fpu();
> + else
> + _restore_fp(¤t->thread.fpu);
> +
> + this_cpu_write(in_kernel_fpu, false);
> + preempt_enable();
> +}
> +EXPORT_SYMBOL(kernel_fpu_end);
--
~Randy