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


Groups > linux.kernel > #1599686

Re: [tpmdd-devel] [PATCH] tpm: Add sysfs interface to show TPM family version

From James Bottomley <James.Bottomley@HansenPartnership.com>
Newsgroups linux.kernel
Subject Re: [tpmdd-devel] [PATCH] tpm: Add sysfs interface to show TPM family version
Date 2017-03-13 19:50 +0100
Message-ID <tkDcB-4C4-1@gated-at.bofh.it> (permalink)
References <tkusH-6Sd-39@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Mon, 2017-03-13 at 17:20 +0800, Meng.Li@windriver.com wrote:
[...]
> +/**
> + * 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]);
> +	}
> +}
> +

For non-dynamic attributes, use the attribute_group structure in the
device instead.  It will take care of creation and removal
automatically.

James

Back to linux.kernel | Previous | NextPrevious 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