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/rj54n1cb0c.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/rj54n1cb0c.c')
-rw-r--r-- | drivers/media/video/rj54n1cb0c.c | 27 |
1 files changed, 6 insertions, 21 deletions
diff --git a/drivers/media/video/rj54n1cb0c.c b/drivers/media/video/rj54n1cb0c.c index 9a871537d233..fcb14d93a24c 100644 --- a/drivers/media/video/rj54n1cb0c.c +++ b/drivers/media/video/rj54n1cb0c.c | |||
@@ -1235,8 +1235,7 @@ static int rj54n1_g_mbus_config(struct v4l2_subdev *sd, | |||
1235 | struct v4l2_mbus_config *cfg) | 1235 | struct v4l2_mbus_config *cfg) |
1236 | { | 1236 | { |
1237 | struct i2c_client *client = v4l2_get_subdevdata(sd); | 1237 | struct i2c_client *client = v4l2_get_subdevdata(sd); |
1238 | struct soc_camera_device *icd = client->dev.platform_data; | 1238 | struct soc_camera_link *icl = soc_camera_i2c_to_link(client); |
1239 | struct soc_camera_link *icl = to_soc_camera_link(icd); | ||
1240 | 1239 | ||
1241 | cfg->flags = | 1240 | cfg->flags = |
1242 | V4L2_MBUS_PCLK_SAMPLE_RISING | V4L2_MBUS_PCLK_SAMPLE_FALLING | | 1241 | V4L2_MBUS_PCLK_SAMPLE_RISING | V4L2_MBUS_PCLK_SAMPLE_FALLING | |
@@ -1252,8 +1251,7 @@ static int rj54n1_s_mbus_config(struct v4l2_subdev *sd, | |||
1252 | const struct v4l2_mbus_config *cfg) | 1251 | const struct v4l2_mbus_config *cfg) |
1253 | { | 1252 | { |
1254 | struct i2c_client *client = v4l2_get_subdevdata(sd); | 1253 | struct i2c_client *client = v4l2_get_subdevdata(sd); |
1255 | struct soc_camera_device *icd = client->dev.platform_data; | 1254 | struct soc_camera_link *icl = soc_camera_i2c_to_link(client); |
1256 | struct soc_camera_link *icl = to_soc_camera_link(icd); | ||
1257 | 1255 | ||
1258 | /* Figures 2.5-1 to 2.5-3 - default falling pixclk edge */ | 1256 | /* Figures 2.5-1 to 2.5-3 - default falling pixclk edge */ |
1259 | if (soc_camera_apply_board_flags(icl, cfg) & | 1257 | if (soc_camera_apply_board_flags(icl, cfg) & |
@@ -1285,17 +1283,12 @@ static struct v4l2_subdev_ops rj54n1_subdev_ops = { | |||
1285 | * Interface active, can use i2c. If it fails, it can indeed mean, that | 1283 | * Interface active, can use i2c. If it fails, it can indeed mean, that |
1286 | * this wasn't our capture interface, so, we wait for the right one | 1284 | * this wasn't our capture interface, so, we wait for the right one |
1287 | */ | 1285 | */ |
1288 | static int rj54n1_video_probe(struct soc_camera_device *icd, | 1286 | static int rj54n1_video_probe(struct i2c_client *client, |
1289 | struct i2c_client *client, | ||
1290 | struct rj54n1_pdata *priv) | 1287 | struct rj54n1_pdata *priv) |
1291 | { | 1288 | { |
1292 | int data1, data2; | 1289 | int data1, data2; |
1293 | int ret; | 1290 | int ret; |
1294 | 1291 | ||
1295 | /* We must have a parent by now. And it cannot be a wrong one. */ | ||
1296 | BUG_ON(!icd->parent || | ||
1297 | to_soc_camera_host(icd->parent)->nr != icd->iface); | ||
1298 | |||
1299 | /* Read out the chip version register */ | 1292 | /* Read out the chip version register */ |
1300 | data1 = reg_read(client, RJ54N1_DEV_CODE); | 1293 | data1 = reg_read(client, RJ54N1_DEV_CODE); |
1301 | data2 = reg_read(client, RJ54N1_DEV_CODE2); | 1294 | data2 = reg_read(client, RJ54N1_DEV_CODE2); |
@@ -1323,18 +1316,11 @@ static int rj54n1_probe(struct i2c_client *client, | |||
1323 | const struct i2c_device_id *did) | 1316 | const struct i2c_device_id *did) |
1324 | { | 1317 | { |
1325 | struct rj54n1 *rj54n1; | 1318 | struct rj54n1 *rj54n1; |
1326 | struct soc_camera_device *icd = client->dev.platform_data; | 1319 | struct soc_camera_link *icl = soc_camera_i2c_to_link(client); |
1327 | struct i2c_adapter *adapter = to_i2c_adapter(client->dev.parent); | 1320 | struct i2c_adapter *adapter = to_i2c_adapter(client->dev.parent); |
1328 | struct soc_camera_link *icl; | ||
1329 | struct rj54n1_pdata *rj54n1_priv; | 1321 | struct rj54n1_pdata *rj54n1_priv; |
1330 | int ret; | 1322 | int ret; |
1331 | 1323 | ||
1332 | if (!icd) { | ||
1333 | dev_err(&client->dev, "RJ54N1CB0C: missing soc-camera data!\n"); | ||
1334 | return -EINVAL; | ||
1335 | } | ||
1336 | |||
1337 | icl = to_soc_camera_link(icd); | ||
1338 | if (!icl || !icl->priv) { | 1324 | if (!icl || !icl->priv) { |
1339 | dev_err(&client->dev, "RJ54N1CB0C: missing platform data!\n"); | 1325 | dev_err(&client->dev, "RJ54N1CB0C: missing platform data!\n"); |
1340 | return -EINVAL; | 1326 | return -EINVAL; |
@@ -1382,7 +1368,7 @@ static int rj54n1_probe(struct i2c_client *client, | |||
1382 | rj54n1->tgclk_mhz = (rj54n1_priv->mclk_freq / PLL_L * PLL_N) / | 1368 | rj54n1->tgclk_mhz = (rj54n1_priv->mclk_freq / PLL_L * PLL_N) / |
1383 | (clk_div.ratio_tg + 1) / (clk_div.ratio_t + 1); | 1369 | (clk_div.ratio_tg + 1) / (clk_div.ratio_t + 1); |
1384 | 1370 | ||
1385 | ret = rj54n1_video_probe(icd, client, rj54n1_priv); | 1371 | ret = rj54n1_video_probe(client, rj54n1_priv); |
1386 | if (ret < 0) { | 1372 | if (ret < 0) { |
1387 | v4l2_ctrl_handler_free(&rj54n1->hdl); | 1373 | v4l2_ctrl_handler_free(&rj54n1->hdl); |
1388 | kfree(rj54n1); | 1374 | kfree(rj54n1); |
@@ -1394,8 +1380,7 @@ static int rj54n1_probe(struct i2c_client *client, | |||
1394 | static int rj54n1_remove(struct i2c_client *client) | 1380 | static int rj54n1_remove(struct i2c_client *client) |
1395 | { | 1381 | { |
1396 | struct rj54n1 *rj54n1 = to_rj54n1(client); | 1382 | struct rj54n1 *rj54n1 = to_rj54n1(client); |
1397 | struct soc_camera_device *icd = client->dev.platform_data; | 1383 | struct soc_camera_link *icl = soc_camera_i2c_to_link(client); |
1398 | struct soc_camera_link *icl = to_soc_camera_link(icd); | ||
1399 | 1384 | ||
1400 | v4l2_device_unregister_subdev(&rj54n1->subdev); | 1385 | v4l2_device_unregister_subdev(&rj54n1->subdev); |
1401 | if (icl->free_bus) | 1386 | if (icl->free_bus) |