summaryrefslogtreecommitdiff
path: root/drivers/edgetpu/mm-backport.h
blob: 2e2f9a71adfd088d5fd24cd729a56be03ffa995a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
/* SPDX-License-Identifier: GPL-2.0 */
/*
 * Backport mm APIs.
 *
 * Copyright (C) 2021 Google, Inc.
 */
#ifndef __MM_BACKPORT_H__
#define __MM_BACKPORT_H__

#include <linux/mm.h>

/*
 * Define pin_user_pages* which are introduced in Linux 5.6.
 *
 * We simply define pin_user_pages* as get_user_pages* here so our driver can
 * prefer PIN over GET when possible.
 */
#ifndef FOLL_PIN

/* define as zero to prevent older get_user_pages* returning EINVAL */
#define FOLL_LONGTERM 0

#define pin_user_pages_fast get_user_pages_fast
#define unpin_user_page put_page

#endif /* FOLL_PIN */

#endif /* __MM_BACKPORT_H__ */