cron job: media_tree daily build: WARNINGS

2018-02-17 Thread Hans Verkuil
This message is generated daily by a cron job that builds media_tree for
the kernels and architectures in the list below.

Results of the daily build of media_tree:

date:   Sun Feb 18 05:00:11 CET 2018
media-tree git hash:29422737017b866d4a51014cc7522fa3a99e8852
media_build git hash:   d144cfe4b3c37ece55ae27778c99765d4943c4fa
v4l-utils git hash: 432d9ebfcea65337647fd4e458f76b0417ea1c2f
gcc version:i686-linux-gcc (GCC) 7.3.0
sparse version: v0.5.0-3994-g45eb2282
smatch version: v0.5.0-3994-g45eb2282
host hardware:  x86_64
host os:4.14.0-3-amd64

linux-git-arm-at91: OK
linux-git-arm-davinci: OK
linux-git-arm-multi: OK
linux-git-arm-pxa: OK
linux-git-arm-stm32: OK
linux-git-arm64: OK
linux-git-blackfin-bf561: OK
linux-git-i686: OK
linux-git-m32r: OK
linux-git-mips: OK
linux-git-powerpc64: OK
linux-git-sh: OK
linux-git-x86_64: OK
linux-2.6.36.4-i686: WARNINGS
linux-2.6.36.4-x86_64: WARNINGS
linux-2.6.37.6-i686: WARNINGS
linux-2.6.37.6-x86_64: WARNINGS
linux-2.6.38.8-i686: WARNINGS
linux-2.6.38.8-x86_64: WARNINGS
linux-2.6.39.4-i686: WARNINGS
linux-2.6.39.4-x86_64: WARNINGS
linux-3.0.60-i686: WARNINGS
linux-3.0.60-x86_64: WARNINGS
linux-3.1.10-i686: WARNINGS
linux-3.1.10-x86_64: WARNINGS
linux-3.2.98-i686: WARNINGS
linux-3.2.98-x86_64: WARNINGS
linux-3.3.8-i686: WARNINGS
linux-3.3.8-x86_64: WARNINGS
linux-3.4.27-i686: WARNINGS
linux-3.4.27-x86_64: WARNINGS
linux-3.5.7-i686: WARNINGS
linux-3.5.7-x86_64: WARNINGS
linux-3.6.11-i686: WARNINGS
linux-3.6.11-x86_64: WARNINGS
linux-3.7.4-i686: WARNINGS
linux-3.7.4-x86_64: WARNINGS
linux-3.8-i686: WARNINGS
linux-3.8-x86_64: WARNINGS
linux-3.9.2-i686: WARNINGS
linux-3.9.2-x86_64: WARNINGS
linux-3.10.1-i686: WARNINGS
linux-3.10.1-x86_64: WARNINGS
linux-3.11.1-i686: WARNINGS
linux-3.11.1-x86_64: WARNINGS
linux-3.12.67-i686: WARNINGS
linux-3.12.67-x86_64: WARNINGS
linux-3.13.11-i686: WARNINGS
linux-3.13.11-x86_64: WARNINGS
linux-3.14.9-i686: WARNINGS
linux-3.14.9-x86_64: WARNINGS
linux-3.15.2-i686: WARNINGS
linux-3.15.2-x86_64: WARNINGS
linux-3.16.53-i686: WARNINGS
linux-3.16.53-x86_64: WARNINGS
linux-3.17.8-i686: WARNINGS
linux-3.17.8-x86_64: WARNINGS
linux-3.18.93-i686: WARNINGS
linux-3.18.93-x86_64: WARNINGS
linux-3.19-i686: WARNINGS
linux-3.19-x86_64: WARNINGS
linux-4.0.9-i686: WARNINGS
linux-4.0.9-x86_64: WARNINGS
linux-4.1.49-i686: WARNINGS
linux-4.1.49-x86_64: WARNINGS
linux-4.2.8-i686: WARNINGS
linux-4.2.8-x86_64: WARNINGS
linux-4.3.6-i686: WARNINGS
linux-4.3.6-x86_64: WARNINGS
linux-4.4.115-i686: OK
linux-4.4.115-x86_64: OK
linux-4.5.7-i686: WARNINGS
linux-4.5.7-x86_64: WARNINGS
linux-4.6.7-i686: OK
linux-4.6.7-x86_64: WARNINGS
linux-4.7.5-i686: OK
linux-4.7.5-x86_64: WARNINGS
linux-4.8-i686: OK
linux-4.8-x86_64: WARNINGS
linux-4.9.80-i686: OK
linux-4.9.80-x86_64: OK
linux-4.10.14-i686: OK
linux-4.10.14-x86_64: WARNINGS
linux-4.11-i686: OK
linux-4.11-x86_64: WARNINGS
linux-4.12.1-i686: OK
linux-4.12.1-x86_64: WARNINGS
linux-4.13-i686: OK
linux-4.13-x86_64: OK
linux-4.14.17-i686: OK
linux-4.14.17-x86_64: OK
linux-4.15.2-i686: OK
linux-4.15.2-x86_64: OK
linux-4.16-rc1-i686: OK
linux-4.16-rc1-x86_64: OK
apps: WARNINGS
spec-git: OK
sparse: WARNINGS
smatch: OK

Detailed results are available here:

http://www.xs4all.nl/~hverkuil/logs/Sunday.log

Full logs are available here:

http://www.xs4all.nl/~hverkuil/logs/Sunday.tar.bz2

The Media Infrastructure API from this daily build is here:

http://www.xs4all.nl/~hverkuil/spec/index.html


