linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Subject: [PATCH] staging: media: meson: vdec: declare u32 as static const
@ 2021-04-12 14:18 Mitali Borkar
  2021-04-12 16:45 ` kernel test robot
  2021-04-12 20:07 ` kernel test robot
  0 siblings, 2 replies; 3+ messages in thread
From: Mitali Borkar @ 2021-04-12 14:18 UTC (permalink / raw)
  To: narmstrong, mchehab, gregkh, khilman, jbrunet, martin.blumenstingl
  Cc: linux-media, linux-staging, linux-kernel, outreachy-kernel,
	mitali_s, linux-amlogic

Declared 32 bit unsigned int as static constant inside a function and
replaced u32[] {x,y} as canvas3, canvas4 in codec_h264.c
This indicates the value of canvas indexes will remain constant throughout execution.

Signed-off-by: Mitali Borkar <mitaliborkar810@gmail.com>
---
 drivers/staging/media/meson/vdec/codec_h264.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/media/meson/vdec/codec_h264.c b/drivers/staging/media/meson/vdec/codec_h264.c
index c61128fc4bb9..ea86e9e1c447 100644
--- a/drivers/staging/media/meson/vdec/codec_h264.c
+++ b/drivers/staging/media/meson/vdec/codec_h264.c
@@ -287,10 +287,10 @@ static void codec_h264_resume(struct amvdec_session *sess)
 	struct amvdec_core *core = sess->core;
 	struct codec_h264 *h264 = sess->priv;
 	u32 mb_width, mb_height, mb_total;
+	static const u32[] canvas3 = { ANCO_CANVAS_ADDR, 0 };
+	static const u32[] canvas4 = { 24, 0 };
 
-	amvdec_set_canvases(sess,
-			    (u32[]){ ANC0_CANVAS_ADDR, 0 },
-			    (u32[]){ 24, 0 });
+	amvdec_set_canvases(sess, canvas3, canvas4);
 
 	dev_dbg(core->dev, "max_refs = %u; actual_dpb_size = %u\n",
 		h264->max_refs, sess->num_dst_bufs);
-- 
2.30.2


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

* Re: Subject: [PATCH] staging: media: meson: vdec: declare u32 as static const
  2021-04-12 14:18 Subject: [PATCH] staging: media: meson: vdec: declare u32 as static const Mitali Borkar
@ 2021-04-12 16:45 ` kernel test robot
  2021-04-12 20:07 ` kernel test robot
  1 sibling, 0 replies; 3+ messages in thread
From: kernel test robot @ 2021-04-12 16:45 UTC (permalink / raw)
  To: Mitali Borkar, narmstrong, mchehab, gregkh, khilman, jbrunet,
	martin.blumenstingl
  Cc: kbuild-all, linux-media, linux-staging, linux-kernel, outreachy-kernel

[-- Attachment #1: Type: text/plain, Size: 4143 bytes --]

Hi Mitali,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on staging/staging-testing]

url:    https://github.com/0day-ci/linux/commits/Mitali-Borkar/Subject-PATCH-staging-media-meson-vdec-declare-u32-as-static-const/20210412-222025
base:   https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging.git f2f560e1bdc055a6a306e6b7823ba589794e6564
config: ia64-allmodconfig (attached as .config)
compiler: ia64-linux-gcc (GCC) 9.3.0
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # https://github.com/0day-ci/linux/commit/c9873622761b42d977b48804bb0b4b9a7fbcd6b3
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Mitali-Borkar/Subject-PATCH-staging-media-meson-vdec-declare-u32-as-static-const/20210412-222025
        git checkout c9873622761b42d977b48804bb0b4b9a7fbcd6b3
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=ia64 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All error/warnings (new ones prefixed by >>):

   drivers/staging/media/meson/vdec/codec_h264.c: In function 'codec_h264_resume':
>> drivers/staging/media/meson/vdec/codec_h264.c:290:18: error: expected identifier or '(' before '[' token
     290 |  static const u32[] canvas3 = { ANCO_CANVAS_ADDR, 0 };
         |                  ^
   drivers/staging/media/meson/vdec/codec_h264.c:291:18: error: expected identifier or '(' before '[' token
     291 |  static const u32[] canvas4 = { 24, 0 };
         |                  ^
