diff options
-rw-r--r-- | linux/drivers/media/dvb/b2c2/skystar2.c | 61 |
1 files changed, 27 insertions, 34 deletions
diff --git a/linux/drivers/media/dvb/b2c2/skystar2.c b/linux/drivers/media/dvb/b2c2/skystar2.c index 7e54ef5ae..7d2900bef 100644 --- a/linux/drivers/media/dvb/b2c2/skystar2.c +++ b/linux/drivers/media/dvb/b2c2/skystar2.c @@ -1378,10 +1378,7 @@ static int dma_init_dma(struct adapter *adapter, u32 dma_channel) write_reg_dw(adapter, 0x008, adapter->dmaq1.bus_addr & 0xfffffffc); udelay(1000); - if (subbuffers == 0) - dma_enable_disable_irq(adapter, 0, 1, 0); - else - dma_enable_disable_irq(adapter, 0, 1, 1); + dma_enable_disable_irq(adapter, 0, 1, subbuffers ? 1 : 0); irq_dma_enable_disable_irq(adapter, 1); @@ -1989,9 +1986,7 @@ err_kfree: static void driver_halt(struct pci_dev *pdev) { - struct adapter *adapter; - - adapter = pci_get_drvdata(pdev); + struct adapter *adapter = pci_get_drvdata(pdev); irq_dma_enable_disable_irq(adapter, 0); @@ -2484,6 +2479,7 @@ static int skystar2_probe(struct pci_dev *pdev, const struct pci_device_id *ent) struct adapter *adapter; struct dvb_adapter *dvb_adapter; struct dvb_demux *dvbdemux; + struct dmx_demux *dmx; int ret = -ENODEV; if (!pdev) @@ -2500,15 +2496,13 @@ static int skystar2_probe(struct pci_dev *pdev, const struct pci_device_id *ent) goto err_halt; } - adapter = (struct adapter *) pci_get_drvdata(pdev); + adapter = pci_get_drvdata(pdev); dvb_adapter->priv = adapter; adapter->dvb_adapter = dvb_adapter; - init_MUTEX(&adapter->i2c_sem); - memset(&adapter->i2c_adap, 0, sizeof(struct i2c_adapter)); strcpy(adapter->i2c_adap.name, "SkyStar2"); @@ -2529,7 +2523,7 @@ static int skystar2_probe(struct pci_dev *pdev, const struct pci_device_id *ent) dvbdemux = &adapter->demux; - dvbdemux->priv = (void *) adapter; + dvbdemux->priv = adapter; dvbdemux->filternum = N_PID_SLOTS; dvbdemux->feednum = N_PID_SLOTS; dvbdemux->start_feed = dvb_start_feed; @@ -2541,27 +2535,28 @@ static int skystar2_probe(struct pci_dev *pdev, const struct pci_device_id *ent) if (ret < 0) goto err_i2c_del; - adapter->hw_frontend.source = DMX_FRONTEND_0; + dmx = &dvbdemux->dmx; + adapter->hw_frontend.source = DMX_FRONTEND_0; adapter->dmxdev.filternum = N_PID_SLOTS; - adapter->dmxdev.demux = &dvbdemux->dmx; + adapter->dmxdev.demux = dmx; adapter->dmxdev.capabilities = 0; ret = dvb_dmxdev_init(&adapter->dmxdev, adapter->dvb_adapter); if (ret < 0) goto err_dmx_release; - ret = dvbdemux->dmx.add_frontend(&dvbdemux->dmx, &adapter->hw_frontend); + ret = dmx->add_frontend(dmx, &adapter->hw_frontend); if (ret < 0) goto err_dmxdev_release; adapter->mem_frontend.source = DMX_MEMORY_FE; - ret = dvbdemux->dmx.add_frontend(&dvbdemux->dmx, &adapter->mem_frontend); + ret = dmx->add_frontend(dmx, &adapter->mem_frontend); if (ret < 0) goto err_remove_hw_frontend; - ret = dvbdemux->dmx.connect_frontend(&dvbdemux->dmx, &adapter->hw_frontend); + ret = dmx->connect_frontend(dmx, &adapter->hw_frontend); if (ret < 0) goto err_remove_mem_frontend; @@ -2590,34 +2585,32 @@ err_halt: static void skystar2_remove(struct pci_dev *pdev) { - struct adapter *adapter; + struct adapter *adapter = pci_get_drvdata(pdev); struct dvb_demux *dvbdemux; + struct dmx_demux *dmx; - if (pdev == NULL) + if (!adapter) return; - adapter = pci_get_drvdata(pdev); - - if (adapter != NULL) { - dvb_net_release(&adapter->dvbnet); - dvbdemux = &adapter->demux; + dvb_net_release(&adapter->dvbnet); + dvbdemux = &adapter->demux; + dmx = &dvbdemux->dmx; - dvbdemux->dmx.close(&dvbdemux->dmx); - dvbdemux->dmx.remove_frontend(&dvbdemux->dmx, &adapter->hw_frontend); - dvbdemux->dmx.remove_frontend(&dvbdemux->dmx, &adapter->mem_frontend); + dmx->close(dmx); + dmx->remove_frontend(dmx, &adapter->hw_frontend); + dmx->remove_frontend(dmx, &adapter->mem_frontend); - dvb_dmxdev_release(&adapter->dmxdev); - dvb_dmx_release(&adapter->demux); + dvb_dmxdev_release(&adapter->dmxdev); + dvb_dmx_release(dvbdemux); - if (adapter->fe != NULL) - dvb_unregister_frontend(adapter->fe); + if (adapter->fe != NULL) + dvb_unregister_frontend(adapter->fe); - dvb_unregister_adapter(adapter->dvb_adapter); + dvb_unregister_adapter(adapter->dvb_adapter); - i2c_del_adapter(&adapter->i2c_adap); + i2c_del_adapter(&adapter->i2c_adap); - driver_halt(pdev); - } + driver_halt(pdev); } static struct pci_device_id skystar2_pci_tbl[] = { |