lkml.org 
[lkml]   [2014]   [May]   [20]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH 1/1] drivers/s390/cio/qdio_main.c: replace shift loop by ilog2
From
Date
On Tue, 2014-05-20 at 18:37 +0200, Fabian Frederick wrote:
> This is untested.
[]
> diff --git a/drivers/s390/cio/qdio_main.c b/drivers/s390/cio/qdio_main.c
[]
> @@ -411,15 +411,14 @@ static inline void qdio_stop_polling(struct qdio_q *q)
>
> static inline void account_sbals(struct qdio_q *q, 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);

What guarantees count > 0 here?

count may be better unsigned.



\
 
 \ /
  Last update: 2014-05-20 19:41    [W:0.057 / U:0.256 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site