linux-integrity.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jarkko Sakkinen <jarkko@kernel.org>
To: 乱石 <zhangliguang@linux.alibaba.com>
Cc: Peter Huewe <peterhuewe@gmx.de>, Jason Gunthorpe <jgg@ziepe.ca>,
	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
Date: Sun, 9 May 2021 23:39:12 +0300	[thread overview]
Message-ID: <YJhIcIXMFj/LcYwu@kernel.org> (raw)
In-Reply-To: <e74fd54f-1700-4b06-a320-c0e257666565@linux.alibaba.com>

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 <zhangliguang@linux.alibaba.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 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?

/Jarkko

  reply	other threads:[~2021-05-09 20:39 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-07 14:52 [PATCH] tpm_tis_spi: set default probe function if device id not match Liguang Zhang
2021-05-08  2:01 ` Jarkko Sakkinen
2021-05-08  2:46   ` 乱石
2021-05-09 20:39     ` Jarkko Sakkinen [this message]
2021-05-10  1:23       ` 乱石
2021-05-12  1:07       ` 乱石
2021-05-12  1:19         ` Jarkko Sakkinen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YJhIcIXMFj/LcYwu@kernel.org \
    --to=jarkko@kernel.org \
    --cc=jgg@ziepe.ca \
    --cc=linux-integrity@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=peterhuewe@gmx.de \
    --cc=zhangliguang@linux.alibaba.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).