linux-media.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] media: s5p-jpeg: change "RST" to "RSET" to fix build warnings
@ 2021-09-05 23:57 Randy Dunlap
  2021-09-06  6:51 ` Mauro Carvalho Chehab
  0 siblings, 1 reply; 3+ messages in thread
From: Randy Dunlap @ 2021-09-05 23:57 UTC (permalink / raw)
  To: linux-kernel
  Cc: Randy Dunlap, kernel test robot, Mauro Carvalho Chehab,
	linux-media, Andrzej Pietrasiewicz, Jacek Anaszewski,
	Sylwester Nawrocki, linux-arm-kernel

The use of a macro named 'RST' conflicts with one of the same name
in arch/mips/include/asm/mach-rc32434/rb.h. This causes build
warnings on some MIPS builds.

Change the use of RST to the name RSET.

Fixes these build warnings:

In file included from ../drivers/media/platform/s5p-jpeg/jpeg-hw-exynos3250.c:14:
../drivers/media/platform/s5p-jpeg/jpeg-core.h:43: warning: "RST" redefined
   43 | #define RST                             0xd0
      | 
../arch/mips/include/asm/mach-rc32434/rb.h:13: note: this is the location of the previous definition
   13 | #define RST             (1 << 15)

In file included from ../drivers/media/platform/s5p-jpeg/jpeg-hw-s5p.c:13:
../drivers/media/platform/s5p-jpeg/jpeg-core.h:43: warning: "RST" redefined
   43 | #define RST                             0xd0
../arch/mips/include/asm/mach-rc32434/rb.h:13: note: this is the location of the previous definition
   13 | #define RST             (1 << 15)

In file included from ../drivers/media/platform/s5p-jpeg/jpeg-hw-exynos4.c:12:
../drivers/media/platform/s5p-jpeg/jpeg-core.h:43: warning: "RST" redefined
   43 | #define RST                             0xd0
../arch/mips/include/asm/mach-rc32434/rb.h:13: note: this is the location of the previous definition
   13 | #define RST             (1 << 15)

In file included from ../drivers/media/platform/s5p-jpeg/jpeg-core.c:31:
../drivers/media/platform/s5p-jpeg/jpeg-core.h:43: warning: "RST" redefined
   43 | #define RST                             0xd0
../arch/mips/include/asm/mach-rc32434/rb.h:13: note: this is the location of the previous definition
   13 | #define RST             (1 << 15)

Fixes: bb677f3ac434 ("[media] Exynos4 JPEG codec v4l2 driver")
Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Randy Dunlap <rdunlap@infradead.org>
Cc: Mauro Carvalho Chehab <mchehab@kernel.org>
Cc: linux-media@vger.kernel.org
Cc: Andrzej Pietrasiewicz <andrzejtp2010@gmail.com>
Cc: Jacek Anaszewski <jacek.anaszewski@gmail.com>
Cc: Sylwester Nawrocki <s.nawrocki@samsung.com>
Cc: linux-arm-kernel@lists.infradead.org
---
 drivers/media/platform/s5p-jpeg/jpeg-core.c |    2 +-
 drivers/media/platform/s5p-jpeg/jpeg-core.h |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

--- linux-next-20210903.orig/drivers/media/platform/s5p-jpeg/jpeg-core.c
+++ linux-next-20210903/drivers/media/platform/s5p-jpeg/jpeg-core.c
@@ -1203,7 +1203,7 @@ static bool s5p_jpeg_parse_hdr(struct s5
 			break;
 
 		/* skip payload-less markers */
-		case RST ... RST + 7:
+		case RSET ... RSET + 7:
 		case SOI:
 		case EOI:
 		case TEM:
--- linux-next-20210903.orig/drivers/media/platform/s5p-jpeg/jpeg-core.h
+++ linux-next-20210903/drivers/media/platform/s5p-jpeg/jpeg-core.h
@@ -40,7 +40,7 @@
 #define TEM				0x01
 #define SOF0				0xc0
 #define DHT				0xc4
-#define RST				0xd0
+#define RSET				0xd0
 #define SOI				0xd8
 #define EOI				0xd9
 #define	SOS				0xda

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

* Re: [PATCH] media: s5p-jpeg: change "RST" to "RSET" to fix build warnings
  2021-09-05 23:57 [PATCH] media: s5p-jpeg: change "RST" to "RSET" to fix build warnings Randy Dunlap
@ 2021-09-06  6:51 ` Mauro Carvalho Chehab
  2021-09-06 23:51   ` Randy Dunlap
  0 siblings, 1 reply; 3+ messages in thread
From: Mauro Carvalho Chehab @ 2021-09-06  6:51 UTC (permalink / raw)
  To: Randy Dunlap
  Cc: linux-kernel, kernel test robot, linux-media,
	Andrzej Pietrasiewicz, Jacek Anaszewski, Sylwester Nawrocki,
	linux-arm-kernel

Em Sun,  5 Sep 2021 16:57:15 -0700
Randy Dunlap <rdunlap@infradead.org> escreveu:

> The use of a macro named 'RST' conflicts with one of the same name
> in arch/mips/include/asm/mach-rc32434/rb.h. This causes build
> warnings on some MIPS builds.
> 
> Change the use of RST to the name RSET.
> 
> Fixes these build warnings:
> 
> In file included from ../drivers/media/platform/s5p-jpeg/jpeg-hw-exynos3250.c:14:
> ../drivers/media/platform/s5p-jpeg/jpeg-core.h:43: warning: "RST" redefined
>    43 | #define RST                             0xd0
>       | 
> ../arch/mips/include/asm/mach-rc32434/rb.h:13: note: this is the location of the previous definition
>    13 | #define RST             (1 << 15)
> 
> In file included from ../drivers/media/platform/s5p-jpeg/jpeg-hw-s5p.c:13:
> ../drivers/media/platform/s5p-jpeg/jpeg-core.h:43: warning: "RST" redefined
>    43 | #define RST                             0xd0
> ../arch/mips/include/asm/mach-rc32434/rb.h:13: note: this is the location of the previous definition
>    13 | #define RST             (1 << 15)
> 
> In file included from ../drivers/media/platform/s5p-jpeg/jpeg-hw-exynos4.c:12:
> ../drivers/media/platform/s5p-jpeg/jpeg-core.h:43: warning: "RST" redefined
>    43 | #define RST                             0xd0
> ../arch/mips/include/asm/mach-rc32434/rb.h:13: note: this is the location of the previous definition
>    13 | #define RST             (1 << 15)
> 
> In file included from ../drivers/media/platform/s5p-jpeg/jpeg-core.c:31:
> ../drivers/media/platform/s5p-jpeg/jpeg-core.h:43: warning: "RST" redefined
>    43 | #define RST                             0xd0
> ../arch/mips/include/asm/mach-rc32434/rb.h:13: note: this is the location of the previous definition
>    13 | #define RST             (1 << 15)
> 
> Fixes: bb677f3ac434 ("[media] Exynos4 JPEG codec v4l2 driver")
> Reported-by: kernel test robot <lkp@intel.com>
> Signed-off-by: Randy Dunlap <rdunlap@infradead.org>
> Cc: Mauro Carvalho Chehab <mchehab@kernel.org>
> Cc: linux-media@vger.kernel.org
> Cc: Andrzej Pietrasiewicz <andrzejtp2010@gmail.com>
> Cc: Jacek Anaszewski <jacek.anaszewski@gmail.com>
> Cc: Sylwester Nawrocki <s.nawrocki@samsung.com>
> Cc: linux-arm-kernel@lists.infradead.org
> ---
>  drivers/media/platform/s5p-jpeg/jpeg-core.c |    2 +-
>  drivers/media/platform/s5p-jpeg/jpeg-core.h |    2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)
> 
> --- linux-next-20210903.orig/drivers/media/platform/s5p-jpeg/jpeg-core.c
> +++ linux-next-20210903/drivers/media/platform/s5p-jpeg/jpeg-core.c
> @@ -1203,7 +1203,7 @@ static bool s5p_jpeg_parse_hdr(struct s5
>  			break;
>  
>  		/* skip payload-less markers */
> -		case RST ... RST + 7:
> +		case RSET ... RSET + 7:
>  		case SOI:
>  		case EOI:
>  		case TEM:
> --- linux-next-20210903.orig/drivers/media/platform/s5p-jpeg/jpeg-core.h
> +++ linux-next-20210903/drivers/media/platform/s5p-jpeg/jpeg-core.h
> @@ -40,7 +40,7 @@
>  #define TEM				0x01
>  #define SOF0				0xc0
>  #define DHT				0xc4
> -#define RST				0xd0
> +#define RSET				0xd0
>  #define SOI				0xd8
>  #define EOI				0xd9
>  #define	SOS				0xda

I don't like this change, for a couple reasons:

1. the JPEG marker is "RST" (actually, "RST0") instead of "RSET" 
   (see pag. 36 https://www.w3.org/Graphics/JPEG/itu-t81.pdf). The
   close it sticks with the JPEG standard, the better;

2. better to add a namespace here, as other JPEG markers like SOS,
   SOI and EOI seems to have a high chance of happening somewhere
   else on other kernel headers in the future.

So, IMO, the best would be to rename all those markers as a hole, with
something similar to:

	$ for i in TEM SOF0 DHT RST SOI EOI SOS DQT DHP; do sed "s,\b$i\b,JPEG_MARKER_$i,g" -i drivers/media/platform/s5p-jpeg/*.[ch]; done

and manually adjust the patch, as at least this hunk could be
improved:

	@@ -187,11 +187,11 @@ struct s5p_jpeg_marker {
	  * @fmt:       driver-specific format of this queue
	  * @w:         image width
	  * @h:         image height
	- * @sos:       SOS marker's position relative to the buffer beginning
	- * @dht:       DHT markers' positions relative to the buffer beginning
	- * @dqt:       DQT markers' positions relative to the buffer beginning
	- * @sof:       SOF0 marker's position relative to the buffer beginning
	- * @sof_len:   SOF0 marker's payload length (without length field itself)
	+ * @sos:       JPEG_MARKER_SOS marker's position relative to the buffer beginning
	+ * @dht:       JPEG_MARKER_DHT markers' positions relative to the buffer beginning
	+ * @dqt:       JPEG_MARKER_DQT markers' positions relative to the buffer beginning
	+ * @sof:       JPEG_MARKER_SOF0 marker's position relative to the buffer beginning
	+ * @sof_len:   JPEG_MARKER_SOF0 marker's payload length (without length field itself)
	  * @size:      image buffer size in bytes
	  */

to avoid repeating the word marker.

Thanks,
Mauro

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

* Re: [PATCH] media: s5p-jpeg: change "RST" to "RSET" to fix build warnings
  2021-09-06  6:51 ` Mauro Carvalho Chehab
