]> git.baikalelectronics.ru Git - kernel.git/commit
net: ipa: rearrange functions for similarity
authorAlex Elder <elder@linaro.org>
Thu, 22 Sep 2022 22:20:55 +0000 (17:20 -0500)
committerJakub Kicinski <kuba@kernel.org>
Sat, 24 Sep 2022 03:56:28 +0000 (20:56 -0700)
commit0e200275851e1e9b80ceb5a2465c7c854b4fa455
tree6517e11b0656b7819b5e11c45e713844f06c115b
parentabcbdc18c3f50723dd7de19564faac77603af2d7
net: ipa: rearrange functions for similarity

Both aggr_time_limit_encode() and hol_block_timer_encode() figure
out how to encode a millisecond time value so it can be programmed
into a register.  Rearranging them a bit can make their similarity
more obvious, with both taking essentially the same form.

To do this:
  - Return 0 immediately in aggr_time_limit_encode() if the
    microseconds value supplied is zero.
  - Reverse the test at top of aggr_time_limit_encode(), so we
    compute and return the Qtime value in the "true" block,
    and compute the result the old way otherwise.
  - Open-code (and eliminate) hol_block_timer_qtime_encode() at the
    top of hol_block_timer_encode() in the case we use Qtimer.

Signed-off-by: Alex Elder <elder@linaro.org>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/ipa/ipa_endpoint.c