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