Message ID | 20210205202022.4515-2-dirk@gouders.net (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | tpm_tis: handle -EPROBE_DEFER in tpm_tis_plat_probe() | expand |
On Fri, Feb 05, 2021 at 09:20:22PM +0100, Dirk Gouders wrote: > tpm_tis does not consider -EPROBE_DEFER in tpm_tis_plat_probe(). > Instead, without notification it falls back to polling mode if > platform_get_irq_optional() returns a negative value. > > This could lead to different behavior depending on wether tpm_tis was > compiled builtin or as a module; in the latter case > platform_get_irq_optional() often if not always returns a valid IRQ > number on the first attempt. > > Harmonize builtin and module behavior by returning -EPROBE_DEFER, > effectively putting the device on the deferred probe list for later > probe attempts. > > Signed-off-by: Dirk Gouders <dirk@gouders.net> This would be best picked to James' patch set. > --- > drivers/char/tpm/tpm_tis.c | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/drivers/char/tpm/tpm_tis.c b/drivers/char/tpm/tpm_tis.c > index 4ed6e660273a..4cf863704aa1 100644 > --- a/drivers/char/tpm/tpm_tis.c > +++ b/drivers/char/tpm/tpm_tis.c > @@ -320,6 +320,9 @@ static int tpm_tis_plat_probe(struct platform_device *pdev) > > tpm_info.irq = platform_get_irq_optional(pdev, 0); > if (tpm_info.irq <= 0) { > + if (tpm_info.irq == -EPROBE_DEFER) > + /* Enter deferred probe list and try again, later. */ > + return -EPROBE_DEFER; > if (pdev != force_pdev) > tpm_info.irq = -1; > else > -- > 2.26.2 > > /Jarkko
diff --git a/drivers/char/tpm/tpm_tis.c b/drivers/char/tpm/tpm_tis.c index 4ed6e660273a..4cf863704aa1 100644 --- a/drivers/char/tpm/tpm_tis.c +++ b/drivers/char/tpm/tpm_tis.c @@ -320,6 +320,9 @@ static int tpm_tis_plat_probe(struct platform_device *pdev) tpm_info.irq = platform_get_irq_optional(pdev, 0); if (tpm_info.irq <= 0) { + if (tpm_info.irq == -EPROBE_DEFER) + /* Enter deferred probe list and try again, later. */ + return -EPROBE_DEFER; if (pdev != force_pdev) tpm_info.irq = -1; else
tpm_tis does not consider -EPROBE_DEFER in tpm_tis_plat_probe(). Instead, without notification it falls back to polling mode if platform_get_irq_optional() returns a negative value. This could lead to different behavior depending on wether tpm_tis was compiled builtin or as a module; in the latter case platform_get_irq_optional() often if not always returns a valid IRQ number on the first attempt. Harmonize builtin and module behavior by returning -EPROBE_DEFER, effectively putting the device on the deferred probe list for later probe attempts. Signed-off-by: Dirk Gouders <dirk@gouders.net> --- drivers/char/tpm/tpm_tis.c | 3 +++ 1 file changed, 3 insertions(+)