]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
media: atomisp: Replace rarely used macro from math_support.h
authorAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Tue, 13 Aug 2024 13:12:25 +0000 (15:12 +0200)
committerMauro Carvalho Chehab <mchehab+huawei@kernel.org>
Fri, 6 Sep 2024 09:56:54 +0000 (11:56 +0200)
Replace rarely used macro by generic ones from Linux kernel headers.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20240813131225.2232817-1-andriy.shevchenko@linux.intel.com
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
drivers/staging/media/atomisp/pci/hive_isp_css_include/math_support.h
drivers/staging/media/atomisp/pci/isp/kernels/ipu2_io_ls/bayer_io_ls/ia_css_bayer_io.host.c
drivers/staging/media/atomisp/pci/isp/kernels/ipu2_io_ls/yuv444_io_ls/ia_css_yuv444_io.host.c
drivers/staging/media/atomisp/pci/runtime/binary/src/binary.c
drivers/staging/media/atomisp/pci/runtime/isys/src/virtual_isys.c

index 160c496784b7fc775f99fbdd52784493c3bfce9d..907f9ebcc60db44ae153b4a06d76a1c31e760733 100644 (file)
 #define CEIL_SHIFT(a, b)     (((a) + (1 << (b)) - 1) >> (b))
 #define CEIL_SHIFT_MUL(a, b) (CEIL_SHIFT(a, b) << (b))
 
-#if !defined(PIPE_GENERATION)
-
-#define ceil_div(a, b)         (CEIL_DIV(a, b))
-
-#endif /* !defined(PIPE_GENERATION) */
-
 /*
  * For SP and ISP, SDK provides the definition of OP_std_modadd.
  * We need it only for host
index 0091e2a3da526098b3239db49d3c97b97c074740..c32659894c29d5d01c63aab9468f0ee9e32c28ef 100644 (file)
  * more details.
  */
 
+#include <linux/bitops.h>
+#include <linux/math.h>
+
 #include "ia_css_bayer_io.host.h"
 #include "dma.h"
-#include "math_support.h"
 #ifndef IA_CSS_NO_DEBUG
 #include "ia_css_debug.h"
 #endif
@@ -29,9 +31,8 @@ int ia_css_bayer_io_config(const struct ia_css_binary      *binary,
        const struct ia_css_frame **out_frames = (const struct ia_css_frame **)
                &args->out_frame;
        const struct ia_css_frame_info *in_frame_info = ia_css_frame_get_info(in_frame);
-       const unsigned int ddr_bits_per_element = sizeof(short) * 8;
-       const unsigned int ddr_elems_per_word = ceil_div(HIVE_ISP_DDR_WORD_BITS,
-                                               ddr_bits_per_element);
+       const unsigned int ddr_elems_per_word =
+               DIV_ROUND_UP(HIVE_ISP_DDR_WORD_BITS, BITS_PER_TYPE(short));
        unsigned int size_get = 0, size_put = 0;
        unsigned int offset = 0;
        int ret;
index 32c504a950cef1fd843d6222bbf58de1665ea7be..5b2d5023b5eeedb4ce76a65789ff3abbb5e99557 100644 (file)
@@ -13,9 +13,11 @@ FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
 more details.
 */
 
+#include <linux/bitops.h>
+#include <linux/math.h>
+
 #include "ia_css_yuv444_io.host.h"
 #include "dma.h"
-#include "math_support.h"
 #ifndef IA_CSS_NO_DEBUG
 #include "ia_css_debug.h"
 #endif
@@ -29,9 +31,8 @@ int ia_css_yuv444_io_config(const struct ia_css_binary      *binary,
        const struct ia_css_frame **out_frames = (const struct ia_css_frame **)
                &args->out_frame;
        const struct ia_css_frame_info *in_frame_info = ia_css_frame_get_info(in_frame);
-       const unsigned int ddr_bits_per_element = sizeof(short) * 8;
-       const unsigned int ddr_elems_per_word = ceil_div(HIVE_ISP_DDR_WORD_BITS,
-                                               ddr_bits_per_element);
+       const unsigned int ddr_elems_per_word =
+               DIV_ROUND_UP(HIVE_ISP_DDR_WORD_BITS, BITS_PER_TYPE(short));
        unsigned int size_get = 0, size_put = 0;
        unsigned int offset = 0;
        int ret;
index b0f904a5e442ee9108bf809baae430b6dd7ddb2c..2ff522f7dec8c6138f670975bd3abf31bada0a53 100644 (file)
@@ -328,7 +328,8 @@ ia_css_binary_dvs_grid_info(const struct ia_css_binary *binary,
 
        dvs_info = &info->dvs_grid.dvs_grid_info;
 
-       /* for DIS, we use a division instead of a ceil_div. If this is smaller
+       /*
+        * For DIS, we use a division instead of a DIV_ROUND_UP(). If this is smaller
         * than the 3a grid size, it indicates that the outer values are not
         * valid for DIS.
         */
index 52483498239d2d837f191c7b569b8296be17e69f..2e0193671f4b0d5bbad305159e51bfd775b00cc2 100644 (file)
@@ -13,6 +13,8 @@
  * more details.
  */
 
+#include <linux/bitops.h>
+#include <linux/math.h>
 #include <linux/string.h> /* for memcpy() */
 
 #include "system_global.h"
@@ -20,7 +22,6 @@
 
 #include "ia_css_isys.h"
 #include "ia_css_debug.h"
-#include "math_support.h"
 #include "virtual_isys.h"
 #include "isp.h"
 #include "sh_css_defs.h"
@@ -558,7 +559,7 @@ static int32_t calculate_stride(
                bits_per_pixel = CEIL_MUL(bits_per_pixel, 8);
 
        pixels_per_word = HIVE_ISP_DDR_WORD_BITS / bits_per_pixel;
-       words_per_line  = ceil_div(pixels_per_line_padded, pixels_per_word);
+       words_per_line  = DIV_ROUND_UP(pixels_per_line_padded, pixels_per_word);
        bytes_per_line  = HIVE_ISP_DDR_WORD_BYTES * words_per_line;
 
        return bytes_per_line;
@@ -690,7 +691,6 @@ static bool calculate_ibuf_ctrl_cfg(
     const isp2401_input_system_cfg_t   *isys_cfg,
     ibuf_ctrl_cfg_t                    *cfg)
 {
-       const s32 bits_per_byte = 8;
        s32 bits_per_pixel;
        s32 bytes_per_pixel;
        s32 left_padding;
@@ -698,7 +698,7 @@ static bool calculate_ibuf_ctrl_cfg(
        (void)input_port;
 
        bits_per_pixel = isys_cfg->input_port_resolution.bits_per_pixel;
-       bytes_per_pixel = ceil_div(bits_per_pixel, bits_per_byte);
+       bytes_per_pixel = BITS_TO_BYTES(bits_per_pixel);
 
        left_padding = CEIL_MUL(isys_cfg->output_port_attr.left_padding, ISP_VEC_NELEMS)
                       * bytes_per_pixel;