ia64/xen-unstable

changeset 9072:a66763eb86fe

Allow tpmfront/tpmback to be built as modules.

From: Jan Beulich

Signed-off-by: Keir Fraser <keir@xensource.com>
author kaf24@firebug.cl.cam.ac.uk
date Tue Feb 28 19:00:15 2006 +0100 (2006-02-28)
parents 271cb04a4f2b
children a376bab39768
files linux-2.6-xen-sparse/drivers/xen/Kconfig linux-2.6-xen-sparse/drivers/xen/tpmback/common.h linux-2.6-xen-sparse/drivers/xen/tpmback/interface.c linux-2.6-xen-sparse/drivers/xen/tpmback/tpmback.c linux-2.6-xen-sparse/drivers/xen/tpmback/xenbus.c linux-2.6-xen-sparse/drivers/xen/tpmfront/tpmfront.c
line diff
     1.1 --- a/linux-2.6-xen-sparse/drivers/xen/Kconfig	Tue Feb 28 18:59:24 2006 +0100
     1.2 +++ b/linux-2.6-xen-sparse/drivers/xen/Kconfig	Tue Feb 28 19:00:15 2006 +0100
     1.3 @@ -118,7 +118,7 @@ config XEN_NETDEV_LOOPBACK
     1.4  	  connection.
     1.5  
     1.6  config XEN_TPMDEV_BACKEND
     1.7 -	bool "TPM-device backend driver"
     1.8 +	tristate "TPM-device backend driver"
     1.9  	default n
    1.10  	help
    1.11  	  The TPM-device backend driver
    1.12 @@ -162,7 +162,7 @@ config XEN_BLKDEV_TAP
    1.13  	  space.  Odds are that you want to say N here.
    1.14  
    1.15  config XEN_TPMDEV_FRONTEND
    1.16 -	bool "TPM-device frontend driver"
    1.17 +	tristate "TPM-device frontend driver"
    1.18  	default n
    1.19  	select TCG_TPM
    1.20  	select TCG_XEN
     2.1 --- a/linux-2.6-xen-sparse/drivers/xen/tpmback/common.h	Tue Feb 28 18:59:24 2006 +0100
     2.2 +++ b/linux-2.6-xen-sparse/drivers/xen/tpmback/common.h	Tue Feb 28 19:00:15 2006 +0100
     2.3 @@ -54,9 +54,11 @@ typedef struct tpmif_st {
     2.4  void tpmif_disconnect_complete(tpmif_t * tpmif);
     2.5  tpmif_t *tpmif_find(domid_t domid, long int instance);
     2.6  void tpmif_interface_init(void);
     2.7 +void tpmif_interface_exit(void);
     2.8  void tpmif_schedule_work(tpmif_t * tpmif);
     2.9  void tpmif_deschedule_work(tpmif_t * tpmif);
    2.10  void tpmif_xenbus_init(void);
    2.11 +void tpmif_xenbus_exit(void);
    2.12  int tpmif_map(tpmif_t *tpmif, unsigned long shared_page, unsigned int evtchn);
    2.13  irqreturn_t tpmif_be_int(int irq, void *dev_id, struct pt_regs *regs);
    2.14  int tpmif_vtpm_open(tpmif_t *tpmif, domid_t domain, u32 instance);
     3.1 --- a/linux-2.6-xen-sparse/drivers/xen/tpmback/interface.c	Tue Feb 28 18:59:24 2006 +0100
     3.2 +++ b/linux-2.6-xen-sparse/drivers/xen/tpmback/interface.c	Tue Feb 28 19:00:15 2006 +0100
     3.3 @@ -186,6 +186,12 @@ tpmif_interface_init(void)
     3.4  					 0, 0, NULL, NULL);
     3.5  }
     3.6  
     3.7 +void __init
     3.8 +tpmif_interface_exit(void)
     3.9 +{
    3.10 +	kmem_cache_destroy(tpmif_cachep);
    3.11 +}
    3.12 +
    3.13  /*
    3.14   * Local variables:
    3.15   *  c-file-style: "linux"
     4.1 --- a/linux-2.6-xen-sparse/drivers/xen/tpmback/tpmback.c	Tue Feb 28 18:59:24 2006 +0100
     4.2 +++ b/linux-2.6-xen-sparse/drivers/xen/tpmback/tpmback.c	Tue Feb 28 19:00:15 2006 +0100
     4.3 @@ -1092,7 +1092,20 @@ tpmback_init(void)
     4.4  	return 0;
     4.5  }
     4.6  
     4.7 -__initcall(tpmback_init);
     4.8 +module_init(tpmback_init);
     4.9 +
    4.10 +static void __exit
    4.11 +tpmback_exit(void)
    4.12 +{
    4.13 +
    4.14 +	tpmif_xenbus_exit();
    4.15 +	tpmif_interface_exit();
    4.16 +	misc_deregister(&ibmvtpms_miscdevice);
    4.17 +}
    4.18 +
    4.19 +module_exit(tpmback_exit);
    4.20 +
    4.21 +MODULE_LICENSE("Dual BSD/GPL");
    4.22  
    4.23  /*
    4.24   * Local variables:
     5.1 --- a/linux-2.6-xen-sparse/drivers/xen/tpmback/xenbus.c	Tue Feb 28 18:59:24 2006 +0100
     5.2 +++ b/linux-2.6-xen-sparse/drivers/xen/tpmback/xenbus.c	Tue Feb 28 19:00:15 2006 +0100
     5.3 @@ -317,6 +317,11 @@ void tpmif_xenbus_init(void)
     5.4  	xenbus_register_backend(&tpmback);
     5.5  }
     5.6  
     5.7 +void tpmif_xenbus_exit(void)
     5.8 +{
     5.9 +	xenbus_unregister_driver(&tpmback);
    5.10 +}
    5.11 +
    5.12  /*
    5.13   * Local variables:
    5.14   *  c-file-style: "linux"
     6.1 --- a/linux-2.6-xen-sparse/drivers/xen/tpmfront/tpmfront.c	Tue Feb 28 18:59:24 2006 +0100
     6.2 +++ b/linux-2.6-xen-sparse/drivers/xen/tpmfront/tpmfront.c	Tue Feb 28 19:00:15 2006 +0100
     6.3 @@ -480,6 +480,11 @@ static void __init init_tpm_xenbus(void)
     6.4  	xenbus_register_frontend(&tpmfront);
     6.5  }
     6.6  
     6.7 +static void __exit exit_tpm_xenbus(void)
     6.8 +{
     6.9 +	xenbus_unregister_driver(&tpmfront);
    6.10 +}
    6.11 +
    6.12  
    6.13  static int
    6.14  tpm_allocate_buffers(struct tpm_private *tp)
    6.15 @@ -700,7 +705,18 @@ tpmif_init(void)
    6.16  	return 0;
    6.17  }
    6.18  
    6.19 -__initcall(tpmif_init);
    6.20 +module_init(tpmif_init);
    6.21 +
    6.22 +static void __exit
    6.23 +tpmif_exit(void)
    6.24 +{
    6.25 +	exit_tpm_xenbus();
    6.26 +	gnttab_free_grant_references(gref_head);
    6.27 +}
    6.28 +
    6.29 +module_exit(tpmif_exit);
    6.30 +
    6.31 +MODULE_LICENSE("Dual BSD/GPL");
    6.32  
    6.33  /*
    6.34   * Local variables: