]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
lib/math: Move dvb_math.c into lib/math/int_log.c
authorAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Mon, 3 Jul 2023 13:52:08 +0000 (16:52 +0300)
committerMark Brown <broonie@kernel.org>
Sun, 9 Jul 2023 21:47:48 +0000 (22:47 +0100)
Some existing and new users may benefit from the intlog2() and
intlog10() APIs, make them wide available.

Reviewed-by: Mauro Carvalho Chehab <mchehab@kernel.org>
Acked-by: Mauro Carvalho Chehab <mchehab@kernel.org>
Link: https://lore.kernel.org/r/20230619172019.21457-2-andriy.shevchenko@linux.intel.com
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Randy Dunlap <rdunlap@infradead.org>
Link: https://lore.kernel.org/r/20230703135211.87416-2-andriy.shevchenko@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
32 files changed:
Documentation/core-api/kernel-api.rst
Documentation/driver-api/media/dtv-common.rst
drivers/media/dvb-core/Makefile
drivers/media/dvb-frontends/af9013_priv.h
drivers/media/dvb-frontends/af9033_priv.h
drivers/media/dvb-frontends/cxd2820r_priv.h
drivers/media/dvb-frontends/cxd2841er.c
drivers/media/dvb-frontends/cxd2880/cxd2880_tnrdmd_dvbt2_mon.c
drivers/media/dvb-frontends/cxd2880/cxd2880_tnrdmd_dvbt_mon.c
drivers/media/dvb-frontends/cxd2880/cxd2880_top.c
drivers/media/dvb-frontends/dib7000p.c
drivers/media/dvb-frontends/dib8000.c
drivers/media/dvb-frontends/dib9000.c
drivers/media/dvb-frontends/drxk_hard.c
drivers/media/dvb-frontends/lgdt3305.c
drivers/media/dvb-frontends/lgdt3306a.c
drivers/media/dvb-frontends/lgdt330x.c
drivers/media/dvb-frontends/m88ds3103_priv.h
drivers/media/dvb-frontends/mn88443x.c
drivers/media/dvb-frontends/mn88472_priv.h
drivers/media/dvb-frontends/mn88473_priv.h
drivers/media/dvb-frontends/or51132.c
drivers/media/dvb-frontends/or51211.c
drivers/media/dvb-frontends/rtl2830_priv.h
drivers/media/dvb-frontends/rtl2832_priv.h
drivers/media/dvb-frontends/si2165.c
drivers/media/dvb-frontends/stv0367.c
drivers/media/dvb-frontends/tc90522.c
drivers/media/dvb-frontends/tda10048.c
include/linux/int_log.h [moved from include/media/dvb_math.h with 92% similarity]
lib/math/Makefile
lib/math/int_log.c [moved from drivers/media/dvb-core/dvb_math.c with 95% similarity]

index f2bcc5a7ea432d8da0f0dad5105241df8494211e..a526fbe06f86472ffbabc6b3787beacb8cd61544 100644 (file)
@@ -162,8 +162,11 @@ Base 2 log and power Functions
 .. kernel-doc:: include/linux/log2.h
    :internal:
 
-Integer power Functions
------------------------
+Integer log and power Functions
+-------------------------------
+
+.. kernel-doc:: include/linux/int_log.h
+   :export:
 
 .. kernel-doc:: lib/math/int_pow.c
    :export:
index f8b2c4dc81701119d80b0ac2a63ae5fafe62dcff..207a22bcaf4aad3a0745fe4c4a521d7dfdcdca75 100644 (file)
@@ -3,15 +3,6 @@
 Digital TV Common functions
 ---------------------------
 
-Math functions
-~~~~~~~~~~~~~~
-
-Provide some commonly-used math functions, usually required in order to
-estimate signal strength and signal to noise measurements in dB.
-
-.. kernel-doc:: include/media/dvb_math.h
-
-
 DVB devices
 ~~~~~~~~~~~
 
