All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] staging: most: dim2: use dev_err_probe() for clock errors in rcar enable functions
  2026-06-23 12:42 [PATCH] staging: most: dim2: use dev_err_probe() for clock errors in rcar enable functions Batu Ada Tutkun
@ 2026-06-23 12:35 ` Batu Ada Tutkun
  2026-06-23 13:16 ` [PATCH] " Dan Carpenter
  2026-06-23 19:46 ` [PATCH v2] " Batu Ada Tutkun
  2 siblings, 0 replies; 6+ messages in thread
From: Batu Ada Tutkun @ 2026-06-23 12:35 UTC (permalink / raw)
  To: parthiban.veerasooran, christian.gromm
  Cc: gregkh, linux-staging, linux-kernel, error27

rcar_gen2_enable() and rcar_gen3_enable() use the old pattern of
dev_err() followed by return PTR_ERR() when devm_clk_get() fails.
fsl_mx6_enable() in the same file was already converted to use
dev_err_probe() by a previous cleanup series.

Convert the remaining two functions for consistency. devm_clk_get()
calls clk_get() which can return -EPROBE_DEFER if the clock provider
has not yet registered. Using dev_err_probe() suppresses the log at
error level in that case, avoiding misleading "cannot get clock" output
during a normal deferred probe.

clk_prepare_enable() cannot return -EPROBE_DEFER since the clock handle
is already acquired at that point, so those error paths are left as
dev_err().

Signed-off-by: Batu Ada Tutkun <batuadatutkun@gmail.com>

---
Compile tested only. No R-Car hardware available. This is a correctness
fix for the deferred probe path, not a response to a reported
user visible issue.

Changes in v2:
- Mention clk_get() explicitly in commit message
- Add testing note under --- cut off line

 drivers/staging/most/dim2/dim2.c | 14 ++++++--------
 1 file changed, 6 insertions(+), 8 deletions(-)

diff --git a/drivers/staging/most/dim2/dim2.c b/drivers/staging/most/dim2/dim2.c
index 7953d4626..56f856d6d 100644
--- a/drivers/staging/most/dim2/dim2.c
+++ b/drivers/staging/most/dim2/dim2.c
@@ -974,10 +974,9 @@ static int rcar_gen2_enable(struct platform_device *pdev)
 	int ret;
 
 	dev->clk = devm_clk_get(&pdev->dev, NULL);
-	if (IS_ERR(dev->clk)) {
-		dev_err(&pdev->dev, "cannot get clock\n");
-		return PTR_ERR(dev->clk);
-	}
+	if (IS_ERR(dev->clk))
+		return dev_err_probe(&pdev->dev, PTR_ERR(dev->clk),
+				     "cannot get clock\n");
 
 	ret = clk_prepare_enable(dev->clk);
 	if (ret) {
@@ -1019,10 +1018,9 @@ static int rcar_gen3_enable(struct platform_device *pdev)
 	int ret;
 
 	dev->clk = devm_clk_get(&pdev->dev, NULL);
-	if (IS_ERR(dev->clk)) {
-		dev_err(&pdev->dev, "cannot get clock\n");
-		return PTR_ERR(dev->clk);
-	}
+	if (IS_ERR(dev->clk))
+		return dev_err_probe(&pdev->dev, PTR_ERR(dev->clk),
+				     "cannot get clock\n");
 
 	ret = clk_prepare_enable(dev->clk);
 	if (ret) {
-- 
2.53.0


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH] staging: most: dim2: use dev_err_probe() for clock errors in rcar enable functions
@ 2026-06-23 12:42 Batu Ada Tutkun
  2026-06-23 12:35 ` [PATCH v2] " Batu Ada Tutkun
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Batu Ada Tutkun @ 2026-06-23 12:42 UTC (permalink / raw)
  To: parthiban.veerasooran, christian.gromm
  Cc: gregkh, linux-staging, linux-kernel, Batu Ada Tutkun

rcar_gen2_enable() and rcar_gen3_enable() use the old pattern of
dev_err() followed by return PTR_ERR() when devm_clk_get() fails.
fsl_mx6_enable() in the same file was already converted to use
dev_err_probe() by a previous cleanup series.

Convert the remaining two functions for consistency. devm_clk_get()
can return -EPROBE_DEFER, so dev_err_probe() is appropriate here: it
suppresses the log message at error level when the failure is a deferred
probe, avoiding misleading output during normal boot.

Signed-off-by: Batu Ada Tutkun <batuadatutkun@gmail.com>
---
 drivers/staging/most/dim2/dim2.c | 14 ++++++--------
 1 file changed, 6 insertions(+), 8 deletions(-)

diff --git a/drivers/staging/most/dim2/dim2.c b/drivers/staging/most/dim2/dim2.c
index 7953d4626..56f856d6d 100644
--- a/drivers/staging/most/dim2/dim2.c
+++ b/drivers/staging/most/dim2/dim2.c
@@ -974,10 +974,9 @@ static int rcar_gen2_enable(struct platform_device *pdev)
 	int ret;
 
 	dev->clk = devm_clk_get(&pdev->dev, NULL);
-	if (IS_ERR(dev->clk)) {
-		dev_err(&pdev->dev, "cannot get clock\n");
-		return PTR_ERR(dev->clk);
-	}
+	if (IS_ERR(dev->clk))
+		return dev_err_probe(&pdev->dev, PTR_ERR(dev->clk),
+				     "cannot get clock\n");
 
 	ret = clk_prepare_enable(dev->clk);
 	if (ret) {
@@ -1019,10 +1018,9 @@ static int rcar_gen3_enable(struct platform_device *pdev)
 	int ret;
 
 	dev->clk = devm_clk_get(&pdev->dev, NULL);
-	if (IS_ERR(dev->clk)) {
-		dev_err(&pdev->dev, "cannot get clock\n");
-		return PTR_ERR(dev->clk);
-	}
+	if (IS_ERR(dev->clk))
+		return dev_err_probe(&pdev->dev, PTR_ERR(dev->clk),
+				     "cannot get clock\n");
 
 	ret = clk_prepare_enable(dev->clk);
 	if (ret) {
-- 
2.53.0


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH] staging: most: dim2: use dev_err_probe() for clock errors in rcar enable functions
  2026-06-23 12:42 [PATCH] staging: most: dim2: use dev_err_probe() for clock errors in rcar enable functions Batu Ada Tutkun
  2026-06-23 12:35 ` [PATCH v2] " Batu Ada Tutkun
@ 2026-06-23 13:16 ` Dan Carpenter
  2026-06-23 17:41   ` Batu Ada Tutkun
  2026-06-23 19:46 ` [PATCH v2] " Batu Ada Tutkun
  2 siblings, 1 reply; 6+ messages in thread
From: Dan Carpenter @ 2026-06-23 13:16 UTC (permalink / raw)
  To: Batu Ada Tutkun
  Cc: parthiban.veerasooran, christian.gromm, gregkh, linux-staging,
	linux-kernel

On Tue, Jun 23, 2026 at 03:42:43PM +0300, Batu Ada Tutkun wrote:
> rcar_gen2_enable() and rcar_gen3_enable() use the old pattern of
> dev_err() followed by return PTR_ERR() when devm_clk_get() fails.
> fsl_mx6_enable() in the same file was already converted to use
> dev_err_probe() by a previous cleanup series.
> 
> Convert the remaining two functions for consistency. devm_clk_get()
> can return -EPROBE_DEFER, so dev_err_probe() is appropriate here: it
> suppresses the log message at error level when the failure is a deferred
> probe, avoiding misleading output during normal boot.
> 

This feels like an AI patch.  Please state when you are using AI.

In fsl_mx6_enable(), the original code returned -EFAULT if
devm_clk_get() failed so change it to propagate the error code and
use dev_err_probe() made obvious sense.  This was done in
commit b7a013c12504 ("staging: most: dim2: use dev_err_probe and
proper error codes for clock").

In this case, the logic is "monkey see, monkey do" which is
reasonable AI logic but it's not enough motivation on its own
Does devm_clk_get() actually return -EPROBE_DEFER?  Does
clk_prepare_enable() return -EPROBE_DEFER?  Should that be changed
as well?

> Signed-off-by: Batu Ada Tutkun <batuadatutkun@gmail.com>
> ---
  ^^^
You need to say if a patch has been tested or not here under the
--- cut off line.

>  drivers/staging/most/dim2/dim2.c | 14 ++++++--------
>  1 file changed, 6 insertions(+), 8 deletions(-)

regards,
dan carpenter


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] staging: most: dim2: use dev_err_probe() for clock errors in rcar enable functions
  2026-06-23 13:16 ` [PATCH] " Dan Carpenter
@ 2026-06-23 17:41   ` Batu Ada Tutkun
  2026-06-23 18:35     ` Dan Carpenter
  0 siblings, 1 reply; 6+ messages in thread
From: Batu Ada Tutkun @ 2026-06-23 17:41 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: parthiban.veerasooran, christian.gromm, gregkh, linux-staging,
	linux-kernel

Yes, this was drafted with AI assistance. Thank you for pointing it out.

You are right that the error code was not broken here. rcar_gen2 and gen3 already return PTR_ERR(dev->clk), so unlike the fsl_mx6 case there is no -EFAULT bug to fix. This is just a consistency cleanup, plus devm_clk_get() can return -EPROBE_DEFER when the clock provider has not registered yet so dev_err_probe() suppresses the misleading "cannot get clock" message during a normal deferred probe.

clk_prepare_enable() can't return -EPROBE_DEFER. By the time it is called the clock handle is already acquired and deferral only happens at acquisition. Because of that I deliberately left that path as dev_err().

Compile tested only. I do not have R-Car hardware.

Regards,
Batu Ada Tutkun

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] staging: most: dim2: use dev_err_probe() for clock errors in rcar enable functions
  2026-06-23 17:41   ` Batu Ada Tutkun
@ 2026-06-23 18:35     ` Dan Carpenter
  0 siblings, 0 replies; 6+ messages in thread
From: Dan Carpenter @ 2026-06-23 18:35 UTC (permalink / raw)
  To: Batu Ada Tutkun
  Cc: parthiban.veerasooran, christian.gromm, gregkh, linux-staging,
	linux-kernel

On Tue, Jun 23, 2026 at 10:41:56AM -0700, Batu Ada Tutkun wrote:
> Yes, this was drafted with AI assistance. Thank you for pointing it out.
> 
> You are right that the error code was not broken here. rcar_gen2 and gen3 already return PTR_ERR(dev->clk), so unlike the fsl_mx6 case there is no -EFAULT bug to fix. This is just a consistency cleanup, plus devm_clk_get() can return -EPROBE_DEFER when the clock provider has not registered yet so dev_err_probe() suppresses the misleading "cannot get clock" message during a normal deferred probe.

I checked this and sure enough, clk_get() returns -EPROBE_DEFER.  Please
specifically mention clk_get() in the commit message in case someone wants
to check the code...

Useless: grep "when the clock provider has not registered yet"
 Useful: vim -t clk_get

> 
> clk_prepare_enable() can't return -EPROBE_DEFER. By the time it is called the clock handle is already acquired and deferral only happens at acquisition. Because of that I deliberately left that path as dev_err().
> 
> Compile tested only. I do not have R-Car hardware.

This is good information and it needs to be in the commit message under
the --- cut off line.  Obviously, I know that changing dev_err() to
dev_err_probe() does not cause a problem, but I also want to know if this
is something which is already affecting users in real life or if it's
just a correctness thing.

So the patch is fine, but the commit message needs to be re-written.

regards,
dan carpenter


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH v2] staging: most: dim2: use dev_err_probe() for clock errors in rcar enable functions
  2026-06-23 12:42 [PATCH] staging: most: dim2: use dev_err_probe() for clock errors in rcar enable functions Batu Ada Tutkun
  2026-06-23 12:35 ` [PATCH v2] " Batu Ada Tutkun
  2026-06-23 13:16 ` [PATCH] " Dan Carpenter
@ 2026-06-23 19:46 ` Batu Ada Tutkun
  2 siblings, 0 replies; 6+ messages in thread
From: Batu Ada Tutkun @ 2026-06-23 19:46 UTC (permalink / raw)
  To: parthiban.veerasooran, christian.gromm
  Cc: gregkh, linux-staging, linux-kernel, error27

rcar_gen2_enable() and rcar_gen3_enable() use the old pattern of
dev_err() followed by return PTR_ERR() when devm_clk_get() fails.
fsl_mx6_enable() in the same file was already converted to use
dev_err_probe() by a previous cleanup series.

Convert the remaining two functions for consistency. devm_clk_get()
calls clk_get() which can return -EPROBE_DEFER if the clock provider
has not yet registered. Using dev_err_probe() suppresses the log at
error level in that case, avoiding misleading "cannot get clock" output
during a normal deferred probe.

clk_prepare_enable() cannot return -EPROBE_DEFER since the clock handle
is already acquired at that point, so those error paths are left as
dev_err().

Signed-off-by: Batu Ada Tutkun <batuadatutkun@gmail.com>
---
Compile tested only. No R-Car hardware available. This is a correctness
fix for the deferred probe path, not a response to a reported
user visible issue.

Changes in v2:
- Mention clk_get() explicitly in commit message
- Add testing note under --- cut off line

 drivers/staging/most/video/video.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/most/video/video.c b/drivers/staging/most/video/video.c
index 04351f8cc..1e1ff3c52 100644
--- a/drivers/staging/most/video/video.c
+++ b/drivers/staging/most/video/video.c
@@ -33,14 +33,14 @@ struct most_video_dev {
 	bool mute;
 
 	struct list_head pending_mbos;
-	spinlock_t list_lock;
+	spinlock_t list_lock;	/* protects pending_mbos and mute */
 
 	struct v4l2_device v4l2_dev;
 	atomic_t access_ref;
 	struct video_device *vdev;
 	unsigned int ctrl_input;
 
-	struct mutex lock;
+	struct mutex lock;		/* serializes V4L2 ioctls */
 
 	wait_queue_head_t wait_data;
 };
-- 
2.53.0


^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2026-06-23 19:52 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-06-23 12:42 [PATCH] staging: most: dim2: use dev_err_probe() for clock errors in rcar enable functions Batu Ada Tutkun
2026-06-23 12:35 ` [PATCH v2] " Batu Ada Tutkun
2026-06-23 13:16 ` [PATCH] " Dan Carpenter
2026-06-23 17:41   ` Batu Ada Tutkun
2026-06-23 18:35     ` Dan Carpenter
2026-06-23 19:46 ` [PATCH v2] " Batu Ada Tutkun

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.