Message ID | 20230614051204.1614722-1-sarath.babu.naidu.gaddam@amd.com (mailing list archive) |
---|---|
State | Changes Requested |
Delegated to: | Netdev Maintainers |
Headers | show |
Series | [V2] ptp: clockmatrix: Add Defer probe if firmware load fails | expand |
On Wed, 14 Jun 2023 10:42:04 +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. The first-step fix should be to try to get the FW into initramfs. For that driver should specify MODULE_FIRMWARE(), which I don't see here.
diff --git a/drivers/ptp/ptp_clockmatrix.c b/drivers/ptp/ptp_clockmatrix.c index c9d451bf89e2..b3cb136257e3 100644 --- a/drivers/ptp/ptp_clockmatrix.c +++ b/drivers/ptp/ptp_clockmatrix.c @@ -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);
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> --- 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(-)