* [PATCH net-next] net: constify net_class
@ 2024-04-12 10:17 Heiner Kallweit
2024-04-12 16:38 ` Stephen Hemminger
2024-04-15 9:50 ` patchwork-bot+netdevbpf
0 siblings, 2 replies; 4+ messages in thread
From: Heiner Kallweit @ 2024-04-12 10:17 UTC (permalink / raw)
To: Eric Dumazet, Paolo Abeni, Jakub Kicinski, David Miller
Cc: netdev@vger.kernel.org
AFAICS all users of net_class take a const struct class * argument.
Therefore fully constify net_class.
Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
---
net/core/net-sysfs.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/core/net-sysfs.c b/net/core/net-sysfs.c
index e3d7a8cfa..427185c24 100644
--- a/net/core/net-sysfs.c
+++ b/net/core/net-sysfs.c
@@ -2046,7 +2046,7 @@ static void net_get_ownership(const struct device *d, kuid_t *uid, kgid_t *gid)
net_ns_get_ownership(net, uid, gid);
}
-static struct class net_class __ro_after_init = {
+static const struct class net_class = {
.name = "net",
.dev_release = netdev_release,
.dev_groups = net_class_groups,
--
2.44.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH net-next] net: constify net_class
2024-04-12 10:17 [PATCH net-next] net: constify net_class Heiner Kallweit
@ 2024-04-12 16:38 ` Stephen Hemminger
2024-04-12 19:14 ` Heiner Kallweit
2024-04-15 9:50 ` patchwork-bot+netdevbpf
1 sibling, 1 reply; 4+ messages in thread
From: Stephen Hemminger @ 2024-04-12 16:38 UTC (permalink / raw)
To: Heiner Kallweit
Cc: Eric Dumazet, Paolo Abeni, Jakub Kicinski, David Miller,
netdev@vger.kernel.org
On Fri, 12 Apr 2024 12:17:57 +0200
Heiner Kallweit <hkallweit1@gmail.com> wrote:
> AFAICS all users of net_class take a const struct class * argument.
> Therefore fully constify net_class.
>
> Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
> ---
Acked-by: Stephen Hemminger <stephen@networkplumber.org>
PS: net_class_attr can be const as well?
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH net-next] net: constify net_class
2024-04-12 16:38 ` Stephen Hemminger
@ 2024-04-12 19:14 ` Heiner Kallweit
0 siblings, 0 replies; 4+ messages in thread
From: Heiner Kallweit @ 2024-04-12 19:14 UTC (permalink / raw)
To: Stephen Hemminger
Cc: Eric Dumazet, Paolo Abeni, Jakub Kicinski, David Miller,
netdev@vger.kernel.org
On 12.04.2024 18:38, Stephen Hemminger wrote:
> On Fri, 12 Apr 2024 12:17:57 +0200
> Heiner Kallweit <hkallweit1@gmail.com> wrote:
>
>> AFAICS all users of net_class take a const struct class * argument.
>> Therefore fully constify net_class.
>>
>> Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
>> ---
>
> Acked-by: Stephen Hemminger <stephen@networkplumber.org>
>
> PS: net_class_attr can be const as well?
No, this results in warnings, because the const is at least discarded.
struct attribute_group {
const char *name;
umode_t (*is_visible)(struct kobject *,
struct attribute *, int);
umode_t (*is_bin_visible)(struct kobject *,
struct bin_attribute *, int);
struct attribute **attrs;
struct bin_attribute **bin_attrs;
};
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH net-next] net: constify net_class
2024-04-12 10:17 [PATCH net-next] net: constify net_class Heiner Kallweit
2024-04-12 16:38 ` Stephen Hemminger
@ 2024-04-15 9:50 ` patchwork-bot+netdevbpf
1 sibling, 0 replies; 4+ messages in thread
From: patchwork-bot+netdevbpf @ 2024-04-15 9:50 UTC (permalink / raw)
To: Heiner Kallweit; +Cc: edumazet, pabeni, kuba, davem, netdev
Hello:
This patch was applied to netdev/net-next.git (main)
by David S. Miller <davem@davemloft.net>:
On Fri, 12 Apr 2024 12:17:57 +0200 you wrote:
> AFAICS all users of net_class take a const struct class * argument.
> Therefore fully constify net_class.
>
> Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
> ---
> net/core/net-sysfs.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
Here is the summary with links:
- [net-next] net: constify net_class
https://git.kernel.org/netdev/net-next/c/9382b4f338d2
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] 4+ messages in thread
end of thread, other threads:[~2024-04-15 9:50 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-04-12 10:17 [PATCH net-next] net: constify net_class Heiner Kallweit
2024-04-12 16:38 ` Stephen Hemminger
2024-04-12 19:14 ` Heiner Kallweit
2024-04-15 9:50 ` patchwork-bot+netdevbpf
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox