From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752181AbbJEPSX (ORCPT ); Mon, 5 Oct 2015 11:18:23 -0400 Received: from mga01.intel.com ([192.55.52.88]:17918 "EHLO mga01.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751409AbbJEPSW (ORCPT ); Mon, 5 Oct 2015 11:18:22 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.17,639,1437462000"; d="scan'208";a="574450990" Date: Mon, 5 Oct 2015 16:18:17 +0100 From: Vinod Koul To: Kedareswara rao Appana Cc: dan.j.williams@intel.com, anirudh@xilinx.com, michal.simek@xilinx.com, soren.brinkmann@xilinx.com, appanad@xilinx.com, dmaengine@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v6 2/2] dmaengine: Add Xilinx AXI Central Direct Memory Access Engine driver support Message-ID: <20151005151816.GD13501@vkoul-mobl.iind.intel.com> References: <1441629198-17663-1-git-send-email-appanad@xilinx.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1441629198-17663-1-git-send-email-appanad@xilinx.com> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Sep 07, 2015 at 06:03:18PM +0530, Kedareswara rao Appana wrote: > +static struct xilinx_cdma_tx_segment * > +xilinx_cdma_alloc_tx_segment(struct xilinx_cdma_chan *chan) > +{ > + struct xilinx_cdma_tx_segment *segment; > + dma_addr_t phys; > + > + segment = dma_pool_alloc(chan->desc_pool, GFP_ATOMIC, &phys); > + if (!segment) > + return NULL; > + > + memset(segment, 0, sizeof(*segment)); dma_pool_zalloc() pls > +static void xilinx_cdma_start_transfer(struct xilinx_cdma_chan *chan) > +{ > + struct xilinx_cdma_tx_descriptor *head_desc, *tail_desc; > + struct xilinx_cdma_tx_segment *tail_segment; > + u32 ctrl_reg = cdma_read(chan, XILINX_CDMA_CONTROL_OFFSET); > + > + if (chan->err) > + return; > + > + if (list_empty(&chan->pending_list)) > + return; > + > + if (!chan->idle) > + return; this and err case can be combined ! > +static struct dma_async_tx_descriptor * > +xilinx_cdma_prep_memcpy(struct dma_chan *dchan, dma_addr_t dma_dst, > + dma_addr_t dma_src, size_t len, unsigned long flags) > +{ > + struct xilinx_cdma_chan *chan = to_xilinx_chan(dchan); > + struct xilinx_cdma_desc_hw *hw; > + struct xilinx_cdma_tx_descriptor *desc; > + struct xilinx_cdma_tx_segment *segment, *prev; > + > + if (!len || len > XILINX_CDMA_MAX_TRANS_LEN) > + return NULL; > + > + desc = xilinx_cdma_alloc_tx_descriptor(chan); > + if (!desc) > + return NULL; > + > + dma_async_tx_descriptor_init(&desc->async_tx, &chan->common); > + desc->async_tx.tx_submit = xilinx_cdma_tx_submit; > + async_tx_ack(&desc->async_tx); Why do you need this ? > +static int xilinx_cdma_terminate_all(struct dma_chan *dchan) > +{ > + struct xilinx_cdma_chan *chan = to_xilinx_chan(dchan); > + > + /* Reset the channel */ > + xilinx_cdma_chan_reset(chan); what about the irqs that are already fired/tasklets scheduled? > + > + /* Remove and free all of the descriptors in the lists */ > + xilinx_cdma_free_descriptors(chan); > + > + return 0; > +} > + > +/* ----------------------------------------------------------------------------- > + * Probe and remove > + */ > + > +/** > + * xilinx_cdma_free_channel - Channel remove function > + * @chan: Driver specific cdma channel > + */ > +static void xilinx_cdma_free_channel(struct xilinx_cdma_chan *chan) Free channel is a bad name, as we alloc and free channels from dmaengine API -- ~Vinod