Skip to contentSkip to conversation

irq: make kobj_type structures constant

PATCH Applied Thomas Weißschuh 2 participants 2 messages Feb 17, 2023 – Feb 21, 2023 IRQ

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 irq: make kobj_type structures constant

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 definitions to prevent modification at runtime.

---
 kernel/irq/irqdesc.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
kernel/irq/irqdesc.c +2 -2
index fd0996274401..240e145e969f 100644
@@ -277,7 +277,7 @@ static struct attribute *irq_attrs[] = {
 };
 ATTRIBUTE_GROUPS(irq);
 
-static struct kobj_type irq_kobj_type = {
+static const struct kobj_type irq_kobj_type = {
 	.release	= irq_kobj_release,
 	.sysfs_ops	= &kobj_sysfs_ops,
 	.default_groups = irq_groups,
@@ -335,7 +335,7 @@ postcore_initcall(irq_sysfs_init);
 
 #else /* !CONFIG_SYSFS */
 
-static struct kobj_type irq_kobj_type = {
+static const struct kobj_type irq_kobj_type = {
 	.release	= irq_kobj_release,
 };
 

---
base-commit: 3ac88fa4605ec98e545fb3ad0154f575fda2de5f
change-id: 20230217-kobj_type-irq-ea87ec34b6e1

Best regards,

Signature · 1 line
Thomas Weißschuh <[email protected]>
#1 lore raw

[tip: irq/urgent] genirq/irqdesc: Make kobj_type structures constant

The following commit has been merged into the irq/urgent branch of tip:

The following commit has been merged into the irq/urgent branch of tip:

Commit-ID:     ce7980ae9080f72f08d50355c4d9084d57aece63
Gitweb:        https://git.kernel.org/tip/ce7980ae9080f72f08d50355c4d9084d57aece63
Author:        Thomas Weißschuh <[email protected]>
AuthorDate:    Fri, 17 Feb 2023 03:16:25 
Committer:     Thomas Gleixner <[email protected]>
CommitterDate: Tue, 21 Feb 2023 15:00:09 +01:00

genirq/irqdesc: Make kobj_type structures constant

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 definitions which prevents modification at runtime.

---
 kernel/irq/irqdesc.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
kernel/irq/irqdesc.c +2 -2
index fd09962..240e145 100644
@@ -277,7 +277,7 @@ static struct attribute *irq_attrs[] = {
 };
 ATTRIBUTE_GROUPS(irq);
 
-static struct kobj_type irq_kobj_type = {
+static const struct kobj_type irq_kobj_type = {
 	.release	= irq_kobj_release,
 	.sysfs_ops	= &kobj_sysfs_ops,
 	.default_groups = irq_groups,
@@ -335,7 +335,7 @@ postcore_initcall(irq_sysfs_init);
 
 #else /* !CONFIG_SYSFS */
 
-static struct kobj_type irq_kobj_type = {
+static const struct kobj_type irq_kobj_type = {
 	.release	= irq_kobj_release,
 };