All the mail mirrored from lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] tpm_tis_spi: set default probe function if device id not match
@ 2021-05-07 14:52 Liguang Zhang
  2021-05-08  2:01 ` Jarkko Sakkinen
  0 siblings, 1 reply; 7+ messages in thread
From: Liguang Zhang @ 2021-05-07 14:52 UTC (permalink / raw)
  To: Peter Huewe, Jarkko Sakkinen
  Cc: Jason Gunthorpe, linux-integrity, linux-kernel, Liguang Zhang

In DSDT table, TPM _CID was SMO0768, and no _HID definition. After a
kernel upgrade from 4.19 to 5.10, TPM probe function was changed which
causes device probe fails. In order to make newer kernel to be
compatible with the older acpi definition, it would be best set default
probe function.

Signed-off-by: Liguang Zhang <zhangliguang@linux.alibaba.com>
---
 drivers/char/tpm/tpm_tis_spi_main.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/drivers/char/tpm/tpm_tis_spi_main.c b/drivers/char/tpm/tpm_tis_spi_main.c
index 3856f6ebcb34..da632a582621 100644
--- a/drivers/char/tpm/tpm_tis_spi_main.c
+++ b/drivers/char/tpm/tpm_tis_spi_main.c
@@ -240,10 +240,14 @@ static int tpm_tis_spi_driver_probe(struct spi_device *spi)
 	tpm_tis_spi_probe_func probe_func;
 
 	probe_func = of_device_get_match_data(&spi->dev);
-	if (!probe_func && spi_dev_id)
-		probe_func = (tpm_tis_spi_probe_func)spi_dev_id->driver_data;
-	if (!probe_func)
-		return -ENODEV;
+	if (!probe_func) {
+		if (spi_dev_id) {
+			probe_func = (tpm_tis_spi_probe_func)spi_dev_id->driver_data;
+			if (!probe_func)
+				return -ENODEV;
+		} else
+			probe_func = tpm_tis_spi_probe;
+	}
 
 	return probe_func(spi);
 }
-- 
2.19.1.6.gb485710b


^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2021-05-12  1:19 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-07 14:52 [PATCH] tpm_tis_spi: set default probe function if device id not match Liguang Zhang
2021-05-08  2:01 ` Jarkko Sakkinen
2021-05-08  2:46   ` 乱石
2021-05-09 20:39     ` Jarkko Sakkinen
2021-05-10  1:23       ` 乱石
2021-05-12  1:07       ` 乱石
2021-05-12  1:19         ` Jarkko Sakkinen

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.