Re: [RFC PATCH v3 02/10] irq_work: Split type definition to its own header

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

 



On Thu, Jul 11, 2024 at 02:59:56PM +0200, Valentin Schneider wrote:
> A later commit will add a struct irq_work member to struct task_struct, which
> would require <linux/sched.h> to include the definition of struct
> irq_work.
> 
> Thanks to header dependency hell, incudling <linux/irq_work.h> in <linux/sched.h>
> results in defining inline helpers using not-yet-defined fields (mm_struct,
> task_struct, various task states...).
> 
> Break off the definition of struct irq_work into its own header file.
> 
> Signed-off-by: Valentin Schneider <vschneid@xxxxxxxxxx>
> ---
>  include/linux/irq_work.h       |  8 ++------
>  include/linux/irq_work_types.h | 14 ++++++++++++++
>  2 files changed, 16 insertions(+), 6 deletions(-)
>  create mode 100644 include/linux/irq_work_types.h
> 
> diff --git a/include/linux/irq_work.h b/include/linux/irq_work.h
> index 136f2980cba30..7f6d2af360d91 100644
> --- a/include/linux/irq_work.h
> +++ b/include/linux/irq_work.h
> @@ -5,6 +5,8 @@
>  #include <linux/smp_types.h>
>  #include <linux/rcuwait.h>
>  
> +#include <linux/irq_work_types.h>
> +
>  /*
>   * An entry can be in one of four states:
>   *
> @@ -14,12 +16,6 @@
>   * busy      NULL, 2 -> {free, claimed} : callback in progress, can be claimed
>   */
>  
> -struct irq_work {
> -	struct __call_single_node node;
> -	void (*func)(struct irq_work *);
> -	struct rcuwait irqwait;
> -};
> -
>  #define __IRQ_WORK_INIT(_func, _flags) (struct irq_work){	\
>  	.node = { .u_flags = (_flags), },			\
>  	.func = (_func),					\
> diff --git a/include/linux/irq_work_types.h b/include/linux/irq_work_types.h
> new file mode 100644
> index 0000000000000..108cbc514733b
> --- /dev/null
> +++ b/include/linux/irq_work_types.h
> @@ -0,0 +1,14 @@
> +/* SPDX-License-Identifier: GPL-2.0 */
> +#ifndef _LINUX_IRQ_WORK_TYPES_H
> +#define _LINUX_IRQ_WORK_TYPES_H
> +
> +#include <linux/smp_types.h>
> +#include <linux/rcuwait_types.h>
> +
> +struct irq_work {
> +	struct __call_single_node node;
> +	void (*func)(struct irq_work *);
> +	struct rcuwait irqwait;
> +};
> +
> +#endif

Since smp_types.h already mentions IRQ_WORK, given how I tangled the
whole things together, should we just put this struct there as well?




[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux