[PATCH 2/2] media: dvb: represent min/max/step/tolerance freqs in Hz

2018-07-04 Thread Mauro Carvalho Chehab
Right now, satellite frontend drivers specify frequencies in kHz,
while terrestrial/cable ones specify in Hz. That's confusing
for developers.

However, the main problem is that universal frontends capable
of handling both satellite and non-satelite delivery systems
are appearing. We end by needing to hack the drivers in
order to support such hybrid frontends.

So, convert everything to specify frontend frequencies in Hz.

Signed-off-by: Mauro Carvalho Chehab 
---
 drivers/media/common/siano/smsdvb-main.c  |  6 +-
 drivers/media/dvb-core/dvb_frontend.c | 72 ---
 drivers/media/dvb-frontends/af9013.c  |  7 +-
 drivers/media/dvb-frontends/af9033.c  |  7 +-
 drivers/media/dvb-frontends/as102_fe.c|  6 +-
 drivers/media/dvb-frontends/atbm8830.c|  6 +-
 drivers/media/dvb-frontends/au8522_dig.c  |  6 +-
 drivers/media/dvb-frontends/bcm3510.c |  6 +-
 drivers/media/dvb-frontends/cx22700.c |  6 +-
 drivers/media/dvb-frontends/cx22702.c |  6 +-
 drivers/media/dvb-frontends/cx24110.c |  8 +--
 drivers/media/dvb-frontends/cx24116.c |  8 +--
 drivers/media/dvb-frontends/cx24117.c |  8 +--
 drivers/media/dvb-frontends/cx24120.c |  8 +--
 drivers/media/dvb-frontends/cx24123.c |  8 +--
 drivers/media/dvb-frontends/cxd2820r_t.c  |  4 +-
 drivers/media/dvb-frontends/cxd2820r_t2.c |  4 +-
 drivers/media/dvb-frontends/cxd2841er.c   |  9 ++-
 .../media/dvb-frontends/cxd2880/cxd2880_top.c |  6 +-
 drivers/media/dvb-frontends/dib3000mb.c   |  6 +-
 drivers/media/dvb-frontends/dib3000mc.c   |  6 +-
 drivers/media/dvb-frontends/dib7000m.c|  6 +-
 drivers/media/dvb-frontends/dib7000p.c|  6 +-
 drivers/media/dvb-frontends/dib8000.c |  6 +-
 drivers/media/dvb-frontends/dib9000.c |  6 +-
 drivers/media/dvb-frontends/drx39xyj/drxj.c   |  6 +-
 drivers/media/dvb-frontends/drxd_hard.c   |  7 +-
 drivers/media/dvb-frontends/drxk_hard.c   |  8 +--
 drivers/media/dvb-frontends/ds3000.c  |  8 +--
 drivers/media/dvb-frontends/dvb_dummy_fe.c| 24 +++
 drivers/media/dvb-frontends/gp8psk-fe.c   |  6 +-
 drivers/media/dvb-frontends/ix2505v.c |  4 +-
 drivers/media/dvb-frontends/l64781.c  |  7 +-
 drivers/media/dvb-frontends/lg2160.c  | 12 ++--
 drivers/media/dvb-frontends/lgdt3305.c| 12 ++--
 drivers/media/dvb-frontends/lgdt3306a.c   |  6 +-
 drivers/media/dvb-frontends/lgdt330x.c| 12 ++--
 drivers/media/dvb-frontends/lgs8gl5.c |  7 +-
 drivers/media/dvb-frontends/lgs8gxx.c |  6 +-
 drivers/media/dvb-frontends/m88ds3103.c   |  6 +-
 drivers/media/dvb-frontends/m88rs2000.c   |  8 +--
 drivers/media/dvb-frontends/mb86a16.c |  7 +-
 drivers/media/dvb-frontends/mb86a20s.c|  6 +-
 drivers/media/dvb-frontends/mt312.c   | 10 +--
 drivers/media/dvb-frontends/mt352.c   |  7 +-
 drivers/media/dvb-frontends/mxl5xx.c  |  6 +-
 drivers/media/dvb-frontends/nxt200x.c |  6 +-
 drivers/media/dvb-frontends/nxt6000.c |  6 +-
 drivers/media/dvb-frontends/or51132.c |  6 +-
 drivers/media/dvb-frontends/or51211.c |  8 +--
 drivers/media/dvb-frontends/rtl2830.c |  4 +-
 drivers/media/dvb-frontends/rtl2832.c | 10 +--
 drivers/media/dvb-frontends/s5h1409.c |  6 +-
 drivers/media/dvb-frontends/s5h1411.c |  6 +-
 drivers/media/dvb-frontends/s5h1420.c |  8 +--
 drivers/media/dvb-frontends/s5h1432.c |  6 +-
 drivers/media/dvb-frontends/s921.c|  7 +-
 drivers/media/dvb-frontends/si2165.c  |  2 +-
 drivers/media/dvb-frontends/si21xx.c  |  7 +-
 drivers/media/dvb-frontends/sp8870.c  |  6 +-
 drivers/media/dvb-frontends/sp887x.c  |  6 +-
 drivers/media/dvb-frontends/stb0899_drv.c |  6 +-
 drivers/media/dvb-frontends/stv0288.c |  7 +-
 drivers/media/dvb-frontends/stv0297.c |  6 +-
 drivers/media/dvb-frontends/stv0299.c |  7 +-
 drivers/media/dvb-frontends/stv0367.c | 20 +++---
 drivers/media/dvb-frontends/stv0900_core.c|  7 +-
 drivers/media/dvb-frontends/stv090x.c |  6 +-
 drivers/media/dvb-frontends/stv0910.c |  6 +-
 drivers/media/dvb-frontends/tc90522.c | 10 +--
 drivers/media/dvb-frontends/tda10021.c| 10 +--
 drivers/media/dvb-frontends/tda10023.c|  6 +-
 drivers/media/dvb-frontends/tda10048.c|  6 +-
 drivers/media/dvb-frontends/tda1004x.c| 12 ++--
 drivers/media/dvb-frontends/tda10071.c| 10 +--
 drivers/media/dvb-frontends/tda10086.c|  6 +-
 drivers/media/dvb-frontends/tda8083.c |  7 +-
 drivers/media/dvb-frontends/ves1820.c |  6 +-
 drivers/media/dvb-frontends/ves1x93.c |  8 +--
 drivers/media/dvb-frontends/zl10036.c |  4 +-
 drivers/media/dvb-frontends/zl10353.c |  7 +-
 drivers/media/firewire/

Re: [PATCH 2/2] media: dvb: represent min/max/step/tolerance freqs in Hz

2018-07-04 Thread kbuild test robot
Hi Mauro,

I love your patch! Perhaps something to improve:

[auto build test WARNING on linuxtv-media/master]
[also build test WARNING on v4.18-rc3 next-20180704]
[if your patch is applied to the wrong git tree, please drop us a note to help 
improve the system]

url:
https://github.com/0day-ci/linux/commits/Mauro-Carvalho-Chehab/DVB-represent-frequencies-at-tuner-frontend-info-in-Hz/20180705-105703
base:   git://linuxtv.org/media_tree.git master
config: x86_64-randconfig-x004-201826 (attached as .config)
compiler: gcc-7 (Debian 7.3.0-16) 7.3.0
reproduce:
# save the attached .config to linux build tree
make ARCH=x86_64 

All warnings (new ones prefixed by >>):

   drivers/media/dvb-core/dvb_frontend.c: In function 
'dvb_frontend_handle_ioctl':
>> drivers/media/dvb-core/dvb_frontend.c:2396:25: warning: argument to 'sizeof' 
>> in 'memset' call is the same expression as the destination; did you mean to 
>> dereference it? [-Wsizeof-pointer-memaccess]
  memset(info, 0, sizeof(info));
^

