1 | // SPDX-License-Identifier: GPL-2.0 |
---|---|
2 | /* |
3 | * HMC Drive DVD Module |
4 | * |
5 | * Copyright IBM Corp. 2013 |
6 | * Author(s): Ralf Hoppe (rhoppe@de.ibm.com) |
7 | */ |
8 | |
9 | #define KMSG_COMPONENT "hmcdrv" |
10 | #define pr_fmt(fmt) KMSG_COMPONENT ": " fmt |
11 | |
12 | #include <linux/kernel.h> |
13 | #include <linux/module.h> |
14 | #include <linux/moduleparam.h> |
15 | #include <linux/stat.h> |
16 | |
17 | #include "hmcdrv_ftp.h" |
18 | #include "hmcdrv_dev.h" |
19 | #include "hmcdrv_cache.h" |
20 | |
21 | MODULE_LICENSE("GPL"); |
22 | MODULE_AUTHOR("Copyright 2013 IBM Corporation"); |
23 | MODULE_DESCRIPTION("HMC drive DVD access"); |
24 | |
25 | /* |
26 | * module parameter 'cachesize' |
27 | */ |
28 | static size_t hmcdrv_mod_cachesize = HMCDRV_CACHE_SIZE_DFLT; |
29 | module_param_named(cachesize, hmcdrv_mod_cachesize, ulong, S_IRUGO); |
30 | |
31 | /** |
32 | * hmcdrv_mod_init() - module init function |
33 | */ |
34 | static int __init hmcdrv_mod_init(void) |
35 | { |
36 | int rc = hmcdrv_ftp_probe(); /* perform w/o cache */ |
37 | |
38 | if (rc) |
39 | return rc; |
40 | |
41 | rc = hmcdrv_cache_startup(cachesize: hmcdrv_mod_cachesize); |
42 | |
43 | if (rc) |
44 | return rc; |
45 | |
46 | rc = hmcdrv_dev_init(); |
47 | |
48 | if (rc) |
49 | hmcdrv_cache_shutdown(); |
50 | |
51 | return rc; |
52 | } |
53 | |
54 | /** |
55 | * hmcdrv_mod_exit() - module exit function |
56 | */ |
57 | static void __exit hmcdrv_mod_exit(void) |
58 | { |
59 | hmcdrv_dev_exit(); |
60 | hmcdrv_cache_shutdown(); |
61 | } |
62 | |
63 | module_init(hmcdrv_mod_init); |
64 | module_exit(hmcdrv_mod_exit); |
65 |