Skip to content

Commit a4c7d79

Browse files
robherringjarkkojs
authored andcommitted
tpm: nuvoton: Use i2c_get_match_data()
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 <[email protected]> Reviewed-by: Jarkko Sakkinen <[email protected]> Signed-off-by: Jarkko Sakkinen <[email protected]>
1 parent 9f8413c commit a4c7d79

File tree

1 file changed

+4
-11
lines changed

1 file changed

+4
-11
lines changed

drivers/char/tpm/tpm_i2c_nuvoton.c

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@
1919
#include <linux/interrupt.h>
2020
#include <linux/wait.h>
2121
#include <linux/i2c.h>
22-
#include <linux/of_device.h>
22+
#include <linux/of.h>
23+
#include <linux/property.h>
2324
#include "tpm.h"
2425

2526
/* I2C interface offsets */
@@ -524,7 +525,6 @@ static int get_vid(struct i2c_client *client, u32 *res)
524525

525526
static int i2c_nuvoton_probe(struct i2c_client *client)
526527
{
527-
const struct i2c_device_id *id = i2c_client_get_device_id(client);
528528
int rc;
529529
struct tpm_chip *chip;
530530
struct device *dev = &client->dev;
@@ -546,15 +546,8 @@ static int i2c_nuvoton_probe(struct i2c_client *client)
546546
if (!priv)
547547
return -ENOMEM;
548548

549-
if (dev->of_node) {
550-
const struct of_device_id *of_id;
551-
552-
of_id = of_match_device(dev->driver->of_match_table, dev);
553-
if (of_id && of_id->data == OF_IS_TPM2)
554-
chip->flags |= TPM_CHIP_FLAG_TPM2;
555-
} else
556-
if (id->driver_data == I2C_IS_TPM2)
557-
chip->flags |= TPM_CHIP_FLAG_TPM2;
549+
if (i2c_get_match_data(client))
550+
chip->flags |= TPM_CHIP_FLAG_TPM2;
558551

559552
init_waitqueue_head(&priv->read_queue);
560553

0 commit comments

Comments
 (0)