irda: Convert function pointer arrays and uses to const
authorJoe Perches <joe@perches.com>
Wed, 10 Dec 2014 18:28:58 +0000 (10:28 -0800)
committerDavid S. Miller <davem@davemloft.net>
Wed, 10 Dec 2014 20:33:16 +0000 (15:33 -0500)
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 <joe@perches.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
include/net/irda/parameters.h
net/irda/ircomm/ircomm_param.c
net/irda/irttp.c
net/irda/parameters.c
net/irda/qos.c

index 42713c931d1fee497f000b242204c7b14416ae1d..2d9cd0007cba6ad984635278c95d57e61576142b 100644 (file)
@@ -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_TYPE    type;  /* 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;
index 27be782be7e7e4125a8f2b254eb0aa9aec0edba1..3c4caa60c9265dd95f62d7a3aba84d40cdba0492 100644 (file)
@@ -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 }
index 3ef0b08b6bf5b703ecc82beb33f5b950ec88ffcb..b6ab41d5b3a34afcc7f3e94324e3965697e37bd2 100644 (file)
@@ -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 ************************/
index 006786bfdd6579cdf4a240e12441aa02af31992e..16ce32ffe004484c20618a4f2c00adecea13dec8 100644 (file)
@@ -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[] = {
        irda_insert_integer, /* Handler for any length integers */
        irda_insert_integer, /* Handler for 8  bits integers */
        irda_insert_integer, /* Handler for 16 bits integers */
@@ -449,7 +449,7 @@ static int irda_param_unpack(__u8 *buf, char *fmt, ...)
 int irda_param_insert(void *self, __u8 pi, __u8 *buf, int len,
                      pi_param_info_t *info)
 {
-       pi_minor_info_t *pi_minor_info;
+       const pi_minor_info_t *pi_minor_info;
        __u8 pi_minor;
        __u8 pi_major;
        int type;
@@ -504,7 +504,7 @@ EXPORT_SYMBOL(irda_param_insert);
 static int irda_param_extract(void *self, __u8 *buf, int len,
                              pi_param_info_t *info)
 {
-       pi_minor_info_t *pi_minor_info;
+       const pi_minor_info_t *pi_minor_info;
        __u8 pi_minor;
        __u8 pi_major;
        int type;
index 5ed6c9a7baee1885ecb394a50e3fc7d58db798b3..25ba8509ad3e49536459674fb11c9df4a98f118b 100644 (file)
@@ -122,7 +122,7 @@ static __u32 max_line_capacities[10][4] = {
        { 800000, 400000, 160000, 80000 }, /* 16000000 bps */
 };
 
-static pi_minor_info_t pi_minor_call_table_type_0[] = {
+static const pi_minor_info_t pi_minor_call_table_type_0[] = {
        { NULL, 0 },
 /* 01 */{ irlap_param_baud_rate,       PV_INTEGER | PV_LITTLE_ENDIAN },
        { NULL, 0 },
@@ -134,7 +134,7 @@ static pi_minor_info_t pi_minor_call_table_type_0[] = {
 /* 08 */{ irlap_param_link_disconnect, PV_INT_8_BITS }
 };
 
-static pi_minor_info_t pi_minor_call_table_type_1[] = {
+static const pi_minor_info_t pi_minor_call_table_type_1[] = {
        { NULL, 0 },
        { NULL, 0 },
 /* 82 */{ irlap_param_max_turn_time,   PV_INT_8_BITS },
@@ -144,7 +144,7 @@ static pi_minor_info_t pi_minor_call_table_type_1[] = {
 /* 86 */{ irlap_param_min_turn_time,   PV_INT_8_BITS },
 };
 
-static pi_major_info_t pi_major_call_table[] = {
+static const pi_major_info_t pi_major_call_table[] = {
        { pi_minor_call_table_type_0, 9 },
        { pi_minor_call_table_type_1, 7 },
 };