Message ID | 20250326084937.3932383-1-alexander.stein@ew.tq-group.com (mailing list archive) |
---|---|
State | New |
Headers | show |
Series | [1/1] i2c: imx: add some dev_err_probe calls | expand |
On 3/26/2025 2:19 PM, Alexander Stein wrote: > Especially DMA channels might not be available. Add some deferred probe > messages accordingly. > Anything specific instead of some deferred probe messages ? Would be good to mention problem like During probe if DMA channels not available, replace regular error messages by deferred probe messages ? > Signed-off-by: Alexander Stein <alexander.stein@ew.tq-group.com> > --- > drivers/i2c/busses/i2c-imx.c | 14 +++++++++----- > 1 file changed, 9 insertions(+), 5 deletions(-) > > diff --git a/drivers/i2c/busses/i2c-imx.c b/drivers/i2c/busses/i2c-imx.c > index 9e5d454d8318e..e6e09d5a2bbd4 100644 > --- a/drivers/i2c/busses/i2c-imx.c > +++ b/drivers/i2c/busses/i2c-imx.c > @@ -1711,11 +1711,13 @@ static int i2c_imx_probe(struct platform_device *pdev) > > irq = platform_get_irq(pdev, 0); > if (irq < 0) > - return irq; > + return dev_err_probe(&pdev->dev, irq, > + "can't get IRQ\n"); Can fit into single line ? > > base = devm_platform_get_and_ioremap_resource(pdev, 0, &res); > if (IS_ERR(base)) > - return PTR_ERR(base); > + return dev_err_probe(&pdev->dev, PTR_ERR(base), > + "can't get IO memory\n"); same here if possible. > > phy_addr = (dma_addr_t)res->start; > i2c_imx = devm_kzalloc(&pdev->dev, sizeof(*i2c_imx), GFP_KERNEL); > @@ -1810,13 +1812,15 @@ static int i2c_imx_probe(struct platform_device *pdev) > */ > ret = i2c_imx_dma_request(i2c_imx, phy_addr); > if (ret) { > - if (ret == -EPROBE_DEFER) > + if (ret == -EPROBE_DEFER) { > + dev_err_probe(&pdev->dev, ret, "can't get DMA channels\n"); > goto clk_notifier_unregister; > - else if (ret == -ENODEV) > + } else if (ret == -ENODEV) { > dev_dbg(&pdev->dev, "Only use PIO mode\n"); > - else > + } else { > dev_warn(&pdev->dev, "Failed to setup DMA (%pe), only use PIO mode\n", > ERR_PTR(ret)); > + } > } > > /* Add I2C adapter */
On Wed, Mar 26, 2025 at 09:49:36AM +0100, Alexander Stein wrote: > Especially DMA channels might not be available. Add some deferred probe > messages accordingly. > > Signed-off-by: Alexander Stein <alexander.stein@ew.tq-group.com> > --- Reviewed-by: Frank Li <Frank.Li@nxp.com> > drivers/i2c/busses/i2c-imx.c | 14 +++++++++----- > 1 file changed, 9 insertions(+), 5 deletions(-) > > diff --git a/drivers/i2c/busses/i2c-imx.c b/drivers/i2c/busses/i2c-imx.c > index 9e5d454d8318e..e6e09d5a2bbd4 100644 > --- a/drivers/i2c/busses/i2c-imx.c > +++ b/drivers/i2c/busses/i2c-imx.c > @@ -1711,11 +1711,13 @@ static int i2c_imx_probe(struct platform_device *pdev) > > irq = platform_get_irq(pdev, 0); > if (irq < 0) > - return irq; > + return dev_err_probe(&pdev->dev, irq, > + "can't get IRQ\n"); > > base = devm_platform_get_and_ioremap_resource(pdev, 0, &res); > if (IS_ERR(base)) > - return PTR_ERR(base); > + return dev_err_probe(&pdev->dev, PTR_ERR(base), > + "can't get IO memory\n"); > > phy_addr = (dma_addr_t)res->start; > i2c_imx = devm_kzalloc(&pdev->dev, sizeof(*i2c_imx), GFP_KERNEL); > @@ -1810,13 +1812,15 @@ static int i2c_imx_probe(struct platform_device *pdev) > */ > ret = i2c_imx_dma_request(i2c_imx, phy_addr); > if (ret) { > - if (ret == -EPROBE_DEFER) > + if (ret == -EPROBE_DEFER) { > + dev_err_probe(&pdev->dev, ret, "can't get DMA channels\n"); > goto clk_notifier_unregister; > - else if (ret == -ENODEV) > + } else if (ret == -ENODEV) { > dev_dbg(&pdev->dev, "Only use PIO mode\n"); > - else > + } else { > dev_warn(&pdev->dev, "Failed to setup DMA (%pe), only use PIO mode\n", > ERR_PTR(ret)); > + } > } > > /* Add I2C adapter */ > -- > 2.43.0 >
diff --git a/drivers/i2c/busses/i2c-imx.c b/drivers/i2c/busses/i2c-imx.c index 9e5d454d8318e..e6e09d5a2bbd4 100644 --- a/drivers/i2c/busses/i2c-imx.c +++ b/drivers/i2c/busses/i2c-imx.c @@ -1711,11 +1711,13 @@ static int i2c_imx_probe(struct platform_device *pdev) irq = platform_get_irq(pdev, 0); if (irq < 0) - return irq; + return dev_err_probe(&pdev->dev, irq, + "can't get IRQ\n"); base = devm_platform_get_and_ioremap_resource(pdev, 0, &res); if (IS_ERR(base)) - return PTR_ERR(base); + return dev_err_probe(&pdev->dev, PTR_ERR(base), + "can't get IO memory\n"); phy_addr = (dma_addr_t)res->start; i2c_imx = devm_kzalloc(&pdev->dev, sizeof(*i2c_imx), GFP_KERNEL); @@ -1810,13 +1812,15 @@ static int i2c_imx_probe(struct platform_device *pdev) */ ret = i2c_imx_dma_request(i2c_imx, phy_addr); if (ret) { - if (ret == -EPROBE_DEFER) + if (ret == -EPROBE_DEFER) { + dev_err_probe(&pdev->dev, ret, "can't get DMA channels\n"); goto clk_notifier_unregister; - else if (ret == -ENODEV) + } else if (ret == -ENODEV) { dev_dbg(&pdev->dev, "Only use PIO mode\n"); - else + } else { dev_warn(&pdev->dev, "Failed to setup DMA (%pe), only use PIO mode\n", ERR_PTR(ret)); + } } /* Add I2C adapter */
Especially DMA channels might not be available. Add some deferred probe messages accordingly. Signed-off-by: Alexander Stein <alexander.stein@ew.tq-group.com> --- drivers/i2c/busses/i2c-imx.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-)