Commit 8cdd708f authored by Hans Verkuil's avatar Hans Verkuil
Browse files

media: use sizeof() instead of V4L2_SUBDEV_NAME_SIZE



Don't rely on a define, let the compiler use the actual
field size.

Remove all uses of the V4L2_SUBDEV_NAME_SIZE define and also
drop the define itself.

Signed-off-by: default avatarHans Verkuil <hverkuil-cisco@xs4all.nl>
Reviewed-by: default avatarLaurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Reviewed-by: default avatarNiklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: default avatarMaxime Ripard <mripard@kernel.org>
Reviewed-by: default avatarLuca Ceresoli <luca.ceresoli@bootlin.com>
Tested-by: default avatarLuca Ceresoli <luca.ceresoli@bootlin.com>
parent d9d432af
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -561,7 +561,7 @@ static int msp_log_status(struct v4l2_subdev *sd)
	struct msp_state *state = to_state(sd);
	struct i2c_client *client = v4l2_get_subdevdata(sd);
	const char *p;
	char prefix[V4L2_SUBDEV_NAME_SIZE + 20];
	char prefix[sizeof(sd->name) + 20];

	if (state->opmode == OPMODE_AUTOSELECT)
		msp_detect_stereo(client);
+2 −2
Original line number Diff line number Diff line
@@ -516,8 +516,8 @@ static int csi2rx_probe(struct platform_device *pdev)
	csi2rx->subdev.dev = &pdev->dev;
	v4l2_subdev_init(&csi2rx->subdev, &csi2rx_subdev_ops);
	v4l2_set_subdevdata(&csi2rx->subdev, &pdev->dev);
	snprintf(csi2rx->subdev.name, V4L2_SUBDEV_NAME_SIZE, "%s.%s",
		 KBUILD_MODNAME, dev_name(&pdev->dev));
	snprintf(csi2rx->subdev.name, sizeof(csi2rx->subdev.name),
		 "%s.%s", KBUILD_MODNAME, dev_name(&pdev->dev));

	/* Create our media pads */
	csi2rx->subdev.entity.function = MEDIA_ENT_F_VID_IF_BRIDGE;
+2 −2
Original line number Diff line number Diff line
@@ -592,8 +592,8 @@ static int csi2tx_probe(struct platform_device *pdev)
	csi2tx->subdev.owner = THIS_MODULE;
	csi2tx->subdev.dev = &pdev->dev;
	csi2tx->subdev.flags |= V4L2_SUBDEV_FL_HAS_DEVNODE;
	snprintf(csi2tx->subdev.name, V4L2_SUBDEV_NAME_SIZE, "%s.%s",
		 KBUILD_MODNAME, dev_name(&pdev->dev));
	snprintf(csi2tx->subdev.name, sizeof(csi2tx->subdev.name),
		 "%s.%s", KBUILD_MODNAME, dev_name(&pdev->dev));

	ret = csi2tx_check_lanes(csi2tx);
	if (ret)
+1 −1
Original line number Diff line number Diff line
@@ -467,7 +467,7 @@ static int risp_probe(struct platform_device *pdev)
	isp->subdev.dev = &pdev->dev;
	v4l2_subdev_init(&isp->subdev, &rcar_isp_subdev_ops);
	v4l2_set_subdevdata(&isp->subdev, &pdev->dev);
	snprintf(isp->subdev.name, V4L2_SUBDEV_NAME_SIZE, "%s %s",
	snprintf(isp->subdev.name, sizeof(isp->subdev.name), "%s %s",
		 KBUILD_MODNAME, dev_name(&pdev->dev));
	isp->subdev.flags = V4L2_SUBDEV_FL_HAS_DEVNODE;

+1 −1
Original line number Diff line number Diff line
@@ -1889,7 +1889,7 @@ static int rcsi2_probe(struct platform_device *pdev)
	priv->subdev.dev = &pdev->dev;
	v4l2_subdev_init(&priv->subdev, &rcar_csi2_subdev_ops);
	v4l2_set_subdevdata(&priv->subdev, &pdev->dev);
	snprintf(priv->subdev.name, V4L2_SUBDEV_NAME_SIZE, "%s %s",
	snprintf(priv->subdev.name, sizeof(priv->subdev.name), "%s %s",
		 KBUILD_MODNAME, dev_name(&pdev->dev));
	priv->subdev.flags = V4L2_SUBDEV_FL_HAS_DEVNODE;

Loading