>> drivers/staging/media/meson/vdec/codec_h264.c:291:2: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
     291 |  static const u32[] canvas4 = { 24, 0 };
         |  ^~~~~~
>> drivers/staging/media/meson/vdec/codec_h264.c:293:28: error: 'canvas3' undeclared (first use in this function)
     293 |  amvdec_set_canvases(sess, canvas3, canvas4);
         |                            ^~~~~~~
   drivers/staging/media/meson/vdec/codec_h264.c:293:28: note: each undeclared identifier is reported only once for each function it appears in
>> drivers/staging/media/meson/vdec/codec_h264.c:293:37: error: 'canvas4' undeclared (first use in this function)
     293 |  amvdec_set_canvases(sess, canvas3, canvas4);
         |                                     ^~~~~~~


vim +290 drivers/staging/media/meson/vdec/codec_h264.c

   284	
   285	static void codec_h264_resume(struct amvdec_session *sess)
   286	{
   287		struct amvdec_core *core = sess->core;
   288		struct codec_h264 *h264 = sess->priv;
   289		u32 mb_width, mb_height, mb_total;
 > 290		static const u32[] canvas3 = { ANCO_CANVAS_ADDR, 0 };
 > 291		static const u32[] canvas4 = { 24, 0 };
   292	
 > 293		amvdec_set_canvases(sess, canvas3, canvas4);
   294	
   295		dev_dbg(core->dev, "max_refs = %u; actual_dpb_size = %u\n",
   296			h264->max_refs, sess->num_dst_bufs);
   297	
   298		/* Align to a multiple of 4 macroblocks */
   299		mb_width = ALIGN(h264->mb_width, 4);
   300		mb_height = ALIGN(h264->mb_height, 4);
   301		mb_total = mb_width * mb_height;
   302	
   303		h264->ref_size = mb_total * MB_MV_SIZE * h264->max_refs;
   304		h264->ref_vaddr = dma_alloc_coherent(core->dev, h264->ref_size,
   305						     &h264->ref_paddr, GFP_KERNEL);
   306		if (!h264->ref_vaddr) {
   307			amvdec_abort(sess);
   308			return;
   309		}
   310	
   311		/* Address to store the references' MVs */
   312		amvdec_write_dos(core, AV_SCRATCH_1, h264->ref_paddr);
   313		/* End of ref MV */
   314		amvdec_write_dos(core, AV_SCRATCH_4, h264->ref_paddr + h264->ref_size);
   315	
   316		amvdec_write_dos(core, AV_SCRATCH_0, (h264->max_refs << 24) |
   317						     (sess->num_dst_bufs << 16) |
   318						     ((h264->max_refs - 1) << 8));
   319	}
   320	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 63844 bytes --]

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

* Re: Subject: [PATCH] staging: media: meson: vdec: declare u32 as static const
  2021-04-12 14:18 Subject: [PATCH] staging: media: meson: vdec: declare u32 as static const Mitali Borkar
  2021-04-12 16:45 ` kernel test robot
@ 2021-04-12 20:07 ` kernel test robot
  1 sibling, 0 replies; 3+ messages in thread
From: kernel test robot @ 2021-04-12 20:07 UTC (permalink / raw)
  To: Mitali Borkar, narmstrong, mchehab, gregkh, khilman, jbrunet,
	martin.blumenstingl
  Cc: kbuild-all, clang-built-linux, linux-media, linux-staging,
	linux-kernel, outreachy-kernel

[-- Attachment #1: Type: text/plain, Size: 4947 bytes --]

Hi Mitali,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on staging/staging-testing]

