Remove duplicate code as it already available upstream.

Signed-off-by: crynobone <crynobone@gmail.com>