From: James Bottomley <James.Bottomley@HansenPartnership.com>
To: Meng.Li@windriver.com, linux-kernel@vger.kernel.org
Cc: tpmdd-devel@lists.sourceforge.net
Subject: Re: [tpmdd-devel] [PATCH] tpm: Add sysfs interface to show TPM family version
Date: Mon, 13 Mar 2017 11:46:11 -0700 [thread overview]
Message-ID: <1489430771.23810.5.camel@HansenPartnership.com> (raw)
In-Reply-To: <1489396817-24855-1-git-send-email-Meng.Li@windriver.com>
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
prev parent reply other threads:[~2017-03-13 18:46 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-03-13 9:20 [PATCH] tpm: Add sysfs interface to show TPM family version Meng.Li
2017-03-13 11:54 ` Jarkko Sakkinen
2017-03-13 12:54 ` Li, Meng
2017-03-13 14:31 ` [tpmdd-devel] " Andrew Lunn
2017-03-13 14:59 ` Jarkko Sakkinen
2017-03-13 16:55 ` Jason Gunthorpe
2017-03-13 18:35 ` Jarkko Sakkinen
2017-03-13 18:46 ` James Bottomley [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1489430771.23810.5.camel@HansenPartnership.com \
--to=james.bottomley@hansenpartnership.com \
--cc=Meng.Li@windriver.com \
--cc=linux-kernel@vger.kernel.org \
--cc=tpmdd-devel@lists.sourceforge.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox