aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/ov2640.c
diff options
context:
space:
mode:
authorGuennadi Liakhovetski <g.liakhovetski@gmx.de>2011-09-21 14:16:30 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2011-11-03 16:28:58 -0400
commit14178aa57ce6ac4f05b4df8ea9e010486ce83a76 (patch)
tree992b8ae46ddad4f16c0d5d7b8fa3ab2a84b4e50e /drivers/media/video/ov2640.c
parent09362ec25c3f42d00a4008d0622bfbca68e540f5 (diff)
[media] V4L: soc-camera: start removing struct soc_camera_device from client drivers
Remove most trivial uses of struct soc_camera_device from most client drivers, abstracting some of them inside inline functions. Next steps will eliminate remaining uses and modify inline functions to not use struct soc_camera_device. Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video/ov2640.c')
-rw-r--r--drivers/media/video/ov2640.c27
1 files changed, 7 insertions, 20 deletions
diff --git a/drivers/media/video/ov2640.c b/drivers/media/video/ov2640.c
index 981767f2d8ea..d37a5cceebb6 100644
--- a/drivers/media/video/ov2640.c
+++ b/drivers/media/video/ov2640.c
@@ -942,18 +942,13 @@ static int ov2640_cropcap(struct v4l2_subdev *sd, struct v4l2_cropcap *a)
942 return 0; 942 return 0;
943} 943}
944 944
945static int ov2640_video_probe(struct soc_camera_device *icd, 945static int ov2640_video_probe(struct i2c_client *client)
946 struct i2c_client *client)
947{ 946{
948 struct ov2640_priv *priv = to_ov2640(client); 947 struct ov2640_priv *priv = to_ov2640(client);
949 u8 pid, ver, midh, midl; 948 u8 pid, ver, midh, midl;
950 const char *devname; 949 const char *devname;
951 int ret; 950 int ret;
952 951
953 /* We must have a parent by now. And it cannot be a wrong one. */
954 BUG_ON(!icd->parent ||
955 to_soc_camera_host(icd->parent)->nr != icd->iface);
956
957 /* 952 /*
958 * check and show product ID and manufacturer ID 953 * check and show product ID and manufacturer ID
959 */ 954 */
@@ -1001,8 +996,7 @@ static int ov2640_g_mbus_config(struct v4l2_subdev *sd,
1001 struct v4l2_mbus_config *cfg) 996 struct v4l2_mbus_config *cfg)
1002{ 997{
1003 struct i2c_client *client = v4l2_get_subdevdata(sd); 998 struct i2c_client *client = v4l2_get_subdevdata(sd);
1004 struct soc_camera_device *icd = client->dev.platform_data; 999 struct soc_camera_link *icl = soc_camera_i2c_to_link(client);
1005 struct soc_camera_link *icl = to_soc_camera_link(icd);
1006 1000
1007 cfg->flags = V4L2_MBUS_PCLK_SAMPLE_RISING | V4L2_MBUS_MASTER | 1001 cfg->flags = V4L2_MBUS_PCLK_SAMPLE_RISING | V4L2_MBUS_MASTER |
1008 V4L2_MBUS_VSYNC_ACTIVE_HIGH | V4L2_MBUS_HSYNC_ACTIVE_HIGH | 1002 V4L2_MBUS_VSYNC_ACTIVE_HIGH | V4L2_MBUS_HSYNC_ACTIVE_HIGH |
@@ -1035,18 +1029,11 @@ static struct v4l2_subdev_ops ov2640_subdev_ops = {
1035static int ov2640_probe(struct i2c_client *client, 1029static int ov2640_probe(struct i2c_client *client,
1036 const struct i2c_device_id *did) 1030 const struct i2c_device_id *did)
1037{ 1031{
1038 struct ov2640_priv *priv; 1032 struct ov2640_priv *priv;
1039 struct soc_camera_device *icd = client->dev.platform_data; 1033 struct soc_camera_link *icl = soc_camera_i2c_to_link(client);
1040 struct i2c_adapter *adapter = to_i2c_adapter(client->dev.parent); 1034 struct i2c_adapter *adapter = to_i2c_adapter(client->dev.parent);
1041 struct soc_camera_link *icl; 1035 int ret;
1042 int ret;
1043
1044 if (!icd) {
1045 dev_err(&adapter->dev, "OV2640: missing soc-camera data!\n");
1046 return -EINVAL;
1047 }
1048 1036
1049 icl = to_soc_camera_link(icd);
1050 if (!icl) { 1037 if (!icl) {
1051 dev_err(&adapter->dev, 1038 dev_err(&adapter->dev,
1052 "OV2640: Missing platform_data for driver\n"); 1039 "OV2640: Missing platform_data for driver\n");
@@ -1080,7 +1067,7 @@ static int ov2640_probe(struct i2c_client *client,
1080 return err; 1067 return err;
1081 } 1068 }
1082 1069
1083 ret = ov2640_video_probe(icd, client); 1070 ret = ov2640_video_probe(client);
1084 if (ret) { 1071 if (ret) {
1085 v4l2_ctrl_handler_free(&priv->hdl); 1072 v4l2_ctrl_handler_free(&priv->hdl);
1086 kfree(priv); 1073 kfree(priv);