18c2ecf20Sopenharmony_ci// SPDX-License-Identifier: GPL-2.0 28c2ecf20Sopenharmony_ci#include <linux/bcd.h> 38c2ecf20Sopenharmony_ci#include <linux/export.h> 48c2ecf20Sopenharmony_ci 58c2ecf20Sopenharmony_ciunsigned _bcd2bin(unsigned char val) 68c2ecf20Sopenharmony_ci{ 78c2ecf20Sopenharmony_ci return (val & 0x0f) + (val >> 4) * 10; 88c2ecf20Sopenharmony_ci} 98c2ecf20Sopenharmony_ciEXPORT_SYMBOL(_bcd2bin); 108c2ecf20Sopenharmony_ci 118c2ecf20Sopenharmony_ciunsigned char _bin2bcd(unsigned val) 128c2ecf20Sopenharmony_ci{ 138c2ecf20Sopenharmony_ci return ((val / 10) << 4) + val % 10; 148c2ecf20Sopenharmony_ci} 158c2ecf20Sopenharmony_ciEXPORT_SYMBOL(_bin2bcd); 16