All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] Staging: media: davinci_vpfe: Convert ceil macro into an inline function
@ 2019-03-27 18:00 Madhumitha Prabakaran
  2019-03-29 16:04 ` Greg KH
  0 siblings, 1 reply; 5+ messages in thread
From: Madhumitha Prabakaran @ 2019-03-27 18:00 UTC (permalink / raw)
  To: mchehab, gregkh, outreachy-kernel; +Cc: Madhumitha Prabakaran

Convert macro into an inline function in order to maintain Linux kernel
coding style based on which the inline function is preferable over the
macro.

Signed-off-by: Madhumitha Prabakaran <madhumithabiw@gmail.com>

---
Changes in v2 -

- Corrected commit log spelling
- Made the subject line unique from previous commit
---
 drivers/staging/media/davinci_vpfe/dm365_ipipe.h   | 5 ++++-
 drivers/staging/media/davinci_vpfe/dm365_resizer.c | 4 ++--
 2 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/media/davinci_vpfe/dm365_ipipe.h b/drivers/staging/media/davinci_vpfe/dm365_ipipe.h
index 174334b53f96..32dce3c95304 100644
--- a/drivers/staging/media/davinci_vpfe/dm365_ipipe.h
+++ b/drivers/staging/media/davinci_vpfe/dm365_ipipe.h
@@ -27,7 +27,10 @@
 #include "davinci_vpfe_user.h"
 #include "vpfe_video.h"
 
-#define CEIL(a, b)	(((a) + (b-1)) / (b))
+inline unsigned int ceil(unsigned int a, unsigned int b)
+{
+	return ((a + (b - 1)) / b);
+}
 
 enum ipipe_noise_filter {
 	IPIPE_D2F_1ST = 0,
diff --git a/drivers/staging/media/davinci_vpfe/dm365_resizer.c b/drivers/staging/media/davinci_vpfe/dm365_resizer.c
index 9d726298b406..395c66520932 100644
--- a/drivers/staging/media/davinci_vpfe/dm365_resizer.c
+++ b/drivers/staging/media/davinci_vpfe/dm365_resizer.c
@@ -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 += ((ceil(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 += (ceil(rsz, 1024) << 1);
 		h1 = val;
 	}
 	h2 = output_width - h1;
-- 
2.17.1



^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2019-04-02 14:58 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-03-27 18:00 [PATCH v2] Staging: media: davinci_vpfe: Convert ceil macro into an inline function Madhumitha Prabakaran
2019-03-29 16:04 ` Greg KH
2019-04-01 22:32   ` Madhumthia Prabakaran
2019-04-02  5:21     ` Greg KH
2019-04-02 14:58       ` Madhumthia Prabakaran

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.