Skip to contentSkip to conversation

constify *_ops

PATCH In review Arvind Yadav 2 participants 7 messages Aug 23, 2017 – Aug 24, 2017

Subsystems (5)
lore
Share & tools
lore
#1 lore raw

PATCH 1/3 net: rtlwifi: constify rate_control_ops

In reply to Arvind Yadav

rate_control_ops are not supposed to change at runtime. All functions working with rate_control_ops provided by <net/mac80211.h> work with const rate_control_ops. So mark the non-const structs as const.

---
 drivers/net/wireless/realtek/rtlwifi/rc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/realtek/rtlwifi/rc.c +1 -1
index 951d257..02811ed 100644
@@ -283,7 +283,7 @@ static void rtl_rate_free_sta(void *rtlpriv,
 	kfree(rate_priv);
 }
 
-static struct rate_control_ops rtl_rate_ops = {
+static const struct rate_control_ops rtl_rate_ops = {
 	.name = "rtl_rc",
 	.alloc = rtl_rate_alloc,
 	.free = rtl_rate_free,
Signature · 1 line
1.9.1
#3 lore raw

PATCH 2/3 net: rsi: mac80211: constify ieee80211_ops

In reply to Arvind Yadav

ieee80211_ops are not supposed to change at runtime. All functions working with ieee80211_ops provided by <net/mac80211.h> work with const ieee80211_ops. So mark the non-const structs as const.

---
 drivers/net/wireless/rsi/rsi_91x_mac80211.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/rsi/rsi_91x_mac80211.c +1 -1
index 021e5ac..67532fb 100644
@@ -1177,7 +1177,7 @@ static void rsi_reg_notify(struct wiphy *wiphy,
 	adapter->dfs_region = request->dfs_region;
 }
 
-static struct ieee80211_ops mac80211_ops = {
+static const struct ieee80211_ops mac80211_ops = {
 	.tx = rsi_mac80211_tx,
 	.start = rsi_mac80211_start,
 	.stop = rsi_mac80211_stop,
Signature · 1 line
1.9.1
#0 lore raw

cover constify *_ops

*_ops are not supposed to change at runtime and none of the structures is modified.

Arvind Yadav (3):
[PATCH 1/3] net: rtlwifi: constify rate_control_ops [PATCH 2/3] net: rsi: mac80211: constify ieee80211_ops [PATCH 3/3] net: rsi: netlink: constify genl_ops

 drivers/net/wireless/realtek/rtlwifi/rc.c   | 2 +-
 drivers/net/wireless/rsi/rsi_91x_mac80211.c | 2 +-
 net/tipc/netlink_compat.c                   | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)
Signature · 1 line
1.9.1
#4 lore raw

PATCH 3/3 net: rsi: netlink: constify genl_ops

genl_ops are not supposed to change at runtime. All functions working with genl_ops provided by <net/genetlink.h> work with const genl_ops. So mark the non-const structs as const.

---
 net/tipc/netlink_compat.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
net/tipc/netlink_compat.c +1 -1
index 750949d..e48f0b2 100644
@@ -1217,7 +1217,7 @@ static int tipc_nl_compat_recv(struct sk_buff *skb, struct genl_info *info)
 	return err;
 }
 
-static struct genl_ops tipc_genl_compat_ops[] = {
+static const struct genl_ops tipc_genl_compat_ops[] = {
 	{
 		.cmd		= TIPC_GENL_CMD,
 		.doit		= tipc_nl_compat_recv,
Signature · 1 line
1.9.1
#5 lore raw

Re: [PATCH 3/3] net: rsi: netlink: constify genl_ops

Quoted 8 lines · Arvind Yadav

genl_ops are not supposed to change at runtime. All functions working with genl_ops provided by <net/genetlink.h> work with const genl_ops. So mark the non-const structs as const.

---
 net/tipc/netlink_compat.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Using the prefix "rsi:" looks wrong for this patch.

Signature · 1 line
Kalle Valo
#6 lore raw

Re: [PATCH 3/3] net: rsi: netlink: constify genl_ops

Hi,

Quoted 11 lines · Kalle Valo
Quoted 8 lines · Arvind Yadav

genl_ops are not supposed to change at runtime. All functions working with genl_ops provided by <net/genetlink.h> work with const genl_ops. So mark the non-const structs as const.

---
  net/tipc/netlink_compat.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

Using the prefix "rsi:" looks wrong for this patch.

Thanks for pointing. I will update.

Quoted 1 line

~arvind

#2 lore raw

Re: [1/3] net: rtlwifi: constify rate_control_ops

In reply to Arvind Yadav
Quoted 5 lines · Arvind Yadav

rate_control_ops are not supposed to change at runtime. All functions working with rate_control_ops provided by <net/mac80211.h> work with const rate_control_ops. So mark the non-const structs as const.

2 patches applied to wireless-drivers-next.git, thanks.

28b75415ad19 wireless: ipw2200: Replace PCI pool old API 9ea792a48cdd net: rsi: mac80211: constify ieee80211_ops

Signature · 3 lines
https://patchwork.kernel.org/patch/9917001/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches