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=-4.0 required=3.0 tests=BAYES_00, 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 8773AC433E0 for ; Fri, 31 Jul 2020 12:46:50 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 630C321D95 for ; Fri, 31 Jul 2020 12:46:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730934AbgGaMqu (ORCPT ); Fri, 31 Jul 2020 08:46:50 -0400 Received: from mail.baikalelectronics.com ([87.245.175.226]:60756 "EHLO mail.baikalelectronics.ru" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727040AbgGaMqu (ORCPT ); Fri, 31 Jul 2020 08:46:50 -0400 Received: from localhost (unknown [127.0.0.1]) by mail.baikalelectronics.ru (Postfix) with ESMTP id 7799C8030802; Fri, 31 Jul 2020 12:46:47 +0000 (UTC) X-Virus-Scanned: amavisd-new at baikalelectronics.ru Received: from mail.baikalelectronics.ru ([127.0.0.1]) by localhost (mail.baikalelectronics.ru [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id mJzSbjY_LpHW; Fri, 31 Jul 2020 15:46:46 +0300 (MSK) Date: Fri, 31 Jul 2020 15:46:46 +0300 From: Serge Semin To: Andy Shevchenko CC: Serge Semin , Mark Brown , Alexey Malahov , Georgy Vlasov , Ramil Zaripov , Pavel Parkhomenko , Peter Ujfalusi , Feng Tang , Vinod Koul , , Subject: Re: [PATCH 4/8] spi: dw-dma: Move DMA transfers submission to the channels prep methods Message-ID: <20200731124646.2bngx5mgtwrgctzi@mobilestation> References: <20200731075953.14416-1-Sergey.Semin@baikalelectronics.ru> <20200731075953.14416-5-Sergey.Semin@baikalelectronics.ru> <20200731091528.GI3703480@smile.fi.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: <20200731091528.GI3703480@smile.fi.intel.com> X-ClientProxiedBy: MAIL.baikal.int (192.168.51.25) To mail (192.168.51.25) Sender: linux-spi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-spi@vger.kernel.org On Fri, Jul 31, 2020 at 12:15:28PM +0300, Andy Shevchenko wrote: > On Fri, Jul 31, 2020 at 10:59:49AM +0300, Serge Semin wrote: > > Indeed we can freely move the dmaengine_submit() method invocation and the > > Tx and Rx busy flag setting into the DMA Tx/Rx prepare methods. By doing > > so first we implement another preparation before adding the one-by-one DMA > > SG entries transmission, second we now have the dma_async_tx_descriptor > > descriptor used locally only in the new DMA transfers submitition methods, > > which makes the code less complex with no passing around the DMA Tx > > descriptors, third we make the generic transfer method more readable, where > > now the functionality of submission, execution and wait procedures is > > transparently split up instead of having a preparation, intermixed > > submission/execution and wait procedures. While at it we also add the > > dmaengine_submit() return value test. It has been unnecessary for > > DW DMAC, but should be done to support the generic DMA interface. > > > > Note since the DMA channels preparation methods are now responsible for > > the DMA transactions submission, we also rename them to > > dw_spi_dma_submit_{tx,rx}(). > > ... > > > + cookie = dmaengine_submit(txdesc); > > + ret = dma_submit_error(cookie); > > + if (!ret) > > Use traditional pattern > if (ret) > return ret; > > Same for below. Ok. > > > + set_bit(TX_BUSY, &dws->dma_chan_busy); > > + > > + return ret; > > ... > > > - if (!xfer->rx_buf) > > - return NULL; > > This seems not related. I moved it to the upper level for the methods better maintainability. -Sergey > > -- > With Best Regards, > Andy Shevchenko > >