aboutsummaryrefslogtreecommitdiffstats
path: root/arch/s390/include
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2010-05-27 13:48:46 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2010-05-27 13:48:46 -0400
commitcc106eb35ed4abea675bce0d8fe40a46ff0b4a72 (patch)
tree7d18624a769680049f2933ce48a02c8e08e5937c /arch/s390/include
parent4e455c6782bd6bf6a0135c1e1c9f018ec191979e (diff)
parent3bfe68580a9d2a25465fc004986acd7991d700d1 (diff)
Merge branch 'for-linus' of git://git390.marist.edu/pub/scm/linux-2.6
* 'for-linus' of git://git390.marist.edu/pub/scm/linux-2.6: [S390] fill out file list in s390 MAINTAINERS entry [S390] Add support for LZO-compressed kernels. [S390] cmm: get rid of CMM_PROC config option [S390] cmm: remove superfluous EXPORT_SYMBOLs plus cleanups [S390] dasd: unit check handling during internal cio I/O [S390] cio: unit check handling during internal I/O [S390] ccwgroup: add locking around drvdata access [S390] cio: remove stsch [S390] spp: remove KVM_AWARE_CMF config option [S390] kprobes: forbid probing of stnsm/stosm/epsw [S390] spp: fix compilation for CONFIG_32BIT [S390] atomic: implement atomic64_dec_if_positive [S390] cmm: fix crash on module unload
Diffstat (limited to 'arch/s390/include')
-rw-r--r--arch/s390/include/asm/atomic.h19
-rw-r--r--arch/s390/include/asm/ccwdev.h10
2 files changed, 29 insertions, 0 deletions
diff --git a/arch/s390/include/asm/atomic.h b/arch/s390/include/asm/atomic.h
index 451bfbb9db3d..76daea117181 100644
--- a/arch/s390/include/asm/atomic.h
+++ b/arch/s390/include/asm/atomic.h
@@ -15,6 +15,7 @@
15 15
16#include <linux/compiler.h> 16#include <linux/compiler.h>
17#include <linux/types.h> 17#include <linux/types.h>
18#include <asm/system.h>
18 19
19#define ATOMIC_INIT(i) { (i) } 20#define ATOMIC_INIT(i) { (i) }
20 21
@@ -274,6 +275,7 @@ static inline void atomic64_clear_mask(unsigned long long mask, atomic64_t *v)
274static inline int atomic64_add_unless(atomic64_t *v, long long a, long long u) 275static inline int atomic64_add_unless(atomic64_t *v, long long a, long long u)
275{ 276{
276 long long c, old; 277 long long c, old;
278
277 c = atomic64_read(v); 279 c = atomic64_read(v);
278 for (;;) { 280 for (;;) {
279 if (unlikely(c == u)) 281 if (unlikely(c == u))
@@ -286,6 +288,23 @@ static inline int atomic64_add_unless(atomic64_t *v, long long a, long long u)
286 return c != u; 288 return c != u;
287} 289}
288 290
291static inline long long atomic64_dec_if_positive(atomic64_t *v)
292{
293 long long c, old, dec;
294
295 c = atomic64_read(v);
296 for (;;) {
297 dec = c - 1;
298 if (unlikely(dec < 0))
299 break;
300 old = atomic64_cmpxchg((v), c, dec);
301 if (likely(old == c))
302 break;
303 c = old;
304 }
305 return dec;
306}
307
289#define atomic64_add(_i, _v) atomic64_add_return(_i, _v) 308#define atomic64_add(_i, _v) atomic64_add_return(_i, _v)
290#define atomic64_add_negative(_i, _v) (atomic64_add_return(_i, _v) < 0) 309#define atomic64_add_negative(_i, _v) (atomic64_add_return(_i, _v) < 0)
291#define atomic64_inc(_v) atomic64_add_return(1, _v) 310#define atomic64_inc(_v) atomic64_add_return(1, _v)
diff --git a/arch/s390/include/asm/ccwdev.h b/arch/s390/include/asm/ccwdev.h
index f4bd346a52d3..1c0030f9b890 100644
--- a/arch/s390/include/asm/ccwdev.h
+++ b/arch/s390/include/asm/ccwdev.h
@@ -91,6 +91,14 @@ struct ccw_device {
91 void (*handler) (struct ccw_device *, unsigned long, struct irb *); 91 void (*handler) (struct ccw_device *, unsigned long, struct irb *);
92}; 92};
93 93
94/*
95 * Possible CIO actions triggered by the unit check handler.
96 */
97enum uc_todo {
98 UC_TODO_RETRY,
99 UC_TODO_RETRY_ON_NEW_PATH,
100 UC_TODO_STOP
101};
94 102
95/** 103/**
96 * struct ccw driver - device driver for channel attached devices 104 * struct ccw driver - device driver for channel attached devices
@@ -107,6 +115,7 @@ struct ccw_device {
107 * @freeze: callback for freezing during hibernation snapshotting 115 * @freeze: callback for freezing during hibernation snapshotting
108 * @thaw: undo work done in @freeze 116 * @thaw: undo work done in @freeze
109 * @restore: callback for restoring after hibernation 117 * @restore: callback for restoring after hibernation
118 * @uc_handler: callback for unit check handler
110 * @driver: embedded device driver structure 119 * @driver: embedded device driver structure
111 * @name: device driver name 120 * @name: device driver name
112 */ 121 */
@@ -124,6 +133,7 @@ struct ccw_driver {
124 int (*freeze)(struct ccw_device *); 133 int (*freeze)(struct ccw_device *);
125 int (*thaw) (struct ccw_device *); 134 int (*thaw) (struct ccw_device *);
126 int (*restore)(struct ccw_device *); 135 int (*restore)(struct ccw_device *);
136 enum uc_todo (*uc_handler) (struct ccw_device *, struct irb *);
127 struct device_driver driver; 137 struct device_driver driver;
128 char *name; 138 char *name;
129}; 139};