Re: [PATCH] net: ieee802154: constify ieee802154_ops structures

2016-11-21 Thread David Miller
From: Bhumika Goyal 
Date: Tue, 22 Nov 2016 02:00:14 +0530

> Declare the structure ieee802154_ops as const as it is only passed as an
> argument to the function  ieee802154_alloc_hw. This argument is of type
> const struct ieee802154_ops *, so ieee80254_ops structures having this
> property can be declared as const.
> Done using Coccinelle:
 ...
> Signed-off-by: Bhumika Goyal 

Applied.


Re: [PATCH] net: ieee802154: constify ieee802154_ops structures

2016-11-21 Thread David Miller
From: Bhumika Goyal 
Date: Tue, 22 Nov 2016 02:00:14 +0530

> Declare the structure ieee802154_ops as const as it is only passed as an
> argument to the function  ieee802154_alloc_hw. This argument is of type
> const struct ieee802154_ops *, so ieee80254_ops structures having this
> property can be declared as const.
> Done using Coccinelle:
 ...
> Signed-off-by: Bhumika Goyal 

Applied.


Re: [PATCH] net: ieee802154: constify ieee802154_ops structures

2016-11-21 Thread Stefan Schmidt

Hello.

On 21/11/16 21:30, Bhumika Goyal wrote:

Declare the structure ieee802154_ops as const as it is only passed as an
argument to the function  ieee802154_alloc_hw. This argument is of type
const struct ieee802154_ops *, so ieee80254_ops structures having this
property can be declared as const.
Done using Coccinelle:

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

@ok1@
identifier r1.i;
position p;
expression e1;
@@
ieee802154_alloc_hw(e1,@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 ieee802154_ops  i={...};

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

The before and after size details of the affected files are:

   textdata bss dec hex filename
   86691176  1698612685 drivers/net/ieee802154/adf7242.o
   88051048  169869268d drivers/net/ieee802154/adf7242.o

   textdata bss dec hex filename
   72112296  3295392543 drivers/net/ieee802154/atusb.o
   73392160  329531253b drivers/net/ieee802154/atusb.o

Signed-off-by: Bhumika Goyal 
---
 drivers/net/ieee802154/adf7242.c | 2 +-
 drivers/net/ieee802154/atusb.c   | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ieee802154/adf7242.c b/drivers/net/ieee802154/adf7242.c
index 9fa7ac9..4ff4c7d 100644
--- a/drivers/net/ieee802154/adf7242.c
+++ b/drivers/net/ieee802154/adf7242.c
@@ -874,7 +874,7 @@ static int adf7242_rx(struct adf7242_local *lp)
return 0;
 }

