* [PATCH v2] gpu: drm: Use dev_err_probe instead of dev_err
@ 2023-07-26 11:57 Wang Ming
2023-07-26 14:51 ` Laurent Pinchart
0 siblings, 1 reply; 2+ messages in thread
From: Wang Ming @ 2023-07-26 11:57 UTC (permalink / raw)
To: Laurent Pinchart, David Airlie, Daniel Vetter, Michal Simek,
dri-devel, linux-arm-kernel, linux-kernel
Cc: Wang Ming, opensource.kernel
It is possible that dma_request_chan will return EPROBE_DEFER,
which means that disp->dev is not ready yet. In this case,
dev_err(disp->dev), there will be no output. This patch fixes the bug.
Signed-off-by: Wang Ming <machel@vivo.com>
---
drivers/gpu/drm/xlnx/zynqmp_disp.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/gpu/drm/xlnx/zynqmp_disp.c b/drivers/gpu/drm/xlnx/zynqmp_disp.c
index 3b87eebddc97..676f09fe8594 100644
--- a/drivers/gpu/drm/xlnx/zynqmp_disp.c
+++ b/drivers/gpu/drm/xlnx/zynqmp_disp.c
@@ -1094,8 +1094,8 @@ static int zynqmp_disp_layer_request_dma(struct zynqmp_disp *disp,
"%s%u", dma_names[layer->id], i);
dma->chan = dma_request_chan(disp->dev, dma_channel_name);
if (IS_ERR(dma->chan)) {
- dev_err(disp->dev, "failed to request dma channel\n");
- ret = PTR_ERR(dma->chan);
+ ret = dev_err_probe(disp->dev, PTR_ERR(dma->chan),
+ "failed to request dma channel\n");
dma->chan = NULL;
return ret;
}
--
2.25.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH v2] gpu: drm: Use dev_err_probe instead of dev_err
2023-07-26 11:57 [PATCH v2] gpu: drm: Use dev_err_probe instead of dev_err Wang Ming
@ 2023-07-26 14:51 ` Laurent Pinchart
0 siblings, 0 replies; 2+ messages in thread
From: Laurent Pinchart @ 2023-07-26 14:51 UTC (permalink / raw)
To: Wang Ming
Cc: opensource.kernel, linux-kernel, dri-devel, Michal Simek,
linux-arm-kernel
Hi Wang,
Thank you for the patch.
On Wed, Jul 26, 2023 at 07:57:56PM +0800, Wang Ming wrote:
> It is possible that dma_request_chan will return EPROBE_DEFER,
> which means that disp->dev is not ready yet. In this case,
> dev_err(disp->dev), there will be no output. This patch fixes the bug.
It's not a bug. The existing code works as expected. dev_err_probe() is
nicer though, as it records the reason for the probe deferral. Here's a
proposal for a better commit message:
It is possible that dma_request_chan() returns EPROBE_DEFER, in which
case the driver defers probing without printing any message. Use
dev_err_probe() to record the probe deferral cause and ease debugging.
> Signed-off-by: Wang Ming <machel@vivo.com>
> ---
> drivers/gpu/drm/xlnx/zynqmp_disp.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/xlnx/zynqmp_disp.c b/drivers/gpu/drm/xlnx/zynqmp_disp.c
> index 3b87eebddc97..676f09fe8594 100644
> --- a/drivers/gpu/drm/xlnx/zynqmp_disp.c
> +++ b/drivers/gpu/drm/xlnx/zynqmp_disp.c
> @@ -1094,8 +1094,8 @@ static int zynqmp_disp_layer_request_dma(struct zynqmp_disp *disp,
> "%s%u", dma_names[layer->id], i);
> dma->chan = dma_request_chan(disp->dev, dma_channel_name);
> if (IS_ERR(dma->chan)) {
> - dev_err(disp->dev, "failed to request dma channel\n");
> - ret = PTR_ERR(dma->chan);
> + ret = dev_err_probe(disp->dev, PTR_ERR(dma->chan),
> + "failed to request dma channel\n");
The alignment is wrong, this should be
ret = dev_err_probe(disp->dev, PTR_ERR(dma->chan),
"failed to request dma channel\n");
If you're fine with those changes, I can fix this locally, there's no
need to resubmit.
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> dma->chan = NULL;
> return ret;
> }
--
Regards,
Laurent Pinchart
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2023-07-27 7:12 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-07-26 11:57 [PATCH v2] gpu: drm: Use dev_err_probe instead of dev_err Wang Ming
2023-07-26 14:51 ` Laurent Pinchart
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).