aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char
diff options
context:
space:
mode:
authorJarkko Sakkinen <jarkko.sakkinen@linux.intel.com>2014-12-12 14:46:36 -0500
committerPeter Huewe <peterhuewe@gmx.de>2015-01-17 08:00:09 -0500
commit71ed848fd791bc0b53a1b7a04f29eb9e994c7cbb (patch)
tree415a3e0afdc68aa03598441005b3d60850fb5d6f /drivers/char
parent0dc553652102c55a43eb1ab52e2049e478469f53 (diff)
tpm: rename chip->dev to chip->pdev
Rename chip->dev to chip->pdev to make it explicit that this not the character device but actually represents the platform device. Signed-off-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com> Reviewed-by: Jasob Gunthorpe <jason.gunthorpe@obsidianresearch.com> Reviewed-by: Stefan Berger <stefanb@linux.vnet.ibm.com> Reviewed-by: Peter Huewe <peterhuewe@gmx.de> Tested-by: Scot Doyle <lkml14@scotdoyle.com> Tested-by: Peter Huewe <peterhuewe@gmx.de> Signed-off-by: Peter Huewe <peterhuewe@gmx.de>
Diffstat (limited to 'drivers/char')
-rw-r--r--drivers/char/tpm/tpm-chip.c4
-rw-r--r--drivers/char/tpm/tpm-dev.c10
-rw-r--r--drivers/char/tpm/tpm-interface.c29
-rw-r--r--drivers/char/tpm/tpm-sysfs.c6
-rw-r--r--drivers/char/tpm/tpm.h4
-rw-r--r--drivers/char/tpm/tpm_atmel.c14
-rw-r--r--drivers/char/tpm/tpm_i2c_atmel.c16
-rw-r--r--drivers/char/tpm/tpm_i2c_infineon.c6
-rw-r--r--drivers/char/tpm/tpm_i2c_nuvoton.c22
-rw-r--r--drivers/char/tpm/tpm_i2c_stm_st33.c18
-rw-r--r--drivers/char/tpm/tpm_infineon.c22
-rw-r--r--drivers/char/tpm/tpm_nsc.c20
-rw-r--r--drivers/char/tpm/tpm_ppi.c4
-rw-r--r--drivers/char/tpm/tpm_tis.c14
14 files changed, 95 insertions, 94 deletions
diff --git a/drivers/char/tpm/tpm-chip.c b/drivers/char/tpm/tpm-chip.c
index 64102de91ca3..e72b042aa867 100644
--- a/drivers/char/tpm/tpm-chip.c
+++ b/drivers/char/tpm/tpm-chip.c
@@ -45,7 +45,7 @@ struct tpm_chip *tpm_chip_find_get(int chip_num)
45 if (chip_num != TPM_ANY_NUM && chip_num != pos->dev_num) 45 if (chip_num != TPM_ANY_NUM && chip_num != pos->dev_num)
46 continue; 46 continue;
47 47
48 if (try_module_get(pos->dev->driver->owner)) { 48 if (try_module_get(pos->pdev->driver->owner)) {
49 chip = pos; 49 chip = pos;
50 break; 50 break;
51 } 51 }
@@ -110,7 +110,7 @@ struct tpm_chip *tpmm_chip_alloc(struct device *dev,
110 110
111 scnprintf(chip->devname, sizeof(chip->devname), "tpm%d", chip->dev_num); 111 scnprintf(chip->devname, sizeof(chip->devname), "tpm%d", chip->dev_num);
112 112
113 chip->dev = dev; 113 chip->pdev = dev;
114 devm_add_action(dev, tpmm_chip_remove, chip); 114 devm_add_action(dev, tpmm_chip_remove, chip);
115 dev_set_drvdata(dev, chip); 115 dev_set_drvdata(dev, chip);
116 116
diff --git a/drivers/char/tpm/tpm-dev.c b/drivers/char/tpm/tpm-dev.c
index d9b774e02a1f..356832146788 100644
--- a/drivers/char/tpm/tpm-dev.c
+++ b/drivers/char/tpm/tpm-dev.c
@@ -63,7 +63,7 @@ static int tpm_open(struct inode *inode, struct file *file)
63 * by the check of is_open variable, which is protected 63 * by the check of is_open variable, which is protected
64 * by driver_lock. */ 64 * by driver_lock. */
65 if (test_and_set_bit(0, &chip->is_open)) { 65 if (test_and_set_bit(0, &chip->is_open)) {
66 dev_dbg(chip->dev, "Another process owns this TPM\n"); 66 dev_dbg(chip->pdev, "Another process owns this TPM\n");
67 return -EBUSY; 67 return -EBUSY;
68 } 68 }
69 69
@@ -81,7 +81,7 @@ static int tpm_open(struct inode *inode, struct file *file)
81 INIT_WORK(&priv->work, timeout_work); 81 INIT_WORK(&priv->work, timeout_work);
82 82
83 file->private_data = priv; 83 file->private_data = priv;
84 get_device(chip->dev); 84 get_device(chip->pdev);
85 return 0; 85 return 0;
86} 86}
87 87
@@ -168,7 +168,7 @@ static int tpm_release(struct inode *inode, struct file *file)
168 file->private_data = NULL; 168 file->private_data = NULL;
169 atomic_set(&priv->data_pending, 0); 169 atomic_set(&priv->data_pending, 0);
170 clear_bit(0, &priv->chip->is_open); 170 clear_bit(0, &priv->chip->is_open);
171 put_device(priv->chip->dev); 171 put_device(priv->chip->pdev);
172 kfree(priv); 172 kfree(priv);
173 return 0; 173 return 0;
174} 174}
@@ -193,12 +193,12 @@ int tpm_dev_add_device(struct tpm_chip *chip)
193 chip->vendor.miscdev.minor = MISC_DYNAMIC_MINOR; 193 chip->vendor.miscdev.minor = MISC_DYNAMIC_MINOR;
194 194
195 chip->vendor.miscdev.name = chip->devname; 195 chip->vendor.miscdev.name = chip->devname;
196 chip->vendor.miscdev.parent = chip->dev; 196 chip->vendor.miscdev.parent = chip->pdev;
197 197
198 rc = misc_register(&chip->vendor.miscdev); 198 rc = misc_register(&chip->vendor.miscdev);
199 if (rc) { 199 if (rc) {
200 chip->vendor.miscdev.name = NULL; 200 chip->vendor.miscdev.name = NULL;
201 dev_err(chip->dev, 201 dev_err(chip->pdev,
202 "unable to misc_register %s, minor %d err=%d\n", 202 "unable to misc_register %s, minor %d err=%d\n",
203 chip->vendor.miscdev.name, 203 chip->vendor.miscdev.name,
204 chip->vendor.miscdev.minor, rc); 204 chip->vendor.miscdev.minor, rc);
diff --git a/drivers/char/tpm/tpm-interface.c b/drivers/char/tpm/tpm-interface.c
index 4dbed1e45abd..e2af28fd63cb 100644
--- a/drivers/char/tpm/tpm-interface.c
+++ b/drivers/char/tpm/tpm-interface.c
@@ -343,7 +343,7 @@ ssize_t tpm_transmit(struct tpm_chip *chip, const char *buf,
343 if (count == 0) 343 if (count == 0)
344 return -ENODATA; 344 return -ENODATA;
345 if (count > bufsiz) { 345 if (count > bufsiz) {
346 dev_err(chip->dev, 346 dev_err(chip->pdev,
347 "invalid count value %x %zx\n", count, bufsiz); 347 "invalid count value %x %zx\n", count, bufsiz);
348 return -E2BIG; 348 return -E2BIG;
349 } 349 }
@@ -352,7 +352,7 @@ ssize_t tpm_transmit(struct tpm_chip *chip, const char *buf,
352 352
353 rc = chip->ops->send(chip, (u8 *) buf, count); 353 rc = chip->ops->send(chip, (u8 *) buf, count);
354 if (rc < 0) { 354 if (rc < 0) {
355 dev_err(chip->dev, 355 dev_err(chip->pdev,
356 "tpm_transmit: tpm_send: error %zd\n", rc); 356 "tpm_transmit: tpm_send: error %zd\n", rc);
357 goto out; 357 goto out;
358 } 358 }
@@ -368,7 +368,7 @@ ssize_t tpm_transmit(struct tpm_chip *chip, const char *buf,
368 goto out_recv; 368 goto out_recv;
369 369
370 if (chip->ops->req_canceled(chip, status)) { 370 if (chip->ops->req_canceled(chip, status)) {
371 dev_err(chip->dev, "Operation Canceled\n"); 371 dev_err(chip->pdev, "Operation Canceled\n");
372 rc = -ECANCELED; 372 rc = -ECANCELED;
373 goto out; 373 goto out;
374 } 374 }
@@ -378,14 +378,14 @@ ssize_t tpm_transmit(struct tpm_chip *chip, const char *buf,
378 } while (time_before(jiffies, stop)); 378 } while (time_before(jiffies, stop));
379 379
380 chip->ops->cancel(chip); 380 chip->ops->cancel(chip);
381 dev_err(chip->dev, "Operation Timed out\n"); 381 dev_err(chip->pdev, "Operation Timed out\n");
382 rc = -ETIME; 382 rc = -ETIME;
383 goto out; 383 goto out;
384 384
385out_recv: 385out_recv:
386 rc = chip->ops->recv(chip, (u8 *) buf, bufsiz); 386 rc = chip->ops->recv(chip, (u8 *) buf, bufsiz);
387 if (rc < 0) 387 if (rc < 0)
388 dev_err(chip->dev, 388 dev_err(chip->pdev,
389 "tpm_transmit: tpm_recv: error %zd\n", rc); 389 "tpm_transmit: tpm_recv: error %zd\n", rc);
390out: 390out:
391 mutex_unlock(&chip->tpm_mutex); 391 mutex_unlock(&chip->tpm_mutex);
@@ -411,7 +411,8 @@ ssize_t tpm_transmit_cmd(struct tpm_chip *chip, void *cmd,
411 411
412 err = be32_to_cpu(header->return_code); 412 err = be32_to_cpu(header->return_code);
413 if (err != 0 && desc) 413 if (err != 0 && desc)
414 dev_err(chip->dev, "A TPM error (%d) occurred %s\n", err, desc); 414 dev_err(chip->pdev, "A TPM error (%d) occurred %s\n", err,
415 desc);
415 416
416 return err; 417 return err;
417} 418}
@@ -505,7 +506,7 @@ int tpm_get_timeouts(struct tpm_chip *chip)
505 if (rc == TPM_ERR_INVALID_POSTINIT) { 506 if (rc == TPM_ERR_INVALID_POSTINIT) {
506 /* The TPM is not started, we are the first to talk to it. 507 /* The TPM is not started, we are the first to talk to it.
507 Execute a startup command. */ 508 Execute a startup command. */
508 dev_info(chip->dev, "Issuing TPM_STARTUP"); 509 dev_info(chip->pdev, "Issuing TPM_STARTUP");
509 if (tpm_startup(chip, TPM_ST_CLEAR)) 510 if (tpm_startup(chip, TPM_ST_CLEAR))
510 return rc; 511 return rc;
511 512
@@ -517,7 +518,7 @@ int tpm_get_timeouts(struct tpm_chip *chip)
517 NULL); 518 NULL);
518 } 519 }
519 if (rc) { 520 if (rc) {
520 dev_err(chip->dev, 521 dev_err(chip->pdev,
521 "A TPM error (%zd) occurred attempting to determine the timeouts\n", 522 "A TPM error (%zd) occurred attempting to determine the timeouts\n",
522 rc); 523 rc);
523 goto duration; 524 goto duration;
@@ -556,7 +557,7 @@ int tpm_get_timeouts(struct tpm_chip *chip)
556 557
557 /* Report adjusted timeouts */ 558 /* Report adjusted timeouts */
558 if (chip->vendor.timeout_adjusted) { 559 if (chip->vendor.timeout_adjusted) {
559 dev_info(chip->dev, 560 dev_info(chip->pdev,
560 HW_ERR "Adjusting reported timeouts: A %lu->%luus B %lu->%luus C %lu->%luus D %lu->%luus\n", 561 HW_ERR "Adjusting reported timeouts: A %lu->%luus B %lu->%luus C %lu->%luus D %lu->%luus\n",
561 old_timeout[0], new_timeout[0], 562 old_timeout[0], new_timeout[0],
562 old_timeout[1], new_timeout[1], 563 old_timeout[1], new_timeout[1],
@@ -603,7 +604,7 @@ duration:
603 chip->vendor.duration[TPM_MEDIUM] *= 1000; 604 chip->vendor.duration[TPM_MEDIUM] *= 1000;
604 chip->vendor.duration[TPM_LONG] *= 1000; 605 chip->vendor.duration[TPM_LONG] *= 1000;
605 chip->vendor.duration_adjusted = true; 606 chip->vendor.duration_adjusted = true;
606 dev_info(chip->dev, "Adjusting TPM timeout parameters."); 607 dev_info(chip->pdev, "Adjusting TPM timeout parameters.");
607 } 608 }
608 return 0; 609 return 0;
609} 610}
@@ -760,7 +761,7 @@ int tpm_do_selftest(struct tpm_chip *chip)
760 * around 300ms while the self test is ongoing, keep trying 761 * around 300ms while the self test is ongoing, keep trying
761 * until the self test duration expires. */ 762 * until the self test duration expires. */
762 if (rc == -ETIME) { 763 if (rc == -ETIME) {
763 dev_info(chip->dev, HW_ERR "TPM command timed out during continue self test"); 764 dev_info(chip->pdev, HW_ERR "TPM command timed out during continue self test");
764 msleep(delay_msec); 765 msleep(delay_msec);
765 continue; 766 continue;
766 } 767 }
@@ -770,7 +771,7 @@ int tpm_do_selftest(struct tpm_chip *chip)
770 771
771 rc = be32_to_cpu(cmd.header.out.return_code); 772 rc = be32_to_cpu(cmd.header.out.return_code);
772 if (rc == TPM_ERR_DISABLED || rc == TPM_ERR_DEACTIVATED) { 773 if (rc == TPM_ERR_DISABLED || rc == TPM_ERR_DEACTIVATED) {
773 dev_info(chip->dev, 774 dev_info(chip->pdev,
774 "TPM is disabled/deactivated (0x%X)\n", rc); 775 "TPM is disabled/deactivated (0x%X)\n", rc);
775 /* TPM is disabled and/or deactivated; driver can 776 /* TPM is disabled and/or deactivated; driver can
776 * proceed and TPM does handle commands for 777 * proceed and TPM does handle commands for
@@ -918,10 +919,10 @@ int tpm_pm_suspend(struct device *dev)
918 } 919 }
919 920
920 if (rc) 921 if (rc)
921 dev_err(chip->dev, 922 dev_err(chip->pdev,
922 "Error (%d) sending savestate before suspend\n", rc); 923 "Error (%d) sending savestate before suspend\n", rc);
923 else if (try > 0) 924 else if (try > 0)
924 dev_warn(chip->dev, "TPM savestate took %dms\n", 925 dev_warn(chip->pdev, "TPM savestate took %dms\n",
925 try * TPM_TIMEOUT_RETRY); 926 try * TPM_TIMEOUT_RETRY);
926 927
927 return rc; 928 return rc;
diff --git a/drivers/char/tpm/tpm-sysfs.c b/drivers/char/tpm/tpm-sysfs.c
index 8ecb052e290d..ee66fd4673f3 100644
--- a/drivers/char/tpm/tpm-sysfs.c
+++ b/drivers/char/tpm/tpm-sysfs.c
@@ -284,16 +284,16 @@ static const struct attribute_group tpm_dev_group = {
284int tpm_sysfs_add_device(struct tpm_chip *chip) 284int tpm_sysfs_add_device(struct tpm_chip *chip)
285{ 285{
286 int err; 286 int err;
287 err = sysfs_create_group(&chip->dev->kobj, 287 err = sysfs_create_group(&chip->pdev->kobj,
288 &tpm_dev_group); 288 &tpm_dev_group);
289 289
290 if (err) 290 if (err)
291 dev_err(chip->dev, 291 dev_err(chip->pdev,
292 "failed to create sysfs attributes, %d\n", err); 292 "failed to create sysfs attributes, %d\n", err);
293 return err; 293 return err;
294} 294}
295 295
296void tpm_sysfs_del_device(struct tpm_chip *chip) 296void tpm_sysfs_del_device(struct tpm_chip *chip)
297{ 297{
298 sysfs_remove_group(&chip->dev->kobj, &tpm_dev_group); 298 sysfs_remove_group(&chip->pdev->kobj, &tpm_dev_group);
299} 299}
diff --git a/drivers/char/tpm/tpm.h b/drivers/char/tpm/tpm.h
index 3409acf953f3..adf6af835329 100644
--- a/drivers/char/tpm/tpm.h
+++ b/drivers/char/tpm/tpm.h
@@ -103,7 +103,7 @@ enum tpm_chip_flags {
103}; 103};
104 104
105struct tpm_chip { 105struct tpm_chip {
106 struct device *dev; /* Device stuff */ 106 struct device *pdev; /* Device stuff */
107 const struct tpm_class_ops *ops; 107 const struct tpm_class_ops *ops;
108 unsigned int flags; 108 unsigned int flags;
109 109
@@ -130,7 +130,7 @@ struct tpm_chip {
130 130
131static inline void tpm_chip_put(struct tpm_chip *chip) 131static inline void tpm_chip_put(struct tpm_chip *chip)
132{ 132{
133 module_put(chip->dev->driver->owner); 133 module_put(chip->pdev->driver->owner);
134} 134}
135 135
136static inline int tpm_read_index(int base, int index) 136static inline int tpm_read_index(int base, int index)
diff --git a/drivers/char/tpm/tpm_atmel.c b/drivers/char/tpm/tpm_atmel.c
index 3d4c6c3b0433..dfadad0916a1 100644
--- a/drivers/char/tpm/tpm_atmel.c
+++ b/drivers/char/tpm/tpm_atmel.c
@@ -49,7 +49,7 @@ static int tpm_atml_recv(struct tpm_chip *chip, u8 *buf, size_t count)
49 for (i = 0; i < 6; i++) { 49 for (i = 0; i < 6; i++) {
50 status = ioread8(chip->vendor.iobase + 1); 50 status = ioread8(chip->vendor.iobase + 1);
51 if ((status & ATML_STATUS_DATA_AVAIL) == 0) { 51 if ((status & ATML_STATUS_DATA_AVAIL) == 0) {
52 dev_err(chip->dev, "error reading header\n"); 52 dev_err(chip->pdev, "error reading header\n");
53 return -EIO; 53 return -EIO;
54 } 54 }
55 *buf++ = ioread8(chip->vendor.iobase); 55 *buf++ = ioread8(chip->vendor.iobase);
@@ -60,12 +60,12 @@ static int tpm_atml_recv(struct tpm_chip *chip, u8 *buf, size_t count)
60 size = be32_to_cpu(*native_size); 60 size = be32_to_cpu(*native_size);
61 61
62 if (count < size) { 62 if (count < size) {
63 dev_err(chip->dev, 63 dev_err(chip->pdev,
64 "Recv size(%d) less than available space\n", size); 64 "Recv size(%d) less than available space\n", size);
65 for (; i < size; i++) { /* clear the waiting data anyway */ 65 for (; i < size; i++) { /* clear the waiting data anyway */
66 status = ioread8(chip->vendor.iobase + 1); 66 status = ioread8(chip->vendor.iobase + 1);
67 if ((status & ATML_STATUS_DATA_AVAIL) == 0) { 67 if ((status & ATML_STATUS_DATA_AVAIL) == 0) {
68 dev_err(chip->dev, "error reading data\n"); 68 dev_err(chip->pdev, "error reading data\n");
69 return -EIO; 69 return -EIO;
70 } 70 }
71 } 71 }
@@ -76,7 +76,7 @@ static int tpm_atml_recv(struct tpm_chip *chip, u8 *buf, size_t count)
76 for (; i < size; i++) { 76 for (; i < size; i++) {
77 status = ioread8(chip->vendor.iobase + 1); 77 status = ioread8(chip->vendor.iobase + 1);
78 if ((status & ATML_STATUS_DATA_AVAIL) == 0) { 78 if ((status & ATML_STATUS_DATA_AVAIL) == 0) {
79 dev_err(chip->dev, "error reading data\n"); 79 dev_err(chip->pdev, "error reading data\n");
80 return -EIO; 80 return -EIO;
81 } 81 }
82 *buf++ = ioread8(chip->vendor.iobase); 82 *buf++ = ioread8(chip->vendor.iobase);
@@ -86,7 +86,7 @@ static int tpm_atml_recv(struct tpm_chip *chip, u8 *buf, size_t count)
86 status = ioread8(chip->vendor.iobase + 1); 86 status = ioread8(chip->vendor.iobase + 1);
87 87
88 if (status & ATML_STATUS_DATA_AVAIL) { 88 if (status & ATML_STATUS_DATA_AVAIL) {
89 dev_err(chip->dev, "data available is stuck\n"); 89 dev_err(chip->pdev, "data available is stuck\n");
90 return -EIO; 90 return -EIO;
91 } 91 }
92 92
@@ -97,9 +97,9 @@ static int tpm_atml_send(struct tpm_chip *chip, u8 *buf, size_t count)
97{ 97{
98 int i; 98 int i;
99 99
100 dev_dbg(chip->dev, "tpm_atml_send:\n"); 100 dev_dbg(chip->pdev, "tpm_atml_send:\n");
101 for (i = 0; i < count; i++) { 101 for (i = 0; i < count; i++) {
102 dev_dbg(chip->dev, "%d 0x%x(%d)\n", i, buf[i], buf[i]); 102 dev_dbg(chip->pdev, "%d 0x%x(%d)\n", i, buf[i], buf[i]);
103 iowrite8(buf[i], chip->vendor.iobase); 103 iowrite8(buf[i], chip->vendor.iobase);
104 } 104 }
105 105
diff --git a/drivers/char/tpm/tpm_i2c_atmel.c b/drivers/char/tpm/tpm_i2c_atmel.c
index 643a9402e911..7a0ca78ad3c6 100644
--- a/drivers/char/tpm/tpm_i2c_atmel.c
+++ b/drivers/char/tpm/tpm_i2c_atmel.c
@@ -52,7 +52,7 @@ struct priv_data {
52static int i2c_atmel_send(struct tpm_chip *chip, u8 *buf, size_t len) 52static int i2c_atmel_send(struct tpm_chip *chip, u8 *buf, size_t len)
53{ 53{
54 struct priv_data *priv = chip->vendor.priv; 54 struct priv_data *priv = chip->vendor.priv;
55 struct i2c_client *client = to_i2c_client(chip->dev); 55 struct i2c_client *client = to_i2c_client(chip->pdev);
56 s32 status; 56 s32 status;
57 57
58 priv->len = 0; 58 priv->len = 0;
@@ -62,7 +62,7 @@ static int i2c_atmel_send(struct tpm_chip *chip, u8 *buf, size_t len)
62 62
63 status = i2c_master_send(client, buf, len); 63 status = i2c_master_send(client, buf, len);
64 64
65 dev_dbg(chip->dev, 65 dev_dbg(chip->pdev,
66 "%s(buf=%*ph len=%0zx) -> sts=%d\n", __func__, 66 "%s(buf=%*ph len=%0zx) -> sts=%d\n", __func__,
67 (int)min_t(size_t, 64, len), buf, len, status); 67 (int)min_t(size_t, 64, len), buf, len, status);
68 return status; 68 return status;
@@ -71,7 +71,7 @@ static int i2c_atmel_send(struct tpm_chip *chip, u8 *buf, size_t len)
71static int i2c_atmel_recv(struct tpm_chip *chip, u8 *buf, size_t count) 71static int i2c_atmel_recv(struct tpm_chip *chip, u8 *buf, size_t count)
72{ 72{
73 struct priv_data *priv = chip->vendor.priv; 73 struct priv_data *priv = chip->vendor.priv;
74 struct i2c_client *client = to_i2c_client(chip->dev); 74 struct i2c_client *client = to_i2c_client(chip->pdev);
75 struct tpm_output_header *hdr = 75 struct tpm_output_header *hdr =
76 (struct tpm_output_header *)priv->buffer; 76 (struct tpm_output_header *)priv->buffer;
77 u32 expected_len; 77 u32 expected_len;
@@ -88,7 +88,7 @@ static int i2c_atmel_recv(struct tpm_chip *chip, u8 *buf, size_t count)
88 return -ENOMEM; 88 return -ENOMEM;
89 89
90 if (priv->len >= expected_len) { 90 if (priv->len >= expected_len) {
91 dev_dbg(chip->dev, 91 dev_dbg(chip->pdev,
92 "%s early(buf=%*ph count=%0zx) -> ret=%d\n", __func__, 92 "%s early(buf=%*ph count=%0zx) -> ret=%d\n", __func__,
93 (int)min_t(size_t, 64, expected_len), buf, count, 93 (int)min_t(size_t, 64, expected_len), buf, count,
94 expected_len); 94 expected_len);
@@ -97,7 +97,7 @@ static int i2c_atmel_recv(struct tpm_chip *chip, u8 *buf, size_t count)
97 } 97 }
98 98
99 rc = i2c_master_recv(client, buf, expected_len); 99 rc = i2c_master_recv(client, buf, expected_len);
100 dev_dbg(chip->dev, 100 dev_dbg(chip->pdev,
101 "%s reread(buf=%*ph count=%0zx) -> ret=%d\n", __func__, 101 "%s reread(buf=%*ph count=%0zx) -> ret=%d\n", __func__,
102 (int)min_t(size_t, 64, expected_len), buf, count, 102 (int)min_t(size_t, 64, expected_len), buf, count,
103 expected_len); 103 expected_len);
@@ -106,13 +106,13 @@ static int i2c_atmel_recv(struct tpm_chip *chip, u8 *buf, size_t count)
106 106
107static void i2c_atmel_cancel(struct tpm_chip *chip) 107static void i2c_atmel_cancel(struct tpm_chip *chip)
108{ 108{
109 dev_err(chip->dev, "TPM operation cancellation was requested, but is not supported"); 109 dev_err(chip->pdev, "TPM operation cancellation was requested, but is not supported");
110} 110}
111 111
112static u8 i2c_atmel_read_status(struct tpm_chip *chip) 112static u8 i2c_atmel_read_status(struct tpm_chip *chip)
113{ 113{
114 struct priv_data *priv = chip->vendor.priv; 114 struct priv_data *priv = chip->vendor.priv;
115 struct i2c_client *client = to_i2c_client(chip->dev); 115 struct i2c_client *client = to_i2c_client(chip->pdev);
116 int rc; 116 int rc;
117 117
118 /* The TPM fails the I2C read until it is ready, so we do the entire 118 /* The TPM fails the I2C read until it is ready, so we do the entire
@@ -125,7 +125,7 @@ static u8 i2c_atmel_read_status(struct tpm_chip *chip)
125 /* Once the TPM has completed the command the command remains readable 125 /* Once the TPM has completed the command the command remains readable
126 * until another command is issued. */ 126 * until another command is issued. */
127 rc = i2c_master_recv(client, priv->buffer, sizeof(priv->buffer)); 127 rc = i2c_master_recv(client, priv->buffer, sizeof(priv->buffer));
128 dev_dbg(chip->dev, 128 dev_dbg(chip->pdev,
129 "%s: sts=%d", __func__, rc); 129 "%s: sts=%d", __func__, rc);
130 if (rc <= 0) 130 if (rc <= 0)
131 return 0; 131 return 0;
diff --git a/drivers/char/tpm/tpm_i2c_infineon.c b/drivers/char/tpm/tpm_i2c_infineon.c
index 03708e6b309a..33c5f360ab01 100644
--- a/drivers/char/tpm/tpm_i2c_infineon.c
+++ b/drivers/char/tpm/tpm_i2c_infineon.c
@@ -446,7 +446,7 @@ static int tpm_tis_i2c_recv(struct tpm_chip *chip, u8 *buf, size_t count)
446 /* read first 10 bytes, including tag, paramsize, and result */ 446 /* read first 10 bytes, including tag, paramsize, and result */
447 size = recv_data(chip, buf, TPM_HEADER_SIZE); 447 size = recv_data(chip, buf, TPM_HEADER_SIZE);
448 if (size < TPM_HEADER_SIZE) { 448 if (size < TPM_HEADER_SIZE) {
449 dev_err(chip->dev, "Unable to read header\n"); 449 dev_err(chip->pdev, "Unable to read header\n");
450 goto out; 450 goto out;
451 } 451 }
452 452
@@ -459,14 +459,14 @@ static int tpm_tis_i2c_recv(struct tpm_chip *chip, u8 *buf, size_t count)
459 size += recv_data(chip, &buf[TPM_HEADER_SIZE], 459 size += recv_data(chip, &buf[TPM_HEADER_SIZE],
460 expected - TPM_HEADER_SIZE); 460 expected - TPM_HEADER_SIZE);
461 if (size < expected) { 461 if (size < expected) {
462 dev_err(chip->dev, "Unable to read remainder of result\n"); 462 dev_err(chip->pdev, "Unable to read remainder of result\n");
463 size = -ETIME; 463 size = -ETIME;
464 goto out; 464 goto out;
465 } 465 }
466 466
467 wait_for_stat(chip, TPM_STS_VALID, chip->vendor.timeout_c, &status); 467 wait_for_stat(chip, TPM_STS_VALID, chip->vendor.timeout_c, &status);
468 if (status & TPM_STS_DATA_AVAIL) { /* retry? */ 468 if (status & TPM_STS_DATA_AVAIL) { /* retry? */
469 dev_err(chip->dev, "Error left over data\n"); 469 dev_err(chip->pdev, "Error left over data\n");
470 size = -EIO; 470 size = -EIO;
471 goto out; 471 goto out;
472 } 472 }
diff --git a/drivers/char/tpm/tpm_i2c_nuvoton.c b/drivers/char/tpm/tpm_i2c_nuvoton.c
index 8c23088d99ef..e1eadb0c1568 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->dev); 99 struct i2c_client *client = to_i2c_client(chip->pdev);
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->dev, "%s() error return %d\n", __func__, 105 dev_err(chip->pdev, "%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->dev); 130 struct i2c_client *client = to_i2c_client(chip->pdev);
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->dev, 136 dev_err(chip->pdev,
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->dev, "%s(%02x, %02x) -> timeout\n", __func__, mask, 215 dev_err(chip->pdev, "%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->dev, 243 dev_err(chip->pdev,
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->dev, 252 dev_err(chip->pdev,
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->dev, "%s(%d):", __func__, bytes2read); 257 dev_dbg(chip->pdev, "%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->dev; 267 struct device *dev = chip->pdev;
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->dev, "%s() -> %d\n", __func__, size); 337 dev_dbg(chip->pdev, "%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->dev; 350 struct device *dev = chip->pdev;
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;
diff --git a/drivers/char/tpm/tpm_i2c_stm_st33.c b/drivers/char/tpm/tpm_i2c_stm_st33.c
index 9a96d3704fe5..48c4808d5a7a 100644
--- a/drivers/char/tpm/tpm_i2c_stm_st33.c
+++ b/drivers/char/tpm/tpm_i2c_stm_st33.c
@@ -588,7 +588,7 @@ static int tpm_stm_i2c_recv(struct tpm_chip *chip, unsigned char *buf,
588 588
589 size = recv_data(chip, buf, TPM_HEADER_SIZE); 589 size = recv_data(chip, buf, TPM_HEADER_SIZE);
590 if (size < TPM_HEADER_SIZE) { 590 if (size < TPM_HEADER_SIZE) {
591 dev_err(chip->dev, "Unable to read header\n"); 591 dev_err(chip->pdev, "Unable to read header\n");
592 goto out; 592 goto out;
593 } 593 }
594 594
@@ -601,7 +601,7 @@ static int tpm_stm_i2c_recv(struct tpm_chip *chip, unsigned char *buf,
601 size += recv_data(chip, &buf[TPM_HEADER_SIZE], 601 size += recv_data(chip, &buf[TPM_HEADER_SIZE],
602 expected - TPM_HEADER_SIZE); 602 expected - TPM_HEADER_SIZE);
603 if (size < expected) { 603 if (size < expected) {
604 dev_err(chip->dev, "Unable to read remainder of result\n"); 604 dev_err(chip->pdev, "Unable to read remainder of result\n");
605 size = -ETIME; 605 size = -ETIME;
606 goto out; 606 goto out;
607 } 607 }
@@ -639,14 +639,14 @@ static int tpm_stm_i2c_of_request_resources(struct tpm_chip *chip)
639 639
640 pp = client->dev.of_node; 640 pp = client->dev.of_node;
641 if (!pp) { 641 if (!pp) {
642 dev_err(chip->dev, "No platform data\n"); 642 dev_err(chip->pdev, "No platform data\n");
643 return -ENODEV; 643 return -ENODEV;
644 } 644 }
645 645
646 /* Get GPIO from device tree */ 646 /* Get GPIO from device tree */
647 gpio = of_get_named_gpio(pp, "lpcpd-gpios", 0); 647 gpio = of_get_named_gpio(pp, "lpcpd-gpios", 0);
648 if (gpio < 0) { 648 if (gpio < 0) {
649 dev_err(chip->dev, "Failed to retrieve lpcpd-gpios from dts.\n"); 649 dev_err(chip->pdev, "Failed to retrieve lpcpd-gpios from dts.\n");
650 tpm_dev->io_lpcpd = -1; 650 tpm_dev->io_lpcpd = -1;
651 /* 651 /*
652 * lpcpd pin is not specified. This is not an issue as 652 * lpcpd pin is not specified. This is not an issue as
@@ -659,7 +659,7 @@ static int tpm_stm_i2c_of_request_resources(struct tpm_chip *chip)
659 ret = devm_gpio_request_one(&client->dev, gpio, 659 ret = devm_gpio_request_one(&client->dev, gpio,
660 GPIOF_OUT_INIT_HIGH, "TPM IO LPCPD"); 660 GPIOF_OUT_INIT_HIGH, "TPM IO LPCPD");
661 if (ret) { 661 if (ret) {
662 dev_err(chip->dev, "Failed to request lpcpd pin\n"); 662 dev_err(chip->pdev, "Failed to request lpcpd pin\n");
663 return -ENODEV; 663 return -ENODEV;
664 } 664 }
665 tpm_dev->io_lpcpd = gpio; 665 tpm_dev->io_lpcpd = gpio;
@@ -682,7 +682,7 @@ static int tpm_stm_i2c_request_resources(struct i2c_client *client,
682 682
683 pdata = client->dev.platform_data; 683 pdata = client->dev.platform_data;
684 if (!pdata) { 684 if (!pdata) {
685 dev_err(chip->dev, "No platform data\n"); 685 dev_err(chip->pdev, "No platform data\n");
686 return -ENODEV; 686 return -ENODEV;
687 } 687 }
688 688
@@ -694,7 +694,7 @@ static int tpm_stm_i2c_request_resources(struct i2c_client *client,
694 pdata->io_lpcpd, GPIOF_OUT_INIT_HIGH, 694 pdata->io_lpcpd, GPIOF_OUT_INIT_HIGH,
695 "TPM IO_LPCPD"); 695 "TPM IO_LPCPD");
696 if (ret) { 696 if (ret) {
697 dev_err(chip->dev, "%s : reset gpio_request failed\n", 697 dev_err(chip->pdev, "%s : reset gpio_request failed\n",
698 __FILE__); 698 __FILE__);
699 return ret; 699 return ret;
700 } 700 }
@@ -776,7 +776,7 @@ tpm_stm_i2c_probe(struct i2c_client *client, const struct i2c_device_id *id)
776 IRQF_TRIGGER_HIGH, 776 IRQF_TRIGGER_HIGH,
777 "TPM SERIRQ management", chip); 777 "TPM SERIRQ management", chip);
778 if (ret < 0) { 778 if (ret < 0) {
779 dev_err(chip->dev , "TPM SERIRQ signals %d not available\n", 779 dev_err(chip->pdev , "TPM SERIRQ signals %d not available\n",
780 client->irq); 780 client->irq);
781 goto _tpm_clean_answer; 781 goto _tpm_clean_answer;
782 } 782 }
@@ -807,7 +807,7 @@ tpm_stm_i2c_probe(struct i2c_client *client, const struct i2c_device_id *id)
807 807
808 return tpm_chip_register(chip); 808 return tpm_chip_register(chip);
809_tpm_clean_answer: 809_tpm_clean_answer:
810 dev_info(chip->dev, "TPM I2C initialisation fail\n"); 810 dev_info(chip->pdev, "TPM I2C initialisation fail\n");
811 return ret; 811 return ret;
812} 812}
813 813
diff --git a/drivers/char/tpm/tpm_infineon.c b/drivers/char/tpm/tpm_infineon.c
index dcdb671b2a5d..6d492132ad2b 100644
--- a/drivers/char/tpm/tpm_infineon.c
+++ b/drivers/char/tpm/tpm_infineon.c
@@ -195,9 +195,9 @@ static int wait(struct tpm_chip *chip, int wait_for_bit)
195 } 195 }
196 if (i == TPM_MAX_TRIES) { /* timeout occurs */ 196 if (i == TPM_MAX_TRIES) { /* timeout occurs */
197 if (wait_for_bit == STAT_XFE) 197 if (wait_for_bit == STAT_XFE)
198 dev_err(chip->dev, "Timeout in wait(STAT_XFE)\n"); 198 dev_err(chip->pdev, "Timeout in wait(STAT_XFE)\n");
199 if (wait_for_bit == STAT_RDA) 199 if (wait_for_bit == STAT_RDA)
200 dev_err(chip->dev, "Timeout in wait(STAT_RDA)\n"); 200 dev_err(chip->pdev, "Timeout in wait(STAT_RDA)\n");
201 return -EIO; 201 return -EIO;
202 } 202 }
203 return 0; 203 return 0;
@@ -220,7 +220,7 @@ static void wait_and_send(struct tpm_chip *chip, u8 sendbyte)
220static void tpm_wtx(struct tpm_chip *chip) 220static void tpm_wtx(struct tpm_chip *chip)
221{ 221{
222 number_of_wtx++; 222 number_of_wtx++;
223 dev_info(chip->dev, "Granting WTX (%02d / %02d)\n", 223 dev_info(chip->pdev, "Granting WTX (%02d / %02d)\n",
224 number_of_wtx, TPM_MAX_WTX_PACKAGES); 224 number_of_wtx, TPM_MAX_WTX_PACKAGES);
225 wait_and_send(chip, TPM_VL_VER); 225 wait_and_send(chip, TPM_VL_VER);
226 wait_and_send(chip, TPM_CTRL_WTX); 226 wait_and_send(chip, TPM_CTRL_WTX);
@@ -231,7 +231,7 @@ static void tpm_wtx(struct tpm_chip *chip)
231 231
232static void tpm_wtx_abort(struct tpm_chip *chip) 232static void tpm_wtx_abort(struct tpm_chip *chip)
233{ 233{
234 dev_info(chip->dev, "Aborting WTX\n"); 234 dev_info(chip->pdev, "Aborting WTX\n");
235 wait_and_send(chip, TPM_VL_VER); 235 wait_and_send(chip, TPM_VL_VER);
236 wait_and_send(chip, TPM_CTRL_WTX_ABORT); 236 wait_and_send(chip, TPM_CTRL_WTX_ABORT);
237 wait_and_send(chip, 0x00); 237 wait_and_send(chip, 0x00);
@@ -257,7 +257,7 @@ recv_begin:
257 } 257 }
258 258
259 if (buf[0] != TPM_VL_VER) { 259 if (buf[0] != TPM_VL_VER) {
260 dev_err(chip->dev, 260 dev_err(chip->pdev,
261 "Wrong transport protocol implementation!\n"); 261 "Wrong transport protocol implementation!\n");
262 return -EIO; 262 return -EIO;
263 } 263 }
@@ -272,7 +272,7 @@ recv_begin:
272 } 272 }
273 273
274 if ((size == 0x6D00) && (buf[1] == 0x80)) { 274 if ((size == 0x6D00) && (buf[1] == 0x80)) {
275 dev_err(chip->dev, "Error handling on vendor layer!\n"); 275 dev_err(chip->pdev, "Error handling on vendor layer!\n");
276 return -EIO; 276 return -EIO;
277 } 277 }
278 278
@@ -284,7 +284,7 @@ recv_begin:
284 } 284 }
285 285
286 if (buf[1] == TPM_CTRL_WTX) { 286 if (buf[1] == TPM_CTRL_WTX) {
287 dev_info(chip->dev, "WTX-package received\n"); 287 dev_info(chip->pdev, "WTX-package received\n");
288 if (number_of_wtx < TPM_MAX_WTX_PACKAGES) { 288 if (number_of_wtx < TPM_MAX_WTX_PACKAGES) {
289 tpm_wtx(chip); 289 tpm_wtx(chip);
290 goto recv_begin; 290 goto recv_begin;
@@ -295,14 +295,14 @@ recv_begin:
295 } 295 }
296 296
297 if (buf[1] == TPM_CTRL_WTX_ABORT_ACK) { 297 if (buf[1] == TPM_CTRL_WTX_ABORT_ACK) {
298 dev_info(chip->dev, "WTX-abort acknowledged\n"); 298 dev_info(chip->pdev, "WTX-abort acknowledged\n");
299 return size; 299 return size;
300 } 300 }
301 301
302 if (buf[1] == TPM_CTRL_ERROR) { 302 if (buf[1] == TPM_CTRL_ERROR) {
303 dev_err(chip->dev, "ERROR-package received:\n"); 303 dev_err(chip->pdev, "ERROR-package received:\n");
304 if (buf[4] == TPM_INF_NAK) 304 if (buf[4] == TPM_INF_NAK)
305 dev_err(chip->dev, 305 dev_err(chip->pdev,
306 "-> Negative acknowledgement" 306 "-> Negative acknowledgement"
307 " - retransmit command!\n"); 307 " - retransmit command!\n");
308 return -EIO; 308 return -EIO;
@@ -321,7 +321,7 @@ static int tpm_inf_send(struct tpm_chip *chip, u8 * buf, size_t count)
321 321
322 ret = empty_fifo(chip, 1); 322 ret = empty_fifo(chip, 1);
323 if (ret) { 323 if (ret) {
324 dev_err(chip->dev, "Timeout while clearing FIFO\n"); 324 dev_err(chip->pdev, "Timeout while clearing FIFO\n");
325 return -EIO; 325 return -EIO;
326 } 326 }
327 327
diff --git a/drivers/char/tpm/tpm_nsc.c b/drivers/char/tpm/tpm_nsc.c
index 6e2c2e64b292..289389ecef84 100644
--- a/drivers/char/tpm/tpm_nsc.c
+++ b/drivers/char/tpm/tpm_nsc.c
@@ -113,7 +113,7 @@ static int nsc_wait_for_ready(struct tpm_chip *chip)
113 } 113 }
114 while (time_before(jiffies, stop)); 114 while (time_before(jiffies, stop));
115 115
116 dev_info(chip->dev, "wait for ready failed\n"); 116 dev_info(chip->pdev, "wait for ready failed\n");
117 return -EBUSY; 117 return -EBUSY;
118} 118}
119 119
@@ -129,12 +129,12 @@ static int tpm_nsc_recv(struct tpm_chip *chip, u8 * buf, size_t count)
129 return -EIO; 129 return -EIO;
130 130
131 if (wait_for_stat(chip, NSC_STATUS_F0, NSC_STATUS_F0, &data) < 0) { 131 if (wait_for_stat(chip, NSC_STATUS_F0, NSC_STATUS_F0, &data) < 0) {
132 dev_err(chip->dev, "F0 timeout\n"); 132 dev_err(chip->pdev, "F0 timeout\n");
133 return -EIO; 133 return -EIO;
134 } 134 }
135 if ((data = 135 if ((data =
136 inb(chip->vendor.base + NSC_DATA)) != NSC_COMMAND_NORMAL) { 136 inb(chip->vendor.base + NSC_DATA)) != NSC_COMMAND_NORMAL) {
137 dev_err(chip->dev, "not in normal mode (0x%x)\n", 137 dev_err(chip->pdev, "not in normal mode (0x%x)\n",
138 data); 138 data);
139 return -EIO; 139 return -EIO;
140 } 140 }
@@ -143,7 +143,7 @@ static int tpm_nsc_recv(struct tpm_chip *chip, u8 * buf, size_t count)
143 for (p = buffer; p < &buffer[count]; p++) { 143 for (p = buffer; p < &buffer[count]; p++) {
144 if (wait_for_stat 144 if (wait_for_stat
145 (chip, NSC_STATUS_OBF, NSC_STATUS_OBF, &data) < 0) { 145 (chip, NSC_STATUS_OBF, NSC_STATUS_OBF, &data) < 0) {
146 dev_err(chip->dev, 146 dev_err(chip->pdev,
147 "OBF timeout (while reading data)\n"); 147 "OBF timeout (while reading data)\n");
148 return -EIO; 148 return -EIO;
149 } 149 }
@@ -154,11 +154,11 @@ static int tpm_nsc_recv(struct tpm_chip *chip, u8 * buf, size_t count)
154 154
155 if ((data & NSC_STATUS_F0) == 0 && 155 if ((data & NSC_STATUS_F0) == 0 &&
156 (wait_for_stat(chip, NSC_STATUS_F0, NSC_STATUS_F0, &data) < 0)) { 156 (wait_for_stat(chip, NSC_STATUS_F0, NSC_STATUS_F0, &data) < 0)) {
157 dev_err(chip->dev, "F0 not set\n"); 157 dev_err(chip->pdev, "F0 not set\n");
158 return -EIO; 158 return -EIO;
159 } 159 }
160 if ((data = inb(chip->vendor.base + NSC_DATA)) != NSC_COMMAND_EOC) { 160 if ((data = inb(chip->vendor.base + NSC_DATA)) != NSC_COMMAND_EOC) {
161 dev_err(chip->dev, 161 dev_err(chip->pdev,
162 "expected end of command(0x%x)\n", data); 162 "expected end of command(0x%x)\n", data);
163 return -EIO; 163 return -EIO;
164 } 164 }
@@ -189,19 +189,19 @@ static int tpm_nsc_send(struct tpm_chip *chip, u8 * buf, size_t count)
189 return -EIO; 189 return -EIO;
190 190
191 if (wait_for_stat(chip, NSC_STATUS_IBF, 0, &data) < 0) { 191 if (wait_for_stat(chip, NSC_STATUS_IBF, 0, &data) < 0) {
192 dev_err(chip->dev, "IBF timeout\n"); 192 dev_err(chip->pdev, "IBF timeout\n");
193 return -EIO; 193 return -EIO;
194 } 194 }
195 195
196 outb(NSC_COMMAND_NORMAL, chip->vendor.base + NSC_COMMAND); 196 outb(NSC_COMMAND_NORMAL, chip->vendor.base + NSC_COMMAND);
197 if (wait_for_stat(chip, NSC_STATUS_IBR, NSC_STATUS_IBR, &data) < 0) { 197 if (wait_for_stat(chip, NSC_STATUS_IBR, NSC_STATUS_IBR, &data) < 0) {
198 dev_err(chip->dev, "IBR timeout\n"); 198 dev_err(chip->pdev, "IBR timeout\n");
199 return -EIO; 199 return -EIO;
200 } 200 }
201 201
202 for (i = 0; i < count; i++) { 202 for (i = 0; i < count; i++) {
203 if (wait_for_stat(chip, NSC_STATUS_IBF, 0, &data) < 0) { 203 if (wait_for_stat(chip, NSC_STATUS_IBF, 0, &data) < 0) {
204 dev_err(chip->dev, 204 dev_err(chip->pdev,
205 "IBF timeout (while writing data)\n"); 205 "IBF timeout (while writing data)\n");
206 return -EIO; 206 return -EIO;
207 } 207 }
@@ -209,7 +209,7 @@ static int tpm_nsc_send(struct tpm_chip *chip, u8 * buf, size_t count)
209 } 209 }
210 210
211 if (wait_for_stat(chip, NSC_STATUS_IBF, 0, &data) < 0) { 211 if (wait_for_stat(chip, NSC_STATUS_IBF, 0, &data) < 0) {
212 dev_err(chip->dev, "IBF timeout\n"); 212 dev_err(chip->pdev, "IBF timeout\n");
213 return -EIO; 213 return -EIO;
214 } 214 }
215 outb(NSC_COMMAND_EOC, chip->vendor.base + NSC_COMMAND); 215 outb(NSC_COMMAND_EOC, chip->vendor.base + NSC_COMMAND);
diff --git a/drivers/char/tpm/tpm_ppi.c b/drivers/char/tpm/tpm_ppi.c
index af48c56f642f..6ca9b5d78144 100644
--- a/drivers/char/tpm/tpm_ppi.c
+++ b/drivers/char/tpm/tpm_ppi.c
@@ -356,7 +356,7 @@ int tpm_add_ppi(struct tpm_chip *chip)
356 ACPI_FREE(obj); 356 ACPI_FREE(obj);
357 } 357 }
358 358
359 rc = sysfs_create_group(&chip->dev->kobj, &ppi_attr_grp); 359 rc = sysfs_create_group(&chip->pdev->kobj, &ppi_attr_grp);
360 360
361 if (!rc) 361 if (!rc)
362 chip->flags |= TPM_CHIP_FLAG_PPI; 362 chip->flags |= TPM_CHIP_FLAG_PPI;
@@ -367,5 +367,5 @@ int tpm_add_ppi(struct tpm_chip *chip)
367void tpm_remove_ppi(struct tpm_chip *chip) 367void tpm_remove_ppi(struct tpm_chip *chip)
368{ 368{
369 if (chip->flags & TPM_CHIP_FLAG_PPI) 369 if (chip->flags & TPM_CHIP_FLAG_PPI)
370 sysfs_remove_group(&chip->dev->kobj, &ppi_attr_grp); 370 sysfs_remove_group(&chip->pdev->kobj, &ppi_attr_grp);
371} 371}
diff --git a/drivers/char/tpm/tpm_tis.c b/drivers/char/tpm/tpm_tis.c
index 9695850d2afa..9e02489a94f3 100644
--- a/drivers/char/tpm/tpm_tis.c
+++ b/drivers/char/tpm/tpm_tis.c
@@ -242,7 +242,7 @@ static int tpm_tis_recv(struct tpm_chip *chip, u8 *buf, size_t count)
242 /* read first 10 bytes, including tag, paramsize, and result */ 242 /* read first 10 bytes, including tag, paramsize, and result */
243 if ((size = 243 if ((size =
244 recv_data(chip, buf, TPM_HEADER_SIZE)) < TPM_HEADER_SIZE) { 244 recv_data(chip, buf, TPM_HEADER_SIZE)) < TPM_HEADER_SIZE) {
245 dev_err(chip->dev, "Unable to read header\n"); 245 dev_err(chip->pdev, "Unable to read header\n");
246 goto out; 246 goto out;
247 } 247 }
248 248
@@ -255,7 +255,7 @@ static int tpm_tis_recv(struct tpm_chip *chip, u8 *buf, size_t count)
255 if ((size += 255 if ((size +=
256 recv_data(chip, &buf[TPM_HEADER_SIZE], 256 recv_data(chip, &buf[TPM_HEADER_SIZE],
257 expected - TPM_HEADER_SIZE)) < expected) { 257 expected - TPM_HEADER_SIZE)) < expected) {
258 dev_err(chip->dev, "Unable to read remainder of result\n"); 258 dev_err(chip->pdev, "Unable to read remainder of result\n");
259 size = -ETIME; 259 size = -ETIME;
260 goto out; 260 goto out;
261 } 261 }
@@ -264,7 +264,7 @@ static int tpm_tis_recv(struct tpm_chip *chip, u8 *buf, size_t count)
264 &chip->vendor.int_queue, false); 264 &chip->vendor.int_queue, false);
265 status = tpm_tis_status(chip); 265 status = tpm_tis_status(chip);
266 if (status & TPM_STS_DATA_AVAIL) { /* retry? */ 266 if (status & TPM_STS_DATA_AVAIL) { /* retry? */
267 dev_err(chip->dev, "Error left over data\n"); 267 dev_err(chip->pdev, "Error left over data\n");
268 size = -EIO; 268 size = -EIO;
269 goto out; 269 goto out;
270 } 270 }
@@ -406,7 +406,7 @@ static int tpm_tis_send(struct tpm_chip *chip, u8 *buf, size_t len)
406 msleep(1); 406 msleep(1);
407 if (!priv->irq_tested) { 407 if (!priv->irq_tested) {
408 disable_interrupts(chip); 408 disable_interrupts(chip);
409 dev_err(chip->dev, 409 dev_err(chip->pdev,
410 FW_BUG "TPM interrupt not working, polling instead\n"); 410 FW_BUG "TPM interrupt not working, polling instead\n");
411 } 411 }
412 priv->irq_tested = true; 412 priv->irq_tested = true;
@@ -476,7 +476,7 @@ static int probe_itpm(struct tpm_chip *chip)
476 476
477 rc = tpm_tis_send_data(chip, cmd_getticks, len); 477 rc = tpm_tis_send_data(chip, cmd_getticks, len);
478 if (rc == 0) { 478 if (rc == 0) {
479 dev_info(chip->dev, "Detected an iTPM.\n"); 479 dev_info(chip->pdev, "Detected an iTPM.\n");
480 rc = 1; 480 rc = 1;
481 } else 481 } else
482 rc = -EFAULT; 482 rc = -EFAULT;
@@ -699,7 +699,7 @@ static int tpm_tis_init(struct device *dev, acpi_handle acpi_dev_handle,
699 if (devm_request_irq 699 if (devm_request_irq
700 (dev, i, tis_int_probe, IRQF_SHARED, 700 (dev, i, tis_int_probe, IRQF_SHARED,
701 chip->vendor.miscdev.name, chip) != 0) { 701 chip->vendor.miscdev.name, chip) != 0) {
702 dev_info(chip->dev, 702 dev_info(chip->pdev,
703 "Unable to request irq: %d for probe\n", 703 "Unable to request irq: %d for probe\n",
704 i); 704 i);
705 continue; 705 continue;
@@ -746,7 +746,7 @@ static int tpm_tis_init(struct device *dev, acpi_handle acpi_dev_handle,
746 if (devm_request_irq 746 if (devm_request_irq
747 (dev, chip->vendor.irq, tis_int_handler, IRQF_SHARED, 747 (dev, chip->vendor.irq, tis_int_handler, IRQF_SHARED,
748 chip->vendor.miscdev.name, chip) != 0) { 748 chip->vendor.miscdev.name, chip) != 0) {
749 dev_info(chip->dev, 749 dev_info(chip->pdev,
750 "Unable to request irq: %d for use\n", 750 "Unable to request irq: %d for use\n",
751 chip->vendor.irq); 751 chip->vendor.irq);
752 chip->vendor.irq = 0; 752 chip->vendor.irq = 0;