-static struct ieee802154_ops adf7242_ops = {
+static const struct ieee802154_ops adf7242_ops = {
.owner = THIS_MODULE,
.xmit_sync = adf7242_xmit,
.ed = adf7242_ed,
diff --git a/drivers/net/ieee802154/atusb.c b/drivers/net/ieee802154/atusb.c
index 1056ed1..322864a 100644
--- a/drivers/net/ieee802154/atusb.c
+++ b/drivers/net/ieee802154/atusb.c
@@ -567,7 +567,7 @@ static void atusb_stop(struct ieee802154_hw *hw)
return 0;
 }

-static struct ieee802154_ops atusb_ops = {
+static const struct ieee802154_ops atusb_ops = {
.owner  = THIS_MODULE,
.xmit_async = atusb_xmit,
.ed = atusb_ed,




Acked-by: Stefan Schmidt 

regards
Stefan Schmidt


Re: [PATCH] net: ieee802154: constify ieee802154_ops structures

2016-11-21 Thread Stefan Schmidt

Hello.

On 21/11/16 21:30, Bhumika Goyal wrote:

Declare the structure ieee802154_ops as const as it is only passed as an
argument to the function  ieee802154_alloc_hw. This argument is of type
const struct ieee802154_ops *, so ieee80254_ops structures having this
property can be declared as const.
Done using Coccinelle:

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

@ok1@
identifier r1.i;
position p;
expression e1;
@@
ieee802154_alloc_hw(e1,@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 ieee802154_ops  i={...};

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

The before and after size details of the affected files are:

   textdata bss dec hex filename
   86691176  1698612685 drivers/net/ieee802154/adf7242.o
   88051048  169869268d drivers/net/ieee802154/adf7242.o

   textdata bss dec hex filename
   72112296  3295392543 drivers/net/ieee802154/atusb.o
   73392160  329531253b drivers/net/ieee802154/atusb.o

Signed-off-by: Bhumika Goyal 
---
 drivers/net/ieee802154/adf7242.c | 2 +-
 drivers/net/ieee802154/atusb.c   | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ieee802154/adf7242.c b/drivers/net/ieee802154/adf7242.c
index 9fa7ac9..4ff4c7d 100644
--- a/drivers/net/ieee802154/adf7242.c
+++ b/drivers/net/ieee802154/adf7242.c
@@ -874,7 +874,7 @@ static int adf7242_rx(struct adf7242_local *lp)
return 0;
 }

-static struct ieee802154_ops adf7242_ops = {
+static const struct ieee802154_ops adf7242_ops = {
.owner = THIS_MODULE,
.xmit_sync = adf7242_xmit,
.ed = adf7242_ed,
diff --git a/drivers/net/ieee802154/atusb.c b/drivers/net/ieee802154/atusb.c
index 1056ed1..322864a 100644
--- a/drivers/net/ieee802154/atusb.c
+++ b/drivers/net/ieee802154/atusb.c
@@ -567,7 +567,7 @@ static void atusb_stop(struct ieee802154_hw *hw)
return 0;
 }

-static struct ieee802154_ops atusb_ops = {
+static const struct ieee802154_ops atusb_ops = {
.owner  = THIS_MODULE,
.xmit_async = atusb_xmit,
.ed = atusb_ed,




Acked-by: Stefan Schmidt 

regards
Stefan Schmidt


[PATCH] net: ieee802154: constify ieee802154_ops structures

2016-11-21 Thread Bhumika Goyal
Declare the structure ieee802154_ops as const as it is only passed as an
argument to the function  ieee802154_alloc_hw. This argument is of type
const struct ieee802154_ops *, so ieee80254_ops structures having this
property can be declared as const.
Done using Coccinelle:

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

@ok1@
identifier r1.i;
position p;
expression e1;
@@
ieee802154_alloc_hw(e1,@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 ieee802154_ops  i={...};

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

The before and after size details of the affected files are:

   textdata bss dec hex filename
   86691176  1698612685 drivers/net/ieee802154/adf7242.o
   88051048  169869268d drivers/net/ieee802154/adf7242.o

   textdata bss dec hex filename
   72112296  3295392543 drivers/net/ieee802154/atusb.o
   73392160  329531253b drivers/net/ieee802154/atusb.o

Signed-off-by: Bhumika Goyal 
---
 drivers/net/ieee802154/adf7242.c | 2 +-
 drivers/net/ieee802154/atusb.c   | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ieee802154/adf7242.c b/drivers/net/ieee802154/adf7242.c
index 9fa7ac9..4ff4c7d 100644
--- a/drivers/net/ieee802154/adf7242.c
+++ b/drivers/net/ieee802154/adf7242.c
@@ -874,7 +874,7 @@ static int adf7242_rx(struct adf7242_local *lp)
return 0;
 }
 
-static struct ieee802154_ops adf7242_ops = {
+static const struct ieee802154_ops adf7242_ops = {
.owner = THIS_MODULE,
.xmit_sync = adf7242_xmit,
.ed = adf7242_ed,
diff --git a/drivers/net/ieee802154/atusb.c b/drivers/net/ieee802154/atusb.c
index 1056ed1..322864a 100644
--- a/drivers/net/ieee802154/atusb.c
+++ b/drivers/net/ieee802154/atusb.c
@@ -567,7 +567,7 @@ static void atusb_stop(struct ieee802154_hw *hw)
return 0;
 }
 
-static struct ieee802154_ops atusb_ops = {
+static const struct ieee802154_ops atusb_ops = {
.owner  = THIS_MODULE,
.xmit_async = atusb_xmit,
.ed = atusb_ed,
-- 
1.9.1



[PATCH] net: ieee802154: constify ieee802154_ops structures

2016-11-21 Thread Bhumika Goyal
Declare the structure ieee802154_ops as const as it is only passed as an
argument to the function  ieee802154_alloc_hw. This argument is of type
const struct ieee802154_ops *, so ieee80254_ops structures having this
property can be declared as const.
Done using Coccinelle:

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

@ok1@
identifier r1.i;
position p;
expression e1;
@@
ieee802154_alloc_hw(e1,@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 ieee802154_ops  i={...};

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

The before and after size details of the affected files are:

   textdata bss dec hex filename
   86691176  1698612685 drivers/net/ieee802154/adf7242.o
   88051048  169869268d drivers/net/ieee802154/adf7242.o

   textdata bss dec hex filename
   72112296  3295392543 drivers/net/ieee802154/atusb.o
   73392160  329531253b drivers/net/ieee802154/atusb.o

Signed-off-by: Bhumika Goyal 
---
 drivers/net/ieee802154/adf7242.c | 2 +-
 drivers/net/ieee802154/atusb.c   | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ieee802154/adf7242.c b/drivers/net/ieee802154/adf7242.c
index 9fa7ac9..4ff4c7d 100644
--- a/drivers/net/ieee802154/adf7242.c
+++ b/drivers/net/ieee802154/adf7242.c
@@ -874,7 +874,7 @@ static int adf7242_rx(struct adf7242_local *lp)
return 0;
 }
 
-static struct ieee802154_ops adf7242_ops = {
+static const struct ieee802154_ops adf7242_ops = {
.owner = THIS_MODULE,
.xmit_sync = adf7242_xmit,
.ed = adf7242_ed,
diff --git a/drivers/net/ieee802154/atusb.c b/drivers/net/ieee802154/atusb.c
index 1056ed1..322864a 100644
--- a/drivers/net/ieee802154/atusb.c
+++ b/drivers/net/ieee802154/atusb.c
@@ -567,7 +567,7 @@ static void atusb_stop(struct ieee802154_hw *hw)
return 0;
 }
 
-static struct ieee802154_ops atusb_ops = {
+static const struct ieee802154_ops atusb_ops = {
.owner  = THIS_MODULE,
.xmit_async = atusb_xmit,
.ed = atusb_ed,
-- 
1.9.1