aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/char/tpm/tpm_i2c_nuvoton.c')
-rw-r--r--drivers/char/tpm/tpm_i2c_nuvoton.c22
1 files changed, 11 insertions, 11 deletions
diff --git a/drivers/char/tpm/tpm_i2c_nuvoton.c b/drivers/char/tpm/tpm_i2c_nuvoton.c
index 847f1597fe9b..a1e1474dda30 100644
--- a/drivers/char/tpm/tpm_i2c_nuvoton.c
+++ b/drivers/char/tpm/tpm_i2c_nuvoton.c
@@ -96,13 +96,13 @@ static s32 i2c_nuvoton_write_buf(struct i2c_client *client, u8 offset, u8 size,
96/* read TPM_STS register */ 96/* read TPM_STS register */
97static u8 i2c_nuvoton_read_status(struct tpm_chip *chip) 97static u8 i2c_nuvoton_read_status(struct tpm_chip *chip)
98{ 98{
99 struct i2c_client *client = to_i2c_client(chip->pdev); 99 struct i2c_client *client = to_i2c_client(chip->dev.parent);
100 s32 status; 100 s32 status;
101 u8 data; 101 u8 data;
102 102
103 status = i2c_nuvoton_read_buf(client, TPM_STS, 1, &data); 103 status = i2c_nuvoton_read_buf(client, TPM_STS, 1, &data);
104 if (status <= 0) { 104 if (status <= 0) {
105 dev_err(chip->pdev, "%s() error return %d\n", __func__, 105 dev_err(&chip->dev, "%s() error return %d\n", __func__,
106 status); 106 status);
107 data = TPM_STS_ERR_VAL; 107 data = TPM_STS_ERR_VAL;
108 } 108 }
@@ -127,13 +127,13 @@ static s32 i2c_nuvoton_write_status(struct i2c_client *client, u8 data)
127/* write commandReady to TPM_STS register */ 127/* write commandReady to TPM_STS register */
128static void i2c_nuvoton_ready(struct tpm_chip *chip) 128static void i2c_nuvoton_ready(struct tpm_chip *chip)
129{ 129{
130 struct i2c_client *client = to_i2c_client(chip->pdev); 130 struct i2c_client *client = to_i2c_client(chip->dev.parent);
131 s32 status; 131 s32 status;
132 132
133 /* this causes the current command to be aborted */ 133 /* this causes the current command to be aborted */
134 status = i2c_nuvoton_write_status(client, TPM_STS_COMMAND_READY); 134 status = i2c_nuvoton_write_status(client, TPM_STS_COMMAND_READY);
135 if (status < 0) 135 if (status < 0)
136 dev_err(chip->pdev, 136 dev_err(&chip->dev,
137 "%s() fail to write TPM_STS.commandReady\n", __func__); 137 "%s() fail to write TPM_STS.commandReady\n", __func__);
138} 138}
139 139
@@ -212,7 +212,7 @@ static int i2c_nuvoton_wait_for_stat(struct tpm_chip *chip, u8 mask, u8 value,
212 return 0; 212 return 0;
213 } while (time_before(jiffies, stop)); 213 } while (time_before(jiffies, stop));
214 } 214 }
215 dev_err(chip->pdev, "%s(%02x, %02x) -> timeout\n", __func__, mask, 215 dev_err(&chip->dev, "%s(%02x, %02x) -> timeout\n", __func__, mask,
216 value); 216 value);
217 return -ETIMEDOUT; 217 return -ETIMEDOUT;
218} 218}
@@ -240,7 +240,7 @@ static int i2c_nuvoton_recv_data(struct i2c_client *client,
240 &chip->vendor.read_queue) == 0) { 240 &chip->vendor.read_queue) == 0) {
241 burst_count = i2c_nuvoton_get_burstcount(client, chip); 241 burst_count = i2c_nuvoton_get_burstcount(client, chip);
242 if (burst_count < 0) { 242 if (burst_count < 0) {
243 dev_err(chip->pdev, 243 dev_err(&chip->dev,
244 "%s() fail to read burstCount=%d\n", __func__, 244 "%s() fail to read burstCount=%d\n", __func__,
245 burst_count); 245 burst_count);
246 return -EIO; 246 return -EIO;
@@ -249,12 +249,12 @@ static int i2c_nuvoton_recv_data(struct i2c_client *client,
249 rc = i2c_nuvoton_read_buf(client, TPM_DATA_FIFO_R, 249 rc = i2c_nuvoton_read_buf(client, TPM_DATA_FIFO_R,
250 bytes2read, &buf[size]); 250 bytes2read, &buf[size]);
251 if (rc < 0) { 251 if (rc < 0) {
252 dev_err(chip->pdev, 252 dev_err(&chip->dev,
253 "%s() fail on i2c_nuvoton_read_buf()=%d\n", 253 "%s() fail on i2c_nuvoton_read_buf()=%d\n",
254 __func__, rc); 254 __func__, rc);
255 return -EIO; 255 return -EIO;
256 } 256 }
257 dev_dbg(chip->pdev, "%s(%d):", __func__, bytes2read); 257 dev_dbg(&chip->dev, "%s(%d):", __func__, bytes2read);
258 size += bytes2read; 258 size += bytes2read;
259 } 259 }
260 260
@@ -264,7 +264,7 @@ static int i2c_nuvoton_recv_data(struct i2c_client *client,
264/* Read TPM command results */ 264/* Read TPM command results */
265static int i2c_nuvoton_recv(struct tpm_chip *chip, u8 *buf, size_t count) 265static int i2c_nuvoton_recv(struct tpm_chip *chip, u8 *buf, size_t count)
266{ 266{
267 struct device *dev = chip->pdev; 267 struct device *dev = chip->dev.parent;
268 struct i2c_client *client = to_i2c_client(dev); 268 struct i2c_client *client = to_i2c_client(dev);
269 s32 rc; 269 s32 rc;
270 int expected, status, burst_count, retries, size = 0; 270 int expected, status, burst_count, retries, size = 0;
@@ -334,7 +334,7 @@ static int i2c_nuvoton_recv(struct tpm_chip *chip, u8 *buf, size_t count)
334 break; 334 break;
335 } 335 }
336 i2c_nuvoton_ready(chip); 336 i2c_nuvoton_ready(chip);
337 dev_dbg(chip->pdev, "%s() -> %d\n", __func__, size); 337 dev_dbg(&chip->dev, "%s() -> %d\n", __func__, size);
338 return size; 338 return size;
339} 339}
340 340
@@ -347,7 +347,7 @@ static int i2c_nuvoton_recv(struct tpm_chip *chip, u8 *buf, size_t count)
347 */ 347 */
348static int i2c_nuvoton_send(struct tpm_chip *chip, u8 *buf, size_t len) 348static int i2c_nuvoton_send(struct tpm_chip *chip, u8 *buf, size_t len)
349{ 349{
350 struct device *dev = chip->pdev; 350 struct device *dev = chip->dev.parent;
351 struct i2c_client *client = to_i2c_client(dev); 351 struct i2c_client *client = to_i2c_client(dev);
352 u32 ordinal; 352 u32 ordinal;
353 size_t count = 0; 353 size_t count = 0;