Make the code of setting port speed more readable.