diff options
Diffstat (limited to 'backport/backport-include/linux')
7 files changed, 201 insertions, 0 deletions
diff --git a/backport/backport-include/linux/freezer.h b/backport/backport-include/linux/freezer.h new file mode 100644 index 00000000..c6053f30 --- /dev/null +++ b/backport/backport-include/linux/freezer.h @@ -0,0 +1,32 @@ +#ifndef __BACKPORT_FREEZER_H_INCLUDED +#define __BACKPORT_FREEZER_H_INCLUDED +#include_next <linux/freezer.h> + +#ifdef CONFIG_FREEZER +#if LINUX_VERSION_IS_LESS(3,11,0) +/* + * Like schedule_hrtimeout_range(), but should not block the freezer. Do not + * call this with locks held. + */ +#define freezable_schedule_hrtimeout_range LINUX_BACKPORT(freezable_schedule_hrtimeout_range) +static inline int freezable_schedule_hrtimeout_range(ktime_t *expires, + unsigned long delta, const enum hrtimer_mode mode) +{ + int __retval; + freezer_do_not_count(); + __retval = schedule_hrtimeout_range(expires, delta, mode); + freezer_count(); + return __retval; +} +#endif /* LINUX_VERSION_IS_LESS(3,11,0) */ + +#else /* !CONFIG_FREEZER */ + +#ifndef freezable_schedule_hrtimeout_range +#define freezable_schedule_hrtimeout_range(expires, delta, mode) \ + schedule_hrtimeout_range(expires, delta, mode) +#endif + +#endif /* !CONFIG_FREEZER */ + +#endif /* __BACKPORT_FREEZER_H_INCLUDED */ diff --git a/backport/backport-include/linux/mm.h b/backport/backport-include/linux/mm.h index b28156d3..587aa8dc 100644 --- a/backport/backport-include/linux/mm.h +++ b/backport/backport-include/linux/mm.h @@ -12,6 +12,102 @@ void kvfree(const void *addr); #endif /* < 3.15 */ +#if LINUX_VERSION_IS_LESS(3,20,0) +#define get_user_pages_locked LINUX_BACKPORT(get_user_pages_locked) +long get_user_pages_locked(unsigned long start, unsigned long nr_pages, + int write, int force, struct page **pages, int *locked); +#define get_user_pages_unlocked LINUX_BACKPORT(get_user_pages_unlocked) +long get_user_pages_unlocked(unsigned long start, unsigned long nr_pages, + int write, int force, struct page **pages); +#elif LINUX_VERSION_IS_LESS(4,6,0) +static inline +long backport_get_user_pages_locked(unsigned long start, unsigned long nr_pages, + int write, int force, struct page **pages, int *locked) +{ + return get_user_pages_locked(current, current->mm, start, nr_pages, + write, force, pages, locked); +} +#define get_user_pages_locked LINUX_BACKPORT(get_user_pages_locked) + +static inline +long backport_get_user_pages_unlocked(unsigned long start, unsigned long nr_pages, + int write, int force, struct page **pages) +{ + return get_user_pages_unlocked(current, current->mm, start, nr_pages, + write, force, pages); +} +#define get_user_pages_unlocked LINUX_BACKPORT(get_user_pages_unlocked) +#endif + +#if LINUX_VERSION_IS_LESS(4,6,0) +static inline +long backport_get_user_pages(unsigned long start, unsigned long nr_pages, + int write, int force, struct page **pages, + struct vm_area_struct **vmas) +{ + return get_user_pages(current, current->mm, start, nr_pages, + write, force, pages, vmas); +} +#define get_user_pages LINUX_BACKPORT(get_user_pages) +#endif + +#ifndef FOLL_TRIED +#define FOLL_TRIED 0x800 /* a retry, previous pass started an IO */ +#endif + +#ifdef CPTCFG_BPAUTO_BUILD_FRAME_VECTOR +/* Container for pinned pfns / pages */ +struct frame_vector { + unsigned int nr_allocated; /* Number of frames we have space for */ + unsigned int nr_frames; /* Number of frames stored in ptrs array */ + bool got_ref; /* Did we pin pages by getting page ref? */ + bool is_pfns; /* Does array contain pages or pfns? */ + void *ptrs[0]; /* Array of pinned pfns / pages. Use + * pfns_vector_pages() or pfns_vector_pfns() + * for access */ +}; + +struct frame_vector *frame_vector_create(unsigned int nr_frames); +void frame_vector_destroy(struct frame_vector *vec); +int get_vaddr_frames(unsigned long start, unsigned int nr_pfns, + bool write, bool force, struct frame_vector *vec); +void put_vaddr_frames(struct frame_vector *vec); +int frame_vector_to_pages(struct frame_vector *vec); +void frame_vector_to_pfns(struct frame_vector *vec); + +static inline unsigned int frame_vector_count(struct frame_vector *vec) +{ + return vec->nr_frames; +} + +static inline struct page **frame_vector_pages(struct frame_vector *vec) +{ + if (vec->is_pfns) { + int err = frame_vector_to_pages(vec); + + if (err) + return ERR_PTR(err); + } + return (struct page **)(vec->ptrs); +} + +static inline unsigned long *frame_vector_pfns(struct frame_vector *vec) +{ + if (!vec->is_pfns) + frame_vector_to_pfns(vec); + return (unsigned long *)(vec->ptrs); +} +#endif + +#if LINUX_VERSION_IS_LESS(4,1,9) && \ + LINUX_VERSION_IS_GEQ(3,6,0) +#define page_is_pfmemalloc LINUX_BACKPORT(page_is_pfmemalloc) +static inline bool page_is_pfmemalloc(struct page *page) +{ + return page->pfmemalloc; +} +#endif /* < 4.2 */ + #if LINUX_VERSION_IS_LESS(4,12,0) #define kvmalloc LINUX_BACKPORT(kvmalloc) static inline void *kvmalloc(size_t size, gfp_t flags) diff --git a/backport/backport-include/linux/platform_data/media/si4713.h b/backport/backport-include/linux/platform_data/media/si4713.h new file mode 100644 index 00000000..3d49c32f --- /dev/null +++ b/backport/backport-include/linux/platform_data/media/si4713.h @@ -0,0 +1,10 @@ +#ifndef __BACKPORT_SI4713_H +#define __BACKPORT_SI4713_H +#include <linux/version.h> +#if LINUX_VERSION_IS_GEQ(4,5,0) +#include_next <linux/platform_data/media/si4713.h> +#else +#include <media/si4713.h> +#endif /* < 4.5 */ + +#endif /* __BACKPORT_SI4713_H */ diff --git a/backport/backport-include/linux/platform_data/media/soc_camera_platform.h b/backport/backport-include/linux/platform_data/media/soc_camera_platform.h new file mode 100644 index 00000000..927bf8fa --- /dev/null +++ b/backport/backport-include/linux/platform_data/media/soc_camera_platform.h @@ -0,0 +1,10 @@ +#ifndef __BACKPORT_SOC_CAMERA_H__ +#define __BACKPORT_SOC_CAMERA_H__ +#include <linux/version.h> +#if LINUX_VERSION_IS_GEQ(4,5,0) +#include_next <linux/platform_data/media/soc_camera_platform.h> +#else +#include <media/soc_camera_platform.h> +#endif /* < 4.5 */ + +#endif /* __BACKPORT_SOC_CAMERA_H__ */ diff --git a/backport/backport-include/linux/platform_data/media/timb_radio.h b/backport/backport-include/linux/platform_data/media/timb_radio.h new file mode 100644 index 00000000..f1fb47a2 --- /dev/null +++ b/backport/backport-include/linux/platform_data/media/timb_radio.h @@ -0,0 +1,10 @@ +#ifndef __BACKPORT_TIMB_RADIO_ +#define __BACKPORT_TIMB_RADIO_ +#include <linux/version.h> +#if LINUX_VERSION_IS_GEQ(4,5,0) +#include_next <linux/platform_data/media/timb_radio.h> +#else +#include <media/timb_radio.h> +#endif /* < 4.5 */ + +#endif /* __BACKPORT_TIMB_RADIO_ */ diff --git a/backport/backport-include/linux/platform_data/media/timb_video.h b/backport/backport-include/linux/platform_data/media/timb_video.h new file mode 100644 index 00000000..82ff7887 --- /dev/null +++ b/backport/backport-include/linux/platform_data/media/timb_video.h @@ -0,0 +1,10 @@ +#ifndef __BACKPORT_TIMB_VIDEO_ +#define __BACKPORT_TIMB_VIDEO_ +#include <linux/version.h> +#if LINUX_VERSION_IS_GEQ(4,5,0) +#include_next <linux/platform_data/media/timb_video.h> +#else +#include <media/timb_video.h> +#endif /* < 4.5 */ + +#endif /* __BACKPORT_TIMB_VIDEO_ */ diff --git a/backport/backport-include/linux/regulator/driver.h b/backport/backport-include/linux/regulator/driver.h new file mode 100644 index 00000000..f88d9bef --- /dev/null +++ b/backport/backport-include/linux/regulator/driver.h @@ -0,0 +1,33 @@ +/* + * driver.h -- SoC Regulator driver support. + * + * Copyright (C) 2007, 2008 Wolfson Microelectronics PLC. + * + * Author: Liam Girdwood <lrg@slimlogic.co.uk> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * Regulator Driver Interface. + */ + +#ifndef __BACKPORT_LINUX_REGULATOR_DRIVER_H_ +#define __BACKPORT_LINUX_REGULATOR_DRIVER_H_ + +#include <linux/version.h> +#include_next <linux/regulator/driver.h> + +#if LINUX_VERSION_IS_LESS(3,13,0) && \ + LINUX_VERSION_IS_GEQ(3,5,0) +#define devm_regulator_register LINUX_BACKPORT(devm_regulator_register) +struct regulator_dev * +devm_regulator_register(struct device *dev, + const struct regulator_desc *regulator_desc, + const struct regulator_config *config); +#define devm_regulator_unregister LINUX_BACKPORT(devm_regulator_unregister) +void devm_regulator_unregister(struct device *dev, struct regulator_dev *rdev); +#endif /* LINUX_VERSION_IS_LESS(3,13,0) && + LINUX_VERSION_IS_GEQ(3,5,0) */ + +#endif /* __BACKPORT_LINUX_REGULATOR_DRIVER_H_ */ |