Skip to contentSkip to conversation

ptp: clockmatrix: Add Defer probe if firmware load fails

PATCH Vincent Cheng 1 participant 1 message Jun 18, 2023

Subsystems (2)
lore
Share & tools
lore

Vincent Cheng

author Reviewed-by
#0 lore raw
Quoted 9 lines · Vincent Cheng

-----Original Message-----
From: Sarath Babu Naidu Gaddam <[email protected]>
Sent: Wednesday, June 14, 2023 1:12 AM
To: [email protected]; [email protected]
Cc: [email protected]; [email protected]; [email protected]; Vincent Cheng <[email protected]>; [email protected]; [email protected]; [email protected]
Subject: [PATCH V2] ptp: clockmatrix: Add Defer probe if firmware load fails

Quoted 3 lines

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.

Quoted 29 lines

---
Changes in V2:
1) Added mutex_unlock(idtcm->lock); before returning EPROBE_DEFER.
2) Moved failure log after defer probe.

---
 drivers/ptp/ptp_clockmatrix.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/ptp/ptp_clockmatrix.c +6 -2
@@ -2424,8 +2424,13 @@ static int idtcm_probe(struct platform_device *pdev)
 
 	err = idtcm_load_firmware(idtcm, &pdev->dev);
 
-	if (err)
+	if (err) {
+		if (err == -ENOENT) {
+			mutex_unlock(idtcm->lock);
+			return -EPROBE_DEFER;
+		}
 		dev_warn(idtcm->dev, "loading firmware failed with %d", err);
+	}
 
 	wait_for_chip_ready(idtcm);
 
--

2.25.1