diff options
author | Guennadi Liakhovetski <g.liakhovetski@gmx.de> | 2011-09-21 14:16:30 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2011-11-03 16:28:58 -0400 |
commit | 14178aa57ce6ac4f05b4df8ea9e010486ce83a76 (patch) | |
tree | 992b8ae46ddad4f16c0d5d7b8fa3ab2a84b4e50e /drivers/media/video/ov772x.c | |
parent | 09362ec25c3f42d00a4008d0622bfbca68e540f5 (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/ov772x.c')
-rw-r--r-- | drivers/media/video/ov772x.c | 31 |
1 files changed, 10 insertions, 21 deletions
diff --git a/drivers/media/video/ov772x.c b/drivers/media/video/ov772x.c index 9b540421e2cb..a2146c30771e 100644 --- a/drivers/media/video/ov772x.c +++ b/drivers/media/video/ov772x.c | |||
@@ -953,17 +953,12 @@ static int ov772x_try_fmt(struct v4l2_subdev *sd, | |||
953 | return 0; | 953 | return 0; |
954 | } | 954 | } |
955 | 955 | ||
956 | static int ov772x_video_probe(struct soc_camera_device *icd, | 956 | static int ov772x_video_probe(struct i2c_client *client) |
957 | struct i2c_client *client) | ||
958 | { | 957 | { |
959 | struct ov772x_priv *priv = to_ov772x(client); | 958 | struct ov772x_priv *priv = to_ov772x(client); |
960 | u8 pid, ver; | 959 | u8 pid, ver; |
961 | const char *devname; | 960 | const char *devname; |
962 | 961 | ||
963 | /* We must have a parent by now. And it cannot be a wrong one. */ | ||
964 | BUG_ON(!icd->parent || | ||
965 | to_soc_camera_host(icd->parent)->nr != icd->iface); | ||
966 | |||
967 | /* | 962 | /* |
968 | * check and show product ID and manufacturer ID | 963 | * check and show product ID and manufacturer ID |
969 | */ | 964 | */ |
@@ -1021,8 +1016,7 @@ static int ov772x_g_mbus_config(struct v4l2_subdev *sd, | |||
1021 | struct v4l2_mbus_config *cfg) | 1016 | struct v4l2_mbus_config *cfg) |
1022 | { | 1017 | { |
1023 | struct i2c_client *client = v4l2_get_subdevdata(sd); | 1018 | struct i2c_client *client = v4l2_get_subdevdata(sd); |
1024 | struct soc_camera_device *icd = client->dev.platform_data; | 1019 | struct soc_camera_link *icl = soc_camera_i2c_to_link(client); |
1025 | struct soc_camera_link *icl = to_soc_camera_link(icd); | ||
1026 | 1020 | ||
1027 | cfg->flags = V4L2_MBUS_PCLK_SAMPLE_RISING | V4L2_MBUS_MASTER | | 1021 | cfg->flags = V4L2_MBUS_PCLK_SAMPLE_RISING | V4L2_MBUS_MASTER | |
1028 | V4L2_MBUS_VSYNC_ACTIVE_HIGH | V4L2_MBUS_HSYNC_ACTIVE_HIGH | | 1022 | V4L2_MBUS_VSYNC_ACTIVE_HIGH | V4L2_MBUS_HSYNC_ACTIVE_HIGH | |
@@ -1056,20 +1050,15 @@ static struct v4l2_subdev_ops ov772x_subdev_ops = { | |||
1056 | static int ov772x_probe(struct i2c_client *client, | 1050 | static int ov772x_probe(struct i2c_client *client, |
1057 | const struct i2c_device_id *did) | 1051 | const struct i2c_device_id *did) |
1058 | { | 1052 | { |
1059 | struct ov772x_priv *priv; | 1053 | struct ov772x_priv *priv; |
1060 | struct soc_camera_device *icd = client->dev.platform_data; | 1054 | struct soc_camera_link *icl = soc_camera_i2c_to_link(client); |
1061 | struct i2c_adapter *adapter = to_i2c_adapter(client->dev.parent); | 1055 | struct i2c_adapter *adapter = to_i2c_adapter(client->dev.parent); |
1062 | struct soc_camera_link *icl; | 1056 | int ret; |
1063 | int ret; | ||
1064 | |||
1065 | if (!icd) { | ||
1066 | dev_err(&client->dev, "OV772X: missing soc-camera data!\n"); | ||
1067 | return -EINVAL; | ||
1068 | } | ||
1069 | 1057 | ||
1070 | icl = to_soc_camera_link(icd); | 1058 | if (!icl || !icl->priv) { |
1071 | if (!icl || !icl->priv) | 1059 | dev_err(&client->dev, "OV772X: missing platform data!\n"); |
1072 | return -EINVAL; | 1060 | return -EINVAL; |
1061 | } | ||
1073 | 1062 | ||
1074 | if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA)) { | 1063 | if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA)) { |
1075 | dev_err(&adapter->dev, | 1064 | dev_err(&adapter->dev, |
@@ -1100,7 +1089,7 @@ static int ov772x_probe(struct i2c_client *client, | |||
1100 | return err; | 1089 | return err; |
1101 | } | 1090 | } |
1102 | 1091 | ||
1103 | ret = ov772x_video_probe(icd, client); | 1092 | ret = ov772x_video_probe(client); |
1104 | if (ret) { | 1093 | if (ret) { |
1105 | v4l2_ctrl_handler_free(&priv->hdl); | 1094 | v4l2_ctrl_handler_free(&priv->hdl); |
1106 | kfree(priv); | 1095 | kfree(priv); |