index 62b028ded9f784438175969610608e60f35a9353..1cb3ca67bed9ada84dc179e8e3b5a97f21922ee8 100644 (file)
@@ -8,6 +8,6 @@ dvb-vb2-$(CONFIG_DVB_MMAP) := dvb_vb2.o
 
 dvb-core-objs := dvbdev.o dmxdev.o dvb_demux.o                 \
                 dvb_ca_en50221.o dvb_frontend.o                \
-                $(dvb-net-y) dvb_ringbuffer.o $(dvb-vb2-y) dvb_math.o
+                $(dvb-net-y) dvb_ringbuffer.o $(dvb-vb2-y)
 
 obj-$(CONFIG_DVB_CORE) += dvb-core.o
index 3b9b9424fe1af95387916963234679a651c73c12..bba7a9693a2355d588f012a651bd5bb01b5cdb1d 100644 (file)
@@ -12,7 +12,7 @@
 #define AF9013_PRIV_H
 
 #include <media/dvb_frontend.h>
-#include <media/dvb_math.h>
+#include <linux/int_log.h>
 #include "af9013.h"
 #include <linux/firmware.h>
 #include <linux/i2c-mux.h>
index 0e64da0cdeabb19246ba29a212dd5a6682138596..7560da75ef00a04aaaa5f4fb557b140128f95432 100644 (file)
@@ -14,7 +14,7 @@
 #include <linux/math64.h>
 #include <linux/regmap.h>
 #include <linux/kernel.h>
