Skip to content

Commit ce38061

Browse files
committed
Merge tag 'please-pull-ia64_misc' of git://git.kernel.org/pub/scm/linux/kernel/git/aegl/linux
Pull ia64 cleanups from Tony Luck: - More atomic cleanup from willy - Fix a python script to work with version 3 - Some other small cleanups * tag 'please-pull-ia64_misc' of git://git.kernel.org/pub/scm/linux/kernel/git/aegl/linux: ia64/err-inject: fix spelling mistake: "capapbilities" -> "capabilities" ia64/err-inject: Use get_user_pages_fast() ia64: doc: tweak whitespace for 'console=' parameter ia64: Convert remaining atomic operations ia64: convert unwcheck.py to python3
2 parents 094b58e + 48e362d commit ce38061

File tree

4 files changed

+34
-57
lines changed

4 files changed

+34
-57
lines changed

Documentation/ia64/serial.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ TROUBLESHOOTING SERIAL CONSOLE PROBLEMS
111111

112112
- If you don't have an HCDP, the kernel doesn't know where
113113
your console lives until the driver discovers serial
114-
devices. Use "console=uart, io,0x3f8" (or appropriate
114+
devices. Use "console=uart,io,0x3f8" (or appropriate
115115
address for your machine).
116116

117117
Kernel and init script output works fine, but no "login:" prompt:

arch/ia64/include/asm/atomic.h

Lines changed: 23 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -66,50 +66,43 @@ ATOMIC_OPS(add, +)
6666
ATOMIC_OPS(sub, -)
6767

6868
#ifdef __OPTIMIZE__
69-
#define __ia64_atomic_const(i) __builtin_constant_p(i) ? \
69+
#define __ia64_atomic_const(i) \
70+
static const int __ia64_atomic_p = __builtin_constant_p(i) ? \
7071
((i) == 1 || (i) == 4 || (i) == 8 || (i) == 16 || \
71-
(i) == -1 || (i) == -4 || (i) == -8 || (i) == -16) : 0
72+
(i) == -1 || (i) == -4 || (i) == -8 || (i) == -16) : 0;\
73+
__ia64_atomic_p
74+
#else
75+
#define __ia64_atomic_const(i) 0
76+
#endif
7277

73-
#define atomic_add_return(i, v) \
78+
#define atomic_add_return(i,v) \
7479
({ \
75-
int __i = (i); \
76-
static const int __ia64_atomic_p = __ia64_atomic_const(i); \
77-
__ia64_atomic_p ? ia64_fetch_and_add(__i, &(v)->counter) : \
78-
ia64_atomic_add(__i, v); \
80+
int __ia64_aar_i = (i); \
81+
__ia64_atomic_const(i) \
82+
? ia64_fetch_and_add(__ia64_aar_i, &(v)->counter) \
83+
: ia64_atomic_add(__ia64_aar_i, v); \
7984
})
8085

81-
#define atomic_sub_return(i, v) \
86+
#define atomic_sub_return(i,v) \
8287
({ \
83-
int __i = (i); \
84-
static const int __ia64_atomic_p = __ia64_atomic_const(i); \
85-
__ia64_atomic_p ? ia64_fetch_and_add(-__i, &(v)->counter) : \
86-
ia64_atomic_sub(__i, v); \
88+
int __ia64_asr_i = (i); \
89+
__ia64_atomic_const(i) \
90+
? ia64_fetch_and_add(-__ia64_asr_i, &(v)->counter) \
91+
: ia64_atomic_sub(__ia64_asr_i, v); \
8792
})
88-
#else
89-
#define atomic_add_return(i, v) ia64_atomic_add(i, v)
90-
#define atomic_sub_return(i, v) ia64_atomic_sub(i, v)
91-
#endif
9293

