diff options
author | Guennadi Liakhovetski <g.liakhovetski@gmx.de> | 2013-06-10 14:07:35 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2013-06-21 15:28:36 -0400 |
commit | 668773b84604926519e2baf444f382f88d799d41 (patch) | |
tree | cd41634a511a1040e2fbe62fe9227a64ce009fb7 | |
parent | ff5430de70e8137daccecfa1211509f95fcc8d25 (diff) |
[media] V4L2: add a device pointer to struct v4l2_subdev
It is often useful to have simple means to get from a subdevice to the
underlying physical device. This patch adds such a pointer to struct
v4l2_subdev and sets it accordingly in the I2C and SPI cases.
Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Tested-by: Lad, Prabhakar <prabhakar.csengg@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
-rw-r--r-- | drivers/media/v4l2-core/v4l2-common.c | 2 | ||||
-rw-r--r-- | include/media/v4l2-subdev.h | 2 |
2 files changed, 4 insertions, 0 deletions
diff --git a/drivers/media/v4l2-core/v4l2-common.c b/drivers/media/v4l2-core/v4l2-common.c index 3b2a7606bc84..a95e5e23403f 100644 --- a/drivers/media/v4l2-core/v4l2-common.c +++ b/drivers/media/v4l2-core/v4l2-common.c | |||
@@ -237,6 +237,7 @@ void v4l2_i2c_subdev_init(struct v4l2_subdev *sd, struct i2c_client *client, | |||
237 | sd->flags |= V4L2_SUBDEV_FL_IS_I2C; | 237 | sd->flags |= V4L2_SUBDEV_FL_IS_I2C; |
238 | /* the owner is the same as the i2c_client's driver owner */ | 238 | /* the owner is the same as the i2c_client's driver owner */ |
239 | sd->owner = client->driver->driver.owner; | 239 | sd->owner = client->driver->driver.owner; |
240 | sd->dev = &client->dev; | ||
240 | /* i2c_client and v4l2_subdev point to one another */ | 241 | /* i2c_client and v4l2_subdev point to one another */ |
241 | v4l2_set_subdevdata(sd, client); | 242 | v4l2_set_subdevdata(sd, client); |
242 | i2c_set_clientdata(client, sd); | 243 | i2c_set_clientdata(client, sd); |
@@ -370,6 +371,7 @@ void v4l2_spi_subdev_init(struct v4l2_subdev *sd, struct spi_device *spi, | |||
370 | sd->flags |= V4L2_SUBDEV_FL_IS_SPI; | 371 | sd->flags |= V4L2_SUBDEV_FL_IS_SPI; |
371 | /* the owner is the same as the spi_device's driver owner */ | 372 | /* the owner is the same as the spi_device's driver owner */ |
372 | sd->owner = spi->dev.driver->owner; | 373 | sd->owner = spi->dev.driver->owner; |
374 | sd->dev = &spi->dev; | ||
373 | /* spi_device and v4l2_subdev point to one another */ | 375 | /* spi_device and v4l2_subdev point to one another */ |
374 | v4l2_set_subdevdata(sd, spi); | 376 | v4l2_set_subdevdata(sd, spi); |
375 | spi_set_drvdata(spi, sd); | 377 | spi_set_drvdata(spi, sd); |
diff --git a/include/media/v4l2-subdev.h b/include/media/v4l2-subdev.h index 21fc9e16d7be..5fbb266405f9 100644 --- a/include/media/v4l2-subdev.h +++ b/include/media/v4l2-subdev.h | |||
@@ -583,6 +583,8 @@ struct v4l2_subdev { | |||
583 | void *host_priv; | 583 | void *host_priv; |
584 | /* subdev device node */ | 584 | /* subdev device node */ |
585 | struct video_device *devnode; | 585 | struct video_device *devnode; |
586 | /* pointer to the physical device, if any */ | ||
587 | struct device *dev; | ||
586 | }; | 588 | }; |
587 | 589 | ||
588 | #define media_entity_to_v4l2_subdev(ent) \ | 590 | #define media_entity_to_v4l2_subdev(ent) \ |