diff options
author | Paul Gortmaker <paul.gortmaker@windriver.com> | 2012-02-23 15:44:08 -0500 |
---|---|---|
committer | Paul Gortmaker <paul.gortmaker@windriver.com> | 2012-02-24 17:05:14 -0500 |
commit | 732efba4d77e1b0857984c401a7b18784f51b075 (patch) | |
tree | 23ae37b3a90b3648c7f48c6241f27ae755e424a7 /net/tipc | |
parent | f80c24d9964c8a15c55d1afc2dea327c5eff7d6b (diff) |
tipc: nuke the delimit static inline function.
This "shortform" is actually longer than typing out what it is really
trying to do, and just makes reading the code more difficult, so
lets simply shoot it in the head.
In the case of log.c - the comparison is on a u32, so we can drop the
check for < 0 at the same time.
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
Diffstat (limited to 'net/tipc')
-rw-r--r-- | net/tipc/config.c | 8 | ||||
-rw-r--r-- | net/tipc/core.h | 10 | ||||
-rw-r--r-- | net/tipc/log.c | 2 |
3 files changed, 5 insertions, 15 deletions
diff --git a/net/tipc/config.c b/net/tipc/config.c index 9fefd32e9b2e..69cca4f67e8e 100644 --- a/net/tipc/config.c +++ b/net/tipc/config.c | |||
@@ -218,7 +218,7 @@ static struct sk_buff *cfg_set_max_publications(void) | |||
218 | return tipc_cfg_reply_error_string(TIPC_CFG_TLV_ERROR); | 218 | return tipc_cfg_reply_error_string(TIPC_CFG_TLV_ERROR); |
219 | 219 | ||
220 | value = ntohl(*(__be32 *)TLV_DATA(req_tlv_area)); | 220 | value = ntohl(*(__be32 *)TLV_DATA(req_tlv_area)); |
221 | if (value != delimit(value, 1, 65535)) | 221 | if (value < 1 || value > 65535) |
222 | return tipc_cfg_reply_error_string(TIPC_CFG_INVALID_VALUE | 222 | return tipc_cfg_reply_error_string(TIPC_CFG_INVALID_VALUE |
223 | " (max publications must be 1-65535)"); | 223 | " (max publications must be 1-65535)"); |
224 | tipc_max_publications = value; | 224 | tipc_max_publications = value; |
@@ -233,7 +233,7 @@ static struct sk_buff *cfg_set_max_subscriptions(void) | |||
233 | return tipc_cfg_reply_error_string(TIPC_CFG_TLV_ERROR); | 233 | return tipc_cfg_reply_error_string(TIPC_CFG_TLV_ERROR); |
234 | 234 | ||
235 | value = ntohl(*(__be32 *)TLV_DATA(req_tlv_area)); | 235 | value = ntohl(*(__be32 *)TLV_DATA(req_tlv_area)); |
236 | if (value != delimit(value, 1, 65535)) | 236 | if (value < 1 || value > 65535) |
237 | return tipc_cfg_reply_error_string(TIPC_CFG_INVALID_VALUE | 237 | return tipc_cfg_reply_error_string(TIPC_CFG_INVALID_VALUE |
238 | " (max subscriptions must be 1-65535"); | 238 | " (max subscriptions must be 1-65535"); |
239 | tipc_max_subscriptions = value; | 239 | tipc_max_subscriptions = value; |
@@ -249,7 +249,7 @@ static struct sk_buff *cfg_set_max_ports(void) | |||
249 | value = ntohl(*(__be32 *)TLV_DATA(req_tlv_area)); | 249 | value = ntohl(*(__be32 *)TLV_DATA(req_tlv_area)); |
250 | if (value == tipc_max_ports) | 250 | if (value == tipc_max_ports) |
251 | return tipc_cfg_reply_none(); | 251 | return tipc_cfg_reply_none(); |
252 | if (value != delimit(value, 127, 65535)) | 252 | if (value < 127 || value > 65535) |
253 | return tipc_cfg_reply_error_string(TIPC_CFG_INVALID_VALUE | 253 | return tipc_cfg_reply_error_string(TIPC_CFG_INVALID_VALUE |
254 | " (max ports must be 127-65535)"); | 254 | " (max ports must be 127-65535)"); |
255 | if (tipc_mode != TIPC_NOT_RUNNING) | 255 | if (tipc_mode != TIPC_NOT_RUNNING) |
@@ -268,7 +268,7 @@ static struct sk_buff *cfg_set_netid(void) | |||
268 | value = ntohl(*(__be32 *)TLV_DATA(req_tlv_area)); | 268 | value = ntohl(*(__be32 *)TLV_DATA(req_tlv_area)); |
269 | if (value == tipc_net_id) | 269 | if (value == tipc_net_id) |
270 | return tipc_cfg_reply_none(); | 270 | return tipc_cfg_reply_none(); |
271 | if (value != delimit(value, 1, 9999)) | 271 | if (value < 1 || value > 9999) |
272 | return tipc_cfg_reply_error_string(TIPC_CFG_INVALID_VALUE | 272 | return tipc_cfg_reply_error_string(TIPC_CFG_INVALID_VALUE |
273 | " (network id must be 1-9999)"); | 273 | " (network id must be 1-9999)"); |
274 | if (tipc_mode == TIPC_NET_MODE) | 274 | if (tipc_mode == TIPC_NET_MODE) |
diff --git a/net/tipc/core.h b/net/tipc/core.h index 2761af36d141..1260b053bf25 100644 --- a/net/tipc/core.h +++ b/net/tipc/core.h | |||
@@ -168,16 +168,6 @@ extern void tipc_netlink_stop(void); | |||
168 | extern int tipc_socket_init(void); | 168 | extern int tipc_socket_init(void); |
169 | extern void tipc_socket_stop(void); | 169 | extern void tipc_socket_stop(void); |
170 | 170 | ||
171 | static inline int delimit(int val, int min, int max) | ||
172 | { | ||
173 | if (val > max) | ||
174 | return max; | ||
175 | if (val < min) | ||
176 | return min; | ||
177 | return val; | ||
178 | } | ||
179 | |||
180 | |||
181 | /* | 171 | /* |
182 | * TIPC timer and signal code | 172 | * TIPC timer and signal code |
183 | */ | 173 | */ |
diff --git a/net/tipc/log.c b/net/tipc/log.c index 952c39f643e6..895c6e530b0b 100644 --- a/net/tipc/log.c +++ b/net/tipc/log.c | |||
@@ -304,7 +304,7 @@ struct sk_buff *tipc_log_resize_cmd(const void *req_tlv_area, int req_tlv_space) | |||
304 | return tipc_cfg_reply_error_string(TIPC_CFG_TLV_ERROR); | 304 | return tipc_cfg_reply_error_string(TIPC_CFG_TLV_ERROR); |
305 | 305 | ||
306 | value = ntohl(*(__be32 *)TLV_DATA(req_tlv_area)); | 306 | value = ntohl(*(__be32 *)TLV_DATA(req_tlv_area)); |
307 | if (value != delimit(value, 0, 32768)) | 307 | if (value > 32768) |
308 | return tipc_cfg_reply_error_string(TIPC_CFG_INVALID_VALUE | 308 | return tipc_cfg_reply_error_string(TIPC_CFG_INVALID_VALUE |
309 | " (log size must be 0-32768)"); | 309 | " (log size must be 0-32768)"); |
310 | if (tipc_log_resize(value)) | 310 | if (tipc_log_resize(value)) |