9394
#define atomic_fetch_add(i,v) \
9495
({ \
9596
int __ia64_aar_i = (i); \
96-
(__builtin_constant_p(i) \
97-
&& ( (__ia64_aar_i == 1) || (__ia64_aar_i == 4) \
98-
|| (__ia64_aar_i == 8) || (__ia64_aar_i == 16) \
99-
|| (__ia64_aar_i == -1) || (__ia64_aar_i == -4) \
100-
|| (__ia64_aar_i == -8) || (__ia64_aar_i == -16))) \
97+
__ia64_atomic_const(i) \
10198
? ia64_fetchadd(__ia64_aar_i, &(v)->counter, acq) \
10299
: ia64_atomic_fetch_add(__ia64_aar_i, v); \
103100
})
104101

105102
#define atomic_fetch_sub(i,v) \
106103
({ \
107104
int __ia64_asr_i = (i); \
108-
(__builtin_constant_p(i) \
109-
&& ( (__ia64_asr_i == 1) || (__ia64_asr_i == 4) \
110-
|| (__ia64_asr_i == 8) || (__ia64_asr_i == 16) \
111-
|| (__ia64_asr_i == -1) || (__ia64_asr_i == -4) \
112-
|| (__ia64_asr_i == -8) || (__ia64_asr_i == -16))) \
105+
__ia64_atomic_const(i) \
113106
? ia64_fetchadd(-__ia64_asr_i, &(v)->counter, acq) \
114107
: ia64_atomic_fetch_sub(__ia64_asr_i, v); \
115108
})
@@ -170,47 +163,31 @@ ATOMIC64_OPS(sub, -)
170163
#define atomic64_add_return(i,v) \
171164
({ \
172165
long __ia64_aar_i = (i); \
173-
(__builtin_constant_p(i) \
174-
&& ( (__ia64_aar_i == 1) || (__ia64_aar_i == 4) \
175-
|| (__ia64_aar_i == 8) || (__ia64_aar_i == 16) \
176-
|| (__ia64_aar_i == -1) || (__ia64_aar_i == -4) \
177-
|| (__ia64_aar_i == -8) || (__ia64_aar_i == -16))) \
166+
__ia64_atomic_const(i) \
178167
? ia64_fetch_and_add(__ia64_aar_i, &(v)->counter) \
179168
: ia64_atomic64_add(__ia64_aar_i, v); \
180169
})
181170

182171
#define atomic64_sub_return(i,v) \
183172
({ \
184173
long __ia64_asr_i = (i); \
185-
(__builtin_constant_p(i) \
186-
&& ( (__ia64_asr_i == 1) || (__ia64_asr_i == 4) \
187-
|| (__ia64_asr_i == 8) || (__ia64_asr_i == 16) \
188-
|| (__ia64_asr_i == -1) || (__ia64_asr_i == -4) \
189-
|| (__ia64_asr_i == -8) || (__ia64_asr_i == -16))) \
174+
__ia64_atomic_const(i) \
190175
? ia64_fetch_and_add(-__ia64_asr_i, &(v)->counter) \
191176
: ia64_atomic64_sub(__ia64_asr_i, v); \
192177
})
193178

194179
#define atomic64_fetch_add(i,v) \
195180
({ \
196181
long __ia64_aar_i = (i); \
197-
(__builtin_constant_p(i) \
198-
&& ( (__ia64_aar_i == 1) || (__ia64_aar_i == 4) \
199-
|| (__ia64_aar_i == 8) || (__ia64_aar_i == 16) \
200-
|| (__ia64_aar_i == -1) || (__ia64_aar_i == -4) \
201-
|| (__ia64_aar_i == -8) || (__ia64_aar_i == -16))) \
182+
__ia64_atomic_const(i) \
202183
? ia64_fetchadd(__ia64_aar_i, &(v)->counter, acq) \
203184
: ia64_atomic64_fetch_add(__ia64_aar_i, v); \
204185
})
205186