vim +2396 drivers/media/dvb-core/dvb_frontend.c

  2295  
  2296  static int dvb_frontend_handle_ioctl(struct file *file,
  2297   unsigned int cmd, void *parg)
  2298  {
  2299  struct dvb_device *dvbdev = file->private_data;
  2300  struct dvb_frontend *fe = dvbdev->priv;
  2301  struct dvb_frontend_private *fepriv = fe->frontend_priv;
  2302  struct dtv_frontend_properties *c = &fe->dtv_property_cache;
  2303  int i, err = -ENOTSUPP;
  2304  
  2305  dev_dbg(fe->dvb->device, "%s:\n", __func__);
  2306  
  2307  switch (cmd) {
  2308  case FE_SET_PROPERTY: {
  2309  struct dtv_properties *tvps = parg;
  2310  struct dtv_property *tvp = NULL;
  2311  
  2312  dev_dbg(fe->dvb->device, "%s: properties.num = %d\n",
  2313  __func__, tvps->num);
  2314  dev_dbg(fe->dvb->device, "%s: properties.props = %p\n",
  2315  __func__, tvps->props);
  2316  
  2317  /*
  2318   * Put an arbitrary limit on the number of messages 
that can
  2319   * be sent at once
  2320   */
  2321  if (!tvps->num || (tvps->num > DTV_IOCTL_MAX_MSGS))
  2322  return -EINVAL;
  2323  
  2324  tvp = memdup_user((void __user *)tvps->props, tvps->num 
* sizeof(*tvp));
  2325  if (IS_ERR(tvp))
  2326  return PTR_ERR(tvp);
  2327  
  2328  for (i = 0; i < tvps->num; i++) {
  2329  err = dtv_property_process_set(fe, file,
  2330 (tvp + i)->cmd,
  2331 (tvp + 
i)->u.data);
  2332  if (err < 0) {
  2333  kfree(tvp);
  2334  return err;
  2335  }
  2336  }
  2337  kfree(tvp);
  2338  err = 0;
  2339  break;
  2340  }
  2341  case FE_GET_PROPERTY: {
  2342  struct dtv_properties *tvps = parg;
  2343  struct dtv_property *tvp = NULL;
  2344  struct dtv_frontend_properties getp = 
fe->dtv_property_cache;
  2345  
  2346  dev_dbg(fe->dvb->device, "%s: properties.num = %d\n",
  2347  __func__, tvps->num);
  2348  dev_dbg(fe->dvb->device, "%s: properties.props = %p\n",
  2349  __func__, tvps->props);
  2350  
  2351  /*
  2352   * Put an arbitrary limit on the number of messages 
that can
  2353   * be sent at once
  2354   */
  2355  if (!tvps->num || (tvps->num > DTV_IOCTL_MAX_MSGS))
  2356  return -EINVAL;
  2357  
  2358  tvp = memdup_user((void __user *)tvps->props, tvps->num 
* sizeof(*tvp));
  2359  if (IS_ERR(tvp))
  2360  return PTR_ERR(tvp);
  2361  
  2362  /*
  2363   * Let's use our own copy of property cache, in order to
  2364   * avoid mangling with DTV zigzag logic, as drivers 
might
  2365   * return crap, if they don't check if the data is 
available
  2366   * before updating the properties cache.
  2367   */
  2368  if (fepriv->state != FESTATE_IDLE) {
  2369  err = dtv_get_frontend(fe, &getp, NULL);
  2370  if (err < 0) {
  2371  kfree(tvp);
  2372  return err;
  2373  }

Re: [PATCH 2/2] media: dvb: represent min/max/step/tolerance freqs in Hz

2018-07-04 Thread kbuild test robot
Hi Mauro,

I love your patch! Perhaps something to improve:

[auto build test WARNING on linuxtv-media/master]
[also build test WARNING on v4.18-rc3 next-20180704]
[if your patch is applied to the wrong git tree, please drop us a note to help 
improve the system]

url:
https://github.com/0day-ci/linux/commits/Mauro-Carvalho-Chehab/DVB-represent-frequencies-at-tuner-frontend-info-in-Hz/20180705-105703
base:   git://linuxtv.org/media_tree.git master
config: i386-randconfig-x002-201826 (attached as .config)
compiler: gcc-7 (Debian 7.3.0-16) 7.3.0
reproduce:
# save the attached .config to linux build tree
make ARCH=i386 

All warnings (new ones prefixed by >>):

   In file included from arch/x86/include/asm/string.h:3:0,
from include/linux/string.h:20,
from drivers/media/dvb-core/dvb_frontend.c:30:
   drivers/media/dvb-core/dvb_frontend.c: In function 
'dvb_frontend_handle_ioctl':
>> drivers/media/dvb-core/dvb_frontend.c:2396:25: warning: argument to 'sizeof' 
>> in '__builtin_memset' call is the same expression as the destination; did 
>> you mean to dereference it? [-Wsizeof-pointer-memaccess]
  memset(info, 0, sizeof(info));
^
   arch/x86/include/asm/string_32.h:325:52: note: in definition of macro 
'memset'
#define memset(s, c, count) __builtin_memset(s, c, count)
   ^
   Cyclomatic Complexity 5 include/linux/compiler.h:__read_once_size
   Cyclomatic Complexity 5 include/linux/compiler.h:__write_once_size
   Cyclomatic Complexity 1 include/linux/kasan-checks.h:kasan_check_read
   Cyclomatic Complexity 1 include/linux/kasan-checks.h:kasan_check_write
   Cyclomatic Complexity 1 arch/x86/include/asm/bitops.h:constant_test_bit
   Cyclomatic Complexity 1 arch/x86/include/asm/bitops.h:variable_test_bit
   Cyclomatic Complexity 1 arch/x86/include/asm/bitops.h:fls
   Cyclomatic Complexity 1 include/linux/log2.h:__ilog2_u32
   Cyclomatic Complexity 3 include/linux/log2.h:is_power_of_2
   Cyclomatic Complexity 1 arch/x86/include/asm/atomic.h:arch_atomic_read
   Cyclomatic Complexity 1 arch/x86/include/asm/atomic.h:arch_atomic_set
   Cyclomatic Complexity 1 include/asm-generic/atomic-instrumented.h:atomic_read
   Cyclomatic Complexity 1 include/asm-generic/atomic-instrumented.h:atomic_set
   Cyclomatic Complexity 1 arch/x86/include/asm/current.h:get_current
   Cyclomatic Complexity 1 include/asm-generic/getorder.h:__get_order
   Cyclomatic Complexity 1 include/linux/err.h:PTR_ERR
   Cyclomatic Complexity 1 include/linux/err.h:IS_ERR
   Cyclomatic Complexity 2 include/linux/thread_info.h:test_ti_thread_flag
   Cyclomatic Complexity 2 include/linux/thread_info.h:check_object_size
   Cyclomatic Complexity 2 include/linux/thread_info.h:copy_overflow
   Cyclomatic Complexity 4 include/linux/thread_info.h:check_copy_size
   Cyclomatic Complexity 70 include/linux/ktime.h:ktime_divns
   Cyclomatic Complexity 1 include/linux/ktime.h:ktime_to_us
   Cyclomatic Complexity 1 include/linux/ktime.h:ktime_us_delta
   Cyclomatic Complexity 1 include/linux/ktime.h:ktime_add_us
   Cyclomatic Complexity 1 include/linux/timekeeping.h:ktime_get_boottime
   Cyclomatic Complexity 1 include/linux/refcount.h:refcount_set
   Cyclomatic Complexity 1 arch/x86/include/asm/refcount.h:refcount_inc
   Cyclomatic Complexity 1 arch/x86/include/asm/refcount.h:refcount_dec_and_test
   Cyclomatic Complexity 1 include/linux/sched.h:task_thread_info
   Cyclomatic Complexity 1 include/linux/sched.h:test_tsk_thread_flag
   Cyclomatic Complexity 1 include/linux/sched/signal.h:signal_pending
   Cyclomatic Complexity 28 include/linux/slab.h:kmalloc_index
   Cyclomatic Complexity 67 include/linux/slab.h:kmalloc_large
   Cyclomatic Complexity 5 include/linux/slab.h:kmalloc
   Cyclomatic Complexity 1 include/linux/slab.h:kzalloc
   Cyclomatic Complexity 1 include/linux/semaphore.h:sema_init
   Cyclomatic Complexity 2 include/linux/uaccess.h:copy_to_user
   Cyclomatic Complexity 4 include/linux/poll.h:poll_wait
   Cyclomatic Complexity 1 include/linux/kref.h:kref_init
   Cyclomatic Complexity 1 include/linux/kref.h:kref_get
   Cyclomatic Complexity 2 include/linux/kref.h:kref_put
   Cyclomatic Complexity 2 include/linux/freezer.h:freezing
   Cyclomatic Complexity 2 include/linux/freezer.h:try_to_freeze_unsafe
   Cyclomatic Complexity 2 include/linux/freezer.h:try_to_freeze
   Cyclomatic Complexity 1 
drivers/media/dvb-core/dvb_frontend.c:dvb_frontend_get
   Cyclomatic Complexity 1 
drivers/media/dvb-core/dvb_frontend.c:has_get_frontend
   Cyclomatic Complexity 5 drivers/media/dvb-core/dvb_frontend.c:dvbv3_type
   Cyclomatic Complexity 5 
drivers/media/dvb-core/dvb_frontend.c:dvb_frontend_init
   Cyclomatic Complexity 2 
drivers/media/dvb-core/dvb_frontend.c:dvb_frontend_swzigzag_update_delay
   Cyclomatic Complexity 20 
drivers/media/dvb-core/dvb_frontend.c:dvb_frontend_swzigzag_autotune
   Cyclomatic Complexity 6 

Re: [PATCH 2/2] media: dvb: represent min/max/step/tolerance freqs in Hz

2018-07-04 Thread kbuild test robot
Hi Mauro,

I love your patch! Perhaps something to improve:

[auto build test WARNING on linuxtv-media/master]
[also build test WARNING on v4.18-rc3 next-20180704]
[if your patch is applied to the wrong git tree, please drop us a note to help 
improve the system]

url:
https://github.com/0day-ci/linux/commits/Mauro-Carvalho-Chehab/DVB-represent-frequencies-at-tuner-frontend-info-in-Hz/20180705-105703
base:   git://linuxtv.org/media_tree.git master


coccinelle warnings: (new ones prefixed by >>)

>> drivers/media/dvb-core/dvb_frontend.c:2396:18-24: ERROR: application of 
>> sizeof to pointer

Please review and possibly fold the followup patch.

---
0-DAY kernel test infrastructureOpen Source Technology Center
https://lists.01.org/pipermail/kbuild-all   Intel Corporation