V4L/DVB (10987): cx23885: fix crash on non-netup cards
authorHans Verkuil <hverkuil@xs4all.nl>
Fri, 13 Mar 2009 16:24:19 +0000 (13:24 -0300)
committerMauro Carvalho Chehab <mchehab@redhat.com>
Mon, 30 Mar 2009 15:43:20 +0000 (12:43 -0300)
The new support for the CX23885_BOARD_NETUP_DUAL_DVBS2_CI board broke the
existing boards. Interrupts for the netup part were enabled and handled
without testing whether the current board actually had a netup -> instant
and fatal crash.

I've added tests to do this only for the CX23885_BOARD_NETUP_DUAL_DVBS2_CI
board.

Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Reviewed-by: Michael Krufky <mkrufky@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
drivers/media/video/cx23885/cx23885-core.c
drivers/media/video/cx23885/cx23885-dvb.c

index 1b401457d42eb2c8706ae60bb9ce9ed14c0e903d..d19d453cf62aac8d7e92de9ecf5dd6d576eb1896 100644 (file)
@@ -1699,7 +1699,8 @@ static irqreturn_t cx23885_irq(int irq, void *dev_id)
                                PCI_MSK_GPIO1);
        }
 
-       if ((pci_status & PCI_MSK_GPIO0) || (pci_status & PCI_MSK_GPIO1))
+       if (cx23885_boards[dev->board].cimax > 0 &&
+               ((pci_status & PCI_MSK_GPIO0) || (pci_status & PCI_MSK_GPIO1)))
                /* handled += cx23885_irq_gpio(dev, pci_status); */
                handled += netup_ci_slot_status(dev, pci_status);
 
@@ -1775,7 +1776,12 @@ static int __devinit cx23885_initdev(struct pci_dev *pci_dev,
        }
 
        pci_set_drvdata(pci_dev, dev);
-       cx_set(PCI_INT_MSK, 0x01800000); /* for NetUP */
+
+       switch (dev->board) {
+       case CX23885_BOARD_NETUP_DUAL_DVBS2_CI:
+               cx_set(PCI_INT_MSK, 0x01800000); /* for NetUP */
+               break;
+       }
 
        return 0;
 
index 9a0bc6e84a95f1baee17c33bc4a3addd2f6cdfb3..8d731fffad586fb6dff5b7b0f6bbe786ea221f1f 100644 (file)
@@ -778,7 +778,11 @@ int cx23885_dvb_unregister(struct cx23885_tsport *port)
        if (fe0->dvb.frontend)
                videobuf_dvb_unregister_bus(&port->frontends);
 
-       netup_ci_exit(port);
+       switch (port->dev->board) {
+       case CX23885_BOARD_NETUP_DUAL_DVBS2_CI:
+               netup_ci_exit(port);
+               break;
+       }
 
        return 0;
 }