Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 4c0b036d authored by Guennadi Liakhovetski's avatar Guennadi Liakhovetski Committed by Mauro Carvalho Chehab
Browse files

[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: default avatarGuennadi Liakhovetski <g.liakhovetski@gmx.de>
Acked-by: default avatarJanusz Krzysztofik <jkrzyszt@tis.icnet.pl>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent a626f394
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -539,7 +539,7 @@ static u8 to_clkrc(struct v4l2_fract *timeperframe,
static int ov6650_s_fmt(struct v4l2_subdev *sd, struct v4l2_mbus_framefmt *mf)
{
	struct i2c_client *client = v4l2_get_subdevdata(sd);
	struct soc_camera_device *icd = (struct soc_camera_device *)sd->grp_id;
	struct soc_camera_device *icd = v4l2_get_subdev_hostdata(sd);
	struct soc_camera_sense *sense = icd->sense;
	struct ov6650 *priv = to_ov6650(client);
	bool half_scale = !is_unscaled_ok(mf->width, mf->height, &priv->rect);
+21 −13
Original line number Diff line number Diff line
@@ -566,8 +566,10 @@ static int sh_mobile_ceu_add_device(struct soc_camera_device *icd)
	ret = sh_mobile_ceu_soft_reset(pcdev);

	csi2_sd = find_csi2(pcdev);
	if (csi2_sd)
		csi2_sd->grp_id = (long)icd;
	if (csi2_sd) {
		csi2_sd->grp_id = soc_camera_grp_id(icd);
		v4l2_set_subdev_hostdata(csi2_sd, icd);
	}

	ret = v4l2_subdev_call(csi2_sd, core, s_power, 1);
	if (ret < 0 && ret != -ENOIOCTLCMD && ret != -ENODEV) {
@@ -768,7 +770,7 @@ static struct v4l2_subdev *find_bus_subdev(struct sh_mobile_ceu_dev *pcdev,
{
	if (pcdev->csi2_pdev) {
		struct v4l2_subdev *csi2_sd = find_csi2(pcdev);
		if (csi2_sd && csi2_sd->grp_id == (u32)icd)
		if (csi2_sd && csi2_sd->grp_id == soc_camera_grp_id(icd))
			return csi2_sd;
	}

@@ -1089,7 +1091,8 @@ static int sh_mobile_ceu_get_formats(struct soc_camera_device *icd, unsigned int
			/* Try 2560x1920, 1280x960, 640x480, 320x240 */
			mf.width	= 2560 >> shift;
			mf.height	= 1920 >> shift;
			ret = v4l2_device_call_until_err(sd->v4l2_dev, (long)icd, video,
			ret = v4l2_device_call_until_err(sd->v4l2_dev,
					soc_camera_grp_id(icd), video,
					s_mbus_fmt, &mf);
			if (ret < 0)
				return ret;
@@ -1389,7 +1392,8 @@ static int client_s_fmt(struct soc_camera_device *icd,
	bool ceu_1to1;
	int ret;

	ret = v4l2_device_call_until_err(sd->v4l2_dev, (long)icd, video,
	ret = v4l2_device_call_until_err(sd->v4l2_dev,
					 soc_camera_grp_id(icd), video,
					 s_mbus_fmt, mf);
	if (ret < 0)
		return ret;
@@ -1426,7 +1430,8 @@ static int client_s_fmt(struct soc_camera_device *icd,
		tmp_h = min(2 * tmp_h, max_height);
		mf->width = tmp_w;
		mf->height = tmp_h;
		ret = v4l2_device_call_until_err(sd->v4l2_dev, (long)icd, video,
		ret = v4l2_device_call_until_err(sd->v4l2_dev,
					soc_camera_grp_id(icd), video,
					s_mbus_fmt, mf);
		dev_geo(dev, "Camera scaled to %ux%u\n",
			mf->width, mf->height);
@@ -1580,7 +1585,8 @@ static int sh_mobile_ceu_set_crop(struct soc_camera_device *icd,
	}

	if (interm_width < icd->user_width || interm_height < icd->user_height) {
		ret = v4l2_device_call_until_err(sd->v4l2_dev, (int)icd, video,
		ret = v4l2_device_call_until_err(sd->v4l2_dev,
					soc_camera_grp_id(icd), video,
					s_mbus_fmt, &mf);
		if (ret < 0)
			return ret;
@@ -1867,7 +1873,8 @@ static int sh_mobile_ceu_try_fmt(struct soc_camera_device *icd,
	mf.code		= xlate->code;
	mf.colorspace	= pix->colorspace;

	ret = v4l2_device_call_until_err(sd->v4l2_dev, (long)icd, video, try_mbus_fmt, &mf);
	ret = v4l2_device_call_until_err(sd->v4l2_dev, soc_camera_grp_id(icd),
					 video, try_mbus_fmt, &mf);
	if (ret < 0)
		return ret;

@@ -1891,7 +1898,8 @@ static int sh_mobile_ceu_try_fmt(struct soc_camera_device *icd,
			 */
			mf.width = 2560;
			mf.height = 1920;
			ret = v4l2_device_call_until_err(sd->v4l2_dev, (long)icd, video,
			ret = v4l2_device_call_until_err(sd->v4l2_dev,
					soc_camera_grp_id(icd), video,
					try_mbus_fmt, &mf);
			if (ret < 0) {
				/* Shouldn't actually happen... */
+2 −2
Original line number Diff line number Diff line
@@ -142,7 +142,7 @@ static int sh_csi2_s_mbus_config(struct v4l2_subdev *sd,
				 const struct v4l2_mbus_config *cfg)
{
	struct sh_csi2 *priv = container_of(sd, struct sh_csi2, subdev);
	struct soc_camera_device *icd = (struct soc_camera_device *)sd->grp_id;
	struct soc_camera_device *icd = v4l2_get_subdev_hostdata(sd);
	struct v4l2_subdev *client_sd = soc_camera_to_subdev(icd);
	struct v4l2_mbus_config client_cfg = {.type = V4L2_MBUS_CSI2,
					      .flags = priv->mipi_flags};
@@ -201,7 +201,7 @@ static void sh_csi2_hwinit(struct sh_csi2 *priv)
static int sh_csi2_client_connect(struct sh_csi2 *priv)
{
	struct sh_csi2_pdata *pdata = priv->pdev->dev.platform_data;
	struct soc_camera_device *icd = (struct soc_camera_device *)priv->subdev.grp_id;
	struct soc_camera_device *icd = v4l2_get_subdev_hostdata(&priv->subdev);
	struct v4l2_subdev *client_sd = soc_camera_to_subdev(icd);
	struct device *dev = v4l2_get_subdevdata(&priv->subdev);
	struct v4l2_mbus_config cfg;
+2 −1
Original line number Diff line number Diff line
@@ -1103,7 +1103,8 @@ static int soc_camera_probe(struct soc_camera_device *icd)
	}

	sd = soc_camera_to_subdev(icd);
	sd->grp_id = (long)icd;
	sd->grp_id = soc_camera_grp_id(icd);
	v4l2_set_subdev_hostdata(sd, icd);

	if (v4l2_ctrl_add_handler(&icd->ctrl_handler, sd->ctrl_handler))
		goto ectrl;
+6 −1
Original line number Diff line number Diff line
@@ -254,7 +254,7 @@ unsigned long soc_camera_apply_board_flags(struct soc_camera_link *icl,
static inline struct video_device *soc_camera_i2c_to_vdev(const struct i2c_client *client)
{
	struct v4l2_subdev *sd = i2c_get_clientdata(client);
	struct soc_camera_device *icd = (struct soc_camera_device *)sd->grp_id;
	struct soc_camera_device *icd = v4l2_get_subdev_hostdata(sd);
	return icd ? icd->vdev : NULL;
}

@@ -279,6 +279,11 @@ static inline struct soc_camera_device *soc_camera_from_vbq(const struct videobu
	return container_of(vq, struct soc_camera_device, vb_vidq);
}

static inline u32 soc_camera_grp_id(const struct soc_camera_device *icd)
{
	return (icd->iface << 8) | (icd->devnum + 1);
}

void soc_camera_lock(struct vb2_queue *vq);
void soc_camera_unlock(struct vb2_queue *vq);