Re: [PATCH] irda: Convert function pointer arrays and uses to const

2014-12-10 Thread David Miller
From: Joe Perches 
Date: Wed, 10 Dec 2014 10:28:58 -0800

> Making things const is a good thing.
> 
> (x86-64 defconfig with all irda)
> $ size net/irda/built-in.o*
>text  data bss dec hex filename
>  109276  1868 244  111388   1b31c net/irda/built-in.o.new
>  108828  2316 244  111388   1b31c net/irda/built-in.o.old
> 
> Signed-off-by: Joe Perches 

Applied, thanks Joe.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] irda: Convert function pointer arrays and uses to const

2014-12-10 Thread Joe Perches
On Wed, 2014-12-10 at 19:32 +, Rustad, Mark D wrote:
> On Dec 10, 2014, at 10:28 AM, Joe Perches  wrote:
[]
> > diff --git a/include/net/irda/parameters.h b/include/net/irda/parameters.h
[]
> > typedef struct {
> > -   pi_minor_info_t *pi_minor_call_table;
> > +   const pi_minor_info_t *pi_minor_call_table;
> 
> Might you want to go a little further and make it:
>   const pi_minor_into_t * const pi_minor_call_table;
> so that the pointer itself is also constant? That could apply to some others 
> below as well.
> 
> > int len;
> > } pi_major_info_t;

I don't think that's necessary as all the pi_major_info_t uses
become const and this is a typedef, but if you want to, go ahead.


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] irda: Convert function pointer arrays and uses to const

2014-12-10 Thread Rustad, Mark D
On Dec 10, 2014, at 10:28 AM, Joe Perches  wrote:

