Back to home page

OSCL-LXR

 
 

    


0001 // SPDX-License-Identifier: GPL-2.0
0002 /*
0003  * Copyright (c) 2015, Christoph Hellwig.
0004  * Copyright (c) 2015, Intel Corporation.
0005  */
0006 #include <linux/platform_device.h>
0007 #include <linux/init.h>
0008 #include <linux/ioport.h>
0009 
0010 static int found(struct resource *res, void *data)
0011 {
0012     return 1;
0013 }
0014 
0015 static __init int register_e820_pmem(void)
0016 {
0017     struct platform_device *pdev;
0018     int rc;
0019 
0020     rc = walk_iomem_res_desc(IORES_DESC_PERSISTENT_MEMORY_LEGACY,
0021                  IORESOURCE_MEM, 0, -1, NULL, found);
0022     if (rc <= 0)
0023         return 0;
0024 
0025     /*
0026      * See drivers/nvdimm/e820.c for the implementation, this is
0027      * simply here to trigger the module to load on demand.
0028      */
0029     pdev = platform_device_alloc("e820_pmem", -1);
0030 
0031     rc = platform_device_add(pdev);
0032     if (rc)
0033         platform_device_put(pdev);
0034 
0035     return rc;
0036 }
0037 device_initcall(register_e820_pmem);