]> asedeno.scripts.mit.edu Git - linux.git/commit
ath9k: constify ath_bus_ops structure
authorBhumika Goyal <bhumirks@gmail.com>
Sun, 27 Nov 2016 17:03:26 +0000 (22:33 +0530)
committerKalle Valo <kvalo@qca.qualcomm.com>
Thu, 1 Dec 2016 11:17:45 +0000 (13:17 +0200)
commit8ca5a6078d6d09ac50d9c39c214df3284f0d2efb
tree34b211e081e625b28160d53cd6931be474722094
parent43ca92d380a85996429601f0d337cbd58b4e5bf9
ath9k: constify ath_bus_ops structure

Declare the structure ath_bus_ops as const as it is only passed as an
argument to the function ath9k_init_device. This argument is of type
const struct ath_bus_ops *, so ath_bus_ops structures with this property
can be declared as const.
Done using Coccinelle:
@r1 disable optional_qualifier @
identifier i;
position p;
@@
static struct ath_bus_ops i@p = {...};

@ok1@
identifier r1.i;
position p;
expression e1,e2;
@@
ath9k_init_device(e1,e2,&i@p)

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

@depends on !bad disable optional_qualifier@
identifier r1.i;
@@
static
+const
struct ath_bus_ops i={...};

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

File size before:
   text    data     bss     dec     hex filename
   1295     232       0    1527     5f7 ath/ath9k/ahb.o

File size after:
   text    data     bss     dec     hex filename
   1359     176       0    1535     5ff ath/ath9k/ahb.o

Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
drivers/net/wireless/ath/ath9k/ahb.c