From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.3 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 001DEC4360C for ; Fri, 4 Oct 2019 14:08:44 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id C7148222BE for ; Fri, 4 Oct 2019 14:08:43 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="lrRkqcW2" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C7148222BE Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=pengutronix.de Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=L/lyTbT2gDpzlNW6tSa4di3438aSZUTK6pEOlCzCCbE=; b=lrRkqcW2+y8M0f yGCC+osXMJs1itxN1dzW7QZbqja5aSRcziMm2A1Y0IkRXepCqA9rCQB7u8IC6ol418HZ/rYJcB4dS wfYYu859HfKZY5Jw59jAnWlArcKKK8CVOt7x8Hy/86K3dBWFatmMyXkMj3aIWjz+QDxKsbc0R+nCc 9FcfB3rYbesj3k5Jrfu8Ra7EBZu7mQyibmVbiFzUD3K2iFlfrY7J+wcZXkgUwMBLP+D7jWZHyngnM tME6caYHhiyiApxm0EM9bRICtUki6ST70b+x6GjepF4e/qZ9TcpE3g0ZLIUIxEOqXjKCChZzZ8EGi XHsNyTjAPS7a6qGWm0Eg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.2 #3 (Red Hat Linux)) id 1iGOGB-00047d-92; Fri, 04 Oct 2019 14:08:43 +0000 Received: from metis.ext.pengutronix.de ([2001:67c:670:201:290:27ff:fe1d:cc33]) by bombadil.infradead.org with esmtps (Exim 4.92.2 #3 (Red Hat Linux)) id 1iGOG8-00046v-3c for linux-arm-kernel@lists.infradead.org; Fri, 04 Oct 2019 14:08:41 +0000 Received: from pty.hi.pengutronix.de ([2001:67c:670:100:1d::c5]) by metis.ext.pengutronix.de with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1iGOG3-00077c-5N; Fri, 04 Oct 2019 16:08:35 +0200 Received: from ukl by pty.hi.pengutronix.de with local (Exim 4.89) (envelope-from ) id 1iGOG2-0004Pi-Oo; Fri, 04 Oct 2019 16:08:34 +0200 Date: Fri, 4 Oct 2019 16:08:34 +0200 From: Uwe =?iso-8859-1?Q?Kleine-K=F6nig?= To: Rasmus Villemoes Subject: Re: [PATCH v2 5/6] pwm: mxs: avoid a division in mxs_pwm_apply() Message-ID: <20191004140834.4idddyohf52ha4ao@pengutronix.de> References: <20191004133207.6663-1-linux@rasmusvillemoes.dk> <20191004133207.6663-6-linux@rasmusvillemoes.dk> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20191004133207.6663-6-linux@rasmusvillemoes.dk> User-Agent: NeoMutt/20170113 (1.7.2) X-SA-Exim-Connect-IP: 2001:67c:670:100:1d::c5 X-SA-Exim-Mail-From: ukl@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-arm-kernel@lists.infradead.org X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20191004_070840_151666_DE82EE49 X-CRM114-Status: GOOD ( 17.42 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: devicetree@vger.kernel.org, linux-pwm@vger.kernel.org, Shawn Guo , Sascha Hauer , linux-kernel@vger.kernel.org, Rob Herring , Thierry Reding , NXP Linux Team , Pengutronix Kernel Team , Fabio Estevam , linux-arm-kernel@lists.infradead.org Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Fri, Oct 04, 2019 at 03:32:06PM +0200, Rasmus Villemoes wrote: > Since the divisor is not a compile-time constant (unless gcc somehow > decided to unroll the loop PERIOD_CDIV_MAX times), this does a > somewhat expensive 32/32 division. Replace that with a right shift. > = > We still have a 64/32 division just below, but at least in that > case the divisor is compile-time constant. > = > Signed-off-by: Rasmus Villemoes > --- > drivers/pwm/pwm-mxs.c | 6 +++--- > 1 file changed, 3 insertions(+), 3 deletions(-) > = > diff --git a/drivers/pwm/pwm-mxs.c b/drivers/pwm/pwm-mxs.c > index 57562221c439..f2e57fcf8f8b 100644 > --- a/drivers/pwm/pwm-mxs.c > +++ b/drivers/pwm/pwm-mxs.c > @@ -33,8 +33,8 @@ > #define PERIOD_CDIV(div) (((div) & 0x7) << 20) > #define PERIOD_CDIV_MAX 8 > = > -static const unsigned int cdiv[PERIOD_CDIV_MAX] =3D { > - 1, 2, 4, 8, 16, 64, 256, 1024 > +static const u8 cdiv_shift[PERIOD_CDIV_MAX] =3D { > + 0, 1, 2, 3, 4, 6, 8, 10 One small nitpick: I would like to see this name have a mxs_pwm_ prefix. But even without this change: Reviewed-by: Uwe Kleine-K=F6nig Thanks Uwe -- = Pengutronix e.K. | Uwe Kleine-K=F6nig | Industrial Linux Solutions | http://www.pengutronix.de/ | _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel