All of lore.kernel.org
 help / color / mirror / Atom feed
From: Kate Hsuan <hpa@redhat.com>
To: Mauro Carvalho Chehab <mchehab@kernel.org>,
	Hans Verkuil <hverkuil-cisco@xs4all.nl>,
	Laurent Pinchart <laurent.pinchart@ideasonboard.com>,
	Sakari Ailus <sakari.ailus@linux.intel.com>,
	Tomi Valkeinen <tomi.valkeinen+renesas@ideasonboard.com>,
	Stanimir Varbanov <stanimir.varbanov@linaro.org>,
	Xiu Jianfeng <xiujianfeng@huawei.com>,
	Jernej Skrabec <jernej.skrabec@gmail.com>,
	linux-media@vger.kernel.org, Hans de Goede <hdegoede@redhat.com>
Cc: Kate Hsuan <hpa@redhat.com>
Subject: [PATCH] media: v4l2-core: v4l2-ioctl: Printing log with dev_warn() when the pixelformat is unknown
Date: Mon, 27 Mar 2023 17:10:51 +0800	[thread overview]
Message-ID: <20230327091051.404184-1-hpa@redhat.com> (raw)

The original implementation used WARN() to notify the user of the "unknown
pixelformat" error. If fmt->description can be found, the function will
simply return without warnings. Recently, the description had removed from
uvc since v4l_fill_fmtdesc() can provide such kind of information. However,
for some of the USB cameras, such as Intel Realsense F200 returns unknown
format when probe(). Thus, the WARN() message shows and confuses the user.
This work changed WARN() to dev_warn() to reduce the severity of the
message.

The returned video format of Intel RealSense F200 is shown as follows.
kernel: uvcvideo 2-7:1.3: Unknown video format 52564e49-2d90-4a58-920b-773f1f2c556b
kernel: uvcvideo 2-7:1.3: Unknown video format 49524e49-2d90-4a58-920b-773f1f2c556b
kernel: uvcvideo 2-7:1.3: Unknown video format 494c4552-1314-f943-a75a-ee6bbf012e23
kernel: usb 2-7: Found UVC 1.10 device Intel(R) RealSense(TM) 3D Camera (Front F200) (8086:0a66)

Link: https://bugzilla.redhat.com/show_bug.cgi?id=2180107
Signed-off-by: Kate Hsuan <hpa@redhat.com>
---
 drivers/media/v4l2-core/v4l2-ioctl.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/media/v4l2-core/v4l2-ioctl.c b/drivers/media/v4l2-core/v4l2-ioctl.c
index 87f163a89c80..aae987243a5b 100644
--- a/drivers/media/v4l2-core/v4l2-ioctl.c
+++ b/drivers/media/v4l2-core/v4l2-ioctl.c
@@ -1246,7 +1246,7 @@ static int v4l_enumoutput(const struct v4l2_ioctl_ops *ops,
 	return ops->vidioc_enum_output(file, fh, p);
 }
 
-static void v4l_fill_fmtdesc(struct v4l2_fmtdesc *fmt)
+static void v4l_fill_fmtdesc(struct video_device *vdev, struct v4l2_fmtdesc *fmt)
 {
 	const unsigned sz = sizeof(fmt->description);
 	const char *descr = NULL;
@@ -1504,7 +1504,7 @@ static void v4l_fill_fmtdesc(struct v4l2_fmtdesc *fmt)
 		default:
 			if (fmt->description[0])
 				return;
-			WARN(1, "Unknown pixelformat 0x%08x\n", fmt->pixelformat);
+			dev_warn(&vdev->dev, "Unknown pixelformat 0x%08x\n", fmt->pixelformat);
 			flags = 0;
 			snprintf(fmt->description, sz, "%p4cc",
 				 &fmt->pixelformat);
@@ -1589,7 +1589,7 @@ static int v4l_enum_fmt(const struct v4l2_ioctl_ops *ops,
 		break;
 	}
 	if (ret == 0)
-		v4l_fill_fmtdesc(p);
+		v4l_fill_fmtdesc(vdev, p);
 	return ret;
 }
 
-- 
2.39.2


             reply	other threads:[~2023-03-27  9:12 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-27  9:10 Kate Hsuan [this message]
2023-03-27 11:05 ` [PATCH] media: v4l2-core: v4l2-ioctl: Printing log with dev_warn() when the pixelformat is unknown Hans de Goede
2023-03-29 11:40   ` Hans Verkuil

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230327091051.404184-1-hpa@redhat.com \
    --to=hpa@redhat.com \
    --cc=hdegoede@redhat.com \
    --cc=hverkuil-cisco@xs4all.nl \
    --cc=jernej.skrabec@gmail.com \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@kernel.org \
    --cc=sakari.ailus@linux.intel.com \
    --cc=stanimir.varbanov@linaro.org \
    --cc=tomi.valkeinen+renesas@ideasonboard.com \
    --cc=xiujianfeng@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.