* [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
* Re: [PATCH v2] Staging: media: davinci_vpfe: Convert ceil macro into an inline function
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
0 siblings, 1 reply; 5+ messages in thread
From: Greg KH @ 2019-03-29 16:04 UTC (permalink / raw)
To: Madhumitha Prabakaran; +Cc: mchehab, outreachy-kernel
On Wed, Mar 27, 2019 at 01:00:52PM -0500, Madhumitha Prabakaran wrote:
> 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);
> +}
Please just convert the caller to use the in-kernel function for this
instead of having a second one in just this driver.
thanks,
greg k-h
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v2] Staging: media: davinci_vpfe: Convert ceil macro into an inline function
2019-03-29 16:04 ` Greg KH
@ 2019-04-01 22:32 ` Madhumthia Prabakaran
2019-04-02 5:21 ` Greg KH
0 siblings, 1 reply; 5+ messages in thread
From: Madhumthia Prabakaran @ 2019-04-01 22:32 UTC (permalink / raw)
To: Greg KH, outreachy-kernel
On Fri, Mar 29, 2019 at 05:04:51PM +0100, Greg KH wrote:
> On Wed, Mar 27, 2019 at 01:00:52PM -0500, Madhumitha Prabakaran wrote:
> > 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);
> > +}
>
> Please just convert the caller to use the in-kernel function for this
> instead of having a second one in just this driver.
I'm not able to find in-kernel function for ceil. Though there is ceil
function in math.h, which has return type of double, and i'm sure that kernel
cann't accept floating type. how can i resolve this issue?
thanks
>
> thanks,
>
> greg k-h
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v2] Staging: media: davinci_vpfe: Convert ceil macro into an inline function
2019-04-01 22:32 ` Madhumthia Prabakaran
@ 2019-04-02 5:21 ` Greg KH
2019-04-02 14:58 ` Madhumthia Prabakaran
0 siblings, 1 reply; 5+ messages in thread
From: Greg KH @ 2019-04-02 5:21 UTC (permalink / raw)
To: Madhumthia Prabakaran; +Cc: outreachy-kernel
On Mon, Apr 01, 2019 at 05:32:16PM -0500, Madhumthia Prabakaran wrote:
> On Fri, Mar 29, 2019 at 05:04:51PM +0100, Greg KH wrote:
> > On Wed, Mar 27, 2019 at 01:00:52PM -0500, Madhumitha Prabakaran wrote:
> > > 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);
> > > +}
> >
> > Please just convert the caller to use the in-kernel function for this
> > instead of having a second one in just this driver.
>
> I'm not able to find in-kernel function for ceil. Though there is ceil
> function in math.h, which has return type of double, and i'm sure that kernel
> cann't accept floating type. how can i resolve this issue?
The kernel does not have a math.h file, I do not think you are looking
in the kernel include directory.
Look at DIV_ROUND_UP(), that's what you want, right?
thanks,
greg k-h
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v2] Staging: media: davinci_vpfe: Convert ceil macro into an inline function
2019-04-02 5:21 ` Greg KH
@ 2019-04-02 14:58 ` Madhumthia Prabakaran
0 siblings, 0 replies; 5+ messages in thread
From: Madhumthia Prabakaran @ 2019-04-02 14:58 UTC (permalink / raw)
To: Greg KH, outreachy-kernel
On Tue, Apr 02, 2019 at 07:21:51AM +0200, Greg KH wrote:
> On Mon, Apr 01, 2019 at 05:32:16PM -0500, Madhumthia Prabakaran wrote:
> > On Fri, Mar 29, 2019 at 05:04:51PM +0100, Greg KH wrote:
> > > On Wed, Mar 27, 2019 at 01:00:52PM -0500, Madhumitha Prabakaran wrote:
> > > > 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);
> > > > +}
> > >
> > > Please just convert the caller to use the in-kernel function for this
> > > instead of having a second one in just this driver.
> >
> > I'm not able to find in-kernel function for ceil. Though there is ceil
> > function in math.h, which has return type of double, and i'm sure that kernel
> > cann't accept floating type. how can i resolve this issue?
>
> The kernel does not have a math.h file, I do not think you are looking
> in the kernel include directory.
>
> Look at DIV_ROUND_UP(), that's what you want, right?
Thanks
>
> thanks,
>
> greg k-h
^ permalink raw reply [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.