tpm: Remove useless priv field in struct tpm_vendor_specific
[cascardo/linux.git] / drivers / char / tpm / tpm_i2c_atmel.c
index 1b66da6..c37aa72 100644 (file)
@@ -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. */