Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp372606pxj; Fri, 7 May 2021 10:25:32 -0700 (PDT) X-Google-Smtp-Source: ABdhPJydX626pD4TqPVc/t3YZlecIM1jl+1Db+tAFiwuddCMmq+fMKjdQ2utCx4oYM9aibNdYbhJ X-Received: by 2002:aa7:954d:0:b029:29f:d9a6:63d7 with SMTP id w13-20020aa7954d0000b029029fd9a663d7mr8139126pfq.58.1620408332383; Fri, 07 May 2021 10:25:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620408332; cv=none; d=google.com; s=arc-20160816; b=x1eusrQEjDQ0G77Fq9Hc29EZEL0x6Ro869Hxz6YuuNfNNhNqJ06IfT8FD5WxVNMP1X 4Zj08iQYzZfxQjCHonat5xFCq7gGFE+TJ2tq9iBI9dyW4aXDPBzE4l6LtxAuv8i4++p6 FCGbRjxNoj6d839fznwzCHxIzwJTIFRmd8w0vopLWg9N1RNHZ2jCtklAFa3HqKr8RDvS oWai2IKQdmjUY9sGQ9yVwrlUgVf8TWEBVHQk6Qzpef12WKKTj93w7Gb5Z6m2CmRJm8tb nSH4uRMd+2DsYMybY5JANznxWCD2J9nlD4IaXphf9ubOeOqhD8Zi49rL/ZuEsPtbae4E 0PvQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=taEXZEbfPcUNtUyV773TNS+hIApREO4rLq8lhvaxHLk=; b=pHengsir2KB0AVVjQlBg13n+I1MHYsIlotw9QOrUfyjTbFp3tngCvaTm+DeJ9NXXmy 7rPeL5Ucn80RfvkPXUtwnPXxh/30X190lcRf0TOTbg302goeG/JiGncA9QEB+eq4B1K5 1IcGSNDRC4hoKK6esCnNEYY9ALGkWz6LMjkECfNxE6Yubt+9DAOJHuvw1LzaQkyerXm5 A617TCI2qb9bvdmzYVrFQxCxTq338guaqqXNUjQA/nfyjIiuKwltTM47iXH5EguEv/1S U49xAmfdTc34/nELi8+/qL+3BqckywTgd+HkcsAm8ZweKptLZm8bkbgZ72ao7YT8vzhI vrig== 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 g3si7120770plg.67.2021.05.07.10.25.19; Fri, 07 May 2021 10:25:32 -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 S237704AbhEGOyJ (ORCPT + 99 others); Fri, 7 May 2021 10:54:09 -0400 Received: from out30-44.freemail.mail.aliyun.com ([115.124.30.44]:58752 "EHLO out30-44.freemail.mail.aliyun.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234601AbhEGOyI (ORCPT ); Fri, 7 May 2021 10:54:08 -0400 X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R101e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=e01e04420;MF=zhangliguang@linux.alibaba.com;NM=1;PH=DS;RN=6;SR=0;TI=SMTPD_---0UY3o8YN_1620399176; Received: from localhost(mailfrom:zhangliguang@linux.alibaba.com fp:SMTPD_---0UY3o8YN_1620399176) by smtp.aliyun-inc.com(127.0.0.1); Fri, 07 May 2021 22:53:06 +0800 From: Liguang Zhang To: Peter Huewe , Jarkko Sakkinen Cc: Jason Gunthorpe , linux-integrity@vger.kernel.org, linux-kernel@vger.kernel.org, Liguang Zhang Subject: [PATCH] tpm_tis_spi: set default probe function if device id not match Date: Fri, 7 May 2021 22:52:55 +0800 Message-Id: <20210507145255.44033-1-zhangliguang@linux.alibaba.com> X-Mailer: git-send-email 2.19.1.6.gb485710b MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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; + } else + probe_func = tpm_tis_spi_probe; + } return probe_func(spi); } -- 2.19.1.6.gb485710b