Re: [PATCH] tpm_tis_spi: set default probe function if device id not match
From: Jarkko Sakkinen <jarkko@kernel.org>
Date: 2021-05-12 01:19:21
Also in:
lkml
On Wed, May 12, 2021 at 09:07:56AM +0800, 乱石 wrote:
在 2021/5/10 4:39, Jarkko Sakkinen 写道:quoted
On Sat, May 08, 2021 at 10:46:57AM +0800, 乱石 wrote:quoted
Hi, 在 2021/5/8 10:01, Jarkko Sakkinen 写道:quoted
On Fri, May 07, 2021 at 10:52:55PM +0800, Liguang Zhang wrote:quoted
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 <redacted> --- 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;Perhaps also hear fallback to tpm_tis_spi_probe?Yes, I do not think of a good way. Do you have any suggestions?So, I just think that when you have this part: if (!probe_func) { if (spi_dev_id) { probe_func = (tpm_tis_spi_probe_func)spi_dev_id->driver_data; if (!probe_func) return -ENODEV; Why in here would not you also want to fallback to tpm_tis_spi_probe?Sorry to trouble you, do you have a good way to resolve the compatible problem caused by kernel update (4.19 -> 5.10) ?
I think I'll take this as it is. I'll apply it to my tree and take it as part of next pr. Reviewed-by: Jarkko Sakkinen <jarkko@kernel.org> /Jarkko