Merge tag 'io_uring-5.11-2021-01-16' of git://git.kernel.dk/linux-block
[linux/fpc-iii.git] / drivers / media / dvb-frontends / cxd2880 / cxd2880_common.c
blobd6f5af6609c12ca1a008c9007609db37f26fd687
1 // SPDX-License-Identifier: GPL-2.0
2 /*
3 * cxd2880_common.c
4 * Sony CXD2880 DVB-T2/T tuner + demodulator driver
5 * common functions
7 * Copyright (C) 2016, 2017, 2018 Sony Semiconductor Solutions Corporation
8 */
10 #include "cxd2880_common.h"
12 int cxd2880_convert2s_complement(u32 value, u32 bitlen)
14 if (!bitlen || bitlen >= 32)
15 return (int)value;
17 if (value & (u32)(1 << (bitlen - 1)))
18 return (int)(GENMASK(31, bitlen) | value);
19 else
20 return (int)(GENMASK(bitlen - 1, 0) & value);