From: Liguang Zhang zhangliguang@linux.alibaba.com
mainline inclusion from mainline-v5.14-rc1 commit 114e43371c58 category: feature bugzilla: https://gitee.com/openeuler/kernel/issues/I4UACK CVE: NA
Reference: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?i...
-----------------------------------------------------------------------
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 Signed-off-by: Jiefeng Ou oujiefeng@h-partners.com Reviewed-by: Yicong Yang yangyicong@huawei.com Reviewed-by: Jay Fang f.fangjian@huawei.com Acked-by: Xinwei Kongkong.kongxinwei@hisilicon.com Acked-by: Xie XiuQi xiexiuqi@huawei.com Signed-off-by: Zheng Zengkai zhengzengkai@huawei.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 d64bea3298a2..aaa59a00eeae 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); }