lkml.org 
[lkml]   [2018]   [Aug]   [30]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 1/8] RISC-V: Provide a cleaner raw_smp_processor_id()
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)

\
 
 \ /
  Last update: 2018-08-30 20:07    [W:0.634 / U:0.668 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site