net: constify net_class
Subsystems (2)
PATCH 1/1 net: constify net_class
AFAICS all users of net_class take a const struct class * argument. Therefore fully constify net_class.
--- net/core/net-sysfs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/core/net-sysfs.c +1 -1
@@ -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,
Signature · 1 line
2.44.0
Quoted 5 lines · On Fri, 12 Apr 2024 12:17:57 +0200 Heiner Kallweit <[email protected]> wrote:
AFAICS all users of
net_classtake a const struct class * argument. Therefore fully constifynet_class.Signed-off-by Heiner Kallweit <[email protected]>---
PS: net_class_attr can be const as well?
Quoted 6 lines · Stephen Hemminger
Quoted 3 lines · On Fri, 12 Apr 2024 12:17:57 +0200 Heiner Kallweit <[email protected]> wrote:
AFAICS all users of
net_classtake a const struct class * argument. Therefore fully constifynet_class.
Quoted 6 lines
Quoted 2 lines
Signed-off-by Heiner Kallweit <[email protected]>---
PS:
net_class_attrcan 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;
};This patch was applied to netdev/net-next.git (main) by David S. Miller <[email protected]>:
Hello:
This patch was applied to netdev/net-next.git (main) by David S. Miller <[email protected]>:
Quoted 7 lines · On Fri, 12 Apr 2024 12:17:57 +0200 you wrote:
AFAICS all users of
net_classtake a const struct class * argument. Therefore fully constifynet_class.Signed-off-by Heiner Kallweit <[email protected]>--- 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!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html