* [PATCH v2] media: platform: Use dev_err_probe instead of dev_err @ 2023-07-26 11:51 Wang Ming 2023-07-26 14:28 ` Laurent Pinchart 0 siblings, 1 reply; 3+ messages in thread From: Wang Ming @ 2023-07-26 11:51 UTC (permalink / raw) To: Laurent Pinchart, Mauro Carvalho Chehab, Michal Simek, linux-media, linux-arm-kernel, linux-kernel Cc: opensource.kernel, Wang Ming It is possible that dma_request_chan will return EPROBE_DEFER, which means that dma->xdev->dev is not ready yet. In this case, dev_err(dma->xdev->dev), there will be no output. This patch fixes the bug. Signed-off-by: Wang Ming <machel@vivo.com> --- drivers/media/platform/xilinx/xilinx-dma.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/media/platform/xilinx/xilinx-dma.c b/drivers/media/platform/xilinx/xilinx-dma.c index 80d6f5b072ea..16ad39bef6c6 100644 --- a/drivers/media/platform/xilinx/xilinx-dma.c +++ b/drivers/media/platform/xilinx/xilinx-dma.c @@ -708,9 +708,8 @@ int xvip_dma_init(struct xvip_composite_device *xdev, struct xvip_dma *dma, snprintf(name, sizeof(name), "port%u", port); dma->dma = dma_request_chan(dma->xdev->dev, name); if (IS_ERR(dma->dma)) { - ret = PTR_ERR(dma->dma); - if (ret != -EPROBE_DEFER) - dev_err(dma->xdev->dev, "no VDMA channel found\n"); + ret = dev_err_probe(dma->xdev->dev, PTR_ERR(dma->dma), + "no VDMA channel found\n"); goto error; } -- 2.25.1 ^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH v2] media: platform: Use dev_err_probe instead of dev_err 2023-07-26 11:51 [PATCH v2] media: platform: Use dev_err_probe instead of dev_err Wang Ming @ 2023-07-26 14:28 ` Laurent Pinchart 2023-07-26 14:49 ` Laurent Pinchart 0 siblings, 1 reply; 3+ messages in thread From: Laurent Pinchart @ 2023-07-26 14:28 UTC (permalink / raw) To: Wang Ming Cc: Mauro Carvalho Chehab, Michal Simek, linux-media, linux-arm-kernel, linux-kernel, opensource.kernel Hi Wang, Thank you for the patch. On Wed, Jul 26, 2023 at 07:51:58PM +0800, Wang Ming wrote: > It is possible that dma_request_chan will return EPROBE_DEFER, > which means that dma->xdev->dev is not ready yet. In this case, > dev_err(dma->xdev->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. If you're fine with this, there's no need to resubmit, I'll update the commit message locally and merge the patch. Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> > Signed-off-by: Wang Ming <machel@vivo.com> > --- > drivers/media/platform/xilinx/xilinx-dma.c | 5 ++--- > 1 file changed, 2 insertions(+), 3 deletions(-) > > diff --git a/drivers/media/platform/xilinx/xilinx-dma.c b/drivers/media/platform/xilinx/xilinx-dma.c > index 80d6f5b072ea..16ad39bef6c6 100644 > --- a/drivers/media/platform/xilinx/xilinx-dma.c > +++ b/drivers/media/platform/xilinx/xilinx-dma.c > @@ -708,9 +708,8 @@ int xvip_dma_init(struct xvip_composite_device *xdev, struct xvip_dma *dma, > snprintf(name, sizeof(name), "port%u", port); > dma->dma = dma_request_chan(dma->xdev->dev, name); > if (IS_ERR(dma->dma)) { > - ret = PTR_ERR(dma->dma); > - if (ret != -EPROBE_DEFER) > - dev_err(dma->xdev->dev, "no VDMA channel found\n"); > + ret = dev_err_probe(dma->xdev->dev, PTR_ERR(dma->dma), > + "no VDMA channel found\n"); > goto error; > } > -- Regards, Laurent Pinchart ^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v2] media: platform: Use dev_err_probe instead of dev_err 2023-07-26 14:28 ` Laurent Pinchart @ 2023-07-26 14:49 ` Laurent Pinchart 0 siblings, 0 replies; 3+ messages in thread From: Laurent Pinchart @ 2023-07-26 14:49 UTC (permalink / raw) To: Wang Ming Cc: Mauro Carvalho Chehab, Michal Simek, linux-media, linux-arm-kernel, linux-kernel, opensource.kernel On Wed, Jul 26, 2023 at 05:28:37PM +0300, Laurent Pinchart wrote: > Hi Wang, > > Thank you for the patch. > > On Wed, Jul 26, 2023 at 07:51:58PM +0800, Wang Ming wrote: > > It is possible that dma_request_chan will return EPROBE_DEFER, > > which means that dma->xdev->dev is not ready yet. In this case, > > dev_err(dma->xdev->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. > > If you're fine with this, there's no need to resubmit, I'll update the > commit message locally and merge the patch. > > Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> > > > Signed-off-by: Wang Ming <machel@vivo.com> > > --- > > drivers/media/platform/xilinx/xilinx-dma.c | 5 ++--- > > 1 file changed, 2 insertions(+), 3 deletions(-) > > > > diff --git a/drivers/media/platform/xilinx/xilinx-dma.c b/drivers/media/platform/xilinx/xilinx-dma.c > > index 80d6f5b072ea..16ad39bef6c6 100644 > > --- a/drivers/media/platform/xilinx/xilinx-dma.c > > +++ b/drivers/media/platform/xilinx/xilinx-dma.c > > @@ -708,9 +708,8 @@ int xvip_dma_init(struct xvip_composite_device *xdev, struct xvip_dma *dma, > > snprintf(name, sizeof(name), "port%u", port); > > dma->dma = dma_request_chan(dma->xdev->dev, name); > > if (IS_ERR(dma->dma)) { > > - ret = PTR_ERR(dma->dma); > > - if (ret != -EPROBE_DEFER) > > - dev_err(dma->xdev->dev, "no VDMA channel found\n"); > > + ret = dev_err_probe(dma->xdev->dev, PTR_ERR(dma->dma), > > + "no VDMA channel found\n"); I forgot to mention that the message should be aligned: ret = dev_err_probe(dma->xdev->dev, PTR_ERR(dma->dma), "no VDMA channel found\n"); I can fix this locally too. > > goto error; > > } > > -- Regards, Laurent Pinchart ^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2023-07-26 14:49 UTC | newest] Thread overview: 3+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2023-07-26 11:51 [PATCH v2] media: platform: Use dev_err_probe instead of dev_err Wang Ming 2023-07-26 14:28 ` Laurent Pinchart 2023-07-26 14:49 ` Laurent Pinchart
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox