USB: serial: ch341: add min and max line-speed macros
authorJohan Hovold <johan@kernel.org>
Tue, 30 Jun 2020 09:57:56 +0000 (11:57 +0200)
committerJohan Hovold <johan@kernel.org>
Tue, 30 Jun 2020 10:07:00 +0000 (12:07 +0200)
commit86f6da2951db571255ea0b1af7c6115ab870b757
tree2267012f6b9c682ae3a8801105a6f97c6be6fe08
parent2c509d1cc86dfe8eb70042a055dc039cbe850cf7
USB: serial: ch341: add min and max line-speed macros

The line-speed algorithm clamps the requested value to the supported
range instead of bailing out on unsupported values.

Provide min and max macros and indicate how they are derived instead of
hardcoding the limits.

Note that the algorithm depends on the minimum rate (45.78 bps)
being rounded up (and the maximum rate being rounded down) to avoid
special casing.

Suggested-by: Michael Hanselmann <public@hansmi.ch>
Link: https://lore.kernel.org/r/20200630095756.GZ3334@localhost
Signed-off-by: Johan Hovold <johan@kernel.org>
drivers/usb/serial/ch341.c