of: Use enum instead of macro to define flag
diff mbox series

Message ID 00a5abf82a735ff0de442c28c25a60ff4b408a66.1579603361.git.lijiazi@xiaomi.com
State Changes Requested
Headers show
Series
  • of: Use enum instead of macro to define flag
Related show

Checks

Context Check Description
robh/checkpatch warning "total: 0 errors, 1 warnings, 20 lines checked"

Commit Message

lijiazi Jan. 21, 2020, 11:52 a.m. UTC
Use enum instead of macro to define device node flag.
And it seems that no need start with 1, so let's start with 0.

Suggested-by: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
Signed-off-by: lijiazi <lijiazi@xiaomi.com>
---
 include/linux/of.h | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

Comments

Rob Herring Feb. 3, 2020, 11:53 a.m. UTC | #1
On Tue, Jan 21, 2020 at 07:52:36PM +0800, lijiazi wrote:
> Use enum instead of macro to define device node flag.
> And it seems that no need start with 1, so let's start with 0.

Yes, the diff tells me all this. What's missing is why?

I assume this has something to do with the vsprintf changes? Is this a 
dependency?

On it's own, this seems like needless churn.

> 
> Suggested-by: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
> Signed-off-by: lijiazi <lijiazi@xiaomi.com>

Need a full name here.

> ---
>  include/linux/of.h | 14 ++++++++------
>  1 file changed, 8 insertions(+), 6 deletions(-)
> 
> diff --git a/include/linux/of.h b/include/linux/of.h
> index c669c0a..b90936c0 100644
> --- a/include/linux/of.h
> +++ b/include/linux/of.h
> @@ -140,12 +140,14 @@ extern raw_spinlock_t devtree_lock;
>   * struct device_node flag descriptions
>   * (need to be visible even when !CONFIG_OF)
>   */
> -#define OF_DYNAMIC		1 /* (and properties) allocated via kmalloc */
> -#define OF_DETACHED		2 /* detached from the device tree */
> -#define OF_POPULATED		3 /* device already created */
> -#define OF_POPULATED_BUS	4 /* platform bus created for children */
> -#define OF_OVERLAY		5 /* allocated for an overlay */
> -#define OF_OVERLAY_FREE_CSET	6 /* in overlay cset being freed */
> +enum of_device_node_flag {
> +	OF_DYNAMIC = 0,		/* (and properties) allocated via kmalloc */
> +	OF_DETACHED,		/* detached from the device tree */
> +	OF_POPULATED,		/* device already created */
> +	OF_POPULATED_BUS,	/* platform bus created for children */
> +	OF_OVERLAY,		/* allocated for an overlay */
> +	OF_OVERLAY_FREE_CSET,	/* in overlay cset being freed */
> +};
>  
>  #define OF_BAD_ADDR	((u64)-1)
>  
> -- 
> 2.7.4
>

Patch
diff mbox series

diff --git a/include/linux/of.h b/include/linux/of.h
index c669c0a..b90936c0 100644
--- a/include/linux/of.h
+++ b/include/linux/of.h
@@ -140,12 +140,14 @@  extern raw_spinlock_t devtree_lock;
  * struct device_node flag descriptions
  * (need to be visible even when !CONFIG_OF)
  */
-#define OF_DYNAMIC		1 /* (and properties) allocated via kmalloc */
-#define OF_DETACHED		2 /* detached from the device tree */
-#define OF_POPULATED		3 /* device already created */
-#define OF_POPULATED_BUS	4 /* platform bus created for children */
-#define OF_OVERLAY		5 /* allocated for an overlay */
-#define OF_OVERLAY_FREE_CSET	6 /* in overlay cset being freed */
+enum of_device_node_flag {
+	OF_DYNAMIC = 0,		/* (and properties) allocated via kmalloc */
+	OF_DETACHED,		/* detached from the device tree */
+	OF_POPULATED,		/* device already created */
+	OF_POPULATED_BUS,	/* platform bus created for children */
+	OF_OVERLAY,		/* allocated for an overlay */
+	OF_OVERLAY_FREE_CSET,	/* in overlay cset being freed */
+};
 
 #define OF_BAD_ADDR	((u64)-1)