@ 2021-09-06 23:51   ` Randy Dunlap
  0 siblings, 0 replies; 3+ messages in thread
From: Randy Dunlap @ 2021-09-06 23:51 UTC (permalink / raw)
  To: Mauro Carvalho Chehab
  Cc: linux-kernel, kernel test robot, linux-media,
	Andrzej Pietrasiewicz, Jacek Anaszewski, Sylwester Nawrocki,
	linux-arm-kernel

On 9/5/21 11:51 PM, Mauro Carvalho Chehab wrote:
> Em Sun,  5 Sep 2021 16:57:15 -0700
> Randy Dunlap <rdunlap@infradead.org> escreveu:
> 
>> The use of a macro named 'RST' conflicts with one of the same name
>> in arch/mips/include/asm/mach-rc32434/rb.h. This causes build
>> warnings on some MIPS builds.
>>
>> Change the use of RST to the name RSET.
>>
>> Fixes these build warnings:
>>
>> In file included from ../drivers/media/platform/s5p-jpeg/jpeg-hw-exynos3250.c:14:
>> ../drivers/media/platform/s5p-jpeg/jpeg-core.h:43: warning: "RST" redefined
>>     43 | #define RST                             0xd0
>>        |
>> ../arch/mips/include/asm/mach-rc32434/rb.h:13: note: this is the location of the previous definition
>>     13 | #define RST             (1 << 15)
>>
>> In file included from ../drivers/media/platform/s5p-jpeg/jpeg-hw-s5p.c:13:
>> ../drivers/media/platform/s5p-jpeg/jpeg-core.h:43: warning: "RST" redefined
>>     43 | #define RST                             0xd0
>> ../arch/mips/include/asm/mach-rc32434/rb.h:13: note: this is the location of the previous definition
>>     13 | #define RST             (1 << 15)
>>
>> In file included from ../drivers/media/platform/s5p-jpeg/jpeg-hw-exynos4.c:12:
>> ../drivers/media/platform/s5p-jpeg/jpeg-core.h:43: warning: "RST" redefined
>>     43 | #define RST                             0xd0
>> ../arch/mips/include/asm/mach-rc32434/rb.h:13: note: this is the location of the previous definition
>>     13 | #define RST             (1 << 15)
>>
>> In file included from ../drivers/media/platform/s5p-jpeg/jpeg-core.c:31:
>> ../drivers/media/platform/s5p-jpeg/jpeg-core.h:43: warning: "RST" redefined
>>     43 | #define RST                             0xd0
>> ../arch/mips/include/asm/mach-rc32434/rb.h:13: note: this is the location of the previous definition
>>     13 | #define RST             (1 << 15)
>>
>> Fixes: bb677f3ac434 ("[media] Exynos4 JPEG codec v4l2 driver")
>> Reported-by: kernel test robot <lkp@intel.com>
>> Signed-off-by: Randy Dunlap <rdunlap@infradead.org>
>> Cc: Mauro Carvalho Chehab <mchehab@kernel.org>
>> Cc: linux-media@vger.kernel.org
>> Cc: Andrzej Pietrasiewicz <andrzejtp2010@gmail.com>
>> Cc: Jacek Anaszewski <jacek.anaszewski@gmail.com>
>> Cc: Sylwester Nawrocki <s.nawrocki@samsung.com>
>> Cc: linux-arm-kernel@lists.infradead.org
>> ---
>>   drivers/media/platform/s5p-jpeg/jpeg-core.c |    2 +-
>>   drivers/media/platform/s5p-jpeg/jpeg-core.h |    2 +-
>>   2 files changed, 2 insertions(+), 2 deletions(-)
>>
>> --- linux-next-20210903.orig/drivers/media/platform/s5p-jpeg/jpeg-core.c
>> +++ linux-next-20210903/drivers/media/platform/s5p-jpeg/jpeg-core.c
>> @@ -1203,7 +1203,7 @@ static bool s5p_jpeg_parse_hdr(struct s5
>>   			break;
>>   
>>   		/* skip payload-less markers */
>> -		case RST ... RST + 7:
>> +		case RSET ... RSET + 7:
>>   		case SOI:
>>   		case EOI:
>>   		case TEM:
>> --- linux-next-20210903.orig/drivers/media/platform/s5p-jpeg/jpeg-core.h
>> +++ linux-next-20210903/drivers/media/platform/s5p-jpeg/jpeg-core.h
>> @@ -40,7 +40,7 @@
>>   #define TEM				0x01
>>   #define SOF0				0xc0
>>   #define DHT				0xc4
>> -#define RST				0xd0
>> +#define RSET				0xd0
>>   #define SOI				0xd8
>>   #define EOI				0xd9
>>   #define	SOS				0xda
> 
> I don't like this change, for a couple reasons:
> 
> 1. the JPEG marker is "RST" (actually, "RST0") instead of "RSET"
>     (see pag. 36 https://www.w3.org/Graphics/JPEG/itu-t81.pdf). The
>     close it sticks with the JPEG standard, the better;

It looks like RST0 would work fine here.
[builds] Yes, it does.

> 2. better to add a namespace here, as other JPEG markers like SOS,
>     SOI and EOI seems to have a high chance of happening somewhere
>     else on other kernel headers in the future.

Makes sense.

> So, IMO, the best would be to rename all those markers as a hole, with
> something similar to:
> 
> 	$ for i in TEM SOF0 DHT RST SOI EOI SOS DQT DHP; do sed "s,\b$i\b,JPEG_MARKER_$i,g" -i drivers/media/platform/s5p-jpeg/*.[ch]; done
> 
> and manually adjust the patch, as at least this hunk could be
> improved:
> 
> 	@@ -187,11 +187,11 @@ struct s5p_jpeg_marker {
> 	  * @fmt:       driver-specific format of this queue
> 	  * @w:         image width
> 	  * @h:         image height
> 	- * @sos:       SOS marker's position relative to the buffer beginning
> 	- * @dht:       DHT markers' positions relative to the buffer beginning
> 	- * @dqt:       DQT markers' positions relative to the buffer beginning
> 	- * @sof:       SOF0 marker's position relative to the buffer beginning
> 	- * @sof_len:   SOF0 marker's payload length (without length field itself)
> 	+ * @sos:       JPEG_MARKER_SOS marker's position relative to the buffer beginning
> 	+ * @dht:       JPEG_MARKER_DHT markers' positions relative to the buffer beginning
> 	+ * @dqt:       JPEG_MARKER_DQT markers' positions relative to the buffer beginning
> 	+ * @sof:       JPEG_MARKER_SOF0 marker's position relative to the buffer beginning
> 	+ * @sof_len:   JPEG_MARKER_SOF0 marker's payload length (without length field itself)
> 	  * @size:      image buffer size in bytes
> 	  */
> 
> to avoid repeating the word marker.

OK, I can do that.

thanks.

-- 
~Randy


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

end of thread, other threads:[~2021-09-06 23:51 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-05 23:57 [PATCH] media: s5p-jpeg: change "RST" to "RSET" to fix build warnings Randy Dunlap
2021-09-06  6:51 ` Mauro Carvalho Chehab
2021-09-06 23:51   ` Randy Dunlap

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).