mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 06/15] tpm: Remove redundant dev_set_drvdata
@ 2013-10-22 18:00 Peter Huewe
  2013-10-22 18:00 ` [PATCH 07/15] tpm: st33: Remove chip->data_buffer access from this driver Peter Huewe
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: Peter Huewe @ 2013-10-22 18:00 UTC (permalink / raw)
  To: james.l.morris, tpmdd-devel, adlai
  Cc: linux-kernel, Jason Gunthorpe, Peter Huewe

From: Jason Gunthorpe <jgunthorpe@obsidianresearch.com>

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 |    2 --
 drivers/char/tpm/tpm_i2c_stm_st33.c |    2 --
 drivers/char/tpm/xen-tpmfront.c     |    2 --
 3 files changed, 0 insertions(+), 6 deletions(-)

diff --git a/drivers/char/tpm/tpm_i2c_infineon.c b/drivers/char/tpm/tpm_i2c_infineon.c
index b8735de..e33d8e5 100644
--- a/drivers/char/tpm/tpm_i2c_infineon.c
+++ b/drivers/char/tpm/tpm_i2c_infineon.c
@@ -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;
 }
diff --git a/drivers/char/tpm/tpm_i2c_stm_st33.c b/drivers/char/tpm/tpm_i2c_stm_st33.c
index 5bb8e2d..1c68d93 100644
--- a/drivers/char/tpm/tpm_i2c_stm_st33.c
+++ b/drivers/char/tpm/tpm_i2c_stm_st33.c
@@ -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:
diff --git a/drivers/char/tpm/xen-tpmfront.c b/drivers/char/tpm/xen-tpmfront.c
index 7a7929b..9b48370 100644
--- a/drivers/char/tpm/xen-tpmfront.c
+++ b/drivers/char/tpm/xen-tpmfront.c
@@ -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;
 }
 
-- 
1.7.5.4


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

end of thread, other threads:[~2013-10-22 18:03 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-10-22 18:00 [PATCH 06/15] tpm: Remove redundant dev_set_drvdata Peter Huewe
2013-10-22 18:00 ` [PATCH 07/15] tpm: st33: Remove chip->data_buffer access from this driver Peter Huewe
2013-10-22 18:00 ` [PATCH 08/15] tpm: Remove tpm_show_caps_1_2 Peter Huewe
2013-10-22 18:00 ` [PATCH 09/15] tpm: cleanup checkpatch warnings Peter Huewe
2013-10-22 18:00 ` [PATCH 10/15] tpm: Rename tpm.c to tpm-interface.c Peter Huewe
2013-10-22 18:00 ` [PATCH 11/15] tpm: Merge the tpm-bios module with tpm.o Peter Huewe
2013-10-22 18:00 ` [PATCH 12/15] tpm: Add support for the Nuvoton NPCT501 I2C TPM Peter Huewe
2013-10-22 18:00 ` [PATCH 13/15] tpm: Add support for Atmel I2C TPMs Peter Huewe
2013-10-22 18:00 ` [PATCH 14/15] tpm: Fix module name description in Kconfig for tpm_i2c_infineon Peter Huewe
2013-10-22 18:00 ` [PATCH 15/15] tpm: use tabs instead of whitespaces in Kconfig Peter Huewe

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

all inboxes | Powered by JetHome®