All of lore.kernel.org
 help / color / mirror / Atom feed
From: William Breathitt Gray <william.gray@linaro.org>
To: kbuild-all@lists.01.org
Subject: Re: [char-misc:char-misc-next 12/23] drivers/counter/ti-ecap-capture.c:380:8: sparse: sparse: symbol 'ecap_cnt_pol_array' was not declared. Should it be static?
Date: Sat, 01 Oct 2022 20:02:58 -0400	[thread overview]
Message-ID: <YzjVModUmh/HM+ET@fedora> (raw)
In-Reply-To: <202210020619.NQbyomII-lkp@intel.com>

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

On Sun, Oct 02, 2022 at 07:04:27AM +0800, kernel test robot wrote:
> tree:   https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc.git char-misc-next
> head:   7cd04013fbf3e6dcb67ca6b59aa813269a2ad9ce
> commit: 4e2f42aa00b67605938173a61d07a44fe13bad68 [12/23] counter: ti-ecap-capture: capture driver support for ECAP
> config: parisc-randconfig-s041-20221002
> compiler: hppa-linux-gcc (GCC) 12.1.0
> reproduce:
>         wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
>         chmod +x ~/bin/make.cross
>         # apt-get install sparse
>         # sparse version: v0.6.4-39-gce1a6720-dirty
>         # https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc.git/commit/?id=4e2f42aa00b67605938173a61d07a44fe13bad68
>         git remote add char-misc https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc.git
>         git fetch --no-tags char-misc char-misc-next
>         git checkout 4e2f42aa00b67605938173a61d07a44fe13bad68
>         # save the config file
>         mkdir build_dir && cp config build_dir/.config
>         COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' O=build_dir ARCH=parisc SHELL=/bin/bash drivers/counter/
> 
> If you fix the issue, kindly add following tag where applicable
> | Reported-by: kernel test robot <lkp@intel.com>
> 
> sparse warnings: (new ones prefixed by >>)
> >> drivers/counter/ti-ecap-capture.c:380:8: sparse: sparse: symbol 'ecap_cnt_pol_array' was not declared. Should it be static?
> 
> vim +/ecap_cnt_pol_array +380 drivers/counter/ti-ecap-capture.c
> 
>    379	
>  > 380	static DEFINE_COUNTER_ARRAY_POLARITY(ecap_cnt_pol_array, ecap_cnt_pol_avail, ECAP_NB_CEVT);
>    381	
> 
> -- 
> 0-DAY CI Kernel Test Service
> https://01.org/lkp

The first argument to the DEFINE_COUNTER_ARRAY_POLARITY() macro is a
token serving as the symbol name in the definition of a new
struct counter_array structure. However, this macro actually expands to
two statements:

    #define DEFINE_COUNTER_ARRAY_POLARITY(_name, _enums, _length) \
            DEFINE_COUNTER_AVAILABLE(_name##_available, _enums); \
            struct counter_array _name = { \
                    .type = COUNTER_COMP_SIGNAL_POLARITY, \
                    .avail = &(_name##_available), \
                    .length = (_length), \
            }

Because of this, the "static" on line 380 only applies to the first
statement. It might be best to take the DEFINE_COUNTER_AVAILABLE() line
out and leave DEFINE_COUNTER_ARRAY_POLARITY() as a simple structure
definition to avoid issues like this.

I'll submit a fix tomorrow to do such.

Thanks,

William Breathitt Gray

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

WARNING: multiple messages have this Message-ID (diff)
From: William Breathitt Gray <william.gray@linaro.org>
To: kernel test robot <lkp@intel.com>
Cc: Julien Panis <jpanis@baylibre.com>,
	kbuild-all@lists.01.org, linux-kernel@vger.kernel.org,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Subject: Re: [char-misc:char-misc-next 12/23] drivers/counter/ti-ecap-capture.c:380:8: sparse: sparse: symbol 'ecap_cnt_pol_array' was not declared. Should it be static?
Date: Sat, 1 Oct 2022 20:02:58 -0400	[thread overview]
Message-ID: <YzjVModUmh/HM+ET@fedora> (raw)
In-Reply-To: <202210020619.NQbyomII-lkp@intel.com>

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

On Sun, Oct 02, 2022 at 07:04:27AM +0800, kernel test robot wrote:
> tree:   https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc.git char-misc-next
> head:   7cd04013fbf3e6dcb67ca6b59aa813269a2ad9ce
> commit: 4e2f42aa00b67605938173a61d07a44fe13bad68 [12/23] counter: ti-ecap-capture: capture driver support for ECAP
> config: parisc-randconfig-s041-20221002
> compiler: hppa-linux-gcc (GCC) 12.1.0
> reproduce:
>         wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
>         chmod +x ~/bin/make.cross
>         # apt-get install sparse
>         # sparse version: v0.6.4-39-gce1a6720-dirty
>         # https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc.git/commit/?id=4e2f42aa00b67605938173a61d07a44fe13bad68
>         git remote add char-misc https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc.git
>         git fetch --no-tags char-misc char-misc-next
>         git checkout 4e2f42aa00b67605938173a61d07a44fe13bad68
>         # save the config file
>         mkdir build_dir && cp config build_dir/.config
>         COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' O=build_dir ARCH=parisc SHELL=/bin/bash drivers/counter/
> 
> If you fix the issue, kindly add following tag where applicable
> | Reported-by: kernel test robot <lkp@intel.com>
> 
> sparse warnings: (new ones prefixed by >>)
> >> drivers/counter/ti-ecap-capture.c:380:8: sparse: sparse: symbol 'ecap_cnt_pol_array' was not declared. Should it be static?
> 
> vim +/ecap_cnt_pol_array +380 drivers/counter/ti-ecap-capture.c
> 
>    379	
>  > 380	static DEFINE_COUNTER_ARRAY_POLARITY(ecap_cnt_pol_array, ecap_cnt_pol_avail, ECAP_NB_CEVT);
>    381	
> 
> -- 
> 0-DAY CI Kernel Test Service
> https://01.org/lkp

The first argument to the DEFINE_COUNTER_ARRAY_POLARITY() macro is a
token serving as the symbol name in the definition of a new
struct counter_array structure. However, this macro actually expands to
two statements:

    #define DEFINE_COUNTER_ARRAY_POLARITY(_name, _enums, _length) \
            DEFINE_COUNTER_AVAILABLE(_name##_available, _enums); \
            struct counter_array _name = { \
                    .type = COUNTER_COMP_SIGNAL_POLARITY, \
                    .avail = &(_name##_available), \
                    .length = (_length), \
            }

Because of this, the "static" on line 380 only applies to the first
statement. It might be best to take the DEFINE_COUNTER_AVAILABLE() line
out and leave DEFINE_COUNTER_ARRAY_POLARITY() as a simple structure
definition to avoid issues like this.

I'll submit a fix tomorrow to do such.

Thanks,

William Breathitt Gray

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

  reply	other threads:[~2022-10-02  0:02 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-01 23:04 [char-misc:char-misc-next 12/23] drivers/counter/ti-ecap-capture.c:380:8: sparse: sparse: symbol 'ecap_cnt_pol_array' was not declared. Should it be static? kernel test robot
2022-10-02  0:02 ` William Breathitt Gray [this message]
2022-10-02  0:02   ` William Breathitt Gray

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YzjVModUmh/HM+ET@fedora \
    --to=william.gray@linaro.org \
    --cc=kbuild-all@lists.01.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.