* [PATCH] platform/chrome: cros_ec_typec: Defer probe on missing EC parent
@ 2025-06-10 15:37 Tomasz Michalec
2025-06-10 17:00 ` Abhishek Pandit-Subedi
2025-06-11 2:19 ` Tzung-Bi Shih
0 siblings, 2 replies; 3+ messages in thread
From: Tomasz Michalec @ 2025-06-10 15:37 UTC (permalink / raw)
To: Benson Leung, Abhishek Pandit-Subedi, Jameson Thies,
Andrei Kuchynski, Tzung-Bi Shih
Cc: Guenter Roeck, Konrad Adamczyk, chrome-platform, linux-kernel,
chromeos-krk-upstreaming, Tomasz Michalec
If cros_typec_probe is called before EC device is registered,
cros_typec_probe will fail. It may happen when cros-ec-typec.ko is
loaded before EC bus layer module (e.g. cros_ec_lpcs.ko,
cros_ec_spi.ko).
Return -EPROBE_DEFER when cros_typec_probe doesn't get EC device, so
the probe function can be called again after EC device is registered.
Signed-off-by: Tomasz Michalec <tmichalec@google.com>
---
drivers/platform/chrome/cros_ec_typec.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/platform/chrome/cros_ec_typec.c b/drivers/platform/chrome/cros_ec_typec.c
index 7678e3d05fd3..f437b594055c 100644
--- a/drivers/platform/chrome/cros_ec_typec.c
+++ b/drivers/platform/chrome/cros_ec_typec.c
@@ -1272,8 +1272,8 @@ static int cros_typec_probe(struct platform_device *pdev)
typec->ec = dev_get_drvdata(pdev->dev.parent);
if (!typec->ec) {
- dev_err(dev, "couldn't find parent EC device\n");
- return -ENODEV;
+ dev_warn(dev, "couldn't find parent EC device\n");
+ return -EPROBE_DEFER;
}
platform_set_drvdata(pdev, typec);
--
2.50.0.rc0.604.gd4ff7b7c86-goog
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] platform/chrome: cros_ec_typec: Defer probe on missing EC parent
2025-06-10 15:37 [PATCH] platform/chrome: cros_ec_typec: Defer probe on missing EC parent Tomasz Michalec
@ 2025-06-10 17:00 ` Abhishek Pandit-Subedi
2025-06-11 2:19 ` Tzung-Bi Shih
1 sibling, 0 replies; 3+ messages in thread
From: Abhishek Pandit-Subedi @ 2025-06-10 17:00 UTC (permalink / raw)
To: Tomasz Michalec
Cc: Benson Leung, Jameson Thies, Andrei Kuchynski, Tzung-Bi Shih,
Guenter Roeck, Konrad Adamczyk, chrome-platform, linux-kernel,
chromeos-krk-upstreaming
On Tue, Jun 10, 2025 at 8:39 AM Tomasz Michalec <tmichalec@google.com> wrote:
>
> If cros_typec_probe is called before EC device is registered,
> cros_typec_probe will fail. It may happen when cros-ec-typec.ko is
> loaded before EC bus layer module (e.g. cros_ec_lpcs.ko,
> cros_ec_spi.ko).
>
> Return -EPROBE_DEFER when cros_typec_probe doesn't get EC device, so
> the probe function can be called again after EC device is registered.
>
> Signed-off-by: Tomasz Michalec <tmichalec@google.com>
> ---
> drivers/platform/chrome/cros_ec_typec.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/platform/chrome/cros_ec_typec.c b/drivers/platform/chrome/cros_ec_typec.c
> index 7678e3d05fd3..f437b594055c 100644
> --- a/drivers/platform/chrome/cros_ec_typec.c
> +++ b/drivers/platform/chrome/cros_ec_typec.c
> @@ -1272,8 +1272,8 @@ static int cros_typec_probe(struct platform_device *pdev)
>
> typec->ec = dev_get_drvdata(pdev->dev.parent);
> if (!typec->ec) {
> - dev_err(dev, "couldn't find parent EC device\n");
> - return -ENODEV;
> + dev_warn(dev, "couldn't find parent EC device\n");
> + return -EPROBE_DEFER;
> }
>
> platform_set_drvdata(pdev, typec);
> --
> 2.50.0.rc0.604.gd4ff7b7c86-goog
>
Reviewed-by: Abhishek Pandit-Subedi <abhishekpandit@chromium.org>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] platform/chrome: cros_ec_typec: Defer probe on missing EC parent
2025-06-10 15:37 [PATCH] platform/chrome: cros_ec_typec: Defer probe on missing EC parent Tomasz Michalec
2025-06-10 17:00 ` Abhishek Pandit-Subedi
@ 2025-06-11 2:19 ` Tzung-Bi Shih
1 sibling, 0 replies; 3+ messages in thread
From: Tzung-Bi Shih @ 2025-06-11 2:19 UTC (permalink / raw)
To: Tomasz Michalec
Cc: Benson Leung, Abhishek Pandit-Subedi, Jameson Thies,
Andrei Kuchynski, Guenter Roeck, Konrad Adamczyk, chrome-platform,
linux-kernel, chromeos-krk-upstreaming
On Tue, Jun 10, 2025 at 05:37:47PM +0200, Tomasz Michalec wrote:
> If cros_typec_probe is called before EC device is registered,
> cros_typec_probe will fail. It may happen when cros-ec-typec.ko is
> loaded before EC bus layer module (e.g. cros_ec_lpcs.ko,
> cros_ec_spi.ko).
>
> Return -EPROBE_DEFER when cros_typec_probe doesn't get EC device, so
> the probe function can be called again after EC device is registered.
>
> [...]
Applied to
https://git.kernel.org/pub/scm/linux/kernel/git/chrome-platform/linux.git for-next
[1/1] platform/chrome: cros_ec_typec: Defer probe on missing EC parent
commit: 8866f4e557eba43e991f99711515217a95f62d2e
Thanks!
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-06-11 2:20 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-06-10 15:37 [PATCH] platform/chrome: cros_ec_typec: Defer probe on missing EC parent Tomasz Michalec
2025-06-10 17:00 ` Abhishek Pandit-Subedi
2025-06-11 2:19 ` Tzung-Bi Shih
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).