diff options
author | Dominik Sliwa <dominik.sliwa@toradex.com> | 2019-02-21 14:48:31 +0100 |
---|---|---|
committer | Dominik Sliwa <dominik.sliwa@toradex.com> | 2019-02-22 15:26:14 +0100 |
commit | 515a1fa55cda2b1d952872e1786857481bd54fcc (patch) | |
tree | 4c66dd52c58f3d1da423a1ed7f92c4f720e24685 /backport | |
parent | c956caceefd8e859c8b783dd13dad197dc1f7907 (diff) |
backports: support 3.1 and 3.10 tegra kernels
Changes specific to vendor kernels
Signed-off-by: Dominik Sliwa <dominik.sliwa@toradex.com>
Diffstat (limited to 'backport')
-rw-r--r-- | backport/backport-include/linux/export.h | 4 | ||||
-rw-r--r-- | backport/backport-include/linux/hrtimer.h | 10 | ||||
-rw-r--r-- | backport/backport-include/linux/kernel.h | 2 | ||||
-rw-r--r-- | backport/backport-include/linux/netdevice.h | 2 | ||||
-rw-r--r-- | backport/backport-include/linux/of_device.h | 2 | ||||
-rw-r--r-- | backport/backport-include/linux/pci.h | 5 | ||||
-rw-r--r-- | backport/backport-include/linux/random.h | 4 | ||||
-rw-r--r-- | backport/backport-include/linux/suspend.h | 14 | ||||
-rw-r--r-- | backport/backport-include/linux/thermal.h | 34 | ||||
-rw-r--r-- | backport/backport-include/linux/timekeeping.h | 5 | ||||
-rw-r--r-- | backport/backport-include/trace/ftrace.h | 3 | ||||
-rw-r--r-- | backport/compat/backport-3.17.c | 18 | ||||
-rw-r--r-- | backport/compat/backport-4.12.c | 2 | ||||
-rw-r--r-- | backport/compat/compat-3.5.c | 4 | ||||
-rw-r--r-- | backport/compat/compat-3.6.c | 2 | ||||
-rw-r--r-- | backport/compat/compat-3.7.c | 3 | ||||
-rw-r--r-- | backport/compat/compat-3.8.c | 3 |
17 files changed, 110 insertions, 7 deletions
diff --git a/backport/backport-include/linux/export.h b/backport/backport-include/linux/export.h index 6f6cb6a9..a3c7799a 100644 --- a/backport/backport-include/linux/export.h +++ b/backport/backport-include/linux/export.h @@ -3,7 +3,7 @@ #include <linux/version.h> -#if LINUX_VERSION_IS_GEQ(3,2,0) +#if LINUX_VERSION_IS_GEQ(3,1,0) #include_next <linux/export.h> #else #ifndef pr_fmt @@ -14,6 +14,6 @@ #undef pr_fmt #undef backport_undef_pr_fmt #endif -#endif /* LINUX_VERSION_IS_GEQ(3,2,0) */ +#endif /* LINUX_VERSION_IS_GEQ(3,1,0) */ #endif /* _COMPAT_LINUX_EXPORT_H */ diff --git a/backport/backport-include/linux/hrtimer.h b/backport/backport-include/linux/hrtimer.h new file mode 100644 index 00000000..2c186dd1 --- /dev/null +++ b/backport/backport-include/linux/hrtimer.h @@ -0,0 +1,10 @@ +#ifndef __BACKPORT_LINUX_HRTIMER_H +#define __BACKPORT_LINUX_HRTIMER_H +#include_next <linux/hrtimer.h> + +#if LINUX_VERSION_IS_LESS(3,17,0) +u64 bp_ktime_divns(const ktime_t kt, s64 div); +#define ktime_divns bp_ktime_divns +#endif /* < 3.17 */ + +#endif /* __BACKPORT_LINUX_HRTIMER_H */ diff --git a/backport/backport-include/linux/kernel.h b/backport/backport-include/linux/kernel.h index f5081663..332f1537 100644 --- a/backport/backport-include/linux/kernel.h +++ b/backport/backport-include/linux/kernel.h @@ -1,7 +1,9 @@ #ifndef __BACKPORT_KERNEL_H #define __BACKPORT_KERNEL_H #include_next <linux/kernel.h> +#if LINUX_VERSION_IS_GEQ(4,5,0) #include <linux/bug.h> +#endif #include <linux/version.h> /* * some older kernels don't have this and thus don't diff --git a/backport/backport-include/linux/netdevice.h b/backport/backport-include/linux/netdevice.h index c3e91a0c..4b1fddff 100644 --- a/backport/backport-include/linux/netdevice.h +++ b/backport/backport-include/linux/netdevice.h @@ -344,7 +344,7 @@ static inline void netif_trans_update(struct net_device *dev) (_dev)->needs_free_netdev = true; #endif -#if LINUX_VERSION_IS_LESS(4,15,0) +#if LINUX_VERSION_IN_RANGE(3,10,0, 4,14,0) static inline int _bp_netdev_upper_dev_link(struct net_device *dev, struct net_device *upper_dev) { diff --git a/backport/backport-include/linux/of_device.h b/backport/backport-include/linux/of_device.h index 2178a338..827c7fb1 100644 --- a/backport/backport-include/linux/of_device.h +++ b/backport/backport-include/linux/of_device.h @@ -24,8 +24,10 @@ static inline int backport_of_dma_configure(struct device *dev, #endif /* < 4.18 */ #if LINUX_VERSION_IS_LESS(4,12,0) +#if LINUX_VERSION_IS_GEQ(4,4,0) ssize_t bp_of_device_modalias(struct device *dev, char *str, ssize_t len); #define of_device_modalias bp_of_device_modalias +#endif /* > 4.4.0 */ #endif /* < 4.12 */ #endif /* __BP_OF_DEVICE_H */ diff --git a/backport/backport-include/linux/pci.h b/backport/backport-include/linux/pci.h index 3a141bf3..42b3dc53 100644 --- a/backport/backport-include/linux/pci.h +++ b/backport/backport-include/linux/pci.h @@ -17,6 +17,9 @@ pci_unregister_driver) #endif +#if LINUX_VERSION_IS_LESS(3,4,0) +void pci_stop_and_remove_bus_device(struct pci_dev *dev); +#endif #if LINUX_VERSION_IS_LESS(3,7,0) #define pcie_capability_read_word LINUX_BACKPORT(pcie_capability_read_word) int pcie_capability_read_word(struct pci_dev *dev, int pos, u16 *val); @@ -60,6 +63,8 @@ static inline int pcie_capability_clear_dword(struct pci_dev *dev, int pos, { return pcie_capability_clear_and_set_dword(dev, pos, clear, 0); } + +int pci_pcie_type(struct pci_dev *dev); #endif #ifndef PCI_DEVICE_SUB diff --git a/backport/backport-include/linux/random.h b/backport/backport-include/linux/random.h index 7d817d8b..fa016cce 100644 --- a/backport/backport-include/linux/random.h +++ b/backport/backport-include/linux/random.h @@ -12,7 +12,9 @@ static inline void add_device_randomness(const void *buf, unsigned int size) } #endif -#if LINUX_VERSION_IS_LESS(3,8,0) +/* #if LINUX_VERSION_IS_LESS(3,8,0) */ +/* already backported in our kernels */ +#if 0 /* backports 496f2f9 */ #define prandom_seed(_seed) srandom32(_seed) #define prandom_u32() random32() diff --git a/backport/backport-include/linux/suspend.h b/backport/backport-include/linux/suspend.h new file mode 100644 index 00000000..60307182 --- /dev/null +++ b/backport/backport-include/linux/suspend.h @@ -0,0 +1,14 @@ +#ifndef __BP_LINUX_SUSPEND_H +#define __BP_LINUX_SUSPEND_H +#include_next <linux/suspend.h> + +#if LINUX_VERSION_IS_LESS(3,18,0) +static inline void pm_system_wakeup(void) +{ +#if LINUX_VERSION_IS_GEQ(3,10,0) + freeze_wake(); +#endif +} +#endif + +#endif /* __BP_LINUX_SUSPEND_H */ diff --git a/backport/backport-include/linux/thermal.h b/backport/backport-include/linux/thermal.h index 8874e196..ad61a90a 100644 --- a/backport/backport-include/linux/thermal.h +++ b/backport/backport-include/linux/thermal.h @@ -6,6 +6,40 @@ #ifdef CONFIG_THERMAL #if LINUX_VERSION_IS_LESS(3,8,0) #include <linux/errno.h> +#include <linux/err.h> + +enum thermal_trend { + THERMAL_TREND_STABLE, /* temperature is stable */ + THERMAL_TREND_RAISING, /* temperature is raising */ + THERMAL_TREND_DROPPING, /* temperature is dropping */ + THERMAL_TREND_RAISE_FULL, /* apply highest cooling action */ + THERMAL_TREND_DROP_FULL, /* apply lowest cooling action */ +}; + +struct backport_thermal_zone_device_ops { + int (*bind) (struct thermal_zone_device *, + struct thermal_cooling_device *); + int (*unbind) (struct thermal_zone_device *, + struct thermal_cooling_device *); + int (*get_temp) (struct thermal_zone_device *, int *); + int (*get_mode) (struct thermal_zone_device *, + enum thermal_device_mode *); + int (*set_mode) (struct thermal_zone_device *, + enum thermal_device_mode); + int (*get_trip_type) (struct thermal_zone_device *, int, + enum thermal_trip_type *); + int (*get_trip_temp) (struct thermal_zone_device *, int, int *); + int (*set_trip_temp) (struct thermal_zone_device *, int, int); + int (*get_trip_hyst) (struct thermal_zone_device *, int, int *); + int (*set_trip_hyst) (struct thermal_zone_device *, int, int); + int (*get_crit_temp) (struct thermal_zone_device *, int *); + int (*set_emul_temp) (struct thermal_zone_device *, int); + int (*get_trend) (struct thermal_zone_device *, int, + enum thermal_trend *); + int (*notify) (struct thermal_zone_device *, int, + enum thermal_trip_type); +}; +#define thermal_zone_device_ops LINUX_BACKPORT(thermal_zone_device_ops) struct thermal_bind_params { struct thermal_cooling_device *cdev; diff --git a/backport/backport-include/linux/timekeeping.h b/backport/backport-include/linux/timekeeping.h index 71871531..a0d65fba 100644 --- a/backport/backport-include/linux/timekeeping.h +++ b/backport/backport-include/linux/timekeeping.h @@ -8,6 +8,11 @@ #endif #if LINUX_VERSION_IS_LESS(3,17,0) +#if BITS_PER_LONG < 64 +extern u64 ktime_divns(const ktime_t kt, s64 div); +#else /* BITS_PER_LONG < 64 */ +# define ktime_divns(kt, div) (u64)((kt).tv64 / (div)) +#endif #define ktime_get_ns LINUX_BACKPORT(ktime_get_ns) extern ktime_t ktime_get(void); #define ktime_get_ns LINUX_BACKPORT(ktime_get_ns) diff --git a/backport/backport-include/trace/ftrace.h b/backport/backport-include/trace/ftrace.h index 2daedd55..756ded36 100644 --- a/backport/backport-include/trace/ftrace.h +++ b/backport/backport-include/trace/ftrace.h @@ -9,5 +9,6 @@ #undef __get_dynamic_array_len #define __get_dynamic_array_len(field) \ ((__entry->__data_loc_##field >> 16) & 0xffff) - +#if LINUX_VERSION_IS_GEQ(3,2,0) #include_next <trace/ftrace.h> +#endif diff --git a/backport/compat/backport-3.17.c b/backport/compat/backport-3.17.c index bf6027cb..5961e3bc 100644 --- a/backport/compat/backport-3.17.c +++ b/backport/compat/backport-3.17.c @@ -146,6 +146,24 @@ char *devm_kasprintf(struct device *dev, gfp_t gfp, const char *fmt, ...) } EXPORT_SYMBOL_GPL(devm_kasprintf); +u64 bp_ktime_divns(const ktime_t kt, s64 div) +{ + u64 dclc; + int sft = 0; + + dclc = ktime_to_ns(kt); + /* Make sure the divisor is less than 2^32: */ + while (div >> 32) { + sft++; + div >>= 1; + } + dclc >>= sft; + do_div(dclc, (unsigned long) div); + + return dclc; +} +EXPORT_SYMBOL_GPL(bp_ktime_divns); + #define STANDARD_PARAM_DEF(name, type, format, strtolfn) \ int param_set_##name(const char *val, const struct kernel_param *kp) \ { \ diff --git a/backport/compat/backport-4.12.c b/backport/compat/backport-4.12.c index 413ae7f1..4f9de261 100644 --- a/backport/compat/backport-4.12.c +++ b/backport/compat/backport-4.12.c @@ -3,6 +3,7 @@ #endif #ifdef CONFIG_OF +#if LINUX_VERSION_IS_GEQ(4,4,0) /** * of_device_modalias - Fill buffer with newline terminated modalias string */ @@ -20,3 +21,4 @@ ssize_t bp_of_device_modalias(struct device *dev, char *str, ssize_t len) } EXPORT_SYMBOL_GPL(bp_of_device_modalias); #endif +#endif diff --git a/backport/compat/compat-3.5.c b/backport/compat/compat-3.5.c index de312283..721ec0e3 100644 --- a/backport/compat/compat-3.5.c +++ b/backport/compat/compat-3.5.c @@ -67,7 +67,9 @@ EXPORT_SYMBOL_GPL(overflowuid); EXPORT_SYMBOL_GPL(overflowgid); #endif -#if IS_ENABLED(CONFIG_PTP_1588_CLOCK) +/* #if IS_ENABLED(CONFIG_PTP_1588_CLOCK) */ +/* backported to all of our kernels */ +#if 0 int ptp_clock_index(struct ptp_clock *ptp) { return ptp->index; diff --git a/backport/compat/compat-3.6.c b/backport/compat/compat-3.6.c index ef364852..9e593f5c 100644 --- a/backport/compat/compat-3.6.c +++ b/backport/compat/compat-3.6.c @@ -14,6 +14,7 @@ /* whoopsie ! */ #ifndef CONFIG_COMMON_CLK +#ifndef CONFIG_ARCH_TEGRA int clk_enable(struct clk *clk) { return 0; @@ -25,3 +26,4 @@ void clk_disable(struct clk *clk) } EXPORT_SYMBOL_GPL(clk_disable); #endif +#endif diff --git a/backport/compat/compat-3.7.c b/backport/compat/compat-3.7.c index a70709c9..528d7ec9 100644 --- a/backport/compat/compat-3.7.c +++ b/backport/compat/compat-3.7.c @@ -49,10 +49,11 @@ static inline u16 pcie_flags_reg(struct pci_dev *dev) } #define pci_pcie_type LINUX_BACKPORT(pci_pcie_type) -static inline int pci_pcie_type(struct pci_dev *dev) +int pci_pcie_type(struct pci_dev *dev) { return (pcie_flags_reg(dev) & PCI_EXP_FLAGS_TYPE) >> 4; } +EXPORT_SYMBOL_GPL(pci_pcie_type); #define pcie_cap_version LINUX_BACKPORT(pcie_cap_version) static inline int pcie_cap_version(struct pci_dev *dev) diff --git a/backport/compat/compat-3.8.c b/backport/compat/compat-3.8.c index ff9cd493..21686cc3 100644 --- a/backport/compat/compat-3.8.c +++ b/backport/compat/compat-3.8.c @@ -356,6 +356,8 @@ bool hid_ignore(struct hid_device *hdev) } EXPORT_SYMBOL_GPL(hid_ignore); +/* backported to our kernel */ +#if 0 /** * prandom_bytes - get the requested number of pseudo-random bytes * @buf: where to copy the pseudo-random bytes to @@ -386,6 +388,7 @@ void prandom_bytes(void *buf, int bytes) } } EXPORT_SYMBOL_GPL(prandom_bytes); +#endif #ifdef CONFIG_OF /** |