The Linux Kernel Mailing List
 help / color / mirror / Atom feed
* [PATCH V2 2/2] drivers/s390/cio/qdio_main.c: replace shift loop by ilog2
@ 2014-06-03 19:55 Fabian Frederick
  2014-06-04 14:21 ` Sebastian Ott
  0 siblings, 1 reply; 2+ messages in thread
From: Fabian Frederick @ 2014-06-03 19:55 UTC (permalink / raw)
  To: linux-kernel; +Cc: Fabian Frederick, Sebastian Ott, Joe Perches, Andrew Morton

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: Sebastian Ott <sebott@linux.vnet.ibm.com>
Cc: Joe Perches <joe@perches.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Fabian Frederick <fabf@skynet.be>
---
 drivers/s390/cio/qdio_main.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/s390/cio/qdio_main.c b/drivers/s390/cio/qdio_main.c
index 9fda160..2eee7f1 100644
--- a/drivers/s390/cio/qdio_main.c
+++ b/drivers/s390/cio/qdio_main.c
@@ -413,15 +413,14 @@ static inline void qdio_stop_polling(struct qdio_q *q)
 
 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]++;
 }
 
-- 
1.8.4.5


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH V2 2/2] drivers/s390/cio/qdio_main.c: replace shift loop by ilog2
  2014-06-03 19:55 [PATCH V2 2/2] drivers/s390/cio/qdio_main.c: replace shift loop by ilog2 Fabian Frederick
@ 2014-06-04 14:21 ` Sebastian Ott
  0 siblings, 0 replies; 2+ messages in thread
From: Sebastian Ott @ 2014-06-04 14:21 UTC (permalink / raw)
  To: Fabian Frederick; +Cc: linux-kernel, Joe Perches, Andrew Morton

On Tue, 3 Jun 2014, Fabian Frederick wrote:
> 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: Sebastian Ott <sebott@linux.vnet.ibm.com>
> Cc: Joe Perches <joe@perches.com>
> Cc: Andrew Morton <akpm@linux-foundation.org>
> Signed-off-by: Fabian Frederick <fabf@skynet.be>
> ---
>  drivers/s390/cio/qdio_main.c | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/s390/cio/qdio_main.c b/drivers/s390/cio/qdio_main.c
> index 9fda160..2eee7f1 100644
> --- a/drivers/s390/cio/qdio_main.c
> +++ b/drivers/s390/cio/qdio_main.c
> @@ -413,15 +413,14 @@ static inline void qdio_stop_polling(struct qdio_q *q)
> 
>  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]++;
>  }
> 
> -- 
> 1.8.4.5
> 
> 

Thanks, applied.
Sebastian


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-06-04 14:21 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-06-03 19:55 [PATCH V2 2/2] drivers/s390/cio/qdio_main.c: replace shift loop by ilog2 Fabian Frederick
2014-06-04 14:21 ` Sebastian Ott

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox