Commit 71ed848f authored by Jarkko Sakkinen's avatar Jarkko Sakkinen Committed by Peter Huewe

tpm: rename chip->dev to chip->pdev

Rename chip->dev to chip->pdev to make it explicit that this not the
character device but actually represents the platform device.
Signed-off-by: default avatarJarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
Reviewed-by: default avatarJasob Gunthorpe <jason.gunthorpe@obsidianresearch.com>
Reviewed-by: default avatarStefan Berger <stefanb@linux.vnet.ibm.com>
Reviewed-by: default avatarPeter Huewe <peterhuewe@gmx.de>
Tested-by: default avatarScot Doyle <lkml14@scotdoyle.com>
Tested-by: default avatarPeter Huewe <peterhuewe@gmx.de>
Signed-off-by: default avatarPeter Huewe <peterhuewe@gmx.de>
parent 0dc55365
...@@ -45,7 +45,7 @@ struct tpm_chip *tpm_chip_find_get(int chip_num) ...@@ -45,7 +45,7 @@ struct tpm_chip *tpm_chip_find_get(int chip_num)
if (chip_num != TPM_ANY_NUM && chip_num != pos->dev_num) if (chip_num != TPM_ANY_NUM && chip_num != pos->dev_num)
continue; continue;
if (try_module_get(pos->dev->driver->owner)) { if (try_module_get(pos->pdev->driver->owner)) {
chip = pos; chip = pos;
break; break;
} }
...@@ -110,7 +110,7 @@ struct tpm_chip *tpmm_chip_alloc(struct device *dev, ...@@ -110,7 +110,7 @@ struct tpm_chip *tpmm_chip_alloc(struct device *dev,
scnprintf(chip->devname, sizeof(chip->devname), "tpm%d", chip->dev_num); scnprintf(chip->devname, sizeof(chip->devname), "tpm%d", chip->dev_num);
chip->dev = dev; chip->pdev = dev;
devm_add_action(dev, tpmm_chip_remove, chip); devm_add_action(dev, tpmm_chip_remove, chip);
dev_set_drvdata(dev, chip); dev_set_drvdata(dev, chip);
......
...@@ -63,7 +63,7 @@ static int tpm_open(struct inode *inode, struct file *file) ...@@ -63,7 +63,7 @@ static int tpm_open(struct inode *inode, struct file *file)
* by the check of is_open variable, which is protected * by the check of is_open variable, which is protected
* by driver_lock. */ * by driver_lock. */
if (test_and_set_bit(0, &chip->is_open)) { if (test_and_set_bit(0, &chip->is_open)) {
dev_dbg(chip->dev, "Another process owns this TPM\n"); dev_dbg(chip->pdev, "Another process owns this TPM\n");
return -EBUSY; return -EBUSY;
} }
...@@ -81,7 +81,7 @@ static int tpm_open(struct inode *inode, struct file *file) ...@@ -81,7 +81,7 @@ static int tpm_open(struct inode *inode, struct file *file)
INIT_WORK(&priv->work, timeout_work); INIT_WORK(&priv->work, timeout_work);
file->private_data = priv; file->private_data = priv;
get_device(chip->dev); get_device(chip->pdev);
return 0; return 0;
} }
...@@ -168,7 +168,7 @@ static int tpm_release(struct inode *inode, struct file *file) ...@@ -168,7 +168,7 @@ static int tpm_release(struct inode *inode, struct file *file)
file->private_data = NULL; file->private_data = NULL;
atomic_set(&priv->data_pending, 0); atomic_set(&priv->data_pending, 0);
clear_bit(0, &priv->chip->is_open); clear_bit(0, &priv->chip->is_open);
put_device(priv->chip->dev); put_device(priv->chip->pdev);
kfree(priv); kfree(priv);
return 0; return 0;
} }
...@@ -193,12 +193,12 @@ int tpm_dev_add_device(struct tpm_chip *chip) ...@@ -193,12 +193,12 @@ int tpm_dev_add_device(struct tpm_chip *chip)
chip->vendor.miscdev.minor = MISC_DYNAMIC_MINOR; chip->vendor.miscdev.minor = MISC_DYNAMIC_MINOR;
chip->vendor.miscdev.name = chip->devname; chip->vendor.miscdev.name = chip->devname;
chip->vendor.miscdev.parent = chip->dev; chip->vendor.miscdev.parent = chip->pdev;
rc = misc_register(&chip->vendor.miscdev); rc = misc_register(&chip->vendor.miscdev);
if (rc) { if (rc) {
chip->vendor.miscdev.name = NULL; chip->vendor.miscdev.name = NULL;
dev_err(chip->dev, dev_err(chip->pdev,
"unable to misc_register %s, minor %d err=%d\n", "unable to misc_register %s, minor %d err=%d\n",
chip->vendor.miscdev.name, chip->vendor.miscdev.name,
chip->vendor.miscdev.minor, rc); chip->vendor.miscdev.minor, rc);
......
...@@ -343,7 +343,7 @@ ssize_t tpm_transmit(struct tpm_chip *chip, const char *buf, ...@@ -343,7 +343,7 @@ ssize_t tpm_transmit(struct tpm_chip *chip, const char *buf,
if (count == 0) if (count == 0)
return -ENODATA; return -ENODATA;
if (count > bufsiz) { if (count > bufsiz) {
dev_err(chip->dev, dev_err(chip->pdev,
"invalid count value %x %zx\n", count, bufsiz); "invalid count value %x %zx\n", count, bufsiz);
return -E2BIG; return -E2BIG;
} }
...@@ -352,7 +352,7 @@ ssize_t tpm_transmit(struct tpm_chip *chip, const char *buf, ...@@ -352,7 +352,7 @@ ssize_t tpm_transmit(struct tpm_chip *chip, const char *buf,
rc = chip->ops->send(chip, (u8 *) buf, count); rc = chip->ops->send(chip, (u8 *) buf, count);
if (rc < 0) { if (rc < 0) {
dev_err(chip->dev, dev_err(chip->pdev,
"tpm_transmit: tpm_send: error %zd\n", rc); "tpm_transmit: tpm_send: error %zd\n", rc);
goto out; goto out;
} }
...@@ -368,7 +368,7 @@ ssize_t tpm_transmit(struct tpm_chip *chip, const char *buf, ...@@ -368,7 +368,7 @@ ssize_t tpm_transmit(struct tpm_chip *chip, const char *buf,
goto out_recv; goto out_recv;
if (chip->ops->req_canceled(chip, status)) { if (chip->ops->req_canceled(chip, status)) {
dev_err(chip->dev, "Operation Canceled\n"); dev_err(chip->pdev, "Operation Canceled\n");
rc = -ECANCELED; rc = -ECANCELED;
goto out; goto out;
} }
...@@ -378,14 +378,14 @@ ssize_t tpm_transmit(struct tpm_chip *chip, const char *buf, ...@@ -378,14 +378,14 @@ ssize_t tpm_transmit(struct tpm_chip *chip, const char *buf,
} while (time_before(jiffies, stop)); } while (time_before(jiffies, stop));
chip->ops->cancel(chip); chip->ops->cancel(chip);
dev_err(chip->dev, "Operation Timed out\n"); dev_err(chip->pdev, "Operation Timed out\n");
rc = -ETIME; rc = -ETIME;
goto out; goto out;
out_recv: out_recv:
rc = chip->ops->recv(chip, (u8 *) buf, bufsiz); rc = chip->ops->recv(chip, (u8 *) buf, bufsiz);
if (rc < 0) if (rc < 0)
dev_err(chip->dev, dev_err(chip->pdev,
"tpm_transmit: tpm_recv: error %zd\n", rc); "tpm_transmit: tpm_recv: error %zd\n", rc);
out: out:
mutex_unlock(&chip->tpm_mutex); mutex_unlock(&chip->tpm_mutex);
...@@ -411,7 +411,8 @@ ssize_t tpm_transmit_cmd(struct tpm_chip *chip, void *cmd, ...@@ -411,7 +411,8 @@ ssize_t tpm_transmit_cmd(struct tpm_chip *chip, void *cmd,
err = be32_to_cpu(header->return_code); err = be32_to_cpu(header->return_code);
if (err != 0 && desc) if (err != 0 && desc)
dev_err(chip->dev, "A TPM error (%d) occurred %s\n", err, desc); dev_err(chip->pdev, "A TPM error (%d) occurred %s\n", err,
desc);
return err; return err;
} }
...@@ -505,7 +506,7 @@ int tpm_get_timeouts(struct tpm_chip *chip) ...@@ -505,7 +506,7 @@ int tpm_get_timeouts(struct tpm_chip *chip)
if (rc == TPM_ERR_INVALID_POSTINIT) { if (rc == TPM_ERR_INVALID_POSTINIT) {
/* The TPM is not started, we are the first to talk to it. /* The TPM is not started, we are the first to talk to it.
Execute a startup command. */ Execute a startup command. */
dev_info(chip->dev, "Issuing TPM_STARTUP"); dev_info(chip->pdev, "Issuing TPM_STARTUP");
if (tpm_startup(chip, TPM_ST_CLEAR)) if (tpm_startup(chip, TPM_ST_CLEAR))
return rc; return rc;
...@@ -517,7 +518,7 @@ int tpm_get_timeouts(struct tpm_chip *chip) ...@@ -517,7 +518,7 @@ int tpm_get_timeouts(struct tpm_chip *chip)
NULL); NULL);
} }
if (rc) { if (rc) {
dev_err(chip->dev, dev_err(chip->pdev,
"A TPM error (%zd) occurred attempting to determine the timeouts\n", "A TPM error (%zd) occurred attempting to determine the timeouts\n",
rc); rc);
goto duration; goto duration;
...@@ -556,7 +557,7 @@ int tpm_get_timeouts(struct tpm_chip *chip) ...@@ -556,7 +557,7 @@ int tpm_get_timeouts(struct tpm_chip *chip)
/* Report adjusted timeouts */ /* Report adjusted timeouts */
if (chip->vendor.timeout_adjusted) { if (chip->vendor.timeout_adjusted) {
dev_info(chip->dev, dev_info(chip->pdev,
HW_ERR "Adjusting reported timeouts: A %lu->%luus B %lu->%luus C %lu->%luus D %lu->%luus\n", HW_ERR "Adjusting reported timeouts: A %lu->%luus B %lu->%luus C %lu->%luus D %lu->%luus\n",
old_timeout[0], new_timeout[0], old_timeout[0], new_timeout[0],
old_timeout[1], new_timeout[1], old_timeout[1], new_timeout[1],
...@@ -603,7 +604,7 @@ int tpm_get_timeouts(struct tpm_chip *chip) ...@@ -603,7 +604,7 @@ int tpm_get_timeouts(struct tpm_chip *chip)
chip->vendor.duration[TPM_MEDIUM] *= 1000; chip->vendor.duration[TPM_MEDIUM] *= 1000;
chip->vendor.duration[TPM_LONG] *= 1000; chip->vendor.duration[TPM_LONG] *= 1000;
chip->vendor.duration_adjusted = true; chip->vendor.duration_adjusted = true;
dev_info(chip->dev, "Adjusting TPM timeout parameters."); dev_info(chip->pdev, "Adjusting TPM timeout parameters.");
} }
return 0; return 0;
} }
...@@ -760,7 +761,7 @@ int tpm_do_selftest(struct tpm_chip *chip) ...@@ -760,7 +761,7 @@ int tpm_do_selftest(struct tpm_chip *chip)
* around 300ms while the self test is ongoing, keep trying * around 300ms while the self test is ongoing, keep trying
* until the self test duration expires. */ * until the self test duration expires. */
if (rc == -ETIME) { if (rc == -ETIME) {
dev_info(chip->dev, HW_ERR "TPM command timed out during continue self test"); dev_info(chip->pdev, HW_ERR "TPM command timed out during continue self test");
msleep(delay_msec); msleep(delay_msec);
continue; continue;
} }
...@@ -770,7 +771,7 @@ int tpm_do_selftest(struct tpm_chip *chip) ...@@ -770,7 +771,7 @@ int tpm_do_selftest(struct tpm_chip *chip)
rc = be32_to_cpu(cmd.header.out.return_code); rc = be32_to_cpu(cmd.header.out.return_code);
if (rc == TPM_ERR_DISABLED || rc == TPM_ERR_DEACTIVATED) { if (rc == TPM_ERR_DISABLED || rc == TPM_ERR_DEACTIVATED) {
dev_info(chip->dev, dev_info(chip->pdev,
"TPM is disabled/deactivated (0x%X)\n", rc); "TPM is disabled/deactivated (0x%X)\n", rc);
/* TPM is disabled and/or deactivated; driver can /* TPM is disabled and/or deactivated; driver can
* proceed and TPM does handle commands for * proceed and TPM does handle commands for
...@@ -918,10 +919,10 @@ int tpm_pm_suspend(struct device *dev) ...@@ -918,10 +919,10 @@ int tpm_pm_suspend(struct device *dev)
} }
if (rc) if (rc)
dev_err(chip->dev, dev_err(chip->pdev,
"Error (%d) sending savestate before suspend\n", rc); "Error (%d) sending savestate before suspend\n", rc);
else if (try > 0) else if (try > 0)
dev_warn(chip->dev, "TPM savestate took %dms\n", dev_warn(chip->pdev, "TPM savestate took %dms\n",
try * TPM_TIMEOUT_RETRY); try * TPM_TIMEOUT_RETRY);
return rc; return rc;
......
...@@ -284,16 +284,16 @@ static const struct attribute_group tpm_dev_group = { ...@@ -284,16 +284,16 @@ static const struct attribute_group tpm_dev_group = {
int tpm_sysfs_add_device(struct tpm_chip *chip) int tpm_sysfs_add_device(struct tpm_chip *chip)
{ {
int err; int err;
err = sysfs_create_group(&chip->dev->kobj, err = sysfs_create_group(&chip->pdev->kobj,
&tpm_dev_group); &tpm_dev_group);
if (err) if (err)
dev_err(chip->dev, dev_err(chip->pdev,
"failed to create sysfs attributes, %d\n", err); "failed to create sysfs attributes, %d\n", err);
return err; return err;
} }
void tpm_sysfs_del_device(struct tpm_chip *chip) void tpm_sysfs_del_device(struct tpm_chip *chip)
{ {
sysfs_remove_group(&chip->dev->kobj, &tpm_dev_group); sysfs_remove_group(&chip->pdev->kobj, &tpm_dev_group);
} }
...@@ -103,7 +103,7 @@ enum tpm_chip_flags { ...@@ -103,7 +103,7 @@ enum tpm_chip_flags {
}; };
struct tpm_chip { struct tpm_chip {
struct device *dev; /* Device stuff */ struct device *pdev; /* Device stuff */
const struct tpm_class_ops *ops; const struct tpm_class_ops *ops;
unsigned int flags; unsigned int flags;
...@@ -130,7 +130,7 @@ struct tpm_chip { ...@@ -130,7 +130,7 @@ struct tpm_chip {
static inline void tpm_chip_put(struct tpm_chip *chip) static inline void tpm_chip_put(struct tpm_chip *chip)
{ {
module_put(chip->dev->driver->owner); module_put(chip->pdev->driver->owner);
} }
static inline int tpm_read_index(int base, int index) static inline int tpm_read_index(int base, int index)
......
...@@ -49,7 +49,7 @@ static int tpm_atml_recv(struct tpm_chip *chip, u8 *buf, size_t count) ...@@ -49,7 +49,7 @@ static int tpm_atml_recv(struct tpm_chip *chip, u8 *buf, size_t count)
for (i = 0; i < 6; i++) { for (i = 0; i < 6; i++) {
status = ioread8(chip->vendor.iobase + 1); status = ioread8(chip->vendor.iobase + 1);
if ((status & ATML_STATUS_DATA_AVAIL) == 0) { if ((status & ATML_STATUS_DATA_AVAIL) == 0) {
dev_err(chip->dev, "error reading header\n"); dev_err(chip->pdev, "error reading header\n");
return -EIO; return -EIO;
} }
*buf++ = ioread8(chip->vendor.iobase); *buf++ = ioread8(chip->vendor.iobase);
...@@ -60,12 +60,12 @@ static int tpm_atml_recv(struct tpm_chip *chip, u8 *buf, size_t count) ...@@ -60,12 +60,12 @@ static int tpm_atml_recv(struct tpm_chip *chip, u8 *buf, size_t count)
size = be32_to_cpu(*native_size); size = be32_to_cpu(*native_size);
if (count < size) { if (count < size) {
dev_err(chip->dev, dev_err(chip->pdev,
"Recv size(%d) less than available space\n", size); "Recv size(%d) less than available space\n", size);
for (; i < size; i++) { /* clear the waiting data anyway */ for (; i < size; i++) { /* clear the waiting data anyway */
status = ioread8(chip->vendor.iobase + 1); status = ioread8(chip->vendor.iobase + 1);
if ((status & ATML_STATUS_DATA_AVAIL) == 0) { if ((status & ATML_STATUS_DATA_AVAIL) == 0) {
dev_err(chip->dev, "error reading data\n"); dev_err(chip->pdev, "error reading data\n");
return -EIO; return -EIO;
} }
} }
...@@ -76,7 +76,7 @@ static int tpm_atml_recv(struct tpm_chip *chip, u8 *buf, size_t count) ...@@ -76,7 +76,7 @@ static int tpm_atml_recv(struct tpm_chip *chip, u8 *buf, size_t count)
for (; i < size; i++) { for (; i < size; i++) {
status = ioread8(chip->vendor.iobase + 1); status = ioread8(chip->vendor.iobase + 1);
if ((status & ATML_STATUS_DATA_AVAIL) == 0) { if ((status & ATML_STATUS_DATA_AVAIL) == 0) {
dev_err(chip->dev, "error reading data\n"); dev_err(chip->pdev, "error reading data\n");
return -EIO; return -EIO;
} }
*buf++ = ioread8(chip->vendor.iobase); *buf++ = ioread8(chip->vendor.iobase);
...@@ -86,7 +86,7 @@ static int tpm_atml_recv(struct tpm_chip *chip, u8 *buf, size_t count) ...@@ -86,7 +86,7 @@ static int tpm_atml_recv(struct tpm_chip *chip, u8 *buf, size_t count)
status = ioread8(chip->vendor.iobase + 1); status = ioread8(chip->vendor.iobase + 1);
if (status & ATML_STATUS_DATA_AVAIL) { if (status & ATML_STATUS_DATA_AVAIL) {
dev_err(chip->dev, "data available is stuck\n"); dev_err(chip->pdev, "data available is stuck\n");
return -EIO; return -EIO;
} }
...@@ -97,9 +97,9 @@ static int tpm_atml_send(struct tpm_chip *chip, u8 *buf, size_t count) ...@@ -97,9 +97,9 @@ static int tpm_atml_send(struct tpm_chip *chip, u8 *buf, size_t count)
{ {
int i; int i;
dev_dbg(chip->dev, "tpm_atml_send:\n"); dev_dbg(chip->pdev, "tpm_atml_send:\n");
for (i = 0; i < count; i++) { for (i = 0; i < count; i++) {
dev_dbg(chip->dev, "%d 0x%x(%d)\n", i, buf[i], buf[i]); dev_dbg(chip->pdev, "%d 0x%x(%d)\n", i, buf[i], buf[i]);
iowrite8(buf[i], chip->vendor.iobase); iowrite8(buf[i], chip->vendor.iobase);
} }
......
...@@ -52,7 +52,7 @@ struct priv_data { ...@@ -52,7 +52,7 @@ struct priv_data {
static int i2c_atmel_send(struct tpm_chip *chip, u8 *buf, size_t len) static int i2c_atmel_send(struct tpm_chip *chip, u8 *buf, size_t len)
{ {
struct priv_data *priv = chip->vendor.priv; struct priv_data *priv = chip->vendor.priv;
struct i2c_client *client = to_i2c_client(chip->dev); struct i2c_client *client = to_i2c_client(chip->pdev);
s32 status; s32 status;
priv->len = 0; priv->len = 0;
...@@ -62,7 +62,7 @@ static int i2c_atmel_send(struct tpm_chip *chip, u8 *buf, size_t len) ...@@ -62,7 +62,7 @@ static int i2c_atmel_send(struct tpm_chip *chip, u8 *buf, size_t len)
status = i2c_master_send(client, buf, len); status = i2c_master_send(client, buf, len);
dev_dbg(chip->dev, dev_dbg(chip->pdev,
"%s(buf=%*ph len=%0zx) -> sts=%d\n", __func__, "%s(buf=%*ph len=%0zx) -> sts=%d\n", __func__,
(int)min_t(size_t, 64, len), buf, len, status); (int)min_t(size_t, 64, len), buf, len, status);
return status; return status;
...@@ -71,7 +71,7 @@ static int i2c_atmel_send(struct tpm_chip *chip, u8 *buf, size_t len) ...@@ -71,7 +71,7 @@ static int i2c_atmel_send(struct tpm_chip *chip, u8 *buf, size_t len)
static int i2c_atmel_recv(struct tpm_chip *chip, u8 *buf, size_t count) static int i2c_atmel_recv(struct tpm_chip *chip, u8 *buf, size_t count)
{ {
struct priv_data *priv = chip->vendor.priv; struct priv_data *priv = chip->vendor.priv;
struct i2c_client *client = to_i2c_client(chip->dev); struct i2c_client *client = to_i2c_client(chip->pdev);
struct tpm_output_header *hdr = struct tpm_output_header *hdr =
(struct tpm_output_header *)priv->buffer; (struct tpm_output_header *)priv->buffer;
u32 expected_len; u32 expected_len;
...@@ -88,7 +88,7 @@ static int i2c_atmel_recv(struct tpm_chip *chip, u8 *buf, size_t count) ...@@ -88,7 +88,7 @@ static int i2c_atmel_recv(struct tpm_chip *chip, u8 *buf, size_t count)
return -ENOMEM; return -ENOMEM;
if (priv->len >= expected_len) { if (priv->len >= expected_len) {
dev_dbg(chip->dev, dev_dbg(chip->pdev,
"%s early(buf=%*ph count=%0zx) -> ret=%d\n", __func__, "%s early(buf=%*ph count=%0zx) -> ret=%d\n", __func__,
(int)min_t(size_t, 64, expected_len), buf, count, (int)min_t(size_t, 64, expected_len), buf, count,
expected_len); expected_len);
...@@ -97,7 +97,7 @@ static int i2c_atmel_recv(struct tpm_chip *chip, u8 *buf, size_t count) ...@@ -97,7 +97,7 @@ static int i2c_atmel_recv(struct tpm_chip *chip, u8 *buf, size_t count)
} }
rc = i2c_master_recv(client, buf, expected_len); rc = i2c_master_recv(client, buf, expected_len);
dev_dbg(chip->dev, dev_dbg(chip->pdev,
"%s reread(buf=%*ph count=%0zx) -> ret=%d\n", __func__, "%s reread(buf=%*ph count=%0zx) -> ret=%d\n", __func__,
(int)min_t(size_t, 64, expected_len), buf, count, (int)min_t(size_t, 64, expected_len), buf, count,
expected_len); expected_len);
...@@ -106,13 +106,13 @@ static int i2c_atmel_recv(struct tpm_chip *chip, u8 *buf, size_t count) ...@@ -106,13 +106,13 @@ static int i2c_atmel_recv(struct tpm_chip *chip, u8 *buf, size_t count)
static void i2c_atmel_cancel(struct tpm_chip *chip) static void i2c_atmel_cancel(struct tpm_chip *chip)
{ {
dev_err(chip->dev, "TPM operation cancellation was requested, but is not supported"); dev_err(chip->pdev, "TPM operation cancellation was requested, but is not supported");
} }
static u8 i2c_atmel_read_status(struct tpm_chip *chip) static u8 i2c_atmel_read_status(struct tpm_chip *chip)
{ {
struct priv_data *priv = chip->vendor.priv; struct priv_data *priv = chip->vendor.priv;
struct i2c_client *client = to_i2c_client(chip->dev); struct i2c_client *client = to_i2c_client(chip->pdev);
int rc; int rc;
/* The TPM fails the I2C read until it is ready, so we do the entire /* The TPM fails the I2C read until it is ready, so we do the entire
...@@ -125,7 +125,7 @@ static u8 i2c_atmel_read_status(struct tpm_chip *chip) ...@@ -125,7 +125,7 @@ static u8 i2c_atmel_read_status(struct tpm_chip *chip)
/* Once the TPM has completed the command the command remains readable /* Once the TPM has completed the command the command remains readable
* until another command is issued. */ * until another command is issued. */
rc = i2c_master_recv(client, priv->buffer, sizeof(priv->buffer)); rc = i2c_master_recv(client, priv->buffer, sizeof(priv->buffer));
dev_dbg(chip->dev, dev_dbg(chip->pdev,
"%s: sts=%d", __func__, rc); "%s: sts=%d", __func__, rc);
if (rc <= 0) if (rc <= 0)
return 0; return 0;
......
...@@ -446,7 +446,7 @@ static int tpm_tis_i2c_recv(struct tpm_chip *chip, u8 *buf, size_t count) ...@@ -446,7 +446,7 @@ static int tpm_tis_i2c_recv(struct tpm_chip *chip, u8 *buf, size_t count)
/* read first 10 bytes, including tag, paramsize, and result */ /* read first 10 bytes, including tag, paramsize, and result */
size = recv_data(chip, buf, TPM_HEADER_SIZE); size = recv_data(chip, buf, TPM_HEADER_SIZE);
if (size < TPM_HEADER_SIZE) { if (size < TPM_HEADER_SIZE) {
dev_err(chip->dev, "Unable to read header\n"); dev_err(chip->pdev, "Unable to read header\n");
goto out; goto out;
} }
...@@ -459,14 +459,14 @@ static int tpm_tis_i2c_recv(struct tpm_chip *chip, u8 *buf, size_t count) ...@@ -459,14 +459,14 @@ static int tpm_tis_i2c_recv(struct tpm_chip *chip, u8 *buf, size_t count)
size += recv_data(chip, &buf[TPM_HEADER_SIZE], size += recv_data(chip, &buf[TPM_HEADER_SIZE],
expected - TPM_HEADER_SIZE); expected - TPM_HEADER_SIZE);
if (size < expected) { if (size < expected) {
dev_err(chip->dev, "Unable to read remainder of result\n"); dev_err(chip->pdev, "Unable to read remainder of result\n");
size = -ETIME; size = -ETIME;
goto out; goto out;
} }
wait_for_stat(chip, TPM_STS_VALID, chip->vendor.timeout_c, &status); wait_for_stat(chip, TPM_STS_VALID, chip->vendor.timeout_c, &status);
if (status & TPM_STS_DATA_AVAIL) { /* retry? */ if (status & TPM_STS_DATA_AVAIL) { /* retry? */
dev_err(chip->dev, "Error left over data\n"); dev_err(chip->pdev, "Error left over data\n");
size = -EIO; size = -EIO;
goto out; goto out;
} }
......
...@@ -96,13 +96,13 @@ static s32 i2c_nuvoton_write_buf(struct i2c_client *client, u8 offset, u8 size, ...@@ -96,13 +96,13 @@ static s32 i2c_nuvoton_write_buf(struct i2c_client *client, u8 offset, u8 size,
/* read TPM_STS register */ /* read TPM_STS register */
static u8 i2c_nuvoton_read_status(struct tpm_chip *chip) static u8 i2c_nuvoton_read_status(struct tpm_chip *chip)
{ {
struct i2c_client *client = to_i2c_client(chip->dev); struct i2c_client *client = to_i2c_client(chip->pdev);
s32 status; s32 status;
u8 data; u8 data;
status = i2c_nuvoton_read_buf(client, TPM_STS, 1, &data); status = i2c_nuvoton_read_buf(client, TPM_STS, 1, &data);
if (status <= 0) { if (status <= 0) {
dev_err(chip->dev, "%s() error return %d\n", __func__, dev_err(chip->pdev, "%s() error return %d\n", __func__,
status); status);
data = TPM_STS_ERR_VAL; data = TPM_STS_ERR_VAL;
} }
...@@ -127,13 +127,13 @@ static s32 i2c_nuvoton_write_status(struct i2c_client *client, u8 data) ...@@ -127,13 +127,13 @@ static s32 i2c_nuvoton_write_status(struct i2c_client *client, u8 data)
/* write commandReady to TPM_STS register */ /* write commandReady to TPM_STS register */
static void i2c_nuvoton_ready(struct tpm_chip *chip) static void i2c_nuvoton_ready(struct tpm_chip *chip)
{ {
struct i2c_client *client = to_i2c_client(chip->dev); struct i2c_client *client = to_i2c_client(chip->pdev);
s32 status; s32 status;
/* this causes the current command to be aborted */ /* this causes the current command to be aborted */
status = i2c_nuvoton_write_status(client, TPM_STS_COMMAND_READY); status = i2c_nuvoton_write_status(client, TPM_STS_COMMAND_READY);
if (status < 0) if (status < 0)
dev_err(chip->dev, dev_err(chip->pdev,
"%s() fail to write TPM_STS.commandReady\n", __func__); "%s() fail to write TPM_STS.commandReady\n", __func__);
} }
...@@ -212,7 +212,7 @@ static int i2c_nuvoton_wait_for_stat(struct tpm_chip *chip, u8 mask, u8 value, ...@@ -212,7 +212,7 @@ static int i2c_nuvoton_wait_for_stat(struct tpm_chip *chip, u8 mask, u8 value,
return 0; return 0;
} while (time_before(jiffies, stop)); } while (time_before(jiffies, stop));
} }
dev_err(chip->dev, "%s(%02x, %02x) -> timeout\n", __func__, mask, dev_err(chip->pdev, "%s(%02x, %02x) -> timeout\n", __func__, mask,
value); value);
return -ETIMEDOUT; return -ETIMEDOUT;
} }
...@@ -240,7 +240,7 @@ static int i2c_nuvoton_recv_data(struct i2c_client *client, ...@@ -240,7 +240,7 @@ static int i2c_nuvoton_recv_data(struct i2c_client *client,
&chip->vendor.read_queue) == 0) { &chip->vendor.read_queue) == 0) {
burst_count = i2c_nuvoton_get_burstcount(client, chip); burst_count = i2c_nuvoton_get_burstcount(client, chip);
if (burst_count < 0) { if (burst_count < 0) {
dev_err(chip->dev, dev_err(chip->pdev,
"%s() fail to read burstCount=%d\n", __func__, "%s() fail to read burstCount=%d\n", __func__,
burst_count); burst_count);
return -EIO; return -EIO;
...@@ -249,12 +249,12 @@ static int i2c_nuvoton_recv_data(struct i2c_client *client, ...@@ -249,12 +249,12 @@ static int i2c_nuvoton_recv_data(struct i2c_client *client,
rc = i2c_nuvoton_read_buf(client, TPM_DATA_FIFO_R, rc = i2c_nuvoton_read_buf(client, TPM_DATA_FIFO_R,
bytes2read, &buf[size]); bytes2read, &buf[size]);
if (rc < 0) { if (rc < 0) {
dev_err(chip->dev, dev_err(chip->pdev,
"%s() fail on i2c_nuvoton_read_buf()=%d\n", "%s() fail on i2c_nuvoton_read_buf()=%d\n",
__func__, rc); __func__, rc);
return -EIO; return -EIO;
} }
dev_dbg(chip->dev, "%s(%d):", __func__, bytes2read); dev_dbg(chip->pdev, "%s(%d):", __func__, bytes2read);
size += bytes2read; size += bytes2read;
} }
...@@ -264,7 +264,7 @@ static int i2c_nuvoton_recv_data(struct i2c_client *client, ...@@ -264,7 +264,7 @@ static int i2c_nuvoton_recv_data(struct i2c_client *client,
/* Read TPM command results */ /* Read TPM command results */
static int i2c_nuvoton_recv(struct tpm_chip *chip, u8 *buf, size_t count) static int i2c_nuvoton_recv(struct tpm_chip *chip, u8 *buf, size_t count)
{ {
struct device *dev = chip->dev; struct device *dev = chip->pdev;
struct i2c_client *client = to_i2c_client(dev); struct i2c_client *client = to_i2c_client(dev);
s32 rc; s32 rc;
int expected, status, burst_count, retries, size = 0; int expected, status, burst_count, retries, size = 0;
...@@ -334,7 +334,7 @@ static int i2c_nuvoton_recv(struct tpm_chip *chip, u8 *buf, size_t count) ...@@ -334,7 +334,7 @@ static int i2c_nuvoton_recv(struct tpm_chip *chip, u8 *buf, size_t count)
break; break;
} }
i2c_nuvoton_ready(chip); i2c_nuvoton_ready(chip);
dev_dbg(chip->dev, "%s() -> %d\n", __func__, size); dev_dbg(chip->pdev, "%s() -> %d\n", __func__, size);
return size; return size;
} }
...@@ -347,7 +347,7 @@ static int i2c_nuvoton_recv(struct tpm_chip *chip, u8 *buf, size_t count) ...@@ -347,7 +347,7 @@ static int i2c_nuvoton_recv(struct tpm_chip *chip, u8 *buf, size_t count)
*/ */
static int i2c_nuvoton_send(struct tpm_chip *chip, u8 *buf, size_t len) static int i2c_nuvoton_send(struct tpm_chip *chip, u8 *buf, size_t len)
{ {
struct device *dev = chip->dev; struct device *dev = chip->pdev;
struct i2c_client *client = to_i2c_client(dev); struct i2c_client *client = to_i2c_client(dev);
u32 ordinal; u32 ordinal;
size_t count = 0; size_t count = 0;
......
...@@ -588,7 +588,7 @@ static int tpm_stm_i2c_recv(struct tpm_chip *chip, unsigned char *buf, ...@@ -588,7 +588,7 @@ static int tpm_stm_i2c_recv(struct tpm_chip *chip, unsigned char *buf,
size = recv_data(chip, buf, TPM_HEADER_SIZE); size = recv_data(chip, buf, TPM_HEADER_SIZE);
if (size < TPM_HEADER_SIZE) { if (size < TPM_HEADER_SIZE) {
dev_err(chip->dev, "Unable to read header\n"); dev_err(chip->pdev, "Unable to read header\n");
goto out; goto out;
} }
...@@ -601,7 +601,7 @@ static int tpm_stm_i2c_recv(struct tpm_chip *chip, unsigned char *buf, ...@@ -601,7 +601,7 @@ static int tpm_stm_i2c_recv(struct tpm_chip *chip, unsigned char *buf,
size += recv_data(chip, &buf[TPM_HEADER_SIZE], size += recv_data(chip, &buf[TPM_HEADER_SIZE],
expected - TPM_HEADER_SIZE); expected - TPM_HEADER_SIZE);
if (size < expected) { if (size < expected) {
dev_err(chip->dev, "Unable to read remainder of result\n"); dev_err(chip->pdev, "Unable to read remainder of result\n");
size = -ETIME; size = -ETIME;
goto out; goto out;
} }
...@@ -639,14 +639,14 @@ static int tpm_stm_i2c_of_request_resources(struct tpm_chip *chip) ...@@ -639,14 +639,14 @@ static int tpm_stm_i2c_of_request_resources(struct tpm_chip *chip)
pp = client->dev.of_node; pp = client->dev.of_node;
if (!pp) { if (!pp) {
dev_err(chip->dev, "No platform data\n"); dev_err(chip->pdev, "No platform data\n");
return -ENODEV; return -ENODEV;
} }
/* Get GPIO from device tree */ /* Get GPIO from device tree */
gpio = of_get_named_gpio(pp, "lpcpd-gpios", 0); gpio = of_get_named_gpio(pp, "lpcpd-gpios", 0);
if (gpio < 0) { if (gpio < 0) {
dev_err(chip->dev, "Failed to retrieve lpcpd-gpios from dts.\n"); dev_err(chip->pdev, "Failed to retrieve lpcpd-gpios from dts.\n");
tpm_dev->io_lpcpd = -1; tpm_dev->io_lpcpd = -1;
/* /*
* lpcpd pin is not specified. This is not an issue as * lpcpd pin is not specified. This is not an issue as
...@@ -659,7 +659,7 @@ static int tpm_stm_i2c_of_request_resources(struct tpm_chip *chip) ...@@ -659,7 +659,7 @@ static int tpm_stm_i2c_of_request_resources(struct tpm_chip *chip)
ret = devm_gpio_request_one(&client->dev, gpio, ret = devm_gpio_request_one(&client->dev, gpio,
GPIOF_OUT_INIT_HIGH, "TPM IO LPCPD"); GPIOF_OUT_INIT_HIGH, "TPM IO LPCPD");
if (ret) { if (ret) {
dev_err(chip->dev, "Failed to request lpcpd pin\n"); dev_err(chip->pdev, "Failed to request lpcpd pin\n");
return -ENODEV; return -ENODEV;
} }
tpm_dev->io_lpcpd = gpio; tpm_dev->io_lpcpd = gpio;
...@@ -682,7 +682,7 @@ static int tpm_stm_i2c_request_resources(struct i2c_client *client, ...@@ -682,7 +682,7 @@ static int tpm_stm_i2c_request_resources(struct i2c_client *client,
pdata = client->dev.platform_data; pdata = client->dev.platform_data;
if (!pdata) { if (!pdata) {
dev_err(chip->dev, "No platform data\n"); dev_err(chip->pdev, "No platform data\n");
return -ENODEV; return -ENODEV;
} }
...@@ -694,7 +694,7 @@ static int tpm_stm_i2c_request_resources(struct i2c_client *client, ...@@ -694,7 +694,7 @@ static int tpm_stm_i2c_request_resources(struct i2c_client *client,
pdata->io_lpcpd, GPIOF_OUT_INIT_HIGH, pdata->io_lpcpd, GPIOF_OUT_INIT_HIGH,
"TPM IO_LPCPD"); "TPM IO_LPCPD");
if (ret) { if (ret) {
dev_err(chip->dev, "%s : reset gpio_request failed\n", dev_err(chip->pdev, "%s : reset gpio_request failed\n",
__FILE__); __FILE__);
return ret; return ret;
} }
...@@ -776,7 +776,7 @@ tpm_stm_i2c_probe(struct i2c_client *client, const struct i2c_device_id *id) ...@@ -776,7 +776,7 @@ tpm_stm_i2c_probe(struct i2c_client *client, const struct i2c_device_id *id)
IRQF_TRIGGER_HIGH, IRQF_TRIGGER_HIGH,
"TPM SERIRQ management", chip); "TPM SERIRQ management", chip);
if (ret < 0) { if (ret < 0) {
dev_err(chip->dev , "TPM SERIRQ signals %d not available\n", dev_err(chip->pdev , "TPM SERIRQ signals %d not available\n",
client->irq); client->irq);
goto _tpm_clean_answer; goto _tpm_clean_answer;
} }
...@@ -807,7 +807,7 @@ tpm_stm_i2c_probe(struct i2c_client *client, const struct i2c_device_id *id) ...@@ -807,7 +807,7 @@ tpm_stm_i2c_probe(struct i2c_client *client, const struct i2c_device_id *id)
return tpm_chip_register(chip); return tpm_chip_register(chip);
_tpm_clean_answer: _tpm_clean_answer:
dev_info(chip->dev, "TPM I2C initialisation fail\n"); dev_info(chip->pdev, "TPM I2C initialisation fail\n");
return ret; return ret;
} }
......
...@@ -195,9 +195,9 @@ static int wait(struct tpm_chip *chip, int wait_for_bit) ...@@ -195,9 +195,9 @@ static int wait(struct tpm_chip *chip, int wait_for_bit)
} }
if (i == TPM_MAX_TRIES) { /* timeout occurs */ if (i == TPM_MAX_TRIES) { /* timeout occurs */
if (wait_for_bit == STAT_XFE) if (wait_for_bit == STAT_XFE)
dev_err(chip->dev, "Timeout in wait(STAT_XFE)\n"); dev_err(chip->pdev, "Timeout in wait(STAT_XFE)\n");
if (wait_for_bit == STAT_RDA) if (wait_for_bit == STAT_RDA)
dev_err(chip->dev, "Timeout in wait(STAT_RDA)\n"); dev_err(chip->pdev, "Timeout in wait(STAT_RDA)\n");
return -EIO; return -EIO;
} }
return 0; return 0;
...@@ -220,7 +220,7 @@ static void wait_and_send(struct tpm_chip *chip, u8 sendbyte) ...@@ -220,7 +220,7 @@ static void wait_and_send(struct tpm_chip *chip, u8 sendbyte)
static void tpm_wtx(struct tpm_chip *chip) static void tpm_wtx(struct tpm_chip *chip)
{ {
number_of_wtx++; number_of_wtx++;
dev_info(chip->dev, "Granting WTX (%02d / %02d)\n", dev_info(chip->pdev, "Granting WTX (%02d / %02d)\n",
number_of_wtx, TPM_MAX_WTX_PACKAGES); number_of_wtx, TPM_MAX_WTX_PACKAGES);
wait_and_send(chip, TPM_VL_VER); wait_and_send(chip, TPM_VL_VER);
wait_and_send(chip, TPM_CTRL_WTX); wait_and_send(chip, TPM_CTRL_WTX);
...@@ -231,7 +231,7 @@ static void tpm_wtx(struct tpm_chip *chip) ...@@ -231,7 +231,7 @@ static void tpm_wtx(struct tpm_chip *chip)
static void tpm_wtx_abort(struct tpm_chip *chip) static void tpm_wtx_abort(struct tpm_chip *chip)
{ {
dev_info(chip->dev, "Aborting WTX\n"); dev_info(chip->pdev, "Aborting WTX\n");
wait_and_send(chip, TPM_VL_VER); wait_and_send(chip, TPM_VL_VER);
wait_and_send(chip, TPM_CTRL_WTX_ABORT); wait_and_send(chip, TPM_CTRL_WTX_ABORT);
wait_and_send(chip, 0x00); wait_and_send(chip, 0x00);
...@@ -257,7 +257,7 @@ static int tpm_inf_recv(struct tpm_chip *chip, u8 * buf, size_t count) ...@@ -257,7 +257,7 @@ static int tpm_inf_recv(struct tpm_chip *chip, u8 * buf, size_t count)
} }
if (buf[0] != TPM_VL_VER) { if (buf[0] != TPM_VL_VER) {
dev_err(chip->dev, dev_err(chip->pdev,
"Wrong transport protocol implementation!\n"); "Wrong transport protocol implementation!\n");
return -EIO; return -EIO;
} }
...@@ -272,7 +272,7 @@ static int tpm_inf_recv(struct tpm_chip *chip, u8 * buf, size_t count) ...@@ -272,7 +272,7 @@ static int tpm_inf_recv(struct tpm_chip *chip, u8 * buf, size_t count)
} }
if ((size == 0x6D00) && (buf[1] == 0x80)) { if ((size == 0x6D00) && (buf[1] == 0x80)) {
dev_err(chip->dev, "Error handling on vendor layer!\n"); dev_err(chip->pdev, "Error handling on vendor layer!\n");
return -EIO; return -EIO;
} }
...@@ -284,7 +284,7 @@ static int tpm_inf_recv(struct tpm_chip *chip, u8 * buf, size_t count) ...@@ -284,7 +284,7 @@ static int tpm_inf_recv(struct tpm_chip *chip, u8 * buf, size_t count)
} }
if (buf[1] == TPM_CTRL_WTX) { if (buf[1] == TPM_CTRL_WTX) {
dev_info(chip->dev, "WTX-package received\n"); dev_info(chip->pdev, "WTX-package received\n");
if (number_of_wtx < TPM_MAX_WTX_PACKAGES) { if (number_of_wtx < TPM_MAX_WTX_PACKAGES) {
tpm_wtx(chip); tpm_wtx(chip);
goto recv_begin; goto recv_begin;
...@@ -295,14 +295,14 @@ static int tpm_inf_recv(struct tpm_chip *chip, u8 * buf, size_t count) ...@@ -295,14 +295,14 @@ static int tpm_inf_recv(struct tpm_chip *chip, u8 * buf, size_t count)
} }
if (buf[1] == TPM_CTRL_WTX_ABORT_ACK) { if (buf[1] == TPM_CTRL_WTX_ABORT_ACK) {
dev_info(chip->dev, "WTX-abort acknowledged\n"); dev_info(chip->pdev, "WTX-abort acknowledged\n");
return size; return size;
} }
if (buf[1] == TPM_CTRL_ERROR) { if (buf[1] == TPM_CTRL_ERROR) {
dev_err(chip->dev, "ERROR-package received:\n"); dev_err(chip->pdev, "ERROR-package received:\n");
if (buf[4] == TPM_INF_NAK) if (buf[4] == TPM_INF_NAK)
dev_err(chip->dev, dev_err(chip->pdev,
"-> Negative acknowledgement" "-> Negative acknowledgement"
" - retransmit command!\n"); " - retransmit command!\n");
return -EIO; return -EIO;
...@@ -321,7 +321,7 @@ static int tpm_inf_send(struct tpm_chip *chip, u8 * buf, size_t count) ...@@ -321,7 +321,7 @@ static int tpm_inf_send(struct tpm_chip *chip, u8 * buf, size_t count)
ret = empty_fifo(chip, 1); ret = empty_fifo(chip, 1);
if (ret) { if (ret) {
dev_err(chip->dev, "Timeout while clearing FIFO\n"); dev_err(chip->pdev, "Timeout while clearing FIFO\n");
return -EIO; return -EIO;
} }
......
...@@ -113,7 +113,7 @@ static int nsc_wait_for_ready(struct tpm_chip *chip) ...@@ -113,7 +113,7 @@ static int nsc_wait_for_ready(struct tpm_chip *chip)
} }
while (time_before(jiffies, stop)); while (time_before(jiffies, stop));
dev_info(chip->dev, "wait for ready failed\n"); dev_info(chip->pdev, "wait for ready failed\n");
return -EBUSY; return -EBUSY;
} }
...@@ -129,12 +129,12 @@ static int tpm_nsc_recv(struct tpm_chip *chip, u8 * buf, size_t count) ...@@ -129,12 +129,12 @@ static int tpm_nsc_recv(struct tpm_chip *chip, u8 * buf, size_t count)
return -EIO; return -EIO;
if (wait_for_stat(chip, NSC_STATUS_F0, NSC_STATUS_F0, &data) < 0) { if (wait_for_stat(chip, NSC_STATUS_F0, NSC_STATUS_F0, &data) < 0) {
dev_err(chip->dev, "F0 timeout\n"); dev_err(chip->pdev, "F0 timeout\n");
return -EIO; return -EIO;
} }
if ((data = if ((data =
inb(chip->vendor.base + NSC_DATA)) != NSC_COMMAND_NORMAL) { inb(chip->vendor.base + NSC_DATA)) != NSC_COMMAND_NORMAL) {
dev_err(chip->dev, "not in normal mode (0x%x)\n", dev_err(chip->pdev, "not in normal mode (0x%x)\n",
data); data);
return -EIO; return -EIO;
} }
...@@ -143,7 +143,7 @@ static int tpm_nsc_recv(struct tpm_chip *chip, u8 * buf, size_t count) ...@@ -143,7 +143,7 @@ static int tpm_nsc_recv(struct tpm_chip *chip, u8 * buf, size_t count)
for (p = buffer; p < &buffer[count]; p++) { for (p = buffer; p < &buffer[count]; p++) {
if (wait_for_stat if (wait_for_stat
(chip, NSC_STATUS_OBF, NSC_STATUS_OBF, &data) < 0) { (chip, NSC_STATUS_OBF, NSC_STATUS_OBF, &data) < 0) {
dev_err(chip->dev, dev_err(chip->pdev,
"OBF timeout (while reading data)\n"); "OBF timeout (while reading data)\n");
return -EIO; return -EIO;
} }
...@@ -154,11 +154,11 @@ static int tpm_nsc_recv(struct tpm_chip *chip, u8 * buf, size_t count) ...@@ -154,11 +154,11 @@ static int tpm_nsc_recv(struct tpm_chip *chip, u8 * buf, size_t count)
if ((data & NSC_STATUS_F0) == 0 && if ((data & NSC_STATUS_F0) == 0 &&
(wait_for_stat(chip, NSC_STATUS_F0, NSC_STATUS_F0, &data) < 0)) { (wait_for_stat(chip, NSC_STATUS_F0, NSC_STATUS_F0, &data) < 0)) {
dev_err(chip->dev, "F0 not set\n"); dev_err(chip->pdev, "F0 not set\n");
return -EIO; return -EIO;
} }
if ((data = inb(chip->vendor.base + NSC_DATA)) != NSC_COMMAND_EOC) { if ((data = inb(chip->vendor.base + NSC_DATA)) != NSC_COMMAND_EOC) {
dev_err(chip->dev, dev_err(chip->pdev,
"expected end of command(0x%x)\n", data); "expected end of command(0x%x)\n", data);
return -EIO; return -EIO;
} }
...@@ -189,19 +189,19 @@ static int tpm_nsc_send(struct tpm_chip *chip, u8 * buf, size_t count) ...@@ -189,19 +189,19 @@ static int tpm_nsc_send(struct tpm_chip *chip, u8 * buf, size_t count)
return -EIO; return -EIO;
if (wait_for_stat(chip, NSC_STATUS_IBF, 0, &data) < 0) { if (wait_for_stat(chip, NSC_STATUS_IBF, 0, &data) < 0) {
dev_err(chip->dev, "IBF timeout\n"); dev_err(chip->pdev, "IBF timeout\n");
return -EIO; return -EIO;
} }
outb(NSC_COMMAND_NORMAL, chip->vendor.base + NSC_COMMAND); outb(NSC_COMMAND_NORMAL, chip->vendor.base + NSC_COMMAND);
if (wait_for_stat(chip, NSC_STATUS_IBR, NSC_STATUS_IBR, &data) < 0) { if (wait_for_stat(chip, NSC_STATUS_IBR, NSC_STATUS_IBR, &data) < 0) {
dev_err(chip->dev, "IBR timeout\n"); dev_err(chip->pdev, "IBR timeout\n");
return -EIO; return -EIO;
} }
for (i = 0; i < count; i++) { for (i = 0; i < count; i++) {
if (wait_for_stat(chip, NSC_STATUS_IBF, 0, &data) < 0) { if (wait_for_stat(chip, NSC_STATUS_IBF, 0, &data) < 0) {
dev_err(chip->dev, dev_err(chip->pdev,
"IBF timeout (while writing data)\n"); "IBF timeout (while writing data)\n");
return -EIO; return -EIO;
} }
...@@ -209,7 +209,7 @@ static int tpm_nsc_send(struct tpm_chip *chip, u8 * buf, size_t count) ...@@ -209,7 +209,7 @@ static int tpm_nsc_send(struct tpm_chip *chip, u8 * buf, size_t count)
} }
if (wait_for_stat(chip, NSC_STATUS_IBF, 0, &data) < 0) { if (wait_for_stat(chip, NSC_STATUS_IBF, 0, &data) < 0) {
dev_err(chip->dev, "IBF timeout\n"); dev_err(chip->pdev, "IBF timeout\n");
return -EIO; return -EIO;
} }
outb(NSC_COMMAND_EOC, chip->vendor.base + NSC_COMMAND); outb(NSC_COMMAND_EOC, chip->vendor.base + NSC_COMMAND);
......
...@@ -356,7 +356,7 @@ int tpm_add_ppi(struct tpm_chip *chip) ...@@ -356,7 +356,7 @@ int tpm_add_ppi(struct tpm_chip *chip)
ACPI_FREE(obj); ACPI_FREE(obj);
} }
rc = sysfs_create_group(&chip->dev->kobj, &ppi_attr_grp); rc = sysfs_create_group(&chip->pdev->kobj, &ppi_attr_grp);
if (!rc) if (!rc)
chip->flags |= TPM_CHIP_FLAG_PPI; chip->flags |= TPM_CHIP_FLAG_PPI;
...@@ -367,5 +367,5 @@ int tpm_add_ppi(struct tpm_chip *chip) ...@@ -367,5 +367,5 @@ int tpm_add_ppi(struct tpm_chip *chip)
void tpm_remove_ppi(struct tpm_chip *chip) void tpm_remove_ppi(struct tpm_chip *chip)
{ {
if (chip->flags & TPM_CHIP_FLAG_PPI) if (chip->flags & TPM_CHIP_FLAG_PPI)
sysfs_remove_group(&chip->dev->kobj, &ppi_attr_grp); sysfs_remove_group(&chip->pdev->kobj, &ppi_attr_grp);
} }
...@@ -242,7 +242,7 @@ static int tpm_tis_recv(struct tpm_chip *chip, u8 *buf, size_t count) ...@@ -242,7 +242,7 @@ static int tpm_tis_recv(struct tpm_chip *chip, u8 *buf, size_t count)
/* read first 10 bytes, including tag, paramsize, and result */ /* read first 10 bytes, including tag, paramsize, and result */
if ((size = if ((size =
recv_data(chip, buf, TPM_HEADER_SIZE)) < TPM_HEADER_SIZE) { recv_data(chip, buf, TPM_HEADER_SIZE)) < TPM_HEADER_SIZE) {
dev_err(chip->dev, "Unable to read header\n"); dev_err(chip->pdev, "Unable to read header\n");
goto out; goto out;
} }
...@@ -255,7 +255,7 @@ static int tpm_tis_recv(struct tpm_chip *chip, u8 *buf, size_t count) ...@@ -255,7 +255,7 @@ static int tpm_tis_recv(struct tpm_chip *chip, u8 *buf, size_t count)
if ((size += if ((size +=
recv_data(chip, &buf[TPM_HEADER_SIZE], recv_data(chip, &buf[TPM_HEADER_SIZE],
expected - TPM_HEADER_SIZE)) < expected) { expected - TPM_HEADER_SIZE)) < expected) {
dev_err(chip->dev, "Unable to read remainder of result\n"); dev_err(chip->pdev, "Unable to read remainder of result\n");
size = -ETIME; size = -ETIME;
goto out; goto out;
} }
...@@ -264,7 +264,7 @@ static int tpm_tis_recv(struct tpm_chip *chip, u8 *buf, size_t count) ...@@ -264,7 +264,7 @@ static int tpm_tis_recv(struct tpm_chip *chip, u8 *buf, size_t count)
&chip->vendor.int_queue, false); &chip->vendor.int_queue, false);
status = tpm_tis_status(chip); status = tpm_tis_status(chip);
if (status & TPM_STS_DATA_AVAIL) { /* retry? */ if (status & TPM_STS_DATA_AVAIL) { /* retry? */
dev_err(chip->dev, "Error left over data\n"); dev_err(chip->pdev, "Error left over data\n");
size = -EIO; size = -EIO;
goto out; goto out;
} }
...@@ -406,7 +406,7 @@ static int tpm_tis_send(struct tpm_chip *chip, u8 *buf, size_t len) ...@@ -406,7 +406,7 @@ static int tpm_tis_send(struct tpm_chip *chip, u8 *buf, size_t len)
msleep(1); msleep(1);
if (!priv->irq_tested) { if (!priv->irq_tested) {
disable_interrupts(chip); disable_interrupts(chip);
dev_err(chip->dev, dev_err(chip->pdev,
FW_BUG "TPM interrupt not working, polling instead\n"); FW_BUG "TPM interrupt not working, polling instead\n");
} }
priv->irq_tested = true; priv->irq_tested = true;
...@@ -476,7 +476,7 @@ static int probe_itpm(struct tpm_chip *chip) ...@@ -476,7 +476,7 @@ static int probe_itpm(struct tpm_chip *chip)
rc = tpm_tis_send_data(chip, cmd_getticks, len); rc = tpm_tis_send_data(chip, cmd_getticks, len);
if (rc == 0) { if (rc == 0) {
dev_info(chip->dev, "Detected an iTPM.\n"); dev_info(chip->pdev, "Detected an iTPM.\n");
rc = 1; rc = 1;
} else } else
rc = -EFAULT; rc = -EFAULT;
...@@ -699,7 +699,7 @@ static int tpm_tis_init(struct device *dev, acpi_handle acpi_dev_handle, ...@@ -699,7 +699,7 @@ static int tpm_tis_init(struct device *dev, acpi_handle acpi_dev_handle,
if (devm_request_irq if (devm_request_irq
(dev, i, tis_int_probe, IRQF_SHARED, (dev, i, tis_int_probe, IRQF_SHARED,
chip->vendor.miscdev.name, chip) != 0) { chip->vendor.miscdev.name, chip) != 0) {
dev_info(chip->dev, dev_info(chip->pdev,
"Unable to request irq: %d for probe\n", "Unable to request irq: %d for probe\n",
i); i);
continue; continue;
...@@ -746,7 +746,7 @@ static int tpm_tis_init(struct device *dev, acpi_handle acpi_dev_handle, ...@@ -746,7 +746,7 @@ static int tpm_tis_init(struct device *dev, acpi_handle acpi_dev_handle,
if (devm_request_irq if (devm_request_irq
(dev, chip->vendor.irq, tis_int_handler, IRQF_SHARED, (dev, chip->vendor.irq, tis_int_handler, IRQF_SHARED,
chip->vendor.miscdev.name, chip) != 0) { chip->vendor.miscdev.name, chip) != 0) {
dev_info(chip->dev, dev_info(chip->pdev,
"Unable to request irq: %d for use\n", "Unable to request irq: %d for use\n",
chip->vendor.irq); chip->vendor.irq);
chip->vendor.irq = 0; chip->vendor.irq = 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment