Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

tpm: Remove tpm_send()

Open code the last remaining call site for tpm_send().

Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
Reviewed-by: Stefan Berger <stefanb@linux.ibm.com>
Reviewed-by: Jarkko Sakkinen <jarkko@kernel.org>
Tested-by: Jarkko Sakkinen <jarkko@kernel.org>
Signed-off-by: Jarkko Sakkinen <jarkko@kernel.org>

+12 -32
-25
drivers/char/tpm/tpm-interface.c
··· 342 342 } 343 343 EXPORT_SYMBOL_GPL(tpm_pcr_extend); 344 344 345 - /** 346 - * tpm_send - send a TPM command 347 - * @chip: a &struct tpm_chip instance, %NULL for the default chip 348 - * @cmd: a TPM command buffer 349 - * @buflen: the length of the TPM command buffer 350 - * 351 - * Return: same as with tpm_transmit_cmd() 352 - */ 353 - int tpm_send(struct tpm_chip *chip, void *cmd, size_t buflen) 354 - { 355 - struct tpm_buf buf; 356 - int rc; 357 - 358 - chip = tpm_find_get_ops(chip); 359 - if (!chip) 360 - return -ENODEV; 361 - 362 - buf.data = cmd; 363 - rc = tpm_transmit_cmd(chip, &buf, 0, "attempting to a send a command"); 364 - 365 - tpm_put_ops(chip); 366 - return rc; 367 - } 368 - EXPORT_SYMBOL_GPL(tpm_send); 369 - 370 345 int tpm_auto_startup(struct tpm_chip *chip) 371 346 { 372 347 int rc;
-5
include/linux/tpm.h
··· 422 422 struct tpm_digest *digest); 423 423 extern int tpm_pcr_extend(struct tpm_chip *chip, u32 pcr_idx, 424 424 struct tpm_digest *digests); 425 - extern int tpm_send(struct tpm_chip *chip, void *cmd, size_t buflen); 426 425 extern int tpm_get_random(struct tpm_chip *chip, u8 *data, size_t max); 427 426 extern struct tpm_chip *tpm_default_chip(void); 428 427 void tpm2_flush_context(struct tpm_chip *chip, u32 handle); ··· 442 443 return -ENODEV; 443 444 } 444 445 445 - static inline int tpm_send(struct tpm_chip *chip, void *cmd, size_t buflen) 446 - { 447 - return -ENODEV; 448 - } 449 446 static inline int tpm_get_random(struct tpm_chip *chip, u8 *data, size_t max) 450 447 { 451 448 return -ENODEV;
+12 -2
security/keys/trusted-keys/trusted_tpm1.c
··· 356 356 */ 357 357 int trusted_tpm_send(unsigned char *cmd, size_t buflen) 358 358 { 359 + struct tpm_buf buf; 359 360 int rc; 360 361 361 362 if (!chip) 362 363 return -ENODEV; 363 364 365 + rc = tpm_try_get_ops(chip); 366 + if (rc) 367 + return rc; 368 + 369 + buf.flags = 0; 370 + buf.data = cmd; 364 371 dump_tpm_buf(cmd); 365 - rc = tpm_send(chip, cmd, buflen); 372 + rc = tpm_transmit_cmd(chip, &buf, 4, "sending data"); 366 373 dump_tpm_buf(cmd); 374 + 367 375 if (rc > 0) 368 - /* Can't return positive return codes values to keyctl */ 376 + /* TPM error */ 369 377 rc = -EPERM; 378 + 379 + tpm_put_ops(chip); 370 380 return rc; 371 381 } 372 382 EXPORT_SYMBOL_GPL(trusted_tpm_send);