diff mbox series

[Outreachy,kernel,1/4,v2] staging: media: omap4iss: Replace macro function by static inline function in file iss.c

Message ID e302566a3d9e5180ab27eb2c2824fd1b678a6d99.1618231618.git.alinesantanacordeiro@gmail.com (mailing list archive)
State New, archived
Headers show
Series [Outreachy,kernel,1/4,v2] staging: media: omap4iss: Replace macro function by static inline function in file iss.c | expand

Commit Message

Aline Santana Cordeiro April 12, 2021, 12:57 p.m. UTC
Replace macro function by static inline function.
Issue suggested by Julia.

Signed-off-by: Aline Santana Cordeiro <alinesantanacordeiro@gmail.com>
---

Changes since v1:
 - Insert file path in commit message

 drivers/staging/media/omap4iss/iss.c | 24 +++++++++++++-----------
 1 file changed, 13 insertions(+), 11 deletions(-)

Comments

Laurent Pinchart April 12, 2021, 1:40 p.m. UTC | #1
Hi Aline,

While testing on a device isn't a requirement as you can't be expected
to have the necessary hardware, changes are expected to be at least
compile-tested before being submitted.

On Mon, Apr 12, 2021 at 09:57:09AM -0300, Aline Santana Cordeiro wrote:
> Replace macro function by static inline function.
> Issue suggested by Julia.
> 
> Signed-off-by: Aline Santana Cordeiro <alinesantanacordeiro@gmail.com>
> ---
> 
> Changes since v1:
>  - Insert file path in commit message
> 
>  drivers/staging/media/omap4iss/iss.c | 24 +++++++++++++-----------
>  1 file changed, 13 insertions(+), 11 deletions(-)
> 
> diff --git a/drivers/staging/media/omap4iss/iss.c b/drivers/staging/media/omap4iss/iss.c
> index c89f268a..3bbc39e 100644
> --- a/drivers/staging/media/omap4iss/iss.c
> +++ b/drivers/staging/media/omap4iss/iss.c
> @@ -27,22 +27,24 @@
>  #include "iss.h"
>  #include "iss_regs.h"
>  
> -#define ISS_PRINT_REGISTER(iss, name)\
> -	dev_dbg(iss->dev, "###ISS " #name "=0x%08x\n", \
> -		iss_reg_read(iss, OMAP4_ISS_MEM_TOP, ISS_##name))
> +static inline iss_print_register(iss, name)
> +{
> +	dev_dbg(iss->dev, "###ISS " #name "=0x%08x\n",
> +		iss_reg_read(iss, OMAP4_ISS_MEM_TOP, ISS_##name));
> +}
>  
>  static void iss_print_status(struct iss_device *iss)
>  {
>  	dev_dbg(iss->dev, "-------------ISS HL Register dump-------------\n");
>  
> -	ISS_PRINT_REGISTER(iss, HL_REVISION);
> -	ISS_PRINT_REGISTER(iss, HL_SYSCONFIG);
> -	ISS_PRINT_REGISTER(iss, HL_IRQSTATUS(5));
> -	ISS_PRINT_REGISTER(iss, HL_IRQENABLE_SET(5));
> -	ISS_PRINT_REGISTER(iss, HL_IRQENABLE_CLR(5));
> -	ISS_PRINT_REGISTER(iss, CTRL);
> -	ISS_PRINT_REGISTER(iss, CLKCTRL);
> -	ISS_PRINT_REGISTER(iss, CLKSTAT);
> +	iss_print_register(iss, HL_REVISION);
> +	iss_print_register(iss, HL_SYSCONFIG);
> +	iss_print_register(iss, HL_IRQSTATUS(5));
> +	iss_print_register(iss, HL_IRQENABLE_SET(5));
> +	iss_print_register(iss, HL_IRQENABLE_CLR(5));
> +	iss_print_register(iss, CTRL);
> +	iss_print_register(iss, CLKCTRL);
> +	iss_print_register(iss, CLKSTAT);
>  
>  	dev_dbg(iss->dev, "-----------------------------------------------\n");
>  }
Aline Santana Cordeiro April 12, 2021, 1:58 p.m. UTC | #2
Em seg, 2021-04-12 às 16:40 +0300, Laurent Pinchart escreveu:
> While testing on a device isn't a requirement as you can't be
> expected
> to have the necessary hardware, changes are expected to be at least
> compile-tested before being submitted.

Hi Laurent,

I thought recompiling the kernel would be enough in this case.
I recompiled it in native Ubuntu 16.04 without errors.

Thank you for the feedback.
Aline
Laurent Pinchart April 12, 2021, 3:11 p.m. UTC | #3
Hi Aline,

On Mon, Apr 12, 2021 at 10:58:45AM -0300, ascordeiro wrote:
> Em seg, 2021-04-12 às 16:40 +0300, Laurent Pinchart escreveu:
> > While testing on a device isn't a requirement as you can't be expected
> > to have the necessary hardware, changes are expected to be at least
> > compile-tested before being submitted.
> 
> Hi Laurent,
> 
> I thought recompiling the kernel would be enough in this case.
> I recompiled it in native Ubuntu 16.04 without errors.

Did it compile the driver you modified ?
Aline Santana Cordeiro April 12, 2021, 5:29 p.m. UTC | #4
Em seg, 2021-04-12 às 18:11 +0300, Laurent Pinchart escreveu:
> Hi Aline,
> 
> On Mon, Apr 12, 2021 at 10:58:45AM -0300, ascordeiro wrote:
> > Em seg, 2021-04-12 às 16:40 +0300, Laurent Pinchart escreveu:
> > > While testing on a device isn't a requirement as you can't be
> > > expected
> > > to have the necessary hardware, changes are expected to be at
> > > least
> > > compile-tested before being submitted.
> > 
> > Hi Laurent,
> > 
> > I thought recompiling the kernel would be enough in this case.
> > I recompiled it in native Ubuntu 16.04 without errors.
> 
> Did it compile the driver you modified ?
> 
I'm sorry, It didn't. I forgot to enable the option to compile the
driver as a module in "make menuconfig" and now I'm seeing the problems
I generated.

Thank you for warning me,
Aline
Julia Lawall April 12, 2021, 5:36 p.m. UTC | #5
On Mon, 12 Apr 2021, ascordeiro wrote:

> Em seg, 2021-04-12 às 18:11 +0300, Laurent Pinchart escreveu:
> > Hi Aline,
> >
> > On Mon, Apr 12, 2021 at 10:58:45AM -0300, ascordeiro wrote:
> > > Em seg, 2021-04-12 às 16:40 +0300, Laurent Pinchart escreveu:
> > > > While testing on a device isn't a requirement as you can't be
> > > > expected
> > > > to have the necessary hardware, changes are expected to be at
> > > > least
> > > > compile-tested before being submitted.
> > >
> > > Hi Laurent,
> > >
> > > I thought recompiling the kernel would be enough in this case.
> > > I recompiled it in native Ubuntu 16.04 without errors.
> >
> > Did it compile the driver you modified ?
> >
> I'm sorry, It didn't. I forgot to enable the option to compile the
> driver as a module in "make menuconfig" and now I'm seeing the problems
> I generated.

You can easily compile a single file using make path/foo.o and a single
directory using make path/.

julia
Aline Santana Cordeiro April 12, 2021, 5:39 p.m. UTC | #6
Em seg, 2021-04-12 às 19:36 +0200, Julia Lawall escreveu:
> 
> 
> On Mon, 12 Apr 2021, ascordeiro wrote:
> 
> > Em seg, 2021-04-12 às 18:11 +0300, Laurent Pinchart escreveu:
> > > Hi Aline,
> > > 
> > > On Mon, Apr 12, 2021 at 10:58:45AM -0300, ascordeiro wrote:
> > > > Em seg, 2021-04-12 às 16:40 +0300, Laurent Pinchart escreveu:
> > > > > While testing on a device isn't a requirement as you can't be
> > > > > expected
> > > > > to have the necessary hardware, changes are expected to be at
> > > > > least
> > > > > compile-tested before being submitted.
> > > > 
> > > > Hi Laurent,
> > > > 
> > > > I thought recompiling the kernel would be enough in this case.
> > > > I recompiled it in native Ubuntu 16.04 without errors.
> > > 
> > > Did it compile the driver you modified ?
> > > 
> > I'm sorry, It didn't. I forgot to enable the option to compile the
> > driver as a module in "make menuconfig" and now I'm seeing the
> > problems
> > I generated.
> 
> You can easily compile a single file using make path/foo.o and a
> single
> directory using make path/.
> 
> julia

Ok! I'll do that from now on.

Thank you for the help,
Aline
diff mbox series

Patch

diff --git a/drivers/staging/media/omap4iss/iss.c b/drivers/staging/media/omap4iss/iss.c
index c89f268a..3bbc39e 100644
--- a/drivers/staging/media/omap4iss/iss.c
+++ b/drivers/staging/media/omap4iss/iss.c
@@ -27,22 +27,24 @@ 
 #include "iss.h"
 #include "iss_regs.h"
 
-#define ISS_PRINT_REGISTER(iss, name)\
-	dev_dbg(iss->dev, "###ISS " #name "=0x%08x\n", \
-		iss_reg_read(iss, OMAP4_ISS_MEM_TOP, ISS_##name))
+static inline iss_print_register(iss, name)
+{
+	dev_dbg(iss->dev, "###ISS " #name "=0x%08x\n",
+		iss_reg_read(iss, OMAP4_ISS_MEM_TOP, ISS_##name));
+}
 
 static void iss_print_status(struct iss_device *iss)
 {
 	dev_dbg(iss->dev, "-------------ISS HL Register dump-------------\n");
 
-	ISS_PRINT_REGISTER(iss, HL_REVISION);
-	ISS_PRINT_REGISTER(iss, HL_SYSCONFIG);
-	ISS_PRINT_REGISTER(iss, HL_IRQSTATUS(5));
-	ISS_PRINT_REGISTER(iss, HL_IRQENABLE_SET(5));
-	ISS_PRINT_REGISTER(iss, HL_IRQENABLE_CLR(5));
-	ISS_PRINT_REGISTER(iss, CTRL);
-	ISS_PRINT_REGISTER(iss, CLKCTRL);
-	ISS_PRINT_REGISTER(iss, CLKSTAT);
+	iss_print_register(iss, HL_REVISION);
+	iss_print_register(iss, HL_SYSCONFIG);
+	iss_print_register(iss, HL_IRQSTATUS(5));
+	iss_print_register(iss, HL_IRQENABLE_SET(5));
+	iss_print_register(iss, HL_IRQENABLE_CLR(5));
+	iss_print_register(iss, CTRL);
+	iss_print_register(iss, CLKCTRL);
+	iss_print_register(iss, CLKSTAT);
 
 	dev_dbg(iss->dev, "-----------------------------------------------\n");
 }