]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
s390/qdio: simplify math in get_*_buffer_frontier()
authorJulian Wiedmann <jwi@linux.vnet.ibm.com>
Wed, 6 Dec 2017 07:53:33 +0000 (08:53 +0100)
committerMartin Schwidefsky <schwidefsky@de.ibm.com>
Mon, 26 Mar 2018 14:12:25 +0000 (16:12 +0200)
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: Julian Wiedmann <jwi@linux.vnet.ibm.com>
Reviewed-by: Benjamin Block <bblock@linux.vnet.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
drivers/s390/cio/qdio_main.c

index d5b02de02a3af31d55fcef8086c5bad2de98a178..6b340e6e29ace335ebea13c77a6a17372924350b 100644 (file)
@@ -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)
 {
-       int count, stop;
        unsigned char state = 0;
+       int count;
 
        q->timestamp = get_tod_clock_fast();
 
@@ -512,9 +512,7 @@ static int get_inbound_buffer_frontier(struct qdio_q *q)
         * would return 0.
         */
        count = min(atomic_read(&q->nr_buf_used), QDIO_MAX_BUFFERS_MASK);
-       stop = add_buf(q->first_to_check, count);
-
-       if (q->first_to_check == stop)
+       if (!count)
                goto out;
 
        /*
@@ -734,8 +732,8 @@ void qdio_inbound_processing(unsigned long data)
 
 static int get_outbound_buffer_frontier(struct qdio_q *q)
 {
-       int count, stop;
        unsigned char state = 0;
+       int count;
 
        q->timestamp = get_tod_clock_fast();
 
@@ -751,8 +749,7 @@ static int get_outbound_buffer_frontier(struct qdio_q *q)
         * would return 0.
         */
        count = min(atomic_read(&q->nr_buf_used), QDIO_MAX_BUFFERS_MASK);
-       stop = add_buf(q->first_to_check, count);
-       if (q->first_to_check == stop)
+       if (!count)
                goto out;
 
        count = get_buf_states(q, q->first_to_check, &state, count, 0, 1);