From patchwork Sat Sep 1 18:53:57 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jean Delvare X-Patchwork-Id: 1395471 Return-Path: X-Original-To: patchwork-linux-media@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id 92754DFABE for ; Sat, 1 Sep 2012 18:54:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753142Ab2IASyJ (ORCPT ); Sat, 1 Sep 2012 14:54:09 -0400 Received: from zoneX.GCU-Squad.org ([194.213.125.0]:25670 "EHLO services.gcu-squad.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752261Ab2IASyI (ORCPT ); Sat, 1 Sep 2012 14:54:08 -0400 Received: from jdelvare.pck.nerim.net ([62.212.121.182] helo=endymion.delvare) by services.gcu-squad.org (GCU Mailer Daemon) with esmtpsa id 1T7spX-0001yO-An (TLSv1:AES128-SHA:128) (envelope-from ) ; Sat, 01 Sep 2012 20:54:03 +0200 Date: Sat, 1 Sep 2012 20:53:57 +0200 From: Jean Delvare To: LMML Cc: Andrew Morton , Guenter Roeck , Mauro Carvalho Chehab Subject: [PATCH] [media] mceusb: Optimize DIV_ROUND_CLOSEST call Message-ID: <20120901205357.1a75d8a1@endymion.delvare> X-Mailer: Claws Mail 3.7.10 (GTK+ 2.24.7; x86_64-suse-linux-gnu) Mime-Version: 1.0 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org DIV_ROUND_CLOSEST is faster if the compiler knows it will only be dealing with unsigned dividends. Signed-off-by: Jean Delvare Cc: Andrew Morton Cc: Guenter Roeck Cc: Mauro Carvalho Chehab Tested-by: Guenter Roeck --- drivers/media/rc/mceusb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- linux-3.6-rc3.orig/drivers/media/rc/mceusb.c 2012-08-04 21:49:27.000000000 +0200 +++ linux-3.6-rc3/drivers/media/rc/mceusb.c 2012-09-01 18:53:32.053042123 +0200 @@ -627,7 +627,7 @@ static void mceusb_dev_printdata(struct break; case MCE_RSP_EQIRCFS: period = DIV_ROUND_CLOSEST( - (1 << data1 * 2) * (data2 + 1), 10); + (1U << data1 * 2) * (data2 + 1), 10); if (!period) break; carrier = (1000 * 1000) / period;