diff options
author | Guennadi Liakhovetski <g.liakhovetski@gmx.de> | 2011-12-05 14:01:13 -0500 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2011-12-11 06:34:00 -0500 |
commit | 4c0b036db808054f10f79e9a3d7928cf90aeb186 (patch) | |
tree | 2b3021d604eb1eb31b70f589bc165ba229bb522b | |
parent | a626f3945208af1d60d3dccf064cac3b15bc54ca (diff) |
[media] V4L: soc-camera: fix compiler warnings on 64-bit platforms
On 64-bit platforms assigning a pointer to a 32-bit variable causes a
compiler warning and cannot actually work. Soc-camera currently doesn't
support any 64-bit systems, but such platforms can be added in the
and in any case compiler warnings should be avoided.
Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Acked-by: Janusz Krzysztofik <jkrzyszt@tis.icnet.pl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
-rw-r--r-- | drivers/media/video/ov6650.c | 2 | ||||
-rw-r--r-- | drivers/media/video/sh_mobile_ceu_camera.c | 34 | ||||
-rw-r--r-- | drivers/media/video/sh_mobile_csi2.c | 4 | ||||
-rw-r--r-- | drivers/media/video/soc_camera.c | 3 | ||||
-rw-r--r-- | include/media/soc_camera.h | 7 |
5 files changed, 32 insertions, 18 deletions
diff --git a/drivers/media/video/ov6650.c b/drivers/media/video/ov6650.c index d5b057207a7b..577941fa3831 100644 --- a/drivers/media/video/ov6650.c +++ b/drivers/media/video/ov6650.c | |||
@@ -539,7 +539,7 @@ static u8 to_clkrc(struct v4l2_fract *timeperframe, | |||
539 | static int ov6650_s_fmt(struct v4l2_subdev *sd, struct v4l2_mbus_framefmt *mf) | 539 | static int ov6650_s_fmt(struct v4l2_subdev *sd, struct v4l2_mbus_framefmt *mf) |
540 | { | 540 | { |
541 | struct i2c_client *client = v4l2_get_subdevdata(sd); | 541 | struct i2c_client *client = v4l2_get_subdevdata(sd); |
542 | struct soc_camera_device *icd = (struct soc_camera_device *)sd->grp_id; | 542 | struct soc_camera_device *icd = v4l2_get_subdev_hostdata(sd); |
543 | struct soc_camera_sense *sense = icd->sense; | 543 | struct soc_camera_sense *sense = icd->sense; |
544 | struct ov6650 *priv = to_ov6650(client); | 544 | struct ov6650 *priv = to_ov6650(client); |
545 | bool half_scale = !is_unscaled_ok(mf->width, mf->height, &priv->rect); | 545 | bool half_scale = !is_unscaled_ok(mf->width, mf->height, &priv->rect); |
diff --git a/drivers/media/video/sh_mobile_ceu_camera.c b/drivers/media/video/sh_mobile_ceu_camera.c index f390682629cf..c51decfcae19 100644 --- a/drivers/media/video/sh_mobile_ceu_camera.c +++ b/drivers/media/video/sh_mobile_ceu_camera.c | |||
@@ -566,8 +566,10 @@ static int sh_mobile_ceu_add_device(struct soc_camera_device *icd) | |||
566 | ret = sh_mobile_ceu_soft_reset(pcdev); | 566 | ret = sh_mobile_ceu_soft_reset(pcdev); |
567 | 567 | ||
568 | csi2_sd = find_csi2(pcdev); | 568 | csi2_sd = find_csi2(pcdev); |
569 | if (csi2_sd) | 569 | if (csi2_sd) { |
570 | csi2_sd->grp_id = (long)icd; | 570 | csi2_sd->grp_id = soc_camera_grp_id(icd); |
571 | v4l2_set_subdev_hostdata(csi2_sd, icd); | ||
572 | } | ||
571 | 573 | ||
572 | ret = v4l2_subdev_call(csi2_sd, core, s_power, 1); | 574 | ret = v4l2_subdev_call(csi2_sd, core, s_power, 1); |
573 | if (ret < 0 && ret != -ENOIOCTLCMD && ret != -ENODEV) { | 575 | if (ret < 0 && ret != -ENOIOCTLCMD && ret != -ENODEV) { |
@@ -768,7 +770,7 @@ static struct v4l2_subdev *find_bus_subdev(struct sh_mobile_ceu_dev *pcdev, | |||
768 | { | 770 | { |
769 | if (pcdev->csi2_pdev) { | 771 | if (pcdev->csi2_pdev) { |
770 | struct v4l2_subdev *csi2_sd = find_csi2(pcdev); | 772 | struct v4l2_subdev *csi2_sd = find_csi2(pcdev); |
771 | if (csi2_sd && csi2_sd->grp_id == (u32)icd) | 773 | if (csi2_sd && csi2_sd->grp_id == soc_camera_grp_id(icd)) |
772 | return csi2_sd; | 774 | return csi2_sd; |
773 | } | 775 | } |
774 | 776 | ||
@@ -1089,8 +1091,9 @@ static int sh_mobile_ceu_get_formats(struct soc_camera_device *icd, unsigned int | |||
1089 | /* Try 2560x1920, 1280x960, 640x480, 320x240 */ | 1091 | /* Try 2560x1920, 1280x960, 640x480, 320x240 */ |
1090 | mf.width = 2560 >> shift; | 1092 | mf.width = 2560 >> shift; |
1091 | mf.height = 1920 >> shift; | 1093 | mf.height = 1920 >> shift; |
1092 | ret = v4l2_device_call_until_err(sd->v4l2_dev, (long)icd, video, | 1094 | ret = v4l2_device_call_until_err(sd->v4l2_dev, |
1093 | s_mbus_fmt, &mf); | 1095 | soc_camera_grp_id(icd), video, |
1096 | s_mbus_fmt, &mf); | ||
1094 | if (ret < 0) | 1097 | if (ret < 0) |
1095 | return ret; | 1098 | return ret; |
1096 | shift++; | 1099 | shift++; |
@@ -1389,7 +1392,8 @@ static int client_s_fmt(struct soc_camera_device *icd, | |||
1389 | bool ceu_1to1; | 1392 | bool ceu_1to1; |
1390 | int ret; | 1393 | int ret; |
1391 | 1394 | ||
1392 | ret = v4l2_device_call_until_err(sd->v4l2_dev, (long)icd, video, | 1395 | ret = v4l2_device_call_until_err(sd->v4l2_dev, |
1396 | soc_camera_grp_id(icd), video, | ||
1393 | s_mbus_fmt, mf); | 1397 | s_mbus_fmt, mf); |
1394 | if (ret < 0) | 1398 | if (ret < 0) |
1395 | return ret; | 1399 | return ret; |
@@ -1426,8 +1430,9 @@ static int client_s_fmt(struct soc_camera_device *icd, | |||
1426 | tmp_h = min(2 * tmp_h, max_height); | 1430 | tmp_h = min(2 * tmp_h, max_height); |
1427 | mf->width = tmp_w; | 1431 | mf->width = tmp_w; |
1428 | mf->height = tmp_h; | 1432 | mf->height = tmp_h; |
1429 | ret = v4l2_device_call_until_err(sd->v4l2_dev, (long)icd, video, | 1433 | ret = v4l2_device_call_until_err(sd->v4l2_dev, |
1430 | s_mbus_fmt, mf); | 1434 | soc_camera_grp_id(icd), video, |
1435 | s_mbus_fmt, mf); | ||
1431 | dev_geo(dev, "Camera scaled to %ux%u\n", | 1436 | dev_geo(dev, "Camera scaled to %ux%u\n", |
1432 | mf->width, mf->height); | 1437 | mf->width, mf->height); |
1433 | if (ret < 0) { | 1438 | if (ret < 0) { |
@@ -1580,8 +1585,9 @@ static int sh_mobile_ceu_set_crop(struct soc_camera_device *icd, | |||
1580 | } | 1585 | } |
1581 | 1586 | ||
1582 | if (interm_width < icd->user_width || interm_height < icd->user_height) { | 1587 | if (interm_width < icd->user_width || interm_height < icd->user_height) { |
1583 | ret = v4l2_device_call_until_err(sd->v4l2_dev, (int)icd, video, | 1588 | ret = v4l2_device_call_until_err(sd->v4l2_dev, |
1584 | s_mbus_fmt, &mf); | 1589 | soc_camera_grp_id(icd), video, |
1590 | s_mbus_fmt, &mf); | ||
1585 | if (ret < 0) | 1591 | if (ret < 0) |
1586 | return ret; | 1592 | return ret; |
1587 | 1593 | ||
@@ -1867,7 +1873,8 @@ static int sh_mobile_ceu_try_fmt(struct soc_camera_device *icd, | |||
1867 | mf.code = xlate->code; | 1873 | mf.code = xlate->code; |
1868 | mf.colorspace = pix->colorspace; | 1874 | mf.colorspace = pix->colorspace; |
1869 | 1875 | ||
1870 | ret = v4l2_device_call_until_err(sd->v4l2_dev, (long)icd, video, try_mbus_fmt, &mf); | 1876 | ret = v4l2_device_call_until_err(sd->v4l2_dev, soc_camera_grp_id(icd), |
1877 | video, try_mbus_fmt, &mf); | ||
1871 | if (ret < 0) | 1878 | if (ret < 0) |
1872 | return ret; | 1879 | return ret; |
1873 | 1880 | ||
@@ -1891,8 +1898,9 @@ static int sh_mobile_ceu_try_fmt(struct soc_camera_device *icd, | |||
1891 | */ | 1898 | */ |
1892 | mf.width = 2560; | 1899 | mf.width = 2560; |
1893 | mf.height = 1920; | 1900 | mf.height = 1920; |
1894 | ret = v4l2_device_call_until_err(sd->v4l2_dev, (long)icd, video, | 1901 | ret = v4l2_device_call_until_err(sd->v4l2_dev, |
1895 | try_mbus_fmt, &mf); | 1902 | soc_camera_grp_id(icd), video, |
1903 | try_mbus_fmt, &mf); | ||
1896 | if (ret < 0) { | 1904 | if (ret < 0) { |
1897 | /* Shouldn't actually happen... */ | 1905 | /* Shouldn't actually happen... */ |
1898 | dev_err(icd->parent, | 1906 | dev_err(icd->parent, |
diff --git a/drivers/media/video/sh_mobile_csi2.c b/drivers/media/video/sh_mobile_csi2.c index 37706eb81f25..bd0ca0e04460 100644 --- a/drivers/media/video/sh_mobile_csi2.c +++ b/drivers/media/video/sh_mobile_csi2.c | |||
@@ -142,7 +142,7 @@ static int sh_csi2_s_mbus_config(struct v4l2_subdev *sd, | |||
142 | const struct v4l2_mbus_config *cfg) | 142 | const struct v4l2_mbus_config *cfg) |
143 | { | 143 | { |
144 | struct sh_csi2 *priv = container_of(sd, struct sh_csi2, subdev); | 144 | struct sh_csi2 *priv = container_of(sd, struct sh_csi2, subdev); |
145 | struct soc_camera_device *icd = (struct soc_camera_device *)sd->grp_id; | 145 | struct soc_camera_device *icd = v4l2_get_subdev_hostdata(sd); |
146 | struct v4l2_subdev *client_sd = soc_camera_to_subdev(icd); | 146 | struct v4l2_subdev *client_sd = soc_camera_to_subdev(icd); |
147 | struct v4l2_mbus_config client_cfg = {.type = V4L2_MBUS_CSI2, | 147 | struct v4l2_mbus_config client_cfg = {.type = V4L2_MBUS_CSI2, |
148 | .flags = priv->mipi_flags}; | 148 | .flags = priv->mipi_flags}; |
@@ -201,7 +201,7 @@ static void sh_csi2_hwinit(struct sh_csi2 *priv) | |||
201 | static int sh_csi2_client_connect(struct sh_csi2 *priv) | 201 | static int sh_csi2_client_connect(struct sh_csi2 *priv) |
202 | { | 202 | { |
203 | struct sh_csi2_pdata *pdata = priv->pdev->dev.platform_data; | 203 | struct sh_csi2_pdata *pdata = priv->pdev->dev.platform_data; |
204 | struct soc_camera_device *icd = (struct soc_camera_device *)priv->subdev.grp_id; | 204 | struct soc_camera_device *icd = v4l2_get_subdev_hostdata(&priv->subdev); |
205 | struct v4l2_subdev *client_sd = soc_camera_to_subdev(icd); | 205 | struct v4l2_subdev *client_sd = soc_camera_to_subdev(icd); |
206 | struct device *dev = v4l2_get_subdevdata(&priv->subdev); | 206 | struct device *dev = v4l2_get_subdevdata(&priv->subdev); |
207 | struct v4l2_mbus_config cfg; | 207 | struct v4l2_mbus_config cfg; |
diff --git a/drivers/media/video/soc_camera.c b/drivers/media/video/soc_camera.c index b72580c38957..62e4312515cb 100644 --- a/drivers/media/video/soc_camera.c +++ b/drivers/media/video/soc_camera.c | |||
@@ -1103,7 +1103,8 @@ static int soc_camera_probe(struct soc_camera_device *icd) | |||
1103 | } | 1103 | } |
1104 | 1104 | ||
1105 | sd = soc_camera_to_subdev(icd); | 1105 | sd = soc_camera_to_subdev(icd); |
1106 | sd->grp_id = (long)icd; | 1106 | sd->grp_id = soc_camera_grp_id(icd); |
1107 | v4l2_set_subdev_hostdata(sd, icd); | ||
1107 | 1108 | ||
1108 | if (v4l2_ctrl_add_handler(&icd->ctrl_handler, sd->ctrl_handler)) | 1109 | if (v4l2_ctrl_add_handler(&icd->ctrl_handler, sd->ctrl_handler)) |
1109 | goto ectrl; | 1110 | goto ectrl; |
diff --git a/include/media/soc_camera.h b/include/media/soc_camera.h index b1377b931eb7..5fb2c3d10c05 100644 --- a/include/media/soc_camera.h +++ b/include/media/soc_camera.h | |||
@@ -254,7 +254,7 @@ unsigned long soc_camera_apply_board_flags(struct soc_camera_link *icl, | |||
254 | static inline struct video_device *soc_camera_i2c_to_vdev(const struct i2c_client *client) | 254 | static inline struct video_device *soc_camera_i2c_to_vdev(const struct i2c_client *client) |
255 | { | 255 | { |
256 | struct v4l2_subdev *sd = i2c_get_clientdata(client); | 256 | struct v4l2_subdev *sd = i2c_get_clientdata(client); |
257 | struct soc_camera_device *icd = (struct soc_camera_device *)sd->grp_id; | 257 | struct soc_camera_device *icd = v4l2_get_subdev_hostdata(sd); |
258 | return icd ? icd->vdev : NULL; | 258 | return icd ? icd->vdev : NULL; |
259 | } | 259 | } |
260 | 260 | ||
@@ -279,6 +279,11 @@ static inline struct soc_camera_device *soc_camera_from_vbq(const struct videobu | |||
279 | return container_of(vq, struct soc_camera_device, vb_vidq); | 279 | return container_of(vq, struct soc_camera_device, vb_vidq); |
280 | } | 280 | } |
281 | 281 | ||
282 | static inline u32 soc_camera_grp_id(const struct soc_camera_device *icd) | ||
283 | { | ||
284 | return (icd->iface << 8) | (icd->devnum + 1); | ||
285 | } | ||
286 | |||
282 | void soc_camera_lock(struct vb2_queue *vq); | 287 | void soc_camera_lock(struct vb2_queue *vq); |
283 | void soc_camera_unlock(struct vb2_queue *vq); | 288 | void soc_camera_unlock(struct vb2_queue *vq); |
284 | 289 | ||