lkml.org 
[lkml]   [2017]   [Mar]   [13]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [tpmdd-devel] [PATCH] tpm: Add sysfs interface to show TPM family version
From
Date
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

\
 
 \ /
  Last update: 2017-03-13 19:46    [W:1.289 / U:0.084 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site