aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoe Perches <joe@perches.com>2014-12-10 13:28:58 -0500
committerDavid S. Miller <davem@davemloft.net>2014-12-10 15:33:16 -0500
commit785c20a08bead1e58ad53f2dc324782da7a0c9ea (patch)
tree1fbf9ac09b89dea8754927e84a54c15ad3e47d0a
parent22bbf5f3e4e4db4a94f18d7b1ba21b5bd5fd934b (diff)
irda: Convert function pointer arrays and uses to const
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>
-rw-r--r--include/net/irda/parameters.h6
-rw-r--r--net/irda/ircomm/ircomm_param.c8
-rw-r--r--net/irda/irttp.c6
-rw-r--r--net/irda/parameters.c8
-rw-r--r--net/irda/qos.c6
5 files changed, 18 insertions, 16 deletions
diff --git a/include/net/irda/parameters.h b/include/net/irda/parameters.h
index 42713c931d1f..2d9cd0007cba 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,
71 PV_TYPE type, PI_HANDLER func); 71 PV_TYPE type, PI_HANDLER func);
72 72
73typedef struct { 73typedef struct {
74 PI_HANDLER func; /* Handler for this parameter identifier */ 74 const PI_HANDLER func; /* Handler for this parameter identifier */
75 PV_TYPE type; /* Data type for this parameter */ 75 PV_TYPE type; /* Data type for this parameter */
76} pi_minor_info_t; 76} pi_minor_info_t;
77 77
78typedef struct { 78typedef struct {
79 pi_minor_info_t *pi_minor_call_table; 79 const pi_minor_info_t *pi_minor_call_table;
80 int len; 80 int len;
81} pi_major_info_t; 81} pi_major_info_t;
82 82
83typedef struct { 83typedef struct {
84 pi_major_info_t *tables; 84 const pi_major_info_t *tables;
85 int len; 85 int len;
86 __u8 pi_mask; 86 __u8 pi_mask;
87 int pi_major_offset; 87 int pi_major_offset;
diff --git a/net/irda/ircomm/ircomm_param.c b/net/irda/ircomm/ircomm_param.c
index 27be782be7e7..3c4caa60c926 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);
61static int ircomm_param_dce(void *instance, irda_param_t *param, int get); 61static int ircomm_param_dce(void *instance, irda_param_t *param, int get);
62static int ircomm_param_poll(void *instance, irda_param_t *param, int get); 62static int ircomm_param_poll(void *instance, irda_param_t *param, int get);
63 63
64static pi_minor_info_t pi_minor_call_table_common[] = { 64static const pi_minor_info_t pi_minor_call_table_common[] = {
65 { ircomm_param_service_type, PV_INT_8_BITS }, 65 { ircomm_param_service_type, PV_INT_8_BITS },
66 { ircomm_param_port_type, PV_INT_8_BITS }, 66 { ircomm_param_port_type, PV_INT_8_BITS },
67 { ircomm_param_port_name, PV_STRING } 67 { ircomm_param_port_name, PV_STRING }
68}; 68};
69static pi_minor_info_t pi_minor_call_table_non_raw[] = { 69static const pi_minor_info_t pi_minor_call_table_non_raw[] = {
70 { ircomm_param_data_rate, PV_INT_32_BITS | PV_BIG_ENDIAN }, 70 { ircomm_param_data_rate, PV_INT_32_BITS | PV_BIG_ENDIAN },
71 { ircomm_param_data_format, PV_INT_8_BITS }, 71 { ircomm_param_data_format, PV_INT_8_BITS },
72 { ircomm_param_flow_control, PV_INT_8_BITS }, 72 { ircomm_param_flow_control, PV_INT_8_BITS },
@@ -74,13 +74,13 @@ static pi_minor_info_t pi_minor_call_table_non_raw[] = {
74 { ircomm_param_enq_ack, PV_INT_16_BITS }, 74 { ircomm_param_enq_ack, PV_INT_16_BITS },
75 { ircomm_param_line_status, PV_INT_8_BITS } 75 { ircomm_param_line_status, PV_INT_8_BITS }
76}; 76};
77static pi_minor_info_t pi_minor_call_table_9_wire[] = { 77static const pi_minor_info_t pi_minor_call_table_9_wire[] = {
78 { ircomm_param_dte, PV_INT_8_BITS }, 78 { ircomm_param_dte, PV_INT_8_BITS },
79 { ircomm_param_dce, PV_INT_8_BITS }, 79 { ircomm_param_dce, PV_INT_8_BITS },
80 { ircomm_param_poll, PV_NO_VALUE }, 80 { ircomm_param_poll, PV_NO_VALUE },
81}; 81};
82 82
83static pi_major_info_t pi_major_call_table[] = { 83static const pi_major_info_t pi_major_call_table[] = {
84 { pi_minor_call_table_common, 3 }, 84 { pi_minor_call_table_common, 3 },
85 { pi_minor_call_table_non_raw, 6 }, 85 { pi_minor_call_table_non_raw, 6 },
86 { pi_minor_call_table_9_wire, 3 } 86 { pi_minor_call_table_9_wire, 3 }
diff --git a/net/irda/irttp.c b/net/irda/irttp.c
index 3ef0b08b6bf5..b6ab41d5b3a3 100644
--- a/net/irda/irttp.c
+++ b/net/irda/irttp.c
@@ -71,11 +71,13 @@ static void irttp_status_indication(void *instance,
71 LINK_STATUS link, LOCK_STATUS lock); 71 LINK_STATUS link, LOCK_STATUS lock);
72 72
73/* Information for parsing parameters in IrTTP */ 73/* Information for parsing parameters in IrTTP */
74static pi_minor_info_t pi_minor_call_table[] = { 74static const pi_minor_info_t pi_minor_call_table[] = {
75 { NULL, 0 }, /* 0x00 */ 75 { NULL, 0 }, /* 0x00 */
76 { irttp_param_max_sdu_size, PV_INTEGER | PV_BIG_ENDIAN } /* 0x01 */ 76 { irttp_param_max_sdu_size, PV_INTEGER | PV_BIG_ENDIAN } /* 0x01 */
77}; 77};
78static pi_major_info_t pi_major_call_table[] = { { pi_minor_call_table, 2 } }; 78static const pi_major_info_t pi_major_call_table[] = {
79 { pi_minor_call_table, 2 }
80};
79static pi_param_info_t param_info = { pi_major_call_table, 1, 0x0f, 4 }; 81static pi_param_info_t param_info = { pi_major_call_table, 1, 0x0f, 4 };
80 82
81/************************ GLOBAL PROCEDURES ************************/ 83/************************ GLOBAL PROCEDURES ************************/
diff --git a/net/irda/parameters.c b/net/irda/parameters.c
index 006786bfdd65..16ce32ffe004 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,
52static int irda_param_unpack(__u8 *buf, char *fmt, ...); 52static int irda_param_unpack(__u8 *buf, char *fmt, ...);
53 53
54/* Parameter value call table. Must match PV_TYPE */ 54/* Parameter value call table. Must match PV_TYPE */
55static PV_HANDLER pv_extract_table[] = { 55static const PV_HANDLER pv_extract_table[] = {
56 irda_extract_integer, /* Handler for any length integers */ 56 irda_extract_integer, /* Handler for any length integers */
57 irda_extract_integer, /* Handler for 8 bits integers */ 57 irda_extract_integer, /* Handler for 8 bits integers */
58 irda_extract_integer, /* Handler for 16 bits integers */ 58 irda_extract_integer, /* Handler for 16 bits integers */
@@ -62,7 +62,7 @@ static PV_HANDLER pv_extract_table[] = {
62 irda_extract_no_value /* Handler for no value parameters */ 62 irda_extract_no_value /* Handler for no value parameters */
63}; 63};
64 64
65static PV_HANDLER pv_insert_table[] = { 65static const PV_HANDLER pv_insert_table[] = {
66 irda_insert_integer, /* Handler for any length integers */ 66 irda_insert_integer, /* Handler for any length integers */
67 irda_insert_integer, /* Handler for 8 bits integers */ 67 irda_insert_integer, /* Handler for 8 bits integers */
68 irda_insert_integer, /* Handler for 16 bits integers */ 68 irda_insert_integer, /* Handler for 16 bits integers */
@@ -449,7 +449,7 @@ static int irda_param_unpack(__u8 *buf, char *fmt, ...)
449int irda_param_insert(void *self, __u8 pi, __u8 *buf, int len, 449int irda_param_insert(void *self, __u8 pi, __u8 *buf, int len,
450 pi_param_info_t *info) 450 pi_param_info_t *info)
451{ 451{
452 pi_minor_info_t *pi_minor_info; 452 const pi_minor_info_t *pi_minor_info;
453 __u8 pi_minor; 453 __u8 pi_minor;
454 __u8 pi_major; 454 __u8 pi_major;
455 int type; 455 int type;
@@ -504,7 +504,7 @@ EXPORT_SYMBOL(irda_param_insert);
504static int irda_param_extract(void *self, __u8 *buf, int len, 504static int irda_param_extract(void *self, __u8 *buf, int len,
505 pi_param_info_t *info) 505 pi_param_info_t *info)
506{ 506{
507 pi_minor_info_t *pi_minor_info; 507 const pi_minor_info_t *pi_minor_info;
508 __u8 pi_minor; 508 __u8 pi_minor;
509 __u8 pi_major; 509 __u8 pi_major;
510 int type; 510 int type;
diff --git a/net/irda/qos.c b/net/irda/qos.c
index 5ed6c9a7baee..25ba8509ad3e 100644
--- a/net/irda/qos.c
+++ b/net/irda/qos.c
@@ -122,7 +122,7 @@ static __u32 max_line_capacities[10][4] = {
122 { 800000, 400000, 160000, 80000 }, /* 16000000 bps */ 122 { 800000, 400000, 160000, 80000 }, /* 16000000 bps */
123}; 123};
124 124
125static pi_minor_info_t pi_minor_call_table_type_0[] = { 125static const pi_minor_info_t pi_minor_call_table_type_0[] = {
126 { NULL, 0 }, 126 { NULL, 0 },
127/* 01 */{ irlap_param_baud_rate, PV_INTEGER | PV_LITTLE_ENDIAN }, 127/* 01 */{ irlap_param_baud_rate, PV_INTEGER | PV_LITTLE_ENDIAN },
128 { NULL, 0 }, 128 { NULL, 0 },
@@ -134,7 +134,7 @@ static pi_minor_info_t pi_minor_call_table_type_0[] = {
134/* 08 */{ irlap_param_link_disconnect, PV_INT_8_BITS } 134/* 08 */{ irlap_param_link_disconnect, PV_INT_8_BITS }
135}; 135};
136 136
137static pi_minor_info_t pi_minor_call_table_type_1[] = { 137static const pi_minor_info_t pi_minor_call_table_type_1[] = {
138 { NULL, 0 }, 138 { NULL, 0 },
139 { NULL, 0 }, 139 { NULL, 0 },
140/* 82 */{ irlap_param_max_turn_time, PV_INT_8_BITS }, 140/* 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[] = {
144/* 86 */{ irlap_param_min_turn_time, PV_INT_8_BITS }, 144/* 86 */{ irlap_param_min_turn_time, PV_INT_8_BITS },
145}; 145};
146 146
147static pi_major_info_t pi_major_call_table[] = { 147static const pi_major_info_t pi_major_call_table[] = {
148 { pi_minor_call_table_type_0, 9 }, 148 { pi_minor_call_table_type_0, 9 },
149 { pi_minor_call_table_type_1, 7 }, 149 { pi_minor_call_table_type_1, 7 },
150}; 150};