Page MenuHomeFreeBSD

Refactor style of the ENA driver
ClosedPublic

Authored by mk_semihalf.com on Oct 31 2017, 1:39 PM.
Tags
None
Referenced Files
Unknown Object (File)
Dec 4 2024, 5:39 PM
Unknown Object (File)
Dec 4 2024, 5:39 PM
Unknown Object (File)
Nov 25 2024, 5:01 AM
Unknown Object (File)
Nov 21 2024, 12:33 PM
Unknown Object (File)
Oct 22 2024, 4:38 PM
Unknown Object (File)
Oct 9 2024, 10:36 PM
Unknown Object (File)
Sep 16 2024, 4:25 PM
Unknown Object (File)
Sep 16 2024, 12:51 AM

Details

Summary
  • Change all conditional checks in "if" statement to boolean expressions
  • Initialzie variables with too complex values outside the declaration
  • Fix indentations
  • Move code associated with sysctls to ena_sysctl.c file
  • For consistency, remove unnecesary "return" from void functions
  • Use if_getdrvflags() function instead of accesing variable directly

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

Most of these changes look to be in the right direction. I don't think evaluating if a bool == true or == false is necessary. In some places parentheses have been added which are not strictly needed, I don't feel strongly about those either way. I did not evaluate for completeness.

sys/dev/ena/ena.c
1430 ↗(On Diff #34523)

This one is not necessary, rss_support is already a bool.

1433 ↗(On Diff #34523)

As above, frag is bool.

1434 ↗(On Diff #34523)

style(9) discourages excess parentheses when the parsing is not confusing. I don't have a complaint if you prefer to parenthesize this, but FYI it is not required by style.

1587–1598 ↗(On Diff #34523)

As above, l3_csum_err and l4_csum_err are already bools.

The boolean variables are no longer compared explicitly to true/false.

sys/dev/ena/ena.c
2220 ↗(On Diff #34672)

Please correct the condition or leave the original version, if running field is boolean.

2455 ↗(On Diff #34672)

Please align lines 2427 and 2428

2980 ↗(On Diff #34672)

is_drbr_empty is should be treated as boolean

mk_semihalf.com marked 3 inline comments as done.

Fix style issues and invalid conditional check

This revision is now accepted and ready to land.Nov 9 2017, 11:27 AM
This revision was automatically updated to reflect the committed changes.