Re: [PATCH 1/8] RISC-V: Provide a cleaner raw_smp_processor_id()
From: Christoph Hellwig
Date: Thu Aug 30 2018 - 10:37:46 EST
On Mon, Aug 27, 2018 at 11:42:36AM -0700, Palmer Dabbelt wrote:
> +/* Obtains the hart ID of the currently executing task. This relies on
> + * THREAD_INFO_IN_TASK, but we define that unconditionally. */
Kernel comment style would be:
/*
* Obtains the hart ID of the currently executing task. This relies on
* THREAD_INFO_IN_TASK, but we define that unconditionally.
*/
> +#ifdef CONFIG_THREAD_INFO_IN_TASK
THREAD_INFO_IN_TASK is always defined for riscv, so no need for this
ifdef.
> +#define get_ti() ((struct thread_info *)get_current())
> +#define raw_smp_processor_id() (get_ti()->cpu)
Please don't cast structs around. This should be something like
#define raw_smp_processor_id() \
(container_of(get_current(), struct task_struct, thread_info)->cpu)