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=-5.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=no 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 8ED20C432BE for ; Thu, 2 Sep 2021 03:23:04 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 5C7C26108E for ; Thu, 2 Sep 2021 03:23:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233165AbhIBDXk (ORCPT ); Wed, 1 Sep 2021 23:23:40 -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