Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp17767pxb; Wed, 1 Sep 2021 20:30:16 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwgWDjsaOPLHrEucI/bgoZr2vUL/kh5muw92qeDxpH34M/1k5Cpv1gGdOyGxmEBpZY4PN3O X-Received: by 2002:a5d:9617:: with SMTP id w23mr950187iol.115.1630553415795; Wed, 01 Sep 2021 20:30:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1630553415; cv=none; d=google.com; s=arc-20160816; b=TwK7rsScQ8FNWJ6439BvISYSPrHMHenRutqJUrvRlMIwTc4gEg1+foXX1FfEXPv2ME 22etd0OKXbHMuhiUYq4AT5oAfsDOXZKZVlTwk+Q+Xmtv6uh1qcyhPjiP2pd3u1Kxrjpu 3qlv1ICFkm1hXOn1H7Vl3fD11X+OStphbg9V+7mZEK34eelNoFgznN02jMycBzYnwpo9 j3u87cQGiJW35ek5L1c3RHRbrZMX2Te5RIhjAa1OTCWJVGZrhAYhkPQjIzrlMmY3Zz7b 7/yOTCzGjaIvDj77y3qCHZAFxM59g8hS3iyXi297d+Ff1xxgGNM6N2ARNkvzqqrrbu8d e8Tg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=JcRZk/q97MurBcAGoJNGK/lMnw5yFOB8ds1nBM2H2mU=; b=RRjVxB3i3mFTMC/dcO8NrFyEcQpCuk4AwDRuSdAcTYb/R4ps6W6DdCCOP/z9zL7vYD YM/tx/9JiFBx7NqC9fRc9+bk/+RMIT5cfVy8Bt6YQb2dC2f2Zr20+ejrD1ktBclaWWkL 9YosjEbJFXYjLI7syJumPYokhMgaVCPbVATPq/KMcWY9EDkjeDaJHLkgtt3Hha3Hb4NA e0FKqJP0o39RgC33zbr1FQHnVOjbWiaSPszm/TKMFknZ9GB9N9GeIMqp3Jxypl4XMI1m DRh3MSDHYyGS2g+XtXJEIHr3il3VkjNv9D8lr2llP63UvepZXsLt5l7FPtvKoAbdjd/x /JpQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass (test mode) header.i=@ideasonboard.com header.s=mail header.b=oj3fLhRt; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id w67si510365jaa.124.2021.09.01.20.29.56; Wed, 01 Sep 2021 20:30:15 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass (test mode) header.i=@ideasonboard.com header.s=mail header.b=oj3fLhRt; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233094AbhIBDXj (ORCPT + 99 others); Wed, 1 Sep 2021 23:23:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38132 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230369AbhIBDXj (ORCPT ); Wed, 1 Sep 2021 23:23:39 -0400 Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 41C20C061575 for ; Wed, 1 Sep 2021 20:22:41 -0700 (PDT) Received: from pendragon.ideasonboard.com (62-78-145-57.bb.dnainternet.fi [62.78.145.57]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id EA6E745E; Thu, 2 Sep 2021 05:22:36 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1630552957; bh=xzDeYUiodNhGwMnAHeVnklX04indURX8IxKXY2cwky4=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=oj3fLhRtr14D2drudtMcLxoAQFJdxGLIoRA38z4R6BFs8qTMrZlI/c2KEY09Jkp7p Cx6KZulYkZpYYs79XAyH71wyyAlK9OFs4cp8wrP88uvPzs9QCZ86ldaNYMqnwBbrAK tP1OgbI2g+AkVDZEO8agj65WiVGuwj7qd+EL4F6E= Date: Thu, 2 Sep 2021 06:22:20 +0300 From: Laurent Pinchart To: Alyssa Rosenzweig Cc: dri-devel@lists.freedesktop.org, Neil Armstrong , David Airlie , Daniel Vetter , Kevin Hilman , Jerome Brunet , Martin Blumenstingl , Rob Clark , Sean Paul , Sandy Huang , Heiko =?utf-8?Q?St=C3=BCbner?= , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , Abhinav Kumar , Dmitry Baryshkov , Lee Jones , Stephen Boyd , Kalyan Thota , Ville =?utf-8?B?U3lyasOkbMOk?= , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 1/5] drm: Add drm_fixed_16_16 helper Message-ID: References: <20210901175431.14060-1-alyssa@rosenzweig.io> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Sep 01, 2021 at 09:35:40PM -0400, Alyssa Rosenzweig wrote: > > Missing documentation :-) > > Ack. > > > > +static inline int drm_fixed_16_16(s32 mult, s32 div) > > > > You should return a s32. > > Ack. > > > The function name isn't very explicit, and departs from the naming > > scheme of other functions in the same file. As fixed-point numbers are > > stored in a s64 for the drm_fixp_* helpers, we shouldn't rese the > > drm_fixp_ prefix, maybe drm_fixp_s16_16_ would be a good prefix. The > > function should probably be named drm_fixp_s16_16 from_fraction() then, > > but then the same logic should possibly be replicated to ensure optimal > > precision. I wonder if it wouldn't be best to simply use > > drm_fixp_from_fraction() and shift the result right by 16 bits. > > Sure, I'm not attached to the naming ... will wait to hear what colours > everyone else wants the bikehed painted. > > As for the implementation, I just went with what was used across > multiple drivers already (no chance of regressions that way) but could > reuse other helpers if it's better..? If the behaviour changes this goes > from a trivial cleanup to a much more invasive changeset. I don't own > half of the hardware here. But except for msm which may need testing, all other drivers use the existing FRAC_16_16() macro with constant arguments, so it shouldn't be difficult to ensure that the new function gives the same results. -- Regards, Laurent Pinchart