Skip to contentSkip to conversation

Staging: media: davinci_vpfe: Drop macro and use an in-kernel function

PATCH New Madhumitha Prabakaran 1 participant 1 message Apr 2, 2019

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH v3 1/1 Staging: media: davinci_vpfe: Drop macro and use an in-kernel function

Drop macro CEIL and use an in-kernel function DIV_ROUND_UP.

---
Changes in v3:
- Drop conversion of macro into inline functions and instead use in-kernel function

Changes in v2:
- Corrected commit log spelling
- Made the subject line unique from previous commit

---
 drivers/staging/media/davinci_vpfe/dm365_ipipe.h   | 2 --
 drivers/staging/media/davinci_vpfe/dm365_resizer.c | 4 ++--
 2 files changed, 2 insertions(+), 4 deletions(-)
drivers/staging/media/davinci_vpfe/dm365_ipipe.h +0 -2
index 174334b53f96..866ae12aeb07 100644
@@ -27,8 +27,6 @@
 #include "davinci_vpfe_user.h"
 #include "vpfe_video.h"
 
-#define CEIL(a, b)	(((a) + (b-1)) / (b))
-
 enum ipipe_noise_filter {
 	IPIPE_D2F_1ST = 0,
 	IPIPE_D2F_2ND = 1,
drivers/staging/media/davinci_vpfe/dm365_resizer.c +2 -2
index 9d726298b406..d460963106fa 100644
@@ -386,7 +386,7 @@ resizer_calculate_down_scale_f_div_param(struct device *dev,
 	}
 	o = 10 + (two_power << 2);
 	if (((input_width << 7) / rsz) % 2)
-		o += (((CEIL(rsz, 1024)) << 1) << n);
+		o += ((DIV_ROUND_UP(rsz, 1024) << 1) << n);
 	h2 = output_width - h1;
 	/* phi */
 	val = (h1 * rsz) - (((upper_h1 - (o - 10)) / two_power) << 8);
@@ -630,7 +630,7 @@ resizer_calculate_normal_f_div_param(struct device *dev, int input_width,
 		val /= rsz << 1;
 		val <<= 1;
 		val += 2;
-		o += ((CEIL(rsz, 1024)) << 1);
+		o += (DIV_ROUND_UP(rsz, 1024) << 1);
 		h1 = val;
 	}
 	h2 = output_width - h1;
Signature · 1 line
2.17.1