hmcdrv_mod.c 1.2 KB

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