Skip to content

Commit 8e37d00

Browse files
Christoph Hellwigdjbw
authored andcommitted
memremap: provide stubs for vmem_altmap_offset and vmem_altmap_free
Currently all calls to those functions are eliminated by the compiler when CONFIG_ZONE_DEVICE is not set, but this soon won't be the case. Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
1 parent 30a7acd commit 8e37d00

File tree

1 file changed

+14
-4
lines changed

1 file changed

+14
-4
lines changed

include/linux/memremap.h

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,6 @@ struct vmem_altmap {
2626
unsigned long alloc;
2727
};
2828

29-
unsigned long vmem_altmap_offset(struct vmem_altmap *altmap);
30-
void vmem_altmap_free(struct vmem_altmap *altmap, unsigned long nr_pfns);
31-
3229
#ifdef CONFIG_ZONE_DEVICE
3330
struct vmem_altmap *to_vmem_altmap(unsigned long memmap_start);
3431
#else
@@ -138,6 +135,9 @@ void *devm_memremap_pages(struct device *dev, struct resource *res,
138135
struct percpu_ref *ref, struct vmem_altmap *altmap);
139136
struct dev_pagemap *find_dev_pagemap(resource_size_t phys);
140137

138+
unsigned long vmem_altmap_offset(struct vmem_altmap *altmap);
139+
void vmem_altmap_free(struct vmem_altmap *altmap, unsigned long nr_pfns);
140+
141141
static inline bool is_zone_device_page(const struct page *page);
142142
#else
143143
static inline void *devm_memremap_pages(struct device *dev,
@@ -157,7 +157,17 @@ static inline struct dev_pagemap *find_dev_pagemap(resource_size_t phys)
157157
{
158158
return NULL;
159159
}
160-
#endif
160+
161+
static inline unsigned long vmem_altmap_offset(struct vmem_altmap *altmap)
162+
{
163+
return 0;
164+
}
165+
166+
static inline void vmem_altmap_free(struct vmem_altmap *altmap,
167+
unsigned long nr_pfns)
168+
{
169+
}
170+
#endif /* CONFIG_ZONE_DEVICE */
161171

162172
#if defined(CONFIG_DEVICE_PRIVATE) || defined(CONFIG_DEVICE_PUBLIC)
163173
static inline bool is_device_private_page(const struct page *page)

0 commit comments

Comments
 (0)