Skip to content

Commit 1f24d0b

Browse files
andy-shevmchehab
authored andcommitted
media: atomisp: Replace rarely used macro from math_support.h
Replace rarely used macro by generic ones from Linux kernel headers. Signed-off-by: Andy Shevchenko <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Hans de Goede <[email protected]> Signed-off-by: Mauro Carvalho Chehab <[email protected]>
1 parent 9e3513a commit 1f24d0b

File tree

5 files changed

+16
-19
lines changed

5 files changed

+16
-19
lines changed

drivers/staging/media/atomisp/pci/hive_isp_css_include/math_support.h

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,6 @@
2828
#define CEIL_SHIFT(a, b) (((a) + (1 << (b)) - 1) >> (b))
2929
#define CEIL_SHIFT_MUL(a, b) (CEIL_SHIFT(a, b) << (b))
3030

31-
#if !defined(PIPE_GENERATION)
32-
33-
#define ceil_div(a, b) (CEIL_DIV(a, b))
34-
35-
#endif /* !defined(PIPE_GENERATION) */
36-
3731
/*
3832
* For SP and ISP, SDK provides the definition of OP_std_modadd.
3933
* We need it only for host

drivers/staging/media/atomisp/pci/isp/kernels/ipu2_io_ls/bayer_io_ls/ia_css_bayer_io.host.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,11 @@
1313
* more details.
1414
*/
1515

16+
#include <linux/bitops.h>
17+
#include <linux/math.h>
18+
1619
#include "ia_css_bayer_io.host.h"
1720
#include "dma.h"
18-
#include "math_support.h"
1921
#ifndef IA_CSS_NO_DEBUG
2022
#include "ia_css_debug.h"
2123
#endif
@@ -29,9 +31,8 @@ int ia_css_bayer_io_config(const struct ia_css_binary *binary,
2931
const struct ia_css_frame **out_frames = (const struct ia_css_frame **)
3032
&args->out_frame;
3133
const struct ia_css_frame_info *in_frame_info = ia_css_frame_get_info(in_frame);
32-
const unsigned int ddr_bits_per_element = sizeof(short) * 8;
33-
const unsigned int ddr_elems_per_word = ceil_div(HIVE_ISP_DDR_WORD_BITS,
34-
ddr_bits_per_element);
34+
const unsigned int ddr_elems_per_word =
35+
DIV_ROUND_UP(HIVE_ISP_DDR_WORD_BITS, BITS_PER_TYPE(short));
3536
unsigned int size_get = 0, size_put = 0;
3637
unsigned int offset = 0;
3738
int ret;

drivers/staging/media/atomisp/pci/isp/kernels/ipu2_io_ls/yuv444_io_ls/ia_css_yuv444_io.host.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,11 @@ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
1313
more details.
1414
*/
1515

16+
#include <linux/bitops.h>
17+
#include <linux/math.h>
18+
1619
#include "ia_css_yuv444_io.host.h"
1720
#include "dma.h"
18-
#include "math_support.h"
1921
#ifndef IA_CSS_NO_DEBUG
2022
#include "ia_css_debug.h"
2123
#endif
@@ -29,9 +31,8 @@ int ia_css_yuv444_io_config(const struct ia_css_binary *binary,
2931
const struct ia_css_frame **out_frames = (const struct ia_css_frame **)
3032
&args->out_frame;
3133
const struct ia_css_frame_info *in_frame_info = ia_css_frame_get_info(in_frame);
32-
const unsigned int ddr_bits_per_element = sizeof(short) * 8;
33-
const unsigned int ddr_elems_per_word = ceil_div(HIVE_ISP_DDR_WORD_BITS,
34-
ddr_bits_per_element);
34+
const unsigned int ddr_elems_per_word =
35+
DIV_ROUND_UP(HIVE_ISP_DDR_WORD_BITS, BITS_PER_TYPE(short));
3536
unsigned int size_get = 0, size_put = 0;
3637
unsigned int offset = 0;
3738
int ret;

drivers/staging/media/atomisp/pci/runtime/binary/src/binary.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -328,7 +328,8 @@ ia_css_binary_dvs_grid_info(const struct ia_css_binary *binary,
328328

329329
dvs_info = &info->dvs_grid.dvs_grid_info;
330330

331-
/* for DIS, we use a division instead of a ceil_div. If this is smaller
331+
/*
332+
* For DIS, we use a division instead of a DIV_ROUND_UP(). If this is smaller
332333
* than the 3a grid size, it indicates that the outer values are not
333334
* valid for DIS.
334335
*/

drivers/staging/media/atomisp/pci/runtime/isys/src/virtual_isys.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,15 @@
1313
* more details.
1414
*/
1515

16+
#include <linux/bitops.h>
17+
#include <linux/math.h>
1618
#include <linux/string.h> /* for memcpy() */
1719

1820
#include "system_global.h"
1921

2022

2123
#include "ia_css_isys.h"
2224
#include "ia_css_debug.h"
23-
#include "math_support.h"
2425
#include "virtual_isys.h"
2526
#include "isp.h"
2627
#include "sh_css_defs.h"
@@ -558,7 +559,7 @@ static int32_t calculate_stride(
558559
bits_per_pixel = CEIL_MUL(bits_per_pixel, 8);
559560

560561
pixels_per_word = HIVE_ISP_DDR_WORD_BITS / bits_per_pixel;
561-
words_per_line = ceil_div(pixels_per_line_padded, pixels_per_word);
562+
words_per_line = DIV_ROUND_UP(pixels_per_line_padded, pixels_per_word);
562563
bytes_per_line = HIVE_ISP_DDR_WORD_BYTES * words_per_line;
563564

564565
return bytes_per_line;
@@ -690,15 +691,14 @@ static bool calculate_ibuf_ctrl_cfg(
690691
const isp2401_input_system_cfg_t *isys_cfg,
691692
ibuf_ctrl_cfg_t *cfg)
692693
{
693-
const s32 bits_per_byte = 8;
694694
s32 bits_per_pixel;
695695
s32 bytes_per_pixel;
696696
s32 left_padding;
697697

698698
(void)input_port;
699699

700700
bits_per_pixel = isys_cfg->input_port_resolution.bits_per_pixel;
701-
bytes_per_pixel = ceil_div(bits_per_pixel, bits_per_byte);
701+
bytes_per_pixel = BITS_TO_BYTES(bits_per_pixel);
702702

703703
left_padding = CEIL_MUL(isys_cfg->output_port_attr.left_padding, ISP_VEC_NELEMS)
704704
* bytes_per_pixel;

0 commit comments

Comments
 (0)