wireless: ath: ath9k: constify ath_bus_ops structure
Subsystems (3)
PATCH 1/1 wireless: ath: 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
--- drivers/net/wireless/ath/ath9k/ahb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/ath/ath9k/ahb.c +1 -1
@@ -62,7 +62,7 @@ static bool ath_ahb_eeprom_read(struct ath_common *common, u32 off, u16 *data)return false; } -static struct ath_bus_ops ath_ahb_bus_ops = { +static const struct ath_bus_ops ath_ahb_bus_ops = { .ath_bus_type =ATH_AHB , .read_cachesize = ath_ahb_read_cachesize, .eeprom_read = ath_ahb_eeprom_read,
Signature · 1 line
1.9.1
Quoted 41 lines · Bhumika Goyal
Declare the structure
ath_bus_opsas const as it is only passed as an argument to the functionath9k_init_device. This argument is of type const structath_bus_ops*, soath_bus_opsstructures with this property can be declared as const.
Done using Coccinelle:
@r1 disableoptional_qualifier@
identifier i;
position p;
@@
static structath_bus_opsi at p = {...};@ok1@
identifier r1.i;
position p;
expression e1,e2;
@@ath9k_init_device(e1,e2,&i at p)@bad@
position p!={r1.p,ok1.p};
identifier r1.i;
@@
i at p@depends on !bad disable optional_qualifier@
identifier r1.i;
@@
static
+const
structath_bus_opsi={...};@depends on !bad disable optional_qualifier@
identifier r1.i;
@@
+const
structath_bus_opsi;File size before:
text data bss dec hex filename
1295 232 0 1527 5f7ath/ath9k/ahb.o
Quoted 5 lines
File size after:
text data bss dec hex filename
1359 176 0 1535 5ffath/ath9k/ahb.oSigned-off-by Bhumika Goyal <[email protected]>
Patch applied to ath-next branch of ath.git, thanks.
8ca5a6078d6d ath9k: constify ath_bus_ops structure
Signature · 6 lines
https://patchwork.kernel.org/patch/9448851/ Documentation about submitting wireless patches and checking status from patchwork: https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches