diff options
author | Rusty Russell <rusty@rustcorp.com.au> | 2011-12-19 08:56:45 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2011-12-19 22:27:29 -0500 |
commit | 3db1cd5c05f35fb43eb134df6f321de4e63141f2 (patch) | |
tree | 960039f3f4f0a524b37e94434624da154859bc64 /net | |
parent | a8e510f682fe6d7671c11887e07c55f86caaf3c1 (diff) |
net: fix assignment of 0/1 to bool variables.
DaveM said:
Please, this kind of stuff rots forever and not using bool properly
drives me crazy.
Joe Perches <joe@perches.com> gave me the spatch script:
@@
bool b;
@@
-b = 0
+b = false
@@
bool b;
@@
-b = 1
+b = true
I merely installed coccinelle, read the documentation and took credit.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r-- | net/caif/caif_usb.c | 2 | ||||
-rw-r--r-- | net/dccp/feat.c | 16 | ||||
-rw-r--r-- | net/dccp/options.c | 2 | ||||
-rw-r--r-- | net/ipv4/tcp_timer.c | 4 | ||||
-rw-r--r-- | net/mac80211/rc80211_pid_algo.c | 4 | ||||
-rw-r--r-- | net/mac80211/scan.c | 2 | ||||
-rw-r--r-- | net/netfilter/ipvs/ip_vs_pe_sip.c | 4 | ||||
-rw-r--r-- | net/rfkill/rfkill-regulator.c | 6 | ||||
-rw-r--r-- | net/rxrpc/ar-ack.c | 14 | ||||
-rw-r--r-- | net/rxrpc/ar-output.c | 4 |
10 files changed, 29 insertions, 29 deletions
diff --git a/net/caif/caif_usb.c b/net/caif/caif_usb.c index f5db57c58081..5fc9eca8cd41 100644 --- a/net/caif/caif_usb.c +++ b/net/caif/caif_usb.c | |||
@@ -179,7 +179,7 @@ static int cfusbl_device_notify(struct notifier_block *me, unsigned long what, | |||
179 | &layer, &caif_usb_type.func); | 179 | &layer, &caif_usb_type.func); |
180 | if (!pack_added) | 180 | if (!pack_added) |
181 | dev_add_pack(&caif_usb_type); | 181 | dev_add_pack(&caif_usb_type); |
182 | pack_added = 1; | 182 | pack_added = true; |
183 | 183 | ||
184 | strncpy(layer->name, dev->name, | 184 | strncpy(layer->name, dev->name, |
185 | sizeof(layer->name) - 1); | 185 | sizeof(layer->name) - 1); |
diff --git a/net/dccp/feat.c b/net/dccp/feat.c index 23cea0ee3101..78a2ad70e1b0 100644 --- a/net/dccp/feat.c +++ b/net/dccp/feat.c | |||
@@ -490,8 +490,8 @@ static int dccp_feat_push_change(struct list_head *fn_list, u8 feat, u8 local, | |||
490 | new->feat_num = feat; | 490 | new->feat_num = feat; |
491 | new->is_local = local; | 491 | new->is_local = local; |
492 | new->state = FEAT_INITIALISING; | 492 | new->state = FEAT_INITIALISING; |
493 | new->needs_confirm = 0; | 493 | new->needs_confirm = false; |
494 | new->empty_confirm = 0; | 494 | new->empty_confirm = false; |
495 | new->val = *fval; | 495 | new->val = *fval; |
496 | new->needs_mandatory = mandatory; | 496 | new->needs_mandatory = mandatory; |
497 | 497 | ||
@@ -517,12 +517,12 @@ static int dccp_feat_push_confirm(struct list_head *fn_list, u8 feat, u8 local, | |||
517 | new->feat_num = feat; | 517 | new->feat_num = feat; |
518 | new->is_local = local; | 518 | new->is_local = local; |
519 | new->state = FEAT_STABLE; /* transition in 6.6.2 */ | 519 | new->state = FEAT_STABLE; /* transition in 6.6.2 */ |
520 | new->needs_confirm = 1; | 520 | new->needs_confirm = true; |
521 | new->empty_confirm = (fval == NULL); | 521 | new->empty_confirm = (fval == NULL); |
522 | new->val.nn = 0; /* zeroes the whole structure */ | 522 | new->val.nn = 0; /* zeroes the whole structure */ |
523 | if (!new->empty_confirm) | 523 | if (!new->empty_confirm) |
524 | new->val = *fval; | 524 | new->val = *fval; |
525 | new->needs_mandatory = 0; | 525 | new->needs_mandatory = false; |
526 | 526 | ||
527 | return 0; | 527 | return 0; |
528 | } | 528 | } |
@@ -1155,7 +1155,7 @@ static u8 dccp_feat_change_recv(struct list_head *fn, u8 is_mandatory, u8 opt, | |||
1155 | } | 1155 | } |
1156 | 1156 | ||
1157 | if (dccp_feat_reconcile(&entry->val, val, len, server, true)) { | 1157 | if (dccp_feat_reconcile(&entry->val, val, len, server, true)) { |
1158 | entry->empty_confirm = 0; | 1158 | entry->empty_confirm = false; |
1159 | } else if (is_mandatory) { | 1159 | } else if (is_mandatory) { |
1160 | return DCCP_RESET_CODE_MANDATORY_ERROR; | 1160 | return DCCP_RESET_CODE_MANDATORY_ERROR; |
1161 | } else if (entry->state == FEAT_INITIALISING) { | 1161 | } else if (entry->state == FEAT_INITIALISING) { |
@@ -1171,10 +1171,10 @@ static u8 dccp_feat_change_recv(struct list_head *fn, u8 is_mandatory, u8 opt, | |||
1171 | defval = dccp_feat_default_value(feat); | 1171 | defval = dccp_feat_default_value(feat); |
1172 | if (!dccp_feat_reconcile(&entry->val, &defval, 1, server, true)) | 1172 | if (!dccp_feat_reconcile(&entry->val, &defval, 1, server, true)) |
1173 | return DCCP_RESET_CODE_OPTION_ERROR; | 1173 | return DCCP_RESET_CODE_OPTION_ERROR; |
1174 | entry->empty_confirm = 1; | 1174 | entry->empty_confirm = true; |
1175 | } | 1175 | } |
1176 | entry->needs_confirm = 1; | 1176 | entry->needs_confirm = true; |
1177 | entry->needs_mandatory = 0; | 1177 | entry->needs_mandatory = false; |
1178 | entry->state = FEAT_STABLE; | 1178 | entry->state = FEAT_STABLE; |
1179 | return 0; | 1179 | return 0; |
1180 | 1180 | ||
diff --git a/net/dccp/options.c b/net/dccp/options.c index 4b2ab657ac8e..68fa6b7a3e01 100644 --- a/net/dccp/options.c +++ b/net/dccp/options.c | |||
@@ -544,7 +544,7 @@ int dccp_insert_fn_opt(struct sk_buff *skb, u8 type, u8 feat, | |||
544 | } | 544 | } |
545 | 545 | ||
546 | if (unlikely(val == NULL || len == 0)) | 546 | if (unlikely(val == NULL || len == 0)) |
547 | len = repeat_first = 0; | 547 | len = repeat_first = false; |
548 | tot_len = 3 + repeat_first + len; | 548 | tot_len = 3 + repeat_first + len; |
549 | 549 | ||
550 | if (DCCP_SKB_CB(skb)->dccpd_opt_len + tot_len > DCCP_MAX_OPT_LEN) { | 550 | if (DCCP_SKB_CB(skb)->dccpd_opt_len + tot_len > DCCP_MAX_OPT_LEN) { |
diff --git a/net/ipv4/tcp_timer.c b/net/ipv4/tcp_timer.c index 40a41f077981..a516d1e399df 100644 --- a/net/ipv4/tcp_timer.c +++ b/net/ipv4/tcp_timer.c | |||
@@ -171,13 +171,13 @@ static int tcp_write_timeout(struct sock *sk) | |||
171 | { | 171 | { |
172 | struct inet_connection_sock *icsk = inet_csk(sk); | 172 | struct inet_connection_sock *icsk = inet_csk(sk); |
173 | int retry_until; | 173 | int retry_until; |
174 | bool do_reset, syn_set = 0; | 174 | bool do_reset, syn_set = false; |
175 | 175 | ||
176 | if ((1 << sk->sk_state) & (TCPF_SYN_SENT | TCPF_SYN_RECV)) { | 176 | if ((1 << sk->sk_state) & (TCPF_SYN_SENT | TCPF_SYN_RECV)) { |
177 | if (icsk->icsk_retransmits) | 177 | if (icsk->icsk_retransmits) |
178 | dst_negative_advice(sk); | 178 | dst_negative_advice(sk); |
179 | retry_until = icsk->icsk_syn_retries ? : sysctl_tcp_syn_retries; | 179 | retry_until = icsk->icsk_syn_retries ? : sysctl_tcp_syn_retries; |
180 | syn_set = 1; | 180 | syn_set = true; |
181 | } else { | 181 | } else { |
182 | if (retransmits_timed_out(sk, sysctl_tcp_retries1, 0, 0)) { | 182 | if (retransmits_timed_out(sk, sysctl_tcp_retries1, 0, 0)) { |
183 | /* Black hole detection */ | 183 | /* Black hole detection */ |
diff --git a/net/mac80211/rc80211_pid_algo.c b/net/mac80211/rc80211_pid_algo.c index aeda65466f3e..502d3ecc4a79 100644 --- a/net/mac80211/rc80211_pid_algo.c +++ b/net/mac80211/rc80211_pid_algo.c | |||
@@ -318,7 +318,7 @@ rate_control_pid_rate_init(void *priv, struct ieee80211_supported_band *sband, | |||
318 | rinfo[i].diff = i * pinfo->norm_offset; | 318 | rinfo[i].diff = i * pinfo->norm_offset; |
319 | } | 319 | } |
320 | for (i = 1; i < sband->n_bitrates; i++) { | 320 | for (i = 1; i < sband->n_bitrates; i++) { |
321 | s = 0; | 321 | s = false; |
322 | for (j = 0; j < sband->n_bitrates - i; j++) | 322 | for (j = 0; j < sband->n_bitrates - i; j++) |
323 | if (unlikely(sband->bitrates[rinfo[j].index].bitrate > | 323 | if (unlikely(sband->bitrates[rinfo[j].index].bitrate > |
324 | sband->bitrates[rinfo[j + 1].index].bitrate)) { | 324 | sband->bitrates[rinfo[j + 1].index].bitrate)) { |
@@ -327,7 +327,7 @@ rate_control_pid_rate_init(void *priv, struct ieee80211_supported_band *sband, | |||
327 | rinfo[j + 1].index = tmp; | 327 | rinfo[j + 1].index = tmp; |
328 | rinfo[rinfo[j].index].rev_index = j; | 328 | rinfo[rinfo[j].index].rev_index = j; |
329 | rinfo[rinfo[j + 1].index].rev_index = j + 1; | 329 | rinfo[rinfo[j + 1].index].rev_index = j + 1; |
330 | s = 1; | 330 | s = true; |
331 | } | 331 | } |
332 | if (!s) | 332 | if (!s) |
333 | break; | 333 | break; |
diff --git a/net/mac80211/scan.c b/net/mac80211/scan.c index 2c5041cc71f8..2c9b493af249 100644 --- a/net/mac80211/scan.c +++ b/net/mac80211/scan.c | |||
@@ -106,7 +106,7 @@ ieee80211_bss_info_update(struct ieee80211_local *local, | |||
106 | /* save the ERP value so that it is available at association time */ | 106 | /* save the ERP value so that it is available at association time */ |
107 | if (elems->erp_info && elems->erp_info_len >= 1) { | 107 | if (elems->erp_info && elems->erp_info_len >= 1) { |
108 | bss->erp_value = elems->erp_info[0]; | 108 | bss->erp_value = elems->erp_info[0]; |
109 | bss->has_erp_value = 1; | 109 | bss->has_erp_value = true; |
110 | } | 110 | } |
111 | 111 | ||
112 | if (elems->tim) { | 112 | if (elems->tim) { |
diff --git a/net/netfilter/ipvs/ip_vs_pe_sip.c b/net/netfilter/ipvs/ip_vs_pe_sip.c index 13d607ae9c52..1aa5cac748c4 100644 --- a/net/netfilter/ipvs/ip_vs_pe_sip.c +++ b/net/netfilter/ipvs/ip_vs_pe_sip.c | |||
@@ -108,7 +108,7 @@ static bool ip_vs_sip_ct_match(const struct ip_vs_conn_param *p, | |||
108 | struct ip_vs_conn *ct) | 108 | struct ip_vs_conn *ct) |
109 | 109 | ||
110 | { | 110 | { |
111 | bool ret = 0; | 111 | bool ret = false; |
112 | 112 | ||
113 | if (ct->af == p->af && | 113 | if (ct->af == p->af && |
114 | ip_vs_addr_equal(p->af, p->caddr, &ct->caddr) && | 114 | ip_vs_addr_equal(p->af, p->caddr, &ct->caddr) && |
@@ -121,7 +121,7 @@ static bool ip_vs_sip_ct_match(const struct ip_vs_conn_param *p, | |||
121 | ct->protocol == p->protocol && | 121 | ct->protocol == p->protocol && |
122 | ct->pe_data && ct->pe_data_len == p->pe_data_len && | 122 | ct->pe_data && ct->pe_data_len == p->pe_data_len && |
123 | !memcmp(ct->pe_data, p->pe_data, p->pe_data_len)) | 123 | !memcmp(ct->pe_data, p->pe_data, p->pe_data_len)) |
124 | ret = 1; | 124 | ret = true; |
125 | 125 | ||
126 | IP_VS_DBG_BUF(9, "SIP template match %s %s->%s:%d %s\n", | 126 | IP_VS_DBG_BUF(9, "SIP template match %s %s->%s:%d %s\n", |
127 | ip_vs_proto_name(p->protocol), | 127 | ip_vs_proto_name(p->protocol), |
diff --git a/net/rfkill/rfkill-regulator.c b/net/rfkill/rfkill-regulator.c index 2ebfe8d0e873..11da3018a853 100644 --- a/net/rfkill/rfkill-regulator.c +++ b/net/rfkill/rfkill-regulator.c | |||
@@ -36,12 +36,12 @@ static int rfkill_regulator_set_block(void *data, bool blocked) | |||
36 | if (blocked) { | 36 | if (blocked) { |
37 | if (rfkill_data->reg_enabled) { | 37 | if (rfkill_data->reg_enabled) { |
38 | regulator_disable(rfkill_data->vcc); | 38 | regulator_disable(rfkill_data->vcc); |
39 | rfkill_data->reg_enabled = 0; | 39 | rfkill_data->reg_enabled = false; |
40 | } | 40 | } |
41 | } else { | 41 | } else { |
42 | if (!rfkill_data->reg_enabled) { | 42 | if (!rfkill_data->reg_enabled) { |
43 | regulator_enable(rfkill_data->vcc); | 43 | regulator_enable(rfkill_data->vcc); |
44 | rfkill_data->reg_enabled = 1; | 44 | rfkill_data->reg_enabled = true; |
45 | } | 45 | } |
46 | } | 46 | } |
47 | 47 | ||
@@ -96,7 +96,7 @@ static int __devinit rfkill_regulator_probe(struct platform_device *pdev) | |||
96 | 96 | ||
97 | if (regulator_is_enabled(vcc)) { | 97 | if (regulator_is_enabled(vcc)) { |
98 | dev_dbg(&pdev->dev, "Regulator already enabled\n"); | 98 | dev_dbg(&pdev->dev, "Regulator already enabled\n"); |
99 | rfkill_data->reg_enabled = 1; | 99 | rfkill_data->reg_enabled = true; |
100 | } | 100 | } |
101 | rfkill_data->vcc = vcc; | 101 | rfkill_data->vcc = vcc; |
102 | rfkill_data->rf_kill = rf_kill; | 102 | rfkill_data->rf_kill = rf_kill; |
diff --git a/net/rxrpc/ar-ack.c b/net/rxrpc/ar-ack.c index f99cfce7ca97..c3126e864f3c 100644 --- a/net/rxrpc/ar-ack.c +++ b/net/rxrpc/ar-ack.c | |||
@@ -195,7 +195,7 @@ static void rxrpc_resend(struct rxrpc_call *call) | |||
195 | sp = rxrpc_skb(txb); | 195 | sp = rxrpc_skb(txb); |
196 | 196 | ||
197 | if (sp->need_resend) { | 197 | if (sp->need_resend) { |
198 | sp->need_resend = 0; | 198 | sp->need_resend = false; |
199 | 199 | ||
200 | /* each Tx packet has a new serial number */ | 200 | /* each Tx packet has a new serial number */ |
201 | sp->hdr.serial = | 201 | sp->hdr.serial = |
@@ -216,7 +216,7 @@ static void rxrpc_resend(struct rxrpc_call *call) | |||
216 | } | 216 | } |
217 | 217 | ||
218 | if (time_after_eq(jiffies + 1, sp->resend_at)) { | 218 | if (time_after_eq(jiffies + 1, sp->resend_at)) { |
219 | sp->need_resend = 1; | 219 | sp->need_resend = true; |
220 | resend |= 1; | 220 | resend |= 1; |
221 | } else if (resend & 2) { | 221 | } else if (resend & 2) { |
222 | if (time_before(sp->resend_at, resend_at)) | 222 | if (time_before(sp->resend_at, resend_at)) |
@@ -265,7 +265,7 @@ static void rxrpc_resend_timer(struct rxrpc_call *call) | |||
265 | if (sp->need_resend) { | 265 | if (sp->need_resend) { |
266 | ; | 266 | ; |
267 | } else if (time_after_eq(jiffies + 1, sp->resend_at)) { | 267 | } else if (time_after_eq(jiffies + 1, sp->resend_at)) { |
268 | sp->need_resend = 1; | 268 | sp->need_resend = true; |
269 | resend |= 1; | 269 | resend |= 1; |
270 | } else if (resend & 2) { | 270 | } else if (resend & 2) { |
271 | if (time_before(sp->resend_at, resend_at)) | 271 | if (time_before(sp->resend_at, resend_at)) |
@@ -314,11 +314,11 @@ static int rxrpc_process_soft_ACKs(struct rxrpc_call *call, | |||
314 | 314 | ||
315 | switch (sacks[loop]) { | 315 | switch (sacks[loop]) { |
316 | case RXRPC_ACK_TYPE_ACK: | 316 | case RXRPC_ACK_TYPE_ACK: |
317 | sp->need_resend = 0; | 317 | sp->need_resend = false; |
318 | *p_txb |= 1; | 318 | *p_txb |= 1; |
319 | break; | 319 | break; |
320 | case RXRPC_ACK_TYPE_NACK: | 320 | case RXRPC_ACK_TYPE_NACK: |
321 | sp->need_resend = 1; | 321 | sp->need_resend = true; |
322 | *p_txb &= ~1; | 322 | *p_txb &= ~1; |
323 | resend = 1; | 323 | resend = 1; |
324 | break; | 324 | break; |
@@ -344,13 +344,13 @@ static int rxrpc_process_soft_ACKs(struct rxrpc_call *call, | |||
344 | 344 | ||
345 | if (*p_txb & 1) { | 345 | if (*p_txb & 1) { |
346 | /* packet must have been discarded */ | 346 | /* packet must have been discarded */ |
347 | sp->need_resend = 1; | 347 | sp->need_resend = true; |
348 | *p_txb &= ~1; | 348 | *p_txb &= ~1; |
349 | resend |= 1; | 349 | resend |= 1; |
350 | } else if (sp->need_resend) { | 350 | } else if (sp->need_resend) { |
351 | ; | 351 | ; |
352 | } else if (time_after_eq(jiffies + 1, sp->resend_at)) { | 352 | } else if (time_after_eq(jiffies + 1, sp->resend_at)) { |
353 | sp->need_resend = 1; | 353 | sp->need_resend = true; |
354 | resend |= 1; | 354 | resend |= 1; |
355 | } else if (resend & 2) { | 355 | } else if (resend & 2) { |
356 | if (time_before(sp->resend_at, resend_at)) | 356 | if (time_before(sp->resend_at, resend_at)) |
diff --git a/net/rxrpc/ar-output.c b/net/rxrpc/ar-output.c index 338d793c7113..16ae88762d00 100644 --- a/net/rxrpc/ar-output.c +++ b/net/rxrpc/ar-output.c | |||
@@ -486,7 +486,7 @@ static void rxrpc_queue_packet(struct rxrpc_call *call, struct sk_buff *skb, | |||
486 | _proto("Tx DATA %%%u { #%u }", | 486 | _proto("Tx DATA %%%u { #%u }", |
487 | ntohl(sp->hdr.serial), ntohl(sp->hdr.seq)); | 487 | ntohl(sp->hdr.serial), ntohl(sp->hdr.seq)); |
488 | 488 | ||
489 | sp->need_resend = 0; | 489 | sp->need_resend = false; |
490 | sp->resend_at = jiffies + rxrpc_resend_timeout * HZ; | 490 | sp->resend_at = jiffies + rxrpc_resend_timeout * HZ; |
491 | if (!test_and_set_bit(RXRPC_CALL_RUN_RTIMER, &call->flags)) { | 491 | if (!test_and_set_bit(RXRPC_CALL_RUN_RTIMER, &call->flags)) { |
492 | _debug("run timer"); | 492 | _debug("run timer"); |
@@ -508,7 +508,7 @@ static void rxrpc_queue_packet(struct rxrpc_call *call, struct sk_buff *skb, | |||
508 | 508 | ||
509 | if (ret < 0) { | 509 | if (ret < 0) { |
510 | _debug("need instant resend %d", ret); | 510 | _debug("need instant resend %d", ret); |
511 | sp->need_resend = 1; | 511 | sp->need_resend = true; |
512 | rxrpc_instant_resend(call); | 512 | rxrpc_instant_resend(call); |
513 | } | 513 | } |
514 | 514 | ||