public inbox for linux-integrity@vger.kernel.org
 help / color / mirror / Atom feed
From: Jarkko Sakkinen <jarkko@kernel.org>
To: Rob Herring <robh@kernel.org>, Peter Huewe <peterhuewe@gmx.de>,
	Jason Gunthorpe <jgg@ziepe.ca>
Cc: linux-integrity@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] tpm: nuvoton: Use i2c_get_match_data()
Date: Tue, 10 Oct 2023 15:35:44 +0300	[thread overview]
Message-ID: <276b9295c119c1e54471398a63fa33ade66b9975.camel@kernel.org> (raw)
In-Reply-To: <20231006214246.337426-1-robh@kernel.org>

On Fri, 2023-10-06 at 16:42 -0500, Rob Herring wrote:
> Use preferred i2c_get_match_data() instead of of_match_device() to
> get the driver match data. With this, adjust the includes to explicitly
> include the correct headers.
> 
> Signed-off-by: Rob Herring <robh@kernel.org>

Perhaps self-evident but to have a closed story would be nice touch
to write down the reason for the switch.

BR, Jarkko

> ---
>  drivers/char/tpm/tpm_i2c_nuvoton.c | 15 ++++-----------
>  1 file changed, 4 insertions(+), 11 deletions(-)
> 
> diff --git a/drivers/char/tpm/tpm_i2c_nuvoton.c b/drivers/char/tpm/tpm_i2c_nuvoton.c
> index d7be03c41098..5490f7e0fa43 100644
> --- a/drivers/char/tpm/tpm_i2c_nuvoton.c
> +++ b/drivers/char/tpm/tpm_i2c_nuvoton.c
> @@ -19,7 +19,8 @@
>  #include <linux/interrupt.h>
>  #include <linux/wait.h>
>  #include <linux/i2c.h>
> -#include <linux/of_device.h>
> +#include <linux/of.h>
> +#include <linux/property.h>
>  #include "tpm.h"
>  
>  /* I2C interface offsets */
> @@ -524,7 +525,6 @@ static int get_vid(struct i2c_client *client, u32 *res)
>  
>  static int i2c_nuvoton_probe(struct i2c_client *client)
>  {
> -       const struct i2c_device_id *id = i2c_client_get_device_id(client);
>         int rc;
>         struct tpm_chip *chip;
>         struct device *dev = &client->dev;
> @@ -546,15 +546,8 @@ static int i2c_nuvoton_probe(struct i2c_client *client)
>         if (!priv)
>                 return -ENOMEM;
>  
> -       if (dev->of_node) {
> -               const struct of_device_id *of_id;
> -
> -               of_id = of_match_device(dev->driver->of_match_table, dev);
> -               if (of_id && of_id->data == OF_IS_TPM2)
> -                       chip->flags |= TPM_CHIP_FLAG_TPM2;
> -       } else
> -               if (id->driver_data == I2C_IS_TPM2)
> -                       chip->flags |= TPM_CHIP_FLAG_TPM2;
> +       if (i2c_get_match_data(client))
> +               chip->flags |= TPM_CHIP_FLAG_TPM2;
>  
>         init_waitqueue_head(&priv->read_queue);
>  

No complains about the code change.

BR, Jarkko


      reply	other threads:[~2023-10-10 12:35 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-06 21:42 [PATCH] tpm: nuvoton: Use i2c_get_match_data() Rob Herring
2023-10-10 12:35 ` Jarkko Sakkinen [this message]

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=276b9295c119c1e54471398a63fa33ade66b9975.camel@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=robh@kernel.org \
    /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