All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stefan Berger <stefanb@linux.vnet.ibm.com>
To: Linux kernel mailing list <linux-kernel@vger.kernel.org>,
	Rajiv Andrade <srajiv@linux.vnet.ibm.com>,
	Marcel Selhorst <m.selhorst@sirrix.com>,
	James Morris <jmorris@namei.org>
Subject: tpm: suppress durations sysfs output if not set
Date: Mon, 22 Aug 2011 06:49:20 -0400	[thread overview]
Message-ID: <4E523430.1070003@linux.vnet.ibm.com> (raw)

Suppress the output of durations if they were not read during driver 
initialization.
This is similar to other sysfs entries that return nothing if for some 
reason sending the commands to the TPM fails.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>

---
  drivers/char/tpm/tpm.c |    3 +++
  1 file changed, 3 insertions(+)

Index: linux-2.6/drivers/char/tpm/tpm.c
===================================================================
--- linux-2.6.orig/drivers/char/tpm/tpm.c
+++ linux-2.6/drivers/char/tpm/tpm.c
@@ -963,6 +963,9 @@ ssize_t tpm_show_durations(struct device
  {
      struct tpm_chip *chip = dev_get_drvdata(dev);

+    if (chip->vendor.duration[TPM_LONG] == 0)
+        return 0;
+
      return sprintf(buf, "%d %d %d [%s]\n",
                 jiffies_to_usecs(chip->vendor.duration[TPM_SHORT]),
                 jiffies_to_usecs(chip->vendor.duration[TPM_MEDIUM]),

             reply	other threads:[~2011-08-22 10:49 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-08-22 10:49 Stefan Berger [this message]
2011-08-23  0:49 ` tpm: suppress durations sysfs output if not set James Morris

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=4E523430.1070003@linux.vnet.ibm.com \
    --to=stefanb@linux.vnet.ibm.com \
    --cc=jmorris@namei.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=m.selhorst@sirrix.com \
    --cc=srajiv@linux.vnet.ibm.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.