Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

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

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
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -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)
			continue;

		if (try_module_get(pos->dev->driver->owner)) {
		if (try_module_get(pos->pdev->driver->owner)) {
			chip = pos;
			break;
		}
@@ -110,7 +110,7 @@ struct tpm_chip *tpmm_chip_alloc(struct device *dev,

	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);
	dev_set_drvdata(dev, chip);

+5 −5
Original line number Diff line number Diff line
@@ -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 driver_lock. */
	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;
	}

@@ -81,7 +81,7 @@ static int tpm_open(struct inode *inode, struct file *file)
	INIT_WORK(&priv->work, timeout_work);

	file->private_data = priv;
	get_device(chip->dev);
	get_device(chip->pdev);
	return 0;
}

@@ -168,7 +168,7 @@ static int tpm_release(struct inode *inode, struct file *file)
	file->private_data = NULL;
	atomic_set(&priv->data_pending, 0);
	clear_bit(0, &priv->chip->is_open);
	put_device(priv->chip->dev);
	put_device(priv->chip->pdev);
	kfree(priv);
	return 0;
}
@@ -193,12 +193,12 @@ int tpm_dev_add_device(struct tpm_chip *chip)
		chip->vendor.miscdev.minor = MISC_DYNAMIC_MINOR;

	chip->vendor.miscdev.name = chip->devname;
	chip->vendor.miscdev.parent = chip->dev;
	chip->vendor.miscdev.parent = chip->pdev;

	rc = misc_register(&chip->vendor.miscdev);
	if (rc) {
		chip->vendor.miscdev.name = NULL;
		dev_err(chip->dev,
		dev_err(chip->pdev,
			"unable to misc_register %s, minor %d err=%d\n",
			chip->vendor.miscdev.name,
			chip->vendor.miscdev.minor, rc);
+15 −14
Original line number Diff line number Diff line
@@ -343,7 +343,7 @@ ssize_t tpm_transmit(struct tpm_chip *chip, const char *buf,
	if (count == 0)
		return -ENODATA;
	if (count > bufsiz) {
		dev_err(chip->dev,
		dev_err(chip->pdev,
			"invalid count value %x %zx\n", count, bufsiz);
		return -E2BIG;
	}
@@ -352,7 +352,7 @@ ssize_t tpm_transmit(struct tpm_chip *chip, const char *buf,

	rc = chip->ops->send(chip, (u8 *) buf, count);
	if (rc < 0) {
		dev_err(chip->dev,
		dev_err(chip->pdev,
			"tpm_transmit: tpm_send: error %zd\n", rc);
		goto out;
	}
@@ -368,7 +368,7 @@ ssize_t tpm_transmit(struct tpm_chip *chip, const char *buf,
			goto out_recv;

		if (chip->ops->req_canceled(chip, status)) {
			dev_err(chip->dev, "Operation Canceled\n");
			dev_err(chip->pdev, "Operation Canceled\n");
			rc = -ECANCELED;
			goto out;
		}
@@ -378,14 +378,14 @@ ssize_t tpm_transmit(struct tpm_chip *chip, const char *buf,
	} while (time_before(jiffies, stop));

	chip->ops->cancel(chip);
	dev_err(chip->dev, "Operation Timed out\n");
	dev_err(chip->pdev, "Operation Timed out\n");
	rc = -ETIME;
	goto out;

out_recv:
	rc = chip->ops->recv(chip, (u8 *) buf, bufsiz);
	if (rc < 0)
		dev_err(chip->dev,
		dev_err(chip->pdev,
			"tpm_transmit: tpm_recv: error %zd\n", rc);
out:
	mutex_unlock(&chip->tpm_mutex);
@@ -411,7 +411,8 @@ ssize_t tpm_transmit_cmd(struct tpm_chip *chip, void *cmd,

	err = be32_to_cpu(header->return_code);
	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;
}
@@ -505,7 +506,7 @@ int tpm_get_timeouts(struct tpm_chip *chip)
	if (rc == TPM_ERR_INVALID_POSTINIT) {
		/* The TPM is not started, we are the first to talk to it.
		   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))
			return rc;

@@ -517,7 +518,7 @@ int tpm_get_timeouts(struct tpm_chip *chip)
				  NULL);
	}
	if (rc) {
		dev_err(chip->dev,
		dev_err(chip->pdev,
			"A TPM error (%zd) occurred attempting to determine the timeouts\n",
			rc);
		goto duration;
@@ -556,7 +557,7 @@ int tpm_get_timeouts(struct tpm_chip *chip)

	/* Report adjusted timeouts */
	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",
			 old_timeout[0], new_timeout[0],
			 old_timeout[1], new_timeout[1],
@@ -603,7 +604,7 @@ int tpm_get_timeouts(struct tpm_chip *chip)
		chip->vendor.duration[TPM_MEDIUM] *= 1000;
		chip->vendor.duration[TPM_LONG] *= 1000;
		chip->vendor.duration_adjusted = true;
		dev_info(chip->dev, "Adjusting TPM timeout parameters.");
		dev_info(chip->pdev, "Adjusting TPM timeout parameters.");
	}
	return 0;
}
@@ -760,7 +761,7 @@ int tpm_do_selftest(struct tpm_chip *chip)
		 * around 300ms while the self test is ongoing, keep trying
		 * until the self test duration expires. */
		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);
			continue;
		}
@@ -770,7 +771,7 @@ int tpm_do_selftest(struct tpm_chip *chip)

		rc = be32_to_cpu(cmd.header.out.return_code);
		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 and/or deactivated; driver can
			 * proceed and TPM does handle commands for
@@ -918,10 +919,10 @@ int tpm_pm_suspend(struct device *dev)
	}

	if (rc)
		dev_err(chip->dev,
		dev_err(chip->pdev,
			"Error (%d) sending savestate before suspend\n", rc);
	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);

	return rc;
+3 −3
Original line number Diff line number Diff line
@@ -284,16 +284,16 @@ static const struct attribute_group tpm_dev_group = {
int tpm_sysfs_add_device(struct tpm_chip *chip)
{
	int err;
	err = sysfs_create_group(&chip->dev->kobj,
	err = sysfs_create_group(&chip->pdev->kobj,
				 &tpm_dev_group);

	if (err)
		dev_err(chip->dev,
		dev_err(chip->pdev,
			"failed to create sysfs attributes, %d\n", err);
	return err;
}

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);
}
+2 −2
Original line number Diff line number Diff line
@@ -103,7 +103,7 @@ enum tpm_chip_flags {
};

struct tpm_chip {
	struct device *dev;	/* Device stuff */
	struct device *pdev;	/* Device stuff */
	const struct tpm_class_ops *ops;
	unsigned int flags;

@@ -130,7 +130,7 @@ struct tpm_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)
Loading