# HG changeset patch
# User kaf24@xxxxxxxxxxxxxxxxxxxx
# Node ID a66763eb86fee0a215712245be4f49e871d74ac4
# Parent 271cb04a4f2b74a7f7d3baa68868ef6f8c159525
Allow tpmfront/tpmback to be built as modules.
From: Jan Beulich
Signed-off-by: Keir Fraser <keir@xxxxxxxxxxxxx>
diff -r 271cb04a4f2b -r a66763eb86fe linux-2.6-xen-sparse/drivers/xen/Kconfig
--- a/linux-2.6-xen-sparse/drivers/xen/Kconfig Tue Feb 28 17:59:24 2006
+++ b/linux-2.6-xen-sparse/drivers/xen/Kconfig Tue Feb 28 18:00:15 2006
@@ -118,7 +118,7 @@
connection.
config XEN_TPMDEV_BACKEND
- bool "TPM-device backend driver"
+ tristate "TPM-device backend driver"
default n
help
The TPM-device backend driver
@@ -162,7 +162,7 @@
space. Odds are that you want to say N here.
config XEN_TPMDEV_FRONTEND
- bool "TPM-device frontend driver"
+ tristate "TPM-device frontend driver"
default n
select TCG_TPM
select TCG_XEN
diff -r 271cb04a4f2b -r a66763eb86fe
linux-2.6-xen-sparse/drivers/xen/tpmback/common.h
--- a/linux-2.6-xen-sparse/drivers/xen/tpmback/common.h Tue Feb 28 17:59:24 2006
+++ b/linux-2.6-xen-sparse/drivers/xen/tpmback/common.h Tue Feb 28 18:00:15 2006
@@ -54,9 +54,11 @@
void tpmif_disconnect_complete(tpmif_t * tpmif);
tpmif_t *tpmif_find(domid_t domid, long int instance);
void tpmif_interface_init(void);
+void tpmif_interface_exit(void);
void tpmif_schedule_work(tpmif_t * tpmif);
void tpmif_deschedule_work(tpmif_t * tpmif);
void tpmif_xenbus_init(void);
+void tpmif_xenbus_exit(void);
int tpmif_map(tpmif_t *tpmif, unsigned long shared_page, unsigned int evtchn);
irqreturn_t tpmif_be_int(int irq, void *dev_id, struct pt_regs *regs);
int tpmif_vtpm_open(tpmif_t *tpmif, domid_t domain, u32 instance);
diff -r 271cb04a4f2b -r a66763eb86fe
linux-2.6-xen-sparse/drivers/xen/tpmback/interface.c
--- a/linux-2.6-xen-sparse/drivers/xen/tpmback/interface.c Tue Feb 28
17:59:24 2006
+++ b/linux-2.6-xen-sparse/drivers/xen/tpmback/interface.c Tue Feb 28
18:00:15 2006
@@ -186,6 +186,12 @@
0, 0, NULL, NULL);
}
+void __init
+tpmif_interface_exit(void)
+{
+ kmem_cache_destroy(tpmif_cachep);
+}
+
/*
* Local variables:
* c-file-style: "linux"
diff -r 271cb04a4f2b -r a66763eb86fe
linux-2.6-xen-sparse/drivers/xen/tpmback/tpmback.c
--- a/linux-2.6-xen-sparse/drivers/xen/tpmback/tpmback.c Tue Feb 28
17:59:24 2006
+++ b/linux-2.6-xen-sparse/drivers/xen/tpmback/tpmback.c Tue Feb 28
18:00:15 2006
@@ -1092,7 +1092,20 @@
return 0;
}
-__initcall(tpmback_init);
+module_init(tpmback_init);
+
+static void __exit
+tpmback_exit(void)
+{
+
+ tpmif_xenbus_exit();
+ tpmif_interface_exit();
+ misc_deregister(&ibmvtpms_miscdevice);
+}
+
+module_exit(tpmback_exit);
+
+MODULE_LICENSE("Dual BSD/GPL");
/*
* Local variables:
diff -r 271cb04a4f2b -r a66763eb86fe
linux-2.6-xen-sparse/drivers/xen/tpmback/xenbus.c
--- a/linux-2.6-xen-sparse/drivers/xen/tpmback/xenbus.c Tue Feb 28 17:59:24 2006
+++ b/linux-2.6-xen-sparse/drivers/xen/tpmback/xenbus.c Tue Feb 28 18:00:15 2006
@@ -317,6 +317,11 @@
xenbus_register_backend(&tpmback);
}
+void tpmif_xenbus_exit(void)
+{
+ xenbus_unregister_driver(&tpmback);
+}
+
/*
* Local variables:
* c-file-style: "linux"
diff -r 271cb04a4f2b -r a66763eb86fe
linux-2.6-xen-sparse/drivers/xen/tpmfront/tpmfront.c
--- a/linux-2.6-xen-sparse/drivers/xen/tpmfront/tpmfront.c Tue Feb 28
17:59:24 2006
+++ b/linux-2.6-xen-sparse/drivers/xen/tpmfront/tpmfront.c Tue Feb 28
18:00:15 2006
@@ -480,6 +480,11 @@
xenbus_register_frontend(&tpmfront);
}
+static void __exit exit_tpm_xenbus(void)
+{
+ xenbus_unregister_driver(&tpmfront);
+}
+
static int
tpm_allocate_buffers(struct tpm_private *tp)
@@ -700,7 +705,18 @@
return 0;
}
-__initcall(tpmif_init);
+module_init(tpmif_init);
+
+static void __exit
+tpmif_exit(void)
+{
+ exit_tpm_xenbus();
+ gnttab_free_grant_references(gref_head);
+}
+
+module_exit(tpmif_exit);
+
+MODULE_LICENSE("Dual BSD/GPL");
/*
* Local variables:
_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog
|