From 52ab30b13b867c1f3cd5aa5d9eb3e24d430c49d5 Mon Sep 17 00:00:00 2001 From: Lee Leahy Date: Wed, 15 Mar 2017 09:22:11 -0700 Subject: drivers/i2c/tpm: Fix issues detected by checkpatch Fix the following warnings detected by checkpatch.pl: WARNING: Prefer 'unsigned int' to bare use of 'unsigned' WARNING: braces {} are not necessary for single statement blocks WARNING: Unnecessary parentheses - maybe == should be = ? WARNING: line over 80 characters WARNING: missing space after return type TEST=Build and run on Galileo Gen2 Change-Id: I56f915f6c1975cce123fd38043bad2638717d88c Signed-off-by: Lee Leahy Reviewed-on: https://review.coreboot.org/18832 Tested-by: build bot (Jenkins) Reviewed-by: Aaron Durbin --- src/drivers/i2c/tpm/chip.h | 2 +- src/drivers/i2c/tpm/cr50.c | 4 ++-- src/drivers/i2c/tpm/tis.c | 8 ++++---- src/drivers/i2c/tpm/tpm.c | 13 ++++++++----- src/drivers/i2c/tpm/tpm.h | 6 +++--- 5 files changed, 18 insertions(+), 15 deletions(-) (limited to 'src') diff --git a/src/drivers/i2c/tpm/chip.h b/src/drivers/i2c/tpm/chip.h index 14103c7cc3..83df998c96 100644 --- a/src/drivers/i2c/tpm/chip.h +++ b/src/drivers/i2c/tpm/chip.h @@ -4,7 +4,7 @@ struct drivers_i2c_tpm_config { const char *hid; /* ACPI _HID (required) */ const char *desc; /* Device Description */ - unsigned uid; /* ACPI _UID */ + unsigned int uid; /* ACPI _UID */ enum i2c_speed speed; /* Bus speed in Hz, default is I2C_SPEED_FAST */ struct acpi_irq irq; /* Interrupt */ }; diff --git a/src/drivers/i2c/tpm/cr50.c b/src/drivers/i2c/tpm/cr50.c index 0877de01ea..42c82d6fec 100644 --- a/src/drivers/i2c/tpm/cr50.c +++ b/src/drivers/i2c/tpm/cr50.c @@ -438,7 +438,7 @@ static void cr50_vendor_init(struct tpm_chip *chip) __func__, CR50_TIMEOUT_NOIRQ_MS); } -int tpm_vendor_probe(unsigned bus, uint32_t addr) +int tpm_vendor_probe(unsigned int bus, uint32_t addr) { struct tpm_inf_dev *tpm_dev = car_get_var_ptr(&g_tpm_dev); struct tpm_chip probe_chip; @@ -475,7 +475,7 @@ int tpm_vendor_probe(unsigned bus, uint32_t addr) return 0; } -int tpm_vendor_init(struct tpm_chip *chip, unsigned bus, uint32_t dev_addr) +int tpm_vendor_init(struct tpm_chip *chip, unsigned int bus, uint32_t dev_addr) { struct tpm_inf_dev *tpm_dev = car_get_var_ptr(&g_tpm_dev); uint32_t vendor; diff --git a/src/drivers/i2c/tpm/tis.c b/src/drivers/i2c/tpm/tis.c index fea5145ad2..a0d05409ef 100644 --- a/src/drivers/i2c/tpm/tis.c +++ b/src/drivers/i2c/tpm/tis.c @@ -47,9 +47,8 @@ int tis_open(void) if (rc < 0) chip->is_open = 0; - if (rc) { + if (rc) return -1; - } return 0; } @@ -115,8 +114,9 @@ static ssize_t tpm_transmit(const uint8_t *buf, size_t bufsiz) goto out_recv; } - if ((status == chip->vendor.req_canceled)) { - printk(BIOS_DEBUG, "tpm_transmit: Operation Canceled\n"); + if (status == chip->vendor.req_canceled) { + printk(BIOS_DEBUG, + "tpm_transmit: Operation Canceled\n"); rc = -1; goto out; } diff --git a/src/drivers/i2c/tpm/tpm.c b/src/drivers/i2c/tpm/tpm.c index 972b17de42..e804d6fc60 100644 --- a/src/drivers/i2c/tpm/tpm.c +++ b/src/drivers/i2c/tpm/tpm.c @@ -174,7 +174,8 @@ static int iic_tpm_write_generic(uint8_t addr, uint8_t *buffer, size_t len, int count; if (len > TPM_BUFSIZE) { - printk(BIOS_DEBUG, "%s: Length %zd is too large\n", __func__, len); + printk(BIOS_DEBUG, "%s: Length %zd is too large\n", + __func__, len); return -1; } @@ -313,7 +314,8 @@ static ssize_t get_burstcount(struct tpm_chip *chip) int timeout = 2 * 1000; /* 2s timeout */ while (timeout) { /* Note: STS is little endian */ - if (iic_tpm_read(TPM_STS(chip->vendor.locality) + 1, buf, 3) < 0) + if (iic_tpm_read(TPM_STS(chip->vendor.locality) + 1, buf, 3) + < 0) burstcnt = 0; else burstcnt = (buf[2] << 16) + (buf[1] << 8) + buf[0]; @@ -473,7 +475,7 @@ out_err: /* Initialization of I2C TPM */ -int tpm_vendor_probe(unsigned bus, uint32_t addr) +int tpm_vendor_probe(unsigned int bus, uint32_t addr) { struct tpm_inf_dev *tpm_dev = car_get_var_ptr(&g_tpm_dev); struct stopwatch sw; @@ -515,7 +517,7 @@ int tpm_vendor_probe(unsigned bus, uint32_t addr) return 0; } -int tpm_vendor_init(struct tpm_chip *chip, unsigned bus, uint32_t dev_addr) +int tpm_vendor_init(struct tpm_chip *chip, unsigned int bus, uint32_t dev_addr) { struct tpm_inf_dev *tpm_dev = car_get_var_ptr(&g_tpm_dev); uint32_t vendor; @@ -557,7 +559,8 @@ int tpm_vendor_init(struct tpm_chip *chip, unsigned bus, uint32_t dev_addr) } else if (be32_to_cpu(vendor) == TPM_TIS_I2C_DID_VID_9635) { tpm_dev->chip_type = SLB9635; } else { - printk(BIOS_DEBUG, "Vendor ID 0x%08x not recognized.\n", vendor); + printk(BIOS_DEBUG, "Vendor ID 0x%08x not recognized.\n", + vendor); goto out_err; } diff --git a/src/drivers/i2c/tpm/tpm.h b/src/drivers/i2c/tpm/tpm.h index b6dda1af47..403620f0d6 100644 --- a/src/drivers/i2c/tpm/tpm.h +++ b/src/drivers/i2c/tpm/tpm.h @@ -78,7 +78,7 @@ struct tpm_vendor_specific { int (*recv)(struct tpm_chip *, uint8_t *, size_t); int (*send)(struct tpm_chip *, uint8_t *, size_t); void (*cancel)(struct tpm_chip *); - uint8_t(*status)(struct tpm_chip *); + uint8_t (*status)(struct tpm_chip *); int locality; }; @@ -145,9 +145,9 @@ struct tpm_cmd_t { /* ---------- Interface for TPM vendor ------------ */ -int tpm_vendor_probe(unsigned bus, uint32_t addr); +int tpm_vendor_probe(unsigned int bus, uint32_t addr); -int tpm_vendor_init(struct tpm_chip *chip, unsigned bus, uint32_t dev_addr); +int tpm_vendor_init(struct tpm_chip *chip, unsigned int bus, uint32_t dev_addr); void tpm_vendor_cleanup(struct tpm_chip *chip); -- cgit v1.2.3