summaryrefslogtreecommitdiff
path: root/drivers/char
diff options
context:
space:
mode:
authorLiguang Zhang <zhangliguang@linux.alibaba.com>2021-05-07 22:52:55 +0800
committerJarkko Sakkinen <jarkko@kernel.org>2021-06-23 16:51:03 +0300
commit114e43371c58992c3ceece219cc359f16314b2c9 (patch)
tree1407f9732fc032cf6f18dd6b0147ceeb4273627d /drivers/char
parent7937bd532fe6f6342206b3e002bd791bf25085e0 (diff)
tpm_tis_spi: set default probe function if device id not match
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> Reviewed-by: Jarkko Sakkinen <jarkko@kernel.org> Signed-off-by: Jarkko Sakkinen <jarkko@kernel.org>
Diffstat (limited to 'drivers/char')
-rw-r--r--drivers/char/tpm/tpm_tis_spi_main.c12
1 files 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);
}