aboutsummaryrefslogtreecommitdiffstats
path: root/include/asm-generic
diff options
context:
space:
mode:
Diffstat (limited to 'include/asm-generic')
-rw-r--r--include/asm-generic/checksum.h4
-rw-r--r--include/asm-generic/cmpxchg-local.h8
-rw-r--r--include/asm-generic/cputime.h66
-rw-r--r--include/asm-generic/cputime_jiffies.h72
-rw-r--r--include/asm-generic/cputime_nsecs.h104
-rw-r--r--include/asm-generic/gpio.h86
-rw-r--r--include/asm-generic/io.h28
-rw-r--r--include/asm-generic/pgtable.h10
-rw-r--r--include/asm-generic/syscalls.h16
-rw-r--r--include/asm-generic/uaccess.h14
-rw-r--r--include/asm-generic/unistd.h3
-rw-r--r--include/asm-generic/vmlinux.lds.h32
12 files changed, 297 insertions, 146 deletions
diff --git a/include/asm-generic/checksum.h b/include/asm-generic/checksum.h
index c084767c88bc..59811df58c5b 100644
--- a/include/asm-generic/checksum.h
+++ b/include/asm-generic/checksum.h
@@ -38,12 +38,15 @@ extern __wsum csum_partial_copy_from_user(const void __user *src, void *dst,
38 csum_partial_copy((src), (dst), (len), (sum)) 38 csum_partial_copy((src), (dst), (len), (sum))
39#endif 39#endif
40 40
41#ifndef ip_fast_csum
41/* 42/*
42 * This is a version of ip_compute_csum() optimized for IP headers, 43 * This is a version of ip_compute_csum() optimized for IP headers,
43 * which always checksum on 4 octet boundaries. 44 * which always checksum on 4 octet boundaries.
44 */ 45 */
45extern __sum16 ip_fast_csum(const void *iph, unsigned int ihl); 46extern __sum16 ip_fast_csum(const void *iph, unsigned int ihl);
47#endif
46 48
49#ifndef csum_fold
47/* 50/*
48 * Fold a partial checksum 51 * Fold a partial checksum
49 */ 52 */
@@ -54,6 +57,7 @@ static inline __sum16 csum_fold(__wsum csum)
54 sum = (sum & 0xffff) + (sum >> 16); 57 sum = (sum & 0xffff) + (sum >> 16);
55 return (__force __sum16)~sum; 58 return (__force __sum16)~sum;
56} 59}
60#endif
57 61
58#ifndef csum_tcpudp_nofold 62#ifndef csum_tcpudp_nofold
59/* 63/*
diff --git a/include/asm-generic/cmpxchg-local.h b/include/asm-generic/cmpxchg-local.h
index 2533fddd34a6..d8d4c898c1bb 100644
--- a/include/asm-generic/cmpxchg-local.h
+++ b/include/asm-generic/cmpxchg-local.h
@@ -21,7 +21,7 @@ static inline unsigned long __cmpxchg_local_generic(volatile void *ptr,
21 if (size == 8 && sizeof(unsigned long) != 8) 21 if (size == 8 && sizeof(unsigned long) != 8)
22 wrong_size_cmpxchg(ptr); 22 wrong_size_cmpxchg(ptr);
23 23
24 local_irq_save(flags); 24 raw_local_irq_save(flags);
25 switch (size) { 25 switch (size) {
26 case 1: prev = *(u8 *)ptr; 26 case 1: prev = *(u8 *)ptr;
27 if (prev == old) 27 if (prev == old)
@@ -42,7 +42,7 @@ static inline unsigned long __cmpxchg_local_generic(volatile void *ptr,
42 default: 42 default:
43 wrong_size_cmpxchg(ptr); 43 wrong_size_cmpxchg(ptr);
44 } 44 }
45 local_irq_restore(flags); 45 raw_local_irq_restore(flags);
46 return prev; 46 return prev;
47} 47}
48 48
@@ -55,11 +55,11 @@ static inline u64 __cmpxchg64_local_generic(volatile void *ptr,
55 u64 prev; 55 u64 prev;
56 unsigned long flags; 56 unsigned long flags;
57 57
58 local_irq_save(flags); 58 raw_local_irq_save(flags);
59 prev = *(u64 *)ptr; 59 prev = *(u64 *)ptr;
60 if (prev == old) 60 if (prev == old)
61 *(u64 *)ptr = new; 61 *(u64 *)ptr = new;
62 local_irq_restore(flags); 62 raw_local_irq_restore(flags);
63 return prev; 63 return prev;
64} 64}
65 65
diff --git a/include/asm-generic/cputime.h b/include/asm-generic/cputime.h
index 9a62937c56ca..51969436b8b8 100644
--- a/include/asm-generic/cputime.h
+++ b/include/asm-generic/cputime.h
@@ -4,66 +4,12 @@
4#include <linux/time.h> 4#include <linux/time.h>
5#include <linux/jiffies.h> 5#include <linux/jiffies.h>
6 6
7typedef unsigned long __nocast cputime_t; 7#ifndef CONFIG_VIRT_CPU_ACCOUNTING
8 8# include <asm-generic/cputime_jiffies.h>
9#define cputime_one_jiffy jiffies_to_cputime(1) 9#endif
10#define cputime_to_jiffies(__ct) (__force unsigned long)(__ct)
11#define cputime_to_scaled(__ct) (__ct)
12#define jiffies_to_cputime(__hz) (__force cputime_t)(__hz)
13
14typedef u64 __nocast cputime64_t;
15
16#define cputime64_to_jiffies64(__ct) (__force u64)(__ct)
17#define jiffies64_to_cputime64(__jif) (__force cputime64_t)(__jif)
18
19#define nsecs_to_cputime64(__ct) \
20 jiffies64_to_cputime64(nsecs_to_jiffies64(__ct))
21
22
23/*
24 * Convert cputime to microseconds and back.
25 */
26#define cputime_to_usecs(__ct) \
27 jiffies_to_usecs(cputime_to_jiffies(__ct))
28#define usecs_to_cputime(__usec) \
29 jiffies_to_cputime(usecs_to_jiffies(__usec))
30#define usecs_to_cputime64(__usec) \
31 jiffies64_to_cputime64(nsecs_to_jiffies64((__usec) * 1000))
32
33/*
34 * Convert cputime to seconds and back.
35 */
36#define cputime_to_secs(jif) (cputime_to_jiffies(jif) / HZ)
37#define secs_to_cputime(sec) jiffies_to_cputime((sec) * HZ)
38
39/*
40 * Convert cputime to timespec and back.
41 */
42#define timespec_to_cputime(__val) \
43 jiffies_to_cputime(timespec_to_jiffies(__val))
44#define cputime_to_timespec(__ct,__val) \
45 jiffies_to_timespec(cputime_to_jiffies(__ct),__val)
46
47/*
48 * Convert cputime to timeval and back.
49 */
50#define timeval_to_cputime(__val) \
51 jiffies_to_cputime(timeval_to_jiffies(__val))
52#define cputime_to_timeval(__ct,__val) \
53 jiffies_to_timeval(cputime_to_jiffies(__ct),__val)
54
55/*
56 * Convert cputime to clock and back.
57 */
58#define cputime_to_clock_t(__ct) \
59 jiffies_to_clock_t(cputime_to_jiffies(__ct))
60#define clock_t_to_cputime(__x) \
61 jiffies_to_cputime(clock_t_to_jiffies(__x))
62 10
63/* 11#ifdef CONFIG_VIRT_CPU_ACCOUNTING_GEN
64 * Convert cputime64 to clock. 12# include <asm-generic/cputime_nsecs.h>
65 */ 13#endif
66#define cputime64_to_clock_t(__ct) \
67 jiffies_64_to_clock_t(cputime64_to_jiffies64(__ct))
68 14
69#endif 15#endif
diff --git a/include/asm-generic/cputime_jiffies.h b/include/asm-generic/cputime_jiffies.h
new file mode 100644
index 000000000000..272ecba9f588
--- /dev/null
+++ b/include/asm-generic/cputime_jiffies.h
@@ -0,0 +1,72 @@
1#ifndef _ASM_GENERIC_CPUTIME_JIFFIES_H
2#define _ASM_GENERIC_CPUTIME_JIFFIES_H
3
4typedef unsigned long __nocast cputime_t;
5
6#define cputime_one_jiffy jiffies_to_cputime(1)
7#define cputime_to_jiffies(__ct) (__force unsigned long)(__ct)
8#define cputime_to_scaled(__ct) (__ct)
9#define jiffies_to_cputime(__hz) (__force cputime_t)(__hz)
10
11typedef u64 __nocast cputime64_t;
12
13#define cputime64_to_jiffies64(__ct) (__force u64)(__ct)
14#define jiffies64_to_cputime64(__jif) (__force cputime64_t)(__jif)
15
16
17/*
18 * Convert nanoseconds to cputime
19 */
20#define nsecs_to_cputime64(__nsec) \
21 jiffies64_to_cputime64(nsecs_to_jiffies64(__nsec))
22#define nsecs_to_cputime(__nsec) \
23 jiffies_to_cputime(nsecs_to_jiffies(__nsec))
24
25
26/*
27 * Convert cputime to microseconds and back.
28 */
29#define cputime_to_usecs(__ct) \
30 jiffies_to_usecs(cputime_to_jiffies(__ct))
31#define usecs_to_cputime(__usec) \
32 jiffies_to_cputime(usecs_to_jiffies(__usec))
33#define usecs_to_cputime64(__usec) \
34 jiffies64_to_cputime64(nsecs_to_jiffies64((__usec) * 1000))
35
36/*
37 * Convert cputime to seconds and back.
38 */
39#define cputime_to_secs(jif) (cputime_to_jiffies(jif) / HZ)
40#define secs_to_cputime(sec) jiffies_to_cputime((sec) * HZ)
41
42/*
43 * Convert cputime to timespec and back.
44 */
45#define timespec_to_cputime(__val) \
46 jiffies_to_cputime(timespec_to_jiffies(__val))
47#define cputime_to_timespec(__ct,__val) \
48 jiffies_to_timespec(cputime_to_jiffies(__ct),__val)
49
50/*
51 * Convert cputime to timeval and back.
52 */
53#define timeval_to_cputime(__val) \
54 jiffies_to_cputime(timeval_to_jiffies(__val))
55#define cputime_to_timeval(__ct,__val) \
56 jiffies_to_timeval(cputime_to_jiffies(__ct),__val)
57
58/*
59 * Convert cputime to clock and back.
60 */
61#define cputime_to_clock_t(__ct) \
62 jiffies_to_clock_t(cputime_to_jiffies(__ct))
63#define clock_t_to_cputime(__x) \
64 jiffies_to_cputime(clock_t_to_jiffies(__x))
65
66/*
67 * Convert cputime64 to clock.
68 */
69#define cputime64_to_clock_t(__ct) \
70 jiffies_64_to_clock_t(cputime64_to_jiffies64(__ct))
71
72#endif
diff --git a/include/asm-generic/cputime_nsecs.h b/include/asm-generic/cputime_nsecs.h
new file mode 100644
index 000000000000..a8ece9a33aef
--- /dev/null
+++ b/include/asm-generic/cputime_nsecs.h
@@ -0,0 +1,104 @@
1/*
2 * Definitions for measuring cputime in nsecs resolution.
3 *
4 * Based on <arch/ia64/include/asm/cputime.h>
5 *
6 * Copyright (C) 2007 FUJITSU LIMITED
7 * Copyright (C) 2007 Hidetoshi Seto <seto.hidetoshi@jp.fujitsu.com>
8 *
9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License
11 * as published by the Free Software Foundation; either version
12 * 2 of the License, or (at your option) any later version.
13 *
14 */
15
16#ifndef _ASM_GENERIC_CPUTIME_NSECS_H
17#define _ASM_GENERIC_CPUTIME_NSECS_H
18
19typedef u64 __nocast cputime_t;
20typedef u64 __nocast cputime64_t;
21
22#define cputime_one_jiffy jiffies_to_cputime(1)
23
24/*
25 * Convert cputime <-> jiffies (HZ)
26 */
27#define cputime_to_jiffies(__ct) \
28 ((__force u64)(__ct) / (NSEC_PER_SEC / HZ))
29#define cputime_to_scaled(__ct) (__ct)
30#define jiffies_to_cputime(__jif) \
31 (__force cputime_t)((__jif) * (NSEC_PER_SEC / HZ))
32#define cputime64_to_jiffies64(__ct) \
33 ((__force u64)(__ct) / (NSEC_PER_SEC / HZ))
34#define jiffies64_to_cputime64(__jif) \
35 (__force cputime64_t)((__jif) * (NSEC_PER_SEC / HZ))
36
37
38/*
39 * Convert cputime <-> nanoseconds
40 */
41#define nsecs_to_cputime(__nsecs) ((__force u64)(__nsecs))
42
43
44/*
45 * Convert cputime <-> microseconds
46 */
47#define cputime_to_usecs(__ct) \
48 ((__force u64)(__ct) / NSEC_PER_USEC)
49#define usecs_to_cputime(__usecs) \
50 (__force cputime_t)((__usecs) * NSEC_PER_USEC)
51#define usecs_to_cputime64(__usecs) \
52 (__force cputime64_t)((__usecs) * NSEC_PER_USEC)
53
54/*
55 * Convert cputime <-> seconds
56 */
57#define cputime_to_secs(__ct) \
58 ((__force u64)(__ct) / NSEC_PER_SEC)
59#define secs_to_cputime(__secs) \
60 (__force cputime_t)((__secs) * NSEC_PER_SEC)
61
62/*
63 * Convert cputime <-> timespec (nsec)
64 */
65static inline cputime_t timespec_to_cputime(const struct timespec *val)
66{
67 u64 ret = val->tv_sec * NSEC_PER_SEC + val->tv_nsec;
68 return (__force cputime_t) ret;
69}
70static inline void cputime_to_timespec(const cputime_t ct, struct timespec *val)
71{
72 val->tv_sec = (__force u64) ct / NSEC_PER_SEC;
73 val->tv_nsec = (__force u64) ct % NSEC_PER_SEC;
74}
75
76/*
77 * Convert cputime <-> timeval (msec)
78 */
79static inline cputime_t timeval_to_cputime(const struct timeval *val)
80{
81 u64 ret = val->tv_sec * NSEC_PER_SEC + val->tv_usec * NSEC_PER_USEC;
82 return (__force cputime_t) ret;
83}
84static inline void cputime_to_timeval(const cputime_t ct, struct timeval *val)
85{
86 val->tv_sec = (__force u64) ct / NSEC_PER_SEC;
87 val->tv_usec = ((__force u64) ct % NSEC_PER_SEC) / NSEC_PER_USEC;
88}
89
90/*
91 * Convert cputime <-> clock (USER_HZ)
92 */
93#define cputime_to_clock_t(__ct) \
94 ((__force u64)(__ct) / (NSEC_PER_SEC / USER_HZ))
95#define clock_t_to_cputime(__x) \
96 (__force cputime_t)((__x) * (NSEC_PER_SEC / USER_HZ))
97
98/*
99 * Convert cputime64 to clock.
100 */
101#define cputime64_to_clock_t(__ct) \
102 cputime_to_clock_t((__force cputime_t)__ct)
103
104#endif
diff --git a/include/asm-generic/gpio.h b/include/asm-generic/gpio.h
index 20ca7663975f..bde646995d10 100644
--- a/include/asm-generic/gpio.h
+++ b/include/asm-generic/gpio.h
@@ -47,12 +47,14 @@ struct gpio;
47struct seq_file; 47struct seq_file;
48struct module; 48struct module;
49struct device_node; 49struct device_node;
50struct gpio_desc;
50 51
51/** 52/**
52 * struct gpio_chip - abstract a GPIO controller 53 * struct gpio_chip - abstract a GPIO controller
53 * @label: for diagnostics 54 * @label: for diagnostics
54 * @dev: optional device providing the GPIOs 55 * @dev: optional device providing the GPIOs
55 * @owner: helps prevent removal of modules exporting active GPIOs 56 * @owner: helps prevent removal of modules exporting active GPIOs
57 * @list: links gpio_chips together for traversal
56 * @request: optional hook for chip-specific activation, such as 58 * @request: optional hook for chip-specific activation, such as
57 * enabling module power and clock; may sleep 59 * enabling module power and clock; may sleep
58 * @free: optional hook for chip-specific deactivation, such as 60 * @free: optional hook for chip-specific deactivation, such as
@@ -75,6 +77,7 @@ struct device_node;
75 * negative during registration, requests dynamic ID allocation. 77 * negative during registration, requests dynamic ID allocation.
76 * @ngpio: the number of GPIOs handled by this controller; the last GPIO 78 * @ngpio: the number of GPIOs handled by this controller; the last GPIO
77 * handled is (base + ngpio - 1). 79 * handled is (base + ngpio - 1).
80 * @desc: array of ngpio descriptors. Private.
78 * @can_sleep: flag must be set iff get()/set() methods sleep, as they 81 * @can_sleep: flag must be set iff get()/set() methods sleep, as they
79 * must while accessing GPIO expander chips over I2C or SPI 82 * must while accessing GPIO expander chips over I2C or SPI
80 * @names: if set, must be an array of strings to use as alternative 83 * @names: if set, must be an array of strings to use as alternative
@@ -98,6 +101,7 @@ struct gpio_chip {
98 const char *label; 101 const char *label;
99 struct device *dev; 102 struct device *dev;
100 struct module *owner; 103 struct module *owner;
104 struct list_head list;
101 105
102 int (*request)(struct gpio_chip *chip, 106 int (*request)(struct gpio_chip *chip,
103 unsigned offset); 107 unsigned offset);
@@ -124,6 +128,7 @@ struct gpio_chip {
124 struct gpio_chip *chip); 128 struct gpio_chip *chip);
125 int base; 129 int base;
126 u16 ngpio; 130 u16 ngpio;
131 struct gpio_desc *desc;
127 const char *const *names; 132 const char *const *names;
128 unsigned can_sleep:1; 133 unsigned can_sleep:1;
129 unsigned exported:1; 134 unsigned exported:1;
@@ -152,7 +157,6 @@ struct gpio_chip {
152extern const char *gpiochip_is_requested(struct gpio_chip *chip, 157extern const char *gpiochip_is_requested(struct gpio_chip *chip,
153 unsigned offset); 158 unsigned offset);
154extern struct gpio_chip *gpio_to_chip(unsigned gpio); 159extern struct gpio_chip *gpio_to_chip(unsigned gpio);
155extern int __must_check gpiochip_reserve(int start, int ngpio);
156 160
157/* add/remove chips */ 161/* add/remove chips */
158extern int gpiochip_add(struct gpio_chip *chip); 162extern int gpiochip_add(struct gpio_chip *chip);
@@ -192,12 +196,6 @@ extern int gpio_request_one(unsigned gpio, unsigned long flags, const char *labe
192extern int gpio_request_array(const struct gpio *array, size_t num); 196extern int gpio_request_array(const struct gpio *array, size_t num);
193extern void gpio_free_array(const struct gpio *array, size_t num); 197extern void gpio_free_array(const struct gpio *array, size_t num);
194 198
195/* bindings for managed devices that want to request gpios */
196int devm_gpio_request(struct device *dev, unsigned gpio, const char *label);
197int devm_gpio_request_one(struct device *dev, unsigned gpio,
198 unsigned long flags, const char *label);
199void devm_gpio_free(struct device *dev, unsigned int gpio);
200
201#ifdef CONFIG_GPIO_SYSFS 199#ifdef CONFIG_GPIO_SYSFS
202 200
203/* 201/*
@@ -212,6 +210,43 @@ extern void gpio_unexport(unsigned gpio);
212 210
213#endif /* CONFIG_GPIO_SYSFS */ 211#endif /* CONFIG_GPIO_SYSFS */
214 212
213#ifdef CONFIG_PINCTRL
214
215/**
216 * struct gpio_pin_range - pin range controlled by a gpio chip
217 * @head: list for maintaining set of pin ranges, used internally
218 * @pctldev: pinctrl device which handles corresponding pins
219 * @range: actual range of pins controlled by a gpio controller
220 */
221
222struct gpio_pin_range {
223 struct list_head node;
224 struct pinctrl_dev *pctldev;
225 struct pinctrl_gpio_range range;
226};
227
228int gpiochip_add_pin_range(struct gpio_chip *chip, const char *pinctl_name,
229 unsigned int gpio_offset, unsigned int pin_offset,
230 unsigned int npins);
231void gpiochip_remove_pin_ranges(struct gpio_chip *chip);
232
233#else
234
235static inline int
236gpiochip_add_pin_range(struct gpio_chip *chip, const char *pinctl_name,
237 unsigned int gpio_offset, unsigned int pin_offset,
238 unsigned int npins)
239{
240 return 0;
241}
242
243static inline void
244gpiochip_remove_pin_ranges(struct gpio_chip *chip)
245{
246}
247
248#endif /* CONFIG_PINCTRL */
249
215#else /* !CONFIG_GPIOLIB */ 250#else /* !CONFIG_GPIOLIB */
216 251
217static inline bool gpio_is_valid(int number) 252static inline bool gpio_is_valid(int number)
@@ -270,41 +305,4 @@ static inline void gpio_unexport(unsigned gpio)
270} 305}
271#endif /* CONFIG_GPIO_SYSFS */ 306#endif /* CONFIG_GPIO_SYSFS */
272 307
273#ifdef CONFIG_PINCTRL
274
275/**
276 * struct gpio_pin_range - pin range controlled by a gpio chip
277 * @head: list for maintaining set of pin ranges, used internally
278 * @pctldev: pinctrl device which handles corresponding pins
279 * @range: actual range of pins controlled by a gpio controller
280 */
281
282struct gpio_pin_range {
283 struct list_head node;
284 struct pinctrl_dev *pctldev;
285 struct pinctrl_gpio_range range;
286};
287
288int gpiochip_add_pin_range(struct gpio_chip *chip, const char *pinctl_name,
289 unsigned int gpio_offset, unsigned int pin_offset,
290 unsigned int npins);
291void gpiochip_remove_pin_ranges(struct gpio_chip *chip);
292
293#else
294
295static inline int
296gpiochip_add_pin_range(struct gpio_chip *chip, const char *pinctl_name,
297 unsigned int gpio_offset, unsigned int pin_offset,
298 unsigned int npins)
299{
300 return 0;
301}
302
303static inline void
304gpiochip_remove_pin_ranges(struct gpio_chip *chip)
305{
306}
307
308#endif /* CONFIG_PINCTRL */
309
310#endif /* _ASM_GENERIC_GPIO_H */ 308#endif /* _ASM_GENERIC_GPIO_H */
diff --git a/include/asm-generic/io.h b/include/asm-generic/io.h
index cc76b3ecd206..ac9da00e9f2c 100644
--- a/include/asm-generic/io.h
+++ b/include/asm-generic/io.h
@@ -53,8 +53,18 @@ static inline u32 __raw_readl(const volatile void __iomem *addr)
53#endif 53#endif
54 54
55#define readb __raw_readb 55#define readb __raw_readb
56#define readw(addr) __le16_to_cpu(__raw_readw(addr)) 56
57#define readl(addr) __le32_to_cpu(__raw_readl(addr)) 57#define readw readw
58static inline u16 readw(const volatile void __iomem *addr)
59{
60 return __le16_to_cpu(__raw_readw(addr));
61}
62
63#define readl readl
64static inline u32 readl(const volatile void __iomem *addr)
65{
66 return __le32_to_cpu(__raw_readl(addr));
67}
58 68
59#ifndef __raw_writeb 69#ifndef __raw_writeb
60static inline void __raw_writeb(u8 b, volatile void __iomem *addr) 70static inline void __raw_writeb(u8 b, volatile void __iomem *addr)
@@ -89,7 +99,11 @@ static inline u64 __raw_readq(const volatile void __iomem *addr)
89} 99}
90#endif 100#endif
91 101
92#define readq(addr) __le64_to_cpu(__raw_readq(addr)) 102#define readq readq
103static inline u64 readq(const volatile void __iomem *addr)
104{
105 return __le64_to_cpu(__raw_readq(addr));
106}
93 107
94#ifndef __raw_writeq 108#ifndef __raw_writeq
95static inline void __raw_writeq(u64 b, volatile void __iomem *addr) 109static inline void __raw_writeq(u64 b, volatile void __iomem *addr)
@@ -225,15 +239,15 @@ static inline void outsl(unsigned long addr, const void *buffer, int count)
225#ifndef CONFIG_GENERIC_IOMAP 239#ifndef CONFIG_GENERIC_IOMAP
226#define ioread8(addr) readb(addr) 240#define ioread8(addr) readb(addr)
227#define ioread16(addr) readw(addr) 241#define ioread16(addr) readw(addr)
228#define ioread16be(addr) be16_to_cpu(ioread16(addr)) 242#define ioread16be(addr) __be16_to_cpu(__raw_readw(addr))
229#define ioread32(addr) readl(addr) 243#define ioread32(addr) readl(addr)
230#define ioread32be(addr) be32_to_cpu(ioread32(addr)) 244#define ioread32be(addr) __be32_to_cpu(__raw_readl(addr))
231 245
232#define iowrite8(v, addr) writeb((v), (addr)) 246#define iowrite8(v, addr) writeb((v), (addr))
233#define iowrite16(v, addr) writew((v), (addr)) 247#define iowrite16(v, addr) writew((v), (addr))
234#define iowrite16be(v, addr) iowrite16(be16_to_cpu(v), (addr)) 248#define iowrite16be(v, addr) __raw_writew(__cpu_to_be16(v), addr)
235#define iowrite32(v, addr) writel((v), (addr)) 249#define iowrite32(v, addr) writel((v), (addr))
236#define iowrite32be(v, addr) iowrite32(be32_to_cpu(v), (addr)) 250#define iowrite32be(v, addr) __raw_writel(__cpu_to_be32(v), addr)
237 251
238#define ioread8_rep(p, dst, count) \ 252#define ioread8_rep(p, dst, count) \
239 insb((unsigned long) (p), (dst), (count)) 253 insb((unsigned long) (p), (dst), (count))
diff --git a/include/asm-generic/pgtable.h b/include/asm-generic/pgtable.h
index 5cf680a98f9b..bfd87685fc1f 100644
--- a/include/asm-generic/pgtable.h
+++ b/include/asm-generic/pgtable.h
@@ -197,16 +197,6 @@ static inline int pmd_same(pmd_t pmd_a, pmd_t pmd_b)
197#endif /* CONFIG_TRANSPARENT_HUGEPAGE */ 197#endif /* CONFIG_TRANSPARENT_HUGEPAGE */
198#endif 198#endif
199 199
200#ifndef __HAVE_ARCH_PAGE_TEST_AND_CLEAR_DIRTY
201#define page_test_and_clear_dirty(pfn, mapped) (0)
202#endif
203
204#ifndef __HAVE_ARCH_PAGE_TEST_AND_CLEAR_DIRTY
205#define pte_maybe_dirty(pte) pte_dirty(pte)
206#else
207#define pte_maybe_dirty(pte) (1)
208#endif
209
210#ifndef __HAVE_ARCH_PAGE_TEST_AND_CLEAR_YOUNG 200#ifndef __HAVE_ARCH_PAGE_TEST_AND_CLEAR_YOUNG
211#define page_test_and_clear_young(pfn) (0) 201#define page_test_and_clear_young(pfn) (0)
212#endif 202#endif
diff --git a/include/asm-generic/syscalls.h b/include/asm-generic/syscalls.h
index 1db51b8524e9..1f74be5113b2 100644
--- a/include/asm-generic/syscalls.h
+++ b/include/asm-generic/syscalls.h
@@ -21,24 +21,8 @@ asmlinkage long sys_mmap(unsigned long addr, unsigned long len,
21 unsigned long fd, off_t pgoff); 21 unsigned long fd, off_t pgoff);
22#endif 22#endif
23 23
24#ifndef CONFIG_GENERIC_SIGALTSTACK
25#ifndef sys_sigaltstack
26asmlinkage long sys_sigaltstack(const stack_t __user *, stack_t __user *,
27 struct pt_regs *);
28#endif
29#endif
30
31#ifndef sys_rt_sigreturn 24#ifndef sys_rt_sigreturn
32asmlinkage long sys_rt_sigreturn(struct pt_regs *regs); 25asmlinkage long sys_rt_sigreturn(struct pt_regs *regs);
33#endif 26#endif
34 27
35#ifndef sys_rt_sigsuspend
36asmlinkage long sys_rt_sigsuspend(sigset_t __user *unewset, size_t sigsetsize);
37#endif
38
39#ifndef sys_rt_sigaction
40asmlinkage long sys_rt_sigaction(int sig, const struct sigaction __user *act,
41 struct sigaction __user *oact, size_t sigsetsize);
42#endif
43
44#endif /* __ASM_GENERIC_SYSCALLS_H */ 28#endif /* __ASM_GENERIC_SYSCALLS_H */
diff --git a/include/asm-generic/uaccess.h b/include/asm-generic/uaccess.h
index 9788568f7978..c184aa8ec8cd 100644
--- a/include/asm-generic/uaccess.h
+++ b/include/asm-generic/uaccess.h
@@ -7,7 +7,6 @@
7 * address space, e.g. all NOMMU machines. 7 * address space, e.g. all NOMMU machines.
8 */ 8 */
9#include <linux/sched.h> 9#include <linux/sched.h>
10#include <linux/mm.h>
11#include <linux/string.h> 10#include <linux/string.h>
12 11
13#include <asm/segment.h> 12#include <asm/segment.h>
@@ -32,7 +31,9 @@ static inline void set_fs(mm_segment_t fs)
32} 31}
33#endif 32#endif
34 33
34#ifndef segment_eq
35#define segment_eq(a, b) ((a).seg == (b).seg) 35#define segment_eq(a, b) ((a).seg == (b).seg)
36#endif
36 37
37#define VERIFY_READ 0 38#define VERIFY_READ 0
38#define VERIFY_WRITE 1 39#define VERIFY_WRITE 1
@@ -168,12 +169,18 @@ static inline __must_check long __copy_to_user(void __user *to,
168 -EFAULT; \ 169 -EFAULT; \
169}) 170})
170 171
172#ifndef __put_user_fn
173
171static inline int __put_user_fn(size_t size, void __user *ptr, void *x) 174static inline int __put_user_fn(size_t size, void __user *ptr, void *x)
172{ 175{
173 size = __copy_to_user(ptr, x, size); 176 size = __copy_to_user(ptr, x, size);
174 return size ? -EFAULT : size; 177 return size ? -EFAULT : size;
175} 178}
176 179
180#define __put_user_fn(sz, u, k) __put_user_fn(sz, u, k)
181
182#endif
183
177extern int __put_user_bad(void) __attribute__((noreturn)); 184extern int __put_user_bad(void) __attribute__((noreturn));
178 185
179#define __get_user(x, ptr) \ 186#define __get_user(x, ptr) \
@@ -224,12 +231,17 @@ extern int __put_user_bad(void) __attribute__((noreturn));
224 -EFAULT; \ 231 -EFAULT; \
225}) 232})
226 233
234#ifndef __get_user_fn
227static inline int __get_user_fn(size_t size, const void __user *ptr, void *x) 235static inline int __get_user_fn(size_t size, const void __user *ptr, void *x)
228{ 236{
229 size = __copy_from_user(x, ptr, size); 237 size = __copy_from_user(x, ptr, size);
230 return size ? -EFAULT : size; 238 return size ? -EFAULT : size;
231} 239}
232 240
241#define __get_user_fn(sz, u, k) __get_user_fn(sz, u, k)
242
243#endif
244
233extern int __get_user_bad(void) __attribute__((noreturn)); 245extern int __get_user_bad(void) __attribute__((noreturn));
234 246
235#ifndef __copy_from_user_inatomic 247#ifndef __copy_from_user_inatomic
diff --git a/include/asm-generic/unistd.h b/include/asm-generic/unistd.h
index abc925de8ecf..4077b5d9ff81 100644
--- a/include/asm-generic/unistd.h
+++ b/include/asm-generic/unistd.h
@@ -9,9 +9,6 @@
9#define __ARCH_WANT_STAT64 9#define __ARCH_WANT_STAT64
10#define __ARCH_WANT_SYS_LLSEEK 10#define __ARCH_WANT_SYS_LLSEEK
11#endif 11#endif
12#define __ARCH_WANT_SYS_RT_SIGACTION
13#define __ARCH_WANT_SYS_RT_SIGSUSPEND
14#define __ARCH_WANT_COMPAT_SYS_RT_SIGSUSPEND
15 12
16/* 13/*
17 * "Conditional" syscalls 14 * "Conditional" syscalls
diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h
index d1ea7ce0b4cb..afa12c7a025c 100644
--- a/include/asm-generic/vmlinux.lds.h
+++ b/include/asm-generic/vmlinux.lds.h
@@ -149,6 +149,33 @@
149#define TRACE_SYSCALLS() 149#define TRACE_SYSCALLS()
150#endif 150#endif
151 151
152#ifdef CONFIG_CLKSRC_OF
153#define CLKSRC_OF_TABLES() . = ALIGN(8); \
154 VMLINUX_SYMBOL(__clksrc_of_table) = .; \
155 *(__clksrc_of_table) \
156 *(__clksrc_of_table_end)
157#else
158#define CLKSRC_OF_TABLES()
159#endif
160
161#ifdef CONFIG_IRQCHIP
162#define IRQCHIP_OF_MATCH_TABLE() \
163 . = ALIGN(8); \
164 VMLINUX_SYMBOL(__irqchip_begin) = .; \
165 *(__irqchip_of_table) \
166 *(__irqchip_of_end)
167#else
168#define IRQCHIP_OF_MATCH_TABLE()
169#endif
170
171#ifdef CONFIG_COMMON_CLK
172#define CLK_OF_TABLES() . = ALIGN(8); \
173 VMLINUX_SYMBOL(__clk_of_table) = .; \
174 *(__clk_of_table) \
175 *(__clk_of_table_end)
176#else
177#define CLK_OF_TABLES()
178#endif
152 179
153#define KERNEL_DTB() \ 180#define KERNEL_DTB() \
154 STRUCT_ALIGN(); \ 181 STRUCT_ALIGN(); \
@@ -493,7 +520,10 @@
493 DEV_DISCARD(init.rodata) \ 520 DEV_DISCARD(init.rodata) \
494 CPU_DISCARD(init.rodata) \ 521 CPU_DISCARD(init.rodata) \
495 MEM_DISCARD(init.rodata) \ 522 MEM_DISCARD(init.rodata) \
496 KERNEL_DTB() 523 CLK_OF_TABLES() \
524 CLKSRC_OF_TABLES() \
525 KERNEL_DTB() \
526 IRQCHIP_OF_MATCH_TABLE()
497 527
498#define INIT_TEXT \ 528#define INIT_TEXT \
499 *(.init.text) \ 529 *(.init.text) \