pmem.c 798 B

12345678910111213141516171819202122232425262728293031323334353637
  1. // SPDX-License-Identifier: GPL-2.0
  2. /*
  3. * Copyright (c) 2015, Christoph Hellwig.
  4. * Copyright (c) 2015, Intel Corporation.
  5. */
  6. #include <linux/platform_device.h>
  7. #include <linux/init.h>
  8. #include <linux/ioport.h>
  9. static int found(struct resource *res, void *data)
  10. {
  11. return 1;
  12. }
  13. static __init int register_e820_pmem(void)
  14. {
  15. struct platform_device *pdev;
  16. int rc;
  17. rc = walk_iomem_res_desc(IORES_DESC_PERSISTENT_MEMORY_LEGACY,
  18. IORESOURCE_MEM, 0, -1, NULL, found);
  19. if (rc <= 0)
  20. return 0;
  21. /*
  22. * See drivers/nvdimm/e820.c for the implementation, this is
  23. * simply here to trigger the module to load on demand.
  24. */
  25. pdev = platform_device_alloc("e820_pmem", -1);
  26. rc = platform_device_add(pdev);
  27. if (rc)
  28. platform_device_put(pdev);
  29. return rc;
  30. }
  31. device_initcall(register_e820_pmem);