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 <leroy.p.leahy@intel.com>
Reviewed-on: https://review.coreboot.org/18832
Tested-by: build bot (Jenkins)
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
This commit is contained in:
Lee Leahy 2017-03-15 09:22:11 -07:00
parent 08824ec8d4
commit 52ab30b13b
5 changed files with 18 additions and 15 deletions

View File

@ -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 */
};

View File

@ -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;

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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);