Skip to content

Commit 35498ed

Browse files
baihuahuadavem330
authored andcommitted
net/ieee80211: ieee80211_is_* can be boolean
This patch makes ieee80211_is_* return bool to improve readability due to these particular functions only using either one or zero as their return value. No functional change. Signed-off-by: Yaowei Bai <bywxiaobai@163.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 61d0353 commit 35498ed

1 file changed

Lines changed: 38 additions & 38 deletions

File tree

‎include/linux/ieee80211.h‎

Lines changed: 38 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@
121121
#define IEEE80211_MAX_SN IEEE80211_SN_MASK
122122
#define IEEE80211_SN_MODULO (IEEE80211_MAX_SN + 1)
123123

124-
static inline int ieee80211_sn_less(u16 sn1, u16 sn2)
124+
static inline bool ieee80211_sn_less(u16 sn1, u16 sn2)
125125
{
126126
return ((sn1 - sn2) & IEEE80211_SN_MASK) > (IEEE80211_SN_MODULO >> 1);
127127
}
@@ -250,7 +250,7 @@ struct ieee80211_qos_hdr {
250250
* ieee80211_has_tods - check if IEEE80211_FCTL_TODS is set
251251
* @fc: frame control bytes in little-endian byteorder
252252
*/
253-
static inline int ieee80211_has_tods(__le16 fc)
253+
static inline bool ieee80211_has_tods(__le16 fc)
254254
{
255255
return (fc & cpu_to_le16(IEEE80211_FCTL_TODS)) != 0;
256256
}
@@ -259,7 +259,7 @@ static inline int ieee80211_has_tods(__le16 fc)
259259
* ieee80211_has_fromds - check if IEEE80211_FCTL_FROMDS is set
260260
* @fc: frame control bytes in little-endian byteorder
261261
*/
262-
static inline int ieee80211_has_fromds(__le16 fc)
262+
static inline bool ieee80211_has_fromds(__le16 fc)
263263
{
264264
return (fc & cpu_to_le16(IEEE80211_FCTL_FROMDS)) != 0;
265265
}
@@ -268,7 +268,7 @@ static inline int ieee80211_has_fromds(__le16 fc)
268268
* ieee80211_has_a4 - check if IEEE80211_FCTL_TODS and IEEE80211_FCTL_FROMDS are set
269269
* @fc: frame control bytes in little-endian byteorder
270270
*/
271-
static inline int ieee80211_has_a4(__le16 fc)
271+
static inline bool ieee80211_has_a4(__le16 fc)
272272
{
273273
__le16 tmp = cpu_to_le16(IEEE80211_FCTL_TODS | IEEE80211_FCTL_FROMDS);
274274
return (fc & tmp) == tmp;
@@ -278,7 +278,7 @@ static inline int ieee80211_has_a4(__le16 fc)
278278
* ieee80211_has_morefrags - check if IEEE80211_FCTL_MOREFRAGS is set
279279
* @fc: frame control bytes in little-endian byteorder
280280
*/
281-
static inline int ieee80211_has_morefrags(__le16 fc)
281+
static inline bool ieee80211_has_morefrags(__le16 fc)
282282
{
283283
return (fc & cpu_to_le16(IEEE80211_FCTL_MOREFRAGS)) != 0;
284284
}
@@ -287,7 +287,7 @@ static inline int ieee80211_has_morefrags(__le16 fc)
287287
* ieee80211_has_retry - check if IEEE80211_FCTL_RETRY is set
288288
* @fc: frame control bytes in little-endian byteorder
289289
*/
290-
static inline int ieee80211_has_retry(__le16 fc)
290+
static inline bool ieee80211_has_retry(__le16 fc)
291291
{
292292
return (fc & cpu_to_le16(IEEE80211_FCTL_RETRY)) != 0;
293293
}
@@ -296,7 +296,7 @@ static inline int ieee80211_has_retry(__le16 fc)
296296
* ieee80211_has_pm - check if IEEE80211_FCTL_PM is set
297297
* @fc: frame control bytes in little-endian byteorder
298298
*/
299-
static inline int ieee80211_has_pm(__le16 fc)
299+
static inline bool ieee80211_has_pm(__le16 fc)
300300
{
301301
return (fc & cpu_to_le16(IEEE80211_FCTL_PM)) != 0;
302302
}
@@ -305,7 +305,7 @@ static inline int ieee80211_has_pm(__le16 fc)
305305
* ieee80211_has_moredata - check if IEEE80211_FCTL_MOREDATA is set
306306
* @fc: frame control bytes in little-endian byteorder
307307
*/
308-
static inline int ieee80211_has_moredata(__le16 fc)
308+
static inline bool ieee80211_has_moredata(__le16 fc)
309309
{
310310
return (fc & cpu_to_le16(IEEE80211_FCTL_MOREDATA)) != 0;
311311
}
@@ -314,7 +314,7 @@ static inline int ieee80211_has_moredata(__le16 fc)
314314
* ieee80211_has_protected - check if IEEE80211_FCTL_PROTECTED is set
315315
* @fc: frame control bytes in little-endian byteorder
316316
*/
317-
static inline int ieee80211_has_protected(__le16 fc)
317+
static inline bool ieee80211_has_protected(__le16 fc)
318318
{
319319
return (fc & cpu_to_le16(IEEE80211_FCTL_PROTECTED)) != 0;
320320
}
@@ -323,7 +323,7 @@ static inline int ieee80211_has_protected(__le16 fc)
323323
* ieee80211_has_order - check if IEEE80211_FCTL_ORDER is set
324324
* @fc: frame control bytes in little-endian byteorder
325325
*/
326-
static inline int ieee80211_has_order(__le16 fc)
326+
static inline bool ieee80211_has_order(__le16 fc)
327327
{
328328
return (fc & cpu_to_le16(IEEE80211_FCTL_ORDER)) != 0;
329329
}
@@ -332,7 +332,7 @@ static inline int ieee80211_has_order(__le16 fc)
332332
* ieee80211_is_mgmt - check if type is IEEE80211_FTYPE_MGMT
333333
* @fc: frame control bytes in little-endian byteorder
334334
*/
335-
static inline int ieee80211_is_mgmt(__le16 fc)
335+
static inline bool ieee80211_is_mgmt(__le16 fc)
336336
{
337337
return (fc & cpu_to_le16(IEEE80211_FCTL_FTYPE)) ==
338338
cpu_to_le16(IEEE80211_FTYPE_MGMT);
@@ -342,7 +342,7 @@ static inline int ieee80211_is_mgmt(__le16 fc)
342342
* ieee80211_is_ctl - check if type is IEEE80211_FTYPE_CTL
343343
* @fc: frame control bytes in little-endian byteorder
344344
*/
345-
static inline int ieee80211_is_ctl(__le16 fc)
345+
static inline bool ieee80211_is_ctl(__le16 fc)
346346
{
347347
return (fc & cpu_to_le16(IEEE80211_FCTL_FTYPE)) ==
348348
cpu_to_le16(IEEE80211_FTYPE_CTL);
@@ -352,7 +352,7 @@ static inline int ieee80211_is_ctl(__le16 fc)
352352
* ieee80211_is_data - check if type is IEEE80211_FTYPE_DATA
353353
* @fc: frame control bytes in little-endian byteorder
354354
*/
355-
static inline int ieee80211_is_data(__le16 fc)
355+
static inline bool ieee80211_is_data(__le16 fc)
356356
{
357357
return (fc & cpu_to_le16(IEEE80211_FCTL_FTYPE)) ==
358358
cpu_to_le16(IEEE80211_FTYPE_DATA);
@@ -362,7 +362,7 @@ static inline int ieee80211_is_data(__le16 fc)
362362
* ieee80211_is_data_qos - check if type is IEEE80211_FTYPE_DATA and IEEE80211_STYPE_QOS_DATA is set
363363
* @fc: frame control bytes in little-endian byteorder
364364
*/
365-
static inline int ieee80211_is_data_qos(__le16 fc)
365+
static inline bool ieee80211_is_data_qos(__le16 fc)
366366
{
367367
/*
368368
* mask with QOS_DATA rather than IEEE80211_FCTL_STYPE as we just need
@@ -376,7 +376,7 @@ static inline int ieee80211_is_data_qos(__le16 fc)
376376
* ieee80211_is_data_present - check if type is IEEE80211_FTYPE_DATA and has data
377377
* @fc: frame control bytes in little-endian byteorder
378378
*/
379-
static inline int ieee80211_is_data_present(__le16 fc)
379+
static inline bool ieee80211_is_data_present(__le16 fc)
380380
{
381381
/*
382382
* mask with 0x40 and test that that bit is clear to only return true
@@ -390,7 +390,7 @@ static inline int ieee80211_is_data_present(__le16 fc)
390390
* ieee80211_is_assoc_req - check if IEEE80211_FTYPE_MGMT && IEEE80211_STYPE_ASSOC_REQ
391391
* @fc: frame control bytes in little-endian byteorder
392392
*/
393-
static inline int ieee80211_is_assoc_req(__le16 fc)
393+
static inline bool ieee80211_is_assoc_req(__le16 fc)
394394
{
395395
return (fc & cpu_to_le16(IEEE80211_FCTL_FTYPE | IEEE80211_FCTL_STYPE)) ==
396396
cpu_to_le16(IEEE80211_FTYPE_MGMT | IEEE80211_STYPE_ASSOC_REQ);
@@ -400,7 +400,7 @@ static inline int ieee80211_is_assoc_req(__le16 fc)
400400
* ieee80211_is_assoc_resp - check if IEEE80211_FTYPE_MGMT && IEEE80211_STYPE_ASSOC_RESP
401401
* @fc: frame control bytes in little-endian byteorder
402402
*/
403-
static inline int ieee80211_is_assoc_resp(__le16 fc)
403+
static inline bool ieee80211_is_assoc_resp(__le16 fc)
404404
{
405405
return (fc & cpu_to_le16(IEEE80211_FCTL_FTYPE | IEEE80211_FCTL_STYPE)) ==
406406
cpu_to_le16(IEEE80211_FTYPE_MGMT | IEEE80211_STYPE_ASSOC_RESP);
@@ -410,7 +410,7 @@ static inline int ieee80211_is_assoc_resp(__le16 fc)
410410
* ieee80211_is_reassoc_req - check if IEEE80211_FTYPE_MGMT && IEEE80211_STYPE_REASSOC_REQ
411411
* @fc: frame control bytes in little-endian byteorder
412412
*/
413-
static inline int ieee80211_is_reassoc_req(__le16 fc)
413+
static inline bool ieee80211_is_reassoc_req(__le16 fc)
414414
{
415415
return (fc & cpu_to_le16(IEEE80211_FCTL_FTYPE | IEEE80211_FCTL_STYPE)) ==
416416
cpu_to_le16(IEEE80211_FTYPE_MGMT | IEEE80211_STYPE_REASSOC_REQ);
@@ -420,7 +420,7 @@ static inline int ieee80211_is_reassoc_req(__le16 fc)
420420
* ieee80211_is_reassoc_resp - check if IEEE80211_FTYPE_MGMT && IEEE80211_STYPE_REASSOC_RESP
421421
* @fc: frame control bytes in little-endian byteorder
422422
*/
423-
static inline int ieee80211_is_reassoc_resp(__le16 fc)
423+
static inline bool ieee80211_is_reassoc_resp(__le16 fc)
424424
{
425425
return (fc & cpu_to_le16(IEEE80211_FCTL_FTYPE | IEEE80211_FCTL_STYPE)) ==
426426
cpu_to_le16(IEEE80211_FTYPE_MGMT | IEEE80211_STYPE_REASSOC_RESP);
@@ -430,7 +430,7 @@ static inline int ieee80211_is_reassoc_resp(__le16 fc)
430430
* ieee80211_is_probe_req - check if IEEE80211_FTYPE_MGMT && IEEE80211_STYPE_PROBE_REQ
431431
* @fc: frame control bytes in little-endian byteorder
432432
*/
433-
static inline int ieee80211_is_probe_req(__le16 fc)
433+
static inline bool ieee80211_is_probe_req(__le16 fc)
434434
{
435435
return (fc & cpu_to_le16(IEEE80211_FCTL_FTYPE | IEEE80211_FCTL_STYPE)) ==
436436
cpu_to_le16(IEEE80211_FTYPE_MGMT | IEEE80211_STYPE_PROBE_REQ);
@@ -440,7 +440,7 @@ static inline int ieee80211_is_probe_req(__le16 fc)
440440
* ieee80211_is_probe_resp - check if IEEE80211_FTYPE_MGMT && IEEE80211_STYPE_PROBE_RESP
441441
* @fc: frame control bytes in little-endian byteorder
442442
*/
443-
static inline int ieee80211_is_probe_resp(__le16 fc)
443+
static inline bool ieee80211_is_probe_resp(__le16 fc)
444444
{
445445
return (fc & cpu_to_le16(IEEE80211_FCTL_FTYPE | IEEE80211_FCTL_STYPE)) ==
446446
cpu_to_le16(IEEE80211_FTYPE_MGMT | IEEE80211_STYPE_PROBE_RESP);
@@ -450,7 +450,7 @@ static inline int ieee80211_is_probe_resp(__le16 fc)
450450
* ieee80211_is_beacon - check if IEEE80211_FTYPE_MGMT && IEEE80211_STYPE_BEACON
451451
* @fc: frame control bytes in little-endian byteorder
452452
*/
453-
static inline int ieee80211_is_beacon(__le16 fc)
453+
static inline bool ieee80211_is_beacon(__le16 fc)
454454
{
455455
return (fc & cpu_to_le16(IEEE80211_FCTL_FTYPE | IEEE80211_FCTL_STYPE)) ==
456456
cpu_to_le16(IEEE80211_FTYPE_MGMT | IEEE80211_STYPE_BEACON);
@@ -460,7 +460,7 @@ static inline int ieee80211_is_beacon(__le16 fc)
460460
* ieee80211_is_atim - check if IEEE80211_FTYPE_MGMT && IEEE80211_STYPE_ATIM
461461
* @fc: frame control bytes in little-endian byteorder
462462
*/
463-
static inline int ieee80211_is_atim(__le16 fc)
463+
static inline bool ieee80211_is_atim(__le16 fc)
464464
{
465465
return (fc & cpu_to_le16(IEEE80211_FCTL_FTYPE | IEEE80211_FCTL_STYPE)) ==
466466
cpu_to_le16(IEEE80211_FTYPE_MGMT | IEEE80211_STYPE_ATIM);
@@ -470,7 +470,7 @@ static inline int ieee80211_is_atim(__le16 fc)
470470
* ieee80211_is_disassoc - check if IEEE80211_FTYPE_MGMT && IEEE80211_STYPE_DISASSOC
471471
* @fc: frame control bytes in little-endian byteorder
472472
*/
473-
static inline int ieee80211_is_disassoc(__le16 fc)
473+
static inline bool ieee80211_is_disassoc(__le16 fc)
474474
{
475475
return (fc & cpu_to_le16(IEEE80211_FCTL_FTYPE | IEEE80211_FCTL_STYPE)) ==
476476
cpu_to_le16(IEEE80211_FTYPE_MGMT | IEEE80211_STYPE_DISASSOC);
@@ -480,7 +480,7 @@ static inline int ieee80211_is_disassoc(__le16 fc)
480480
* ieee80211_is_auth - check if IEEE80211_FTYPE_MGMT && IEEE80211_STYPE_AUTH
481481
* @fc: frame control bytes in little-endian byteorder
482482
*/
483-
static inline int ieee80211_is_auth(__le16 fc)
483+
static inline bool ieee80211_is_auth(__le16 fc)
484484
{
485485
return (fc & cpu_to_le16(IEEE80211_FCTL_FTYPE | IEEE80211_FCTL_STYPE)) ==
486486
cpu_to_le16(IEEE80211_FTYPE_MGMT | IEEE80211_STYPE_AUTH);
@@ -490,7 +490,7 @@ static inline int ieee80211_is_auth(__le16 fc)
490490
* ieee80211_is_deauth - check if IEEE80211_FTYPE_MGMT && IEEE80211_STYPE_DEAUTH
491491
* @fc: frame control bytes in little-endian byteorder
492492
*/
493-
static inline int ieee80211_is_deauth(__le16 fc)
493+
static inline bool ieee80211_is_deauth(__le16 fc)
494494
{
495495
return (fc & cpu_to_le16(IEEE80211_FCTL_FTYPE | IEEE80211_FCTL_STYPE)) ==
496496
cpu_to_le16(IEEE80211_FTYPE_MGMT | IEEE80211_STYPE_DEAUTH);
@@ -500,7 +500,7 @@ static inline int ieee80211_is_deauth(__le16 fc)
500500
* ieee80211_is_action - check if IEEE80211_FTYPE_MGMT && IEEE80211_STYPE_ACTION
501501
* @fc: frame control bytes in little-endian byteorder
502502
*/
503-
static inline int ieee80211_is_action(__le16 fc)
503+
static inline bool ieee80211_is_action(__le16 fc)
504504
{
505505
return (fc & cpu_to_le16(IEEE80211_FCTL_FTYPE | IEEE80211_FCTL_STYPE)) ==
506506
cpu_to_le16(IEEE80211_FTYPE_MGMT | IEEE80211_STYPE_ACTION);
@@ -510,7 +510,7 @@ static inline int ieee80211_is_action(__le16 fc)
510510
* ieee80211_is_back_req - check if IEEE80211_FTYPE_CTL && IEEE80211_STYPE_BACK_REQ
511511
* @fc: frame control bytes in little-endian byteorder
512512
*/
513-
static inline int ieee80211_is_back_req(__le16 fc)
513+
static inline bool ieee80211_is_back_req(__le16 fc)
514514
{
515515
return (fc & cpu_to_le16(IEEE80211_FCTL_FTYPE | IEEE80211_FCTL_STYPE)) ==
516516
cpu_to_le16(IEEE80211_FTYPE_CTL | IEEE80211_STYPE_BACK_REQ);
@@ -520,7 +520,7 @@ static inline int ieee80211_is_back_req(__le16 fc)
520520
* ieee80211_is_back - check if IEEE80211_FTYPE_CTL && IEEE80211_STYPE_BACK
521521
* @fc: frame control bytes in little-endian byteorder
522522
*/
523-
static inline int ieee80211_is_back(__le16 fc)
523+
static inline bool ieee80211_is_back(__le16 fc)
524524
{
525525
return (fc & cpu_to_le16(IEEE80211_FCTL_FTYPE | IEEE80211_FCTL_STYPE)) ==
526526
cpu_to_le16(IEEE80211_FTYPE_CTL | IEEE80211_STYPE_BACK);
@@ -530,7 +530,7 @@ static inline int ieee80211_is_back(__le16 fc)
530530
* ieee80211_is_pspoll - check if IEEE80211_FTYPE_CTL && IEEE80211_STYPE_PSPOLL
531531
* @fc: frame control bytes in little-endian byteorder
532532
*/
533-
static inline int ieee80211_is_pspoll(__le16 fc)
533+
static inline bool ieee80211_is_pspoll(__le16 fc)
534534
{
535535
return (fc & cpu_to_le16(IEEE80211_FCTL_FTYPE | IEEE80211_FCTL_STYPE)) ==
536536
cpu_to_le16(IEEE80211_FTYPE_CTL | IEEE80211_STYPE_PSPOLL);
@@ -540,7 +540,7 @@ static inline int ieee80211_is_pspoll(__le16 fc)
540540
* ieee80211_is_rts - check if IEEE80211_FTYPE_CTL && IEEE80211_STYPE_RTS
541541
* @fc: frame control bytes in little-endian byteorder
542542
*/
543-
static inline int ieee80211_is_rts(__le16 fc)
543+
static inline bool ieee80211_is_rts(__le16 fc)
544544
{
545545
return (fc & cpu_to_le16(IEEE80211_FCTL_FTYPE | IEEE80211_FCTL_STYPE)) ==
546546
cpu_to_le16(IEEE80211_FTYPE_CTL | IEEE80211_STYPE_RTS);
@@ -550,7 +550,7 @@ static inline int ieee80211_is_rts(__le16 fc)
550550
* ieee80211_is_cts - check if IEEE80211_FTYPE_CTL && IEEE80211_STYPE_CTS
551551
* @fc: frame control bytes in little-endian byteorder
552552
*/
553-
static inline int ieee80211_is_cts(__le16 fc)
553+
static inline bool ieee80211_is_cts(__le16 fc)
554554
{
555555
return (fc & cpu_to_le16(IEEE80211_FCTL_FTYPE | IEEE80211_FCTL_STYPE)) ==
556556
cpu_to_le16(IEEE80211_FTYPE_CTL | IEEE80211_STYPE_CTS);
@@ -560,7 +560,7 @@ static inline int ieee80211_is_cts(__le16 fc)
560560
* ieee80211_is_ack - check if IEEE80211_FTYPE_CTL && IEEE80211_STYPE_ACK
561561
* @fc: frame control bytes in little-endian byteorder
562562
*/
563-
static inline int ieee80211_is_ack(__le16 fc)
563+
static inline bool ieee80211_is_ack(__le16 fc)
564564
{
565565
return (fc & cpu_to_le16(IEEE80211_FCTL_FTYPE | IEEE80211_FCTL_STYPE)) ==
566566
cpu_to_le16(IEEE80211_FTYPE_CTL | IEEE80211_STYPE_ACK);
@@ -570,7 +570,7 @@ static inline int ieee80211_is_ack(__le16 fc)
570570
* ieee80211_is_cfend - check if IEEE80211_FTYPE_CTL && IEEE80211_STYPE_CFEND
571571
* @fc: frame control bytes in little-endian byteorder
572572
*/
573-
static inline int ieee80211_is_cfend(__le16 fc)
573+
static inline bool ieee80211_is_cfend(__le16 fc)
574574
{
575575
return (fc & cpu_to_le16(IEEE80211_FCTL_FTYPE | IEEE80211_FCTL_STYPE)) ==
576576
cpu_to_le16(IEEE80211_FTYPE_CTL | IEEE80211_STYPE_CFEND);
@@ -580,7 +580,7 @@ static inline int ieee80211_is_cfend(__le16 fc)
580580
* ieee80211_is_cfendack - check if IEEE80211_FTYPE_CTL && IEEE80211_STYPE_CFENDACK
581581
* @fc: frame control bytes in little-endian byteorder
582582
*/
583-
static inline int ieee80211_is_cfendack(__le16 fc)
583+
static inline bool ieee80211_is_cfendack(__le16 fc)
584584
{
585585
return (fc & cpu_to_le16(IEEE80211_FCTL_FTYPE | IEEE80211_FCTL_STYPE)) ==
586586
cpu_to_le16(IEEE80211_FTYPE_CTL | IEEE80211_STYPE_CFENDACK);
@@ -590,7 +590,7 @@ static inline int ieee80211_is_cfendack(__le16 fc)
590590
* ieee80211_is_nullfunc - check if frame is a regular (non-QoS) nullfunc frame
591591
* @fc: frame control bytes in little-endian byteorder
592592
*/
593-
static inline int ieee80211_is_nullfunc(__le16 fc)
593+
static inline bool ieee80211_is_nullfunc(__le16 fc)
594594
{
595595
return (fc & cpu_to_le16(IEEE80211_FCTL_FTYPE | IEEE80211_FCTL_STYPE)) ==
596596
cpu_to_le16(IEEE80211_FTYPE_DATA | IEEE80211_STYPE_NULLFUNC);
@@ -600,7 +600,7 @@ static inline int ieee80211_is_nullfunc(__le16 fc)
600600
* ieee80211_is_qos_nullfunc - check if frame is a QoS nullfunc frame
601601
* @fc: frame control bytes in little-endian byteorder
602602
*/
603-
static inline int ieee80211_is_qos_nullfunc(__le16 fc)
603+
static inline bool ieee80211_is_qos_nullfunc(__le16 fc)
604604
{
605605
return (fc & cpu_to_le16(IEEE80211_FCTL_FTYPE | IEEE80211_FCTL_STYPE)) ==
606606
cpu_to_le16(IEEE80211_FTYPE_DATA | IEEE80211_STYPE_QOS_NULLFUNC);
@@ -624,7 +624,7 @@ static inline bool ieee80211_is_bufferable_mmpdu(__le16 fc)
624624
* ieee80211_is_first_frag - check if IEEE80211_SCTL_FRAG is not set
625625
* @seq_ctrl: frame sequence control bytes in little-endian byteorder
626626
*/
627-
static inline int ieee80211_is_first_frag(__le16 seq_ctrl)
627+
static inline bool ieee80211_is_first_frag(__le16 seq_ctrl)
628628
{
629629
return (seq_ctrl & cpu_to_le16(IEEE80211_SCTL_FRAG)) == 0;
630630
}

0 commit comments

Comments
 (0)