aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char/tpm
diff options
context:
space:
mode:
authorDave Jones <davej@redhat.com>2006-12-12 18:13:32 -0500
committerDave Jones <davej@redhat.com>2006-12-12 18:13:32 -0500
commitf0eef25339f92f7cd4aeea23d9ae97987a5a1e82 (patch)
tree2472e94d39f43a9580a6d2d5d92de0b749023263 /drivers/char/tpm
parent0cfea5dd98205f2fa318836da664a7d7df1afbc1 (diff)
parente1036502e5263851259d147771226161e5ccc85a (diff)
Merge ../linus
Diffstat (limited to 'drivers/char/tpm')
-rw-r--r--drivers/char/tpm/tpm.c18
-rw-r--r--drivers/char/tpm/tpm.h1
-rw-r--r--drivers/char/tpm/tpm_atmel.c10
-rw-r--r--drivers/char/tpm/tpm_nsc.c6
-rw-r--r--drivers/char/tpm/tpm_tis.c4
5 files changed, 25 insertions, 14 deletions
diff --git a/drivers/char/tpm/tpm.c b/drivers/char/tpm/tpm.c
index a082a2e34252..33e1f66e39cb 100644
--- a/drivers/char/tpm/tpm.c
+++ b/drivers/char/tpm/tpm.c
@@ -325,9 +325,9 @@ static void user_reader_timeout(unsigned long ptr)
325 schedule_work(&chip->work); 325 schedule_work(&chip->work);
326} 326}
327 327
328static void timeout_work(void *ptr) 328static void timeout_work(struct work_struct *work)
329{ 329{
330 struct tpm_chip *chip = ptr; 330 struct tpm_chip *chip = container_of(work, struct tpm_chip, work);
331 331
332 down(&chip->buffer_mutex); 332 down(&chip->buffer_mutex);
333 atomic_set(&chip->data_pending, 0); 333 atomic_set(&chip->data_pending, 0);
@@ -1105,7 +1105,7 @@ struct tpm_chip *tpm_register_hardware(struct device *dev, const struct tpm_vend
1105 init_MUTEX(&chip->tpm_mutex); 1105 init_MUTEX(&chip->tpm_mutex);
1106 INIT_LIST_HEAD(&chip->list); 1106 INIT_LIST_HEAD(&chip->list);
1107 1107
1108 INIT_WORK(&chip->work, timeout_work, chip); 1108 INIT_WORK(&chip->work, timeout_work);
1109 1109
1110 init_timer(&chip->user_read_timer); 1110 init_timer(&chip->user_read_timer);
1111 chip->user_read_timer.function = user_reader_timeout; 1111 chip->user_read_timer.function = user_reader_timeout;
@@ -1130,7 +1130,7 @@ struct tpm_chip *tpm_register_hardware(struct device *dev, const struct tpm_vend
1130 scnprintf(devname, DEVNAME_SIZE, "%s%d", "tpm", chip->dev_num); 1130 scnprintf(devname, DEVNAME_SIZE, "%s%d", "tpm", chip->dev_num);
1131 chip->vendor.miscdev.name = devname; 1131 chip->vendor.miscdev.name = devname;
1132 1132
1133 chip->vendor.miscdev.dev = dev; 1133 chip->vendor.miscdev.parent = dev;
1134 chip->dev = get_device(dev); 1134 chip->dev = get_device(dev);
1135 1135
1136 if (misc_register(&chip->vendor.miscdev)) { 1136 if (misc_register(&chip->vendor.miscdev)) {
@@ -1153,7 +1153,15 @@ struct tpm_chip *tpm_register_hardware(struct device *dev, const struct tpm_vend
1153 1153
1154 spin_unlock(&driver_lock); 1154 spin_unlock(&driver_lock);
1155 1155
1156 sysfs_create_group(&dev->kobj, chip->vendor.attr_group); 1156 if (sysfs_create_group(&dev->kobj, chip->vendor.attr_group)) {
1157 list_del(&chip->list);
1158 misc_deregister(&chip->vendor.miscdev);
1159 put_device(dev);
1160 clear_bit(chip->dev_num, dev_mask);
1161 kfree(chip);
1162 kfree(devname);
1163 return NULL;
1164 }
1157 1165
1158 chip->bios_dir = tpm_bios_log_setup(devname); 1166 chip->bios_dir = tpm_bios_log_setup(devname);
1159 1167
diff --git a/drivers/char/tpm/tpm.h b/drivers/char/tpm/tpm.h
index 050ced247f68..bb9a43c6cf3d 100644
--- a/drivers/char/tpm/tpm.h
+++ b/drivers/char/tpm/tpm.h
@@ -22,6 +22,7 @@
22#include <linux/pci.h> 22#include <linux/pci.h>
23#include <linux/delay.h> 23#include <linux/delay.h>
24#include <linux/fs.h> 24#include <linux/fs.h>
25#include <linux/sched.h>
25#include <linux/miscdevice.h> 26#include <linux/miscdevice.h>
26#include <linux/platform_device.h> 27#include <linux/platform_device.h>
27#include <linux/io.h> 28#include <linux/io.h>
diff --git a/drivers/char/tpm/tpm_atmel.c b/drivers/char/tpm/tpm_atmel.c
index ad8ffe49256f..1ab0896070be 100644
--- a/drivers/char/tpm/tpm_atmel.c
+++ b/drivers/char/tpm/tpm_atmel.c
@@ -184,7 +184,9 @@ static int __init init_atmel(void)
184 unsigned long base; 184 unsigned long base;
185 struct tpm_chip *chip; 185 struct tpm_chip *chip;
186 186
187 driver_register(&atml_drv); 187 rc = driver_register(&atml_drv);
188 if (rc)
189 return rc;
188 190
189 if ((iobase = atmel_get_base_addr(&base, &region_size)) == NULL) { 191 if ((iobase = atmel_get_base_addr(&base, &region_size)) == NULL) {
190 rc = -ENODEV; 192 rc = -ENODEV;
@@ -195,10 +197,8 @@ static int __init init_atmel(void)
195 (atmel_request_region 197 (atmel_request_region
196 (tpm_atmel.base, region_size, "tpm_atmel0") == NULL) ? 0 : 1; 198 (tpm_atmel.base, region_size, "tpm_atmel0") == NULL) ? 0 : 1;
197 199
198 200 pdev = platform_device_register_simple("tpm_atmel", -1, NULL, 0);
199 if (IS_ERR 201 if (IS_ERR(pdev)) {
200 (pdev =
201 platform_device_register_simple("tpm_atmel", -1, NULL, 0))) {
202 rc = PTR_ERR(pdev); 202 rc = PTR_ERR(pdev);
203 goto err_rel_reg; 203 goto err_rel_reg;
204 } 204 }
diff --git a/drivers/char/tpm/tpm_nsc.c b/drivers/char/tpm/tpm_nsc.c
index 26287aace87d..608f73071bef 100644
--- a/drivers/char/tpm/tpm_nsc.c
+++ b/drivers/char/tpm/tpm_nsc.c
@@ -284,7 +284,7 @@ static struct device_driver nsc_drv = {
284static int __init init_nsc(void) 284static int __init init_nsc(void)
285{ 285{
286 int rc = 0; 286 int rc = 0;
287 int lo, hi; 287 int lo, hi, err;
288 int nscAddrBase = TPM_ADDR; 288 int nscAddrBase = TPM_ADDR;
289 struct tpm_chip *chip; 289 struct tpm_chip *chip;
290 unsigned long base; 290 unsigned long base;
@@ -297,7 +297,9 @@ static int __init init_nsc(void)
297 return -ENODEV; 297 return -ENODEV;
298 } 298 }
299 299
300 driver_register(&nsc_drv); 300 err = driver_register(&nsc_drv);
301 if (err)
302 return err;
301 303
302 hi = tpm_read_index(nscAddrBase, TPM_NSC_BASE0_HI); 304 hi = tpm_read_index(nscAddrBase, TPM_NSC_BASE0_HI);
303 lo = tpm_read_index(nscAddrBase, TPM_NSC_BASE0_LO); 305 lo = tpm_read_index(nscAddrBase, TPM_NSC_BASE0_LO);
diff --git a/drivers/char/tpm/tpm_tis.c b/drivers/char/tpm/tpm_tis.c
index ee7ac6f43c65..483f3f60013c 100644
--- a/drivers/char/tpm/tpm_tis.c
+++ b/drivers/char/tpm/tpm_tis.c
@@ -377,7 +377,7 @@ static struct tpm_vendor_specific tpm_tis = {
377 .fops = &tis_ops,}, 377 .fops = &tis_ops,},
378}; 378};
379 379
380static irqreturn_t tis_int_probe(int irq, void *dev_id, struct pt_regs *regs) 380static irqreturn_t tis_int_probe(int irq, void *dev_id)
381{ 381{
382 struct tpm_chip *chip = (struct tpm_chip *) dev_id; 382 struct tpm_chip *chip = (struct tpm_chip *) dev_id;
383 u32 interrupt; 383 u32 interrupt;
@@ -397,7 +397,7 @@ static irqreturn_t tis_int_probe(int irq, void *dev_id, struct pt_regs *regs)
397 return IRQ_HANDLED; 397 return IRQ_HANDLED;
398} 398}
399 399
400static irqreturn_t tis_int_handler(int irq, void *dev_id, struct pt_regs *regs) 400static irqreturn_t tis_int_handler(int irq, void *dev_id)
401{ 401{
402 struct tpm_chip *chip = (struct tpm_chip *) dev_id; 402 struct tpm_chip *chip = (struct tpm_chip *) dev_id;
403 u32 interrupt; 403 u32 interrupt;