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

Commit 3635e2ec authored by Jason Gunthorpe's avatar Jason Gunthorpe Committed by Jarkko Sakkinen
Browse files

tpm: Get rid of devname



Now that we have a proper struct device just use dev_name() to
access this value instead of keeping two copies.

Signed-off-by: default avatarJason Gunthorpe <jgunthorpe@obsidianresearch.com>
Signed-off-by: default avatarStefan Berger <stefanb@linux.vnet.ibm.com>
Reviewed-by: default avatarJarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
Tested-by: default avatarJarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
Signed-off-by: default avatarJarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
parent 8cfffc9d
Loading
Loading
Loading
Loading
+11 −7
Original line number Diff line number Diff line
@@ -111,7 +111,7 @@ struct tpm_chip *tpmm_chip_alloc(struct device *dev,

	set_bit(chip->dev_num, dev_mask);

	scnprintf(chip->devname, sizeof(chip->devname), "tpm%d", chip->dev_num);
	device_initialize(&chip->dev);

	dev_set_drvdata(dev, chip);

@@ -127,9 +127,9 @@ struct tpm_chip *tpmm_chip_alloc(struct device *dev,
	else
		chip->dev.devt = MKDEV(MAJOR(tpm_devt), chip->dev_num);

	dev_set_name(&chip->dev, "%s", chip->devname);

	device_initialize(&chip->dev);
	rc = dev_set_name(&chip->dev, "tpm%d", chip->dev_num);
	if (rc)
		goto out;

	cdev_init(&chip->cdev, &tpm_fops);
	chip->cdev.owner = dev->driver->owner;
@@ -142,6 +142,10 @@ struct tpm_chip *tpmm_chip_alloc(struct device *dev,
	}

	return chip;

out:
	put_device(&chip->dev);
	return ERR_PTR(rc);
}
EXPORT_SYMBOL_GPL(tpmm_chip_alloc);

@@ -153,7 +157,7 @@ static int tpm_add_char_device(struct tpm_chip *chip)
	if (rc) {
		dev_err(&chip->dev,
			"unable to cdev_add() %s, major %d, minor %d, err=%d\n",
			chip->devname, MAJOR(chip->dev.devt),
			dev_name(&chip->dev), MAJOR(chip->dev.devt),
			MINOR(chip->dev.devt), rc);

		return rc;
@@ -163,7 +167,7 @@ static int tpm_add_char_device(struct tpm_chip *chip)
	if (rc) {
		dev_err(&chip->dev,
			"unable to device_register() %s, major %d, minor %d, err=%d\n",
			chip->devname, MAJOR(chip->dev.devt),
			dev_name(&chip->dev), MAJOR(chip->dev.devt),
			MINOR(chip->dev.devt), rc);

		cdev_del(&chip->cdev);
@@ -190,7 +194,7 @@ static int tpm1_chip_register(struct tpm_chip *chip)
	if (rc)
		return rc;

	chip->bios_dir = tpm_bios_log_setup(chip->devname);
	chip->bios_dir = tpm_bios_log_setup(dev_name(&chip->dev));

	return 0;
}
+0 −1
Original line number Diff line number Diff line
@@ -174,7 +174,6 @@ struct tpm_chip {
	unsigned int flags;

	int dev_num;		/* /dev/tpm# */
	char devname[7];
	unsigned long is_open;	/* only one allowed */
	int time_expired;

+1 −1
Original line number Diff line number Diff line
@@ -403,7 +403,7 @@ static int is_bad(void *p)
	return 0;
}

struct dentry **tpm_bios_log_setup(char *name)
struct dentry **tpm_bios_log_setup(const char *name)
{
	struct dentry **ret = NULL, *tpm_dir, *bin_file, *ascii_file;

+1 −1
Original line number Diff line number Diff line
@@ -77,7 +77,7 @@ int read_log(struct tpm_bios_log *log);

#if defined(CONFIG_TCG_IBMVTPM) || defined(CONFIG_TCG_IBMVTPM_MODULE) || \
	defined(CONFIG_ACPI)
extern struct dentry **tpm_bios_log_setup(char *);
extern struct dentry **tpm_bios_log_setup(const char *);
extern void tpm_bios_log_teardown(struct dentry **);
#else
static inline struct dentry **tpm_bios_log_setup(char *name)
+1 −1
Original line number Diff line number Diff line
@@ -560,7 +560,7 @@ static int i2c_nuvoton_probe(struct i2c_client *client,
		rc = devm_request_irq(dev, chip->vendor.irq,
				      i2c_nuvoton_int_handler,
				      IRQF_TRIGGER_LOW,
				      chip->devname,
				      dev_name(&chip->dev),
				      chip);
		if (rc) {
			dev_err(dev, "%s() Unable to request irq: %d for use\n",
Loading