channels/serial: code cleanup