From f0538cd58dce004bfe55aaf18bd77bd096dfa838 Mon Sep 17 00:00:00 2001 From: Jon Hunter Date: Mon, 12 Feb 2024 15:25:19 +0000 Subject: [PATCH] camera: Handle probe deferral Probing a driver can be deferred if a resource is not ready and this is accomplished by returning -EPROBE_DEFER from the .probe function. This tells to kernel to probe the driver again some time later. When probing a driver is deferred it is not necessary to print an error message because this is an expected error case. To avoid printing an error message on probe deferral, the dev_err_probe() function can be used which will only print an error if the error code is not -EPROBE_DEFER. Therefore, update the camera drivers to use dev_err_probe() to avoid printing an error message when -EPROBE_DEFER if returned from ICC. This change will also cause the probing of the rtcpu-debug driver to be deferred if -EPROBE_DEFER is returned and prevent the rtcpu-debug driver from being probed at all if an real error is encountered. Bug 4496044 Change-Id: I8a5313750e11b4bd661191c0c544c39e43478089 Signed-off-by: Jon Hunter Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3084829 Tested-by: mobile promotions Reviewed-by: mobile promotions --- drivers/platform/tegra/rtcpu/rtcpu-debug.c | 10 ++++------ drivers/video/tegra/host/vi/vi5.c | 7 +++---- 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/drivers/platform/tegra/rtcpu/rtcpu-debug.c b/drivers/platform/tegra/rtcpu/rtcpu-debug.c index a56baec2..e17c04d0 100644 --- a/drivers/platform/tegra/rtcpu/rtcpu-debug.c +++ b/drivers/platform/tegra/rtcpu/rtcpu-debug.c @@ -1,5 +1,5 @@ // SPDX-License-Identifier: GPL-2.0 -// Copyright (c) 2022-2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved. +// SPDX-FileCopyrightText: Copyright (c) 2022-2024 NVIDIA CORPORATION & AFFILIATES. All rights reserved. #include "soc/tegra/camrtc-dbg-messages.h" @@ -1882,11 +1882,9 @@ static int camrtc_debug_probe(struct tegra_ivc_channel *ch) } crd->icc_path = devm_of_icc_get(crd->mem_devices[0], "write"); - if (IS_ERR(crd->icc_path)) { - dev_err(dev, "failed to get icc path for rtcpu, err: %ld\n", - PTR_ERR(crd->icc_path)); - crd->icc_path = NULL; - } + if (IS_ERR(crd->icc_path)) + return dev_err_probe(dev, PTR_ERR(crd->icc_path), + "failed to get icc write handle\n"); if (camrtc_debug_populate(ch)) return -ENOMEM; diff --git a/drivers/video/tegra/host/vi/vi5.c b/drivers/video/tegra/host/vi/vi5.c index 2669db05..5dcfdb37 100644 --- a/drivers/video/tegra/host/vi/vi5.c +++ b/drivers/video/tegra/host/vi/vi5.c @@ -252,10 +252,9 @@ static int vi5_probe(struct platform_device *pdev) vi5 = pdata->private_data; vi5->icc_write = devm_of_icc_get(dev, "write"); - if (IS_ERR(vi5->icc_write)) { - dev_err(dev, "failed to get icc write handle\n"); - return PTR_ERR(vi5->icc_write); - } + if (IS_ERR(vi5->icc_write)) + return dev_err_probe(&pdev->dev, PTR_ERR(vi5->icc_write), + "failed to get icc write handle\n"); err = nvhost_client_device_get_resources(pdev); if (err)