summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Scheller <d.scheller@gmx.net>2017-12-17 10:40:49 -0500
committerMauro Carvalho Chehab <mchehab@s-opensource.com>2017-12-19 07:18:38 -0500
commitae49432810c5cca2143afc1445edad6582c9f270 (patch)
tree1e7eb2ba9bd48696966694b5ae1f500d00b89487
parentc0e10260cc6462cbfbcbfc35eb07e4f626704a4a (diff)
downloadop-kernel-dev-ae49432810c5cca2143afc1445edad6582c9f270.zip
op-kernel-dev-ae49432810c5cca2143afc1445edad6582c9f270.tar.gz
media: ddbridge: improve ddb_ports_attach() failure handling
As all error handling improved quite a bit, don't stop attaching frontends if one of them failed, since - if other tuner modules are connected to the PCIe bridge - other hardware may just work, so don't break on a single port failure, but rather initialise as much as possible. Ie. if there are issues with a C2T2-equipped PCIe bridge card which has additional DuoFlex modules connected and the bridge generally works, the DuoFlex tuners can still work fine. If all ports failed to initialise where connected hardware was detected on at first, return -ENODEV though to cause this PCI device to fail and free all allocated resources. In any case, leave a kernel log warning (or error, even) if things went wrong. Signed-off-by: Daniel Scheller <d.scheller@gmx.net> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
-rw-r--r--drivers/media/pci/ddbridge/ddbridge-core.c26
1 files changed, 23 insertions, 3 deletions
diff --git a/drivers/media/pci/ddbridge/ddbridge-core.c b/drivers/media/pci/ddbridge/ddbridge-core.c
index d2e1c99..5188f40 100644
--- a/drivers/media/pci/ddbridge/ddbridge-core.c
+++ b/drivers/media/pci/ddbridge/ddbridge-core.c
@@ -1964,7 +1964,7 @@ static int ddb_port_attach(struct ddb_port *port)
int ddb_ports_attach(struct ddb *dev)
{
- int i, ret = 0;
+ int i, numports, err_ports = 0, ret = 0;
struct ddb_port *port;
if (dev->port_num) {
@@ -1974,11 +1974,31 @@ int ddb_ports_attach(struct ddb *dev)
return ret;
}
}
+
+ numports = dev->port_num;
+
for (i = 0; i < dev->port_num; i++) {
port = &dev->port[i];
- ret = ddb_port_attach(port);
+ if (port->class != DDB_PORT_NONE) {
+ ret = ddb_port_attach(port);
+ if (ret)
+ err_ports++;
+ } else {
+ numports--;
+ }
}
- return ret;
+
+ if (err_ports) {
+ if (err_ports == numports) {
+ dev_err(dev->dev, "All connected ports failed to initialise!\n");
+ return -ENODEV;
+ }
+
+ dev_warn(dev->dev, "%d of %d connected ports failed to initialise!\n",
+ err_ports, numports);
+ }
+
+ return 0;
}
void ddb_ports_detach(struct ddb *dev)
OpenPOWER on IntegriCloud