Bug: Two device nodes created in /dev for a single UVC webcam

2018-02-17 Thread Alexandre-Xavier Labonté-Lamoureux
Hi,

I'm running Linux 4.9.0-5-amd64 on Debian. I built the drivers from
the latest git and installed the modules. Now, two device nodes are
created for my webcam. This is not normal as it has never happened to
me before. If I connect another webcam to my laptop, two more device
nodes will be created for this webcam. So two new device nodes are
created for a single webcam.

The name of my webcam appears twice in the device comobox in Guvcview
because of this. One of them will not work if I select it. My webcam
has completely stopped working with Cheese and VLC.

> v4l2-ctl --list-devices
Laptop_Integrated_Webcam_E4HD:  (usb-:00:1a.0-1.5):
/dev/video0
/dev/video1

> ls /dev/video*
/dev/video0  /dev/video1

Have a nice day,
Alexandre-Xavier


Regional Liaison Representative

2018-02-17 Thread Atsushi Die Casting Co.Ltd

Hello

Atsushi Die Casting Co.Ltd is currently looking on expanding is work force by 
over 80% by contracting companies and individuals to act as a representative 
irrespective of your profession to help their growing business based in 
USA/CANADA.If Interested please send your resume/contact details for immediate 
consideration via email:atsushidiecast...@gmail.com for details.Note you don't 
need to pay any money we are the one that will be paying you for your service.

Regards,
HR Dept


Regional Liaison Representative

2018-02-17 Thread Atsushi Die Casting Co.Ltd

Hello

Atsushi Die Casting Co.Ltd is currently looking on expanding is work force by 
over 80% by contracting companies and individuals to act as a representative 
irrespective of your profession to help their growing business based in 
USA/CANADA.If Interested please send your resume/contact details for immediate 
consideration via email:atsushidiecast...@gmail.com for details.Note you don't 
need to pay any money we are the one that will be paying you for your service.

Regards,
HR Dept


Regional Liaison Representative

2018-02-17 Thread Atsushi Die Casting Co.Ltd

Hello

Atsushi Die Casting Co.Ltd is currently looking on expanding is work force by 
over 80% by contracting companies and individuals to act as a representative 
irrespective of your profession to help their growing business based in 
USA/CANADA.If Interested please send your resume/contact details for immediate 
consideration via email:atsushidiecast...@gmail.com for details.Note you don't 
need to pay any money we are the one that will be paying you for your service.

Regards,
HR Dept


Regional Liaison Representative

2018-02-17 Thread Atsushi Die Casting Co.Ltd

Hello

Atsushi Die Casting Co.Ltd is currently looking on expanding is work force by 
over 80% by contracting companies and individuals to act as a representative 
irrespective of your profession to help their growing business based in 
USA/CANADA.If Interested please send your resume/contact details for immediate 
consideration via email:atsushidiecast...@gmail.com for details.Note you don't 
need to pay any money we are the one that will be paying you for your service.

Regards,
HR Dept


[PATCH v2 7/7] [media] MAINTAINERS: add entry for cxd2099

2018-02-17 Thread Daniel Scheller
From: Jasmin Jessich 

The cxd2099 driver is now maintained and being taken care of by

  * Jasmin Jessich 

Signed-off-by: Jasmin Jessich 
---
 MAINTAINERS | 8 
 1 file changed, 8 insertions(+)

diff --git a/MAINTAINERS b/MAINTAINERS
index aee793bff977..c3b689e2583e 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -8540,6 +8540,14 @@ T:   git git://linuxtv.org/media_tree.git
 S: Supported
 F: drivers/media/dvb-frontends/ascot2e*
 
+MEDIA DRIVERS FOR CXD2099AR CI CONTROLLERS
+M: Jasmin Jessich 
+L: linux-media@vger.kernel.org
+W: https://linuxtv.org
+T: git git://linuxtv.org/media_tree.git
+S: Maintained
+F: drivers/media/dvb-frontends/cxd2099*
+
 MEDIA DRIVERS FOR CXD2841ER
 M: Sergey Kozlov 
 M: Abylay Ospan 
-- 
2.13.6



[PATCH v2 5/7] [media] staging/cxd2099: remove remainders from old attach way

2018-02-17 Thread Daniel Scheller
From: Daniel Scheller 

As all drivers using the cxd2099 are converted to handle attach/detach
the generic I2C client way, the static inline cxd2099_attach isn't
required anymore. Thus cleanup cxd2099.h from the remainders, the adr
struct member isn't used anymore aswell.

Signed-off-by: Daniel Scheller 
Signed-off-by: Jasmin Jessich 
---
 drivers/staging/media/cxd2099/cxd2099.h | 10 --
 1 file changed, 10 deletions(-)

