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=-11.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, 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 E252EC43461 for ; Fri, 11 Sep 2020 13:57:59 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (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 84B4420855 for ; Fri, 11 Sep 2020 13:57:59 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="ewFrzgJh" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 84B4420855 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linux.intel.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+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=merlin.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=tykoIs3JlBMBLqRhjTsdvNRz/KbkjRBk2mmxU+w/k4A=; b=ewFrzgJhsqAad+xEU9NMrI8dt ItxJ5EGq4vdkb05v0wW+eyXZ2M/hC8MVV2BTHzHHNsC5JPhwziVHwCAz54bfhHJFYkv92vjAVT0Aj 2DMDbCagxMRlYxLqQFMyy4BL79JI/27u9PpCPFArnftpmnv+Ga93j3fDBoPltzur/iyYm/kKOa/mR FlMU2dZRKy1nyDiIh0HO7+IG0xIzIF7beGTn8HGptgtoxUoy0LVpqiA+rG/swKJ9/VO1tlo5sbRZr BWeWWJ8Ujb0wV40jpd41BGdxSZYv5OP6r9U0UkKQ7uZEX8uTG8q02DL2hbV5v+qbztwF1Wd/RLZwI PgGqKq/KQ==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kGjXg-0006YG-2f; Fri, 11 Sep 2020 13:56:44 +0000 Received: from mga18.intel.com ([134.134.136.126]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kGjXd-0006XH-Pg for linux-arm-kernel@lists.infradead.org; Fri, 11 Sep 2020 13:56:42 +0000 IronPort-SDR: Zjd+7EvKjN4FLWw8ZcK7Kj5BSzjrXNsGXHufp4ygSwZ/VO1BoRjg3c1Tg20WnJMy/vbyT+cfDG qOfVn9rbNVGA== X-IronPort-AV: E=McAfee;i="6000,8403,9740"; a="146487810" X-IronPort-AV: E=Sophos;i="5.76,415,1592895600"; d="scan'208";a="146487810" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Sep 2020 06:56:39 -0700 IronPort-SDR: vmjohGXeCztnlk0HvpTJJd5IK/ylPkCfq+HKaYOu83Xe+UYZw4oOsfGeUHsoE/+XJ7K8FKmbE4 ANMKFfA6LC5Q== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.76,415,1592895600"; d="scan'208";a="342306628" Received: from stinkbox.fi.intel.com (HELO stinkbox) ([10.237.72.174]) by FMSMGA003.fm.intel.com with SMTP; 11 Sep 2020 06:56:34 -0700 Received: by stinkbox (sSMTP sendmail emulation); Fri, 11 Sep 2020 16:56:34 +0300 Date: Fri, 11 Sep 2020 16:56:34 +0300 From: Ville =?iso-8859-1?Q?Syrj=E4l=E4?= To: Laurentiu Palcu Subject: Re: [PATCH] drm/imx/dcss: fix 64-bit divisions Message-ID: <20200911135634.GI6112@intel.com> References: <20200911134827.32142-1-laurentiu.palcu@oss.nxp.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20200911134827.32142-1-laurentiu.palcu@oss.nxp.com> X-Patchwork-Hint: comment User-Agent: Mutt/1.10.1 (2018-07-13) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200911_095641_950907_F27B613B X-CRM114-Status: GOOD ( 23.09 ) 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: Philipp Zabel , David Airlie , Fabio Estevam , Sascha Hauer , linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, NXP Linux Team , Daniel Vetter , Shawn Guo , Pengutronix Kernel Team , linux-arm-kernel@lists.infradead.org, Lucas Stach Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Fri, Sep 11, 2020 at 04:48:27PM +0300, Laurentiu Palcu wrote: > Use div_s64() for the 64-bit divisions. This would allow the driver to co= mpile > on 32-bit architectures, if needed. > = > Signed-off-by: Laurentiu Palcu > --- > drivers/gpu/drm/imx/dcss/dcss-scaler.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > = > diff --git a/drivers/gpu/drm/imx/dcss/dcss-scaler.c b/drivers/gpu/drm/imx= /dcss/dcss-scaler.c > index cd21905de580..7c1e0e461244 100644 > --- a/drivers/gpu/drm/imx/dcss/dcss-scaler.c > +++ b/drivers/gpu/drm/imx/dcss/dcss-scaler.c > @@ -134,7 +134,7 @@ static int div_q(int A, int B) > else > temp -=3D B / 2; > = > - result =3D (int)(temp / B); > + result =3D (int)(div_s64(temp, B)); > return result; > } > = > @@ -237,7 +237,7 @@ static void dcss_scaler_gaussian_filter(int fc_q, boo= l use_5_taps, > ll_temp =3D coef[phase][i]; > ll_temp <<=3D PSC_COEFF_PRECISION; > ll_temp +=3D sum >> 1; > - ll_temp /=3D sum; That looks like hand rolled DIV_ROUND_CLOSEST_ULL() > + ll_temp =3D div_s64(ll_temp, sum); > coef[phase][i] =3D (int)ll_temp; > } > } > -- = > 2.17.1 > = > _______________________________________________ > dri-devel mailing list > dri-devel@lists.freedesktop.org > https://lists.freedesktop.org/mailman/listinfo/dri-devel -- = Ville Syrj=E4l=E4 Intel _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel 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=-11.2 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,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 5524EC43461 for ; Fri, 11 Sep 2020 13:56:42 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (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 0DD6920855 for ; Fri, 11 Sep 2020 13:56:42 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 0DD6920855 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linux.intel.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 4816D6E956; Fri, 11 Sep 2020 13:56:41 +0000 (UTC) Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by gabe.freedesktop.org (Postfix) with ESMTPS id 60E706E956 for ; Fri, 11 Sep 2020 13:56:40 +0000 (UTC) IronPort-SDR: +HFog+SaVJ8DMbPcp591Kftx9MokrsM14lsbGQHl5QvVkBJ+fVKGPPRqXUkrgQ8suNsdLqS0oh mSCb+Y84J90w== X-IronPort-AV: E=McAfee;i="6000,8403,9740"; a="159692724" X-IronPort-AV: E=Sophos;i="5.76,415,1592895600"; d="scan'208";a="159692724" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Sep 2020 06:56:39 -0700 IronPort-SDR: vmjohGXeCztnlk0HvpTJJd5IK/ylPkCfq+HKaYOu83Xe+UYZw4oOsfGeUHsoE/+XJ7K8FKmbE4 ANMKFfA6LC5Q== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.76,415,1592895600"; d="scan'208";a="342306628" Received: from stinkbox.fi.intel.com (HELO stinkbox) ([10.237.72.174]) by FMSMGA003.fm.intel.com with SMTP; 11 Sep 2020 06:56:34 -0700 Received: by stinkbox (sSMTP sendmail emulation); Fri, 11 Sep 2020 16:56:34 +0300 Date: Fri, 11 Sep 2020 16:56:34 +0300 From: Ville =?iso-8859-1?Q?Syrj=E4l=E4?= To: Laurentiu Palcu Subject: Re: [PATCH] drm/imx/dcss: fix 64-bit divisions Message-ID: <20200911135634.GI6112@intel.com> References: <20200911134827.32142-1-laurentiu.palcu@oss.nxp.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20200911134827.32142-1-laurentiu.palcu@oss.nxp.com> X-Patchwork-Hint: comment User-Agent: Mutt/1.10.1 (2018-07-13) X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: David Airlie , Sascha Hauer , linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, NXP Linux Team , Shawn Guo , Pengutronix Kernel Team , linux-arm-kernel@lists.infradead.org Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" On Fri, Sep 11, 2020 at 04:48:27PM +0300, Laurentiu Palcu wrote: > Use div_s64() for the 64-bit divisions. This would allow the driver to co= mpile > on 32-bit architectures, if needed. > = > Signed-off-by: Laurentiu Palcu > --- > drivers/gpu/drm/imx/dcss/dcss-scaler.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > = > diff --git a/drivers/gpu/drm/imx/dcss/dcss-scaler.c b/drivers/gpu/drm/imx= /dcss/dcss-scaler.c > index cd21905de580..7c1e0e461244 100644 > --- a/drivers/gpu/drm/imx/dcss/dcss-scaler.c > +++ b/drivers/gpu/drm/imx/dcss/dcss-scaler.c > @@ -134,7 +134,7 @@ static int div_q(int A, int B) > else > temp -=3D B / 2; > = > - result =3D (int)(temp / B); > + result =3D (int)(div_s64(temp, B)); > return result; > } > = > @@ -237,7 +237,7 @@ static void dcss_scaler_gaussian_filter(int fc_q, boo= l use_5_taps, > ll_temp =3D coef[phase][i]; > ll_temp <<=3D PSC_COEFF_PRECISION; > ll_temp +=3D sum >> 1; > - ll_temp /=3D sum; That looks like hand rolled DIV_ROUND_CLOSEST_ULL() > + ll_temp =3D div_s64(ll_temp, sum); > coef[phase][i] =3D (int)ll_temp; > } > } > -- = > 2.17.1 > = > _______________________________________________ > dri-devel mailing list > dri-devel@lists.freedesktop.org > https://lists.freedesktop.org/mailman/listinfo/dri-devel -- = Ville Syrj=E4l=E4 Intel _______________________________________________ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel 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=-11.2 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,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 CB4E0C43461 for ; Fri, 11 Sep 2020 16:32:59 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 99D3C221EB for ; Fri, 11 Sep 2020 16:32:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726654AbgIKQc6 (ORCPT ); Fri, 11 Sep 2020 12:32:58 -0400 Received: from mga18.intel.com ([134.134.136.126]:20408 "EHLO mga18.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726418AbgIKPTB (ORCPT ); Fri, 11 Sep 2020 11:19:01 -0400 IronPort-SDR: aNyfM9wNeliUF6yCC63zXsKB4ICo5WwM0rq/A/1qklXb1ap2itW5qC67FsNrLDbfnA42weh77M bous9ExZjVxQ== X-IronPort-AV: E=McAfee;i="6000,8403,9740"; a="146487813" X-IronPort-AV: E=Sophos;i="5.76,415,1592895600"; d="scan'208";a="146487813" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Sep 2020 06:56:39 -0700 IronPort-SDR: vmjohGXeCztnlk0HvpTJJd5IK/ylPkCfq+HKaYOu83Xe+UYZw4oOsfGeUHsoE/+XJ7K8FKmbE4 ANMKFfA6LC5Q== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.76,415,1592895600"; d="scan'208";a="342306628" Received: from stinkbox.fi.intel.com (HELO stinkbox) ([10.237.72.174]) by FMSMGA003.fm.intel.com with SMTP; 11 Sep 2020 06:56:34 -0700 Received: by stinkbox (sSMTP sendmail emulation); Fri, 11 Sep 2020 16:56:34 +0300 Date: Fri, 11 Sep 2020 16:56:34 +0300 From: Ville =?iso-8859-1?Q?Syrj=E4l=E4?= To: Laurentiu Palcu Cc: Lucas Stach , Philipp Zabel , David Airlie , Daniel Vetter , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , NXP Linux Team , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, dri-devel@lists.freedesktop.org Subject: Re: [PATCH] drm/imx/dcss: fix 64-bit divisions Message-ID: <20200911135634.GI6112@intel.com> References: <20200911134827.32142-1-laurentiu.palcu@oss.nxp.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20200911134827.32142-1-laurentiu.palcu@oss.nxp.com> X-Patchwork-Hint: comment User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Sep 11, 2020 at 04:48:27PM +0300, Laurentiu Palcu wrote: > Use div_s64() for the 64-bit divisions. This would allow the driver to compile > on 32-bit architectures, if needed. > > Signed-off-by: Laurentiu Palcu > --- > drivers/gpu/drm/imx/dcss/dcss-scaler.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/drivers/gpu/drm/imx/dcss/dcss-scaler.c b/drivers/gpu/drm/imx/dcss/dcss-scaler.c > index cd21905de580..7c1e0e461244 100644 > --- a/drivers/gpu/drm/imx/dcss/dcss-scaler.c > +++ b/drivers/gpu/drm/imx/dcss/dcss-scaler.c > @@ -134,7 +134,7 @@ static int div_q(int A, int B) > else > temp -= B / 2; > > - result = (int)(temp / B); > + result = (int)(div_s64(temp, B)); > return result; > } > > @@ -237,7 +237,7 @@ static void dcss_scaler_gaussian_filter(int fc_q, bool use_5_taps, > ll_temp = coef[phase][i]; > ll_temp <<= PSC_COEFF_PRECISION; > ll_temp += sum >> 1; > - ll_temp /= sum; That looks like hand rolled DIV_ROUND_CLOSEST_ULL() > + ll_temp = div_s64(ll_temp, sum); > coef[phase][i] = (int)ll_temp; > } > } > -- > 2.17.1 > > _______________________________________________ > dri-devel mailing list > dri-devel@lists.freedesktop.org > https://lists.freedesktop.org/mailman/listinfo/dri-devel -- Ville Syrjälä Intel