net: constify struct device_type usage
Subsystems (12)
cover net: constify struct device_type usage
This is a simple and straight forward cleanup series that makes all device types in the net subsystem constants. This has been possible since 2011 [1] but not all occurrences were cleaned. I have been sweeping the tree to fix them all.
I was not sure if I should send these squashed, but there are quite a few changes so I decided to send them separately. Please let me know if that is not desirable.
---
[1] https://lore.kernel.org/all/[email protected]/
---
Ricardo B. Marliere (12):
net: usbnet: constify the struct device_type usage
net: dsa: constify the struct device_type usage
net: bridge: constify the struct device_type usage
net: vxlan: constify the struct device_type usage
net: ppp: constify the struct device_type usage
net: geneve: constify the struct device_type usage
net: hsr: constify the struct device_type usage
net: l2tp: constify the struct device_type usage
net: vlan: constify the struct device_type usage
net: netdevsim: constify the struct device_type usage
net: wwan: core: constify the struct device_type usage
net: hso: constify the struct device_type usage
drivers/net/geneve.c | 2 +- drivers/net/netdevsim/bus.c | 2 +- drivers/net/ppp/ppp_generic.c | 2 +- drivers/net/usb/hso.c | 2 +- drivers/net/usb/usbnet.c | 4 ++-- drivers/net/vxlan/vxlan_core.c | 2 +- drivers/net/wwan/wwan_core.c | 2 +- net/8021q/vlan_dev.c | 2 +- net/bridge/br_device.c | 2 +- net/dsa/user.c | 2 +- net/hsr/hsr_device.c | 2 +- net/l2tp/l2tp_eth.c | 2 +- 12 files changed, 13 insertions(+), 13 deletions(-)
---
base-commit: a6e0cb150c514efba4aaba4069927de43d80bb59
change-id: 20240217-device_cleanup-net-878960951968
Best regards,
Signature · 1 line
Ricardo B. Marliere <[email protected]>
PATCH 1/12 net: usbnet: constify the struct device_type usage
Since commit aed65af1cc2f ("drivers: make device_type const"), the driver core can properly handle constant struct device_type. Move the wlan_type and wwan_type variables to be constant structures as well, placing it into read-only memory which can not be modified at runtime.
--- drivers/net/usb/usbnet.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/usb/usbnet.c +2 -2
@@ -1654,11 +1654,11 @@ static const struct net_device_ops usbnet_netdev_ops = {// precondition: never called in_interrupt -static struct device_type wlan_type = { +static const struct device_type wlan_type = { .name ="wlan" , }; -static struct device_type wwan_type = { +static const struct device_type wwan_type = { .name ="wwan" , };
Signature · 1 line
2.43.0
Re: [PATCH 01/12] net: usbnet: constify the struct device_type usage
Quoted 7 lines · Ricardo B. Marliere
Since commit
aed65af1cc2f("drivers: makedevice_typeconst"), the driver core can properly handle constant structdevice_type. Move thewlan_typeandwwan_typevariables to be constant structures as well, placing it into read-only memory which can not be modified at runtime.Cc Greg Kroah-Hartman <[email protected]>Signed-off-by Ricardo B. Marliere <[email protected]>
PATCH 2/12 net: dsa: constify the struct device_type usage
In reply to Ricardo B. MarliereSince commit aed65af1cc2f ("drivers: make device_type const"), the driver core can properly handle constant struct device_type. Move the dsa_type variable to be a constant structure as well, placing it into read-only memory which can not be modified at runtime.
--- net/dsa/user.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/dsa/user.c +1 -1
@@ -2429,7 +2429,7 @@ static const struct net_device_ops dsa_user_netdev_ops = { .ndo_fill_forward_path = dsa_user_fill_forward_path, }; -static struct device_type dsa_type = { +static const struct device_type dsa_type = { .name ="dsa" , };
Signature · 1 line
2.43.0
Re: [PATCH 02/12] net: dsa: constify the struct device_type usage
Quoted 7 lines · Ricardo B. Marliere
Since commit
aed65af1cc2f("drivers: makedevice_typeconst"), the driver core can properly handle constant structdevice_type. Move thedsa_typevariable to be a constant structure as well, placing it into read-only memory which can not be modified at runtime.Cc Greg Kroah-Hartman <[email protected]>Signed-off-by Ricardo B. Marliere <[email protected]>
Signature · 1 line
Florian
PATCH 3/12 net: bridge: constify the struct device_type usage
In reply to Ricardo B. MarliereSince commit aed65af1cc2f ("drivers: make device_type const"), the driver core can properly handle constant struct device_type. Move the br_type variable to be a constant structure as well, placing it into read-only memory which can not be modified at runtime.
--- net/bridge/br_device.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/bridge/br_device.c +1 -1
@@ -474,7 +474,7 @@ static const struct net_device_ops br_netdev_ops = { .ndo_fill_forward_path = br_fill_forward_path, }; -static struct device_type br_type = { +static const struct device_type br_type = { .name ="bridge" , };
Signature · 1 line
2.43.0
Re: [PATCH 03/12] net: bridge: constify the struct device_type usage
Quoted 7 lines · Ricardo B. Marliere
Since commit
aed65af1cc2f("drivers: makedevice_typeconst"), the driver core can properly handle constant structdevice_type. Move thebr_typevariable to be a constant structure as well, placing it into read-only memory which can not be modified at runtime.Cc Greg Kroah-Hartman <[email protected]>Signed-off-by Ricardo B. Marliere <[email protected]>
PATCH 4/12 net: vxlan: constify the struct device_type usage
In reply to Ricardo B. MarliereSince commit aed65af1cc2f ("drivers: make device_type const"), the driver core can properly handle constant struct device_type. Move the vxlan_type variable to be a constant structure as well, placing it into read-only memory which can not be modified at runtime.
--- drivers/net/vxlan/vxlan_core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/vxlan/vxlan_core.c +1 -1
@@ -3254,7 +3254,7 @@ static const struct net_device_ops vxlan_netdev_raw_ops = { };/* Info for udev, that this is a virtual tunnel endpoint */ -static struct device_type vxlan_type = { +static const struct device_type vxlan_type = { .name ="vxlan" , };
Signature · 1 line
2.43.0
Re: [PATCH 04/12] net: vxlan: constify the struct device_type usage
Quoted 4 lines · Ricardo B. Marliere
Since commit
aed65af1cc2f("drivers: makedevice_typeconst"), the driver core can properly handle constant structdevice_type. Move thevxlan_typevariable to be a constant structure as well, placing it into read-only memory which can not be modified at runtime.
Note: To help maintainers (and potentially reviewers) work please write in the subject prefix which tree you're targetting. For this series, it should be "[PATCH net-next xx/yy]".
Re: [PATCH 04/12] net: vxlan: constify the struct device_type usage
Hi Guillaume,
Quoted 11 lines · Guillaume Nault
Quoted 4 lines · Ricardo B. Marliere
Since commit
aed65af1cc2f("drivers: makedevice_typeconst"), the driver core can properly handle constant structdevice_type. Move thevxlan_typevariable to be a constant structure as well, placing it into read-only memory which can not be modified at runtime.Reviewed-by Guillaume Nault <[email protected]>Note: To help maintainers (and potentially reviewers) work please write in the subject prefix which tree you're targetting. For this series, it should be "[PATCH net-next xx/yy]".
Makes sense, will keep this in mind next time!
Thanks for reviewing,
- Ricardo.
PATCH 5/12 net: ppp: constify the struct device_type usage
In reply to Ricardo B. MarliereSince commit aed65af1cc2f ("drivers: make device_type const"), the driver core can properly handle constant struct device_type. Move the ppp_type variable to be a constant structure as well, placing it into read-only memory which can not be modified at runtime.
--- drivers/net/ppp/ppp_generic.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ppp/ppp_generic.c +1 -1
@@ -1607,7 +1607,7 @@ static const struct net_device_ops ppp_netdev_ops = { .ndo_fill_forward_path = ppp_fill_forward_path, }; -static struct device_type ppp_type = { +static const struct device_type ppp_type = { .name ="ppp" , };
Signature · 1 line
2.43.0
Re: [PATCH 05/12] net: ppp: constify the struct device_type usage
Quoted 4 lines · Ricardo B. Marliere
Since commit
aed65af1cc2f("drivers: makedevice_typeconst"), the driver core can properly handle constant structdevice_type. Move theppp_typevariable to be a constant structure as well, placing it into read-only memory which can not be modified at runtime.
PATCH 6/12 net: geneve: constify the struct device_type usage
In reply to Ricardo B. MarliereSince commit aed65af1cc2f ("drivers: make device_type const"), the driver core can properly handle constant struct device_type. Move the geneve_type variable to be a constant structure as well, placing it into read-only memory which can not be modified at runtime.
--- drivers/net/geneve.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/geneve.c +1 -1
@@ -1142,7 +1142,7 @@ static const struct ethtool_ops geneve_ethtool_ops = { };/* Info for udev, that this is a virtual tunnel endpoint */ -static struct device_type geneve_type = { +static const struct device_type geneve_type = { .name ="geneve" , };
Signature · 1 line
2.43.0
Re: [PATCH 06/12] net: geneve: constify the struct device_type usage
Quoted 4 lines · Ricardo B. Marliere
Since commit
aed65af1cc2f("drivers: makedevice_typeconst"), the driver core can properly handle constant structdevice_type. Move thegeneve_typevariable to be a constant structure as well, placing it into read-only memory which can not be modified at runtime.
PATCH 7/12 net: hsr: constify the struct device_type usage
In reply to Ricardo B. MarliereSince commit aed65af1cc2f ("drivers: make device_type const"), the driver core can properly handle constant struct device_type. Move the hsr_type variable to be a constant structure as well, placing it into read-only memory which can not be modified at runtime.
--- net/hsr/hsr_device.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/hsr/hsr_device.c +1 -1
@@ -467,7 +467,7 @@ static const struct net_device_ops hsr_device_ops = { .ndo_set_rx_mode = hsr_set_rx_mode, }; -static struct device_type hsr_type = { +static const struct device_type hsr_type = { .name ="hsr" , };
Signature · 1 line
2.43.0
Re: [PATCH 07/12] net: hsr: constify the struct device_type usage
Quoted 7 lines · Ricardo B. Marliere
Since commit
aed65af1cc2f("drivers: makedevice_typeconst"), the driver core can properly handle constant structdevice_type. Move thehsr_typevariable to be a constant structure as well, placing it into read-only memory which can not be modified at runtime.Cc Greg Kroah-Hartman <[email protected]>Signed-off-by Ricardo B. Marliere <[email protected]>
PATCH 8/12 net: l2tp: constify the struct device_type usage
In reply to Ricardo B. MarliereSince commit aed65af1cc2f ("drivers: make device_type const"), the driver core can properly handle constant struct device_type. Move the l2tpeth_type variable to be a constant structure as well, placing it into read-only memory which can not be modified at runtime.
--- net/l2tp/l2tp_eth.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/l2tp/l2tp_eth.c +1 -1
@@ -100,7 +100,7 @@ static const struct net_device_ops l2tp_eth_netdev_ops = { .ndo_set_mac_address = eth_mac_addr, }; -static struct device_type l2tpeth_type = { +static const struct device_type l2tpeth_type = { .name ="l2tpeth" , };
Signature · 1 line
2.43.0
Re: [PATCH 08/12] net: l2tp: constify the struct device_type usage
Quoted 4 lines · Ricardo B. Marliere
Since commit
aed65af1cc2f("drivers: makedevice_typeconst"), the driver core can properly handle constant structdevice_type. Move thel2tpeth_typevariable to be a constant structure as well, placing it into read-only memory which can not be modified at runtime.
PATCH 9/12 net: vlan: constify the struct device_type usage
In reply to Ricardo B. MarliereSince commit aed65af1cc2f ("drivers: make device_type const"), the driver core can properly handle constant struct device_type. Move the vlan_type variable to be a constant structure as well, placing it into read-only memory which can not be modified at runtime.
--- net/8021q/vlan_dev.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/8021q/vlan_dev.c +1 -1
@@ -537,7 +537,7 @@ static const struct header_ops vlan_passthru_header_ops = { .parse_protocol = vlan_parse_protocol, }; -static struct device_type vlan_type = { +static const struct device_type vlan_type = { .name ="vlan" , };
Signature · 1 line
2.43.0
Re: [PATCH 09/12] net: vlan: constify the struct device_type usage
Quoted 7 lines · Ricardo B. Marliere
Since commit
aed65af1cc2f("drivers: makedevice_typeconst"), the driver core can properly handle constant structdevice_type. Move thevlan_typevariable to be a constant structure as well, placing it into read-only memory which can not be modified at runtime.Cc Greg Kroah-Hartman <[email protected]>Signed-off-by Ricardo B. Marliere <[email protected]>
PATCH 10/12 net: netdevsim: constify the struct device_type usage
In reply to Ricardo B. MarliereSince commit aed65af1cc2f ("drivers: make device_type const"), the driver core can properly handle constant struct device_type. Move the nsim_bus_dev_type variable to be a constant structure as well, placing it into read-only memory which can not be modified at runtime.
--- drivers/net/netdevsim/bus.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/netdevsim/bus.c +1 -1
@@ -129,7 +129,7 @@ static void nsim_bus_dev_release(struct device *dev)complete (&nsim_bus_devs_released); } -static struct device_type nsim_bus_dev_type = { +static const struct device_type nsim_bus_dev_type = { .groups = nsim_bus_dev_attr_groups, .release = nsim_bus_dev_release, };
Signature · 1 line
2.43.0
Re: [PATCH 10/12] net: netdevsim: constify the struct device_type usage
Quoted 7 lines · Ricardo B. Marliere
Since commit
aed65af1cc2f("drivers: makedevice_typeconst"), the driver core can properly handle constant structdevice_type. Move thensim_bus_dev_typevariable to be a constant structure as well, placing it into read-only memory which can not be modified at runtime.Cc Greg Kroah-Hartman <[email protected]>Signed-off-by Ricardo B. Marliere <[email protected]>
PATCH 11/12 net: wwan: core: constify the struct device_type usage
In reply to Ricardo B. MarliereSince commit aed65af1cc2f ("drivers: make device_type const"), the driver core can properly handle constant struct device_type. Move the wwan_type variable to be a constant structure as well, placing it into read-only memory which can not be modified at runtime.
--- drivers/net/wwan/wwan_core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wwan/wwan_core.c +1 -1
@@ -920,7 +920,7 @@ static int wwan_rtnl_validate(struct nlattr *tb[], struct nlattr *data[],return 0 ; } -static struct device_type wwan_type = { .name ="wwan" }; +static const struct device_type wwan_type = { .name ="wwan" }; static struct net_device *wwan_rtnl_alloc(struct nlattr *tb[], const char *ifname,
Signature · 1 line
2.43.0
Re: [PATCH 11/12] net: wwan: core: constify the struct device_type usage
Quoted 7 lines · Ricardo B. Marliere
Since commit
aed65af1cc2f("drivers: makedevice_typeconst"), the driver core can properly handle constant structdevice_type. Move thewwan_typevariable to be a constant structure as well, placing it into read-only memory which can not be modified at runtime.Cc Greg Kroah-Hartman <[email protected]>Signed-off-by Ricardo B. Marliere <[email protected]>
Re: [PATCH 11/12] net: wwan: core: constify the struct device_type usage
In reply to Ricardo B. MarliereQuoted 7 lines · Ricardo B. Marliere
Since commit
aed65af1cc2f("drivers: makedevice_typeconst"), the driver core can properly handle constant structdevice_type. Move thewwan_typevariable to be a constant structure as well, placing it into read-only memory which can not be modified at runtime.Cc Greg Kroah-Hartman <[email protected]>Signed-off-by Ricardo B. Marliere <[email protected]>
PATCH 12/12 net: hso: constify the struct device_type usage
In reply to Ricardo B. MarliereSince commit aed65af1cc2f ("drivers: make device_type const"), the driver core can properly handle constant struct device_type. Move the hso_type variable to be a constant structure as well, placing it into read-only memory which can not be modified at runtime.
--- drivers/net/usb/hso.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/usb/hso.c +1 -1
@@ -2465,7 +2465,7 @@ static void hso_create_rfkill(struct hso_device *hso_dev, } } -static struct device_type hso_type = { +static const struct device_type hso_type = { .name ="wwan" , };
Signature · 1 line
2.43.0
Re: [PATCH 12/12] net: hso: constify the struct device_type usage
Quoted 7 lines · Ricardo B. Marliere
Since commit
aed65af1cc2f("drivers: makedevice_typeconst"), the driver core can properly handle constant structdevice_type. Move thehso_typevariable to be a constant structure as well, placing it into read-only memory which can not be modified at runtime.Cc Greg Kroah-Hartman <[email protected]>Signed-off-by Ricardo B. Marliere <[email protected]>
This series was applied to netdev/net-next.git (main) by David S. Miller <[email protected]>:
Hello:
This series was applied to netdev/net-next.git (main) by David S. Miller <[email protected]>:
Quoted 10 lines · On Sat, 17 Feb 2024 17:13:22 -0300 you wrote:
This is a simple and straight forward cleanup series that makes all device types in the net subsystem constants. This has been possible since 2011 [1] but not all occurrences were cleaned. I have been sweeping the tree to fix them all.
I was not sure if I should send these squashed, but there are quite a few changes so I decided to send them separately. Please let me know if that is not desirable.
[...]
Here is the summary with links:
- [01/12] net: usbnet: constify the struct device_type usage
https://git.kernel.org/netdev/net-next/c/3ce7caee3af0 - [02/12] net: dsa: constify the struct device_type usage https://git.kernel.org/netdev/net-next/c/7e0acba3b49e - [03/12] net: bridge: constify the struct device_type usage https://git.kernel.org/netdev/net-next/c/bbc7e4cc21a4 - [04/12] net: vxlan: constify the struct device_type usage https://git.kernel.org/netdev/net-next/c/c7170e7672e5 - [05/12] net: ppp: constify the struct device_type usage https://git.kernel.org/netdev/net-next/c/908ada0da6d4 - [06/12] net: geneve: constify the struct device_type usage https://git.kernel.org/netdev/net-next/c/e443f3acbc6d - [07/12] net: hsr: constify the struct device_type usage https://git.kernel.org/netdev/net-next/c/0072b2c1ffd0 - [08/12] net: l2tp: constify the struct device_type usage https://git.kernel.org/netdev/net-next/c/43820fd1ddb5 - [09/12] net: vlan: constify the struct device_type usage https://git.kernel.org/netdev/net-next/c/7ae9d3423f1d - [10/12] net: netdevsim: constify the struct device_type usage https://git.kernel.org/netdev/net-next/c/52042e092ba9 - [11/12] net: wwan: core: constify the struct device_type usage https://git.kernel.org/netdev/net-next/c/7eccf41b3bac - [12/12] net: hso: constify the struct device_type usage https://git.kernel.org/netdev/net-next/c/55fad9c4a3c4
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html