Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp4032685pxj; Tue, 11 May 2021 18:21:28 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx57jp6xn2pyg4Nlo+XN07BexHQBnPxmrdg7Krz1iZbiZ2E2t16JrcmxG7J0vWyYrOUY38e X-Received: by 2002:a9d:7e91:: with SMTP id m17mr28140541otp.192.1620782487861; Tue, 11 May 2021 18:21:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620782487; cv=none; d=google.com; s=arc-20160816; b=aX7Lcx+aYBJ75tK6JY+oqWkd0LR6bdMbha4ZDrUZT5OvdgzOj/RjgJOnYYdmK5xhbJ NYN5++N6h/hWWAhySivbbaLuGGC04PhiA8GHk0MYEUeNLuLb1yBrOrxgDbPLq1FYnRNH 3ab/XGl3HmWr4Vu92h0z0D30DXBs7MkRPBfLq3u8fkP4JdaC2CtBL07Gnit20deOWuYw KnVNt+FxL0z0/hBMU65fF2WYGgO3XDZxe9qa7I4MRsZbUxaOHR1993yoyRmhwmr9cnKq awEyamPHfrupp8g0tkxQv1VPorZ8Eh2psCR9MIxq/ul/dgE2Aj8f2W6KHfufeuAP7QUD H6Qw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=EMYSdyWR5g2u1odUGRVr3cEzmMOukOXzfhGuL8q2f0Q=; b=GCtU3fEIE7f9SoJYf/1QL3H591Uc3tf9+DaUy99doK359eiENIl4aNejfASEsCHOyR 58gA5khkymkridSS/uG0YBNd3L8QqtZRFHjr9x52t5+HTBJFbgyC5wg5jrJ7msCgeh5B AoydTZleV5zyPH2sSKSl6F8aO84Uey2RrsQPNUzxPfRHbZJaXYwitNNKD7Lw9yqtt1ue Twbb2p+TYsPA7pBfLuUyPNj5ThZJISViy+h05jRNMFd3KHj7fgWGZhghpg1pxWQIbRer XzEwNLXGwP7azgBy7R8DF4WUPj4v9SaCfyyEZ3oGpzEwXtF7xJcZ+TCol3JhXsyKBUV/ nGzA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="hu4f/XrK"; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id x37si19996301otr.173.2021.05.11.18.21.13; Tue, 11 May 2021 18:21:27 -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; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="hu4f/XrK"; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229932AbhELBU0 (ORCPT + 99 others); Tue, 11 May 2021 21:20:26 -0400 Received: from mail.kernel.org ([198.145.29.99]:34602 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229736AbhELBU0 (ORCPT ); Tue, 11 May 2021 21:20:26 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id BD78861002; Wed, 12 May 2021 01:19:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1620782359; bh=mY19LPLeJ5R4ZXUBmKxvee5mTkZMWOs5YxEaXsA9M5o=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=hu4f/XrKnjc5mk9X/HR24vZ0TZG8qEkvvYf66vQZ6F1/Inmc0svpj5mSqQTM+o1Bq HsP/H/hkO6mOlFdU0w/Fy5p7qBOf6kGsygnx2A6Zr0EVNuRWrIitD8Zy/4x6L16F0l aQlIm1oWhhZt1O2AXprOCRsHMKtXe/e6dcA875JCt+MaQLDZhjEx4idjzfHPx0OcuW ABKlMfAU+12IW8fBEN3Zr6c+OpaxpfebhxUtZeCR0II0nTjqDWtLRCp4jIIYw/eQn9 i3f3fPeAWs8brS4/MS9+49lkUZcg4qnApbNTPAtCx8VxaeQVKBz1QCMKQzt4HLzlA9 BeYiIq0GYK1zA== Date: Wed, 12 May 2021 04:19:16 +0300 From: Jarkko Sakkinen To: =?utf-8?B?5Lmx55+z?= Cc: Peter Huewe , Jason Gunthorpe , linux-integrity@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] tpm_tis_spi: set default probe function if device id not match Message-ID: References: <20210507145255.44033-1-zhangliguang@linux.alibaba.com> <0ec3ed60-6967-c14a-d1f3-0ff80c9d5003@linux.alibaba.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <0ec3ed60-6967-c14a-d1f3-0ff80c9d5003@linux.alibaba.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, May 12, 2021 at 09:07:56AM +0800, 乱石 wrote: > 在 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? > > 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