提交 2d089f82 编写于 作者: P Peter Huewe 提交者: Kent Yoder

tpm/tpm_i2c_stm_st33: formatting and white space changes

Signed-off-by: NPeter Huewe <peterhuewe@gmx.de>
Signed-off-by: NKent Yoder <key@linux.vnet.ibm.com>
上级 958d2c2f
...@@ -178,7 +178,7 @@ static long _wait_for_interrupt_serirq_timeout(struct tpm_chip *chip, ...@@ -178,7 +178,7 @@ static long _wait_for_interrupt_serirq_timeout(struct tpm_chip *chip,
struct i2c_client *client; struct i2c_client *client;
struct st33zp24_platform_data *pin_infos; struct st33zp24_platform_data *pin_infos;
client = (struct i2c_client *) TPM_VPRIV(chip); client = (struct i2c_client *)TPM_VPRIV(chip);
pin_infos = client->dev.platform_data; pin_infos = client->dev.platform_data;
status = wait_for_completion_interruptible_timeout( status = wait_for_completion_interruptible_timeout(
...@@ -197,12 +197,12 @@ static int wait_for_serirq_timeout(struct tpm_chip *chip, bool condition, ...@@ -197,12 +197,12 @@ static int wait_for_serirq_timeout(struct tpm_chip *chip, bool condition,
int status = 2; int status = 2;
struct i2c_client *client; struct i2c_client *client;
client = (struct i2c_client *) TPM_VPRIV(chip); client = (struct i2c_client *)TPM_VPRIV(chip);
status = _wait_for_interrupt_serirq_timeout(chip, timeout); status = _wait_for_interrupt_serirq_timeout(chip, timeout);
if (!status) { if (!status) {
status = -EBUSY; status = -EBUSY;
} else{ } else {
clear_interruption(client); clear_interruption(client);
if (condition) if (condition)
status = 1; status = 1;
...@@ -219,7 +219,7 @@ static void tpm_stm_i2c_cancel(struct tpm_chip *chip) ...@@ -219,7 +219,7 @@ static void tpm_stm_i2c_cancel(struct tpm_chip *chip)
struct i2c_client *client; struct i2c_client *client;
u8 data; u8 data;
client = (struct i2c_client *) TPM_VPRIV(chip); client = (struct i2c_client *)TPM_VPRIV(chip);
data = TPM_STS_COMMAND_READY; data = TPM_STS_COMMAND_READY;
I2C_WRITE_DATA(client, TPM_STS, &data, 1); I2C_WRITE_DATA(client, TPM_STS, &data, 1);
...@@ -236,7 +236,7 @@ static u8 tpm_stm_i2c_status(struct tpm_chip *chip) ...@@ -236,7 +236,7 @@ static u8 tpm_stm_i2c_status(struct tpm_chip *chip)
{ {
struct i2c_client *client; struct i2c_client *client;
u8 data; u8 data;
client = (struct i2c_client *) TPM_VPRIV(chip); client = (struct i2c_client *)TPM_VPRIV(chip);
I2C_READ_DATA(client, TPM_STS, &data, 1); I2C_READ_DATA(client, TPM_STS, &data, 1);
return data; return data;
...@@ -254,7 +254,7 @@ static int check_locality(struct tpm_chip *chip) ...@@ -254,7 +254,7 @@ static int check_locality(struct tpm_chip *chip)
u8 data; u8 data;
u8 status; u8 status;
client = (struct i2c_client *) TPM_VPRIV(chip); client = (struct i2c_client *)TPM_VPRIV(chip);
status = I2C_READ_DATA(client, TPM_ACCESS, &data, 1); status = I2C_READ_DATA(client, TPM_ACCESS, &data, 1);
if (status && (data & if (status && (data &
...@@ -278,7 +278,7 @@ static int request_locality(struct tpm_chip *chip) ...@@ -278,7 +278,7 @@ static int request_locality(struct tpm_chip *chip)
struct i2c_client *client; struct i2c_client *client;
u8 data; u8 data;
client = (struct i2c_client *) TPM_VPRIV(chip); client = (struct i2c_client *)TPM_VPRIV(chip);
if (check_locality(chip) == chip->vendor.locality) if (check_locality(chip) == chip->vendor.locality)
return chip->vendor.locality; return chip->vendor.locality;
...@@ -294,7 +294,7 @@ static int request_locality(struct tpm_chip *chip) ...@@ -294,7 +294,7 @@ static int request_locality(struct tpm_chip *chip)
chip->vendor.timeout_a); chip->vendor.timeout_a);
if (rc > 0) if (rc > 0)
return chip->vendor.locality; return chip->vendor.locality;
} else{ } else {
stop = jiffies + chip->vendor.timeout_a; stop = jiffies + chip->vendor.timeout_a;
do { do {
if (check_locality(chip) >= 0) if (check_locality(chip) >= 0)
...@@ -316,7 +316,7 @@ static void release_locality(struct tpm_chip *chip) ...@@ -316,7 +316,7 @@ static void release_locality(struct tpm_chip *chip)
struct i2c_client *client; struct i2c_client *client;
u8 data; u8 data;
client = (struct i2c_client *) TPM_VPRIV(chip); client = (struct i2c_client *)TPM_VPRIV(chip);
data = TPM_ACCESS_ACTIVE_LOCALITY; data = TPM_ACCESS_ACTIVE_LOCALITY;
I2C_WRITE_DATA(client, TPM_ACCESS, &data, 1); I2C_WRITE_DATA(client, TPM_ACCESS, &data, 1);
...@@ -333,7 +333,7 @@ static int get_burstcount(struct tpm_chip *chip) ...@@ -333,7 +333,7 @@ static int get_burstcount(struct tpm_chip *chip)
int burstcnt, status; int burstcnt, status;
u8 tpm_reg, temp; u8 tpm_reg, temp;
struct i2c_client *client = (struct i2c_client *) TPM_VPRIV(chip); struct i2c_client *client = (struct i2c_client *)TPM_VPRIV(chip);
stop = jiffies + chip->vendor.timeout_d; stop = jiffies + chip->vendor.timeout_d;
do { do {
...@@ -379,7 +379,7 @@ static int wait_for_stat(struct tpm_chip *chip, u8 mask, unsigned long timeout, ...@@ -379,7 +379,7 @@ static int wait_for_stat(struct tpm_chip *chip, u8 mask, unsigned long timeout,
mask), timeout); mask), timeout);
if (rc > 0) if (rc > 0)
return 0; return 0;
} else{ } else {
stop = jiffies + timeout; stop = jiffies + timeout;
do { do {
msleep(TPM_TIMEOUT); msleep(TPM_TIMEOUT);
...@@ -403,7 +403,7 @@ static int recv_data(struct tpm_chip *chip, u8 *buf, size_t count) ...@@ -403,7 +403,7 @@ static int recv_data(struct tpm_chip *chip, u8 *buf, size_t count)
int size = 0, burstcnt, len; int size = 0, burstcnt, len;
struct i2c_client *client; struct i2c_client *client;
client = (struct i2c_client *) TPM_VPRIV(chip); client = (struct i2c_client *)TPM_VPRIV(chip);
while (size < count && while (size < count &&
wait_for_stat(chip, wait_for_stat(chip,
...@@ -433,7 +433,7 @@ static irqreturn_t tpm_ioserirq_handler(int irq, void *dev_id) ...@@ -433,7 +433,7 @@ static irqreturn_t tpm_ioserirq_handler(int irq, void *dev_id)
disable_irq_nosync(irq); disable_irq_nosync(irq);
client = (struct i2c_client *) TPM_VPRIV(chip); client = (struct i2c_client *)TPM_VPRIV(chip);
pin_infos = client->dev.platform_data; pin_infos = client->dev.platform_data;
complete(&pin_infos->irq_detection); complete(&pin_infos->irq_detection);
...@@ -453,8 +453,7 @@ static irqreturn_t tpm_ioserirq_handler(int irq, void *dev_id) ...@@ -453,8 +453,7 @@ static irqreturn_t tpm_ioserirq_handler(int irq, void *dev_id)
static int tpm_stm_i2c_send(struct tpm_chip *chip, unsigned char *buf, static int tpm_stm_i2c_send(struct tpm_chip *chip, unsigned char *buf,
size_t len) size_t len)
{ {
u32 status, u32 status, burstcnt = 0, i, size;
burstcnt = 0, i, size;
int ret; int ret;
u8 data; u8 data;
struct i2c_client *client; struct i2c_client *client;
...@@ -483,7 +482,7 @@ static int tpm_stm_i2c_send(struct tpm_chip *chip, unsigned char *buf, ...@@ -483,7 +482,7 @@ static int tpm_stm_i2c_send(struct tpm_chip *chip, unsigned char *buf,
} }
} }
for (i = 0 ; i < len - 1 ;) { for (i = 0; i < len - 1;) {
burstcnt = get_burstcount(chip); burstcnt = get_burstcount(chip);
size = min_t(int, len - i - 1, burstcnt); size = min_t(int, len - i - 1, burstcnt);
ret = I2C_WRITE_DATA(client, TPM_DATA_FIFO, buf, size); ret = I2C_WRITE_DATA(client, TPM_DATA_FIFO, buf, size);
...@@ -547,7 +546,7 @@ static int tpm_stm_i2c_recv(struct tpm_chip *chip, unsigned char *buf, ...@@ -547,7 +546,7 @@ static int tpm_stm_i2c_recv(struct tpm_chip *chip, unsigned char *buf,
goto out; goto out;
} }
expected = be32_to_cpu(*(__be32 *) (buf + 2)); expected = be32_to_cpu(*(__be32 *)(buf + 2));
if (expected > count) { if (expected > count) {
size = -EIO; size = -EIO;
goto out; goto out;
...@@ -569,7 +568,7 @@ static int tpm_stm_i2c_recv(struct tpm_chip *chip, unsigned char *buf, ...@@ -569,7 +568,7 @@ static int tpm_stm_i2c_recv(struct tpm_chip *chip, unsigned char *buf,
static bool tpm_st33_i2c_req_canceled(struct tpm_chip *chip, u8 status) static bool tpm_st33_i2c_req_canceled(struct tpm_chip *chip, u8 status)
{ {
return (status == TPM_STS_COMMAND_READY); return (status == TPM_STS_COMMAND_READY);
} }
static const struct file_operations tpm_st33_i2c_fops = { static const struct file_operations tpm_st33_i2c_fops = {
...@@ -617,7 +616,7 @@ static struct tpm_vendor_specific st_i2c_tpm = { ...@@ -617,7 +616,7 @@ static struct tpm_vendor_specific st_i2c_tpm = {
.miscdev = {.fops = &tpm_st33_i2c_fops,}, .miscdev = {.fops = &tpm_st33_i2c_fops,},
}; };
static int interrupts ; static int interrupts;
module_param(interrupts, int, 0444); module_param(interrupts, int, 0444);
MODULE_PARM_DESC(interrupts, "Enable interrupts"); MODULE_PARM_DESC(interrupts, "Enable interrupts");
...@@ -714,7 +713,7 @@ tpm_st33_i2c_probe(struct i2c_client *client, const struct i2c_device_id *id) ...@@ -714,7 +713,7 @@ tpm_st33_i2c_probe(struct i2c_client *client, const struct i2c_device_id *id)
"TPM SERIRQ management", chip); "TPM SERIRQ management", chip);
if (err < 0) { if (err < 0) {
dev_err(chip->dev , "TPM SERIRQ signals %d not available\n", dev_err(chip->dev , "TPM SERIRQ signals %d not available\n",
gpio_to_irq(platform_data->io_serirq)); gpio_to_irq(platform_data->io_serirq));
goto _irq_set; goto _irq_set;
} }
...@@ -754,7 +753,7 @@ tpm_st33_i2c_probe(struct i2c_client *client, const struct i2c_device_id *id) ...@@ -754,7 +753,7 @@ tpm_st33_i2c_probe(struct i2c_client *client, const struct i2c_device_id *id)
dev_info(chip->dev, "TPM I2C Initialized\n"); dev_info(chip->dev, "TPM I2C Initialized\n");
return 0; return 0;
_irq_set: _irq_set:
free_irq(gpio_to_irq(platform_data->io_serirq), (void *) chip); free_irq(gpio_to_irq(platform_data->io_serirq), (void *)chip);
_gpio_init2: _gpio_init2:
if (interrupts) if (interrupts)
gpio_free(platform_data->io_serirq); gpio_free(platform_data->io_serirq);
...@@ -784,7 +783,7 @@ static int tpm_st33_i2c_remove(struct i2c_client *client) ...@@ -784,7 +783,7 @@ static int tpm_st33_i2c_remove(struct i2c_client *client)
{ {
struct tpm_chip *chip = (struct tpm_chip *)i2c_get_clientdata(client); struct tpm_chip *chip = (struct tpm_chip *)i2c_get_clientdata(client);
struct st33zp24_platform_data *pin_infos = struct st33zp24_platform_data *pin_infos =
((struct i2c_client *) TPM_VPRIV(chip))->dev.platform_data; ((struct i2c_client *)TPM_VPRIV(chip))->dev.platform_data;
if (pin_infos != NULL) { if (pin_infos != NULL) {
free_irq(pin_infos->io_serirq, chip); free_irq(pin_infos->io_serirq, chip);
...@@ -823,9 +822,9 @@ static int tpm_st33_i2c_pm_suspend(struct device *dev) ...@@ -823,9 +822,9 @@ static int tpm_st33_i2c_pm_suspend(struct device *dev)
struct st33zp24_platform_data *pin_infos = dev->platform_data; struct st33zp24_platform_data *pin_infos = dev->platform_data;
int ret = 0; int ret = 0;
if (power_mgt) if (power_mgt) {
gpio_set_value(pin_infos->io_lpcpd, 0); gpio_set_value(pin_infos->io_lpcpd, 0);
else{ } else {
if (chip->data_buffer == NULL) if (chip->data_buffer == NULL)
chip->data_buffer = pin_infos->tpm_i2c_buffer[0]; chip->data_buffer = pin_infos->tpm_i2c_buffer[0];
ret = tpm_pm_suspend(dev); ret = tpm_pm_suspend(dev);
...@@ -851,12 +850,12 @@ static int tpm_st33_i2c_pm_resume(struct device *dev) ...@@ -851,12 +850,12 @@ static int tpm_st33_i2c_pm_resume(struct device *dev)
(chip->vendor.status(chip) & (chip->vendor.status(chip) &
TPM_STS_VALID) == TPM_STS_VALID, TPM_STS_VALID) == TPM_STS_VALID,
chip->vendor.timeout_b); chip->vendor.timeout_b);
} else{ } else {
if (chip->data_buffer == NULL) if (chip->data_buffer == NULL)
chip->data_buffer = pin_infos->tpm_i2c_buffer[0]; chip->data_buffer = pin_infos->tpm_i2c_buffer[0];
ret = tpm_pm_resume(dev); ret = tpm_pm_resume(dev);
if (!ret) if (!ret)
tpm_do_selftest(chip); tpm_do_selftest(chip);
} }
return ret; return ret;
} /* tpm_st33_i2c_pm_resume() */ } /* tpm_st33_i2c_pm_resume() */
...@@ -867,7 +866,8 @@ static const struct i2c_device_id tpm_st33_i2c_id[] = { ...@@ -867,7 +866,8 @@ static const struct i2c_device_id tpm_st33_i2c_id[] = {
{} {}
}; };
MODULE_DEVICE_TABLE(i2c, tpm_st33_i2c_id); MODULE_DEVICE_TABLE(i2c, tpm_st33_i2c_id);
static SIMPLE_DEV_PM_OPS(tpm_st33_i2c_ops, tpm_st33_i2c_pm_suspend, tpm_st33_i2c_pm_resume); static SIMPLE_DEV_PM_OPS(tpm_st33_i2c_ops, tpm_st33_i2c_pm_suspend,
tpm_st33_i2c_pm_resume);
static struct i2c_driver tpm_st33_i2c_driver = { static struct i2c_driver tpm_st33_i2c_driver = {
.driver = { .driver = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册