xref: /kernel/linux/linux-5.10/include/asm-generic/flat.h
  • Home
  • History
  • Annotate Annotate
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
  • only in /kernel/linux/linux-5.10/include/asm-generic/
18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */
28c2ecf20Sopenharmony_ci#ifndef _ASM_GENERIC_FLAT_H
38c2ecf20Sopenharmony_ci#define _ASM_GENERIC_FLAT_H
48c2ecf20Sopenharmony_ci
58c2ecf20Sopenharmony_ci#include <linux/uaccess.h>
68c2ecf20Sopenharmony_ci
78c2ecf20Sopenharmony_cistatic inline int flat_get_addr_from_rp(u32 __user *rp, u32 relval, u32 flags,
88c2ecf20Sopenharmony_ci		u32 *addr)
98c2ecf20Sopenharmony_ci{
108c2ecf20Sopenharmony_ci#ifndef CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS
118c2ecf20Sopenharmony_ci	return copy_from_user(addr, rp, 4) ? -EFAULT : 0;
128c2ecf20Sopenharmony_ci#else
138c2ecf20Sopenharmony_ci	return get_user(*addr, rp);
148c2ecf20Sopenharmony_ci#endif
158c2ecf20Sopenharmony_ci}
168c2ecf20Sopenharmony_ci
178c2ecf20Sopenharmony_cistatic inline int flat_put_addr_at_rp(u32 __user *rp, u32 addr, u32 rel)
188c2ecf20Sopenharmony_ci{
198c2ecf20Sopenharmony_ci#ifndef CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS
208c2ecf20Sopenharmony_ci	return copy_to_user(rp, &addr, 4) ? -EFAULT : 0;
218c2ecf20Sopenharmony_ci#else
228c2ecf20Sopenharmony_ci	return put_user(addr, rp);
238c2ecf20Sopenharmony_ci#endif
248c2ecf20Sopenharmony_ci}
258c2ecf20Sopenharmony_ci
268c2ecf20Sopenharmony_ci#endif /* _ASM_GENERIC_FLAT_H */
27

Indexes created Thu Nov 07 10:32:03 CST 2024