summaryrefslogtreecommitdiff
path: root/linux/drivers/media
diff options
context:
space:
mode:
Diffstat (limited to 'linux/drivers/media')
-rw-r--r--linux/drivers/media/dvb/pluto2/pluto2.c28
1 files changed, 18 insertions, 10 deletions
diff --git a/linux/drivers/media/dvb/pluto2/pluto2.c b/linux/drivers/media/dvb/pluto2/pluto2.c
index 35636dfe0..5deb9f996 100644
--- a/linux/drivers/media/dvb/pluto2/pluto2.c
+++ b/linux/drivers/media/dvb/pluto2/pluto2.c
@@ -98,7 +98,7 @@ struct pluto {
struct dmx_frontend hw_frontend;
struct dmx_frontend mem_frontend;
struct dmxdev dmxdev;
- struct dvb_adapter *dvb_adapter;
+ struct dvb_adapter dvb_adapter;
struct dvb_demux demux;
struct dvb_frontend *fe;
struct dvb_net dvbnet;
@@ -117,6 +117,16 @@ struct pluto {
u8 dma_buf[TS_DMA_BYTES];
};
+static inline struct pluto *feed_to_pluto(struct dvb_demux_feed *feed)
+{
+ return container_of(feed->demux, struct pluto, demux);
+}
+
+static inline struct pluto *frontend_to_pluto(struct dvb_frontend *fe)
+{
+ return container_of(fe->dvb, struct pluto, dvb_adapter);
+}
+
static inline u32 pluto_readreg(struct pluto *pluto, u32 reg)
{
return readl(&pluto->io_mem[reg]);
@@ -228,7 +238,7 @@ static void pluto_dma_unmap(struct pluto *pluto)
static int pluto_start_feed(struct dvb_demux_feed *f)
{
- struct pluto *pluto = f->demux->priv;
+ struct pluto *pluto = feed_to_pluto(f);
if ((f->pid < 0x2000) && (f->index < NHWFILTERS))
pluto_rw(pluto, REG_PIDn(f->index), PIDn_ENP | PIDn_PID, PIDn_ENP | f->pid);
@@ -240,7 +250,7 @@ static int pluto_start_feed(struct dvb_demux_feed *f)
static int pluto_stop_feed(struct dvb_demux_feed *f)
{
- struct pluto *pluto = f->demux->priv;
+ struct pluto *pluto = feed_to_pluto(f);
if ((f->pid < 0x2000) && (f->index < NHWFILTERS))
pluto_rw(pluto, REG_PIDn(f->index), PIDn_ENP | PIDn_PID, 0x1fff);
@@ -412,7 +422,7 @@ static inline u32 divide(u32 numerator, u32 denominator)
static int lg_tdtpe001p_pll_set(struct dvb_frontend *fe,
struct dvb_frontend_parameters *p)
{
- struct pluto *pluto = fe->dvb->priv;
+ struct pluto *pluto = frontend_to_pluto(fe);
struct i2c_msg msg;
int ret;
u8 buf[4];
@@ -470,7 +480,7 @@ static int lg_tdtpe001p_pll_set(struct dvb_frontend *fe,
static int pluto2_request_firmware(struct dvb_frontend *fe,
const struct firmware **fw, char *name)
{
- struct pluto *pluto = fe->dvb->priv;
+ struct pluto *pluto = frontend_to_pluto(fe);
return request_firmware(fw, name, &pluto->pdev->dev);
}
@@ -492,7 +502,7 @@ static int __devinit frontend_init(struct pluto *pluto)
return -ENODEV;
}
- ret = dvb_register_frontend(pluto->dvb_adapter, pluto->fe);
+ ret = dvb_register_frontend(&pluto->dvb_adapter, pluto->fe);
if (ret < 0) {
if (pluto->fe->ops->release)
pluto->fe->ops->release(pluto->fe);
@@ -602,14 +612,12 @@ static int __devinit pluto2_probe(struct pci_dev *pdev,
if (ret < 0)
goto err_i2c_del_adapter;
- dvb_adapter = pluto->dvb_adapter;
- dvb_adapter->priv = pluto;
+ dvb_adapter = &pluto->dvb_adapter;
pluto_read_rev(pluto);
pluto_read_mac(pluto, dvb_adapter->proposed_mac);
dvbdemux = &pluto->demux;
- dvbdemux->priv = pluto;
dvbdemux->filternum = 256;
dvbdemux->feednum = 256;
dvbdemux->start_feed = pluto_start_feed;
@@ -684,7 +692,7 @@ err_kfree:
static void __devexit pluto2_remove(struct pci_dev *pdev)
{
struct pluto *pluto = pci_get_drvdata(pdev);
- struct dvb_adapter *dvb_adapter = pluto->dvb_adapter;
+ struct dvb_adapter *dvb_adapter = &pluto->dvb_adapter;
struct dvb_demux *dvbdemux = &pluto->demux;
struct dmx_demux *dmx = &dvbdemux->dmx;