public inbox for linux-integrity@vger.kernel.org
 help / color / mirror / Atom feed
* [RESEND PATCH] tpm: nuvoton: Use i2c_get_match_data()
@ 2023-11-15 21:02 Rob Herring
  2023-11-15 21:37 ` Jarkko Sakkinen
  0 siblings, 1 reply; 3+ messages in thread
From: Rob Herring @ 2023-11-15 21:02 UTC (permalink / raw)
  To: Peter Huewe, Jarkko Sakkinen, Jason Gunthorpe
  Cc: linux-integrity, linux-kernel

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>
---
 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);
 
-- 
2.42.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [RESEND PATCH] tpm: nuvoton: Use i2c_get_match_data()
  2023-11-15 21:02 [RESEND PATCH] tpm: nuvoton: Use i2c_get_match_data() Rob Herring
@ 2023-11-15 21:37 ` Jarkko Sakkinen
  2023-12-16  9:47   ` Lukas Wunner
  0 siblings, 1 reply; 3+ messages in thread
From: Jarkko Sakkinen @ 2023-11-15 21:37 UTC (permalink / raw)
  To: Rob Herring, Peter Huewe, Jason Gunthorpe; +Cc: linux-integrity, linux-kernel

On Wed Nov 15, 2023 at 11:02 PM EET, 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>
> ---
>  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);
>  

OK, apologies for having to do a resend. I'll pick this, thanks!

Reviewed-by: Jarkko Sakkinen <jarkko@kernel.org>

BR, Jarkko

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [RESEND PATCH] tpm: nuvoton: Use i2c_get_match_data()
  2023-11-15 21:37 ` Jarkko Sakkinen
@ 2023-12-16  9:47   ` Lukas Wunner
  0 siblings, 0 replies; 3+ messages in thread
From: Lukas Wunner @ 2023-12-16  9:47 UTC (permalink / raw)
  To: Jarkko Sakkinen
  Cc: Rob Herring, Peter Huewe, Jason Gunthorpe, linux-integrity,
	linux-kernel

On Wed, Nov 15, 2023 at 11:37:55PM +0200, Jarkko Sakkinen wrote:
> On Wed Nov 15, 2023 at 11:02 PM EET, 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>
> > ---
> >  drivers/char/tpm/tpm_i2c_nuvoton.c | 15 ++++-----------
[...]
> 
> OK, apologies for having to do a resend. I'll pick this, thanks!

This is now duplicated as commit ebf2d4e8e582 in Jarkko's tree and
commit 319e31686b9f in Rob's tree:

https://git.kernel.org/pub/scm/linux/kernel/git/jarkko/linux-tpmdd.git/commit/?h=next&id=ebf2d4e8e582a444e12eff7d4a59d87f22fb3481

https://git.kernel.org/pub/scm/linux/kernel/git/robh/linux.git/commit/?h=for-next&id=319e31686b9f2bd669fd5c3a63b8ccf2efd9186f

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-12-16  9:56 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-11-15 21:02 [RESEND PATCH] tpm: nuvoton: Use i2c_get_match_data() Rob Herring
2023-11-15 21:37 ` Jarkko Sakkinen
2023-12-16  9:47   ` Lukas Wunner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox