* [PATCH] ptp: clockmatrix: Add Defer probe if firmware load fails
@ 2023-06-12 10:00 Sarath Babu Naidu Gaddam
2023-06-12 13:16 ` Simon Horman
2023-06-12 14:22 ` Andrew Lunn
0 siblings, 2 replies; 3+ messages in thread
From: Sarath Babu Naidu Gaddam @ 2023-06-12 10:00 UTC (permalink / raw)
To: richardcochran, netdev
Cc: linux-kernel, vincent.cheng.xh, harini.katakam, git,
sarath.babu.naidu.gaddam
Clock matrix driver can be probed before the rootfs containing
firmware/initialization .bin is available. The current driver
throws a warning and proceeds to execute probe even when firmware
is not ready. Instead, defer probe and wait for the .bin file to
be available.
Signed-off-by: Sarath Babu Naidu Gaddam <sarath.babu.naidu.gaddam@amd.com>
---
drivers/ptp/ptp_clockmatrix.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/drivers/ptp/ptp_clockmatrix.c b/drivers/ptp/ptp_clockmatrix.c
index c9d451bf89e2..96328dfb7e55 100644
--- a/drivers/ptp/ptp_clockmatrix.c
+++ b/drivers/ptp/ptp_clockmatrix.c
@@ -2424,9 +2424,13 @@ static int idtcm_probe(struct platform_device *pdev)
err = idtcm_load_firmware(idtcm, &pdev->dev);
- if (err)
+ if (err) {
dev_warn(idtcm->dev, "loading firmware failed with %d", err);
+ if (err == -ENOENT)
+ return -EPROBE_DEFER;
+ }
+
wait_for_chip_ready(idtcm);
if (idtcm->tod_mask) {
--
2.25.1
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] ptp: clockmatrix: Add Defer probe if firmware load fails
2023-06-12 10:00 [PATCH] ptp: clockmatrix: Add Defer probe if firmware load fails Sarath Babu Naidu Gaddam
@ 2023-06-12 13:16 ` Simon Horman
2023-06-12 14:22 ` Andrew Lunn
1 sibling, 0 replies; 3+ messages in thread
From: Simon Horman @ 2023-06-12 13:16 UTC (permalink / raw)
To: Sarath Babu Naidu Gaddam
Cc: richardcochran, netdev, linux-kernel, vincent.cheng.xh,
harini.katakam, git
On Mon, Jun 12, 2023 at 03:30:44PM +0530, Sarath Babu Naidu Gaddam wrote:
> Clock matrix driver can be probed before the rootfs containing
> firmware/initialization .bin is available. The current driver
> throws a warning and proceeds to execute probe even when firmware
> is not ready. Instead, defer probe and wait for the .bin file to
> be available.
>
> Signed-off-by: Sarath Babu Naidu Gaddam <sarath.babu.naidu.gaddam@amd.com>
> ---
> drivers/ptp/ptp_clockmatrix.c | 6 +++++-
> 1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/ptp/ptp_clockmatrix.c b/drivers/ptp/ptp_clockmatrix.c
> index c9d451bf89e2..96328dfb7e55 100644
> --- a/drivers/ptp/ptp_clockmatrix.c
> +++ b/drivers/ptp/ptp_clockmatrix.c
> @@ -2424,9 +2424,13 @@ static int idtcm_probe(struct platform_device *pdev)
>
> err = idtcm_load_firmware(idtcm, &pdev->dev);
>
> - if (err)
> + if (err) {
> dev_warn(idtcm->dev, "loading firmware failed with %d", err);
>
> + if (err == -ENOENT)
> + return -EPROBE_DEFER;
Hi Sarath,
Smatch reports that idtcm->lock is leaked here.
> + }
> +
> wait_for_chip_ready(idtcm);
>
> if (idtcm->tod_mask) {
> --
> 2.25.1
>
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] ptp: clockmatrix: Add Defer probe if firmware load fails
2023-06-12 10:00 [PATCH] ptp: clockmatrix: Add Defer probe if firmware load fails Sarath Babu Naidu Gaddam
2023-06-12 13:16 ` Simon Horman
@ 2023-06-12 14:22 ` Andrew Lunn
1 sibling, 0 replies; 3+ messages in thread
From: Andrew Lunn @ 2023-06-12 14:22 UTC (permalink / raw)
To: Sarath Babu Naidu Gaddam
Cc: richardcochran, netdev, linux-kernel, vincent.cheng.xh,
harini.katakam, git
On Mon, Jun 12, 2023 at 03:30:44PM +0530, Sarath Babu Naidu Gaddam wrote:
> Clock matrix driver can be probed before the rootfs containing
> firmware/initialization .bin is available. The current driver
> throws a warning and proceeds to execute probe even when firmware
> is not ready. Instead, defer probe and wait for the .bin file to
> be available.
>
> Signed-off-by: Sarath Babu Naidu Gaddam <sarath.babu.naidu.gaddam@amd.com>
> ---
> drivers/ptp/ptp_clockmatrix.c | 6 +++++-
> 1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/ptp/ptp_clockmatrix.c b/drivers/ptp/ptp_clockmatrix.c
> index c9d451bf89e2..96328dfb7e55 100644
> --- a/drivers/ptp/ptp_clockmatrix.c
> +++ b/drivers/ptp/ptp_clockmatrix.c
> @@ -2424,9 +2424,13 @@ static int idtcm_probe(struct platform_device *pdev)
>
> err = idtcm_load_firmware(idtcm, &pdev->dev);
>
> - if (err)
> + if (err) {
> dev_warn(idtcm->dev, "loading firmware failed with %d", err);
>
> + if (err == -ENOENT)
> + return -EPROBE_DEFER;
> + }
Maybe move the dev_warn() after the test so you don't spam the logs
with failures which are not yet real failures?
Andrew
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2023-06-12 14:26 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-06-12 10:00 [PATCH] ptp: clockmatrix: Add Defer probe if firmware load fails Sarath Babu Naidu Gaddam
2023-06-12 13:16 ` Simon Horman
2023-06-12 14:22 ` Andrew Lunn
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®