* [PATCH net-next v2 1/2] net: bridge: make kobj_type structure constant
2023-02-14 4:23 [PATCH net-next v2 0/2] net: make kobj_type structures constant Thomas Weißschuh
@ 2023-02-14 4:23 ` Thomas Weißschuh
2023-02-14 8:40 ` Nikolay Aleksandrov
2023-02-14 4:23 ` [PATCH net-next v2 2/2] net-sysfs: make kobj_type structures constant Thomas Weißschuh
2023-02-15 4:50 ` [PATCH net-next v2 0/2] net: " patchwork-bot+netdevbpf
2 siblings, 1 reply; 5+ messages in thread
From: Thomas Weißschuh @ 2023-02-14 4:23 UTC (permalink / raw)
To: Roopa Prabhu, Nikolay Aleksandrov, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni
Cc: bridge, netdev, 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>
---
net/bridge/br_if.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/bridge/br_if.c b/net/bridge/br_if.c
index ad13b48e3e08..24f01ff113f0 100644
--- a/net/bridge/br_if.c
+++ b/net/bridge/br_if.c
@@ -269,7 +269,7 @@ static void brport_get_ownership(const struct kobject *kobj, kuid_t *uid, kgid_t
net_ns_get_ownership(dev_net(p->dev), uid, gid);
}
-static struct kobj_type brport_ktype = {
+static const struct kobj_type brport_ktype = {
#ifdef CONFIG_SYSFS
.sysfs_ops = &brport_sysfs_ops,
#endif
--
2.39.1
^ permalink raw reply related [flat|nested] 5+ messages in thread* Re: [PATCH net-next v2 1/2] net: bridge: make kobj_type structure constant
2023-02-14 4:23 ` [PATCH net-next v2 1/2] net: bridge: make kobj_type structure constant Thomas Weißschuh
@ 2023-02-14 8:40 ` Nikolay Aleksandrov
0 siblings, 0 replies; 5+ messages in thread
From: Nikolay Aleksandrov @ 2023-02-14 8:40 UTC (permalink / raw)
To: Thomas Weißschuh, Roopa Prabhu, David S. Miller,
Eric Dumazet, Jakub Kicinski, Paolo Abeni
Cc: bridge, netdev, linux-kernel
On 14/02/2023 06:23, 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>
> ---
> net/bridge/br_if.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/net/bridge/br_if.c b/net/bridge/br_if.c
> index ad13b48e3e08..24f01ff113f0 100644
> --- a/net/bridge/br_if.c
> +++ b/net/bridge/br_if.c
> @@ -269,7 +269,7 @@ static void brport_get_ownership(const struct kobject *kobj, kuid_t *uid, kgid_t
> net_ns_get_ownership(dev_net(p->dev), uid, gid);
> }
>
> -static struct kobj_type brport_ktype = {
> +static const struct kobj_type brport_ktype = {
> #ifdef CONFIG_SYSFS
> .sysfs_ops = &brport_sysfs_ops,
> #endif
>
Acked-by: Nikolay Aleksandrov <razor@blackwall.org>
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH net-next v2 2/2] net-sysfs: make kobj_type structures constant
2023-02-14 4:23 [PATCH net-next v2 0/2] net: make kobj_type structures constant Thomas Weißschuh
2023-02-14 4:23 ` [PATCH net-next v2 1/2] net: bridge: make kobj_type structure constant Thomas Weißschuh
@ 2023-02-14 4:23 ` Thomas Weißschuh
2023-02-15 4:50 ` [PATCH net-next v2 0/2] net: " patchwork-bot+netdevbpf
2 siblings, 0 replies; 5+ messages in thread
From: Thomas Weißschuh @ 2023-02-14 4:23 UTC (permalink / raw)
To: Roopa Prabhu, Nikolay Aleksandrov, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni
Cc: bridge, netdev, 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 definitions to prevent
modification at runtime.
Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
---
net/core/net-sysfs.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/net/core/net-sysfs.c b/net/core/net-sysfs.c
index ca55dd747d6c..a3771bba841a 100644
--- a/net/core/net-sysfs.c
+++ b/net/core/net-sysfs.c
@@ -1040,7 +1040,7 @@ static void rx_queue_get_ownership(const struct kobject *kobj,
net_ns_get_ownership(net, uid, gid);
}
-static struct kobj_type rx_queue_ktype __ro_after_init = {
+static const struct kobj_type rx_queue_ktype = {
.sysfs_ops = &rx_queue_sysfs_ops,
.release = rx_queue_release,
.default_groups = rx_queue_default_groups,
@@ -1643,7 +1643,7 @@ static void netdev_queue_get_ownership(const struct kobject *kobj,
net_ns_get_ownership(net, uid, gid);
}
-static struct kobj_type netdev_queue_ktype __ro_after_init = {
+static const struct kobj_type netdev_queue_ktype = {
.sysfs_ops = &netdev_queue_sysfs_ops,
.release = netdev_queue_release,
.default_groups = netdev_queue_default_groups,
--
2.39.1
^ permalink raw reply related [flat|nested] 5+ messages in thread* Re: [PATCH net-next v2 0/2] net: make kobj_type structures constant
2023-02-14 4:23 [PATCH net-next v2 0/2] net: make kobj_type structures constant Thomas Weißschuh
2023-02-14 4:23 ` [PATCH net-next v2 1/2] net: bridge: make kobj_type structure constant Thomas Weißschuh
2023-02-14 4:23 ` [PATCH net-next v2 2/2] net-sysfs: make kobj_type structures constant Thomas Weißschuh
@ 2023-02-15 4:50 ` patchwork-bot+netdevbpf
2 siblings, 0 replies; 5+ messages in thread
From: patchwork-bot+netdevbpf @ 2023-02-15 4:50 UTC (permalink / raw)
To: =?utf-8?q?Thomas_Wei=C3=9Fschuh_=3Clinux=40weissschuh=2Enet=3E?=
Cc: roopa, razor, davem, edumazet, kuba, pabeni, bridge, netdev,
linux-kernel
Hello:
This series was applied to netdev/net-next.git (master)
by Jakub Kicinski <kuba@kernel.org>:
On Tue, 14 Feb 2023 04:23:10 +0000 you 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 definitions to prevent
> modification at runtime.
>
> Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
>
> [...]
Here is the summary with links:
- [net-next,v2,1/2] net: bridge: make kobj_type structure constant
https://git.kernel.org/netdev/net-next/c/e8c6cbd7656e
- [net-next,v2,2/2] net-sysfs: make kobj_type structures constant
https://git.kernel.org/netdev/net-next/c/b2793517052d
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 5+ messages in thread