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 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D04BDC433EF for ; Tue, 9 Nov 2021 05:50:49 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id AB0506115B for ; Tue, 9 Nov 2021 05:50:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238225AbhKIFxe (ORCPT ); Tue, 9 Nov 2021 00:53:34 -0500 Received: from mail.kernel.org ([198.145.29.99]:50960 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230364AbhKIFxd (ORCPT ); Tue, 9 Nov 2021 00:53:33 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id ABB45610F7; Tue, 9 Nov 2021 05:50:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1636437048; bh=7wrdFm6RXmCeAdIpuwIhaiDDfnkWbf0prf/NE/auG6w=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=SWcwkwwOuRWxpUwx5oLLfgnruxI10Dj/1xdBUkCOvWtEQVVOXTkcFlencWpXw2QQL tsrE4ykafAy7yYPw65LaX6u3ULiwkHniVZY/P1zm0hTCY5GSdYpW9mNnnSyTAIsjQ2 KvnDz39VlTBWnwpJC3SOr0xoNPcJVPaFvakHkCH6yjMDCb/Ar+JDkzjs3H4HL6fc1I HGb//Gz44Fr98Pt8SCsubaVrHOR0lLBa/o1UIXTlsd/Nac1eg7xAUvc4UWuawfRyM5 fjg623QJQSGSW8IdBce5nHDGV1s/GSZfs8a66S/N1ExVa3uB58R/0f1/sMbfzWpROu RZdFu3tCZ8Kzg== Date: Tue, 9 Nov 2021 11:20:43 +0530 From: Vinod Koul To: Amelie Delaunay Cc: Maxime Coquelin , Alexandre Torgue , dmaengine@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Arnd Bergmann , kernel test robot Subject: Re: [PATCH 1/1] dmaengine: stm32-dma: avoid 64-bit division in stm32_dma_get_max_width Message-ID: References: <20211103153312.41483-1-amelie.delaunay@foss.st.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20211103153312.41483-1-amelie.delaunay@foss.st.com> Precedence: bulk List-ID: X-Mailing-List: dmaengine@vger.kernel.org On 03-11-21, 16:33, Amelie Delaunay wrote: > From: Arnd Bergmann > > Using the % operator on a 64-bit variable is expensive and can > cause a link failure: > > arm-linux-gnueabi-ld: drivers/dma/stm32-dma.o: in function `stm32_dma_get_max_width': > stm32-dma.c:(.text+0x170): undefined reference to `__aeabi_uldivmod' > arm-linux-gnueabi-ld: drivers/dma/stm32-dma.o: in function `stm32_dma_set_xfer_param': > stm32-dma.c:(.text+0x1cd4): undefined reference to `__aeabi_uldivmod' > > As we know that we just want to check the alignment in > stm32_dma_get_max_width(), there is no need for a full division, and > using a simple mask is a faster replacement. > > Same in stm32_dma_set_xfer_param(), change this to only allow burst > transfers if the address is a multiple of the length. > stm32_dma_get_best_burst just after will take buf_len into account to fix > burst in case of misalignment. Applied, thanks -- ~Vinod