> Making things const is a good thing.
> 
> (x86-64 defconfig with all irda)
> $ size net/irda/built-in.o*
>   text   data bss dec hex filename
> 109276   1868 244  111388   1b31c net/irda/built-in.o.new
> 108828   2316 244  111388   1b31c net/irda/built-in.o.old
> 
> Signed-off-by: Joe Perches 
> ---
> include/net/irda/parameters.h  | 6 +++---
> net/irda/ircomm/ircomm_param.c | 8 
> net/irda/irttp.c   | 6 --
> net/irda/parameters.c  | 8 
> net/irda/qos.c | 6 +++---
> 5 files changed, 18 insertions(+), 16 deletions(-)
> 
> diff --git a/include/net/irda/parameters.h b/include/net/irda/parameters.h
> index 42713c9..2d9cd00 100644
> --- a/include/net/irda/parameters.h
> +++ b/include/net/irda/parameters.h
> @@ -71,17 +71,17 @@ typedef int (*PV_HANDLER)(void *self, __u8 *buf, int len, 
> __u8 pi,
> PV_TYPE type, PI_HANDLER func);
> 
> typedef struct {
> - PI_HANDLER func;  /* Handler for this parameter identifier */
> + const PI_HANDLER func;  /* Handler for this parameter identifier */
>   PV_TYPEtype;  /* Data type for this parameter */
> } pi_minor_info_t;
> 
> typedef struct {
> - pi_minor_info_t *pi_minor_call_table;
> + const pi_minor_info_t *pi_minor_call_table;

Might you want to go a little further and make it:
const pi_minor_into_t * const pi_minor_call_table;
so that the pointer itself is also constant? That could apply to some others 
below as well.

>   int len;
> } pi_major_info_t;
> 
> typedef struct {
> - pi_major_info_t *tables;
> + const pi_major_info_t *tables;
>   int  len;
>   __u8 pi_mask;
>   int  pi_major_offset;
> diff --git a/net/irda/ircomm/ircomm_param.c b/net/irda/ircomm/ircomm_param.c
> index 27be782..3c4caa6 100644
> --- a/net/irda/ircomm/ircomm_param.c
> +++ b/net/irda/ircomm/ircomm_param.c
> @@ -61,12 +61,12 @@ static int ircomm_param_dte(void *instance, irda_param_t 
> *param, int get);
> static int ircomm_param_dce(void *instance, irda_param_t *param, int get);
> static int ircomm_param_poll(void *instance, irda_param_t *param, int get);
> 
> -static pi_minor_info_t pi_minor_call_table_common[] = {
> +static const pi_minor_info_t pi_minor_call_table_common[] = {
>   { ircomm_param_service_type, PV_INT_8_BITS },
>   { ircomm_param_port_type,PV_INT_8_BITS },
>   { ircomm_param_port_name,PV_STRING }
> };
> -static pi_minor_info_t pi_minor_call_table_non_raw[] = {
> +static const pi_minor_info_t pi_minor_call_table_non_raw[] = {
>   { ircomm_param_data_rate,PV_INT_32_BITS | PV_BIG_ENDIAN },
>   { ircomm_param_data_format,  PV_INT_8_BITS },
>   { ircomm_param_flow_control, PV_INT_8_BITS },
> @@ -74,13 +74,13 @@ static pi_minor_info_t pi_minor_call_table_non_raw[] = {
>   { ircomm_param_enq_ack,  PV_INT_16_BITS },
>   { ircomm_param_line_status,  PV_INT_8_BITS }
> };
> -static pi_minor_info_t pi_minor_call_table_9_wire[] = {
> +static const pi_minor_info_t pi_minor_call_table_9_wire[] = {
>   { ircomm_param_dte,  PV_INT_8_BITS },
>   { ircomm_param_dce,  PV_INT_8_BITS },
>   { ircomm_param_poll, PV_NO_VALUE },
> };
> 
> -static pi_major_info_t pi_major_call_table[] = {
> +static const pi_major_info_t pi_major_call_table[] = {
>   { pi_minor_call_table_common,  3 },
>   { pi_minor_call_table_non_raw, 6 },
>   { pi_minor_call_table_9_wire,  3 }
> diff --git a/net/irda/irttp.c b/net/irda/irttp.c
> index 3ef0b08..b6ab41d 100644
> --- a/net/irda/irttp.c
> +++ b/net/irda/irttp.c
> @@ -71,11 +71,13 @@ static void irttp_status_indication(void *instance,
>   LINK_STATUS link, LOCK_STATUS lock);
> 
> /* Information for parsing parameters in IrTTP */
> -static pi_minor_info_t pi_minor_call_table[] = {
> +static const pi_minor_info_t pi_minor_call_table[] = {
>   { NULL, 0 }, /* 0x00 */
>   { irttp_param_max_sdu_size, PV_INTEGER | PV_BIG_ENDIAN } /* 0x01 */
> };
> -static pi_major_info_t pi_major_call_table[] = { { pi_minor_call_table, 2 } 
> };
> +static const pi_major_info_t pi_major_call_table[] = {
> + { pi_minor_call_table, 2 }
> +};
> static pi_param_info_t param_info = { pi_major_call_table, 1, 0x0f, 4 };
> 
> / GLOBAL PROCEDURES /
> diff --git a/net/irda/parameters.c b/net/irda/parameters.c
> index 006786b..16ce32f 100644
> --- a/net/irda/parameters.c
> +++ b/net/irda/parameters.c
> @@ -52,7 +52,7 @@ static int irda_insert_no_value(void *self, __u8 *buf, int 
> len, __u8 pi,
> static int irda_param_unpack(__u8 *buf, char *fmt, ...);
> 
> /* Parameter value call table. Must match PV_TYPE */
> -static PV_HANDLER pv_extract_table[] = {
> +static const PV_HANDLER pv_extract_table[] = {
>   

[PATCH] irda: Convert function pointer arrays and uses to const

2014-12-10 Thread Joe Perches
Making things const is a good thing.

(x86-64 defconfig with all irda)
$ size net/irda/built-in.o*
   textdata bss dec hex filename
 1092761868 244  111388   1b31c net/irda/built-in.o.new
 1088282316 244  111388   1b31c net/irda/built-in.o.old

Signed-off-by: Joe Perches 
---
 include/net/irda/parameters.h  | 6 +++---
 net/irda/ircomm/ircomm_param.c | 8 
 net/irda/irttp.c   | 6 --
 net/irda/parameters.c  | 8 
 net/irda/qos.c | 6 +++---
 5 files changed, 18 insertions(+), 16 deletions(-)

diff --git a/include/net/irda/parameters.h b/include/net/irda/parameters.h
index 42713c9..2d9cd00 100644
--- a/include/net/irda/parameters.h
+++ b/include/net/irda/parameters.h
@@ -71,17 +71,17 @@ typedef int (*PV_HANDLER)(void *self, __u8 *buf, int len, 
__u8 pi,
  PV_TYPE type, PI_HANDLER func);
 
 typedef struct {
-   PI_HANDLER func;  /* Handler for this parameter identifier */
+   const PI_HANDLER func;  /* Handler for this parameter identifier */
PV_TYPEtype;  /* Data type for this parameter */
 } pi_minor_info_t;
 
 typedef struct {
-   pi_minor_info_t *pi_minor_call_table;
+   const pi_minor_info_t *pi_minor_call_table;
int len;
 } pi_major_info_t;
 
 typedef struct {
-   pi_major_info_t *tables;
+   const pi_major_info_t *tables;
int  len;
__u8 pi_mask;
int  pi_major_offset;
diff --git a/net/irda/ircomm/ircomm_param.c b/net/irda/ircomm/ircomm_param.c
index 27be782..3c4caa6 100644
--- a/net/irda/ircomm/ircomm_param.c
+++ b/net/irda/ircomm/ircomm_param.c
@@ -61,12 +61,12 @@ static int ircomm_param_dte(void *instance, irda_param_t 
*param, int get);
 static int ircomm_param_dce(void *instance, irda_param_t *param, int get);
 static int ircomm_param_poll(void *instance, irda_param_t *param, int get);
 
-static pi_minor_info_t pi_minor_call_table_common[] = {
+static const pi_minor_info_t pi_minor_call_table_common[] = {
{ ircomm_param_service_type, PV_INT_8_BITS },
{ ircomm_param_port_type,PV_INT_8_BITS },
{ ircomm_param_port_name,PV_STRING }
 };
-static pi_minor_info_t pi_minor_call_table_non_raw[] = {
+static const pi_minor_info_t pi_minor_call_table_non_raw[] = {
{ ircomm_param_data_rate,PV_INT_32_BITS | PV_BIG_ENDIAN },
{ ircomm_param_data_format,  PV_INT_8_BITS },
{ ircomm_param_flow_control, PV_INT_8_BITS },
@@ -74,13 +74,13 @@ static pi_minor_info_t pi_minor_call_table_non_raw[] = {
{ ircomm_param_enq_ack,  PV_INT_16_BITS },
{ ircomm_param_line_status,  PV_INT_8_BITS }
 };
-static pi_minor_info_t pi_minor_call_table_9_wire[] = {
+static const pi_minor_info_t pi_minor_call_table_9_wire[] = {
{ ircomm_param_dte,  PV_INT_8_BITS },
{ ircomm_param_dce,  PV_INT_8_BITS },
{ ircomm_param_poll, PV_NO_VALUE },
 };
 
-static pi_major_info_t pi_major_call_table[] = {
+static const pi_major_info_t pi_major_call_table[] = {
{ pi_minor_call_table_common,  3 },
{ pi_minor_call_table_non_raw, 6 },
{ pi_minor_call_table_9_wire,  3 }
diff --git a/net/irda/irttp.c b/net/irda/irttp.c
index 3ef0b08..b6ab41d 100644
--- a/net/irda/irttp.c
+++ b/net/irda/irttp.c
@@ -71,11 +71,13 @@ static void irttp_status_indication(void *instance,
LINK_STATUS link, LOCK_STATUS lock);
 
 /* Information for parsing parameters in IrTTP */
-static pi_minor_info_t pi_minor_call_table[] = {
+static const pi_minor_info_t pi_minor_call_table[] = {
{ NULL, 0 }, /* 0x00 */
{ irttp_param_max_sdu_size, PV_INTEGER | PV_BIG_ENDIAN } /* 0x01 */
 };
-static pi_major_info_t pi_major_call_table[] = { { pi_minor_call_table, 2 } };
+static const pi_major_info_t pi_major_call_table[] = {
+   { pi_minor_call_table, 2 }
+};
 static pi_param_info_t param_info = { pi_major_call_table, 1, 0x0f, 4 };
 
 / GLOBAL PROCEDURES /
diff --git a/net/irda/parameters.c b/net/irda/parameters.c
index 006786b..16ce32f 100644
--- a/net/irda/parameters.c
+++ b/net/irda/parameters.c
@@ -52,7 +52,7 @@ static int irda_insert_no_value(void *self, __u8 *buf, int 
len, __u8 pi,
 static int irda_param_unpack(__u8 *buf, char *fmt, ...);
 
 /* Parameter value call table. Must match PV_TYPE */
-static PV_HANDLER pv_extract_table[] = {
+static const PV_HANDLER pv_extract_table[] = {
irda_extract_integer, /* Handler for any length integers */
irda_extract_integer, /* Handler for 8  bits integers */
irda_extract_integer, /* Handler for 16 bits integers */
@@ -62,7 +62,7 @@ static PV_HANDLER pv_extract_table[] = {
irda_extract_no_value /* Handler for no value parameters */
 };
 
-static PV_HANDLER pv_insert_table[] = {
+static const PV_HANDLER pv_insert_table[] = {
  

[PATCH] irda: Convert function pointer arrays and uses to const

2014-12-10 Thread Joe Perches
Making things const is a good thing.

(x86-64 defconfig with all irda)
$ size net/irda/built-in.o*
   textdata bss dec hex filename
 1092761868 244  111388   1b31c net/irda/built-in.o.new
 1088282316 244  111388   1b31c net/irda/built-in.o.old

Signed-off-by: Joe Perches j...@perches.com
---
 include/net/irda/parameters.h  | 6 +++---
 net/irda/ircomm/ircomm_param.c | 8 
 net/irda/irttp.c   | 6 --
 net/irda/parameters.c  | 8 
 net/irda/qos.c | 6 +++---
 5 files changed, 18 insertions(+), 16 deletions(-)

diff --git a/include/net/irda/parameters.h b/include/net/irda/parameters.h
index 42713c9..2d9cd00 100644
--- a/include/net/irda/parameters.h
+++ b/include/net/irda/parameters.h
@@ -71,17 +71,17 @@ typedef int (*PV_HANDLER)(void *self, __u8 *buf, int len, 
__u8 pi,
  PV_TYPE type, PI_HANDLER func);
 
 typedef struct {
-   PI_HANDLER func;  /* Handler for this parameter identifier */
+   const PI_HANDLER func;  /* Handler for this parameter identifier */
PV_TYPEtype;  /* Data type for this parameter */
 } pi_minor_info_t;
 
 typedef struct {
-   pi_minor_info_t *pi_minor_call_table;
+   const pi_minor_info_t *pi_minor_call_table;
int len;
 } pi_major_info_t;
 
 typedef struct {
-   pi_major_info_t *tables;
+   const pi_major_info_t *tables;
int  len;
__u8 pi_mask;
int  pi_major_offset;
diff --git a/net/irda/ircomm/ircomm_param.c b/net/irda/ircomm/ircomm_param.c
index 27be782..3c4caa6 100644
--- a/net/irda/ircomm/ircomm_param.c
+++ b/net/irda/ircomm/ircomm_param.c
@@ -61,12 +61,12 @@ static int ircomm_param_dte(void *instance, irda_param_t 
*param, int get);
 static int ircomm_param_dce(void *instance, irda_param_t *param, int get);
 static int ircomm_param_poll(void *instance, irda_param_t *param, int get);
 
-static pi_minor_info_t pi_minor_call_table_common[] = {
+static const pi_minor_info_t pi_minor_call_table_common[] = {
{ ircomm_param_service_type, PV_INT_8_BITS },
{ ircomm_param_port_type,PV_INT_8_BITS },
{ ircomm_param_port_name,PV_STRING }
 };
-static pi_minor_info_t pi_minor_call_table_non_raw[] = {
+static const pi_minor_info_t pi_minor_call_table_non_raw[] = {
{ ircomm_param_data_rate,PV_INT_32_BITS | PV_BIG_ENDIAN },
{ ircomm_param_data_format,  PV_INT_8_BITS },
{ ircomm_param_flow_control, PV_INT_8_BITS },
@@ -74,13 +74,13 @@ static pi_minor_info_t pi_minor_call_table_non_raw[] = {
{ ircomm_param_enq_ack,  PV_INT_16_BITS },
{ ircomm_param_line_status,  PV_INT_8_BITS }
 };
-static pi_minor_info_t pi_minor_call_table_9_wire[] = {
+static const pi_minor_info_t pi_minor_call_table_9_wire[] = {
{ ircomm_param_dte,  PV_INT_8_BITS },
{ ircomm_param_dce,  PV_INT_8_BITS },
{ ircomm_param_poll, PV_NO_VALUE },
 };
 
-static pi_major_info_t pi_major_call_table[] = {
+static const pi_major_info_t pi_major_call_table[] = {
{ pi_minor_call_table_common,  3 },
{ pi_minor_call_table_non_raw, 6 },
{ pi_minor_call_table_9_wire,  3 }
diff --git a/net/irda/irttp.c b/net/irda/irttp.c
index 3ef0b08..b6ab41d 100644
--- a/net/irda/irttp.c
+++ b/net/irda/irttp.c
@@ -71,11 +71,13 @@ static void irttp_status_indication(void *instance,
LINK_STATUS link, LOCK_STATUS lock);
 
 /* Information for parsing parameters in IrTTP */
-static pi_minor_info_t pi_minor_call_table[] = {
+static const pi_minor_info_t pi_minor_call_table[] = {
{ NULL, 0 }, /* 0x00 */
{ irttp_param_max_sdu_size, PV_INTEGER | PV_BIG_ENDIAN } /* 0x01 */
 };
-static pi_major_info_t pi_major_call_table[] = { { pi_minor_call_table, 2 } };
+static const pi_major_info_t pi_major_call_table[] = {
+   { pi_minor_call_table, 2 }
+};
 static pi_param_info_t param_info = { pi_major_call_table, 1, 0x0f, 4 };
 
 / GLOBAL PROCEDURES /
diff --git a/net/irda/parameters.c b/net/irda/parameters.c
index 006786b..16ce32f 100644
--- a/net/irda/parameters.c
+++ b/net/irda/parameters.c
@@ -52,7 +52,7 @@ static int irda_insert_no_value(void *self, __u8 *buf, int 
len, __u8 pi,
 static int irda_param_unpack(__u8 *buf, char *fmt, ...);
 
 /* Parameter value call table. Must match PV_TYPE */
-static PV_HANDLER pv_extract_table[] = {
+static const PV_HANDLER pv_extract_table[] = {
irda_extract_integer, /* Handler for any length integers */
irda_extract_integer, /* Handler for 8  bits integers */
irda_extract_integer, /* Handler for 16 bits integers */
@@ -62,7 +62,7 @@ static PV_HANDLER pv_extract_table[] = {
irda_extract_no_value /* Handler for no value parameters */
 };
 
-static PV_HANDLER pv_insert_table[] = {
+static const PV_HANDLER 

Re: [PATCH] irda: Convert function pointer arrays and uses to const

2014-12-10 Thread Rustad, Mark D
On Dec 10, 2014, at 10:28 AM, Joe Perches j...@perches.com wrote:

 Making things const is a good thing.
 
 (x86-64 defconfig with all irda)
 $ size net/irda/built-in.o*
   text   data bss dec hex filename
 109276   1868 244  111388   1b31c net/irda/built-in.o.new
 108828   2316 244  111388   1b31c net/irda/built-in.o.old
 
 Signed-off-by: Joe Perches j...@perches.com
 ---
 include/net/irda/parameters.h  | 6 +++---
 net/irda/ircomm/ircomm_param.c | 8 
 net/irda/irttp.c   | 6 --
 net/irda/parameters.c  | 8 
 net/irda/qos.c | 6 +++---
 5 files changed, 18 insertions(+), 16 deletions(-)
 
 diff --git a/include/net/irda/parameters.h b/include/net/irda/parameters.h
 index 42713c9..2d9cd00 100644
 --- a/include/net/irda/parameters.h
 +++ b/include/net/irda/parameters.h
 @@ -71,17 +71,17 @@ typedef int (*PV_HANDLER)(void *self, __u8 *buf, int len, 
 __u8 pi,
 PV_TYPE type, PI_HANDLER func);
 
 typedef struct {
 - PI_HANDLER func;  /* Handler for this parameter identifier */
 + const PI_HANDLER func;  /* Handler for this parameter identifier */
   PV_TYPEtype;  /* Data type for this parameter */
 } pi_minor_info_t;
 
 typedef struct {
 - pi_minor_info_t *pi_minor_call_table;
 + const pi_minor_info_t *pi_minor_call_table;

Might you want to go a little further and make it:
const pi_minor_into_t * const pi_minor_call_table;
so that the pointer itself is also constant? That could apply to some others 
below as well.

   int len;
 } pi_major_info_t;
 
 typedef struct {
 - pi_major_info_t *tables;
 + const pi_major_info_t *tables;
   int  len;
   __u8 pi_mask;
   int  pi_major_offset;
 diff --git a/net/irda/ircomm/ircomm_param.c b/net/irda/ircomm/ircomm_param.c
 index 27be782..3c4caa6 100644
 --- a/net/irda/ircomm/ircomm_param.c
 +++ b/net/irda/ircomm/ircomm_param.c
 @@ -61,12 +61,12 @@ static int ircomm_param_dte(void *instance, irda_param_t 
 *param, int get);
 static int ircomm_param_dce(void *instance, irda_param_t *param, int get);
 static int ircomm_param_poll(void *instance, irda_param_t *param, int get);
 
 -static pi_minor_info_t pi_minor_call_table_common[] = {
 +static const pi_minor_info_t pi_minor_call_table_common[] = {
   { ircomm_param_service_type, PV_INT_8_BITS },
   { ircomm_param_port_type,PV_INT_8_BITS },
   { ircomm_param_port_name,PV_STRING }
 };
 -static pi_minor_info_t pi_minor_call_table_non_raw[] = {
 +static const pi_minor_info_t pi_minor_call_table_non_raw[] = {
   { ircomm_param_data_rate,PV_INT_32_BITS | PV_BIG_ENDIAN },
   { ircomm_param_data_format,  PV_INT_8_BITS },
   { ircomm_param_flow_control, PV_INT_8_BITS },
 @@ -74,13 +74,13 @@ static pi_minor_info_t pi_minor_call_table_non_raw[] = {
   { ircomm_param_enq_ack,  PV_INT_16_BITS },
   { ircomm_param_line_status,  PV_INT_8_BITS }
 };
 -static pi_minor_info_t pi_minor_call_table_9_wire[] = {
 +static const pi_minor_info_t pi_minor_call_table_9_wire[] = {
   { ircomm_param_dte,  PV_INT_8_BITS },
   { ircomm_param_dce,  PV_INT_8_BITS },
   { ircomm_param_poll, PV_NO_VALUE },
 };
 
 -static pi_major_info_t pi_major_call_table[] = {
 +static const pi_major_info_t pi_major_call_table[] = {
   { pi_minor_call_table_common,  3 },
   { pi_minor_call_table_non_raw, 6 },
   { pi_minor_call_table_9_wire,  3 }
 diff --git a/net/irda/irttp.c b/net/irda/irttp.c
 index 3ef0b08..b6ab41d 100644
 --- a/net/irda/irttp.c
 +++ b/net/irda/irttp.c
 @@ -71,11 +71,13 @@ static void irttp_status_indication(void *instance,
   LINK_STATUS link, LOCK_STATUS lock);
 
 /* Information for parsing parameters in IrTTP */
 -static pi_minor_info_t pi_minor_call_table[] = {
 +static const pi_minor_info_t pi_minor_call_table[] = {
   { NULL, 0 }, /* 0x00 */
   { irttp_param_max_sdu_size, PV_INTEGER | PV_BIG_ENDIAN } /* 0x01 */
 };
 -static pi_major_info_t pi_major_call_table[] = { { pi_minor_call_table, 2 } 
 };
 +static const pi_major_info_t pi_major_call_table[] = {
 + { pi_minor_call_table, 2 }
 +};
 static pi_param_info_t param_info = { pi_major_call_table, 1, 0x0f, 4 };
 
 / GLOBAL PROCEDURES /
 diff --git a/net/irda/parameters.c b/net/irda/parameters.c
 index 006786b..16ce32f 100644
 --- a/net/irda/parameters.c
 +++ b/net/irda/parameters.c
 @@ -52,7 +52,7 @@ static int irda_insert_no_value(void *self, __u8 *buf, int 
 len, __u8 pi,
 static int irda_param_unpack(__u8 *buf, char *fmt, ...);
 
 /* Parameter value call table. Must match PV_TYPE */
 -static PV_HANDLER pv_extract_table[] = {
 +static const PV_HANDLER pv_extract_table[] = {
   irda_extract_integer, /* Handler for any length integers */
   

Re: [PATCH] irda: Convert function pointer arrays and uses to const

2014-12-10 Thread Joe Perches
On Wed, 2014-12-10 at 19:32 +, Rustad, Mark D wrote:
 On Dec 10, 2014, at 10:28 AM, Joe Perches j...@perches.com wrote:
[]
  diff --git a/include/net/irda/parameters.h b/include/net/irda/parameters.h
[]
  typedef struct {
  -   pi_minor_info_t *pi_minor_call_table;
  +   const pi_minor_info_t *pi_minor_call_table;
 
 Might you want to go a little further and make it:
   const pi_minor_into_t * const pi_minor_call_table;
 so that the pointer itself is also constant? That could apply to some others 
 below as well.
 
  int len;
  } pi_major_info_t;

I don't think that's necessary as all the pi_major_info_t uses
become const and this is a typedef, but if you want to, go ahead.


--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] irda: Convert function pointer arrays and uses to const

2014-12-10 Thread David Miller
From: Joe Perches j...@perches.com
Date: Wed, 10 Dec 2014 10:28:58 -0800

 Making things const is a good thing.
 
 (x86-64 defconfig with all irda)
 $ size net/irda/built-in.o*
text  data bss dec hex filename
  109276  1868 244  111388   1b31c net/irda/built-in.o.new
  108828  2316 244  111388   1b31c net/irda/built-in.o.old
 
 Signed-off-by: Joe Perches j...@perches.com

Applied, thanks Joe.
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/