From patchwork Sat Sep 21 01:03:10 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Emilio_L=C3=B3pez?= X-Patchwork-Id: 2921951 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 952649F1E2 for ; Sat, 21 Sep 2013 01:05:30 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id DA2D3204CB for ; Sat, 21 Sep 2013 01:05:29 +0000 (UTC) Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id EE3C3204C7 for ; Sat, 21 Sep 2013 01:05:28 +0000 (UTC) Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1VNBdC-0000aq-6z; Sat, 21 Sep 2013 01:05:06 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1VNBd3-0000ew-JZ; Sat, 21 Sep 2013 01:04:57 +0000 Received: from zetta.elopez.com.ar ([199.30.59.35]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1VNBct-0000dL-5u for linux-arm-kernel@lists.infradead.org; Sat, 21 Sep 2013 01:04:48 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=elopez.com.ar; s=mail; h=Content-Transfer-Encoding:Content-Type:MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From; bh=kzqs2wTWar52d81uAy4aQjjYvcRuomVQGdOA1bX5dzk=; b=uMDpj33kGId4l0udMWxO0kFRA8I/fW9O50u/7/GTh727IK4l58V6l2YGdKTywJsrfj1UvOZ3tMT4qtDcf3M6r+76H8efNTyXXVoxSgyRA9Mc51lmvb6WJJuUSXZViPY4X6CHZJj9qOwX1OxVv6/6SbKxEZt7G9UydAAjOA/nC9KCRUy1aQx5Vlt3MEQ/5nqi4ykfy9lITb8d88RGfEvwXDM6LQau3c1WDWJEaI1Phh5VDFLQAB3/jdl/mR7nHz92vP7uxHBUYX0u2oHFehDcQ+fQqiH7PjaLR0DVmtLbIAuCVuMjDIxDBf7xl53KQQUOkLre4W+P9KBu6tGPP2xGSQ==; Received: from 201-212-126-35.prima.net.ar ([201.212.126.35] helo=desktop.lan) by zetta.elopez.com.ar with esmtpsa (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) id 1VNBca-00072F-T2; Fri, 20 Sep 2013 22:04:29 -0300 From: =?UTF-8?q?Emilio=20L=C3=B3pez?= To: Mike Turquette , Maxime Ripard Subject: [PATCH 1/3] clk: sunxi: factors: fix off-by-one masks Date: Fri, 20 Sep 2013 22:03:10 -0300 Message-Id: <1379725392-30202-2-git-send-email-emilio@elopez.com.ar> X-Mailer: git-send-email 1.8.4 In-Reply-To: <1379725392-30202-1-git-send-email-emilio@elopez.com.ar> References: <1379725392-30202-1-git-send-email-emilio@elopez.com.ar> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20130920_210447_409596_C09DFD53 X-CRM114-Status: UNSURE ( 8.56 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -2.7 (--) Cc: =?UTF-8?q?Emilio=20L=C3=B3pez?= , linux-arm-kernel@lists.infradead.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,RP_MATCHES_RCVD,T_DKIM_INVALID,UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The previous code would generate one bit too long masks, and was needlessly complicated. This patch replaces it by simpler code that can generate the masks correctly. Signed-off-by: Emilio López Acked-by: Maxime Ripard --- drivers/clk/sunxi/clk-factors.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/clk/sunxi/clk-factors.c b/drivers/clk/sunxi/clk-factors.c index 88523f9..5687ac9 100644 --- a/drivers/clk/sunxi/clk-factors.c +++ b/drivers/clk/sunxi/clk-factors.c @@ -40,7 +40,7 @@ struct clk_factors { #define to_clk_factors(_hw) container_of(_hw, struct clk_factors, hw) -#define SETMASK(len, pos) (((-1U) >> (31-len)) << (pos)) +#define SETMASK(len, pos) (((1U << (len)) - 1) << (pos)) #define CLRMASK(len, pos) (~(SETMASK(len, pos))) #define FACTOR_GET(bit, len, reg) (((reg) & SETMASK(len, bit)) >> (bit))