hmcdrv_mod.c 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  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. #define KMSG_COMPONENT "hmcdrv"
  9. #define pr_fmt(fmt) KMSG_COMPONENT ": " fmt
  10. #include <linux/kernel.h>
  11. #include <linux/module.h>
  12. #include <linux/moduleparam.h>
  13. #include <linux/stat.h>
  14. #include "hmcdrv_ftp.h"
  15. #include "hmcdrv_dev.h"
  16. #include "hmcdrv_cache.h"
  17. MODULE_LICENSE("GPL");
  18. MODULE_AUTHOR("Copyright 2013 IBM Corporation");
  19. MODULE_DESCRIPTION("HMC drive DVD access");
  20. /*
  21. * module parameter 'cachesize'
  22. */
  23. static size_t hmcdrv_mod_cachesize = HMCDRV_CACHE_SIZE_DFLT;
  24. module_param_named(cachesize, hmcdrv_mod_cachesize, ulong, S_IRUGO);
  25. /**
  26. * hmcdrv_mod_init() - module init function
  27. */
  28. static int __init hmcdrv_mod_init(void)
  29. {
  30. int rc = hmcdrv_ftp_probe(); /* perform w/o cache */
  31. if (rc)
  32. return rc;
  33. rc = hmcdrv_cache_startup(hmcdrv_mod_cachesize);
  34. if (rc)
  35. return rc;
  36. rc = hmcdrv_dev_init();
  37. if (rc)
  38. hmcdrv_cache_shutdown();
  39. return rc;
  40. }
  41. /**
  42. * hmcdrv_mod_exit() - module exit function
  43. */
  44. static void __exit hmcdrv_mod_exit(void)
  45. {
  46. hmcdrv_dev_exit();
  47. hmcdrv_cache_shutdown();
  48. }
  49. module_init(hmcdrv_mod_init);
  50. module_exit(hmcdrv_mod_exit);