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/net/qeth_main.c | |
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/net/qeth_main.c')
-rw-r--r-- | drivers/s390/net/qeth_main.c | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/drivers/s390/net/qeth_main.c b/drivers/s390/net/qeth_main.c index f8f55cc468ba..7b2663f27817 100644 --- a/drivers/s390/net/qeth_main.c +++ b/drivers/s390/net/qeth_main.c | |||
@@ -1396,7 +1396,7 @@ qeth_idx_activate_get_answer(struct qeth_channel *channel, | |||
1396 | channel->ccw.cda = (__u32) __pa(iob->data); | 1396 | channel->ccw.cda = (__u32) __pa(iob->data); |
1397 | 1397 | ||
1398 | wait_event(card->wait_q, | 1398 | wait_event(card->wait_q, |
1399 | atomic_compare_and_swap(0,1,&channel->irq_pending) == 0); | 1399 | atomic_cmpxchg(&channel->irq_pending, 0, 1) == 0); |
1400 | QETH_DBF_TEXT(setup, 6, "noirqpnd"); | 1400 | QETH_DBF_TEXT(setup, 6, "noirqpnd"); |
1401 | spin_lock_irqsave(get_ccwdev_lock(channel->ccwdev), flags); | 1401 | spin_lock_irqsave(get_ccwdev_lock(channel->ccwdev), flags); |
1402 | rc = ccw_device_start(channel->ccwdev, | 1402 | rc = ccw_device_start(channel->ccwdev, |
@@ -1463,7 +1463,7 @@ qeth_idx_activate_channel(struct qeth_channel *channel, | |||
1463 | memcpy(QETH_IDX_ACT_QDIO_DEV_REALADDR(iob->data), &temp, 2); | 1463 | memcpy(QETH_IDX_ACT_QDIO_DEV_REALADDR(iob->data), &temp, 2); |
1464 | 1464 | ||
1465 | wait_event(card->wait_q, | 1465 | wait_event(card->wait_q, |
1466 | atomic_compare_and_swap(0,1,&channel->irq_pending) == 0); | 1466 | atomic_cmpxchg(&channel->irq_pending, 0, 1) == 0); |
1467 | QETH_DBF_TEXT(setup, 6, "noirqpnd"); | 1467 | QETH_DBF_TEXT(setup, 6, "noirqpnd"); |
1468 | spin_lock_irqsave(get_ccwdev_lock(channel->ccwdev), flags); | 1468 | spin_lock_irqsave(get_ccwdev_lock(channel->ccwdev), flags); |
1469 | rc = ccw_device_start(channel->ccwdev, | 1469 | rc = ccw_device_start(channel->ccwdev, |
@@ -1616,7 +1616,7 @@ qeth_issue_next_read(struct qeth_card *card) | |||
1616 | } | 1616 | } |
1617 | qeth_setup_ccw(&card->read, iob->data, QETH_BUFSIZE); | 1617 | qeth_setup_ccw(&card->read, iob->data, QETH_BUFSIZE); |
1618 | wait_event(card->wait_q, | 1618 | wait_event(card->wait_q, |
1619 | atomic_compare_and_swap(0,1,&card->read.irq_pending) == 0); | 1619 | atomic_cmpxchg(&card->read.irq_pending, 0, 1) == 0); |
1620 | QETH_DBF_TEXT(trace, 6, "noirqpnd"); | 1620 | QETH_DBF_TEXT(trace, 6, "noirqpnd"); |
1621 | rc = ccw_device_start(card->read.ccwdev, &card->read.ccw, | 1621 | rc = ccw_device_start(card->read.ccwdev, &card->read.ccw, |
1622 | (addr_t) iob, 0, 0); | 1622 | (addr_t) iob, 0, 0); |
@@ -1882,7 +1882,7 @@ qeth_send_control_data(struct qeth_card *card, int len, | |||
1882 | spin_unlock_irqrestore(&card->lock, flags); | 1882 | spin_unlock_irqrestore(&card->lock, flags); |
1883 | QETH_DBF_HEX(control, 2, iob->data, QETH_DBF_CONTROL_LEN); | 1883 | QETH_DBF_HEX(control, 2, iob->data, QETH_DBF_CONTROL_LEN); |
1884 | wait_event(card->wait_q, | 1884 | wait_event(card->wait_q, |
1885 | atomic_compare_and_swap(0,1,&card->write.irq_pending) == 0); | 1885 | atomic_cmpxchg(&card->write.irq_pending, 0, 1) == 0); |
1886 | qeth_prepare_control_data(card, len, iob); | 1886 | qeth_prepare_control_data(card, len, iob); |
1887 | if (IS_IPA(iob->data)) | 1887 | if (IS_IPA(iob->data)) |
1888 | timer.expires = jiffies + QETH_IPA_TIMEOUT; | 1888 | timer.expires = jiffies + QETH_IPA_TIMEOUT; |
@@ -1924,7 +1924,7 @@ qeth_osn_send_control_data(struct qeth_card *card, int len, | |||
1924 | QETH_DBF_TEXT(trace, 5, "osndctrd"); | 1924 | QETH_DBF_TEXT(trace, 5, "osndctrd"); |
1925 | 1925 | ||
1926 | wait_event(card->wait_q, | 1926 | wait_event(card->wait_q, |
1927 | atomic_compare_and_swap(0,1,&card->write.irq_pending) == 0); | 1927 | atomic_cmpxchg(&card->write.irq_pending, 0, 1) == 0); |
1928 | qeth_prepare_control_data(card, len, iob); | 1928 | qeth_prepare_control_data(card, len, iob); |
1929 | QETH_DBF_TEXT(trace, 6, "osnoirqp"); | 1929 | QETH_DBF_TEXT(trace, 6, "osnoirqp"); |
1930 | spin_lock_irqsave(get_ccwdev_lock(card->write.ccwdev), flags); | 1930 | spin_lock_irqsave(get_ccwdev_lock(card->write.ccwdev), flags); |
@@ -4236,9 +4236,8 @@ qeth_do_send_packet_fast(struct qeth_card *card, struct qeth_qdio_out_q *queue, | |||
4236 | QETH_DBF_TEXT(trace, 6, "dosndpfa"); | 4236 | QETH_DBF_TEXT(trace, 6, "dosndpfa"); |
4237 | 4237 | ||
4238 | /* spin until we get the queue ... */ | 4238 | /* spin until we get the queue ... */ |
4239 | while (atomic_compare_and_swap(QETH_OUT_Q_UNLOCKED, | 4239 | while (atomic_cmpxchg(&queue->state, QETH_OUT_Q_UNLOCKED, |
4240 | QETH_OUT_Q_LOCKED, | 4240 | QETH_OUT_Q_LOCKED) != QETH_OUT_Q_UNLOCKED); |
4241 | &queue->state)); | ||
4242 | /* ... now we've got the queue */ | 4241 | /* ... now we've got the queue */ |
4243 | index = queue->next_buf_to_fill; | 4242 | index = queue->next_buf_to_fill; |
4244 | buffer = &queue->bufs[queue->next_buf_to_fill]; | 4243 | buffer = &queue->bufs[queue->next_buf_to_fill]; |
@@ -4292,9 +4291,8 @@ qeth_do_send_packet(struct qeth_card *card, struct qeth_qdio_out_q *queue, | |||
4292 | QETH_DBF_TEXT(trace, 6, "dosndpkt"); | 4291 | QETH_DBF_TEXT(trace, 6, "dosndpkt"); |
4293 | 4292 | ||
4294 | /* spin until we get the queue ... */ | 4293 | /* spin until we get the queue ... */ |
4295 | while (atomic_compare_and_swap(QETH_OUT_Q_UNLOCKED, | 4294 | while (atomic_cmpxchg(&queue->state, QETH_OUT_Q_UNLOCKED, |
4296 | QETH_OUT_Q_LOCKED, | 4295 | QETH_OUT_Q_LOCKED) != QETH_OUT_Q_UNLOCKED); |
4297 | &queue->state)); | ||
4298 | start_index = queue->next_buf_to_fill; | 4296 | start_index = queue->next_buf_to_fill; |
4299 | buffer = &queue->bufs[queue->next_buf_to_fill]; | 4297 | buffer = &queue->bufs[queue->next_buf_to_fill]; |
4300 | /* | 4298 | /* |