tpm: Remove redundant dev_set_drvdata
authorJason Gunthorpe <jgunthorpe@obsidianresearch.com>
Sat, 5 Oct 2013 17:40:19 +0000 (11:40 -0600)
committerPeter Huewe <peterhuewe@gmx.de>
Tue, 22 Oct 2013 17:42:35 +0000 (19:42 +0200)
TPM drivers should not call dev_set_drvdata (or aliases), only the core
code is allowed to call dev_set_drvdata, and it does it during
tpm_register_hardware.

These extra sets are harmless, but are an anti-pattern that many drivers
have copied.

Signed-off-by: Jason Gunthorpe <jgunthorpe@obsidianresearch.com>
Reviewed-by: Joel Schopp <jschopp@linux.vnet.ibm.com>
Reviewed-by: Peter Huewe <peterhuewe@gmx.de>
Acked-by: Ashley Lai <adlai@linux.vnet.ibm.com>
Signed-off-by: Peter Huewe <peterhuewe@gmx.de>
drivers/char/tpm/tpm_i2c_infineon.c
drivers/char/tpm/tpm_i2c_stm_st33.c
drivers/char/tpm/xen-tpmfront.c

index b8735de8ce956a3d19fd3ac5b9a5df77c57d3a22..e33d8e551eff17a035deb46dfb7828f1f9aff9f2 100644 (file)
@@ -685,7 +685,6 @@ out_vendor:
        chip->dev->release = NULL;
        chip->release = NULL;
        tpm_dev.client = NULL;
-       dev_set_drvdata(chip->dev, chip);
 out_err:
        return rc;
 }
@@ -766,7 +765,6 @@ static int tpm_tis_i2c_remove(struct i2c_client *client)
        chip->dev->release = NULL;
        chip->release = NULL;
        tpm_dev.client = NULL;
-       dev_set_drvdata(chip->dev, chip);
 
        return 0;
 }
index 5bb8e2ddd3b3b9b3a51557a605e8675a8f5c3e64..1c68d9317abad7dd1d72a64a6946b733c26e8dbb 100644 (file)
@@ -746,8 +746,6 @@ tpm_st33_i2c_probe(struct i2c_client *client, const struct i2c_device_id *id)
 
        tpm_get_timeouts(chip);
 
-       i2c_set_clientdata(client, chip);
-
        dev_info(chip->dev, "TPM I2C Initialized\n");
        return 0;
 _irq_set:
index 7a7929ba26588dbf07d014bf8bb3cf8f55da509a..9b483705694e9a70e60af545b43b70738bb59ce3 100644 (file)
@@ -386,8 +386,6 @@ static int tpmfront_probe(struct xenbus_device *dev,
 
        tpm_get_timeouts(priv->chip);
 
-       dev_set_drvdata(&dev->dev, priv->chip);
-
        return rv;
 }