Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp2184093pxj; Sun, 9 May 2021 18:26:26 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzPrti9eXQaLTHm0ACtIdELELuMLAcrzOlXBBLQjvxXqBPivreRyCGNMuLB7bRKgnjbtUg8 X-Received: by 2002:aa7:d74c:: with SMTP id a12mr26648497eds.257.1620609985872; Sun, 09 May 2021 18:26:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620609985; cv=none; d=google.com; s=arc-20160816; b=IqnKmqffnanIZPjKFRb6xq8EcyeHCqaqOTs8/pjgCdo3bvvNmYdkwaTPxWOj6CUHF8 IDIQN+M3CDTO/7X1heGR/wCAe1s73BA2kQ0yQEfv1h9al0Z4FdulkNdOEiygDURnQkep PHX1cHVOfMZ83T3apafDbi5Y56XmpjkPApCLaNEkgUgaUfndhHtmGCEdFWuza0vOFymM rzFl77nomhgkrkfOif6fRDdcR4VB4vFnvaXzIMEwebBP+47sJKJZR5tAeSFnXNmYpM1B fVFgpMKqT6DcZM+TDrOxu5fHjp6fxeFyaYb3un9fkA7kcRHdd9SlDob8u09+BYTZ+OI2 FFbg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to :mime-version:user-agent:date:message-id:from:references:cc:to :subject; bh=bEOXCFmBcZs0e/t9HxAmh63n+73UtmuqWMmGR0NfUbU=; b=c6abXybudoFoArya/QXnqVDYSgqUoE2r/j3nWQXZu1yyC3nyd8XeWcPt2qIdGNigb2 aUlaTHd3488N5ADvYK9VgJ7hAENWFpzaz+SR3oO7lSZGNyOOa+0DT8iPk8aRkcTpJHLn H74fk0VrRSqXMe9Lc80erWI8sY4rw7CfMzS4zj4ZxqsS/9QeDRU1N2OURAmXBfJRTQkj sKi5JLzLEwJ9iOI1Y3RvZH1o92Uu10T70lZe9l+pR9n+n2jFa0W9/eeKndXImSiJ5nR1 V7Uuh5P2Uw/BSo5FBb07WGEX5TkN8uAi6SCKUbGIOI/e5gOUyVIDeUjvVoUt2nyMHFZd rvbg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id b10si12172269ejd.716.2021.05.09.18.26.02; Sun, 09 May 2021 18:26:25 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230082AbhEJBZc (ORCPT + 99 others); Sun, 9 May 2021 21:25:32 -0400 Received: from out30-56.freemail.mail.aliyun.com ([115.124.30.56]:35494 "EHLO out30-56.freemail.mail.aliyun.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229941AbhEJBZb (ORCPT ); Sun, 9 May 2021 21:25:31 -0400 X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R661e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=alimailimapcm10staff010182156082;MF=zhangliguang@linux.alibaba.com;NM=1;PH=DS;RN=5;SR=0;TI=SMTPD_---0UYHfDw4_1620609865; Received: from 30.225.35.240(mailfrom:zhangliguang@linux.alibaba.com fp:SMTPD_---0UYHfDw4_1620609865) by smtp.aliyun-inc.com(127.0.0.1); Mon, 10 May 2021 09:24:25 +0800 Subject: Re: [PATCH] tpm_tis_spi: set default probe function if device id not match To: Jarkko Sakkinen Cc: Peter Huewe , Jason Gunthorpe , linux-integrity@vger.kernel.org, linux-kernel@vger.kernel.org References: <20210507145255.44033-1-zhangliguang@linux.alibaba.com> From: =?UTF-8?B?5Lmx55+z?= Message-ID: <765f9bfc-db7c-5db7-16cd-50156b2579e9@linux.alibaba.com> Date: Mon, 10 May 2021 09:23:43 +0800 User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.10.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 在 2021/5/10 4:39, Jarkko Sakkinen 写道: > On Sat, May 08, 2021 at 10:46:57AM +0800, 乱石 wrote: >> Hi, >> >> 在 2021/5/8 10:01, Jarkko Sakkinen 写道: >>> On Fri, May 07, 2021 at 10:52:55PM +0800, Liguang Zhang wrote: >>>> 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 >>>> --- >>>> 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? Thanks, I got it. If spi_dev_id exists, prob_func is NULL, I think it's not reasonable , but not neccessarily correct. In this scenario, maybe can also fallback to tpm_tis_spi_probe. Liguang > > /Jarkko