s390/qdio: replace shift loop by ilog2
authorFabian Frederick <fabf@skynet.be>
Tue, 3 Jun 2014 19:55:15 +0000 (21:55 +0200)
committerMartin Schwidefsky <schwidefsky@de.ibm.com>
Tue, 10 Jun 2014 08:48:28 +0000 (10:48 +0200)
account_sbals is called by get_inbound_buffer_frontier and
get_outbound_buffer_frontier with 'count' value > 0 so we can safely
convert shift loop to ilog2.

Cc: Joe Perches <joe@perches.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Fabian Frederick <fabf@skynet.be>
Signed-off-by: Sebastian Ott <sebott@linux.vnet.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
drivers/s390/cio/qdio_main.c

index 77466c4faabb67b96851fa22c8674d3f6cc4a4a0..f5f42c4314096167742762d62ad58cf0fcae5d2a 100644 (file)
@@ -409,17 +409,16 @@ static inline void qdio_stop_polling(struct qdio_q *q)
                set_buf_state(q, q->u.in.ack_start, SLSB_P_INPUT_NOT_INIT);
 }
 
-static inline void account_sbals(struct qdio_q *q, int count)
+static inline void account_sbals(struct qdio_q *q, unsigned int count)
 {
-       int pos = 0;
+       int pos;
 
        q->q_stats.nr_sbal_total += count;
        if (count == QDIO_MAX_BUFFERS_MASK) {
                q->q_stats.nr_sbals[7]++;
                return;
        }
-       while (count >>= 1)
-               pos++;
+       pos = ilog2(count);
        q->q_stats.nr_sbals[pos]++;
 }