diff mbox series

[3/4] mm/doc: Turn fault flags into an enum

Message ID 20210322195022.2143603-3-willy@infradead.org (mailing list archive)
State New, archived
Headers show
Series [1/4] mm/doc: Fix fault_flag_allow_retry_first kerneldoc | expand

Commit Message

Matthew Wilcox March 22, 2021, 7:50 p.m. UTC
The kernel-doc script complains about
./include/linux/mm.h:425: warning: wrong kernel-doc identifier on line:
 * Fault flag definitions.

I don't know how to document a series of #defines, so turn these
definitions into an enum and document that instead.

Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
---
 include/linux/mm.h | 29 +++++++++++++++--------------
 1 file changed, 15 insertions(+), 14 deletions(-)

Comments

Mike Rapoport March 23, 2021, 7:28 a.m. UTC | #1
On Mon, Mar 22, 2021 at 07:50:21PM +0000, Matthew Wilcox (Oracle) wrote:
> The kernel-doc script complains about
> ./include/linux/mm.h:425: warning: wrong kernel-doc identifier on line:
>  * Fault flag definitions.
> 
> I don't know how to document a series of #defines, so turn these
> definitions into an enum and document that instead.
> 
> Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>

Acked-by: Mike Rapoport <rppt@linux.ibm.com>

