aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char/tpm/xen-tpmfront.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/char/tpm/xen-tpmfront.c')
-rw-r--r--drivers/char/tpm/xen-tpmfront.c37
1 files changed, 1 insertions, 36 deletions
diff --git a/drivers/char/tpm/xen-tpmfront.c b/drivers/char/tpm/xen-tpmfront.c
index 7a7929ba2658..94c280d36e8b 100644
--- a/drivers/char/tpm/xen-tpmfront.c
+++ b/drivers/char/tpm/xen-tpmfront.c
@@ -10,6 +10,7 @@
10#include <linux/errno.h> 10#include <linux/errno.h>
11#include <linux/err.h> 11#include <linux/err.h>
12#include <linux/interrupt.h> 12#include <linux/interrupt.h>
13#include <xen/xen.h>
13#include <xen/events.h> 14#include <xen/events.h>
14#include <xen/interface/io/tpmif.h> 15#include <xen/interface/io/tpmif.h>
15#include <xen/grant_table.h> 16#include <xen/grant_table.h>
@@ -142,32 +143,6 @@ static int vtpm_recv(struct tpm_chip *chip, u8 *buf, size_t count)
142 return length; 143 return length;
143} 144}
144 145
145ssize_t tpm_show_locality(struct device *dev, struct device_attribute *attr,
146 char *buf)
147{
148 struct tpm_chip *chip = dev_get_drvdata(dev);
149 struct tpm_private *priv = TPM_VPRIV(chip);
150 u8 locality = priv->shr->locality;
151
152 return sprintf(buf, "%d\n", locality);
153}
154
155ssize_t tpm_store_locality(struct device *dev, struct device_attribute *attr,
156 const char *buf, size_t len)
157{
158 struct tpm_chip *chip = dev_get_drvdata(dev);
159 struct tpm_private *priv = TPM_VPRIV(chip);
160 u8 val;
161
162 int rv = kstrtou8(buf, 0, &val);
163 if (rv)
164 return rv;
165
166 priv->shr->locality = val;
167
168 return len;
169}
170
171static const struct file_operations vtpm_ops = { 146static const struct file_operations vtpm_ops = {
172 .owner = THIS_MODULE, 147 .owner = THIS_MODULE,
173 .llseek = no_llseek, 148 .llseek = no_llseek,
@@ -188,8 +163,6 @@ static DEVICE_ATTR(caps, S_IRUGO, tpm_show_caps, NULL);
188static DEVICE_ATTR(cancel, S_IWUSR | S_IWGRP, NULL, tpm_store_cancel); 163static DEVICE_ATTR(cancel, S_IWUSR | S_IWGRP, NULL, tpm_store_cancel);
189static DEVICE_ATTR(durations, S_IRUGO, tpm_show_durations, NULL); 164static DEVICE_ATTR(durations, S_IRUGO, tpm_show_durations, NULL);
190static DEVICE_ATTR(timeouts, S_IRUGO, tpm_show_timeouts, NULL); 165static DEVICE_ATTR(timeouts, S_IRUGO, tpm_show_timeouts, NULL);
191static DEVICE_ATTR(locality, S_IRUGO | S_IWUSR, tpm_show_locality,
192 tpm_store_locality);
193 166
194static struct attribute *vtpm_attrs[] = { 167static struct attribute *vtpm_attrs[] = {
195 &dev_attr_pubek.attr, 168 &dev_attr_pubek.attr,
@@ -202,7 +175,6 @@ static struct attribute *vtpm_attrs[] = {
202 &dev_attr_cancel.attr, 175 &dev_attr_cancel.attr,
203 &dev_attr_durations.attr, 176 &dev_attr_durations.attr,
204 &dev_attr_timeouts.attr, 177 &dev_attr_timeouts.attr,
205 &dev_attr_locality.attr,
206 NULL, 178 NULL,
207}; 179};
208 180
@@ -210,8 +182,6 @@ static struct attribute_group vtpm_attr_grp = {
210 .attrs = vtpm_attrs, 182 .attrs = vtpm_attrs,
211}; 183};
212 184
213#define TPM_LONG_TIMEOUT (10 * 60 * HZ)
214
215static const struct tpm_vendor_specific tpm_vtpm = { 185static const struct tpm_vendor_specific tpm_vtpm = {
216 .status = vtpm_status, 186 .status = vtpm_status,
217 .recv = vtpm_recv, 187 .recv = vtpm_recv,
@@ -224,11 +194,6 @@ static const struct tpm_vendor_specific tpm_vtpm = {
224 .miscdev = { 194 .miscdev = {
225 .fops = &vtpm_ops, 195 .fops = &vtpm_ops,
226 }, 196 },
227 .duration = {
228 TPM_LONG_TIMEOUT,
229 TPM_LONG_TIMEOUT,
230 TPM_LONG_TIMEOUT,
231 },
232}; 197};
233 198
234static irqreturn_t tpmif_interrupt(int dummy, void *dev_id) 199static irqreturn_t tpmif_interrupt(int dummy, void *dev_id)