Skip to contentSkip to conversation

net: wireless: marvell: libertas: constify cfg80211_ops structures

PATCH In review Bhumika Goyal 2 participants 3 messages Dec 17, 2016 – Dec 30, 2016

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net: wireless: marvell: libertas: constify cfg80211_ops structures

cfg80211_ops structures are only passed as an argument to the function wiphy_new. This argument is of type const, so cfg80211_ops strutures having this property can be declared as const.
Done using Coccinelle

@r1 disable optional_qualifier @
identifier i;
position p;
@@
static struct cfg80211_ops i@p = {...};

@ok1@
identifier r1.i;
position p;
@@
wiphy_new(&i@p,...)

@bad@
position p!={r1.p,ok1.p};
identifier r1.i;
@@
i@p

@depends on !bad disable optional_qualifier@
identifier r1.i;
@@
+const
struct cfg80211_ops i;

File size before:
text data bss dec hex filename
21225 1954 16 23195 5a9b wireless/marvell/libertas/cfg.o

File size after:
text data bss dec hex filename
22041 1154 16 23211 5aab wireless/marvell/libertas/cfg.o

---
 drivers/net/wireless/marvell/libertas/cfg.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/marvell/libertas/cfg.c +1 -1
index 7ff2efa..3f97acb 100644
@@ -2086,7 +2086,7 @@ static int lbs_set_power_mgmt(struct wiphy *wiphy, struct net_device *dev,
  * Initialization
  */
 
-static struct cfg80211_ops lbs_cfg80211_ops = {
+static const struct cfg80211_ops lbs_cfg80211_ops = {
 	.set_monitor_channel = lbs_cfg_set_monitor_channel,
 	.libertas_set_mesh_channel = lbs_cfg_set_mesh_channel,
 	.scan = lbs_cfg_scan,
Signature · 1 line
1.9.1
#1 lore raw
Quoted 33 lines · Bhumika Goyal

cfg80211_ops structures are only passed as an argument to the function wiphy_new. This argument is of type const, so cfg80211_ops strutures having this property can be declared as const.
Done using Coccinelle

@r1 disable optional_qualifier @
identifier i;
position p;
@@
static struct cfg80211_ops i@p = {...};

@ok1@
identifier r1.i;
position p;
@@
wiphy_new(&i@p,...)

@bad@
position p!={r1.p,ok1.p};
identifier r1.i;
@@
i@p

@depends on !bad disable optional_qualifier@
identifier r1.i;
@@
+const
struct cfg80211_ops i;

File size before:
text data bss dec hex filename
21225 1954 16 23195 5a9b wireless/marvell/libertas/cfg.o

Quoted 5 lines

File size after:
text data bss dec hex filename
22041 1154 16 23211 5aab wireless/marvell/libertas/cfg.o

The prefix should be "libertas:", I can fix that before I commit.

Signature · 6 lines
https://patchwork.kernel.org/patch/9479131/

Documentation about submitting wireless patches and checking status
from patchwork:

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches
#2 lore raw

Re: libertas: constify cfg80211_ops structures

In reply to Bhumika Goyal
Quoted 33 lines · Bhumika Goyal

cfg80211_ops structures are only passed as an argument to the function wiphy_new. This argument is of type const, so cfg80211_ops strutures having this property can be declared as const.
Done using Coccinelle

@r1 disable optional_qualifier @
identifier i;
position p;
@@
static struct cfg80211_ops i@p = {...};

@ok1@
identifier r1.i;
position p;
@@
wiphy_new(&i@p,...)

@bad@
position p!={r1.p,ok1.p};
identifier r1.i;
@@
i@p

@depends on !bad disable optional_qualifier@
identifier r1.i;
@@
+const
struct cfg80211_ops i;

File size before:
text data bss dec hex filename
21225 1954 16 23195 5a9b wireless/marvell/libertas/cfg.o

Quoted 5 lines

File size after:
text data bss dec hex filename
22041 1154 16 23211 5aab wireless/marvell/libertas/cfg.o

Patch applied to wireless-drivers-next.git, thanks.

26eb994d5239 libertas: constify cfg80211_ops structures

Signature · 6 lines
https://patchwork.kernel.org/patch/9479131/

Documentation about submitting wireless patches and checking status
from patchwork:

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