Skip to content

Commit bc0d0d0

Browse files
committed
libnvdimm, e820: skip module loading when no type-12
If there are no persistent memory ranges present then don't bother creating the platform device. Otherwise, it loads the full libnvdimm sub-system only to discover no resources present. Reported-by: Andy Lutomirski <luto@amacapital.net> Acked-by: Andy Lutomirski <luto@amacapital.net> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
1 parent 31ade3b commit bc0d0d0

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

arch/x86/kernel/pmem.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,22 @@
44
*/
55
#include <linux/platform_device.h>
66
#include <linux/module.h>
7+
#include <linux/ioport.h>
8+
9+
static int found(u64 start, u64 end, void *data)
10+
{
11+
return 1;
12+
}
713

814
static __init int register_e820_pmem(void)
915
{
16+
char *pmem = "Persistent Memory (legacy)";
1017
struct platform_device *pdev;
18+
int rc;
19+
20+
rc = walk_iomem_res(pmem, IORESOURCE_MEM, 0, -1, NULL, found);
21+
if (rc <= 0)
22+
return 0;
1123

1224
/*
1325
* See drivers/nvdimm/e820.c for the implementation, this is

0 commit comments

Comments
 (0)