From: Niklas Söderlund niklas.soderlund+renesas@ragnatech.se
[ Upstream commit 5a0abb8909b9dcf347fce1d201ac6686ac33fd64 ]
When operating a pipeline with a missing V4L2_CID_LINK_FREQ control this two line warning is printed each time the pipeline is started. Reduce this excessive logging by only warning once for the missing control.
Signed-off-by: Niklas Söderlund niklas.soderlund+renesas@ragnatech.se Signed-off-by: Sakari Ailus sakari.ailus@linux.intel.com Signed-off-by: Hans Verkuil hverkuil@xs4all.nl Signed-off-by: Sasha Levin sashal@kernel.org ---
LLM Generated explanations, may be completely bogus:
Now I understand the issue. Every time a V4L2 pipeline is started (which happens when streaming begins), the `cio2_hw_init()` function is called, which eventually calls `v4l2_get_link_freq()`. If the V4L2_CID_LINK_FREQ control is not present, it prints two warning messages. This happens EVERY time streaming starts, which can be frequent in normal camera operation.
**Backport Status: YES**
This commit should be backported to stable kernel trees for the following reasons:
1. **It fixes a user-visible annoyance/bug**: The commit addresses excessive logging that occurs every time a V4L2 pipeline is started when the V4L2_CID_LINK_FREQ control is missing. These two-line warnings are printed on each pipeline start (during `start_streaming` operations), which can happen frequently during normal camera usage, leading to log spam.
2. **The fix is minimal and safe**: The change is extremely simple - it only replaces `pr_warn()` with `pr_warn_once()` for two warning messages. This change: - Has zero functional impact on the driver operation - Only affects logging behavior - Cannot introduce regressions in functionality - Is confined to two lines of code
3. **Clear bug fix, not a feature**: This is purely a bug fix that reduces excessive logging. It doesn't add new features or change architectural behavior. The warnings were introduced in commit 67012d97df931 (Feb 2021) and have been causing log spam since then.
4. **Affects real users**: The warning occurs in common V4L2 camera drivers (ipu3-cio2, ipu6-isys-csi2, mei_csi, rcar-csi2, etc.) whenever they start streaming and the transmitter driver hasn't implemented V4L2_CID_LINK_FREQ control. Many camera sensors don't implement this control, making this a widespread issue.
5. **Follows stable kernel rules**: According to stable kernel rules, patches that fix "annoying" issues that affect users are candidates for backporting. Log spam that occurs on every camera stream start definitely qualifies as an annoying issue.
The commit is a perfect candidate for stable backporting - it's a trivial, safe fix for a real user-facing issue that has been present in the kernel for several years.
drivers/media/v4l2-core/v4l2-common.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/media/v4l2-core/v4l2-common.c b/drivers/media/v4l2-core/v4l2-common.c index bd160a8c9efe..e1fc8fe43b74 100644 --- a/drivers/media/v4l2-core/v4l2-common.c +++ b/drivers/media/v4l2-core/v4l2-common.c @@ -505,10 +505,10 @@ s64 __v4l2_get_link_freq_ctrl(struct v4l2_ctrl_handler *handler,
freq = div_u64(v4l2_ctrl_g_ctrl_int64(ctrl) * mul, div);
- pr_warn("%s: Link frequency estimated using pixel rate: result might be inaccurate\n", - __func__); - pr_warn("%s: Consider implementing support for V4L2_CID_LINK_FREQ in the transmitter driver\n", - __func__); + pr_warn_once("%s: Link frequency estimated using pixel rate: result might be inaccurate\n", + __func__); + pr_warn_once("%s: Consider implementing support for V4L2_CID_LINK_FREQ in the transmitter driver\n", + __func__); }
return freq > 0 ? freq : -EINVAL;