diff options
author | Christophe Ricard <christophe.ricard@gmail.com> | 2016-03-31 22:57:00 +0200 |
---|---|---|
committer | Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com> | 2016-06-25 17:26:35 +0300 |
commit | 9e0d39d8a6a0a8805d05fba22e3fbe80b5c8c4cb (patch) | |
tree | b070f2d85c9c98bb35202bce5cc4c09ea9308aed /drivers/char/tpm/tpm_i2c_atmel.c | |
parent | af782f339a5d6ea202652c9f06880e1a28c43813 (diff) | |
download | blackbird-op-linux-9e0d39d8a6a0a8805d05fba22e3fbe80b5c8c4cb.tar.gz blackbird-op-linux-9e0d39d8a6a0a8805d05fba22e3fbe80b5c8c4cb.zip |
tpm: Remove useless priv field in struct tpm_vendor_specific
Remove useless priv field in struct tpm_vendor_specific and take benefit
of chip->dev.driver_data. As priv is the latest field available in
struct tpm_vendor_specific, remove any reference to that structure.
Signed-off-by: Christophe Ricard <christophe-h.ricard@st.com>
Reviewed-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
Signed-off-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
Diffstat (limited to 'drivers/char/tpm/tpm_i2c_atmel.c')
-rw-r--r-- | drivers/char/tpm/tpm_i2c_atmel.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/drivers/char/tpm/tpm_i2c_atmel.c b/drivers/char/tpm/tpm_i2c_atmel.c index 1b66da626fc8..c37aa7259f76 100644 --- a/drivers/char/tpm/tpm_i2c_atmel.c +++ b/drivers/char/tpm/tpm_i2c_atmel.c @@ -51,7 +51,7 @@ struct priv_data { static int i2c_atmel_send(struct tpm_chip *chip, u8 *buf, size_t len) { - struct priv_data *priv = chip->vendor.priv; + struct priv_data *priv = dev_get_drvdata(&chip->dev); struct i2c_client *client = to_i2c_client(chip->dev.parent); s32 status; @@ -70,7 +70,7 @@ static int i2c_atmel_send(struct tpm_chip *chip, u8 *buf, size_t len) static int i2c_atmel_recv(struct tpm_chip *chip, u8 *buf, size_t count) { - struct priv_data *priv = chip->vendor.priv; + struct priv_data *priv = dev_get_drvdata(&chip->dev); struct i2c_client *client = to_i2c_client(chip->dev.parent); struct tpm_output_header *hdr = (struct tpm_output_header *)priv->buffer; @@ -111,7 +111,7 @@ static void i2c_atmel_cancel(struct tpm_chip *chip) static u8 i2c_atmel_read_status(struct tpm_chip *chip) { - struct priv_data *priv = chip->vendor.priv; + struct priv_data *priv = dev_get_drvdata(&chip->dev); struct i2c_client *client = to_i2c_client(chip->dev.parent); int rc; @@ -155,6 +155,7 @@ static int i2c_atmel_probe(struct i2c_client *client, { struct tpm_chip *chip; struct device *dev = &client->dev; + struct priv_data *priv; if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C)) return -ENODEV; @@ -163,9 +164,8 @@ static int i2c_atmel_probe(struct i2c_client *client, if (IS_ERR(chip)) return PTR_ERR(chip); - chip->vendor.priv = devm_kzalloc(dev, sizeof(struct priv_data), - GFP_KERNEL); - if (!chip->vendor.priv) + priv = devm_kzalloc(dev, sizeof(struct priv_data), GFP_KERNEL); + if (!priv) return -ENOMEM; /* Default timeouts */ @@ -174,6 +174,8 @@ static int i2c_atmel_probe(struct i2c_client *client, chip->timeout_c = msecs_to_jiffies(TPM_I2C_SHORT_TIMEOUT); chip->timeout_d = msecs_to_jiffies(TPM_I2C_SHORT_TIMEOUT); + dev_set_drvdata(&chip->dev, priv); + /* There is no known way to probe for this device, and all version * information seems to be read via TPM commands. Thus we rely on the * TPM startup process in the common code to detect the device. */ |