mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] of: make of_node_ktype constant
@ 2023-02-04  5:47 Thomas Weißschuh
  2023-02-06 16:24 ` Rob Herring
  0 siblings, 1 reply; 2+ messages in thread
From: Thomas Weißschuh @ 2023-02-04  5:47 UTC (permalink / raw)
  To: Rob Herring, Frank Rowand; +Cc: devicetree, linux-kernel, Thomas Weißschuh

Since commit ee6d3dd4ed48 ("driver core: make kobj_type constant.")
the driver core allows the usage of const struct kobj_type.

Take advantage of this to constify the structure definition to prevent
modification at runtime.

Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
---
 drivers/of/kobj.c  | 2 +-
 include/linux/of.h | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/of/kobj.c b/drivers/of/kobj.c
index 7d3853a5a09a..3dbce1e6f184 100644
--- a/drivers/of/kobj.c
+++ b/drivers/of/kobj.c
@@ -24,7 +24,7 @@ static void of_node_release(struct kobject *kobj)
 }
 #endif /* CONFIG_OF_DYNAMIC */
 
-struct kobj_type of_node_ktype = {
+const struct kobj_type of_node_ktype = {
 	.release = of_node_release,
 };
 
diff --git a/include/linux/of.h b/include/linux/of.h
index 8b9f94386dc3..8bb348666709 100644
--- a/include/linux/of.h
+++ b/include/linux/of.h
@@ -101,7 +101,7 @@ struct of_reconfig_data {
 };
 
 /* initialize a node */
-extern struct kobj_type of_node_ktype;
+extern const struct kobj_type of_node_ktype;
 extern const struct fwnode_operations of_fwnode_ops;
 static inline void of_node_init(struct device_node *node)
 {

---
base-commit: 0136d86b78522bbd5755f8194c97a987f0586ba5
change-id: 20230204-kobj_type-of-cc701bdb2730

Best regards,
-- 
Thomas Weißschuh <linux@weissschuh.net>


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] of: make of_node_ktype constant
  2023-02-04  5:47 [PATCH] of: make of_node_ktype constant Thomas Weißschuh
@ 2023-02-06 16:24 ` Rob Herring
  0 siblings, 0 replies; 2+ messages in thread
From: Rob Herring @ 2023-02-06 16:24 UTC (permalink / raw)
  To: Thomas Weißschuh; +Cc: Rob Herring, Frank Rowand, linux-kernel, devicetree


On Sat, 04 Feb 2023 05:47:03 +0000, Thomas Weißschuh wrote:
> Since commit ee6d3dd4ed48 ("driver core: make kobj_type constant.")
> the driver core allows the usage of const struct kobj_type.
> 
> Take advantage of this to constify the structure definition to prevent
> modification at runtime.
> 
> Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
> ---
>  drivers/of/kobj.c  | 2 +-
>  include/linux/of.h | 2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)
> 

Applied, thanks!


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-02-06 16:24 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-02-04  5:47 [PATCH] of: make of_node_ktype constant Thomas Weißschuh
2023-02-06 16:24 ` Rob Herring

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®