summaryrefslogtreecommitdiffstats
path: root/drivers/scsi/scsi_module.c
blob: e6d7a607d512df9f9e6b80d34005ae1d5a37fdef (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
/*
 *	scsi_module.c Copyright (1994, 1995) Eric Youngdale.
 *
 * Support for loading low-level scsi drivers using the linux kernel loadable
 * module interface.
 *
 * To use, the host adapter should first define and initialize the variable
 * driver_template (datatype Scsi_Host_Template), and then include this file.
 * This should also be wrapped in a #ifdef MODULE/#endif.
 *
 * The low -level driver must also define a release function which will
 * free any irq assignments, release any dma channels, release any I/O
 * address space that might be reserved, and otherwise clean up after itself.
 * The idea is that the same driver should be able to be reloaded without
 * any difficulty.  This makes debugging new drivers easier, as you should
 * be able to load the driver, test it, unload, modify and reload.
 *
 * One *very* important caveat.  If the driver may need to do DMA on the
 * ISA bus, you must have unchecked_isa_dma set in the device template,
 * even if this might be changed during the detect routine.  This is
 * because the shpnt structure will be allocated in a special way so that
 * it will be below the appropriate DMA limit - thus if your driver uses
 * the hostdata field of shpnt, and the board must be able to access this
 * via DMA, the shpnt structure must be in a DMA accessible region of
 * memory.  This comment would be relevant for something like the buslogic
 * driver where there are many boards, only some of which do DMA onto the
 * ISA bus.  There is no convenient way of specifying whether the host
 * needs to be in a ISA DMA accessible region of memory when you call
 * scsi_register.
 */

#include <linux/module.h>
#include <linux/version.h>

char kernel_version[] = UTS_RELEASE;

int init_module(void) {
	driver_template.usage_count = &mod_use_count_;
	scsi_register_module(MODULE_SCSI_HA, &driver_template);
	return (driver_template.present == 0);
}

void cleanup_module( void) {
	if (MOD_IN_USE) {
		printk(KERN_INFO __FILE__ ": module is in use, remove rejected\n");
	      }
	scsi_unregister_module(MODULE_SCSI_HA, &driver_template);
}