Skip to content

Commit 47a6c28

Browse files
author
Jarkko Sakkinen
committed
tpm: remove @flags from tpm_transmit()
Remove @flags from tpm_transmit() API. It is no longer used for anything. Signed-off-by: Jarkko Sakkinen <[email protected]> Reviewed-by: Stefan Berger <[email protected]> Tested-by: Stefan Berger <[email protected]> Reviewed-by: Jerry Snitselaar <[email protected]> Reviewed-by: James Bottomley <[email protected]> Tested-by: Alexander Steffen <[email protected]>
1 parent a3fbfae commit 47a6c28

File tree

10 files changed

+73
-90
lines changed

10 files changed

+73
-90
lines changed

drivers/char/tpm/tpm-chip.c

Lines changed: 19 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ struct class *tpm_class;
3737
struct class *tpmrm_class;
3838
dev_t tpm_devt;
3939

40-
static int tpm_request_locality(struct tpm_chip *chip, unsigned int flags)
40+
static int tpm_request_locality(struct tpm_chip *chip)
4141
{
4242
int rc;
4343

@@ -52,7 +52,7 @@ static int tpm_request_locality(struct tpm_chip *chip, unsigned int flags)
5252
return 0;
5353
}
5454

55-
static void tpm_relinquish_locality(struct tpm_chip *chip, unsigned int flags)
55+
static void tpm_relinquish_locality(struct tpm_chip *chip)
5656
{
5757
int rc;
5858

@@ -66,15 +66,15 @@ static void tpm_relinquish_locality(struct tpm_chip *chip, unsigned int flags)
6666
chip->locality = -1;
6767
}
6868

69-
static int tpm_cmd_ready(struct tpm_chip *chip, unsigned int flags)
69+
static int tpm_cmd_ready(struct tpm_chip *chip)
7070
{
7171
if (!chip->ops->cmd_ready)
7272
return 0;
7373

7474
return chip->ops->cmd_ready(chip);
7575
}
7676

77-
static int tpm_go_idle(struct tpm_chip *chip, unsigned int flags)
77+
static int tpm_go_idle(struct tpm_chip *chip)
7878
{
7979
if (!chip->ops->go_idle)
8080
return 0;
@@ -85,30 +85,29 @@ static int tpm_go_idle(struct tpm_chip *chip, unsigned int flags)
8585
/**
8686
* tpm_chip_start() - power on the TPM
8787
* @chip: a TPM chip to use
88-
* @flags: TPM transmit flags
8988
*
9089
* Return:
9190
* * The response length - OK
9291
* * -errno - A system error
9392
*/
94-
int tpm_chip_start(struct tpm_chip *chip, unsigned int flags)
93+
int tpm_chip_start(struct tpm_chip *chip)
9594
{
9695
int ret;
9796

9897
if (chip->ops->clk_enable)
9998
chip->ops->clk_enable(chip, true);
10099

101100
if (chip->locality == -1) {
102-
ret = tpm_request_locality(chip, flags);
101+
ret = tpm_request_locality(chip);
103102
if (ret) {
104103
chip->ops->clk_enable(chip, false);
105104
return ret;
106105
}
107106
}
108107

109-
ret = tpm_cmd_ready(chip, flags);
108+
ret = tpm_cmd_ready(chip);
110109
if (ret) {
111-
tpm_relinquish_locality(chip, flags);
110+
tpm_relinquish_locality(chip);
112111
if (chip->ops->clk_enable)
113112
chip->ops->clk_enable(chip, false);
114113
return ret;
@@ -121,16 +120,15 @@ EXPORT_SYMBOL_GPL(tpm_chip_start);
121120
/**
122121
* tpm_chip_stop() - power off the TPM
123122
* @chip: a TPM chip to use
124-
* @flags: TPM transmit flags
125123
*
126124
* Return:
127125
* * The response length - OK
128126
* * -errno - A system error
129127
*/
130-
void tpm_chip_stop(struct tpm_chip *chip, unsigned int flags)
128+
void tpm_chip_stop(struct tpm_chip *chip)
131129
{
132-
tpm_go_idle(chip, flags);
133-
tpm_relinquish_locality(chip, flags);
130+
tpm_go_idle(chip);
131+
tpm_relinquish_locality(chip);
134132
if (chip->ops->clk_enable)
135133
chip->ops->clk_enable(chip, false);
136134
}
@@ -158,7 +156,7 @@ int tpm_try_get_ops(struct tpm_chip *chip)
158156
goto out_ops;
159157

160158
mutex_lock(&chip->tpm_mutex);
161-
rc = tpm_chip_start(chip, 0);
159+
rc = tpm_chip_start(chip);
162160
if (rc)
163161
goto out_lock;
164162

@@ -181,7 +179,7 @@ EXPORT_SYMBOL_GPL(tpm_try_get_ops);
181179
*/
182180
void tpm_put_ops(struct tpm_chip *chip)
183181
{
184-
tpm_chip_stop(chip, 0);
182+
tpm_chip_stop(chip);
185183
mutex_unlock(&chip->tpm_mutex);
186184
up_read(&chip->ops_sem);
187185
put_device(&chip->dev);
@@ -297,9 +295,9 @@ static int tpm_class_shutdown(struct device *dev)
297295

298296
if (chip->flags & TPM_CHIP_FLAG_TPM2) {
299297
down_write(&chip->ops_sem);
300-
if (!tpm_chip_start(chip, 0)) {
298+
if (!tpm_chip_start(chip)) {
301299
tpm2_shutdown(chip, TPM2_SU_CLEAR);
302-
tpm_chip_stop(chip, 0);
300+
tpm_chip_stop(chip);
303301
}
304302
chip->ops = NULL;
305303
up_write(&chip->ops_sem);
@@ -480,9 +478,9 @@ static void tpm_del_char_device(struct tpm_chip *chip)
480478
/* Make the driver uncallable. */
481479
down_write(&chip->ops_sem);
482480
if (chip->flags & TPM_CHIP_FLAG_TPM2) {
483-
if (!tpm_chip_start(chip, 0)) {
481+
if (!tpm_chip_start(chip)) {
484482
tpm2_shutdown(chip, TPM2_SU_CLEAR);
485-
tpm_chip_stop(chip, 0);
483+
tpm_chip_stop(chip);
486484
}
487485
}
488486
chip->ops = NULL;
@@ -566,11 +564,11 @@ int tpm_chip_register(struct tpm_chip *chip)
566564
{
567565
int rc;
568566

569-
rc = tpm_chip_start(chip, 0);
567+
rc = tpm_chip_start(chip);
570568
if (rc)
571569
return rc;
572570
rc = tpm_auto_startup(chip);
573-
tpm_chip_stop(chip, 0);
571+
tpm_chip_stop(chip);
574572
if (rc)
575573
return rc;
576574

drivers/char/tpm/tpm-dev-common.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ static ssize_t tpm_dev_transmit(struct tpm_chip *chip, struct tpm_space *space,
4747
if (ret)
4848
goto out_rc;
4949

50-
len = tpm_transmit(chip, buf, bufsiz, 0);
50+
len = tpm_transmit(chip, buf, bufsiz);
5151
if (len < 0)
5252
ret = len;
5353

drivers/char/tpm/tpm-interface.c

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,7 @@ unsigned long tpm_calc_ordinal_duration(struct tpm_chip *chip, u32 ordinal)
6262
}
6363
EXPORT_SYMBOL_GPL(tpm_calc_ordinal_duration);
6464

65-
static ssize_t tpm_try_transmit(struct tpm_chip *chip, void *buf, size_t bufsiz,
66-
unsigned int flags)
65+
static ssize_t tpm_try_transmit(struct tpm_chip *chip, void *buf, size_t bufsiz)
6766
{
6867
struct tpm_header *header = buf;
6968
int rc;
@@ -143,7 +142,6 @@ static ssize_t tpm_try_transmit(struct tpm_chip *chip, void *buf, size_t bufsiz,
143142
* @chip: a TPM chip to use
144143
* @buf: a TPM command buffer
145144
* @bufsiz: length of the TPM command buffer
146-
* @flags: TPM transmit flags
147145
*
148146
* A wrapper around tpm_try_transmit() that handles TPM2_RC_RETRY returns from
149147
* the TPM and retransmits the command after a delay up to a maximum wait of
@@ -156,8 +154,7 @@ static ssize_t tpm_try_transmit(struct tpm_chip *chip, void *buf, size_t bufsiz,
156154
* * The response length - OK
157155
* * -errno - A system error
158156
*/
159-
ssize_t tpm_transmit(struct tpm_chip *chip, u8 *buf, size_t bufsiz,
160-
unsigned int flags)
157+
ssize_t tpm_transmit(struct tpm_chip *chip, u8 *buf, size_t bufsiz)
161158
{
162159
struct tpm_header *header = (struct tpm_header *)buf;
163160
/* space for header and handles */
@@ -177,7 +174,7 @@ ssize_t tpm_transmit(struct tpm_chip *chip, u8 *buf, size_t bufsiz,
177174
memcpy(save, buf, save_size);
178175

179176
for (;;) {
180-
ret = tpm_try_transmit(chip, buf, bufsiz, flags);
177+
ret = tpm_try_transmit(chip, buf, bufsiz);
181178
if (ret < 0)
182179
break;
183180
rc = be32_to_cpu(header->return_code);
@@ -210,7 +207,6 @@ ssize_t tpm_transmit(struct tpm_chip *chip, u8 *buf, size_t bufsiz,
210207
* @chip: a TPM chip to use
211208
* @buf: a TPM command buffer
212209
* @min_rsp_body_length: minimum expected length of response body
213-
* @flags: TPM transmit flags
214210
* @desc: command description used in the error message
215211
*
216212
* Return:
@@ -219,14 +215,13 @@ ssize_t tpm_transmit(struct tpm_chip *chip, u8 *buf, size_t bufsiz,
219215
* * TPM_RC - A TPM error
220216
*/
221217
ssize_t tpm_transmit_cmd(struct tpm_chip *chip, struct tpm_buf *buf,
222-
size_t min_rsp_body_length, unsigned int flags,
223-
const char *desc)
218+
size_t min_rsp_body_length, const char *desc)
224219
{
225220
const struct tpm_header *header = (struct tpm_header *)buf->data;
226221
int err;
227222
ssize_t len;
228223

229-
len = tpm_transmit(chip, buf->data, PAGE_SIZE, flags);
224+
len = tpm_transmit(chip, buf->data, PAGE_SIZE);
230225
if (len < 0)
231226
return len;
232227

@@ -375,8 +370,7 @@ int tpm_send(struct tpm_chip *chip, void *cmd, size_t buflen)
375370
goto out;
376371

377372
memcpy(buf.data, cmd, buflen);
378-
rc = tpm_transmit_cmd(chip, &buf, 0, 0,
379-
"attempting to a send a command");
373+
rc = tpm_transmit_cmd(chip, &buf, 0, "attempting to a send a command");
380374
tpm_buf_destroy(&buf);
381375
out:
382376
tpm_put_ops(chip);
@@ -416,9 +410,9 @@ int tpm_pm_suspend(struct device *dev)
416410

417411
if (chip->flags & TPM_CHIP_FLAG_TPM2) {
418412
mutex_lock(&chip->tpm_mutex);
419-
if (!tpm_chip_start(chip, 0)) {
413+
if (!tpm_chip_start(chip)) {
420414
tpm2_shutdown(chip, TPM2_SU_STATE);
421-
tpm_chip_stop(chip, 0);
415+
tpm_chip_stop(chip);
422416
}
423417
mutex_unlock(&chip->tpm_mutex);
424418
} else {

drivers/char/tpm/tpm-sysfs.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ static ssize_t pubek_show(struct device *dev, struct device_attribute *attr,
5555
tpm_buf_append(&tpm_buf, anti_replay, sizeof(anti_replay));
5656

5757
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"))
5959
goto out_buf;
6060

6161
out = (struct tpm_readpubek_out *)&tpm_buf.data[10];

drivers/char/tpm/tpm.h

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -485,11 +485,9 @@ extern const struct file_operations tpm_fops;
485485
extern const struct file_operations tpmrm_fops;
486486
extern struct idr dev_nums_idr;
487487

488-
ssize_t tpm_transmit(struct tpm_chip *chip, u8 *buf, size_t bufsiz,
489-
unsigned int flags);
488+
ssize_t tpm_transmit(struct tpm_chip *chip, u8 *buf, size_t bufsiz);
490489
ssize_t tpm_transmit_cmd(struct tpm_chip *chip, struct tpm_buf *buf,
491-
size_t min_rsp_body_length, unsigned int flags,
492-
const char *desc);
490+
size_t min_rsp_body_length, const char *desc);
493491
int tpm_get_timeouts(struct tpm_chip *);
494492
int tpm_auto_startup(struct tpm_chip *chip);
495493

@@ -514,8 +512,8 @@ static inline void tpm_msleep(unsigned int delay_msec)
514512
delay_msec * 1000);
515513
};
516514

517-
int tpm_chip_start(struct tpm_chip *chip, unsigned int flags);
518-
void tpm_chip_stop(struct tpm_chip *chip, unsigned int flags);
515+
int tpm_chip_start(struct tpm_chip *chip);
516+
void tpm_chip_stop(struct tpm_chip *chip);
519517
struct tpm_chip *tpm_find_get_ops(struct tpm_chip *chip);
520518
__must_check int tpm_try_get_ops(struct tpm_chip *chip);
521519
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);
548546
int tpm2_pcr_extend(struct tpm_chip *chip, u32 pcr_idx, u32 count,
549547
struct tpm2_digest *digests);
550548
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,
552-
unsigned int flags);
549+
void tpm2_flush_context(struct tpm_chip *chip, u32 handle);
553550
int tpm2_seal_trusted(struct tpm_chip *chip,
554551
struct trusted_key_payload *payload,
555552
struct trusted_key_options *options);

drivers/char/tpm/tpm1-cmd.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -334,7 +334,7 @@ static int tpm1_startup(struct tpm_chip *chip)
334334

335335
tpm_buf_append_u16(&buf, TPM_ST_CLEAR);
336336

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");
338338
tpm_buf_destroy(&buf);
339339
return rc;
340340
}
@@ -458,7 +458,7 @@ int tpm1_pcr_extend(struct tpm_chip *chip, u32 pcr_idx, const u8 *hash,
458458
tpm_buf_append_u32(&buf, pcr_idx);
459459
tpm_buf_append(&buf, hash, TPM_DIGEST_SIZE);
460460

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);
462462
tpm_buf_destroy(&buf);
463463
return rc;
464464
}
@@ -488,7 +488,7 @@ ssize_t tpm1_getcap(struct tpm_chip *chip, u32 subcap_id, cap_t *cap,
488488
tpm_buf_append_u32(&buf, 4);
489489
tpm_buf_append_u32(&buf, subcap_id);
490490
}
491-
rc = tpm_transmit_cmd(chip, &buf, min_cap_length, 0, desc);
491+
rc = tpm_transmit_cmd(chip, &buf, min_cap_length, desc);
492492
if (!rc)
493493
*cap = *(cap_t *)&buf.data[TPM_HEADER_SIZE + 4];
494494
tpm_buf_destroy(&buf);
@@ -529,7 +529,7 @@ int tpm1_get_random(struct tpm_chip *chip, u8 *dest, size_t max)
529529
do {
530530
tpm_buf_append_u32(&buf, num_bytes);
531531

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),
533533
"attempting get random");
534534
if (rc)
535535
goto out;
@@ -574,7 +574,7 @@ int tpm1_pcr_read(struct tpm_chip *chip, u32 pcr_idx, u8 *res_buf)
574574

575575
tpm_buf_append_u32(&buf, pcr_idx);
576576

577-
rc = tpm_transmit_cmd(chip, &buf, TPM_DIGEST_SIZE, 0,
577+
rc = tpm_transmit_cmd(chip, &buf, TPM_DIGEST_SIZE,
578578
"attempting to read a pcr value");
579579
if (rc)
580580
goto out;
@@ -608,7 +608,7 @@ static int tpm1_continue_selftest(struct tpm_chip *chip)
608608
if (rc)
609609
return rc;
610610

611-
rc = tpm_transmit_cmd(chip, &buf, 0, 0, "continue selftest");
611+
rc = tpm_transmit_cmd(chip, &buf, 0, "continue selftest");
612612
tpm_buf_destroy(&buf);
613613
return rc;
614614
}
@@ -734,7 +734,7 @@ int tpm1_pm_suspend(struct tpm_chip *chip, u32 tpm_suspend_pcr)
734734
return rc;
735735
/* now do the actual savestate */
736736
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);
738738
/*
739739
* If the TPM indicates that it is too busy to respond to
740740
* this command then retry before giving up. It can take

0 commit comments

Comments
 (0)