diff options
author | Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com> | 2018-11-04 20:02:38 -0500 |
---|---|---|
committer | Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com> | 2019-02-13 02:48:46 -0500 |
commit | 47a6c28b6861b14a69e36ba974d2ffa1746e8e6f (patch) | |
tree | 360d56bf556dd92e0042220cfc80bf4e456f7eba | |
parent | a3fbfae82b4cb3ff9928e29f34c64d0507cad874 (diff) |
tpm: remove @flags from tpm_transmit()
Remove @flags from tpm_transmit() API. It is no longer used for
anything.
Signed-off-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
Reviewed-by: Stefan Berger <stefanb@linux.ibm.com>
Tested-by: Stefan Berger <stefanb@linux.ibm.com>
Reviewed-by: Jerry Snitselaar <jsnitsel@redhat.com>
Reviewed-by: James Bottomley <James.Bottomley@HansenPartnership.com>
Tested-by: Alexander Steffen <Alexander.Steffen@infineon.com>
-rw-r--r-- | drivers/char/tpm/tpm-chip.c | 40 | ||||
-rw-r--r-- | drivers/char/tpm/tpm-dev-common.c | 2 | ||||
-rw-r--r-- | drivers/char/tpm/tpm-interface.c | 22 | ||||
-rw-r--r-- | drivers/char/tpm/tpm-sysfs.c | 2 | ||||
-rw-r--r-- | drivers/char/tpm/tpm.h | 13 | ||||
-rw-r--r-- | drivers/char/tpm/tpm1-cmd.c | 14 | ||||
-rw-r--r-- | drivers/char/tpm/tpm2-cmd.c | 48 | ||||
-rw-r--r-- | drivers/char/tpm/tpm2-space.c | 16 | ||||
-rw-r--r-- | drivers/char/tpm/tpm_tis_core.c | 4 | ||||
-rw-r--r-- | drivers/char/tpm/tpm_vtpm_proxy.c | 2 |
10 files changed, 73 insertions, 90 deletions
diff --git a/drivers/char/tpm/tpm-chip.c b/drivers/char/tpm/tpm-chip.c index 1dbc7f45e2b4..4eb48cf6a03a 100644 --- a/drivers/char/tpm/tpm-chip.c +++ b/drivers/char/tpm/tpm-chip.c | |||
@@ -37,7 +37,7 @@ struct class *tpm_class; | |||
37 | struct class *tpmrm_class; | 37 | struct class *tpmrm_class; |
38 | dev_t tpm_devt; | 38 | dev_t tpm_devt; |
39 | 39 | ||
40 | static int tpm_request_locality(struct tpm_chip *chip, unsigned int flags) | 40 | static int tpm_request_locality(struct tpm_chip *chip) |
41 | { | 41 | { |
42 | int rc; | 42 | int rc; |
43 | 43 | ||
@@ -52,7 +52,7 @@ static int tpm_request_locality(struct tpm_chip *chip, unsigned int flags) | |||
52 | return 0; | 52 | return 0; |
53 | } | 53 | } |
54 | 54 | ||
55 | static void tpm_relinquish_locality(struct tpm_chip *chip, unsigned int flags) | 55 | static void tpm_relinquish_locality(struct tpm_chip *chip) |
56 | { | 56 | { |
57 | int rc; | 57 | int rc; |
58 | 58 | ||
@@ -66,7 +66,7 @@ static void tpm_relinquish_locality(struct tpm_chip *chip, unsigned int flags) | |||
66 | chip->locality = -1; | 66 | chip->locality = -1; |
67 | } | 67 | } |
68 | 68 | ||
69 | static int tpm_cmd_ready(struct tpm_chip *chip, unsigned int flags) | 69 | static int tpm_cmd_ready(struct tpm_chip *chip) |
70 | { | 70 | { |
71 | if (!chip->ops->cmd_ready) | 71 | if (!chip->ops->cmd_ready) |
72 | return 0; | 72 | return 0; |
@@ -74,7 +74,7 @@ static int tpm_cmd_ready(struct tpm_chip *chip, unsigned int flags) | |||
74 | return chip->ops->cmd_ready(chip); | 74 | return chip->ops->cmd_ready(chip); |
75 | } | 75 | } |
76 | 76 | ||
77 | static int tpm_go_idle(struct tpm_chip *chip, unsigned int flags) | 77 | static int tpm_go_idle(struct tpm_chip *chip) |
78 | { | 78 | { |
79 | if (!chip->ops->go_idle) | 79 | if (!chip->ops->go_idle) |
80 | return 0; | 80 | return 0; |
@@ -85,13 +85,12 @@ static int tpm_go_idle(struct tpm_chip *chip, unsigned int flags) | |||
85 | /** | 85 | /** |
86 | * tpm_chip_start() - power on the TPM | 86 | * tpm_chip_start() - power on the TPM |
87 | * @chip: a TPM chip to use | 87 | * @chip: a TPM chip to use |
88 | * @flags: TPM transmit flags | ||
89 | * | 88 | * |
90 | * Return: | 89 | * Return: |
91 | * * The response length - OK | 90 | * * The response length - OK |
92 | * * -errno - A system error | 91 | * * -errno - A system error |
93 | */ | 92 | */ |
94 | int tpm_chip_start(struct tpm_chip *chip, unsigned int flags) | 93 | int tpm_chip_start(struct tpm_chip *chip) |
95 | { | 94 | { |
96 | int ret; | 95 | int ret; |
97 | 96 | ||
@@ -99,16 +98,16 @@ int tpm_chip_start(struct tpm_chip *chip, unsigned int flags) | |||
99 | chip->ops->clk_enable(chip, true); | 98 | chip->ops->clk_enable(chip, true); |
100 | 99 | ||
101 | if (chip->locality == -1) { | 100 | if (chip->locality == -1) { |
102 | ret = tpm_request_locality(chip, flags); | 101 | ret = tpm_request_locality(chip); |
103 | if (ret) { | 102 | if (ret) { |
104 | chip->ops->clk_enable(chip, false); | 103 | chip->ops->clk_enable(chip, false); |
105 | return ret; | 104 | return ret; |
106 | } | 105 | } |
107 | } | 106 | } |
108 | 107 | ||
109 | ret = tpm_cmd_ready(chip, flags); | 108 | ret = tpm_cmd_ready(chip); |
110 | if (ret) { | 109 | if (ret) { |
111 | tpm_relinquish_locality(chip, flags); | 110 | tpm_relinquish_locality(chip); |
112 | if (chip->ops->clk_enable) | 111 | if (chip->ops->clk_enable) |
113 | chip->ops->clk_enable(chip, false); | 112 | chip->ops->clk_enable(chip, false); |
114 | return ret; | 113 | return ret; |
@@ -121,16 +120,15 @@ EXPORT_SYMBOL_GPL(tpm_chip_start); | |||
121 | /** | 120 | /** |
122 | * tpm_chip_stop() - power off the TPM | 121 | * tpm_chip_stop() - power off the TPM |
123 | * @chip: a TPM chip to use | 122 | * @chip: a TPM chip to use |
124 | * @flags: TPM transmit flags | ||
125 | * | 123 | * |
126 | * Return: | 124 | * Return: |
127 | * * The response length - OK | 125 | * * The response length - OK |
128 | * * -errno - A system error | 126 | * * -errno - A system error |
129 | */ | 127 | */ |
130 | void tpm_chip_stop(struct tpm_chip *chip, unsigned int flags) | 128 | void tpm_chip_stop(struct tpm_chip *chip) |
131 | { | 129 | { |
132 | tpm_go_idle(chip, flags); | 130 | tpm_go_idle(chip); |
133 | tpm_relinquish_locality(chip, flags); | 131 | tpm_relinquish_locality(chip); |
134 | if (chip->ops->clk_enable) | 132 | if (chip->ops->clk_enable) |
135 | chip->ops->clk_enable(chip, false); | 133 | chip->ops->clk_enable(chip, false); |
136 | } | 134 | } |
@@ -158,7 +156,7 @@ int tpm_try_get_ops(struct tpm_chip *chip) | |||
158 | goto out_ops; | 156 | goto out_ops; |
159 | 157 | ||
160 | mutex_lock(&chip->tpm_mutex); | 158 | mutex_lock(&chip->tpm_mutex); |
161 | rc = tpm_chip_start(chip, 0); | 159 | rc = tpm_chip_start(chip); |
162 | if (rc) | 160 | if (rc) |
163 | goto out_lock; | 161 | goto out_lock; |
164 | 162 | ||
@@ -181,7 +179,7 @@ EXPORT_SYMBOL_GPL(tpm_try_get_ops); | |||
181 | */ | 179 | */ |
182 | void tpm_put_ops(struct tpm_chip *chip) | 180 | void tpm_put_ops(struct tpm_chip *chip) |
183 | { | 181 | { |
184 | tpm_chip_stop(chip, 0); | 182 | tpm_chip_stop(chip); |
185 | mutex_unlock(&chip->tpm_mutex); | 183 | mutex_unlock(&chip->tpm_mutex); |
186 | up_read(&chip->ops_sem); | 184 | up_read(&chip->ops_sem); |
187 | put_device(&chip->dev); | 185 | put_device(&chip->dev); |
@@ -297,9 +295,9 @@ static int tpm_class_shutdown(struct device *dev) | |||
297 | 295 | ||
298 | if (chip->flags & TPM_CHIP_FLAG_TPM2) { | 296 | if (chip->flags & TPM_CHIP_FLAG_TPM2) { |
299 | down_write(&chip->ops_sem); | 297 | down_write(&chip->ops_sem); |
300 | if (!tpm_chip_start(chip, 0)) { | 298 | if (!tpm_chip_start(chip)) { |
301 | tpm2_shutdown(chip, TPM2_SU_CLEAR); | 299 | tpm2_shutdown(chip, TPM2_SU_CLEAR); |
302 | tpm_chip_stop(chip, 0); | 300 | tpm_chip_stop(chip); |
303 | } | 301 | } |
304 | chip->ops = NULL; | 302 | chip->ops = NULL; |
305 | up_write(&chip->ops_sem); | 303 | up_write(&chip->ops_sem); |
@@ -480,9 +478,9 @@ static void tpm_del_char_device(struct tpm_chip *chip) | |||
480 | /* Make the driver uncallable. */ | 478 | /* Make the driver uncallable. */ |
481 | down_write(&chip->ops_sem); | 479 | down_write(&chip->ops_sem); |
482 | if (chip->flags & TPM_CHIP_FLAG_TPM2) { | 480 | if (chip->flags & TPM_CHIP_FLAG_TPM2) { |
483 | if (!tpm_chip_start(chip, 0)) { | 481 | if (!tpm_chip_start(chip)) { |
484 | tpm2_shutdown(chip, TPM2_SU_CLEAR); | 482 | tpm2_shutdown(chip, TPM2_SU_CLEAR); |
485 | tpm_chip_stop(chip, 0); | 483 | tpm_chip_stop(chip); |
486 | } | 484 | } |
487 | } | 485 | } |
488 | chip->ops = NULL; | 486 | chip->ops = NULL; |
@@ -566,11 +564,11 @@ int tpm_chip_register(struct tpm_chip *chip) | |||
566 | { | 564 | { |
567 | int rc; | 565 | int rc; |
568 | 566 | ||
569 | rc = tpm_chip_start(chip, 0); | 567 | rc = tpm_chip_start(chip); |
570 | if (rc) | 568 | if (rc) |
571 | return rc; | 569 | return rc; |
572 | rc = tpm_auto_startup(chip); | 570 | rc = tpm_auto_startup(chip); |
573 | tpm_chip_stop(chip, 0); | 571 | tpm_chip_stop(chip); |
574 | if (rc) | 572 | if (rc) |
575 | return rc; | 573 | return rc; |
576 | 574 | ||
diff --git a/drivers/char/tpm/tpm-dev-common.c b/drivers/char/tpm/tpm-dev-common.c index 435c09ec9056..8856cce5a23b 100644 --- a/drivers/char/tpm/tpm-dev-common.c +++ b/drivers/char/tpm/tpm-dev-common.c | |||
@@ -47,7 +47,7 @@ static ssize_t tpm_dev_transmit(struct tpm_chip *chip, struct tpm_space *space, | |||
47 | if (ret) | 47 | if (ret) |
48 | goto out_rc; | 48 | goto out_rc; |
49 | 49 | ||
50 | len = tpm_transmit(chip, buf, bufsiz, 0); | 50 | len = tpm_transmit(chip, buf, bufsiz); |
51 | if (len < 0) | 51 | if (len < 0) |
52 | ret = len; | 52 | ret = len; |
53 | 53 | ||
diff --git a/drivers/char/tpm/tpm-interface.c b/drivers/char/tpm/tpm-interface.c index 744f1b96128e..498809bf1bf0 100644 --- a/drivers/char/tpm/tpm-interface.c +++ b/drivers/char/tpm/tpm-interface.c | |||
@@ -62,8 +62,7 @@ unsigned long tpm_calc_ordinal_duration(struct tpm_chip *chip, u32 ordinal) | |||
62 | } | 62 | } |
63 | EXPORT_SYMBOL_GPL(tpm_calc_ordinal_duration); | 63 | EXPORT_SYMBOL_GPL(tpm_calc_ordinal_duration); |
64 | 64 | ||
65 | static ssize_t tpm_try_transmit(struct tpm_chip *chip, void *buf, size_t bufsiz, | 65 | static ssize_t tpm_try_transmit(struct tpm_chip *chip, void *buf, size_t bufsiz) |
66 | unsigned int flags) | ||
67 | { | 66 | { |
68 | struct tpm_header *header = buf; | 67 | struct tpm_header *header = buf; |
69 | int rc; | 68 | int rc; |
@@ -143,7 +142,6 @@ out_recv: | |||
143 | * @chip: a TPM chip to use | 142 | * @chip: a TPM chip to use |
144 | * @buf: a TPM command buffer | 143 | * @buf: a TPM command buffer |
145 | * @bufsiz: length of the TPM command buffer | 144 | * @bufsiz: length of the TPM command buffer |
146 | * @flags: TPM transmit flags | ||
147 | * | 145 | * |
148 | * A wrapper around tpm_try_transmit() that handles TPM2_RC_RETRY returns from | 146 | * A wrapper around tpm_try_transmit() that handles TPM2_RC_RETRY returns from |
149 | * the TPM and retransmits the command after a delay up to a maximum wait of | 147 | * the TPM and retransmits the command after a delay up to a maximum wait of |
@@ -156,8 +154,7 @@ out_recv: | |||
156 | * * The response length - OK | 154 | * * The response length - OK |
157 | * * -errno - A system error | 155 | * * -errno - A system error |
158 | */ | 156 | */ |
159 | ssize_t tpm_transmit(struct tpm_chip *chip, u8 *buf, size_t bufsiz, | 157 | ssize_t tpm_transmit(struct tpm_chip *chip, u8 *buf, size_t bufsiz) |
160 | unsigned int flags) | ||
161 | { | 158 | { |
162 | struct tpm_header *header = (struct tpm_header *)buf; | 159 | struct tpm_header *header = (struct tpm_header *)buf; |
163 | /* space for header and handles */ | 160 | /* space for header and handles */ |
@@ -177,7 +174,7 @@ ssize_t tpm_transmit(struct tpm_chip *chip, u8 *buf, size_t bufsiz, | |||
177 | memcpy(save, buf, save_size); | 174 | memcpy(save, buf, save_size); |
178 | 175 | ||
179 | for (;;) { | 176 | for (;;) { |
180 | ret = tpm_try_transmit(chip, buf, bufsiz, flags); | 177 | ret = tpm_try_transmit(chip, buf, bufsiz); |
181 | if (ret < 0) | 178 | if (ret < 0) |
182 | break; | 179 | break; |
183 | rc = be32_to_cpu(header->return_code); | 180 | rc = be32_to_cpu(header->return_code); |
@@ -210,7 +207,6 @@ ssize_t tpm_transmit(struct tpm_chip *chip, u8 *buf, size_t bufsiz, | |||
210 | * @chip: a TPM chip to use | 207 | * @chip: a TPM chip to use |
211 | * @buf: a TPM command buffer | 208 | * @buf: a TPM command buffer |
212 | * @min_rsp_body_length: minimum expected length of response body | 209 | * @min_rsp_body_length: minimum expected length of response body |
213 | * @flags: TPM transmit flags | ||
214 | * @desc: command description used in the error message | 210 | * @desc: command description used in the error message |
215 | * | 211 | * |
216 | * Return: | 212 | * Return: |
@@ -219,14 +215,13 @@ ssize_t tpm_transmit(struct tpm_chip *chip, u8 *buf, size_t bufsiz, | |||
219 | * * TPM_RC - A TPM error | 215 | * * TPM_RC - A TPM error |
220 | */ | 216 | */ |
221 | ssize_t tpm_transmit_cmd(struct tpm_chip *chip, struct tpm_buf *buf, | 217 | ssize_t tpm_transmit_cmd(struct tpm_chip *chip, struct tpm_buf *buf, |
222 | size_t min_rsp_body_length, unsigned int flags, | 218 | size_t min_rsp_body_length, const char *desc) |
223 | const char *desc) | ||
224 | { | 219 | { |
225 | const struct tpm_header *header = (struct tpm_header *)buf->data; | 220 | const struct tpm_header *header = (struct tpm_header *)buf->data; |
226 | int err; | 221 | int err; |
227 | ssize_t len; | 222 | ssize_t len; |
228 | 223 | ||
229 | len = tpm_transmit(chip, buf->data, PAGE_SIZE, flags); | 224 | len = tpm_transmit(chip, buf->data, PAGE_SIZE); |
230 | if (len < 0) | 225 | if (len < 0) |
231 | return len; | 226 | return len; |
232 | 227 | ||
@@ -375,8 +370,7 @@ int tpm_send(struct tpm_chip *chip, void *cmd, size_t buflen) | |||
375 | goto out; | 370 | goto out; |
376 | 371 | ||
377 | memcpy(buf.data, cmd, buflen); | 372 | memcpy(buf.data, cmd, buflen); |
378 | rc = tpm_transmit_cmd(chip, &buf, 0, 0, | 373 | rc = tpm_transmit_cmd(chip, &buf, 0, "attempting to a send a command"); |
379 | "attempting to a send a command"); | ||
380 | tpm_buf_destroy(&buf); | 374 | tpm_buf_destroy(&buf); |
381 | out: | 375 | out: |
382 | tpm_put_ops(chip); | 376 | tpm_put_ops(chip); |
@@ -416,9 +410,9 @@ int tpm_pm_suspend(struct device *dev) | |||
416 | 410 | ||
417 | if (chip->flags & TPM_CHIP_FLAG_TPM2) { | 411 | if (chip->flags & TPM_CHIP_FLAG_TPM2) { |
418 | mutex_lock(&chip->tpm_mutex); | 412 | mutex_lock(&chip->tpm_mutex); |
419 | if (!tpm_chip_start(chip, 0)) { | 413 | if (!tpm_chip_start(chip)) { |
420 | tpm2_shutdown(chip, TPM2_SU_STATE); | 414 | tpm2_shutdown(chip, TPM2_SU_STATE); |
421 | tpm_chip_stop(chip, 0); | 415 | tpm_chip_stop(chip); |
422 | } | 416 | } |
423 | mutex_unlock(&chip->tpm_mutex); | 417 | mutex_unlock(&chip->tpm_mutex); |
424 | } else { | 418 | } else { |
diff --git a/drivers/char/tpm/tpm-sysfs.c b/drivers/char/tpm/tpm-sysfs.c index 3733491671ca..533a260d744e 100644 --- a/drivers/char/tpm/tpm-sysfs.c +++ b/drivers/char/tpm/tpm-sysfs.c | |||
@@ -55,7 +55,7 @@ static ssize_t pubek_show(struct device *dev, struct device_attribute *attr, | |||
55 | tpm_buf_append(&tpm_buf, anti_replay, sizeof(anti_replay)); | 55 | tpm_buf_append(&tpm_buf, anti_replay, sizeof(anti_replay)); |
56 | 56 | ||
57 | if (tpm_transmit_cmd(chip, &tpm_buf, READ_PUBEK_RESULT_MIN_BODY_SIZE, | 57 | if (tpm_transmit_cmd(chip, &tpm_buf, READ_PUBEK_RESULT_MIN_BODY_SIZE, |
58 | 0, "attempting to read the PUBEK")) | 58 | "attempting to read the PUBEK")) |
59 | goto out_buf; | 59 | goto out_buf; |
60 | 60 | ||
61 | out = (struct tpm_readpubek_out *)&tpm_buf.data[10]; | 61 | out = (struct tpm_readpubek_out *)&tpm_buf.data[10]; |
diff --git a/drivers/char/tpm/tpm.h b/drivers/char/tpm/tpm.h index 53e4208759ee..183e2b93e0fe 100644 --- a/drivers/char/tpm/tpm.h +++ b/drivers/char/tpm/tpm.h | |||
@@ -485,11 +485,9 @@ extern const struct file_operations tpm_fops; | |||
485 | extern const struct file_operations tpmrm_fops; | 485 | extern const struct file_operations tpmrm_fops; |
486 | extern struct idr dev_nums_idr; | 486 | extern struct idr dev_nums_idr; |
487 | 487 | ||
488 | ssize_t tpm_transmit(struct tpm_chip *chip, u8 *buf, size_t bufsiz, | 488 | ssize_t tpm_transmit(struct tpm_chip *chip, u8 *buf, size_t bufsiz); |
489 | unsigned int flags); | ||
490 | ssize_t tpm_transmit_cmd(struct tpm_chip *chip, struct tpm_buf *buf, | 489 | ssize_t tpm_transmit_cmd(struct tpm_chip *chip, struct tpm_buf *buf, |
491 | size_t min_rsp_body_length, unsigned int flags, | 490 | size_t min_rsp_body_length, const char *desc); |
492 | const char *desc); | ||
493 | int tpm_get_timeouts(struct tpm_chip *); | 491 | int tpm_get_timeouts(struct tpm_chip *); |
494 | int tpm_auto_startup(struct tpm_chip *chip); | 492 | int tpm_auto_startup(struct tpm_chip *chip); |
495 | 493 | ||
@@ -514,8 +512,8 @@ static inline void tpm_msleep(unsigned int delay_msec) | |||
514 | delay_msec * 1000); | 512 | delay_msec * 1000); |
515 | }; | 513 | }; |
516 | 514 | ||
517 | int tpm_chip_start(struct tpm_chip *chip, unsigned int flags); | 515 | int tpm_chip_start(struct tpm_chip *chip); |
518 | void tpm_chip_stop(struct tpm_chip *chip, unsigned int flags); | 516 | void tpm_chip_stop(struct tpm_chip *chip); |
519 | struct tpm_chip *tpm_find_get_ops(struct tpm_chip *chip); | 517 | struct tpm_chip *tpm_find_get_ops(struct tpm_chip *chip); |
520 | __must_check int tpm_try_get_ops(struct tpm_chip *chip); | 518 | __must_check int tpm_try_get_ops(struct tpm_chip *chip); |
521 | void tpm_put_ops(struct tpm_chip *chip); | 519 | void tpm_put_ops(struct tpm_chip *chip); |
@@ -548,8 +546,7 @@ int tpm2_pcr_read(struct tpm_chip *chip, u32 pcr_idx, u8 *res_buf); | |||
548 | int tpm2_pcr_extend(struct tpm_chip *chip, u32 pcr_idx, u32 count, | 546 | int tpm2_pcr_extend(struct tpm_chip *chip, u32 pcr_idx, u32 count, |
549 | struct tpm2_digest *digests); | 547 | struct tpm2_digest *digests); |
550 | int tpm2_get_random(struct tpm_chip *chip, u8 *dest, size_t max); | 548 | int tpm2_get_random(struct tpm_chip *chip, u8 *dest, size_t max); |
551 | void tpm2_flush_context_cmd(struct tpm_chip *chip, u32 handle, | 549 | void tpm2_flush_context(struct tpm_chip *chip, u32 handle); |
552 | unsigned int flags); | ||
553 | int tpm2_seal_trusted(struct tpm_chip *chip, | 550 | int tpm2_seal_trusted(struct tpm_chip *chip, |
554 | struct trusted_key_payload *payload, | 551 | struct trusted_key_payload *payload, |
555 | struct trusted_key_options *options); | 552 | struct trusted_key_options *options); |
diff --git a/drivers/char/tpm/tpm1-cmd.c b/drivers/char/tpm/tpm1-cmd.c index 5b5f8bcc6210..ec5f3693c096 100644 --- a/drivers/char/tpm/tpm1-cmd.c +++ b/drivers/char/tpm/tpm1-cmd.c | |||
@@ -334,7 +334,7 @@ static int tpm1_startup(struct tpm_chip *chip) | |||
334 | 334 | ||
335 | tpm_buf_append_u16(&buf, TPM_ST_CLEAR); | 335 | tpm_buf_append_u16(&buf, TPM_ST_CLEAR); |
336 | 336 | ||
337 | rc = tpm_transmit_cmd(chip, &buf, 0, 0, "attempting to start the TPM"); | 337 | rc = tpm_transmit_cmd(chip, &buf, 0, "attempting to start the TPM"); |
338 | tpm_buf_destroy(&buf); | 338 | tpm_buf_destroy(&buf); |
339 | return rc; | 339 | return rc; |
340 | } | 340 | } |
@@ -458,7 +458,7 @@ int tpm1_pcr_extend(struct tpm_chip *chip, u32 pcr_idx, const u8 *hash, | |||
458 | tpm_buf_append_u32(&buf, pcr_idx); | 458 | tpm_buf_append_u32(&buf, pcr_idx); |
459 | tpm_buf_append(&buf, hash, TPM_DIGEST_SIZE); | 459 | tpm_buf_append(&buf, hash, TPM_DIGEST_SIZE); |
460 | 460 | ||
461 | rc = tpm_transmit_cmd(chip, &buf, TPM_DIGEST_SIZE, 0, log_msg); | 461 | rc = tpm_transmit_cmd(chip, &buf, TPM_DIGEST_SIZE, log_msg); |
462 | tpm_buf_destroy(&buf); | 462 | tpm_buf_destroy(&buf); |
463 | return rc; | 463 | return rc; |
464 | } | 464 | } |
@@ -488,7 +488,7 @@ ssize_t tpm1_getcap(struct tpm_chip *chip, u32 subcap_id, cap_t *cap, | |||
488 | tpm_buf_append_u32(&buf, 4); | 488 | tpm_buf_append_u32(&buf, 4); |
489 | tpm_buf_append_u32(&buf, subcap_id); | 489 | tpm_buf_append_u32(&buf, subcap_id); |
490 | } | 490 | } |
491 | rc = tpm_transmit_cmd(chip, &buf, min_cap_length, 0, desc); | 491 | rc = tpm_transmit_cmd(chip, &buf, min_cap_length, desc); |
492 | if (!rc) | 492 | if (!rc) |
493 | *cap = *(cap_t *)&buf.data[TPM_HEADER_SIZE + 4]; | 493 | *cap = *(cap_t *)&buf.data[TPM_HEADER_SIZE + 4]; |
494 | tpm_buf_destroy(&buf); | 494 | tpm_buf_destroy(&buf); |
@@ -529,7 +529,7 @@ int tpm1_get_random(struct tpm_chip *chip, u8 *dest, size_t max) | |||
529 | do { | 529 | do { |
530 | tpm_buf_append_u32(&buf, num_bytes); | 530 | tpm_buf_append_u32(&buf, num_bytes); |
531 | 531 | ||
532 | rc = tpm_transmit_cmd(chip, &buf, sizeof(out->rng_data_len), 0, | 532 | rc = tpm_transmit_cmd(chip, &buf, sizeof(out->rng_data_len), |
533 | "attempting get random"); | 533 | "attempting get random"); |
534 | if (rc) | 534 | if (rc) |
535 | goto out; | 535 | goto out; |
@@ -574,7 +574,7 @@ int tpm1_pcr_read(struct tpm_chip *chip, u32 pcr_idx, u8 *res_buf) | |||
574 | 574 | ||
575 | tpm_buf_append_u32(&buf, pcr_idx); | 575 | tpm_buf_append_u32(&buf, pcr_idx); |
576 | 576 | ||
577 | rc = tpm_transmit_cmd(chip, &buf, TPM_DIGEST_SIZE, 0, | 577 | rc = tpm_transmit_cmd(chip, &buf, TPM_DIGEST_SIZE, |
578 | "attempting to read a pcr value"); | 578 | "attempting to read a pcr value"); |
579 | if (rc) | 579 | if (rc) |
580 | goto out; | 580 | goto out; |
@@ -608,7 +608,7 @@ static int tpm1_continue_selftest(struct tpm_chip *chip) | |||
608 | if (rc) | 608 | if (rc) |
609 | return rc; | 609 | return rc; |
610 | 610 | ||
611 | rc = tpm_transmit_cmd(chip, &buf, 0, 0, "continue selftest"); | 611 | rc = tpm_transmit_cmd(chip, &buf, 0, "continue selftest"); |
612 | tpm_buf_destroy(&buf); | 612 | tpm_buf_destroy(&buf); |
613 | return rc; | 613 | return rc; |
614 | } | 614 | } |
@@ -734,7 +734,7 @@ int tpm1_pm_suspend(struct tpm_chip *chip, u32 tpm_suspend_pcr) | |||
734 | return rc; | 734 | return rc; |
735 | /* now do the actual savestate */ | 735 | /* now do the actual savestate */ |
736 | for (try = 0; try < TPM_RETRY; try++) { | 736 | for (try = 0; try < TPM_RETRY; try++) { |
737 | rc = tpm_transmit_cmd(chip, &buf, 0, 0, NULL); | 737 | rc = tpm_transmit_cmd(chip, &buf, 0, NULL); |
738 | /* | 738 | /* |
739 | * If the TPM indicates that it is too busy to respond to | 739 | * If the TPM indicates that it is too busy to respond to |
740 | * this command then retry before giving up. It can take | 740 | * this command then retry before giving up. It can take |
diff --git a/drivers/char/tpm/tpm2-cmd.c b/drivers/char/tpm/tpm2-cmd.c index d6abc964ef66..971d46efaca5 100644 --- a/drivers/char/tpm/tpm2-cmd.c +++ b/drivers/char/tpm/tpm2-cmd.c | |||
@@ -197,7 +197,7 @@ int tpm2_pcr_read(struct tpm_chip *chip, u32 pcr_idx, u8 *res_buf) | |||
197 | tpm_buf_append(&buf, (const unsigned char *)pcr_select, | 197 | tpm_buf_append(&buf, (const unsigned char *)pcr_select, |
198 | sizeof(pcr_select)); | 198 | sizeof(pcr_select)); |
199 | 199 | ||
200 | rc = tpm_transmit_cmd(chip, &buf, 0, 0, res_buf ? | 200 | rc = tpm_transmit_cmd(chip, &buf, 0, res_buf ? |
201 | "attempting to read a pcr value" : NULL); | 201 | "attempting to read a pcr value" : NULL); |
202 | if (rc == 0 && res_buf) { | 202 | if (rc == 0 && res_buf) { |
203 | out = (struct tpm2_pcr_read_out *)&buf.data[TPM_HEADER_SIZE]; | 203 | out = (struct tpm2_pcr_read_out *)&buf.data[TPM_HEADER_SIZE]; |
@@ -264,8 +264,7 @@ int tpm2_pcr_extend(struct tpm_chip *chip, u32 pcr_idx, u32 count, | |||
264 | } | 264 | } |
265 | } | 265 | } |
266 | 266 | ||
267 | rc = tpm_transmit_cmd(chip, &buf, 0, 0, | 267 | rc = tpm_transmit_cmd(chip, &buf, 0, "attempting extend a PCR value"); |
268 | "attempting extend a PCR value"); | ||
269 | 268 | ||
270 | tpm_buf_destroy(&buf); | 269 | tpm_buf_destroy(&buf); |
271 | 270 | ||
@@ -312,7 +311,7 @@ int tpm2_get_random(struct tpm_chip *chip, u8 *dest, size_t max) | |||
312 | err = tpm_transmit_cmd(chip, &buf, | 311 | err = tpm_transmit_cmd(chip, &buf, |
313 | offsetof(struct tpm2_get_random_out, | 312 | offsetof(struct tpm2_get_random_out, |
314 | buffer), | 313 | buffer), |
315 | 0, "attempting get random"); | 314 | "attempting get random"); |
316 | if (err) | 315 | if (err) |
317 | goto out; | 316 | goto out; |
318 | 317 | ||
@@ -341,14 +340,11 @@ out: | |||
341 | } | 340 | } |
342 | 341 | ||
343 | /** | 342 | /** |
344 | * tpm2_flush_context_cmd() - execute a TPM2_FlushContext command | 343 | * tpm2_flush_context() - execute a TPM2_FlushContext command |
345 | * @chip: TPM chip to use | 344 | * @chip: TPM chip to use |
346 | * @handle: context handle | 345 | * @handle: context handle |
347 | * @flags: tpm transmit flags - bitmap | ||
348 | * | ||
349 | */ | 346 | */ |
350 | void tpm2_flush_context_cmd(struct tpm_chip *chip, u32 handle, | 347 | void tpm2_flush_context(struct tpm_chip *chip, u32 handle) |
351 | unsigned int flags) | ||
352 | { | 348 | { |
353 | struct tpm_buf buf; | 349 | struct tpm_buf buf; |
354 | int rc; | 350 | int rc; |
@@ -362,7 +358,7 @@ void tpm2_flush_context_cmd(struct tpm_chip *chip, u32 handle, | |||
362 | 358 | ||
363 | tpm_buf_append_u32(&buf, handle); | 359 | tpm_buf_append_u32(&buf, handle); |
364 | 360 | ||
365 | tpm_transmit_cmd(chip, &buf, 0, flags, "flushing context"); | 361 | tpm_transmit_cmd(chip, &buf, 0, "flushing context"); |
366 | tpm_buf_destroy(&buf); | 362 | tpm_buf_destroy(&buf); |
367 | } | 363 | } |
368 | 364 | ||
@@ -476,7 +472,7 @@ int tpm2_seal_trusted(struct tpm_chip *chip, | |||
476 | goto out; | 472 | goto out; |
477 | } | 473 | } |
478 | 474 | ||
479 | rc = tpm_transmit_cmd(chip, &buf, 4, 0, "sealing data"); | 475 | rc = tpm_transmit_cmd(chip, &buf, 4, "sealing data"); |
480 | if (rc) | 476 | if (rc) |
481 | goto out; | 477 | goto out; |
482 | 478 | ||
@@ -513,7 +509,6 @@ out: | |||
513 | * @payload: the key data in clear and encrypted form | 509 | * @payload: the key data in clear and encrypted form |
514 | * @options: authentication values and other options | 510 | * @options: authentication values and other options |
515 | * @blob_handle: returned blob handle | 511 | * @blob_handle: returned blob handle |
516 | * @flags: tpm transmit flags | ||
517 | * | 512 | * |
518 | * Return: 0 on success. | 513 | * Return: 0 on success. |
519 | * -E2BIG on wrong payload size. | 514 | * -E2BIG on wrong payload size. |
@@ -523,7 +518,7 @@ out: | |||
523 | static int tpm2_load_cmd(struct tpm_chip *chip, | 518 | static int tpm2_load_cmd(struct tpm_chip *chip, |
524 | struct trusted_key_payload *payload, | 519 | struct trusted_key_payload *payload, |
525 | struct trusted_key_options *options, | 520 | struct trusted_key_options *options, |
526 | u32 *blob_handle, unsigned int flags) | 521 | u32 *blob_handle) |
527 | { | 522 | { |
528 | struct tpm_buf buf; | 523 | struct tpm_buf buf; |
529 | unsigned int private_len; | 524 | unsigned int private_len; |
@@ -558,7 +553,7 @@ static int tpm2_load_cmd(struct tpm_chip *chip, | |||
558 | goto out; | 553 | goto out; |
559 | } | 554 | } |
560 | 555 | ||
561 | rc = tpm_transmit_cmd(chip, &buf, 4, flags, "loading blob"); | 556 | rc = tpm_transmit_cmd(chip, &buf, 4, "loading blob"); |
562 | if (!rc) | 557 | if (!rc) |
563 | *blob_handle = be32_to_cpup( | 558 | *blob_handle = be32_to_cpup( |
564 | (__be32 *) &buf.data[TPM_HEADER_SIZE]); | 559 | (__be32 *) &buf.data[TPM_HEADER_SIZE]); |
@@ -579,7 +574,6 @@ out: | |||
579 | * @payload: the key data in clear and encrypted form | 574 | * @payload: the key data in clear and encrypted form |
580 | * @options: authentication values and other options | 575 | * @options: authentication values and other options |
581 | * @blob_handle: blob handle | 576 | * @blob_handle: blob handle |
582 | * @flags: tpm_transmit_cmd flags | ||
583 | * | 577 | * |
584 | * Return: 0 on success | 578 | * Return: 0 on success |
585 | * -EPERM on tpm error status | 579 | * -EPERM on tpm error status |
@@ -588,7 +582,7 @@ out: | |||
588 | static int tpm2_unseal_cmd(struct tpm_chip *chip, | 582 | static int tpm2_unseal_cmd(struct tpm_chip *chip, |
589 | struct trusted_key_payload *payload, | 583 | struct trusted_key_payload *payload, |
590 | struct trusted_key_options *options, | 584 | struct trusted_key_options *options, |
591 | u32 blob_handle, unsigned int flags) | 585 | u32 blob_handle) |
592 | { | 586 | { |
593 | struct tpm_buf buf; | 587 | struct tpm_buf buf; |
594 | u16 data_len; | 588 | u16 data_len; |
@@ -608,7 +602,7 @@ static int tpm2_unseal_cmd(struct tpm_chip *chip, | |||
608 | options->blobauth /* hmac */, | 602 | options->blobauth /* hmac */, |
609 | TPM_DIGEST_SIZE); | 603 | TPM_DIGEST_SIZE); |
610 | 604 | ||
611 | rc = tpm_transmit_cmd(chip, &buf, 6, flags, "unsealing"); | 605 | rc = tpm_transmit_cmd(chip, &buf, 6, "unsealing"); |
612 | if (rc > 0) | 606 | if (rc > 0) |
613 | rc = -EPERM; | 607 | rc = -EPERM; |
614 | 608 | ||
@@ -652,12 +646,12 @@ int tpm2_unseal_trusted(struct tpm_chip *chip, | |||
652 | u32 blob_handle; | 646 | u32 blob_handle; |
653 | int rc; | 647 | int rc; |
654 | 648 | ||
655 | rc = tpm2_load_cmd(chip, payload, options, &blob_handle, 0); | 649 | rc = tpm2_load_cmd(chip, payload, options, &blob_handle); |
656 | if (rc) | 650 | if (rc) |
657 | return rc; | 651 | return rc; |
658 | 652 | ||
659 | rc = tpm2_unseal_cmd(chip, payload, options, blob_handle, 0); | 653 | rc = tpm2_unseal_cmd(chip, payload, options, blob_handle); |
660 | tpm2_flush_context_cmd(chip, blob_handle, 0); | 654 | tpm2_flush_context(chip, blob_handle); |
661 | return rc; | 655 | return rc; |
662 | } | 656 | } |
663 | 657 | ||
@@ -693,7 +687,7 @@ ssize_t tpm2_get_tpm_pt(struct tpm_chip *chip, u32 property_id, u32 *value, | |||
693 | tpm_buf_append_u32(&buf, TPM2_CAP_TPM_PROPERTIES); | 687 | tpm_buf_append_u32(&buf, TPM2_CAP_TPM_PROPERTIES); |
694 | tpm_buf_append_u32(&buf, property_id); | 688 | tpm_buf_append_u32(&buf, property_id); |
695 | tpm_buf_append_u32(&buf, 1); | 689 | tpm_buf_append_u32(&buf, 1); |
696 | rc = tpm_transmit_cmd(chip, &buf, 0, 0, NULL); | 690 | rc = tpm_transmit_cmd(chip, &buf, 0, NULL); |
697 | if (!rc) { | 691 | if (!rc) { |
698 | out = (struct tpm2_get_cap_out *) | 692 | out = (struct tpm2_get_cap_out *) |
699 | &buf.data[TPM_HEADER_SIZE]; | 693 | &buf.data[TPM_HEADER_SIZE]; |
@@ -723,7 +717,7 @@ void tpm2_shutdown(struct tpm_chip *chip, u16 shutdown_type) | |||
723 | if (rc) | 717 | if (rc) |
724 | return; | 718 | return; |
725 | tpm_buf_append_u16(&buf, shutdown_type); | 719 | tpm_buf_append_u16(&buf, shutdown_type); |
726 | tpm_transmit_cmd(chip, &buf, 0, 0, "stopping the TPM"); | 720 | tpm_transmit_cmd(chip, &buf, 0, "stopping the TPM"); |
727 | tpm_buf_destroy(&buf); | 721 | tpm_buf_destroy(&buf); |
728 | } | 722 | } |
729 | 723 | ||
@@ -752,7 +746,7 @@ static int tpm2_do_selftest(struct tpm_chip *chip) | |||
752 | return rc; | 746 | return rc; |
753 | 747 | ||
754 | tpm_buf_append_u8(&buf, full); | 748 | tpm_buf_append_u8(&buf, full); |
755 | rc = tpm_transmit_cmd(chip, &buf, 0, 0, | 749 | rc = tpm_transmit_cmd(chip, &buf, 0, |
756 | "attempting the self test"); | 750 | "attempting the self test"); |
757 | tpm_buf_destroy(&buf); | 751 | tpm_buf_destroy(&buf); |
758 | 752 | ||
@@ -789,7 +783,7 @@ int tpm2_probe(struct tpm_chip *chip) | |||
789 | tpm_buf_append_u32(&buf, TPM2_CAP_TPM_PROPERTIES); | 783 | tpm_buf_append_u32(&buf, TPM2_CAP_TPM_PROPERTIES); |
790 | tpm_buf_append_u32(&buf, TPM_PT_TOTAL_COMMANDS); | 784 | tpm_buf_append_u32(&buf, TPM_PT_TOTAL_COMMANDS); |
791 | tpm_buf_append_u32(&buf, 1); | 785 | tpm_buf_append_u32(&buf, 1); |
792 | rc = tpm_transmit_cmd(chip, &buf, 0, 0, NULL); | 786 | rc = tpm_transmit_cmd(chip, &buf, 0, NULL); |
793 | /* We ignore TPM return codes on purpose. */ | 787 | /* We ignore TPM return codes on purpose. */ |
794 | if (rc >= 0) { | 788 | if (rc >= 0) { |
795 | out = (struct tpm_header *)buf.data; | 789 | out = (struct tpm_header *)buf.data; |
@@ -828,7 +822,7 @@ static ssize_t tpm2_get_pcr_allocation(struct tpm_chip *chip) | |||
828 | tpm_buf_append_u32(&buf, 0); | 822 | tpm_buf_append_u32(&buf, 0); |
829 | tpm_buf_append_u32(&buf, 1); | 823 | tpm_buf_append_u32(&buf, 1); |
830 | 824 | ||
831 | rc = tpm_transmit_cmd(chip, &buf, 9, 0, "get tpm pcr allocation"); | 825 | rc = tpm_transmit_cmd(chip, &buf, 9, "get tpm pcr allocation"); |
832 | if (rc) | 826 | if (rc) |
833 | goto out; | 827 | goto out; |
834 | 828 | ||
@@ -899,7 +893,7 @@ static int tpm2_get_cc_attrs_tbl(struct tpm_chip *chip) | |||
899 | tpm_buf_append_u32(&buf, TPM2_CC_FIRST); | 893 | tpm_buf_append_u32(&buf, TPM2_CC_FIRST); |
900 | tpm_buf_append_u32(&buf, nr_commands); | 894 | tpm_buf_append_u32(&buf, nr_commands); |
901 | 895 | ||
902 | rc = tpm_transmit_cmd(chip, &buf, 9 + 4 * nr_commands, 0, NULL); | 896 | rc = tpm_transmit_cmd(chip, &buf, 9 + 4 * nr_commands, NULL); |
903 | if (rc) { | 897 | if (rc) { |
904 | tpm_buf_destroy(&buf); | 898 | tpm_buf_destroy(&buf); |
905 | goto out; | 899 | goto out; |
@@ -956,7 +950,7 @@ static int tpm2_startup(struct tpm_chip *chip) | |||
956 | return rc; | 950 | return rc; |
957 | 951 | ||
958 | tpm_buf_append_u16(&buf, TPM2_SU_CLEAR); | 952 | tpm_buf_append_u16(&buf, TPM2_SU_CLEAR); |
959 | rc = tpm_transmit_cmd(chip, &buf, 0, 0, "attempting to start the TPM"); | 953 | rc = tpm_transmit_cmd(chip, &buf, 0, "attempting to start the TPM"); |
960 | tpm_buf_destroy(&buf); | 954 | tpm_buf_destroy(&buf); |
961 | 955 | ||
962 | return rc; | 956 | return rc; |
diff --git a/drivers/char/tpm/tpm2-space.c b/drivers/char/tpm/tpm2-space.c index 6cc7bb442162..4a2773c3374f 100644 --- a/drivers/char/tpm/tpm2-space.c +++ b/drivers/char/tpm/tpm2-space.c | |||
@@ -38,7 +38,7 @@ static void tpm2_flush_sessions(struct tpm_chip *chip, struct tpm_space *space) | |||
38 | 38 | ||
39 | for (i = 0; i < ARRAY_SIZE(space->session_tbl); i++) { | 39 | for (i = 0; i < ARRAY_SIZE(space->session_tbl); i++) { |
40 | if (space->session_tbl[i]) | 40 | if (space->session_tbl[i]) |
41 | tpm2_flush_context_cmd(chip, space->session_tbl[i], 0); | 41 | tpm2_flush_context(chip, space->session_tbl[i]); |
42 | } | 42 | } |
43 | } | 43 | } |
44 | 44 | ||
@@ -60,9 +60,9 @@ int tpm2_init_space(struct tpm_space *space) | |||
60 | void tpm2_del_space(struct tpm_chip *chip, struct tpm_space *space) | 60 | void tpm2_del_space(struct tpm_chip *chip, struct tpm_space *space) |
61 | { | 61 | { |
62 | mutex_lock(&chip->tpm_mutex); | 62 | mutex_lock(&chip->tpm_mutex); |
63 | if (!tpm_chip_start(chip, 0)) { | 63 | if (!tpm_chip_start(chip)) { |
64 | tpm2_flush_sessions(chip, space); | 64 | tpm2_flush_sessions(chip, space); |
65 | tpm_chip_stop(chip, 0); | 65 | tpm_chip_stop(chip); |
66 | } | 66 | } |
67 | mutex_unlock(&chip->tpm_mutex); | 67 | mutex_unlock(&chip->tpm_mutex); |
68 | kfree(space->context_buf); | 68 | kfree(space->context_buf); |
@@ -85,7 +85,7 @@ static int tpm2_load_context(struct tpm_chip *chip, u8 *buf, | |||
85 | body_size = sizeof(*ctx) + be16_to_cpu(ctx->blob_size); | 85 | body_size = sizeof(*ctx) + be16_to_cpu(ctx->blob_size); |
86 | tpm_buf_append(&tbuf, &buf[*offset], body_size); | 86 | tpm_buf_append(&tbuf, &buf[*offset], body_size); |
87 | 87 | ||
88 | rc = tpm_transmit_cmd(chip, &tbuf, 4, 0, NULL); | 88 | rc = tpm_transmit_cmd(chip, &tbuf, 4, NULL); |
89 | if (rc < 0) { | 89 | if (rc < 0) { |
90 | dev_warn(&chip->dev, "%s: failed with a system error %d\n", | 90 | dev_warn(&chip->dev, "%s: failed with a system error %d\n", |
91 | __func__, rc); | 91 | __func__, rc); |
@@ -133,7 +133,7 @@ static int tpm2_save_context(struct tpm_chip *chip, u32 handle, u8 *buf, | |||
133 | 133 | ||
134 | tpm_buf_append_u32(&tbuf, handle); | 134 | tpm_buf_append_u32(&tbuf, handle); |
135 | 135 | ||
136 | rc = tpm_transmit_cmd(chip, &tbuf, 0, 0, NULL); | 136 | rc = tpm_transmit_cmd(chip, &tbuf, 0, NULL); |
137 | if (rc < 0) { | 137 | if (rc < 0) { |
138 | dev_warn(&chip->dev, "%s: failed with a system error %d\n", | 138 | dev_warn(&chip->dev, "%s: failed with a system error %d\n", |
139 | __func__, rc); | 139 | __func__, rc); |
@@ -169,7 +169,7 @@ void tpm2_flush_space(struct tpm_chip *chip) | |||
169 | 169 | ||
170 | for (i = 0; i < ARRAY_SIZE(space->context_tbl); i++) | 170 | for (i = 0; i < ARRAY_SIZE(space->context_tbl); i++) |
171 | if (space->context_tbl[i] && ~space->context_tbl[i]) | 171 | if (space->context_tbl[i] && ~space->context_tbl[i]) |
172 | tpm2_flush_context_cmd(chip, space->context_tbl[i], 0); | 172 | tpm2_flush_context(chip, space->context_tbl[i]); |
173 | 173 | ||
174 | tpm2_flush_sessions(chip, space); | 174 | tpm2_flush_sessions(chip, space); |
175 | } | 175 | } |
@@ -417,7 +417,7 @@ static int tpm2_map_response_header(struct tpm_chip *chip, u32 cc, u8 *rsp, | |||
417 | 417 | ||
418 | return 0; | 418 | return 0; |
419 | out_no_slots: | 419 | out_no_slots: |
420 | tpm2_flush_context_cmd(chip, phandle, 0); | 420 | tpm2_flush_context(chip, phandle); |
421 | dev_warn(&chip->dev, "%s: out of slots for 0x%08X\n", __func__, | 421 | dev_warn(&chip->dev, "%s: out of slots for 0x%08X\n", __func__, |
422 | phandle); | 422 | phandle); |
423 | return -ENOMEM; | 423 | return -ENOMEM; |
@@ -504,7 +504,7 @@ static int tpm2_save_space(struct tpm_chip *chip) | |||
504 | } else if (rc) | 504 | } else if (rc) |
505 | return rc; | 505 | return rc; |
506 | 506 | ||
507 | tpm2_flush_context_cmd(chip, space->context_tbl[i], 0); | 507 | tpm2_flush_context(chip, space->context_tbl[i]); |
508 | space->context_tbl[i] = ~0; | 508 | space->context_tbl[i] = ~0; |
509 | } | 509 | } |
510 | 510 | ||
diff --git a/drivers/char/tpm/tpm_tis_core.c b/drivers/char/tpm/tpm_tis_core.c index e33a10491f07..b9f64684c3fb 100644 --- a/drivers/char/tpm/tpm_tis_core.c +++ b/drivers/char/tpm/tpm_tis_core.c | |||
@@ -916,11 +916,11 @@ int tpm_tis_core_init(struct device *dev, struct tpm_tis_data *priv, int irq, | |||
916 | intmask &= ~TPM_GLOBAL_INT_ENABLE; | 916 | intmask &= ~TPM_GLOBAL_INT_ENABLE; |
917 | tpm_tis_write32(priv, TPM_INT_ENABLE(priv->locality), intmask); | 917 | tpm_tis_write32(priv, TPM_INT_ENABLE(priv->locality), intmask); |
918 | 918 | ||
919 | rc = tpm_chip_start(chip, 0); | 919 | rc = tpm_chip_start(chip); |
920 | if (rc) | 920 | if (rc) |
921 | goto out_err; | 921 | goto out_err; |
922 | rc = tpm2_probe(chip); | 922 | rc = tpm2_probe(chip); |
923 | tpm_chip_stop(chip, 0); | 923 | tpm_chip_stop(chip); |
924 | if (rc) | 924 | if (rc) |
925 | goto out_err; | 925 | goto out_err; |
926 | 926 | ||
diff --git a/drivers/char/tpm/tpm_vtpm_proxy.c b/drivers/char/tpm/tpm_vtpm_proxy.c index 9aa6a3baa491..d74f3de74ae6 100644 --- a/drivers/char/tpm/tpm_vtpm_proxy.c +++ b/drivers/char/tpm/tpm_vtpm_proxy.c | |||
@@ -416,7 +416,7 @@ static int vtpm_proxy_request_locality(struct tpm_chip *chip, int locality) | |||
416 | 416 | ||
417 | proxy_dev->state |= STATE_DRIVER_COMMAND; | 417 | proxy_dev->state |= STATE_DRIVER_COMMAND; |
418 | 418 | ||
419 | rc = tpm_transmit_cmd(chip, &buf, 0, 0, "attempting to set locality"); | 419 | rc = tpm_transmit_cmd(chip, &buf, 0, "attempting to set locality"); |
420 | 420 | ||
421 | proxy_dev->state &= ~STATE_DRIVER_COMMAND; | 421 | proxy_dev->state &= ~STATE_DRIVER_COMMAND; |
422 | 422 | ||