Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

s390/qdio: replace shift loop by ilog2

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>

authored by

Fabian Frederick and committed by
Martin Schwidefsky
92bdae5d dbe33fc9

+3 -4
+3 -4
drivers/s390/cio/qdio_main.c
··· 409 409 set_buf_state(q, q->u.in.ack_start, SLSB_P_INPUT_NOT_INIT); 410 410 } 411 411 412 - static inline void account_sbals(struct qdio_q *q, int count) 412 + static inline void account_sbals(struct qdio_q *q, unsigned int count) 413 413 { 414 - int pos = 0; 414 + int pos; 415 415 416 416 q->q_stats.nr_sbal_total += count; 417 417 if (count == QDIO_MAX_BUFFERS_MASK) { 418 418 q->q_stats.nr_sbals[7]++; 419 419 return; 420 420 } 421 - while (count >>= 1) 422 - pos++; 421 + pos = ilog2(count); 423 422 q->q_stats.nr_sbals[pos]++; 424 423 } 425 424