[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID:
<AM0PR0402MB3937C3087A22A1DB8FAE91ECE80C2@AM0PR0402MB3937.eurprd04.prod.outlook.com>
Date: Wed, 25 Dec 2024 10:56:34 +0000
From: Carlos Song <carlos.song@....com>
To: Andi Shyti <andi.shyti@...nel.org>
CC: "o.rempel@...gutronix.de" <o.rempel@...gutronix.de>,
"kernel@...gutronix.de" <kernel@...gutronix.de>, "shawnguo@...nel.org"
<shawnguo@...nel.org>, "s.hauer@...gutronix.de" <s.hauer@...gutronix.de>,
"festevam@...il.com" <festevam@...il.com>, "linux-i2c@...r.kernel.org"
<linux-i2c@...r.kernel.org>, "imx@...ts.linux.dev" <imx@...ts.linux.dev>,
"linux-arm-kernel@...ts.infradead.org"
<linux-arm-kernel@...ts.infradead.org>, "linux-kernel@...r.kernel.org"
<linux-kernel@...r.kernel.org>, Clark Wang <xiaoning.wang@....com>, Ahmad
Fatoum <a.fatoum@...gutronix.de>
Subject: Re: [PATCH v6] i2c: imx: support DMA defer probing
> -----Original Message-----
> From: Andi Shyti <andi.shyti@...nel.org>
> Sent: Tuesday, December 24, 2024 4:33 PM
> To: Carlos Song <carlos.song@....com>
> Cc: o.rempel@...gutronix.de; kernel@...gutronix.de; shawnguo@...nel.org;
> s.hauer@...gutronix.de; festevam@...il.com; linux-i2c@...r.kernel.org;
> imx@...ts.linux.dev; linux-arm-kernel@...ts.infradead.org;
> linux-kernel@...r.kernel.org; Clark Wang <xiaoning.wang@....com>; Ahmad
> Fatoum <a.fatoum@...gutronix.de>
> Subject: [EXT] Re: [PATCH v6] i2c: imx: support DMA defer probing
>
> Caution: This is an external email. Please take care when clicking links or
> opening attachments. When in doubt, report the message using the 'Report this
> email' button
>
>
> > > > @@ -1802,6 +1803,18 @@ static int i2c_imx_probe(struct
> > > > platform_device
> > > *pdev)
> > > > if (ret == -EPROBE_DEFER)
> > > > goto clk_notifier_unregister;
> > > >
> > > > + /* As we can always fall back to PIO, let's ignore the error
> > > > + setting up
> > > DMA. */
> > > > + ret = i2c_imx_dma_request(i2c_imx, phy_addr);
> > > > + if (ret) {
> > > > + if (ret == -EPROBE_DEFER)
> > > > + goto clk_notifier_unregister;
> > > > + else if (ret == -ENODEV)
> > > > + dev_dbg(&pdev->dev, "Only use PIO mode\n");
> > > > + else
> > > > + dev_err(&pdev->dev, "Failed to setup DMA
> > > > + (%pe),
> > > only use PIO mode\n",
> > > > + ERR_PTR(ret));
> > >
> > > My question here is not just about the use of dev_err vs
> > > dev_err_probe, but why don't we exit the probe if we get an error.
> > >
> > > We should use PIO only in case of ENODEV, in all the other cases I
> > > think we should just leave. E.g. why don't we exit if we meet ret ==
> -ENOMEM?
> >
> > Hi, Andi
> >
> > Thank you! From my point, I2C is critical bus so it should be available as much
> as possible.
> > -ENOMEM or other unknown errors all are from i2c_imx_dma_request(). So
> error happened in enable DMA mode process.
>
> OK, makes sense, it's the idea of "let things fail on their own, I'll move forward as
> much as I can"; we need to be aware of the choice. Please add a comment
> above.
>
> But then it's not an error, but a warning. With errors we bail out, with warnings
> we tell users that something went wrong.
>
> Sorry for keeping you on this point for so long, but do you mind swapping this
> dev_err in dev_warn, with a comment explaining the reason we decided not to
> leave?
>
Hi, Andi
It doesn't matter! I am very happy to receive so many suggestions to help enhance the patch.
I will do following things at V7:
1. Change dev_err to dev_warn
2. Use a more detailed comment to explain why we decided not to leave when meet DMA error.
Thank you.
Carlos
> Thanks,
> Andi
Powered by blists - more mailing lists