From patchwork Fri Nov 9 12:10:41 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Akinobu Mita X-Patchwork-Id: 1726491 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by patchwork2.kernel.org (Postfix) with ESMTP id 1B52FDFE80 for ; Mon, 12 Nov 2012 08:01:53 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 0DDA09E962 for ; Mon, 12 Nov 2012 00:01:53 -0800 (PST) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-pb0-f49.google.com (mail-pb0-f49.google.com [209.85.160.49]) by gabe.freedesktop.org (Postfix) with ESMTP id 6E1619E778 for ; Fri, 9 Nov 2012 04:11:13 -0800 (PST) Received: by mail-pb0-f49.google.com with SMTP id xa7so2598364pbc.36 for ; Fri, 09 Nov 2012 04:11:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer; bh=Dm46JF2h7Pioqvf1eSiflqDAvVoS6KhTyw5IQ1+JE1k=; b=hCd+h7PXQY7XIReyQIbRP0ZQ/V5pVf1Ep0ueo17j/LWFeHmnLOjNV2Fvtt6HieEaWT EOWy36ACaxuio+EYKcVPIM9LKbp/WVXhFQHBwJZ49mMmIcttihRCOAXvQwD76JUnr9ok w7UePVn6BBovspEnbWUNklNxhjLONmb8DxEEVwam86i9aKlUzbHo59oYAwVu8YlI37HQ vLtOn3iXyQyuhG6YPXmmtqBygBoQRX2HLoB3X/j8ni7jodBmtBeTBoif/gM+4/yT1zH5 +MBOwDCtA4W4WuYkFTMU5eAjnXWucHA972PD5WttW92XAFwhZRD9dD9m6c0ea68PmNSa sXkg== Received: by 10.68.204.103 with SMTP id kx7mr26696538pbc.33.1352463073323; Fri, 09 Nov 2012 04:11:13 -0800 (PST) Received: from localhost.localdomain (p1120-ipbf2201hodogaya.kanagawa.ocn.ne.jp. [123.220.186.120]) by mx.google.com with ESMTPS id mn5sm17666238pbc.12.2012.11.09.04.11.10 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 09 Nov 2012 04:11:12 -0800 (PST) From: Akinobu Mita To: linux-kernel@vger.kernel.org, akpm@linux-foundation.org Subject: [PATCH] drm/radeon: Use hweight32 Date: Fri, 9 Nov 2012 21:10:41 +0900 Message-Id: <1352463043-9408-1-git-send-email-akinobu.mita@gmail.com> X-Mailer: git-send-email 1.7.11.7 X-Mailman-Approved-At: Mon, 12 Nov 2012 00:00:29 -0800 Cc: Akinobu Mita , dri-devel@lists.freedesktop.org X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: dri-devel-bounces+patchwork-dri-devel=patchwork.kernel.org@lists.freedesktop.org Errors-To: dri-devel-bounces+patchwork-dri-devel=patchwork.kernel.org@lists.freedesktop.org Use hweight32 instead of counting for each bit Signed-off-by: Akinobu Mita Cc: David Airlie Cc: dri-devel@lists.freedesktop.org --- drivers/gpu/drm/radeon/r600.c | 8 +------- drivers/gpu/drm/radeon/r600_cp.c | 7 +------ 2 files changed, 2 insertions(+), 13 deletions(-) diff --git a/drivers/gpu/drm/radeon/r600.c b/drivers/gpu/drm/radeon/r600.c index cda280d..169ecc9 100644 --- a/drivers/gpu/drm/radeon/r600.c +++ b/drivers/gpu/drm/radeon/r600.c @@ -1424,13 +1424,7 @@ u32 r6xx_remap_render_backend(struct radeon_device *rdev, int r600_count_pipe_bits(uint32_t val) { - int i, ret = 0; - - for (i = 0; i < 32; i++) { - ret += val & 1; - val >>= 1; - } - return ret; + return hweight32(val); } static void r600_gpu_init(struct radeon_device *rdev) diff --git a/drivers/gpu/drm/radeon/r600_cp.c b/drivers/gpu/drm/radeon/r600_cp.c index 2514123..be85f75 100644 --- a/drivers/gpu/drm/radeon/r600_cp.c +++ b/drivers/gpu/drm/radeon/r600_cp.c @@ -721,12 +721,7 @@ static u32 r600_get_tile_pipe_to_backend_map(u32 num_tile_pipes, static int r600_count_pipe_bits(uint32_t val) { - int i, ret = 0; - for (i = 0; i < 32; i++) { - ret += val & 1; - val >>= 1; - } - return ret; + return hweight32(val); } static void r600_gfx_init(struct drm_device *dev,