diff --git a/drivers/staging/media/cxd2099/cxd2099.h 
b/drivers/staging/media/cxd2099/cxd2099.h
index 679e87512799..8fa45a4c615a 100644
--- a/drivers/staging/media/cxd2099/cxd2099.h
+++ b/drivers/staging/media/cxd2099/cxd2099.h
@@ -20,7 +20,6 @@
 
 struct cxd2099_cfg {
u32 bitrate;
-   u8  adr;
u8  polarity;
u8  clock_mode;
 
@@ -30,13 +29,4 @@ struct cxd2099_cfg {
struct dvb_ca_en50221 **en;
 };
 
-/* TODO: remove when done */
-static inline struct
-dvb_ca_en50221 *cxd2099_attach(struct cxd2099_cfg *cfg, void *priv,
-  struct i2c_adapter *i2c)
-{
-   dev_warn(>dev, "%s: driver disabled by Kconfig\n", __func__);
-   return NULL;
-}
-
 #endif
-- 
2.13.6



[PATCH v2 6/7] [media] cxd2099: move driver out of staging into dvb-frontends

2018-02-17 Thread Daniel Scheller
From: Daniel Scheller 

According to the TODO file, this driver only landed in staging because of
the way device nodes and data transfers are handled. Besides that this way
(use of secX devices) has become sort of standard to date (ie. VDR
supports this literally since ages via the ddci plugin, TVHeadend received
this functionality lately, and minisatip being currently worked on
regarding this), most importantly this I2C client only driver isn't even
responsible for setting up device nodes, not for handling data
transfer and so on, but only serves as interface for the dvb_ca_en50221
subsystem, just like every other DVB card out in the wild, with hard-wired
or such flexible CA interfaces. And, it would even work with cards having
the cxd2099 controller hard-wired.

Also, this driver received quite some love and even is a proper I2C client
driver by now. So, as this driver acts as a EN50221 frontend device, move
it to dvb-frontends. There is no need to keep it buried in staging.

This commit also updates all affected Kconfig and Makefile's, and adds
MEDIA_AUTOSELECT depends to ddbridge and ngene.

Signed-off-by: Daniel Scheller 
Signed-off-by: Jasmin Jessich 
---
 drivers/media/dvb-frontends/Kconfig  | 12 
 drivers/media/dvb-frontends/Makefile |  1 +
 .../{staging/media/cxd2099 => media/dvb-frontends}/cxd2099.c |  0
 .../{staging/media/cxd2099 => media/dvb-frontends}/cxd2099.h |  0
 drivers/media/pci/ddbridge/Kconfig   |  1 +
 drivers/media/pci/ddbridge/Makefile  |  3 ---
 drivers/media/pci/ngene/Kconfig  |  1 +
 drivers/media/pci/ngene/Makefile |  3 ---
 drivers/staging/media/Kconfig|  2 --
 drivers/staging/media/Makefile   |  1 -
 drivers/staging/media/cxd2099/Kconfig| 12 
 drivers/staging/media/cxd2099/Makefile   |  4 
 drivers/staging/media/cxd2099/TODO   | 12 
 13 files changed, 15 insertions(+), 37 deletions(-)
 rename drivers/{staging/media/cxd2099 => media/dvb-frontends}/cxd2099.c (100%)
 rename drivers/{staging/media/cxd2099 => media/dvb-frontends}/cxd2099.h (100%)
 delete mode 100644 drivers/staging/media/cxd2099/Kconfig
 delete mode 100644 drivers/staging/media/cxd2099/Makefile
 delete mode 100644 drivers/staging/media/cxd2099/TODO

diff --git a/drivers/media/dvb-frontends/Kconfig 
b/drivers/media/dvb-frontends/Kconfig
index d17722eb4456..ca8c7ed079dd 100644
--- a/drivers/media/dvb-frontends/Kconfig
+++ b/drivers/media/dvb-frontends/Kconfig
@@ -904,6 +904,18 @@ config DVB_HELENE
help
  Say Y when you want to support this frontend.
 
+comment "Common Interface (EN50221) controller drivers"
+   depends on DVB_CORE
+
+config DVB_CXD2099
+   tristate "CXD2099AR Common Interface driver"
+   depends on DVB_CORE && I2C
+   ---help---
+ A driver for the CI controller currently found mostly on
+ Digital Devices DuoFlex CI (single) addon modules.
+
+ Say Y when you want to support these devices.
+
 comment "Tools to develop new frontends"
 
 config DVB_DUMMY_FE
diff --git a/drivers/media/dvb-frontends/Makefile 
b/drivers/media/dvb-frontends/Makefile
index 4be59fed4536..abbd76ede540 100644
--- a/drivers/media/dvb-frontends/Makefile
+++ b/drivers/media/dvb-frontends/Makefile
@@ -129,3 +129,4 @@ obj-$(CONFIG_DVB_HORUS3A) += horus3a.o
 obj-$(CONFIG_DVB_ASCOT2E) += ascot2e.o
 obj-$(CONFIG_DVB_HELENE) += helene.o
 obj-$(CONFIG_DVB_ZD1301_DEMOD) += zd1301_demod.o
+obj-$(CONFIG_DVB_CXD2099) += cxd2099.o
diff --git a/drivers/staging/media/cxd2099/cxd2099.c 
b/drivers/media/dvb-frontends/cxd2099.c
similarity index 100%
rename from drivers/staging/media/cxd2099/cxd2099.c
rename to drivers/media/dvb-frontends/cxd2099.c
diff --git a/drivers/staging/media/cxd2099/cxd2099.h 
b/drivers/media/dvb-frontends/cxd2099.h
similarity index 100%
rename from drivers/staging/media/cxd2099/cxd2099.h
rename to drivers/media/dvb-frontends/cxd2099.h
diff --git a/drivers/media/pci/ddbridge/Kconfig 
b/drivers/media/pci/ddbridge/Kconfig
index f43d0b83fc0c..a422dde2f34a 100644
--- a/drivers/media/pci/ddbridge/Kconfig
+++ b/drivers/media/pci/ddbridge/Kconfig
@@ -13,6 +13,7 @@ config DVB_DDBRIDGE
select DVB_LNBH25 if MEDIA_SUBDRV_AUTOSELECT
select MEDIA_TUNER_TDA18212 if MEDIA_SUBDRV_AUTOSELECT
select DVB_MXL5XX if MEDIA_SUBDRV_AUTOSELECT
+   select DVB_CXD2099 if MEDIA_SUBDRV_AUTOSELECT
---help---
  Support for cards with the Digital Devices PCI express bridge:
  - Octopus PCIe Bridge
diff --git a/drivers/media/pci/ddbridge/Makefile 
b/drivers/media/pci/ddbridge/Makefile
index f58fdec50eab..745b37d07558 100644
--- a/drivers/media/pci/ddbridge/Makefile
+++ 

[PATCH v2 4/7] [media] ngene: adapt cxd2099 attach to the new i2c_client way

2018-02-17 Thread Daniel Scheller
From: Daniel Scheller 

Change the way the cxd2099 hardware is being attached to the new I2C
client interface way. Also, add I2C_FUNC_I2C to the I2C interface
functionality.

Signed-off-by: Daniel Scheller 
Signed-off-by: Jasmin Jessich 
---
 drivers/media/pci/ngene/ngene-core.c | 41 
 drivers/media/pci/ngene/ngene-i2c.c  |  2 +-
 drivers/media/pci/ngene/ngene.h  |  1 +
 3 files changed, 39 insertions(+), 5 deletions(-)

diff --git a/drivers/media/pci/ngene/ngene-core.c 
b/drivers/media/pci/ngene/ngene-core.c
index 8c92cb7f7e72..80db777cb7ec 100644
--- a/drivers/media/pci/ngene/ngene-core.c
+++ b/drivers/media/pci/ngene/ngene-core.c
@@ -1562,9 +1562,8 @@ static int init_channels(struct ngene *dev)
return 0;
 }
 