> ---
>  include/linux/mm.h | 29 +++++++++++++++--------------
>  1 file changed, 15 insertions(+), 14 deletions(-)
> 
> diff --git a/include/linux/mm.h b/include/linux/mm.h
> index 96e5ceffce09..58df4027dd4d 100644
> --- a/include/linux/mm.h
> +++ b/include/linux/mm.h
> @@ -429,8 +429,7 @@ extern unsigned int kobjsize(const void *objp);
>  extern pgprot_t protection_map[16];
>  
>  /**
> - * Fault flag definitions.
> - *
> + * enum fault_flag - Fault flag definitions.
>   * @FAULT_FLAG_WRITE: Fault was a write fault.
>   * @FAULT_FLAG_MKWRITE: Fault was mkwrite of existing PTE.
>   * @FAULT_FLAG_ALLOW_RETRY: Allow to retry the fault if blocked.
> @@ -461,16 +460,18 @@ extern pgprot_t protection_map[16];
>   * signals before a retry to make sure the continuous page faults can still be
>   * interrupted if necessary.
>   */
> -#define FAULT_FLAG_WRITE			0x01
> -#define FAULT_FLAG_MKWRITE			0x02
> -#define FAULT_FLAG_ALLOW_RETRY			0x04
> -#define FAULT_FLAG_RETRY_NOWAIT			0x08
> -#define FAULT_FLAG_KILLABLE			0x10
> -#define FAULT_FLAG_TRIED			0x20
> -#define FAULT_FLAG_USER				0x40
> -#define FAULT_FLAG_REMOTE			0x80
> -#define FAULT_FLAG_INSTRUCTION  		0x100
> -#define FAULT_FLAG_INTERRUPTIBLE		0x200
> +enum fault_flag {
> +	FAULT_FLAG_WRITE =		1 << 0,
> +	FAULT_FLAG_MKWRITE =		1 << 1,
> +	FAULT_FLAG_ALLOW_RETRY =	1 << 2,
> +	FAULT_FLAG_RETRY_NOWAIT = 	1 << 3,
> +	FAULT_FLAG_KILLABLE =		1 << 4,
> +	FAULT_FLAG_TRIED = 		1 << 5,
> +	FAULT_FLAG_USER =		1 << 6,
> +	FAULT_FLAG_REMOTE =		1 << 7,
> +	FAULT_FLAG_INSTRUCTION =	1 << 8,
> +	FAULT_FLAG_INTERRUPTIBLE =	1 << 9,
> +};
>  
>  /*
>   * The default fault flags that should be used by most of the
> @@ -493,7 +494,7 @@ extern pgprot_t protection_map[16];
>   * Return: true if the page fault allows retry and this is the first
>   * attempt of the fault handling; false otherwise.
>   */
> -static inline bool fault_flag_allow_retry_first(unsigned int flags)
> +static inline bool fault_flag_allow_retry_first(enum fault_flag flags)
>  {
>  	return (flags & FAULT_FLAG_ALLOW_RETRY) &&
>  	    (!(flags & FAULT_FLAG_TRIED));
> @@ -528,7 +529,7 @@ struct vm_fault {
>  		pgoff_t pgoff;			/* Logical page offset based on vma */
>  		unsigned long address;		/* Faulting virtual address */
>  	};
> -	unsigned int flags;		/* FAULT_FLAG_xxx flags
> +	enum fault_flag flags;		/* FAULT_FLAG_xxx flags
>  					 * XXX: should really be 'const' */
>  	pmd_t *pmd;			/* Pointer to pmd entry matching
>  					 * the 'address' */
> -- 
> 2.30.2
>
diff mbox series

Patch

diff --git a/include/linux/mm.h b/include/linux/mm.h
index 96e5ceffce09..58df4027dd4d 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -429,8 +429,7 @@  extern unsigned int kobjsize(const void *objp);
 extern pgprot_t protection_map[16];
 
 /**
- * Fault flag definitions.
- *
+ * enum fault_flag - Fault flag definitions.
  * @FAULT_FLAG_WRITE: Fault was a write fault.
  * @FAULT_FLAG_MKWRITE: Fault was mkwrite of existing PTE.
  * @FAULT_FLAG_ALLOW_RETRY: Allow to retry the fault if blocked.
@@ -461,16 +460,18 @@  extern pgprot_t protection_map[16];
  * signals before a retry to make sure the continuous page faults can still be
  * interrupted if necessary.
  */
-#define FAULT_FLAG_WRITE			0x01
-#define FAULT_FLAG_MKWRITE			0x02
-#define FAULT_FLAG_ALLOW_RETRY			0x04
-#define FAULT_FLAG_RETRY_NOWAIT			0x08
-#define FAULT_FLAG_KILLABLE			0x10
-#define FAULT_FLAG_TRIED			0x20
-#define FAULT_FLAG_USER				0x40
-#define FAULT_FLAG_REMOTE			0x80
-#define FAULT_FLAG_INSTRUCTION  		0x100
-#define FAULT_FLAG_INTERRUPTIBLE		0x200
+enum fault_flag {
+	FAULT_FLAG_WRITE =		1 << 0,
+	FAULT_FLAG_MKWRITE =		1 << 1,
+	FAULT_FLAG_ALLOW_RETRY =	1 << 2,
+	FAULT_FLAG_RETRY_NOWAIT = 	1 << 3,
+	FAULT_FLAG_KILLABLE =		1 << 4,
+	FAULT_FLAG_TRIED = 		1 << 5,
+	FAULT_FLAG_USER =		1 << 6,
+	FAULT_FLAG_REMOTE =		1 << 7,
+	FAULT_FLAG_INSTRUCTION =	1 << 8,
+	FAULT_FLAG_INTERRUPTIBLE =	1 << 9,
+};
 
 /*
  * The default fault flags that should be used by most of the
@@ -493,7 +494,7 @@  extern pgprot_t protection_map[16];
  * Return: true if the page fault allows retry and this is the first
  * attempt of the fault handling; false otherwise.
  */
-static inline bool fault_flag_allow_retry_first(unsigned int flags)
+static inline bool fault_flag_allow_retry_first(enum fault_flag flags)
 {
 	return (flags & FAULT_FLAG_ALLOW_RETRY) &&
 	    (!(flags & FAULT_FLAG_TRIED));
@@ -528,7 +529,7 @@  struct vm_fault {
 		pgoff_t pgoff;			/* Logical page offset based on vma */
 		unsigned long address;		/* Faulting virtual address */
 	};
-	unsigned int flags;		/* FAULT_FLAG_xxx flags
+	enum fault_flag flags;		/* FAULT_FLAG_xxx flags
 					 * XXX: should really be 'const' */
 	pmd_t *pmd;			/* Pointer to pmd entry matching
 					 * the 'address' */