Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1599333

RE: [PATCH] tpm: Add sysfs interface to show TPM family version

From "Li, Meng" <Meng.Li@windriver.com>
Newsgroups linux.kernel
Subject RE: [PATCH] tpm: Add sysfs interface to show TPM family version
Date 2017-03-13 14:00 +0100
Message-ID <tkxJV-Fd-43@gated-at.bofh.it> (permalink)
References <tkusH-6Sd-39@gated-at.bofh.it> <tkwNQ-8qX-1@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw



> -----Original Message-----
> From: Jarkko Sakkinen [mailto:jarkko.sakkinen@linux.intel.com]
> Sent: Monday, March 13, 2017 7:54 PM
> To: Li, Meng
> Cc: linux-kernel@vger.kernel.org; peterhuewe@gmx.de;
> tpmdd@selhorst.net; jgunthorpe@obsidianresearch.com; tpmdd-
> devel@lists.sourceforge.net
> Subject: Re: [PATCH] tpm: Add sysfs interface to show TPM family version
> 
> On Mon, Mar 13, 2017 at 05:20:17PM +0800, Meng.Li@windriver.com wrote:
> > From: Limeng <Meng.Li@windriver.com>
> >
> > So far, there is not a sysfs interface for user space code to check
> > the TPM family version(TPM1.x or TPM2). So, add a file named
> > description in /sys/class/tpm/tpmX/ to show it.
> >
> > Signed-off-by: Meng Li <Meng.Li@windriver.com>
> > ---
> 
> Is this the first or which version of the patch is this? Version number and
> changelog are missing :/

Hi Jarkko,

This is the second version of this patch. The first one is reviewed by Peter who give out some good advices.

It is my first time to submit patch to upstream(main line),  and I am not very clear with the submitting rule.
So, could you please give me a template to record the version and changing log?
In my previous experience, I will attach a patch-0000 to record version and describe the background of this patch.
But how to show the changing log when submit patch into mainline, I am not very  clear.

Regards,
Limeng

> 
> /Jarkko
> 
> >  drivers/char/tpm/tpm-chip.c |   70
> +++++++++++++++++++++++++++++++++++++++++++
> >  1 file changed, 70 insertions(+)
> >
> > diff --git a/drivers/char/tpm/tpm-chip.c b/drivers/char/tpm/tpm-chip.c
> > index c406343..b222421 100644
> > --- a/drivers/char/tpm/tpm-chip.c
> > +++ b/drivers/char/tpm/tpm-chip.c
> > @@ -36,6 +36,68 @@
> >  dev_t tpm_devt;
> >
> >  /**
> > + * show_description - sysfs interface for checking current TPM hardware
> version.
> > + * @dev:	pointer to tpm chip device
> > + * @attr:	unused
> > + * @buf:	char buffer to be filled with TPM hardware version info
> > + *
> > + * Provides sysfs interface for showing current TPM hardware version.
> > + */
> > +static ssize_t show_description(struct device *dev,
> > +		struct device_attribute *attr, char *buf) {
> > +	struct tpm_chip *chip = (struct tpm_chip *)container_of(dev,struct
> tpm_chip,dev);
> > +	int ret;
> > +
> > +	if (chip->flags & TPM_CHIP_FLAG_TPM2)
> > +		ret = sprintf(buf, "TPM 2.0");
> > +	else
> > +		ret = sprintf(buf, "TPM 1.x");
> > +
> > +	return ret;
> > +}
> > +
> > +static struct device_attribute tpm_attrs[] = {
> > +	__ATTR(description, S_IRUGO, show_description, NULL), };
> > +
> > +/**
> > + * tpm_create_sysfs - Create tpm sysfs interface.
> > + * @dev:	pointer to tpm chip device
> > + *
> > + * Create sysfs interface for checking current TPM hardware version.
> > + */
> > +static int tpm_create_sysfs(struct device *dev) {
> > +	int r, t;
> > +
> > +	for (t = 0; t < ARRAY_SIZE(tpm_attrs); t++) {
> > +		r = device_create_file(dev, &tpm_attrs[t]);
> > +		if (r) {
> > +			dev_err(dev, "failed to create sysfs file\n");
> > +			return r;
> > +		}
> > +	}
> > +
> > +	return 0;
> > +}
> > +
> > +/**
> > + * tpm_remove_sysfs - Remove tpm sysfs interface.
> > + * @dev:	pointer to tpm chip device
> > + *
> > + * Remove sysfs interface for checking current TPM hardware version.
> > + */
> > +static void tpm_remove_sysfs(struct device *dev) {
> > +	int  t;
> > +
> > +	for (t = 0; t < ARRAY_SIZE(tpm_attrs); t++) {
> > +		device_remove_file(dev, &tpm_attrs[t]);
> > +	}
> > +}
> > +
> > +/**
> >   * tpm_try_get_ops() - Get a ref to the tpm_chip
> >   * @chip: Chip to ref
> >   *
> > @@ -363,6 +425,13 @@ int tpm_chip_register(struct tpm_chip *chip)
> >  		return rc;
> >  	}
> >
> > +	rc = tpm_create_sysfs(&chip->dev);
> > +	if (rc) {
> > +		tpm_del_legacy_sysfs(chip);
> > +		tpm_chip_unregister(chip);
> > +		return rc;
> > +	}
> > +
> >  	return 0;
> >  }
> >  EXPORT_SYMBOL_GPL(tpm_chip_register);
> > @@ -382,6 +451,7 @@ int tpm_chip_register(struct tpm_chip *chip)
> >   */
> >  void tpm_chip_unregister(struct tpm_chip *chip)  {
> > +	tpm_remove_sysfs(&chip->dev);
> >  	tpm_del_legacy_sysfs(chip);
> >  	tpm_bios_log_teardown(chip);
> >  	tpm_del_char_device(chip);
> > --
> > 1.7.9.5
> >

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH] tpm: Add sysfs interface to show TPM family version <Meng.Li@windriver.com> - 2017-03-13 10:30 +0100
  Re: [PATCH] tpm: Add sysfs interface to show TPM family version Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com> - 2017-03-13 13:00 +0100
    RE: [PATCH] tpm: Add sysfs interface to show TPM family version "Li, Meng" <Meng.Li@windriver.com> - 2017-03-13 14:00 +0100
      Re: [tpmdd-devel] [PATCH] tpm: Add sysfs interface to show TPM  family version Andrew Lunn <andrew@lunn.ch> - 2017-03-13 15:40 +0100
      Re: [PATCH] tpm: Add sysfs interface to show TPM family version Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com> - 2017-03-13 16:10 +0100
        Re: [PATCH] tpm: Add sysfs interface to show TPM family version Jason Gunthorpe <jgunthorpe@obsidianresearch.com> - 2017-03-13 18:00 +0100
          Re: [PATCH] tpm: Add sysfs interface to show TPM family version Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com> - 2017-03-13 19:40 +0100
  Re: [tpmdd-devel] [PATCH] tpm: Add sysfs interface to show TPM  family version James Bottomley <James.Bottomley@HansenPartnership.com> - 2017-03-13 19:50 +0100

csiph-web