aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/media/common/saa7146_core.c2
-rw-r--r--drivers/media/common/saa7146_i2c.c5
-rw-r--r--include/media/saa7146.h5
3 files changed, 9 insertions, 3 deletions
diff --git a/drivers/media/common/saa7146_core.c b/drivers/media/common/saa7146_core.c
index 961ad16e1d6f..a123844eb656 100644
--- a/drivers/media/common/saa7146_core.c
+++ b/drivers/media/common/saa7146_core.c
@@ -516,7 +516,7 @@ err_free:
516static void saa7146_remove_one(struct pci_dev *pdev) 516static void saa7146_remove_one(struct pci_dev *pdev)
517{ 517{
518 struct v4l2_device *v4l2_dev = pci_get_drvdata(pdev); 518 struct v4l2_device *v4l2_dev = pci_get_drvdata(pdev);
519 struct saa7146_dev *dev = container_of(v4l2_dev, struct saa7146_dev, v4l2_dev); 519 struct saa7146_dev *dev = to_saa7146_dev(v4l2_dev);
520 struct { 520 struct {
521 void *addr; 521 void *addr;
522 dma_addr_t dma; 522 dma_addr_t dma;
diff --git a/drivers/media/common/saa7146_i2c.c b/drivers/media/common/saa7146_i2c.c
index c11da4d09cd0..1b64074a92da 100644
--- a/drivers/media/common/saa7146_i2c.c
+++ b/drivers/media/common/saa7146_i2c.c
@@ -390,7 +390,8 @@ out:
390/* utility functions */ 390/* utility functions */
391static int saa7146_i2c_xfer(struct i2c_adapter* adapter, struct i2c_msg *msg, int num) 391static int saa7146_i2c_xfer(struct i2c_adapter* adapter, struct i2c_msg *msg, int num)
392{ 392{
393 struct saa7146_dev* dev = i2c_get_adapdata(adapter); 393 struct v4l2_device *v4l2_dev = i2c_get_adapdata(adapter);
394 struct saa7146_dev *dev = to_saa7146_dev(v4l2_dev);
394 395
395 /* use helper function to transfer data */ 396 /* use helper function to transfer data */
396 return saa7146_i2c_transfer(dev, msg, num, adapter->retries); 397 return saa7146_i2c_transfer(dev, msg, num, adapter->retries);
@@ -419,7 +420,7 @@ int saa7146_i2c_adapter_prepare(struct saa7146_dev *dev, struct i2c_adapter *i2c
419 420
420 if( NULL != i2c_adapter ) { 421 if( NULL != i2c_adapter ) {
421 BUG_ON(!i2c_adapter->class); 422 BUG_ON(!i2c_adapter->class);
422 i2c_set_adapdata(i2c_adapter,dev); 423 i2c_set_adapdata(i2c_adapter, &dev->v4l2_dev);
423 i2c_adapter->dev.parent = &dev->pci->dev; 424 i2c_adapter->dev.parent = &dev->pci->dev;
424 i2c_adapter->algo = &saa7146_algo; 425 i2c_adapter->algo = &saa7146_algo;
425 i2c_adapter->algo_data = NULL; 426 i2c_adapter->algo_data = NULL;
diff --git a/include/media/saa7146.h b/include/media/saa7146.h
index b9dfeeb26fae..fff4235adae5 100644
--- a/include/media/saa7146.h
+++ b/include/media/saa7146.h
@@ -148,6 +148,11 @@ struct saa7146_dev
148 struct saa7146_dma d_rps1; 148 struct saa7146_dma d_rps1;
149}; 149};
150 150
151static inline struct saa7146_dev *to_saa7146_dev(struct v4l2_device *v4l2_dev)
152{
153 return container_of(v4l2_dev, struct saa7146_dev, v4l2_dev);
154}
155
151/* from saa7146_i2c.c */ 156/* from saa7146_i2c.c */
152int saa7146_i2c_adapter_prepare(struct saa7146_dev *dev, struct i2c_adapter *i2c_adapter, u32 bitrate); 157int saa7146_i2c_adapter_prepare(struct saa7146_dev *dev, struct i2c_adapter *i2c_adapter, u32 bitrate);
153 158