-static struct cxd2099_cfg cxd_cfg = {
+static const struct cxd2099_cfg cxd_cfgtmpl = {
.bitrate = 62000,
-   .adr = 0x40,
.polarity = 0,
.clock_mode = 0,
 };
@@ -1572,18 +1571,52 @@ static struct cxd2099_cfg cxd_cfg = {
 static void cxd_attach(struct ngene *dev)
 {
struct ngene_ci *ci = >ci;
+   struct cxd2099_cfg cxd_cfg = cxd_cfgtmpl;
+   struct i2c_client *client;
+   struct i2c_board_info board_info = {
+   .type = "cxd2099",
+   .addr = 0x40,
+   .platform_data = _cfg,
+   };
+
+   cxd_cfg.en = >en;
+
+   request_module(board_info.type);
+
+   client = i2c_new_device(>channel[0].i2c_adapter, _info);
+   if (!client || !client->dev.driver)
+   goto err_ret;
+
+   if (!try_module_get(client->dev.driver->owner))
+   goto err_i2c;
+
+   if (!ci->en)
+   goto err_i2c;
 
-   ci->en = cxd2099_attach(_cfg, dev, >channel[0].i2c_adapter);
ci->dev = dev;
+   dev->channel[0].i2c_client[0] = client;
+   return;
+
+err_i2c:
+   i2c_unregister_device(client);
+err_ret:
+   printk(KERN_ERR DEVICE_NAME ": CXD2099AR attach failed\n");
return;
 }
 
 static void cxd_detach(struct ngene *dev)
 {
struct ngene_ci *ci = >ci;
+   struct i2c_client *client;
 
dvb_ca_en50221_release(ci->en);
-   kfree(ci->en);
+
+   client = dev->channel[0].i2c_client[0];
+   if (client) {
+   module_put(client->dev.driver->owner);
+   i2c_unregister_device(client);
+   }
+
ci->en = NULL;
 }
 
diff --git a/drivers/media/pci/ngene/ngene-i2c.c 
b/drivers/media/pci/ngene/ngene-i2c.c
index 3004947f300b..092d46c2a3a9 100644
--- a/drivers/media/pci/ngene/ngene-i2c.c
+++ b/drivers/media/pci/ngene/ngene-i2c.c
@@ -147,7 +147,7 @@ static int ngene_i2c_master_xfer(struct i2c_adapter 
*adapter,
 
 static u32 ngene_i2c_functionality(struct i2c_adapter *adap)
 {
-   return I2C_FUNC_SMBUS_EMUL;
+   return I2C_FUNC_I2C | I2C_FUNC_SMBUS_EMUL;
 }
 
 static const struct i2c_algorithm ngene_i2c_algo = {
diff --git a/drivers/media/pci/ngene/ngene.h b/drivers/media/pci/ngene/ngene.h
index 02dbd18f92d0..caf8602c7459 100644
--- a/drivers/media/pci/ngene/ngene.h
+++ b/drivers/media/pci/ngene/ngene.h
@@ -630,6 +630,7 @@ struct ngene_vopen {
 struct ngene_channel {
struct device device;
struct i2c_adapteri2c_adapter;
+   struct i2c_client*i2c_client[1];
 
struct ngene *dev;
int   number;
-- 
2.13.6



[PATCH v2 3/7] [media] ddbridge: adapt cxd2099 attach to new i2c_client way

2018-02-17 Thread Daniel Scheller
From: Daniel Scheller 

Change the way the cxd2099 hardware is being attached to the new I2C
client interface way.

Signed-off-by: Daniel Scheller 
Signed-off-by: Jasmin Jessich 
---
 drivers/media/pci/ddbridge/ddbridge-ci.c | 62 +---
 drivers/media/pci/ddbridge/ddbridge.h|  1 +
 2 files changed, 58 insertions(+), 5 deletions(-)

diff --git a/drivers/media/pci/ddbridge/ddbridge-ci.c 
b/drivers/media/pci/ddbridge/ddbridge-ci.c
index ed19890710d6..6585ef54ac22 100644
--- a/drivers/media/pci/ddbridge/ddbridge-ci.c
+++ b/drivers/media/pci/ddbridge/ddbridge-ci.c
@@ -172,6 +172,7 @@ static void ci_attach(struct ddb_port *port)
memcpy(>en, _templ, sizeof(en_templ));
ci->en.data = ci;
port->en = >en;
+   port->en_freedata = 1;
ci->port = port;
ci->nr = port->nr - 2;
 }
@@ -304,6 +305,7 @@ static void ci_xo2_attach(struct ddb_port *port)
memcpy(>en, _xo2_templ, sizeof(en_xo2_templ));
ci->en.data = ci;
port->en = >en;
+   port->en_freedata = 1;
ci->port = port;
ci->nr = port->nr - 2;
ci->port->creg = 0;
@@ -311,20 +313,58 @@ static void ci_xo2_attach(struct ddb_port *port)
write_creg(ci, 0x08, 0x08);
 }
 
-static struct cxd2099_cfg cxd_cfg = {
+static const struct cxd2099_cfg cxd_cfgtmpl = {
.bitrate =  72000,
-   .adr =  0x40,
.polarity = 1,
.clock_mode = 1,
.max_i2c = 512,
 };
 
+static int ci_cxd2099_attach(struct ddb_port *port, u32 bitrate)
+{
+   struct cxd2099_cfg cxd_cfg = cxd_cfgtmpl;
+   struct i2c_client *client;
+   struct i2c_board_info board_info = {
+   .type = "cxd2099",
+   .addr = 0x40,
+   .platform_data = _cfg,
+   };
+
+   cxd_cfg.bitrate = bitrate;
+   cxd_cfg.en = >en;
+
+   request_module(board_info.type);
+
+   client = i2c_new_device(>i2c->adap, _info);
+   if (!client || !client->dev.driver)
+   goto err_ret;
+
+   if (!try_module_get(client->dev.driver->owner))
+   goto err_i2c;
+
+   if (!port->en)
+   goto err_i2c;
+
+   port->dvb[0].i2c_client[0] = client;
+   port->en_freedata = 0;
+   return 0;
+
+err_i2c:
+   i2c_unregister_device(client);
+err_ret:
+   dev_err(port->dev->dev, "CXD2099AR attach failed\n");
+   return -ENODEV;
+}
+
 int ddb_ci_attach(struct ddb_port *port, u32 bitrate)
 {
+   int ret;
+
switch (port->type) {
case DDB_CI_EXTERNAL_SONY:
-   cxd_cfg.bitrate = bitrate;
-   port->en = cxd2099_attach(_cfg, port, >i2c->adap);
+   ret = ci_cxd2099_attach(port, bitrate);
+   if (ret)
+   return -ENODEV;
break;
case DDB_CI_EXTERNAL_XO2:
case DDB_CI_EXTERNAL_XO2_B:
@@ -345,11 +385,23 @@ int ddb_ci_attach(struct ddb_port *port, u32 bitrate)
 
 void ddb_ci_detach(struct ddb_port *port)
 {
+   struct i2c_client *client;
+
if (port->dvb[0].dev)
dvb_unregister_device(port->dvb[0].dev);
if (port->en) {
dvb_ca_en50221_release(port->en);
-   kfree(port->en->data);
+
+   client = port->dvb[0].i2c_client[0];
+   if (client) {
+   module_put(client->dev.driver->owner);
+   i2c_unregister_device(client);
+   }
+
+   /* free alloc'ed memory if needed */
+   if (port->en_freedata)
+   kfree(port->en->data);
+
port->en = NULL;
}
 }
diff --git a/drivers/media/pci/ddbridge/ddbridge.h 
b/drivers/media/pci/ddbridge/ddbridge.h
index 095457737bc1..f223dc6c9963 100644
--- a/drivers/media/pci/ddbridge/ddbridge.h
+++ b/drivers/media/pci/ddbridge/ddbridge.h
@@ -276,6 +276,7 @@ struct ddb_port {
struct ddb_input  *input[2];
struct ddb_output *output;
struct dvb_ca_en50221 *en;
+   u8 en_freedata;
struct ddb_dvb dvb[2];
u32gap;
u32obr;
-- 
2.13.6



[PATCH v2 2/7] [media] staging/cxd2099: convert to regmap API

2018-02-17 Thread Daniel Scheller
From: Daniel Scheller 

Convert the cxd2099 driver to use regmap for I2C accesses, removing all
own i2c_*() functions. With that, make the driver a proper I2C client
driver. This also adds the benefit of having a proper cleanup function
(cxd2099_remove() in this case) that takes care of resource cleanup
upon I2C client deregistration.

At this point, keep the static inline declared cxd2099_attach()
function so that drivers using the legacy/proprietary style attach way
still compile, albeit lacking the cxd2099 driver functionality. This
is taken care of in the next two patches.

Signed-off-by: Daniel Scheller 
Signed-off-by: Jasmin Jessich 
---
 drivers/staging/media/cxd2099/cxd2099.c | 209 
 drivers/staging/media/cxd2099/cxd2099.h |  11 +-
 2 files changed, 108 insertions(+), 112 deletions(-)

diff --git a/drivers/staging/media/cxd2099/cxd2099.c 
b/drivers/staging/media/cxd2099/cxd2099.c
index dc9cbd8f2104..c0a5849b76bb 100644
--- a/drivers/staging/media/cxd2099/cxd2099.c
+++ b/drivers/staging/media/cxd2099/cxd2099.c
@@ -17,6 +17,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -33,8 +34,9 @@ static int read_data(struct dvb_ca_en50221 *ca, int slot, u8 
*ebuf, int ecount);
 struct cxd {
struct dvb_ca_en50221 en;
 
-   struct i2c_adapter *i2c;
struct cxd2099_cfg cfg;
+   struct i2c_client *client;
+   struct regmap *regmap;
 
u8 regs[0x23];
u8 lastaddress;
@@ -56,69 +58,12 @@ struct cxd {
u8 wbuf[1028];
 };
 
-static int i2c_write_reg(struct i2c_adapter *adapter, u8 adr,
-u8 reg, u8 data)
-{
-   u8 m[2] = {reg, data};
-   struct i2c_msg msg = {.addr = adr, .flags = 0, .buf = m, .len = 2};
-
-   if (i2c_transfer(adapter, , 1) != 1) {
-   dev_err(>dev,
-   "Failed to write to I2C register %02x@%02x!\n",
-   reg, adr);
-   return -1;
-   }
-   return 0;
-}
-
-static int i2c_write(struct i2c_adapter *adapter, u8 adr,
-u8 *data, u16 len)
-{
-   struct i2c_msg msg = {.addr = adr, .flags = 0, .buf = data, .len = len};
-
-   if (i2c_transfer(adapter, , 1) != 1) {
-   dev_err(>dev, "Failed to write to I2C!\n");
-   return -1;
-   }
-   return 0;
-}
-
-static int i2c_read_reg(struct i2c_adapter *adapter, u8 adr,
-   u8 reg, u8 *val)
-{
-   struct i2c_msg msgs[2] = {{.addr = adr, .flags = 0,
-  .buf = , .len = 1},
- {.addr = adr, .flags = I2C_M_RD,
-  .buf = val, .len = 1} };
-
-   if (i2c_transfer(adapter, msgs, 2) != 2) {
-   dev_err(>dev, "error in %s()\n", __func__);
-   return -1;
-   }
-   return 0;
-}
-
-static int i2c_read(struct i2c_adapter *adapter, u8 adr,
-   u8 reg, u8 *data, u16 n)
-{
-   struct i2c_msg msgs[2] = {{.addr = adr, .flags = 0,
-  .buf = , .len = 1},
- {.addr = adr, .flags = I2C_M_RD,
-  .buf = data, .len = n} };
-
-   if (i2c_transfer(adapter, msgs, 2) != 2) {
-   dev_err(>dev, "error in %s()\n", __func__);
-   return -1;
-   }
-   return 0;
-}
-
 static int read_block(struct cxd *ci, u8 adr, u8 *data, u16 n)
 {
int status = 0;
 
if (ci->lastaddress != adr)
-   status = i2c_write_reg(ci->i2c, ci->cfg.adr, 0, adr);
+   status = regmap_write(ci->regmap, 0, adr);
if (!status) {
ci->lastaddress = adr;
 
@@ -127,7 +72,7 @@ static int read_block(struct cxd *ci, u8 adr, u8 *data, u16 
n)
 
if (ci->cfg.max_i2c && len > ci->cfg.max_i2c)
len = ci->cfg.max_i2c;
-   status = i2c_read(ci->i2c, ci->cfg.adr, 1, data, len);
+   status = regmap_raw_read(ci->regmap, 1, data, len);
if (status)
return status;
data += len;
@@ -145,64 +90,66 @@ static int read_reg(struct cxd *ci, u8 reg, u8 *val)
 static int read_pccard(struct cxd *ci, u16 address, u8 *data, u8 n)
 {
int status;
-   u8 addr[3] = {2, address & 0xff, address >> 8};
+   u8 addr[2] = {address & 0xff, address >> 8};
 
-   status = i2c_write(ci->i2c, ci->cfg.adr, addr, 3);
+   status = regmap_raw_write(ci->regmap, 2, addr, 2);
if (!status)
-   status = i2c_read(ci->i2c, ci->cfg.adr, 3, data, n);
+   status = regmap_raw_read(ci->regmap, 3, data, n);
return status;
 }
 
 static int write_pccard(struct cxd *ci, u16 address, u8 *data, u8 n)
 {
int status;
-   u8 addr[3] = {2, address & 0xff, 

[PATCH v2 0/7] cxd2099: convert to regmap API and move out of staging

2018-02-17 Thread Daniel Scheller
From: Daniel Scheller 

Patch series done by Jasmin and me.

This patch series, besides one little cosmetic fix in ddbridge, converts
the cxd2099 CI controller driver to the regmap API and thus makes it a
proper I2C client driver. This not only moves it away from the legacy/
"proprietary" DVB attach way of using I2C drivers, but also adds a
cleanup function through the I2C remove callback (such functionality is
seemingly currently missing from the DVB EN50221 API). Both ddbridge and
ngene (as users of the driver) are updated separately. No regressions
were spotted when used in conjuntion with VDR's and TVHeadend's CI
support. Testing with an ngene card revealed that I2C_FUNC_I2C needs
to be reported in .functionality, else things will fail starting at
the CAM detection.

In addition, this series moves the cxd2099 driver out of staging right
into dvb-frontends/ as it serves as a DVB (EN50221) frontend driver.
What's written in the TODO file in the staging dir simply doesn't apply
to the driver (see the commit message of that specific patch for details)
and it got quite polished up lately, so it's just inappropriate to keep
it in staging.

Lastly, Jasmin opted to take over maintainership of the driver, so the
last patch adds her into the MAINTAINERS file for the cxd2099 driver.

Please pick this series up in this merge window so it'll be part of the
4.17 kernel release.

Changes since v1:
- ngene's I2C interface also reports I2C_FUNC_I2C in .functionality

Daniel Scheller (6):
  [media] ddbridge/ci: further deduplicate code/logic in ddb_ci_attach()
  [media] staging/cxd2099: convert to regmap API
  [media] ddbridge: adapt cxd2099 attach to new i2c_client way
  [media] ngene: adapt cxd2099 attach to the new i2c_client way
  [media] staging/cxd2099: remove remainders from old attach way
  [media] cxd2099: move driver out of staging into dvb-frontends

Jasmin Jessich (1):
  [media] MAINTAINERS: add entry for cxd2099

 MAINTAINERS|   8 +
 drivers/media/dvb-frontends/Kconfig|  12 ++
 drivers/media/dvb-frontends/Makefile   |   1 +
 .../cxd2099 => media/dvb-frontends}/cxd2099.c  | 209 ++---
 .../cxd2099 => media/dvb-frontends}/cxd2099.h  |  19 +-
 drivers/media/pci/ddbridge/Kconfig |   1 +
 drivers/media/pci/ddbridge/Makefile|   3 -
 drivers/media/pci/ddbridge/ddbridge-ci.c   |  72 +--
 drivers/media/pci/ddbridge/ddbridge.h  |   1 +
 drivers/media/pci/ngene/Kconfig|   1 +
 drivers/media/pci/ngene/Makefile   |   3 -
 drivers/media/pci/ngene/ngene-core.c   |  41 +++-
 drivers/media/pci/ngene/ngene-i2c.c|   2 +-
 drivers/media/pci/ngene/ngene.h|   1 +
 drivers/staging/media/Kconfig  |   2 -
 drivers/staging/media/Makefile |   1 -
 drivers/staging/media/cxd2099/Kconfig  |  12 --
 drivers/staging/media/cxd2099/Makefile |   4 -
 drivers/staging/media/cxd2099/TODO |  12 --
 19 files changed, 230 insertions(+), 175 deletions(-)
 rename drivers/{staging/media/cxd2099 => media/dvb-frontends}/cxd2099.c (78%)
 rename drivers/{staging/media/cxd2099 => media/dvb-frontends}/cxd2099.h (62%)
 delete mode 100644 drivers/staging/media/cxd2099/Kconfig
 delete mode 100644 drivers/staging/media/cxd2099/Makefile
 delete mode 100644 drivers/staging/media/cxd2099/TODO

-- 
2.13.6



[PATCH v2 1/7] [media] ddbridge/ci: further deduplicate code/logic in ddb_ci_attach()

2018-02-17 Thread Daniel Scheller
From: Daniel Scheller 

Deduplicate the checks for a valid ptr in port->en, and also handle the
default case to also catch eventually yet unsupported CI hardware.

Signed-off-by: Daniel Scheller 
---
 drivers/media/pci/ddbridge/ddbridge-ci.c | 12 
 1 file changed, 4 insertions(+), 8 deletions(-)

diff --git a/drivers/media/pci/ddbridge/ddbridge-ci.c 
b/drivers/media/pci/ddbridge/ddbridge-ci.c
index 5828111487b0..ed19890710d6 100644
--- a/drivers/media/pci/ddbridge/ddbridge-ci.c
+++ b/drivers/media/pci/ddbridge/ddbridge-ci.c
@@ -325,24 +325,20 @@ int ddb_ci_attach(struct ddb_port *port, u32 bitrate)
case DDB_CI_EXTERNAL_SONY:
cxd_cfg.bitrate = bitrate;
port->en = cxd2099_attach(_cfg, port, >i2c->adap);
-   if (!port->en)
-   return -ENODEV;
break;
-
case DDB_CI_EXTERNAL_XO2:
case DDB_CI_EXTERNAL_XO2_B:
ci_xo2_attach(port);
-   if (!port->en)
-   return -ENODEV;
break;
-
case DDB_CI_INTERNAL:
ci_attach(port);
-   if (!port->en)
-   return -ENODEV;
break;
+   default:
+   return -ENODEV;
}
 
+   if (!port->en)
+   return -ENODEV;
dvb_ca_en50221_init(port->dvb[0].adap, port->en, 0, 1);
return 0;
 }
-- 
2.13.6



Re: cron job: media_tree daily build: ABI WARNING

2018-02-17 Thread Hans Verkuil
On 02/17/2018 05:50 AM, Hans Verkuil wrote:
> This message is generated daily by a cron job that builds media_tree for
> the kernels and architectures in the list below.
> 
> Results of the daily build of media_tree:
> 
> date: Sat Feb 17 05:00:13 CET 2018
> media-tree git hash:  29422737017b866d4a51014cc7522fa3a99e8852
> media_build git hash: d144cfe4b3c37ece55ae27778c99765d4943c4fa
> v4l-utils git hash:   432d9ebfcea65337647fd4e458f76b0417ea1c2f
> gcc version:  i686-linux-gcc (GCC) 7.3.0
> sparse version:   v0.5.0-3994-g45eb2282
> smatch version:   v0.5.0-3994-g45eb2282
> host hardware:x86_64
> host os:  4.14.0-3-amd64
> 
> linux-git-arm-at91: OK
> linux-git-arm-davinci: OK
> linux-git-arm-multi: OK
> linux-git-arm-pxa: OK
> linux-git-arm-stm32: OK
> linux-git-arm64: OK
> linux-git-blackfin-bf561: OK
> linux-git-i686: OK
> linux-git-m32r: OK
> linux-git-mips: OK
> linux-git-powerpc64: OK
> linux-git-sh: OK
> linux-git-x86_64: OK
> linux-2.6.36.4-i686: WARNINGS
> linux-2.6.36.4-x86_64: WARNINGS
> linux-2.6.37.6-i686: WARNINGS
> linux-2.6.37.6-x86_64: WARNINGS
> linux-2.6.38.8-i686: WARNINGS
> linux-2.6.38.8-x86_64: WARNINGS
> linux-2.6.39.4-i686: WARNINGS
> linux-2.6.39.4-x86_64: WARNINGS
> linux-3.0.60-i686: WARNINGS
> linux-3.0.60-x86_64: WARNINGS
> linux-3.1.10-i686: WARNINGS
> linux-3.1.10-x86_64: WARNINGS
> linux-3.2.98-i686: WARNINGS
> linux-3.2.98-x86_64: WARNINGS
> linux-3.3.8-i686: WARNINGS
> linux-3.3.8-x86_64: WARNINGS
> linux-3.4.27-i686: WARNINGS
> linux-3.4.27-x86_64: WARNINGS
> linux-3.5.7-i686: WARNINGS
> linux-3.5.7-x86_64: WARNINGS
> linux-3.6.11-i686: WARNINGS
> linux-3.6.11-x86_64: WARNINGS
> linux-3.7.4-i686: WARNINGS
> linux-3.7.4-x86_64: WARNINGS
> linux-3.8-i686: WARNINGS
> linux-3.8-x86_64: WARNINGS
> linux-3.9.2-i686: WARNINGS
> linux-3.9.2-x86_64: WARNINGS
> linux-3.10.1-i686: WARNINGS
> linux-3.10.1-x86_64: WARNINGS
> linux-3.11.1-i686: WARNINGS
> linux-3.11.1-x86_64: WARNINGS
> linux-3.12.67-i686: WARNINGS
> linux-3.12.67-x86_64: WARNINGS
> linux-3.13.11-i686: WARNINGS
> linux-3.13.11-x86_64: WARNINGS
> linux-3.14.9-i686: WARNINGS
> linux-3.14.9-x86_64: WARNINGS
> linux-3.15.2-i686: WARNINGS
> linux-3.15.2-x86_64: WARNINGS
> linux-3.16.53-i686: WARNINGS
> linux-3.16.53-x86_64: WARNINGS
> linux-3.17.8-i686: WARNINGS
> linux-3.17.8-x86_64: WARNINGS
> linux-3.18.93-i686: WARNINGS
> linux-3.18.93-x86_64: WARNINGS
> linux-3.19-i686: WARNINGS
> linux-3.19-x86_64: WARNINGS
> linux-4.0.9-i686: WARNINGS
> linux-4.0.9-x86_64: WARNINGS
> linux-4.1.49-i686: WARNINGS
> linux-4.1.49-x86_64: WARNINGS
> linux-4.2.8-i686: WARNINGS
> linux-4.2.8-x86_64: WARNINGS
> linux-4.3.6-i686: WARNINGS
> linux-4.3.6-x86_64: WARNINGS
> linux-4.4.115-i686: OK
> linux-4.4.115-x86_64: OK
> linux-4.5.7-i686: WARNINGS
> linux-4.5.7-x86_64: WARNINGS
> linux-4.6.7-i686: OK
> linux-4.6.7-x86_64: WARNINGS
> linux-4.7.5-i686: OK
> linux-4.7.5-x86_64: WARNINGS
> linux-4.8-i686: OK
> linux-4.8-x86_64: WARNINGS
> linux-4.9.80-i686: OK
> linux-4.9.80-x86_64: OK
> linux-4.10.14-i686: OK
> linux-4.10.14-x86_64: WARNINGS
> linux-4.11-i686: OK
> linux-4.11-x86_64: WARNINGS
> linux-4.12.1-i686: OK
> linux-4.12.1-x86_64: WARNINGS
> linux-4.13-i686: OK
> linux-4.13-x86_64: OK
> linux-4.14.17-i686: OK
> linux-4.14.17-x86_64: OK
> linux-4.15.2-i686: OK
> linux-4.15.2-x86_64: OK
> linux-4.16-rc1-i686: OK
> linux-4.16-rc1-x86_64: OK
> apps: WARNINGS
> spec-git: OK
> ABI WARNING: change for arm-at91
> ABI WARNING: change for arm-davinci
> ABI WARNING: change for arm-multi
> ABI WARNING: change for arm-pxa
> ABI WARNING: change for arm-stm32
> ABI WARNING: change for arm64
> ABI WARNING: change for i686
> ABI WARNING: change for m32r
> ABI WARNING: change for mips
> ABI WARNING: change for powerpc64
> ABI WARNING: change for sh
> ABI WARNING: change for x86_64

Ignore these warnings, I switched to a new ABI checker and it still needed
a bit of tweaking. Hopefully this will be gone tomorrow.

Regards,

Hans

> sparse: WARNINGS
> smatch: OK
> 
> Detailed results are available here:
> 
> http://www.xs4all.nl/~hverkuil/logs/Saturday.log
> 
> Full logs are available here:
> 
> http://www.xs4all.nl/~hverkuil/logs/Saturday.tar.bz2
> 
> The Media Infrastructure API from this daily build is here:
> 
> http://www.xs4all.nl/~hverkuil/spec/index.html
>