diff options
author | Martin Schwidefsky <schwidefsky@de.ibm.com> | 2006-01-06 03:19:07 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-01-06 11:33:48 -0500 |
commit | 973bd9937569146de0917f54f05b2942f8257912 (patch) | |
tree | 86dd796de5bf456eca904b350c9515f4795122bb /drivers/s390/cio | |
parent | 8d93c700a489eba08514222df414a23852a85d2b (diff) |
[PATCH] s390: atomic primitives
Hugh Dickins <hugh@veritas.com>
Fix the broken atomic_cmpxchg primitive. Add atomic_sub_and_test,
atomic64_sub_return, atomic64_sub_and_test, atomic64_cmpxchg,
atomic64_add_unless and atomic64_inc_not_zero. Replace old style
atomic_compare_and_swap by atomic_cmpxchg. Shorten the whole header by
defining most primitives with the two inline functions atomic_add_return and
atomic_sub_return.
In addition this patch contains the s390 related fixes of Hugh's "mm: fill
arch atomic64 gaps" patch.
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Signed-off-by: Hugh Dickins <hugh@veritas.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers/s390/cio')
-rw-r--r-- | drivers/s390/cio/ccwgroup.c | 6 | ||||
-rw-r--r-- | drivers/s390/cio/device.c | 4 |
2 files changed, 5 insertions, 5 deletions
diff --git a/drivers/s390/cio/ccwgroup.c b/drivers/s390/cio/ccwgroup.c index be9d2d65c22f..e849289d4f3c 100644 --- a/drivers/s390/cio/ccwgroup.c +++ b/drivers/s390/cio/ccwgroup.c | |||
@@ -1,7 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * drivers/s390/cio/ccwgroup.c | 2 | * drivers/s390/cio/ccwgroup.c |
3 | * bus driver for ccwgroup | 3 | * bus driver for ccwgroup |
4 | * $Revision: 1.32 $ | 4 | * $Revision: 1.33 $ |
5 | * | 5 | * |
6 | * Copyright (C) 2002 IBM Deutschland Entwicklung GmbH, | 6 | * Copyright (C) 2002 IBM Deutschland Entwicklung GmbH, |
7 | * IBM Corporation | 7 | * IBM Corporation |
@@ -263,7 +263,7 @@ ccwgroup_set_online(struct ccwgroup_device *gdev) | |||
263 | struct ccwgroup_driver *gdrv; | 263 | struct ccwgroup_driver *gdrv; |
264 | int ret; | 264 | int ret; |
265 | 265 | ||
266 | if (atomic_compare_and_swap(0, 1, &gdev->onoff)) | 266 | if (atomic_cmpxchg(&gdev->onoff, 0, 1) != 0) |
267 | return -EAGAIN; | 267 | return -EAGAIN; |
268 | if (gdev->state == CCWGROUP_ONLINE) { | 268 | if (gdev->state == CCWGROUP_ONLINE) { |
269 | ret = 0; | 269 | ret = 0; |
@@ -289,7 +289,7 @@ ccwgroup_set_offline(struct ccwgroup_device *gdev) | |||
289 | struct ccwgroup_driver *gdrv; | 289 | struct ccwgroup_driver *gdrv; |
290 | int ret; | 290 | int ret; |
291 | 291 | ||
292 | if (atomic_compare_and_swap(0, 1, &gdev->onoff)) | 292 | if (atomic_cmpxchg(&gdev->onoff, 0, 1) != 0) |
293 | return -EAGAIN; | 293 | return -EAGAIN; |
294 | if (gdev->state == CCWGROUP_OFFLINE) { | 294 | if (gdev->state == CCWGROUP_OFFLINE) { |
295 | ret = 0; | 295 | ret = 0; |
diff --git a/drivers/s390/cio/device.c b/drivers/s390/cio/device.c index 85908cacc3b8..0590cffe62aa 100644 --- a/drivers/s390/cio/device.c +++ b/drivers/s390/cio/device.c | |||
@@ -1,7 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * drivers/s390/cio/device.c | 2 | * drivers/s390/cio/device.c |
3 | * bus driver for ccw devices | 3 | * bus driver for ccw devices |
4 | * $Revision: 1.131 $ | 4 | * $Revision: 1.137 $ |
5 | * | 5 | * |
6 | * Copyright (C) 2002 IBM Deutschland Entwicklung GmbH, | 6 | * Copyright (C) 2002 IBM Deutschland Entwicklung GmbH, |
7 | * IBM Corporation | 7 | * IBM Corporation |
@@ -374,7 +374,7 @@ online_store (struct device *dev, struct device_attribute *attr, const char *buf | |||
374 | int i, force, ret; | 374 | int i, force, ret; |
375 | char *tmp; | 375 | char *tmp; |
376 | 376 | ||
377 | if (atomic_compare_and_swap(0, 1, &cdev->private->onoff)) | 377 | if (atomic_cmpxchg(&cdev->private->onoff, 0, 1) != 0) |
378 | return -EAGAIN; | 378 | return -EAGAIN; |
379 | 379 | ||
380 | if (cdev->drv && !try_module_get(cdev->drv->owner)) { | 380 | if (cdev->drv && !try_module_get(cdev->drv->owner)) { |