diff mbox

[05/16] media: fsl-viu: allow building it with COMPILE_TEST

Message ID 20180406111537.04375bdf@vento.lan (mailing list archive)
State New, archived
Headers show

Commit Message

Mauro Carvalho Chehab April 6, 2018, 2:15 p.m. UTC
Em Fri, 6 Apr 2018 11:51:16 +0200
Arnd Bergmann <arnd@arndb.de> escreveu:

> On Fri, Apr 6, 2018 at 11:47 AM, Mauro Carvalho Chehab
> <mchehab@s-opensource.com> wrote:
> 
> > [PATCH] media: fsl-viu: allow building it with COMPILE_TEST
> >
> > There aren't many things that would be needed to allow it
> > to build with compile test.
> >
> > Add the needed bits.
> >
> > Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>  
> 
> Reviewed-by: Arnd Bergmann <arnd@arndb.de>

Actually, in order to avoid warnings with smatch, the COMPILE_TEST
macros should be declared as:

+#define out_be32(v, a)	iowrite32be(a, (void __iomem *)v)
+#define in_be32(a)	ioread32be((void __iomem *)a)

Thanks,
Mauro

[PATCH] media: fsl-viu: allow building it with COMPILE_TEST

There aren't many things that would be needed to allow it
to build with compile test.

Add the needed bits.

Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>

Comments

Arnd Bergmann April 6, 2018, 2:16 p.m. UTC | #1
On Fri, Apr 6, 2018 at 4:15 PM, Mauro Carvalho Chehab
<mchehab@s-opensource.com> wrote:
> Em Fri, 6 Apr 2018 11:51:16 +0200
> Arnd Bergmann <arnd@arndb.de> escreveu:
>
>> On Fri, Apr 6, 2018 at 11:47 AM, Mauro Carvalho Chehab
>> <mchehab@s-opensource.com> wrote:
>>
>> > [PATCH] media: fsl-viu: allow building it with COMPILE_TEST
>> >
>> > There aren't many things that would be needed to allow it
>> > to build with compile test.
>> >
>> > Add the needed bits.
>> >
>> > Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
>>
>> Reviewed-by: Arnd Bergmann <arnd@arndb.de>
>
> Actually, in order to avoid warnings with smatch, the COMPILE_TEST
> macros should be declared as:
>
> +#define out_be32(v, a) iowrite32be(a, (void __iomem *)v)
> +#define in_be32(a)     ioread32be((void __iomem *)a)

I would just add the correct annotations, I think they've always been missing.
2 patches coming in a few minutes.

      Arnd
Mauro Carvalho Chehab April 6, 2018, 2:26 p.m. UTC | #2
Em Fri, 6 Apr 2018 16:16:46 +0200
Arnd Bergmann <arnd@arndb.de> escreveu:

> On Fri, Apr 6, 2018 at 4:15 PM, Mauro Carvalho Chehab
> <mchehab@s-opensource.com> wrote:
> > Em Fri, 6 Apr 2018 11:51:16 +0200
> > Arnd Bergmann <arnd@arndb.de> escreveu:
> >  
> >> On Fri, Apr 6, 2018 at 11:47 AM, Mauro Carvalho Chehab
> >> <mchehab@s-opensource.com> wrote:
> >>  
> >> > [PATCH] media: fsl-viu: allow building it with COMPILE_TEST
> >> >
> >> > There aren't many things that would be needed to allow it
> >> > to build with compile test.
> >> >
> >> > Add the needed bits.
> >> >
> >> > Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>  
> >>
> >> Reviewed-by: Arnd Bergmann <arnd@arndb.de>  
> >
> > Actually, in order to avoid warnings with smatch, the COMPILE_TEST
> > macros should be declared as:
> >
> > +#define out_be32(v, a) iowrite32be(a, (void __iomem *)v)
> > +#define in_be32(a)     ioread32be((void __iomem *)a)  
> 
> I would just add the correct annotations, I think they've always been missing.
> 2 patches coming in a few minutes.

I corrected the annotations too. Now, it gives the same results
building for both arm and x86.

If you want to double check, the full tree is at:

	https://git.linuxtv.org/mchehab/experimental.git/log/?h=compile_test


> 
>       Arnd



Thanks,
Mauro
Arnd Bergmann April 6, 2018, 2:37 p.m. UTC | #3
On Fri, Apr 6, 2018 at 4:26 PM, Mauro Carvalho Chehab
<mchehab@s-opensource.com> wrote:
> Em Fri, 6 Apr 2018 16:16:46 +0200
> Arnd Bergmann <arnd@arndb.de> escreveu:
>
>> On Fri, Apr 6, 2018 at 4:15 PM, Mauro Carvalho Chehab
>> <mchehab@s-opensource.com> wrote:
>> > Em Fri, 6 Apr 2018 11:51:16 +0200
>> > Arnd Bergmann <arnd@arndb.de> escreveu:
>> >
>> >> On Fri, Apr 6, 2018 at 11:47 AM, Mauro Carvalho Chehab
>> >> <mchehab@s-opensource.com> wrote:
>> >>
>> >> > [PATCH] media: fsl-viu: allow building it with COMPILE_TEST
>> >> >
>> >> > There aren't many things that would be needed to allow it
>> >> > to build with compile test.
>> >> >
>> >> > Add the needed bits.
>> >> >
>> >> > Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
>> >>
>> >> Reviewed-by: Arnd Bergmann <arnd@arndb.de>
>> >
>> > Actually, in order to avoid warnings with smatch, the COMPILE_TEST
>> > macros should be declared as:
>> >
>> > +#define out_be32(v, a) iowrite32be(a, (void __iomem *)v)
>> > +#define in_be32(a)     ioread32be((void __iomem *)a)
>>
>> I would just add the correct annotations, I think they've always been missing.
>> 2 patches coming in a few minutes.
>
> I corrected the annotations too. Now, it gives the same results
> building for both arm and x86.
>
> If you want to double check, the full tree is at:
>
>         https://git.linuxtv.org/mchehab/experimental.git/log/?h=compile_test