-#include <media/dvb_math.h>
+#include <linux/int_log.h>
 
 struct reg_val {
        u32 reg;
index 9b4d9cf8563dc762fdab7f528e9b9cbf89e69070..605320bbc12b674d32ebda15b085e460b8493ac9 100644 (file)
@@ -11,7 +11,7 @@
 
 #include <linux/dvb/version.h>
 #include <media/dvb_frontend.h>
-#include <media/dvb_math.h>
+#include <linux/int_log.h>
 #include "cxd2820r.h"
 #include <linux/gpio/driver.h> /* For gpio_chip */
 #include <linux/math64.h>
index 5431f922f55e4806de3c8021781a13cf361dfa32..ef403a9fb7531a257b848914ed8d77aff2fc8f3b 100644 (file)
@@ -22,7 +22,7 @@
 #include <linux/dynamic_debug.h>
 #include <linux/kernel.h>
 
-#include <media/dvb_math.h>
+#include <linux/int_log.h>
 #include <media/dvb_frontend.h>
 #include "cxd2841er.h"
 #include "cxd2841er_priv.h"
index 604580bf7cf781da29aeb81de80f4dd2a2d02e9d..4e173dd87ecfb44de9c944590c719544b6c8e845 100644 (file)
@@ -11,7 +11,7 @@
 #include "cxd2880_tnrdmd_dvbt2.h"
 #include "cxd2880_tnrdmd_dvbt2_mon.h"
 
-#include <media/dvb_math.h>
+#include <linux/int_log.h>
 
 static const int ref_dbm_1000[4][8] = {
        {-96000, -95000, -94000, -93000, -92000, -92000, -98000, -97000},
index fedc3b4a2fa08a234ba903e35ae530a15d20805a..86d5a1e4022a80a5384c9a7c43f9a9719c4e30eb 100644 (file)
@@ -11,7 +11,7 @@
 #include "cxd2880_tnrdmd_dvbt.h"
 #include "cxd2880_tnrdmd_dvbt_mon.h"
 
-#include <media/dvb_math.h>
+#include <linux/int_log.h>
 
 static const int ref_dbm_1000[3][5] = {
        {-93000, -91000, -90000, -89000, -88000},
index d5b1b3788e3927d3da81f991c7cabc92c46542b4..f67b6d24b8d46ce26b4635f613933cdd3e304149 100644 (file)
@@ -11,7 +11,7 @@
 #include <linux/spi/spi.h>
 
 #include <media/dvb_frontend.h>
-#include <media/dvb_math.h>
+#include <linux/int_log.h>
 
 #include "cxd2880.h"
 #include "cxd2880_tnrdmd_mon.h"
index a90d2f51868ff0b9d9e2add77bca6a9f8f087895..b791e687d2e2f29047df54d6cd088cc88a955e50 100644 (file)
@@ -13,7 +13,7 @@
 #include <linux/mutex.h>
 #include <asm/div64.h>
 
-#include <media/dvb_math.h>
+#include <linux/int_log.h>
 #include <media/dvb_frontend.h>
 
 #include "dib7000p.h"
index fe19d127abb3f35727ac816564b766d532adde91..2abda7d1cb6e35fc3da757dc3e66945a94cd8213 100644 (file)
@@ -13,7 +13,7 @@
 #include <linux/mutex.h>
 #include <asm/div64.h>
 
-#include <media/dvb_math.h>
+#include <linux/int_log.h>
 
 #include <media/dvb_frontend.h>
 
index 914ca820c174b05e2a110c2ba0ff7476e03b01c6..1c57587a917a288b3445ffd2a77c7dbd7085590a 100644 (file)
@@ -11,7 +11,7 @@
 #include <linux/i2c.h>
 #include <linux/mutex.h>
 
-#include <media/dvb_math.h>
+#include <linux/int_log.h>
 #include <media/dvb_frontend.h>
 
 #include "dib9000.h"
index 3301ef75d44173692d39fca0656e489987e3ea83..6ad4f202f1bf538879eef447c16438e84000d106 100644 (file)
@@ -20,7 +20,7 @@
 #include <media/dvb_frontend.h>
 #include "drxk.h"
 #include "drxk_hard.h"
-#include <media/dvb_math.h>
+#include <linux/int_log.h>
 
 static int power_down_dvbt(struct drxk_state *state, bool set_power_mode);
 static int power_down_qam(struct drxk_state *state);
index 62d743988919663d62189e9de4d58c68ffb63fa3..c15d3735d34c0d72c43e5ae440d9621b9ab2fac0 100644 (file)
@@ -10,7 +10,7 @@
 #include <asm/div64.h>
 #include <linux/dvb/frontend.h>
 #include <linux/slab.h>
-#include <media/dvb_math.h>
+#include <linux/int_log.h>
 #include "lgdt3305.h"
 
 static int debug;
index 70258884126b0f0114cf21bc17a5e524c2ce3b92..3c6650f6e9a37ce77a7124ee88249d56770749ae 100644 (file)
@@ -12,7 +12,7 @@
 #include <asm/div64.h>
 #include <linux/kernel.h>
 #include <linux/dvb/frontend.h>
-#include <media/dvb_math.h>
+#include <linux/int_log.h>
 #include "lgdt3306a.h"
 #include <linux/i2c-mux.h>
 
index 83565209c3b1ee59965896af970953826dd9f036..97a10996c7facaa50e8f69f82dc8f33d75d31fc3 100644 (file)
@@ -28,7 +28,7 @@
 #include <asm/byteorder.h>
 
 #include <media/dvb_frontend.h>
-#include <media/dvb_math.h>
+#include <linux/int_log.h>
 #include "lgdt330x_priv.h"
 #include "lgdt330x.h"
 
index aa5306f40201eac367d1386202a95de1ecdb241d..594ad9cbc2cc6908800d85f7856208bf95b58c83 100644 (file)
@@ -10,7 +10,7 @@
 
 #include <media/dvb_frontend.h>
 #include "m88ds3103.h"
-#include <media/dvb_math.h>
+#include <linux/int_log.h>
 #include <linux/firmware.h>
 #include <linux/i2c-mux.h>
 #include <linux/regmap.h>
index 2ce5692bc22c4a364f0d1d50b2ff0b9897886f58..db2921c736af94ea5956acfc2ffe2ed955551dac 100644 (file)
@@ -10,7 +10,7 @@
 #include <linux/gpio/consumer.h>
 #include <linux/of_device.h>
 #include <linux/regmap.h>
-#include <media/dvb_math.h>
+#include <linux/int_log.h>
 
 #include "mn88443x.h"
 
index 337562723f88d12a2b962a2150d288a7eee917b1..41f14bd67bfdbce30fdd0ef65937aa3a696923c3 100644 (file)
@@ -9,7 +9,7 @@
 #define MN88472_PRIV_H
 
 #include <media/dvb_frontend.h>
-#include <media/dvb_math.h>
+#include <linux/int_log.h>
 #include "mn88472.h"
 #include <linux/firmware.h>
 #include <linux/regmap.h>
index eca7f4e2b769325f6ee01cf78421ea9387750884..e9daaacfa22fd7131e59ae7d97cd4b88db4559bb 100644 (file)
@@ -9,7 +9,7 @@
 #define MN88473_PRIV_H
 
 #include <media/dvb_frontend.h>
-#include <media/dvb_math.h>
+#include <linux/int_log.h>
 #include "mn88473.h"
 #include <linux/math64.h>
 #include <linux/firmware.h>
index 24de1b115158387e298a307ec52b1b5a0c461c95..355f3598627bff200d1d5f3fcb4b4e9d0fb1f27f 100644 (file)
@@ -27,7 +27,7 @@
 #include <linux/slab.h>
 #include <asm/byteorder.h>
 
-#include <media/dvb_math.h>
+#include <linux/int_log.h>
 #include <media/dvb_frontend.h>
 #include "or51132.h"
 
index ddcaea5c9941f41c2c0e5d2edcc676e1f0ed2f63..ae732dc5116e2fd61d39526f1b16200598d342fc 100644 (file)
@@ -26,7 +26,7 @@
 #include <linux/slab.h>
 #include <asm/byteorder.h>
 
-#include <media/dvb_math.h>
+#include <linux/int_log.h>
 #include <media/dvb_frontend.h>
 #include "or51211.h"
 
index fae78ed785221c782cfa8d95692d419a1d787fbf..ae1fc24a4d84efd4e67a2fe8e2147c4a4999bda9 100644 (file)
@@ -9,7 +9,7 @@
 #define RTL2830_PRIV_H
 
 #include <media/dvb_frontend.h>
-#include <media/dvb_math.h>
+#include <linux/int_log.h>
 #include "rtl2830.h"
 #include <linux/i2c-mux.h>
 #include <linux/math64.h>
index 5f79f95b9475ed9aa5311db57a92eb75b2587fb7..f11ba038d5f0e868cef4a62cb2479e429be719e8 100644 (file)
@@ -14,7 +14,7 @@
 #include <linux/bitops.h>
 
 #include <media/dvb_frontend.h>
-#include <media/dvb_math.h>
+#include <linux/int_log.h>
 #include "rtl2832.h"
 
 struct rtl2832_dev {
index 72810efd1a96a1438e36274044226be57fd9c987..434d003bf397ccd7c49082efacc058f05fee25aa 100644 (file)
@@ -19,7 +19,7 @@
 #include <linux/regmap.h>
 
 #include <media/dvb_frontend.h>
-#include <media/dvb_math.h>
+#include <linux/int_log.h>
 #include "si2165_priv.h"
 #include "si2165.h"
 
index 95e376f23506fb84806df53f1f55470833c5ea26..a93f40617469627c57dada1de2aec7a03d0c3206 100644 (file)
@@ -15,7 +15,7 @@
 #include <linux/slab.h>
 #include <linux/i2c.h>
 
-#include <media/dvb_math.h>
+#include <linux/int_log.h>
 
 #include "stv0367.h"
 #include "stv0367_defs.h"
index 879f028f96828974013ad94a81637a57bcf811a5..1f8cbf45554a716beecdde29b07d8cb33753e660 100644 (file)
@@ -21,7 +21,7 @@
 #include <linux/kernel.h>
 #include <linux/math64.h>
 #include <linux/dvb/frontend.h>
-#include <media/dvb_math.h>
+#include <linux/int_log.h>
 #include "tc90522.h"
 
 #define TC90522_I2C_THRU_REG 0xfe
index 0b3f6999515e358e49bc04b647e4df397e954cd5..3cb4e5270e4fab9817f1fbe3131ee39d2ec39ece 100644 (file)
@@ -16,7 +16,7 @@
 #include <linux/math64.h>
 #include <asm/div64.h>
 #include <media/dvb_frontend.h>
-#include <media/dvb_math.h>
+#include <linux/int_log.h>
 #include "tda10048.h"
 
 #define TDA10048_DEFAULT_FIRMWARE "dvb-fe-tda10048-1.0.fw"
similarity index 92%
rename from include/media/dvb_math.h
rename to include/linux/int_log.h
index 8690ec42954d03bae4b2c65871c887bc26a1ee79..332306202464b8ba477f42de83723e97f290dfdf 100644 (file)
@@ -1,6 +1,5 @@
 /*
- * dvb-math provides some complex fixed-point math
- * operations shared between the dvb related stuff
+ * Provides fixed-point logarithm operations.
  *
  * Copyright (C) 2006 Christoph Pfister (christophpfister@gmail.com)
  *
@@ -15,8 +14,8 @@
  * GNU Lesser General Public License for more details.
  */
 
-#ifndef __DVB_MATH_H
-#define __DVB_MATH_H
+#ifndef __LINUX_INT_LOG_H
+#define __LINUX_INT_LOG_H
 
 #include <linux/types.h>
 
index bfac26ddfc22f295ddb76e6dd34355ac9b6f3c81..91fcdb0c9efe44dd5be7d51fb7549c3a2be3d075 100644 (file)
@@ -1,5 +1,5 @@
 # SPDX-License-Identifier: GPL-2.0-only
-obj-y += div64.o gcd.o lcm.o int_pow.o int_sqrt.o reciprocal_div.o
+obj-y += div64.o gcd.o lcm.o int_log.o int_pow.o int_sqrt.o reciprocal_div.o
 
 obj-$(CONFIG_CORDIC)           += cordic.o
 obj-$(CONFIG_PRIME_NUMBERS)    += prime_numbers.o
similarity index 95%
rename from drivers/media/dvb-core/dvb_math.c
rename to lib/math/int_log.c
index dc90564d7f34bde20d5050278d6cd9ca0fbb253f..322df25a22d6ab0df92ff256de5149ed7120e1ea 100644 (file)
@@ -1,6 +1,5 @@
 /*
- * dvb-math provides some complex fixed-point math
- * operations shared between the dvb related stuff
+ * Provides fixed-point logarithm operations.
  *
  * Copyright (C) 2006 Christoph Pfister (christophpfister@gmail.com)
  *
  */
 
 #include <linux/bitops.h>
+#include <linux/export.h>
+#include <linux/int_log.h>
 #include <linux/kernel.h>
-#include <linux/module.h>
+#include <linux/types.h>
+
 #include <asm/bug.h>
-#include <media/dvb_math.h>
 
 static const unsigned short logtable[256] = {
        0x0000, 0x0171, 0x02e0, 0x044e, 0x05ba, 0x0725, 0x088e, 0x09f7,
@@ -53,7 +54,7 @@ static const unsigned short logtable[256] = {
        0xe82a, 0xe8ef, 0xe9b3, 0xea77, 0xeb3b, 0xebfe, 0xecc1, 0xed83,
        0xee45, 0xef06, 0xefc8, 0xf088, 0xf149, 0xf209, 0xf2c8, 0xf387,
        0xf446, 0xf505, 0xf5c3, 0xf680, 0xf73e, 0xf7fb, 0xf8b7, 0xf973,
-       0xfa2f, 0xfaea, 0xfba5, 0xfc60, 0xfd1a, 0xfdd4, 0xfe8e, 0xff47
+       0xfa2f, 0xfaea, 0xfba5, 0xfc60, 0xfd1a, 0xfdd4, 0xfe8e, 0xff47,
 };
 
 unsigned int intlog2(u32 value)