All of lore.kernel.org
 help / color / mirror / Atom feed
* Re: [PATCH 4/4] staging: media: zoran: replace dprintk with zrdev_dbg
@ 2022-05-06  5:03 kernel test robot
  0 siblings, 0 replies; 3+ messages in thread
From: kernel test robot @ 2022-05-06  5:03 UTC (permalink / raw)
  To: kbuild

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

CC: llvm(a)lists.linux.dev
CC: kbuild-all(a)lists.01.org
BCC: lkp(a)intel.com
In-Reply-To: <20220423051839.293361-1-ian@linux.cowan.aero>
References: <20220423051839.293361-1-ian@linux.cowan.aero>
TO: Ian Cowan <ian@linux.cowan.aero>
TO: clabbe(a)baylibre.com
CC: mchehab(a)kernel.org
CC: gregkh(a)linuxfoundation.org
CC: dan.carpenter(a)oracle.com
CC: mjpeg-users(a)lists.sourceforge.net
CC: linux-media(a)vger.kernel.org
CC: linux-staging(a)lists.linux.dev
CC: ian(a)linux.cowan.aero

Hi Ian,

Thank you for the patch! Perhaps something to improve:

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

url:    https://github.com/intel-lab-lkp/linux/commits/Ian-Cowan/staging-media-zoran-add-zrdev_dbg-macros/20220425-092814
base:   https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging.git 1efba7ef1d7da5944493728c5375fef5b2130de4
:::::: branch date: 11 days ago
:::::: commit date: 11 days ago
config: riscv-randconfig-c006-20220505 (https://download.01.org/0day-ci/archive/20220506/202205061205.K5S3Mi42-lkp(a)intel.com/config)
compiler: clang version 15.0.0 (https://github.com/llvm/llvm-project 5e004fb787698440a387750db7f8028e7cb14cfc)
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 riscv cross compiling tool for clang build
        # apt-get install binutils-riscv64-linux-gnu
        # https://github.com/intel-lab-lkp/linux/commit/6febc7a1b1d282fb5090a6a6f6945dce452bce98
        git remote add linux-review https://github.com/intel-lab-lkp/linux
        git fetch --no-tags linux-review Ian-Cowan/staging-media-zoran-add-zrdev_dbg-macros/20220425-092814
        git checkout 6febc7a1b1d282fb5090a6a6f6945dce452bce98
        # save the config file
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=riscv clang-analyzer 

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


clang-analyzer warnings: (new ones prefixed by >>)
           ^~~~~~
   net/ethtool/ioctl.c:576:2: note: Call to function 'memset' is insecure as it does not provide security checks introduced in the C11 standard. Replace with analogous functions that support length arguments or provides boundary checks such as 'memset_s' in case of C11
           memset(&link_ksettings, 0, sizeof(link_ksettings));
           ^~~~~~
   net/ethtool/ioctl.c:676:2: warning: Call to function 'memset' is insecure as it does not provide security checks introduced in the C11 standard. Replace with analogous functions that support length arguments or provides boundary checks such as 'memset_s' in case of C11 [clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling]
           memset(&link_ksettings, 0, sizeof(link_ksettings));
           ^~~~~~
   net/ethtool/ioctl.c:676:2: note: Call to function 'memset' is insecure as it does not provide security checks introduced in the C11 standard. Replace with analogous functions that support length arguments or provides boundary checks such as 'memset_s' in case of C11
           memset(&link_ksettings, 0, sizeof(link_ksettings));
           ^~~~~~
   net/ethtool/ioctl.c:797:2: warning: Call to function 'memset' is insecure as it does not provide security checks introduced in the C11 standard. Replace with analogous functions that support length arguments or provides boundary checks such as 'memset_s' in case of C11 [clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling]
           memset(&info, 0, sizeof(info));
           ^~~~~~
   net/ethtool/ioctl.c:797:2: note: Call to function 'memset' is insecure as it does not provide security checks introduced in the C11 standard. Replace with analogous functions that support length arguments or provides boundary checks such as 'memset_s' in case of C11
           memset(&info, 0, sizeof(info));
           ^~~~~~
   net/ethtool/ioctl.c:898:2: warning: Call to function 'memset' is insecure as it does not provide security checks introduced in the C11 standard. Replace with analogous functions that support length arguments or provides boundary checks such as 'memset_s' in case of C11 [clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling]
           memset(&crxnfc, 0, sizeof(crxnfc));
           ^~~~~~
   net/ethtool/ioctl.c:898:2: note: Call to function 'memset' is insecure as it does not provide security checks introduced in the C11 standard. Replace with analogous functions that support length arguments or provides boundary checks such as 'memset_s' in case of C11
           memset(&crxnfc, 0, sizeof(crxnfc));
           ^~~~~~
   net/ethtool/ioctl.c:1064:2: warning: Call to function 'memcpy' is insecure as it does not provide security checks introduced in the C11 standard. Replace with analogous functions that support length arguments or provides boundary checks such as 'memcpy_s' in case of C11 [clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling]
           memcpy(buffer, netdev_rss_key, len);
           ^~~~~~
   net/ethtool/ioctl.c:1064:2: note: Call to function 'memcpy' is insecure as it does not provide security checks introduced in the C11 standard. Replace with analogous functions that support length arguments or provides boundary checks such as 'memcpy_s' in case of C11
           memcpy(buffer, netdev_rss_key, len);
           ^~~~~~
   net/ethtool/ioctl.c:1439:2: warning: Call to function 'memset' is insecure as it does not provide security checks introduced in the C11 standard. Replace with analogous functions that support length arguments or provides boundary checks such as 'memset_s' in case of C11 [clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling]
           memset(&wol, 0, sizeof(struct ethtool_wolinfo));
           ^~~~~~
   net/ethtool/ioctl.c:1439:2: note: Call to function 'memset' is insecure as it does not provide security checks introduced in the C11 standard. Replace with analogous functions that support length arguments or provides boundary checks such as 'memset_s' in case of C11
           memset(&wol, 0, sizeof(struct ethtool_wolinfo));
           ^~~~~~
   net/ethtool/ioctl.c:1477:2: warning: Call to function 'memset' is insecure as it does not provide security checks introduced in the C11 standard. Replace with analogous functions that support length arguments or provides boundary checks such as 'memset_s' in case of C11 [clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling]
           memset(&edata, 0, sizeof(struct ethtool_eee));
           ^~~~~~
   net/ethtool/ioctl.c:1477:2: note: Call to function 'memset' is insecure as it does not provide security checks introduced in the C11 standard. Replace with analogous functions that support length arguments or provides boundary checks such as 'memset_s' in case of C11
           memset(&edata, 0, sizeof(struct ethtool_eee));
           ^~~~~~
   net/ethtool/ioctl.c:1981:2: warning: Call to function 'vsnprintf' is insecure as it does not provide security checks introduced in the C11 standard. Replace with analogous functions that support length arguments or provides boundary checks such as 'vsnprintf_s' in case of C11 [clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling]
           vsnprintf(*data, ETH_GSTRING_LEN, fmt, args);
           ^~~~~~~~~
   net/ethtool/ioctl.c:1981:2: note: Call to function 'vsnprintf' is insecure as it does not provide security checks introduced in the C11 standard. Replace with analogous functions that support length arguments or provides boundary checks such as 'vsnprintf_s' in case of C11
           vsnprintf(*data, ETH_GSTRING_LEN, fmt, args);
           ^~~~~~~~~
   net/ethtool/ioctl.c:2270:2: warning: Call to function 'memset' is insecure as it does not provide security checks introduced in the C11 standard. Replace with analogous functions that support length arguments or provides boundary checks such as 'memset_s' in case of C11 [clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling]
           memset(&tmp, 0, sizeof(tmp));
           ^~~~~~
   net/ethtool/ioctl.c:2270:2: note: Call to function 'memset' is insecure as it does not provide security checks introduced in the C11 standard. Replace with analogous functions that support length arguments or provides boundary checks such as 'memset_s' in case of C11
           memset(&tmp, 0, sizeof(tmp));
           ^~~~~~
   net/ethtool/ioctl.c:3210:4: warning: Call to function 'memcpy' is insecure as it does not provide security checks introduced in the C11 standard. Replace with analogous functions that support length arguments or provides boundary checks such as 'memcpy_s' in case of C11 [clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling]
                           memcpy(&match->key.ipv6.src, v6_spec->ip6src,
                           ^~~~~~
   net/ethtool/ioctl.c:3210:4: note: Call to function 'memcpy' is insecure as it does not provide security checks introduced in the C11 standard. Replace with analogous functions that support length arguments or provides boundary checks such as 'memcpy_s' in case of C11
                           memcpy(&match->key.ipv6.src, v6_spec->ip6src,
                           ^~~~~~
   net/ethtool/ioctl.c:3212:4: warning: Call to function 'memcpy' is insecure as it does not provide security checks introduced in the C11 standard. Replace with analogous functions that support length arguments or provides boundary checks such as 'memcpy_s' in case of C11 [clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling]
                           memcpy(&match->mask.ipv6.src, v6_m_spec->ip6src,
                           ^~~~~~
   net/ethtool/ioctl.c:3212:4: note: Call to function 'memcpy' is insecure as it does not provide security checks introduced in the C11 standard. Replace with analogous functions that support length arguments or provides boundary checks such as 'memcpy_s' in case of C11
                           memcpy(&match->mask.ipv6.src, v6_m_spec->ip6src,
                           ^~~~~~
   net/ethtool/ioctl.c:3216:4: warning: Call to function 'memcpy' is insecure as it does not provide security checks introduced in the C11 standard. Replace with analogous functions that support length arguments or provides boundary checks such as 'memcpy_s' in case of C11 [clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling]
                           memcpy(&match->key.ipv6.dst, v6_spec->ip6dst,
                           ^~~~~~
   net/ethtool/ioctl.c:3216:4: note: Call to function 'memcpy' is insecure as it does not provide security checks introduced in the C11 standard. Replace with analogous functions that support length arguments or provides boundary checks such as 'memcpy_s' in case of C11
                           memcpy(&match->key.ipv6.dst, v6_spec->ip6dst,
                           ^~~~~~
   net/ethtool/ioctl.c:3218:4: warning: Call to function 'memcpy' is insecure as it does not provide security checks introduced in the C11 standard. Replace with analogous functions that support length arguments or provides boundary checks such as 'memcpy_s' in case of C11 [clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling]
                           memcpy(&match->mask.ipv6.dst, v6_m_spec->ip6dst,
                           ^~~~~~
   net/ethtool/ioctl.c:3218:4: note: Call to function 'memcpy' is insecure as it does not provide security checks introduced in the C11 standard. Replace with analogous functions that support length arguments or provides boundary checks such as 'memcpy_s' in case of C11
                           memcpy(&match->mask.ipv6.dst, v6_m_spec->ip6dst,
                           ^~~~~~
   net/ethtool/ioctl.c:3313:3: warning: Call to function 'memcpy' is insecure as it does not provide security checks introduced in the C11 standard. Replace with analogous functions that support length arguments or provides boundary checks such as 'memcpy_s' in case of C11 [clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling]
                   memcpy(match->key.eth_addrs.dst, ext_h_spec->h_dest,
                   ^~~~~~
   net/ethtool/ioctl.c:3313:3: note: Call to function 'memcpy' is insecure as it does not provide security checks introduced in the C11 standard. Replace with analogous functions that support length arguments or provides boundary checks such as 'memcpy_s' in case of C11
                   memcpy(match->key.eth_addrs.dst, ext_h_spec->h_dest,
                   ^~~~~~
   net/ethtool/ioctl.c:3315:3: warning: Call to function 'memcpy' is insecure as it does not provide security checks introduced in the C11 standard. Replace with analogous functions that support length arguments or provides boundary checks such as 'memcpy_s' in case of C11 [clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling]
                   memcpy(match->mask.eth_addrs.dst, ext_m_spec->h_dest,
                   ^~~~~~
   net/ethtool/ioctl.c:3315:3: note: Call to function 'memcpy' is insecure as it does not provide security checks introduced in the C11 standard. Replace with analogous functions that support length arguments or provides boundary checks such as 'memcpy_s' in case of C11
                   memcpy(match->mask.eth_addrs.dst, ext_m_spec->h_dest,
                   ^~~~~~
   Suppressed 88 warnings (81 in non-user code, 7 with check filters).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   61 warnings generated.
   drivers/staging/media/zoran/videocodec.c:69:4: warning: Call to function 'snprintf' is insecure as it does not provide security checks introduced in the C11 standard. Replace with analogous functions that support length arguments or provides boundary checks such as 'snprintf_s' in case of C11 [clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling]
                           snprintf(codec->name + res, sizeof(codec->name) - res, "[%d]", h->attached);
                           ^~~~~~~~
   drivers/staging/media/zoran/videocodec.c:69:4: note: Call to function 'snprintf' is insecure as it does not provide security checks introduced in the C11 standard. Replace with analogous functions that support length arguments or provides boundary checks such as 'snprintf_s' in case of C11
                           snprintf(codec->name + res, sizeof(codec->name) - res, "[%d]", h->attached);
                           ^~~~~~~~
   Suppressed 60 warnings (53 in non-user code, 7 with check filters).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   72 warnings generated.
>> drivers/staging/media/zoran/zr36060.c:97:16: warning: Value stored to 'zr' during its initialization is never read [clang-analyzer-deadcode.DeadStores]
           struct zoran *zr = videocodec_to_zoran(ptr->codec);
                         ^~   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/staging/media/zoran/zr36060.c:97:16: note: Value stored to 'zr' during its initialization is never read
           struct zoran *zr = videocodec_to_zoran(ptr->codec);
                         ^~   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/staging/media/zoran/zr36060.c:133:16: warning: Value stored to 'zr' during its initialization is never read [clang-analyzer-deadcode.DeadStores]
           struct zoran *zr = videocodec_to_zoran(ptr->codec);
                         ^~   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/staging/media/zoran/zr36060.c:133:16: note: Value stored to 'zr' during its initialization is never read
           struct zoran *zr = videocodec_to_zoran(ptr->codec);
                         ^~   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/staging/media/zoran/zr36060.c:248:16: warning: Value stored to 'zr' during its initialization is never read [clang-analyzer-deadcode.DeadStores]
           struct zoran *zr = videocodec_to_zoran(ptr->codec);
                         ^~   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/staging/media/zoran/zr36060.c:248:16: note: Value stored to 'zr' during its initialization is never read
           struct zoran *zr = videocodec_to_zoran(ptr->codec);
                         ^~   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/staging/media/zoran/zr36060.c:277:16: warning: Value stored to 'zr' during its initialization is never read [clang-analyzer-deadcode.DeadStores]
           struct zoran *zr = videocodec_to_zoran(ptr->codec);
                         ^~   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/staging/media/zoran/zr36060.c:277:16: note: Value stored to 'zr' during its initialization is never read
           struct zoran *zr = videocodec_to_zoran(ptr->codec);
                         ^~   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/staging/media/zoran/zr36060.c:303:16: warning: Value stored to 'zr' during its initialization is never read [clang-analyzer-deadcode.DeadStores]
           struct zoran *zr = videocodec_to_zoran(ptr->codec);
                         ^~   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/staging/media/zoran/zr36060.c:303:16: note: Value stored to 'zr' during its initialization is never read
           struct zoran *zr = videocodec_to_zoran(ptr->codec);
                         ^~   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/staging/media/zoran/zr36060.c:463:16: warning: Value stored to 'zr' during its initialization is never read [clang-analyzer-deadcode.DeadStores]
           struct zoran *zr = videocodec_to_zoran(codec);
                         ^~   ~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/staging/media/zoran/zr36060.c:463:16: note: Value stored to 'zr' during its initialization is never read
           struct zoran *zr = videocodec_to_zoran(codec);
                         ^~   ~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/staging/media/zoran/zr36060.c:481:16: warning: Value stored to 'zr' during its initialization is never read [clang-analyzer-deadcode.DeadStores]
           struct zoran *zr = videocodec_to_zoran(codec);
                         ^~   ~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/staging/media/zoran/zr36060.c:481:16: note: Value stored to 'zr' during its initialization is never read
           struct zoran *zr = videocodec_to_zoran(codec);
                         ^~   ~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/staging/media/zoran/zr36060.c:641:16: warning: Value stored to 'zr' during its initialization is never read [clang-analyzer-deadcode.DeadStores]
           struct zoran *zr = videocodec_to_zoran(codec);
                         ^~   ~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/staging/media/zoran/zr36060.c:641:16: note: Value stored to 'zr' during its initialization is never read
           struct zoran *zr = videocodec_to_zoran(codec);
                         ^~   ~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/staging/media/zoran/zr36060.c:758:16: warning: Value stored to 'zr' during its initialization is never read [clang-analyzer-deadcode.DeadStores]
           struct zoran *zr = videocodec_to_zoran(codec);
                         ^~   ~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/staging/media/zoran/zr36060.c:758:16: note: Value stored to 'zr' during its initialization is never read
           struct zoran *zr = videocodec_to_zoran(codec);
                         ^~   ~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/staging/media/zoran/zr36060.c:799:2: warning: Call to function 'snprintf' is insecure as it does not provide security checks introduced in the C11 standard. Replace with analogous functions that support length arguments or provides boundary checks such as 'snprintf_s' in case of C11 [clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling]
           snprintf(ptr->name, sizeof(ptr->name), "zr36060[%d]", zr36060_codecs);
           ^~~~~~~~
   drivers/staging/media/zoran/zr36060.c:799:2: note: Call to function 'snprintf' is insecure as it does not provide security checks introduced in the C11 standard. Replace with analogous functions that support length arguments or provides boundary checks such as 'snprintf_s' in case of C11
           snprintf(ptr->name, sizeof(ptr->name), "zr36060[%d]", zr36060_codecs);
           ^~~~~~~~
   drivers/staging/media/zoran/zr36060.c:810:2: warning: Call to function 'memcpy' is insecure as it does not provide security checks introduced in the C11 standard. Replace with analogous functions that support length arguments or provides boundary checks such as 'memcpy_s' in case of C11 [clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling]
           memcpy(ptr->h_samp_ratio, zr36060_decimation_h, 8);
           ^~~~~~
   drivers/staging/media/zoran/zr36060.c:810:2: note: Call to function 'memcpy' is insecure as it does not provide security checks introduced in the C11 standard. Replace with analogous functions that support length arguments or provides boundary checks such as 'memcpy_s' in case of C11
           memcpy(ptr->h_samp_ratio, zr36060_decimation_h, 8);
           ^~~~~~
   drivers/staging/media/zoran/zr36060.c:811:2: warning: Call to function 'memcpy' is insecure as it does not provide security checks introduced in the C11 standard. Replace with analogous functions that support length arguments or provides boundary checks such as 'memcpy_s' in case of C11 [clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling]
           memcpy(ptr->v_samp_ratio, zr36060_decimation_v, 8);
           ^~~~~~
   drivers/staging/media/zoran/zr36060.c:811:2: note: Call to function 'memcpy' is insecure as it does not provide security checks introduced in the C11 standard. Replace with analogous functions that support length arguments or provides boundary checks such as 'memcpy_s' in case of C11
           memcpy(ptr->v_samp_ratio, zr36060_decimation_v, 8);
           ^~~~~~
   Suppressed 60 warnings (53 in non-user code, 7 with check filters).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   3 warnings generated.
   kernel/bpf/tnum.c:177:9: warning: Call to function 'snprintf' is insecure as it does not provide security checks introduced in the C11 standard. Replace with analogous functions that support length arguments or provides boundary checks such as 'snprintf_s' in case of C11 [clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling]
           return snprintf(str, size, "(%#llx; %#llx)", a.value, a.mask);
                  ^~~~~~~~
   kernel/bpf/tnum.c:177:9: note: Call to function 'snprintf' is insecure as it does not provide security checks introduced in the C11 standard. Replace with analogous functions that support length arguments or provides boundary checks such as 'snprintf_s' in case of C11
           return snprintf(str, size, "(%#llx; %#llx)", a.value, a.mask);
                  ^~~~~~~~
   Suppressed 2 warnings (2 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   89 warnings generated.
   kernel/bpf/bpf_iter.c:514:2: warning: Call to function 'memset' is insecure as it does not provide security checks introduced in the C11 standard. Replace with analogous functions that support length arguments or provides boundary checks such as 'memset_s' in case of C11 [clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling]
           memset(&linfo, 0, sizeof(union bpf_iter_link_info));
           ^~~~~~
   kernel/bpf/bpf_iter.c:514:2: note: Call to function 'memset' is insecure as it does not provide security checks introduced in the C11 standard. Replace with analogous functions that support length arguments or provides boundary checks such as 'memset_s' in case of C11
           memset(&linfo, 0, sizeof(union bpf_iter_link_info));
           ^~~~~~
   Suppressed 88 warnings (81 in non-user code, 7 with check filters).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   88 warnings generated.
   Suppressed 88 warnings (81 in non-user code, 7 with check filters).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   88 warnings generated.
   Suppressed 88 warnings (81 in non-user code, 7 with check filters).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   130 warnings generated.
   net/ipv4/cipso_ipv4.c:134:2: warning: 1st function call argument is an uninitialized value [clang-analyzer-core.CallAndMessage]
           if (entry->lsm_data)

vim +/zr +97 drivers/staging/media/zoran/zr36060.c

61c3b19f7b9eb7 Corentin Labbe        2020-09-25   93  
5e195bbddabdd9 Corentin Labbe        2020-09-25   94  /* wait if codec is ready to proceed (end of processing) or time is over */
5e195bbddabdd9 Corentin Labbe        2020-09-25   95  static void zr36060_wait_end(struct zr36060 *ptr)
61c3b19f7b9eb7 Corentin Labbe        2020-09-25   96  {
6febc7a1b1d282 Ian Cowan             2022-04-23  @97  	struct zoran *zr = videocodec_to_zoran(ptr->codec);
61c3b19f7b9eb7 Corentin Labbe        2020-09-25   98  	int i = 0;
61c3b19f7b9eb7 Corentin Labbe        2020-09-25   99  
c602f29dd17cad Mauro Carvalho Chehab 2020-10-01  100  	while (zr36060_read_status(ptr) & ZR060_CFSR_BUSY) {
61c3b19f7b9eb7 Corentin Labbe        2020-09-25  101  		udelay(1);
61c3b19f7b9eb7 Corentin Labbe        2020-09-25  102  		if (i++ > 200000) {	// 200ms, there is for sure something wrong!!!
6febc7a1b1d282 Ian Cowan             2022-04-23  103  			zrdev_dbg(zr, "%s: timeout at wait_end (last status: 0x%02x)\n",
61c3b19f7b9eb7 Corentin Labbe        2020-09-25  104  				  ptr->name, ptr->status);
61c3b19f7b9eb7 Corentin Labbe        2020-09-25  105  			break;
61c3b19f7b9eb7 Corentin Labbe        2020-09-25  106  		}
61c3b19f7b9eb7 Corentin Labbe        2020-09-25  107  	}
61c3b19f7b9eb7 Corentin Labbe        2020-09-25  108  }
61c3b19f7b9eb7 Corentin Labbe        2020-09-25  109  

-- 
0-DAY CI Kernel Test Service
https://01.org/lkp

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

* Re: [PATCH 4/4] staging: media: zoran: replace dprintk with zrdev_dbg
@ 2022-05-06 22:40 kernel test robot
  0 siblings, 0 replies; 3+ messages in thread
From: kernel test robot @ 2022-05-06 22:40 UTC (permalink / raw)
  To: kbuild

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

CC: llvm(a)lists.linux.dev
CC: kbuild-all(a)lists.01.org
BCC: lkp(a)intel.com
In-Reply-To: <20220423051839.293361-1-ian@linux.cowan.aero>
References: <20220423051839.293361-1-ian@linux.cowan.aero>
TO: Ian Cowan <ian@linux.cowan.aero>
TO: clabbe(a)baylibre.com
CC: mchehab(a)kernel.org
CC: gregkh(a)linuxfoundation.org
CC: dan.carpenter(a)oracle.com
CC: mjpeg-users(a)lists.sourceforge.net
CC: linux-media(a)vger.kernel.org
CC: linux-staging(a)lists.linux.dev
CC: ian(a)linux.cowan.aero

Hi Ian,

Thank you for the patch! Perhaps something to improve:

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

url:    https://github.com/intel-lab-lkp/linux/commits/Ian-Cowan/staging-media-zoran-add-zrdev_dbg-macros/20220425-092814
base:   https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging.git 1efba7ef1d7da5944493728c5375fef5b2130de4
:::::: branch date: 12 days ago
:::::: commit date: 12 days ago
config: riscv-randconfig-c006-20220505 (https://download.01.org/0day-ci/archive/20220507/202205070633.LxhxdJzI-lkp(a)intel.com/config)
compiler: clang version 15.0.0 (https://github.com/llvm/llvm-project 5e004fb787698440a387750db7f8028e7cb14cfc)
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 riscv cross compiling tool for clang build
        # apt-get install binutils-riscv64-linux-gnu
        # https://github.com/intel-lab-lkp/linux/commit/6febc7a1b1d282fb5090a6a6f6945dce452bce98
        git remote add linux-review https://github.com/intel-lab-lkp/linux
        git fetch --no-tags linux-review Ian-Cowan/staging-media-zoran-add-zrdev_dbg-macros/20220425-092814
        git checkout 6febc7a1b1d282fb5090a6a6f6945dce452bce98
        # save the config file
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=riscv clang-analyzer 

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


clang-analyzer warnings: (new ones prefixed by >>)
                              ^
   include/linux/compiler.h:58:31: note: expanded from macro '__trace_if_var'
   #define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : __trace_if_value(cond))
                                 ^
   drivers/thunderbolt/tunnel.c:1553:7: note: 'tunnel' is non-null
           if (!tunnel)
                ^
   include/linux/compiler.h:56:47: note: expanded from macro 'if'
   #define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) )
                                                 ^~~~
   include/linux/compiler.h:58:86: note: expanded from macro '__trace_if_var'
   #define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : __trace_if_value(cond))
                                                                                        ^~~~
   include/linux/compiler.h:69:3: note: expanded from macro '__trace_if_value'
           (cond) ?                                        \
            ^~~~
   drivers/thunderbolt/tunnel.c:1553:2: note: '?' condition is false
           if (!tunnel)
           ^
   include/linux/compiler.h:56:28: note: expanded from macro 'if'
   #define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) )
                              ^
   include/linux/compiler.h:58:69: note: expanded from macro '__trace_if_var'
   #define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : __trace_if_value(cond))
                                                                       ^
   include/linux/compiler.h:69:2: note: expanded from macro '__trace_if_value'
           (cond) ?                                        \
           ^
   drivers/thunderbolt/tunnel.c:1553:2: note: Taking false branch
           if (!tunnel)
           ^
   include/linux/compiler.h:56:23: note: expanded from macro 'if'
   #define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) )
                         ^
   drivers/thunderbolt/tunnel.c:1556:2: note: Assuming field 'deinit' is null
           if (tunnel->deinit)
           ^
   include/linux/compiler.h:56:45: note: expanded from macro 'if'
   #define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) )
                              ~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/compiler.h:58:52: note: expanded from macro '__trace_if_var'
   #define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : __trace_if_value(cond))
                                                      ^~~~
   drivers/thunderbolt/tunnel.c:1556:2: note: '?' condition is false
           if (tunnel->deinit)
           ^
   include/linux/compiler.h:56:28: note: expanded from macro 'if'
   #define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) )
                              ^
   include/linux/compiler.h:58:31: note: expanded from macro '__trace_if_var'
   #define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : __trace_if_value(cond))
                                 ^
   drivers/thunderbolt/tunnel.c:1556:14: note: Field 'deinit' is null
           if (tunnel->deinit)
                       ^
   drivers/thunderbolt/tunnel.c:1556:2: note: '?' condition is false
           if (tunnel->deinit)
           ^
   include/linux/compiler.h:56:28: note: expanded from macro 'if'
   #define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) )
                              ^
   include/linux/compiler.h:58:69: note: expanded from macro '__trace_if_var'
   #define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : __trace_if_value(cond))
                                                                       ^
   include/linux/compiler.h:69:2: note: expanded from macro '__trace_if_value'
           (cond) ?                                        \
           ^
   drivers/thunderbolt/tunnel.c:1556:2: note: Taking false branch
           if (tunnel->deinit)
           ^
   include/linux/compiler.h:56:23: note: expanded from macro 'if'
   #define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) )
                         ^
   drivers/thunderbolt/tunnel.c:1559:14: note: Assuming 'i' is < field 'npaths'
           for (i = 0; i < tunnel->npaths; i++) {
                       ^~~~~~~~~~~~~~~~~~
   drivers/thunderbolt/tunnel.c:1559:2: note: Loop condition is true.  Entering loop body
           for (i = 0; i < tunnel->npaths; i++) {
           ^
   drivers/thunderbolt/tunnel.c:1560:3: note: Array access (via field 'paths') results in a null pointer dereference
                   if (tunnel->paths[i])
                   ^
   include/linux/compiler.h:56:46: note: expanded from macro 'if'
   #define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) )
                                                ^~~~~
   include/linux/compiler.h:58:52: note: expanded from macro '__trace_if_var'
   #define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : __trace_if_value(cond))
                                                      ^~~~
   Suppressed 43 warnings (36 in non-user code, 7 with check filters).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   61 warnings generated.
   drivers/staging/media/zoran/videocodec.c:69:4: warning: Call to function 'snprintf' is insecure as it does not provide security checks introduced in the C11 standard. Replace with analogous functions that support length arguments or provides boundary checks such as 'snprintf_s' in case of C11 [clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling]
                           snprintf(codec->name + res, sizeof(codec->name) - res, "[%d]", h->attached);
                           ^~~~~~~~
   drivers/staging/media/zoran/videocodec.c:69:4: note: Call to function 'snprintf' is insecure as it does not provide security checks introduced in the C11 standard. Replace with analogous functions that support length arguments or provides boundary checks such as 'snprintf_s' in case of C11
                           snprintf(codec->name + res, sizeof(codec->name) - res, "[%d]", h->attached);
                           ^~~~~~~~
   Suppressed 60 warnings (53 in non-user code, 7 with check filters).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   72 warnings generated.
>> drivers/staging/media/zoran/zr36060.c:97:16: warning: Value stored to 'zr' during its initialization is never read [clang-analyzer-deadcode.DeadStores]
           struct zoran *zr = videocodec_to_zoran(ptr->codec);
                         ^~   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/staging/media/zoran/zr36060.c:97:16: note: Value stored to 'zr' during its initialization is never read
           struct zoran *zr = videocodec_to_zoran(ptr->codec);
                         ^~   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/staging/media/zoran/zr36060.c:133:16: warning: Value stored to 'zr' during its initialization is never read [clang-analyzer-deadcode.DeadStores]
           struct zoran *zr = videocodec_to_zoran(ptr->codec);
                         ^~   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/staging/media/zoran/zr36060.c:133:16: note: Value stored to 'zr' during its initialization is never read
           struct zoran *zr = videocodec_to_zoran(ptr->codec);
                         ^~   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/staging/media/zoran/zr36060.c:248:16: warning: Value stored to 'zr' during its initialization is never read [clang-analyzer-deadcode.DeadStores]
           struct zoran *zr = videocodec_to_zoran(ptr->codec);
                         ^~   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/staging/media/zoran/zr36060.c:248:16: note: Value stored to 'zr' during its initialization is never read
           struct zoran *zr = videocodec_to_zoran(ptr->codec);
                         ^~   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/staging/media/zoran/zr36060.c:277:16: warning: Value stored to 'zr' during its initialization is never read [clang-analyzer-deadcode.DeadStores]
           struct zoran *zr = videocodec_to_zoran(ptr->codec);
                         ^~   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/staging/media/zoran/zr36060.c:277:16: note: Value stored to 'zr' during its initialization is never read
           struct zoran *zr = videocodec_to_zoran(ptr->codec);
                         ^~   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/staging/media/zoran/zr36060.c:303:16: warning: Value stored to 'zr' during its initialization is never read [clang-analyzer-deadcode.DeadStores]
           struct zoran *zr = videocodec_to_zoran(ptr->codec);
                         ^~   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/staging/media/zoran/zr36060.c:303:16: note: Value stored to 'zr' during its initialization is never read
           struct zoran *zr = videocodec_to_zoran(ptr->codec);
                         ^~   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/staging/media/zoran/zr36060.c:463:16: warning: Value stored to 'zr' during its initialization is never read [clang-analyzer-deadcode.DeadStores]
           struct zoran *zr = videocodec_to_zoran(codec);
                         ^~   ~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/staging/media/zoran/zr36060.c:463:16: note: Value stored to 'zr' during its initialization is never read
           struct zoran *zr = videocodec_to_zoran(codec);
                         ^~   ~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/staging/media/zoran/zr36060.c:481:16: warning: Value stored to 'zr' during its initialization is never read [clang-analyzer-deadcode.DeadStores]
           struct zoran *zr = videocodec_to_zoran(codec);
                         ^~   ~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/staging/media/zoran/zr36060.c:481:16: note: Value stored to 'zr' during its initialization is never read
           struct zoran *zr = videocodec_to_zoran(codec);
                         ^~   ~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/staging/media/zoran/zr36060.c:641:16: warning: Value stored to 'zr' during its initialization is never read [clang-analyzer-deadcode.DeadStores]
           struct zoran *zr = videocodec_to_zoran(codec);
                         ^~   ~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/staging/media/zoran/zr36060.c:641:16: note: Value stored to 'zr' during its initialization is never read
           struct zoran *zr = videocodec_to_zoran(codec);
                         ^~   ~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/staging/media/zoran/zr36060.c:758:16: warning: Value stored to 'zr' during its initialization is never read [clang-analyzer-deadcode.DeadStores]
           struct zoran *zr = videocodec_to_zoran(codec);
                         ^~   ~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/staging/media/zoran/zr36060.c:758:16: note: Value stored to 'zr' during its initialization is never read
           struct zoran *zr = videocodec_to_zoran(codec);
                         ^~   ~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/staging/media/zoran/zr36060.c:799:2: warning: Call to function 'snprintf' is insecure as it does not provide security checks introduced in the C11 standard. Replace with analogous functions that support length arguments or provides boundary checks such as 'snprintf_s' in case of C11 [clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling]
           snprintf(ptr->name, sizeof(ptr->name), "zr36060[%d]", zr36060_codecs);
           ^~~~~~~~
   drivers/staging/media/zoran/zr36060.c:799:2: note: Call to function 'snprintf' is insecure as it does not provide security checks introduced in the C11 standard. Replace with analogous functions that support length arguments or provides boundary checks such as 'snprintf_s' in case of C11
           snprintf(ptr->name, sizeof(ptr->name), "zr36060[%d]", zr36060_codecs);
           ^~~~~~~~
   drivers/staging/media/zoran/zr36060.c:810:2: warning: Call to function 'memcpy' is insecure as it does not provide security checks introduced in the C11 standard. Replace with analogous functions that support length arguments or provides boundary checks such as 'memcpy_s' in case of C11 [clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling]
           memcpy(ptr->h_samp_ratio, zr36060_decimation_h, 8);
           ^~~~~~
   drivers/staging/media/zoran/zr36060.c:810:2: note: Call to function 'memcpy' is insecure as it does not provide security checks introduced in the C11 standard. Replace with analogous functions that support length arguments or provides boundary checks such as 'memcpy_s' in case of C11
           memcpy(ptr->h_samp_ratio, zr36060_decimation_h, 8);
           ^~~~~~
   drivers/staging/media/zoran/zr36060.c:811:2: warning: Call to function 'memcpy' is insecure as it does not provide security checks introduced in the C11 standard. Replace with analogous functions that support length arguments or provides boundary checks such as 'memcpy_s' in case of C11 [clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling]
           memcpy(ptr->v_samp_ratio, zr36060_decimation_v, 8);
           ^~~~~~
   drivers/staging/media/zoran/zr36060.c:811:2: note: Call to function 'memcpy' is insecure as it does not provide security checks introduced in the C11 standard. Replace with analogous functions that support length arguments or provides boundary checks such as 'memcpy_s' in case of C11
           memcpy(ptr->v_samp_ratio, zr36060_decimation_v, 8);
           ^~~~~~
   Suppressed 60 warnings (53 in non-user code, 7 with check filters).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   97 warnings generated.
   net/ipv6/udp_offload.c:94:3: warning: Call to function 'memmove' is insecure as it does not provide security checks introduced in the C11 standard. Replace with analogous functions that support length arguments or provides boundary checks such as 'memmove_s' in case of C11 [clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling]
                   memmove(packet_start-frag_hdr_sz, packet_start, unfrag_len);
                   ^~~~~~~
   net/ipv6/udp_offload.c:94:3: note: Call to function 'memmove' is insecure as it does not provide security checks introduced in the C11 standard. Replace with analogous functions that support length arguments or provides boundary checks such as 'memmove_s' in case of C11
                   memmove(packet_start-frag_hdr_sz, packet_start, unfrag_len);
                   ^~~~~~~
   Suppressed 96 warnings (89 in non-user code, 7 with check filters).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   90 warnings generated.
   Suppressed 90 warnings (83 in non-user code, 7 with check filters).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   90 warnings generated.
   Suppressed 90 warnings (83 in non-user code, 7 with check filters).
   Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
   55 warnings generated.
   drivers/iio/potentiometer/ad5272.c:49:8: warning: Excessive padding in 'struct ad5272_data' (102 padding bytes, where 38 is optimal). 
   Optimal fields order: 
   buf, 
   client, 
   cfg, 
   lock, 
   consider reordering the fields or adding explicit padding members [clang-analyzer-optin.performance.Padding]
   struct ad5272_data {
   ~~~~~~~^~~~~~~~~~~~~
   drivers/iio/potentiometer/ad5272.c:49:8: note: Excessive padding in 'struct ad5272_data' (102 padding bytes, where 38 is optimal). Optimal fields order: buf, client, cfg, lock, consider reordering the fields or adding explicit padding members
   struct ad5272_data {

vim +/zr +97 drivers/staging/media/zoran/zr36060.c

61c3b19f7b9eb7 Corentin Labbe        2020-09-25   93  
5e195bbddabdd9 Corentin Labbe        2020-09-25   94  /* wait if codec is ready to proceed (end of processing) or time is over */
5e195bbddabdd9 Corentin Labbe        2020-09-25   95  static void zr36060_wait_end(struct zr36060 *ptr)
61c3b19f7b9eb7 Corentin Labbe        2020-09-25   96  {
6febc7a1b1d282 Ian Cowan             2022-04-23  @97  	struct zoran *zr = videocodec_to_zoran(ptr->codec);
61c3b19f7b9eb7 Corentin Labbe        2020-09-25   98  	int i = 0;
61c3b19f7b9eb7 Corentin Labbe        2020-09-25   99  
c602f29dd17cad Mauro Carvalho Chehab 2020-10-01  100  	while (zr36060_read_status(ptr) & ZR060_CFSR_BUSY) {
61c3b19f7b9eb7 Corentin Labbe        2020-09-25  101  		udelay(1);
61c3b19f7b9eb7 Corentin Labbe        2020-09-25  102  		if (i++ > 200000) {	// 200ms, there is for sure something wrong!!!
6febc7a1b1d282 Ian Cowan             2022-04-23  103  			zrdev_dbg(zr, "%s: timeout at wait_end (last status: 0x%02x)\n",
61c3b19f7b9eb7 Corentin Labbe        2020-09-25  104  				  ptr->name, ptr->status);
61c3b19f7b9eb7 Corentin Labbe        2020-09-25  105  			break;
61c3b19f7b9eb7 Corentin Labbe        2020-09-25  106  		}
61c3b19f7b9eb7 Corentin Labbe        2020-09-25  107  	}
61c3b19f7b9eb7 Corentin Labbe        2020-09-25  108  }
61c3b19f7b9eb7 Corentin Labbe        2020-09-25  109  

-- 
0-DAY CI Kernel Test Service
https://01.org/lkp

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

* [PATCH 4/4] staging: media: zoran: replace dprintk with zrdev_dbg
@ 2022-04-23  5:18 Ian Cowan
  0 siblings, 0 replies; 3+ messages in thread
From: Ian Cowan @ 2022-04-23  5:18 UTC (permalink / raw)
  To: clabbe
  Cc: mchehab, gregkh, dan.carpenter, mjpeg-users, linux-media,
	linux-staging, ian

This replaces all of the dprintk() macro calls to the zrdev_dbg(),
zrdev_info(), or zrdev_err() calls as appropriate. This allows for the
removal of the dprintk() macro from each file it is defined in, along
with removal of the module params that track the debugging level.

In the case that a debugging level was used in a comparison, this has
been replaced with checking the console level debugging and making a
decision from there. If the console debugging level is at least the
KERN_ debugging level equivalent, then the comparison will evaluate as
true.

There are a few instances where pr_debug() must be used over the
zrdev_dbg(). These occur in the module cleanup functions because there
should be no devices defined once we get to those modules, so we have no
devices to pass to zrdev_dbg().

Signed-off-by: Ian Cowan <ian@linux.cowan.aero>
---
 drivers/staging/media/zoran/videocodec.c |  55 ++++------
 drivers/staging/media/zoran/zr36016.c    |  60 +++++------
 drivers/staging/media/zoran/zr36050.c    | 131 +++++++++++------------
 drivers/staging/media/zoran/zr36060.c    |  74 ++++++-------
 4 files changed, 143 insertions(+), 177 deletions(-)

diff --git a/drivers/staging/media/zoran/videocodec.c b/drivers/staging/media/zoran/videocodec.c
index cabb291d302c..64ca3efbd3f5 100644
--- a/drivers/staging/media/zoran/videocodec.c
+++ b/drivers/staging/media/zoran/videocodec.c
@@ -16,16 +16,6 @@
 
 #include "videocodec.h"
 
-static int videocodec_debug;
-module_param(videocodec_debug, int, 0);
-MODULE_PARM_DESC(videocodec_debug, "Debug level (0-4)");
-
-#define dprintk(num, format, args...) \
-	do { \
-		if (videocodec_debug >= num) \
-			printk(format, ##args); \
-	} while (0)
-
 struct attached_list {
 	struct videocodec *codec;
 	struct attached_list *next;
@@ -69,7 +59,7 @@ struct videocodec *videocodec_attach(struct videocodec_master *master)
 		// attach only if the slave has at least the flags
 		// expected by the master
 		if ((master->flags & h->codec->flags) == master->flags) {
-			dprintk(4, "%s: try '%s'\n", __func__, h->codec->name);
+			zrdev_dbg(zr, "%s: try '%s'\n", __func__, h->codec->name);
 
 			codec = kmemdup(h->codec, sizeof(struct videocodec), GFP_KERNEL);
 			if (!codec)
@@ -80,7 +70,7 @@ struct videocodec *videocodec_attach(struct videocodec_master *master)
 			codec->master_data = master;
 			res = codec->setup(codec);
 			if (res == 0) {
-				dprintk(3, "%s: '%s'\n", __func__, codec->name);
+				zrdev_dbg(zr, "%s: '%s'\n", __func__, codec->name);
 				ptr = kzalloc(sizeof(*ptr), GFP_KERNEL);
 				if (!ptr)
 					goto out_kfree;
@@ -89,12 +79,13 @@ struct videocodec *videocodec_attach(struct videocodec_master *master)
 				a = h->list;
 				if (!a) {
 					h->list = ptr;
-					dprintk(4, "videocodec: first element\n");
+					zrdev_dbg(zr, "videocodec: first element\n");
 				} else {
 					while (a->next)
 						a = a->next;	// find end
 					a->next = ptr;
-					dprintk(4, "videocodec: in after '%s'\n", h->codec->name);
+					zrdev_dbg(zr, "videocodec: in after '%s'\n",
+						  h->codec->name);
 				}
 
 				h->attached += 1;
@@ -126,8 +117,8 @@ int videocodec_detach(struct videocodec *codec)
 		return -EINVAL;
 	}
 
-	dprintk(2, "%s: '%s', type: %x, flags %lx, magic %lx\n", __func__,
-		codec->name, codec->type, codec->flags, codec->magic);
+	zrdev_dbg(zr, "%s: '%s', type: %x, flags %lx, magic %lx\n", __func__,
+		  codec->name, codec->type, codec->flags, codec->magic);
 
 	if (!h) {
 		zrdev_err(zr, "%s: no device left...\n", __func__);
@@ -141,7 +132,7 @@ int videocodec_detach(struct videocodec *codec)
 			if (codec == a->codec) {
 				res = a->codec->unset(a->codec);
 				if (res >= 0) {
-					dprintk(3, "%s: '%s'\n", __func__, a->codec->name);
+					zrdev_dbg(zr, "%s: '%s'\n", __func__, a->codec->name);
 					a->codec->master_data = NULL;
 				} else {
 					zrdev_err(zr, "%s: '%s'\n", __func__, a->codec->name);
@@ -149,10 +140,10 @@ int videocodec_detach(struct videocodec *codec)
 				}
 				if (!prev) {
 					h->list = a->next;
-					dprintk(4, "videocodec: delete first\n");
+					zrdev_dbg(zr, "videocodec: delete first\n");
 				} else {
 					prev->next = a->next;
-					dprintk(4, "videocodec: delete middle\n");
+					zrdev_dbg(zr, "videocodec: delete middle\n");
 				}
 				kfree(a->codec);
 				kfree(a);
@@ -179,9 +170,8 @@ int videocodec_register(const struct videocodec *codec)
 		return -EINVAL;
 	}
 
-	dprintk(2,
-		"videocodec: register '%s', type: %x, flags %lx, magic %lx\n",
-		codec->name, codec->type, codec->flags, codec->magic);
+	zrdev_dbg(zr, "videocodec: register '%s', type: %x, flags %lx, magic %lx\n",
+		  codec->name, codec->type, codec->flags, codec->magic);
 
 	ptr = kzalloc(sizeof(*ptr), GFP_KERNEL);
 	if (!ptr)
@@ -190,13 +180,13 @@ int videocodec_register(const struct videocodec *codec)
 
 	if (!h) {
 		codeclist_top = ptr;
-		dprintk(4, "videocodec: hooked in as first element\n");
+		zrdev_dbg(zr, "videocodec: hooked in as first element\n");
 	} else {
 		while (h->next)
 			h = h->next;	// find the end
 		h->next = ptr;
-		dprintk(4, "videocodec: hooked in after '%s'\n",
-			h->codec->name);
+		zrdev_dbg(zr, "videocodec: hooked in after '%s'\n",
+			  h->codec->name);
 	}
 
 	return 0;
@@ -212,9 +202,8 @@ int videocodec_unregister(const struct videocodec *codec)
 		return -EINVAL;
 	}
 
-	dprintk(2,
-		"videocodec: unregister '%s', type: %x, flags %lx, magic %lx\n",
-		codec->name, codec->type, codec->flags, codec->magic);
+	zrdev_dbg(zr, "videocodec: unregister '%s', type: %x, flags %lx, magic %lx\n",
+		  codec->name, codec->type, codec->flags, codec->magic);
 
 	if (!h) {
 		zrdev_err(zr, "%s: no device left...\n", __func__);
@@ -227,16 +216,14 @@ int videocodec_unregister(const struct videocodec *codec)
 				zrdev_err(zr, "videocodec: '%s' is used\n", h->codec->name);
 				return -EBUSY;
 			}
-			dprintk(3, "videocodec: unregister '%s' is ok.\n",
-				h->codec->name);
+			zrdev_dbg(zr, "videocodec: unregister '%s' is ok.\n",
+				  h->codec->name);
 			if (!prev) {
 				codeclist_top = h->next;
-				dprintk(4,
-					"videocodec: delete first element\n");
+				zrdev_dbg(zr, "videocodec: delete first element\n");
 			} else {
 				prev->next = h->next;
-				dprintk(4,
-					"videocodec: delete middle element\n");
+				zrdev_dbg(zr, "videocodec: delete middle element\n");
 			}
 			kfree(h);
 			return 0;
diff --git a/drivers/staging/media/zoran/zr36016.c b/drivers/staging/media/zoran/zr36016.c
index 3e3376af0cfa..afdd74e7c59f 100644
--- a/drivers/staging/media/zoran/zr36016.c
+++ b/drivers/staging/media/zoran/zr36016.c
@@ -22,16 +22,6 @@
 /* amount of chips attached via this driver */
 static int zr36016_codecs;
 
-static int zr36016_debug;
-module_param(zr36016_debug, int, 0);
-MODULE_PARM_DESC(zr36016_debug, "Debug level (0-4)");
-
-#define dprintk(num, format, args...) \
-	do { \
-		if (zr36016_debug >= num) \
-			printk(format, ##args); \
-	} while (0)
-
 /* =========================================================================
    Local hardware I/O functions:
 
@@ -50,7 +40,7 @@ static u8 zr36016_read(struct zr36016 *ptr, u16 reg)
 	else
 		zrdev_err(zr, "%s: invalid I/O setup, nothing read!\n", ptr->name);
 
-	dprintk(4, "%s: reading from 0x%04x: %02x\n", ptr->name, reg, value);
+	zrdev_dbg(zr, "%s: reading from 0x%04x: %02x\n", ptr->name, reg, value);
 
 	return value;
 }
@@ -59,7 +49,7 @@ static void zr36016_write(struct zr36016 *ptr, u16 reg, u8 value)
 {
 	struct zoran *zr = videocodec_to_zoran(ptr->codec);
 
-	dprintk(4, "%s: writing 0x%02x to 0x%04x\n", ptr->name, value, reg);
+	zrdev_dbg(zr, "%s: writing 0x%02x to 0x%04x\n", ptr->name, value, reg);
 
 	// just in case something is wrong...
 	if (ptr->codec->master_data->writereg)
@@ -84,7 +74,7 @@ static u8 zr36016_readi(struct zr36016 *ptr, u16 reg)
 		zrdev_err(zr, "%s: invalid I/O setup, nothing read (i)!\n", ptr->name);
 	}
 
-	dprintk(4, "%s: reading indirect from 0x%04x: %02x\n", ptr->name, reg, value);
+	zrdev_dbg(zr, "%s: reading indirect from 0x%04x: %02x\n", ptr->name, reg, value);
 	return value;
 }
 
@@ -92,8 +82,8 @@ static void zr36016_writei(struct zr36016 *ptr, u16 reg, u8 value)
 {
 	struct zoran *zr = videocodec_to_zoran(ptr->codec);
 
-	dprintk(4, "%s: writing indirect 0x%02x to 0x%04x\n", ptr->name,
-		value, reg);
+	zrdev_dbg(zr, "%s: writing indirect 0x%02x to 0x%04x\n", ptr->name,
+		  value, reg);
 
 	/* just in case something is wrong... */
 	if (ptr->codec->master_data->writereg) {
@@ -127,14 +117,14 @@ static int zr36016_basic_test(struct zr36016 *ptr)
 {
 	struct zoran *zr = videocodec_to_zoran(ptr->codec);
 
-	if (zr36016_debug) {
+	if (*KERN_INFO <= CONSOLE_LOGLEVEL_DEFAULT) {
 		int i;
 
 		zr36016_writei(ptr, ZR016I_PAX_LO, 0x55);
-		dprintk(1, KERN_INFO "%s: registers: ", ptr->name);
+		zrdev_info(zr, "%s: registers: ", ptr->name);
 		for (i = 0; i <= 0x0b; i++)
-			dprintk(1, "%02x ", zr36016_readi(ptr, i));
-		dprintk(1, "\n");
+			zrdev_dbg(zr, "%02x ", zr36016_readi(ptr, i));
+		zrdev_dbg(zr, "\n");
 	}
 	// for testing just write 0, then the default value to a register and read
 	// it back in both cases
@@ -171,10 +161,11 @@ static int zr36016_pushit(struct zr36016 *ptr,
 			   u16             len,
 			   const char     *data)
 {
+	struct zoran *zr = videocodec_to_zoran(ptr->codec);
 	int i = 0;
 
-	dprintk(4, "%s: write data block to 0x%04x (len=%d)\n",
-		ptr->name, startreg, len);
+	zrdev_dbg(zr, "%s: write data block to 0x%04x (len=%d)\n",
+		  ptr->name, startreg, len);
 	while (i < len) {
 		zr36016_writei(ptr, startreg++,  data[i++]);
 	}
@@ -232,8 +223,9 @@ static void zr36016_init(struct zr36016 *ptr)
 static int zr36016_set_mode(struct videocodec *codec, int mode)
 {
 	struct zr36016 *ptr = (struct zr36016 *)codec->data;
+	struct zoran *zr = videocodec_to_zoran(codec);
 
-	dprintk(2, "%s: set_mode %d call\n", ptr->name, mode);
+	zrdev_dbg(zr, "%s: set_mode %d call\n", ptr->name, mode);
 
 	if ((mode != CODEC_DO_EXPANSION) && (mode != CODEC_DO_COMPRESSION))
 		return -EINVAL;
@@ -249,11 +241,12 @@ static int zr36016_set_video(struct videocodec *codec, const struct tvnorm *norm
 			     struct vfe_settings *cap, struct vfe_polarity *pol)
 {
 	struct zr36016 *ptr = (struct zr36016 *)codec->data;
+	struct zoran *zr = videocodec_to_zoran(codec);
 
-	dprintk(2, "%s: set_video %d.%d, %d/%d-%dx%d (0x%x) call\n",
-		ptr->name, norm->h_start, norm->v_start,
-		cap->x, cap->y, cap->width, cap->height,
-		cap->decimation);
+	zrdev_dbg(zr, "%s: set_video %d.%d, %d/%d-%dx%d (0x%x) call\n",
+		  ptr->name, norm->h_start, norm->v_start,
+		  cap->x, cap->y, cap->width, cap->height,
+		  cap->decimation);
 
 	/* if () return -EINVAL;
 	 * trust the master driver that it knows what it does - so
@@ -283,9 +276,10 @@ static int zr36016_set_video(struct videocodec *codec, const struct tvnorm *norm
 static int zr36016_control(struct videocodec *codec, int type, int size, void *data)
 {
 	struct zr36016 *ptr = (struct zr36016 *)codec->data;
+	struct zoran *zr = videocodec_to_zoran(codec);
 	int *ival = (int *)data;
 
-	dprintk(2, "%s: control %d call with %d byte\n", ptr->name, type, size);
+	zrdev_dbg(zr, "%s: control %d call with %d byte\n", ptr->name, type, size);
 
 	switch (type) {
 	case CODEC_G_STATUS:	/* get last status - we don't know it ... */
@@ -332,11 +326,12 @@ static int zr36016_control(struct videocodec *codec, int type, int size, void *d
 static int zr36016_unset(struct videocodec *codec)
 {
 	struct zr36016 *ptr = codec->data;
+	struct zoran *zr = videocodec_to_zoran(codec);
 
 	if (ptr) {
 		/* do wee need some codec deinit here, too ???? */
 
-		dprintk(1, "%s: finished codec #%d\n", ptr->name, ptr->num);
+		zrdev_dbg(zr, "%s: finished codec #%d\n", ptr->name, ptr->num);
 		kfree(ptr);
 		codec->data = NULL;
 
@@ -362,7 +357,7 @@ static int zr36016_setup(struct videocodec *codec)
 	struct zr36016 *ptr;
 	int res;
 
-	dprintk(2, "zr36016: initializing VFE subsystem #%d.\n", zr36016_codecs);
+	zrdev_dbg(zr, "zr36016: initializing VFE subsystem #%d.\n", zr36016_codecs);
 
 	if (zr36016_codecs == MAX_CODECS) {
 		zrdev_err(zr, "zr36016: Can't attach more codecs!\n");
@@ -392,7 +387,7 @@ static int zr36016_setup(struct videocodec *codec)
 	ptr->ydec = 0;
 	zr36016_init(ptr);
 
-	dprintk(1, KERN_INFO "%s: codec v%d attached and running\n", ptr->name, ptr->version);
+	zrdev_info(zr, "%s: codec v%d attached and running\n", ptr->name, ptr->version);
 
 	return 0;
 }
@@ -425,9 +420,8 @@ int zr36016_init_module(void)
 void zr36016_cleanup_module(void)
 {
 	if (zr36016_codecs) {
-		dprintk(1,
-			"zr36016: something's wrong - %d codecs left somehow.\n",
-			zr36016_codecs);
+		pr_debug("zr36016: something's wrong - %d codecs left somehow.\n",
+			 zr36016_codecs);
 	}
 	videocodec_unregister(&zr36016_codec);
 }
diff --git a/drivers/staging/media/zoran/zr36050.c b/drivers/staging/media/zoran/zr36050.c
index 950dd79f5c81..b26b0711461c 100644
--- a/drivers/staging/media/zoran/zr36050.c
+++ b/drivers/staging/media/zoran/zr36050.c
@@ -29,17 +29,6 @@
 /* amount of chips attached via this driver */
 static int zr36050_codecs;
 
-/* debugging is available via module parameter */
-static int zr36050_debug;
-module_param(zr36050_debug, int, 0);
-MODULE_PARM_DESC(zr36050_debug, "Debug level (0-4)");
-
-#define dprintk(num, format, args...) \
-	do { \
-		if (zr36050_debug >= num) \
-			printk(format, ##args); \
-	} while (0)
-
 /* =========================================================================
    Local hardware I/O functions:
 
@@ -49,32 +38,32 @@ MODULE_PARM_DESC(zr36050_debug, "Debug level (0-4)");
 /* read and write functions */
 static u8 zr36050_read(struct zr36050 *ptr, u16 reg)
 {
+	struct zoran *zr = videocodec_to_zoran(ptr->codec);
 	u8 value = 0;
 
 	/* just in case something is wrong... */
 	if (ptr->codec->master_data->readreg)
 		value = (ptr->codec->master_data->readreg(ptr->codec, reg)) & 0xFF;
 	else
-		dprintk(1,
-			KERN_ERR "%s: invalid I/O setup, nothing read!\n", ptr->name);
+		zrdev_err(zr, "%s: invalid I/O setup, nothing read!\n", ptr->name);
 
-	dprintk(4, "%s: reading from 0x%04x: %02x\n", ptr->name, reg, value);
+	zrdev_dbg(zr, "%s: reading from 0x%04x: %02x\n", ptr->name, reg, value);
 
 	return value;
 }
 
 static void zr36050_write(struct zr36050 *ptr, u16 reg, u8 value)
 {
-	dprintk(4, "%s: writing 0x%02x to 0x%04x\n", ptr->name, value, reg);
+	struct zoran *zr = videocodec_to_zoran(ptr->codec);
+
+	zrdev_dbg(zr, "%s: writing 0x%02x to 0x%04x\n", ptr->name, value, reg);
 
 	/* just in case something is wrong... */
 	if (ptr->codec->master_data->writereg)
 		ptr->codec->master_data->writereg(ptr->codec, reg, value);
 	else
-		dprintk(1,
-			KERN_ERR
-			"%s: invalid I/O setup, nothing written!\n",
-			ptr->name);
+		zrdev_err(zr, "%s: invalid I/O setup, nothing written!\n",
+			  ptr->name);
 }
 
 /* =========================================================================
@@ -117,14 +106,14 @@ static u16 zr36050_read_scalefactor(struct zr36050 *ptr)
 
 static void zr36050_wait_end(struct zr36050 *ptr)
 {
+	struct zoran *zr = videocodec_to_zoran(ptr->codec);
 	int i = 0;
 
 	while (!(zr36050_read_status1(ptr) & 0x4)) {
 		udelay(1);
 		if (i++ > 200000) {	// 200ms, there is for sure something wrong!!!
-			dprintk(1,
-				"%s: timeout at wait_end (last status: 0x%02x)\n",
-				ptr->name, ptr->status1);
+			zrdev_dbg(zr, "%s: timeout at wait_end (last status: 0x%02x)\n",
+				  ptr->name, ptr->status1);
 			break;
 		}
 	}
@@ -138,33 +127,29 @@ static void zr36050_wait_end(struct zr36050 *ptr)
 
 static int zr36050_basic_test(struct zr36050 *ptr)
 {
+	struct zoran *zr = videocodec_to_zoran(ptr->codec);
+
 	zr36050_write(ptr, ZR050_SOF_IDX, 0x00);
 	zr36050_write(ptr, ZR050_SOF_IDX + 1, 0x00);
 	if ((zr36050_read(ptr, ZR050_SOF_IDX) |
 	     zr36050_read(ptr, ZR050_SOF_IDX + 1)) != 0x0000) {
-		dprintk(1,
-			KERN_ERR
-			"%s: attach failed, can't connect to jpeg processor!\n",
-			ptr->name);
+		zrdev_err(zr, "%s: attach failed, can't connect to jpeg processor!\n",
+			  ptr->name);
 		return -ENXIO;
 	}
 	zr36050_write(ptr, ZR050_SOF_IDX, 0xff);
 	zr36050_write(ptr, ZR050_SOF_IDX + 1, 0xc0);
 	if (((zr36050_read(ptr, ZR050_SOF_IDX) << 8) |
 	     zr36050_read(ptr, ZR050_SOF_IDX + 1)) != 0xffc0) {
-		dprintk(1,
-			KERN_ERR
-			"%s: attach failed, can't connect to jpeg processor!\n",
-			ptr->name);
+		zrdev_err(zr, "%s: attach failed, can't connect to jpeg processor!\n",
+			  ptr->name);
 		return -ENXIO;
 	}
 
 	zr36050_wait_end(ptr);
 	if ((ptr->status1 & 0x4) == 0) {
-		dprintk(1,
-			KERN_ERR
-			"%s: attach failed, jpeg processor failed (end flag)!\n",
-			ptr->name);
+		zrdev_err(zr, "%s: attach failed, jpeg processor failed (end flag)!\n",
+			  ptr->name);
 		return -EBUSY;
 	}
 
@@ -179,10 +164,11 @@ static int zr36050_basic_test(struct zr36050 *ptr)
 
 static int zr36050_pushit(struct zr36050 *ptr, u16 startreg, u16 len, const char *data)
 {
+	struct zoran *zr = videocodec_to_zoran(ptr->codec);
 	int i = 0;
 
-	dprintk(4, "%s: write data block to 0x%04x (len=%d)\n", ptr->name,
-		startreg, len);
+	zrdev_dbg(zr, "%s: write data block to 0x%04x (len=%d)\n", ptr->name,
+		  startreg, len);
 	while (i < len)
 		zr36050_write(ptr, startreg++, data[i++]);
 
@@ -305,11 +291,12 @@ static const char zr36050_decimation_v[8] = { 1, 1, 1, 0, 0, 0, 0, 0 };
 
 static int zr36050_set_sof(struct zr36050 *ptr)
 {
+	struct zoran *zr = videocodec_to_zoran(ptr->codec);
 	char sof_data[34];	// max. size of register set
 	int i;
 
-	dprintk(3, "%s: write SOF (%dx%d, %d components)\n", ptr->name,
-		ptr->width, ptr->height, NO_OF_COMPONENTS);
+	zrdev_dbg(zr, "%s: write SOF (%dx%d, %d components)\n", ptr->name,
+		  ptr->width, ptr->height, NO_OF_COMPONENTS);
 	sof_data[0] = 0xff;
 	sof_data[1] = 0xc0;
 	sof_data[2] = 0x00;
@@ -336,10 +323,11 @@ static int zr36050_set_sof(struct zr36050 *ptr)
 
 static int zr36050_set_sos(struct zr36050 *ptr)
 {
+	struct zoran *zr = videocodec_to_zoran(ptr->codec);
 	char sos_data[16];	// max. size of register set
 	int i;
 
-	dprintk(3, "%s: write SOS\n", ptr->name);
+	zrdev_dbg(zr, "%s: write SOS\n", ptr->name);
 	sos_data[0] = 0xff;
 	sos_data[1] = 0xda;
 	sos_data[2] = 0x00;
@@ -363,9 +351,10 @@ static int zr36050_set_sos(struct zr36050 *ptr)
 
 static int zr36050_set_dri(struct zr36050 *ptr)
 {
+	struct zoran *zr = videocodec_to_zoran(ptr->codec);
 	char dri_data[6];	// max. size of register set
 
-	dprintk(3, "%s: write DRI\n", ptr->name);
+	zrdev_dbg(zr, "%s: write DRI\n", ptr->name);
 	dri_data[0] = 0xff;
 	dri_data[1] = 0xdd;
 	dri_data[2] = 0x00;
@@ -390,7 +379,7 @@ static void zr36050_init(struct zr36050 *ptr)
 	long bitcnt, tmp;
 
 	if (ptr->mode == CODEC_DO_COMPRESSION) {
-		dprintk(2, "%s: COMPRESSION SETUP\n", ptr->name);
+		zrdev_dbg(zr, "%s: COMPRESSION SETUP\n", ptr->name);
 
 		/* 050 communicates with 057 in master mode */
 		zr36050_write(ptr, ZR050_HARDWARE, ZR050_HW_MSTR);
@@ -420,7 +409,7 @@ static void zr36050_init(struct zr36050 *ptr)
 
 		/* setup the fixed jpeg tables - maybe variable, though -
 		 * (see table init section above) */
-		dprintk(3, "%s: write DQT, DHT, APP\n", ptr->name);
+		zrdev_dbg(zr, "%s: write DQT, DHT, APP\n", ptr->name);
 		sum += zr36050_pushit(ptr, ZR050_DQT_IDX,
 				      sizeof(zr36050_dqt), zr36050_dqt);
 		sum += zr36050_pushit(ptr, ZR050_DHT_IDX,
@@ -443,8 +432,8 @@ static void zr36050_init(struct zr36050 *ptr)
 
 		zr36050_write(ptr, ZR050_GO, 1);	// launch codec
 		zr36050_wait_end(ptr);
-		dprintk(2, "%s: Status after table preload: 0x%02x\n",
-			ptr->name, ptr->status1);
+		zrdev_dbg(zr, "%s: Status after table preload: 0x%02x\n",
+			  ptr->name, ptr->status1);
 
 		if ((ptr->status1 & 0x4) == 0) {
 			zrdev_err(zr, "%s: init aborted!\n", ptr->name);
@@ -458,9 +447,8 @@ static void zr36050_init(struct zr36050 *ptr)
 		bitcnt = sum << 3;	/* need the size in bits */
 
 		tmp = bitcnt >> 16;
-		dprintk(3,
-			"%s: code: csize=%d, tot=%d, bit=%ld, highbits=%ld\n",
-			ptr->name, sum, ptr->real_code_vol, bitcnt, tmp);
+		zrdev_dbg(zr, "%s: code: csize=%d, tot=%d, bit=%ld, highbits=%ld\n",
+			  ptr->name, sum, ptr->real_code_vol, bitcnt, tmp);
 		zr36050_write(ptr, ZR050_TCV_NET_HI, tmp >> 8);
 		zr36050_write(ptr, ZR050_TCV_NET_MH, tmp & 0xff);
 		tmp = bitcnt & 0xffff;
@@ -471,8 +459,8 @@ static void zr36050_init(struct zr36050 *ptr)
 		bitcnt -= ((bitcnt * 5) >> 6);	// bits without eob
 
 		tmp = bitcnt >> 16;
-		dprintk(3, "%s: code: nettobit=%ld, highnettobits=%ld\n",
-			ptr->name, bitcnt, tmp);
+		zrdev_dbg(zr, "%s: code: nettobit=%ld, highnettobits=%ld\n",
+			  ptr->name, bitcnt, tmp);
 		zr36050_write(ptr, ZR050_TCV_DATA_HI, tmp >> 8);
 		zr36050_write(ptr, ZR050_TCV_DATA_MH, tmp & 0xff);
 		tmp = bitcnt & 0xffff;
@@ -490,7 +478,7 @@ static void zr36050_init(struct zr36050 *ptr)
 			      ((ptr->app.len > 0) ? ZR050_ME_APP : 0) |
 			      ((ptr->com.len > 0) ? ZR050_ME_COM : 0));
 	} else {
-		dprintk(2, "%s: EXPANSION SETUP\n", ptr->name);
+		zrdev_dbg(zr, "%s: EXPANSION SETUP\n", ptr->name);
 
 		/* 050 communicates with 055 in master mode */
 		zr36050_write(ptr, ZR050_HARDWARE,
@@ -503,7 +491,7 @@ static void zr36050_init(struct zr36050 *ptr)
 		zr36050_write(ptr, ZR050_INT_REQ_0, 0);
 		zr36050_write(ptr, ZR050_INT_REQ_1, 3);	// low 2 bits always 1
 
-		dprintk(3, "%s: write DHT\n", ptr->name);
+		zrdev_dbg(zr, "%s: write DHT\n", ptr->name);
 		zr36050_pushit(ptr, ZR050_DHT_IDX, sizeof(zr36050_dht),
 			       zr36050_dht);
 
@@ -512,8 +500,8 @@ static void zr36050_init(struct zr36050 *ptr)
 
 		zr36050_write(ptr, ZR050_GO, 1);	// launch codec
 		zr36050_wait_end(ptr);
-		dprintk(2, "%s: Status after table preload: 0x%02x\n",
-			ptr->name, ptr->status1);
+		zrdev_dbg(zr, "%s: Status after table preload: 0x%02x\n",
+			  ptr->name, ptr->status1);
 
 		if ((ptr->status1 & 0x4) == 0) {
 			zrdev_err(zr, "%s: init aborted!\n", ptr->name);
@@ -540,8 +528,9 @@ static void zr36050_init(struct zr36050 *ptr)
 static int zr36050_set_mode(struct videocodec *codec, int mode)
 {
 	struct zr36050 *ptr = (struct zr36050 *)codec->data;
+	struct zoran *zr = videocodec_to_zoran(codec);
 
-	dprintk(2, "%s: set_mode %d call\n", ptr->name, mode);
+	zrdev_dbg(zr, "%s: set_mode %d call\n", ptr->name, mode);
 
 	if ((mode != CODEC_DO_EXPANSION) && (mode != CODEC_DO_COMPRESSION))
 		return -EINVAL;
@@ -557,12 +546,13 @@ static int zr36050_set_video(struct videocodec *codec, const struct tvnorm *norm
 			     struct vfe_settings *cap, struct vfe_polarity *pol)
 {
 	struct zr36050 *ptr = (struct zr36050 *)codec->data;
+	struct zoran *zr = videocodec_to_zoran(codec);
 	int size;
 
-	dprintk(2, "%s: set_video %d.%d, %d/%d-%dx%d (0x%x) q%d call\n",
-		ptr->name, norm->h_start, norm->v_start,
-		cap->x, cap->y, cap->width, cap->height,
-		cap->decimation, cap->quality);
+	zrdev_dbg(zr, "%s: set_video %d.%d, %d/%d-%dx%d (0x%x) q%d call\n",
+		  ptr->name, norm->h_start, norm->v_start,
+		  cap->x, cap->y, cap->width, cap->height,
+		  cap->decimation, cap->quality);
 	/* if () return -EINVAL;
 	 * trust the master driver that it knows what it does - so
 	 * we allow invalid startx/y and norm for now ... */
@@ -595,10 +585,11 @@ static int zr36050_set_video(struct videocodec *codec, const struct tvnorm *norm
 static int zr36050_control(struct videocodec *codec, int type, int size, void *data)
 {
 	struct zr36050 *ptr = (struct zr36050 *)codec->data;
+	struct zoran *zr = videocodec_to_zoran(codec);
 	int *ival = (int *)data;
 
-	dprintk(2, "%s: control %d call with %d byte\n", ptr->name, type,
-		size);
+	zrdev_dbg(zr, "%s: control %d call with %d byte\n", ptr->name, type,
+		  size);
 
 	switch (type) {
 	case CODEC_G_STATUS:	/* get last status */
@@ -714,12 +705,12 @@ static int zr36050_control(struct videocodec *codec, int type, int size, void *d
 static int zr36050_unset(struct videocodec *codec)
 {
 	struct zr36050 *ptr = codec->data;
+	struct zoran *zr = videocodec_to_zoran(codec);
 
 	if (ptr) {
 		/* do wee need some codec deinit here, too ???? */
 
-		dprintk(1, "%s: finished codec #%d\n", ptr->name,
-			ptr->num);
+		zrdev_dbg(zr, "%s: finished codec #%d\n", ptr->name, ptr->num);
 		kfree(ptr);
 		codec->data = NULL;
 
@@ -742,14 +733,14 @@ static int zr36050_unset(struct videocodec *codec)
 static int zr36050_setup(struct videocodec *codec)
 {
 	struct zr36050 *ptr;
+	struct zoran *zr = videocodec_to_zoran(codec);
 	int res;
 
-	dprintk(2, "zr36050: initializing MJPEG subsystem #%d.\n",
-		zr36050_codecs);
+	zrdev_dbg(zr, "zr36050: initializing MJPEG subsystem #%d.\n",
+		  zr36050_codecs);
 
 	if (zr36050_codecs == MAX_CODECS) {
-		dprintk(1,
-			KERN_ERR "zr36050: Can't attach more codecs!\n");
+		zrdev_err(zr, "zr36050: Can't attach more codecs!\n");
 		return -ENOSPC;
 	}
 	//mem structure init
@@ -790,8 +781,7 @@ static int zr36050_setup(struct videocodec *codec)
 
 	zr36050_init(ptr);
 
-	dprintk(1, KERN_INFO "%s: codec attached and running\n",
-		ptr->name);
+	zrdev_info(zr, "%s: codec attached and running\n", ptr->name);
 
 	return 0;
 }
@@ -824,9 +814,8 @@ int zr36050_init_module(void)
 void zr36050_cleanup_module(void)
 {
 	if (zr36050_codecs) {
-		dprintk(1,
-			"zr36050: something's wrong - %d codecs left somehow.\n",
-			zr36050_codecs);
+		pr_debug("zr36050: something's wrong - %d codecs left somehow.\n",
+			 zr36050_codecs);
 	}
 	videocodec_unregister(&zr36050_codec);
 }
diff --git a/drivers/staging/media/zoran/zr36060.c b/drivers/staging/media/zoran/zr36060.c
index c09910669585..81e8bfd05d6a 100644
--- a/drivers/staging/media/zoran/zr36060.c
+++ b/drivers/staging/media/zoran/zr36060.c
@@ -32,16 +32,6 @@ static bool low_bitrate;
 module_param(low_bitrate, bool, 0);
 MODULE_PARM_DESC(low_bitrate, "Buz compatibility option, halves bitrate");
 
-static int zr36060_debug;
-module_param(zr36060_debug, int, 0);
-MODULE_PARM_DESC(zr36060_debug, "Debug level (0-4)");
-
-#define dprintk(num, format, args...) \
-	do { \
-		if (zr36060_debug >= num) \
-			printk(format, ##args); \
-	} while (0)
-
 /* =========================================================================
  * Local hardware I/O functions:
  * read/write via codec layer (registers are located in the master device)
@@ -66,7 +56,7 @@ static void zr36060_write(struct zr36060 *ptr, u16 reg, u8 value)
 {
 	struct zoran *zr = videocodec_to_zoran(ptr->codec);
 
-	dprintk(4, "0x%02x @0x%04x\n", value, reg);
+	zrdev_dbg(zr, "0x%02x @0x%04x\n", value, reg);
 
 	// just in case something is wrong...
 	if (ptr->codec->master_data->writereg)
@@ -104,14 +94,14 @@ static u16 zr36060_read_scalefactor(struct zr36060 *ptr)
 /* wait if codec is ready to proceed (end of processing) or time is over */
 static void zr36060_wait_end(struct zr36060 *ptr)
 {
+	struct zoran *zr = videocodec_to_zoran(ptr->codec);
 	int i = 0;
 
 	while (zr36060_read_status(ptr) & ZR060_CFSR_BUSY) {
 		udelay(1);
 		if (i++ > 200000) {	// 200ms, there is for sure something wrong!!!
-			dprintk(1,
-				"%s: timeout at wait_end (last status: 0x%02x)\n",
-				ptr->name, ptr->status);
+			zrdev_dbg(zr, "%s: timeout at wait_end (last status: 0x%02x)\n",
+				  ptr->name, ptr->status);
 			break;
 		}
 	}
@@ -140,10 +130,11 @@ static int zr36060_basic_test(struct zr36060 *ptr)
 /* simple loop for pushing the init datasets */
 static int zr36060_pushit(struct zr36060 *ptr, u16 startreg, u16 len, const char *data)
 {
+	struct zoran *zr = videocodec_to_zoran(ptr->codec);
 	int i = 0;
 
-	dprintk(4, "%s: write data block to 0x%04x (len=%d)\n", ptr->name,
-		startreg, len);
+	zrdev_dbg(zr, "%s: write data block to 0x%04x (len=%d)\n", ptr->name,
+		  startreg, len);
 	while (i < len)
 		zr36060_write(ptr, startreg++, data[i++]);
 
@@ -254,11 +245,12 @@ static const char zr36060_decimation_v[8] = { 1, 1, 1, 0, 0, 0, 0, 0 };
 /* SOF (start of frame) segment depends on width, height and sampling ratio of each color component */
 static int zr36060_set_sof(struct zr36060 *ptr)
 {
+	struct zoran *zr = videocodec_to_zoran(ptr->codec);
 	char sof_data[34];	// max. size of register set
 	int i;
 
-	dprintk(3, "%s: write SOF (%dx%d, %d components)\n", ptr->name,
-		ptr->width, ptr->height, NO_OF_COMPONENTS);
+	zrdev_dbg(zr, "%s: write SOF (%dx%d, %d components)\n", ptr->name,
+		  ptr->width, ptr->height, NO_OF_COMPONENTS);
 	sof_data[0] = 0xff;
 	sof_data[1] = 0xc0;
 	sof_data[2] = 0x00;
@@ -282,10 +274,11 @@ static int zr36060_set_sof(struct zr36060 *ptr)
 /* SOS (start of scan) segment depends on the used scan components of each color component */
 static int zr36060_set_sos(struct zr36060 *ptr)
 {
+	struct zoran *zr = videocodec_to_zoran(ptr->codec);
 	char sos_data[16];	// max. size of register set
 	int i;
 
-	dprintk(3, "%s: write SOS\n", ptr->name);
+	zrdev_dbg(zr, "%s: write SOS\n", ptr->name);
 	sos_data[0] = 0xff;
 	sos_data[1] = 0xda;
 	sos_data[2] = 0x00;
@@ -307,9 +300,10 @@ static int zr36060_set_sos(struct zr36060 *ptr)
 /* DRI (define restart interval) */
 static int zr36060_set_dri(struct zr36060 *ptr)
 {
+	struct zoran *zr = videocodec_to_zoran(ptr->codec);
 	char dri_data[6];	// max. size of register set
 
-	dprintk(3, "%s: write DRI\n", ptr->name);
+	zrdev_dbg(zr, "%s: write DRI\n", ptr->name);
 	dri_data[0] = 0xff;
 	dri_data[1] = 0xdd;
 	dri_data[2] = 0x00;
@@ -329,7 +323,7 @@ static void zr36060_init(struct zr36060 *ptr)
 	long bitcnt, tmp;
 
 	if (ptr->mode == CODEC_DO_COMPRESSION) {
-		dprintk(2, "%s: COMPRESSION SETUP\n", ptr->name);
+		zrdev_dbg(zr, "%s: COMPRESSION SETUP\n", ptr->name);
 
 		zr36060_write(ptr, ZR060_LOAD, ZR060_LOAD_SYNC_RST);
 
@@ -382,9 +376,8 @@ static void zr36060_init(struct zr36060 *ptr)
 		bitcnt = sum << 3;	/* need the size in bits */
 
 		tmp = bitcnt >> 16;
-		dprintk(3,
-			"%s: code: csize=%d, tot=%d, bit=%ld, highbits=%ld\n",
-			ptr->name, sum, ptr->real_code_vol, bitcnt, tmp);
+		zrdev_dbg(zr, "%s: code: csize=%d, tot=%d, bit=%ld, highbits=%ld\n",
+			  ptr->name, sum, ptr->real_code_vol, bitcnt, tmp);
 		zr36060_write(ptr, ZR060_TCV_NET_HI, tmp >> 8);
 		zr36060_write(ptr, ZR060_TCV_NET_MH, tmp & 0xff);
 		tmp = bitcnt & 0xffff;
@@ -395,8 +388,8 @@ static void zr36060_init(struct zr36060 *ptr)
 		bitcnt -= ((bitcnt * 5) >> 6);	// bits without eob
 
 		tmp = bitcnt >> 16;
-		dprintk(3, "%s: code: nettobit=%ld, highnettobits=%ld\n",
-			ptr->name, bitcnt, tmp);
+		zrdev_dbg(zr, "%s: code: nettobit=%ld, highnettobits=%ld\n",
+			  ptr->name, bitcnt, tmp);
 		zr36060_write(ptr, ZR060_TCV_DATA_HI, tmp >> 8);
 		zr36060_write(ptr, ZR060_TCV_DATA_MH, tmp & 0xff);
 		tmp = bitcnt & 0xffff;
@@ -414,7 +407,7 @@ static void zr36060_init(struct zr36060 *ptr)
 		zr36060_write(ptr, ZR060_VCR, ZR060_VCR_RANGE);
 
 	} else {
-		dprintk(2, "%s: EXPANSION SETUP\n", ptr->name);
+		zrdev_dbg(zr, "%s: EXPANSION SETUP\n", ptr->name);
 
 		zr36060_write(ptr, ZR060_LOAD, ZR060_LOAD_SYNC_RST);
 
@@ -447,7 +440,7 @@ static void zr36060_init(struct zr36060 *ptr)
 	/* Load the tables */
 	zr36060_write(ptr, ZR060_LOAD, ZR060_LOAD_SYNC_RST | ZR060_LOAD_LOAD);
 	zr36060_wait_end(ptr);
-	dprintk(2, "%s: Status after table preload: 0x%02x\n", ptr->name, ptr->status);
+	zrdev_dbg(zr, "%s: Status after table preload: 0x%02x\n", ptr->name, ptr->status);
 
 	if (ptr->status & ZR060_CFSR_BUSY) {
 		zrdev_err(zr, "%s: init aborted!\n", ptr->name);
@@ -467,8 +460,9 @@ static void zr36060_init(struct zr36060 *ptr)
 static int zr36060_set_mode(struct videocodec *codec, int mode)
 {
 	struct zr36060 *ptr = (struct zr36060 *)codec->data;
+	struct zoran *zr = videocodec_to_zoran(codec);
 
-	dprintk(2, "%s: set_mode %d call\n", ptr->name, mode);
+	zrdev_dbg(zr, "%s: set_mode %d call\n", ptr->name, mode);
 
 	if (mode != CODEC_DO_EXPANSION && mode != CODEC_DO_COMPRESSION)
 		return -EINVAL;
@@ -484,11 +478,12 @@ static int zr36060_set_video(struct videocodec *codec, const struct tvnorm *norm
 			     struct vfe_settings *cap, struct vfe_polarity *pol)
 {
 	struct zr36060 *ptr = (struct zr36060 *)codec->data;
+	struct zoran *zr = videocodec_to_zoran(codec);
 	u32 reg;
 	int size;
 
-	dprintk(2, "%s: set_video %d/%d-%dx%d (%%%d) call\n", ptr->name,
-		cap->x, cap->y, cap->width, cap->height, cap->decimation);
+	zrdev_dbg(zr, "%s: set_video %d/%d-%dx%d (%%%d) call\n", ptr->name,
+		  cap->x, cap->y, cap->width, cap->height, cap->decimation);
 
 	/* if () return -EINVAL;
 	 * trust the master driver that it knows what it does - so
@@ -643,10 +638,11 @@ static int zr36060_set_video(struct videocodec *codec, const struct tvnorm *norm
 static int zr36060_control(struct videocodec *codec, int type, int size, void *data)
 {
 	struct zr36060 *ptr = (struct zr36060 *)codec->data;
+	struct zoran *zr = videocodec_to_zoran(codec);
 	int *ival = (int *)data;
 
-	dprintk(2, "%s: control %d call with %d byte\n", ptr->name, type,
-		size);
+	zrdev_dbg(zr, "%s: control %d call with %d byte\n", ptr->name, type,
+		  size);
 
 	switch (type) {
 	case CODEC_G_STATUS:	/* get last status */
@@ -759,11 +755,12 @@ static int zr36060_control(struct videocodec *codec, int type, int size, void *d
 static int zr36060_unset(struct videocodec *codec)
 {
 	struct zr36060 *ptr = codec->data;
+	struct zoran *zr = videocodec_to_zoran(codec);
 
 	if (ptr) {
 		/* do wee need some codec deinit here, too ???? */
 
-		dprintk(1, "%s: finished codec #%d\n", ptr->name, ptr->num);
+		zrdev_dbg(zr, "%s: finished codec #%d\n", ptr->name, ptr->num);
 		kfree(ptr);
 		codec->data = NULL;
 
@@ -787,7 +784,7 @@ static int zr36060_setup(struct videocodec *codec)
 	struct zr36060 *ptr;
 	int res;
 
-	dprintk(2, "zr36060: initializing MJPEG subsystem #%d.\n", zr36060_codecs);
+	zrdev_dbg(zr, "zr36060: initializing MJPEG subsystem #%d.\n", zr36060_codecs);
 
 	if (zr36060_codecs == MAX_CODECS) {
 		zrdev_err(zr, "zr36060: Can't attach more codecs!\n");
@@ -830,7 +827,7 @@ static int zr36060_setup(struct videocodec *codec)
 
 	zr36060_init(ptr);
 
-	dprintk(1, KERN_INFO "%s: codec attached and running\n", ptr->name);
+	zrdev_info(zr, "%s: codec attached and running\n", ptr->name);
 
 	return 0;
 }
@@ -859,9 +856,8 @@ int zr36060_init_module(void)
 void zr36060_cleanup_module(void)
 {
 	if (zr36060_codecs) {
-		dprintk(1,
-			"zr36060: something's wrong - %d codecs left somehow.\n",
-			zr36060_codecs);
+		pr_debug("zr36060: something's wrong - %d codecs left somehow.\n",
+			 zr36060_codecs);
 	}
 
 	/* however, we can't just stay alive */
-- 
2.35.1


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

end of thread, other threads:[~2022-05-06 22:40 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-06  5:03 [PATCH 4/4] staging: media: zoran: replace dprintk with zrdev_dbg kernel test robot
  -- strict thread matches above, loose matches on Subject: below --
2022-05-06 22:40 kernel test robot
2022-04-23  5:18 Ian Cowan

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.