The __iomem annotations look good, my other patch is still needed to
get a clean build with "make C=1" but doesn't apply cleanly on top of your
version. I assume you'll just fix it up accordingly.

      Arnd
Mauro Carvalho Chehab April 6, 2018, 2:47 p.m. UTC | #4
Em Fri, 6 Apr 2018 16:37:15 +0200
Arnd Bergmann <arnd@arndb.de> escreveu:

> On Fri, Apr 6, 2018 at 4:26 PM, Mauro Carvalho Chehab
> <mchehab@s-opensource.com> wrote:
> > Em Fri, 6 Apr 2018 16:16:46 +0200
> > Arnd Bergmann <arnd@arndb.de> escreveu:
> >  
> >> On Fri, Apr 6, 2018 at 4:15 PM, Mauro Carvalho Chehab
> >> <mchehab@s-opensource.com> wrote:  
> >> > Em Fri, 6 Apr 2018 11:51:16 +0200
> >> > Arnd Bergmann <arnd@arndb.de> escreveu:
> >> >  
> >> >> On Fri, Apr 6, 2018 at 11:47 AM, Mauro Carvalho Chehab
> >> >> <mchehab@s-opensource.com> wrote:
> >> >>  
> >> >> > [PATCH] media: fsl-viu: allow building it with COMPILE_TEST
> >> >> >
> >> >> > There aren't many things that would be needed to allow it
> >> >> > to build with compile test.
> >> >> >
> >> >> > Add the needed bits.
> >> >> >
> >> >> > Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>  
> >> >>
> >> >> Reviewed-by: Arnd Bergmann <arnd@arndb.de>  
> >> >
> >> > Actually, in order to avoid warnings with smatch, the COMPILE_TEST
> >> > macros should be declared as:
> >> >
> >> > +#define out_be32(v, a) iowrite32be(a, (void __iomem *)v)
> >> > +#define in_be32(a)     ioread32be((void __iomem *)a)  
> >>
> >> I would just add the correct annotations, I think they've always been missing.
> >> 2 patches coming in a few minutes.  
> >
> > I corrected the annotations too. Now, it gives the same results
> > building for both arm and x86.
> >
> > If you want to double check, the full tree is at:
> >
> >         https://git.linuxtv.org/mchehab/experimental.git/log/?h=compile_test  
> 
> The __iomem annotations look good, my other patch is still needed to
> get a clean build with "make C=1" but doesn't apply cleanly on top of your
> version. I assume you'll just fix it up accordingly.

Heh, another duplicated patch:

	https://git.linuxtv.org/mchehab/experimental.git/commit/?h=compile_test&id=687520dc31a88c82c694492423c5d9c503cbdebb

That's why it didn't apply cleanly:

$ patch -p1 -i /tmp/media\:\ platform\:\ fsl-viu\:\ mark\ local\ functions\ \'static\'.patch --merge
patching file drivers/media/platform/fsl-viu.c
Hunk #1 already applied at 238.
Hunk #2 already applied at 251.
Hunk #3 already applied at 262.
Hunk #4 already applied at 806.
Hunk #5 already applied at 817.
Hunk #6 already applied at 1305.

Great minds think alike :-)

Thanks,
Mauro
diff mbox

Patch

diff --git a/drivers/media/platform/Kconfig b/drivers/media/platform/Kconfig
index 03c9dfeb7781..e6eb1eb776e1 100644
--- a/drivers/media/platform/Kconfig
+++ b/drivers/media/platform/Kconfig
@@ -42,7 +42,7 @@  config VIDEO_SH_VOU
 
 config VIDEO_VIU
 	tristate "Freescale VIU Video Driver"
-	depends on VIDEO_V4L2 && PPC_MPC512x
+	depends on VIDEO_V4L2 && (PPC_MPC512x || COMPILE_TEST)
 	select VIDEOBUF_DMA_CONTIG
 	default y
 	---help---
diff --git a/drivers/media/platform/fsl-viu.c b/drivers/media/platform/fsl-viu.c
index 9abe79779659..6fd1c8f66047 100644
--- a/drivers/media/platform/fsl-viu.c
+++ b/drivers/media/platform/fsl-viu.c
@@ -36,6 +36,12 @@ 
 #define DRV_NAME		"fsl_viu"
 #define VIU_VERSION		"0.5.1"
 
+/* Allow building this driver with COMPILE_TEST */
+#ifndef CONFIG_PPC
+#define out_be32(v, a)	iowrite32be(a, (void __iomem *)v)
+#define in_be32(a)	ioread32be((void __iomem *)a)
+#endif
+
 #define BUFFER_TIMEOUT		msecs_to_jiffies(500)  /* 0.5 seconds */
 
 #define	VIU_VID_MEM_LIMIT	4	/* Video memory limit, in Mb */
@@ -1407,7 +1413,7 @@  static int viu_of_probe(struct platform_device *op)
 	}
 
 	viu_irq = irq_of_parse_and_map(op->dev.of_node, 0);
-	if (viu_irq == NO_IRQ) {
+	if (!viu_irq) {
 		dev_err(&op->dev, "Error while mapping the irq\n");
 		return -EINVAL;
 	}