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