206187
#define atomic64_fetch_sub(i,v) \
207188
({ \
208189
long __ia64_asr_i = (i); \
209-
(__builtin_constant_p(i) \
210-
&& ( (__ia64_asr_i == 1) || (__ia64_asr_i == 4) \
211-
|| (__ia64_asr_i == 8) || (__ia64_asr_i == 16) \
212-
|| (__ia64_asr_i == -1) || (__ia64_asr_i == -4) \
213-
|| (__ia64_asr_i == -8) || (__ia64_asr_i == -16))) \
190+
__ia64_atomic_const(i) \
214191
? ia64_fetchadd(-__ia64_asr_i, &(v)->counter, acq) \
215192
: ia64_atomic64_fetch_sub(__ia64_asr_i, v); \
216193
})

arch/ia64/kernel/err_inject.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ store_call_start(struct device *dev, struct device_attribute *attr,
117117

118118
#ifdef ERR_INJ_DEBUG
119119
printk(KERN_DEBUG "Returns: status=%d,\n", (int)status[cpu]);
120-
printk(KERN_DEBUG "capapbilities=%lx,\n", capabilities[cpu]);
120+
printk(KERN_DEBUG "capabilities=%lx,\n", capabilities[cpu]);
121121
printk(KERN_DEBUG "resources=%lx\n", resources[cpu]);
122122
#endif
123123
return size;
@@ -142,7 +142,7 @@ store_virtual_to_phys(struct device *dev, struct device_attribute *attr,
142142
u64 virt_addr=simple_strtoull(buf, NULL, 16);
143143
int ret;
144144

145-
ret = get_user_pages(virt_addr, 1, FOLL_WRITE, NULL, NULL);
145+
ret = get_user_pages_fast(virt_addr, 1, FOLL_WRITE, NULL);
146146
if (ret<=0) {
147147
#ifdef ERR_INJ_DEBUG
148148
printk("Virtual address %lx is not existing.\n",virt_addr);

arch/ia64/scripts/unwcheck.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
import sys
1717

1818
if len(sys.argv) != 2:
19-
print "Usage: %s FILE" % sys.argv[0]
19+
print("Usage: %s FILE" % sys.argv[0])
2020
sys.exit(2)
2121

2222
readelf = os.getenv("READELF", "readelf")
@@ -29,7 +29,7 @@ def check_func (func, slots, rlen_sum):
2929
global num_errors
3030
num_errors += 1
3131
if not func: func = "[%#x-%#x]" % (start, end)
32-
print "ERROR: %s: %lu slots, total region length = %lu" % (func, slots, rlen_sum)
32+
print("ERROR: %s: %lu slots, total region length = %lu" % (func, slots, rlen_sum))
3333
return
3434

3535
num_funcs = 0
@@ -43,23 +43,23 @@ def check_func (func, slots, rlen_sum):
4343
check_func(func, slots, rlen_sum)
4444

4545
func = m.group(1)
46-
start = long(m.group(2), 16)
47-
end = long(m.group(3), 16)
46+
start = int(m.group(2), 16)
47+
end = int(m.group(3), 16)
4848
slots = 3 * (end - start) / 16
49-
rlen_sum = 0L
49+
rlen_sum = 0
5050
num_funcs += 1
5151
else:
5252
m = rlen_pattern.match(line)
5353
if m:
54-
rlen_sum += long(m.group(1))
54+
rlen_sum += int(m.group(1))
5555
check_func(func, slots, rlen_sum)
5656

5757
if num_errors == 0:
58-
print "No errors detected in %u functions." % num_funcs
58+
print("No errors detected in %u functions." % num_funcs)
5959
else:
6060
if num_errors > 1:
6161
err="errors"
6262
else:
6363
err="error"
64-
print "%u %s detected in %u functions." % (num_errors, err, num_funcs)
64+
print("%u %s detected in %u functions." % (num_errors, err, num_funcs))
6565
sys.exit(1)

0 commit comments

Comments
 (0)