url:    https://github.com/0day-ci/linux/commits/Mitali-Borkar/Subject-PATCH-staging-media-meson-vdec-declare-u32-as-static-const/20210412-222025
base:   https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging.git f2f560e1bdc055a6a306e6b7823ba589794e6564
config: mips-randconfig-r013-20210412 (attached as .config)
compiler: clang version 13.0.0 (https://github.com/llvm/llvm-project 9829f5e6b1bca9b61efc629770d28bb9014dec45)
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # install mips cross compiling tool for clang build
        # apt-get install binutils-mips-linux-gnu
        # https://github.com/0day-ci/linux/commit/c9873622761b42d977b48804bb0b4b9a7fbcd6b3
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Mitali-Borkar/Subject-PATCH-staging-media-meson-vdec-declare-u32-as-static-const/20210412-222025
        git checkout c9873622761b42d977b48804bb0b4b9a7fbcd6b3
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=mips 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All errors (new ones prefixed by >>):

>> drivers/staging/media/meson/vdec/codec_h264.c:290:28: error: brackets are not allowed here; to declare an array, place the brackets after the identifier
           static const u32[] canvas3 = { ANCO_CANVAS_ADDR, 0 };
                           ~~        ^
                                     []
>> drivers/staging/media/meson/vdec/codec_h264.c:290:33: error: use of undeclared identifier 'ANCO_CANVAS_ADDR'
           static const u32[] canvas3 = { ANCO_CANVAS_ADDR, 0 };
                                          ^
   drivers/staging/media/meson/vdec/codec_h264.c:291:28: error: brackets are not allowed here; to declare an array, place the brackets after the identifier
           static const u32[] canvas4 = { 24, 0 };
                           ~~        ^
                                     []
>> drivers/staging/media/meson/vdec/codec_h264.c:293:28: error: passing 'const u32 []' to parameter of type 'u32 *' (aka 'unsigned int *') discards qualifiers [-Werror,-Wincompatible-pointer-types-discards-qualifiers]
           amvdec_set_canvases(sess, canvas3, canvas4);
                                     ^~~~~~~
   drivers/staging/media/meson/vdec/vdec_helpers.h:20:8: note: passing argument to parameter 'reg_base' here
                           u32 reg_base[], u32 reg_num[]);
                               ^
   drivers/staging/media/meson/vdec/codec_h264.c:293:37: error: passing 'const u32 [2]' to parameter of type 'u32 *' (aka 'unsigned int *') discards qualifiers [-Werror,-Wincompatible-pointer-types-discards-qualifiers]
           amvdec_set_canvases(sess, canvas3, canvas4);
                                              ^~~~~~~
   drivers/staging/media/meson/vdec/vdec_helpers.h:20:24: note: passing argument to parameter 'reg_num' here
                           u32 reg_base[], u32 reg_num[]);
                                               ^
   5 errors generated.


vim +290 drivers/staging/media/meson/vdec/codec_h264.c

   284	
   285	static void codec_h264_resume(struct amvdec_session *sess)
   286	{
   287		struct amvdec_core *core = sess->core;
   288		struct codec_h264 *h264 = sess->priv;
   289		u32 mb_width, mb_height, mb_total;
 > 290		static const u32[] canvas3 = { ANCO_CANVAS_ADDR, 0 };
   291		static const u32[] canvas4 = { 24, 0 };
   292	
 > 293		amvdec_set_canvases(sess, canvas3, canvas4);
   294	
   295		dev_dbg(core->dev, "max_refs = %u; actual_dpb_size = %u\n",
   296			h264->max_refs, sess->num_dst_bufs);
   297	
   298		/* Align to a multiple of 4 macroblocks */
   299		mb_width = ALIGN(h264->mb_width, 4);
   300		mb_height = ALIGN(h264->mb_height, 4);
   301		mb_total = mb_width * mb_height;
   302	
   303		h264->ref_size = mb_total * MB_MV_SIZE * h264->max_refs;
   304		h264->ref_vaddr = dma_alloc_coherent(core->dev, h264->ref_size,
   305						     &h264->ref_paddr, GFP_KERNEL);
   306		if (!h264->ref_vaddr) {
   307			amvdec_abort(sess);
   308			return;
   309		}
   310	
   311		/* Address to store the references' MVs */
   312		amvdec_write_dos(core, AV_SCRATCH_1, h264->ref_paddr);
   313		/* End of ref MV */
   314		amvdec_write_dos(core, AV_SCRATCH_4, h264->ref_paddr + h264->ref_size);
   315	
   316		amvdec_write_dos(core, AV_SCRATCH_0, (h264->max_refs << 24) |
   317						     (sess->num_dst_bufs << 16) |
   318						     ((h264->max_refs - 1) << 8));
   319	}
   320	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 37742 bytes --]

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

end of thread, other threads:[~2021-04-12 20:07 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-12 14:18 Subject: [PATCH] staging: media: meson: vdec: declare u32 as static const Mitali Borkar
2021-04-12 16:45 ` kernel test robot
2021-04-12 20:07 ` kernel test robot

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).