Commit 152485bf authored by Julian Wiedmann's avatar Julian Wiedmann Committed by Martin Schwidefsky

s390/qdio: simplify math in get_*_buffer_frontier()

When determining the buffer count that get_buf_states() should
be queried for, 'count' is capped at 127 buffers.
So the check
	q->first_to_check == (q->first_to_check + count) % 128
can be reduced to
	count == 0

This helps to emphasize that get_buf_states() is really only
called with count > 0.
Signed-off-by: default avatarJulian Wiedmann <jwi@linux.vnet.ibm.com>
Reviewed-by: default avatarBenjamin Block <bblock@linux.vnet.ibm.com>
Signed-off-by: default avatarMartin Schwidefsky <schwidefsky@de.ibm.com>
parent bcbd41da
...@@ -502,8 +502,8 @@ static inline void inbound_primed(struct qdio_q *q, int count) ...@@ -502,8 +502,8 @@ static inline void inbound_primed(struct qdio_q *q, int count)
static int get_inbound_buffer_frontier(struct qdio_q *q) static int get_inbound_buffer_frontier(struct qdio_q *q)
{ {
int count, stop;
unsigned char state = 0; unsigned char state = 0;
int count;
q->timestamp = get_tod_clock_fast(); q->timestamp = get_tod_clock_fast();
...@@ -512,9 +512,7 @@ static int get_inbound_buffer_frontier(struct qdio_q *q) ...@@ -512,9 +512,7 @@ static int get_inbound_buffer_frontier(struct qdio_q *q)
* would return 0. * would return 0.
*/ */
count = min(atomic_read(&q->nr_buf_used), QDIO_MAX_BUFFERS_MASK); count = min(atomic_read(&q->nr_buf_used), QDIO_MAX_BUFFERS_MASK);
stop = add_buf(q->first_to_check, count); if (!count)
if (q->first_to_check == stop)
goto out; goto out;
/* /*
...@@ -734,8 +732,8 @@ void qdio_inbound_processing(unsigned long data) ...@@ -734,8 +732,8 @@ void qdio_inbound_processing(unsigned long data)
static int get_outbound_buffer_frontier(struct qdio_q *q) static int get_outbound_buffer_frontier(struct qdio_q *q)
{ {
int count, stop;
unsigned char state = 0; unsigned char state = 0;
int count;
q->timestamp = get_tod_clock_fast(); q->timestamp = get_tod_clock_fast();
...@@ -751,8 +749,7 @@ static int get_outbound_buffer_frontier(struct qdio_q *q) ...@@ -751,8 +749,7 @@ static int get_outbound_buffer_frontier(struct qdio_q *q)
* would return 0. * would return 0.
*/ */
count = min(atomic_read(&q->nr_buf_used), QDIO_MAX_BUFFERS_MASK); count = min(atomic_read(&q->nr_buf_used), QDIO_MAX_BUFFERS_MASK);
stop = add_buf(q->first_to_check, count); if (!count)
if (q->first_to_check == stop)
goto out; goto out;
count = get_buf_states(q, q->first_to_check, &state, count, 0, 1); count = get_buf_states(q, q->first_to_check, &state, count, 0, 1);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment