devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Vinod Koul <vinod.koul@intel.com>
To: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
Cc: dmaengine@vger.kernel.org, linux-snps-arc@lists.infradead.org,
	linux-kernel@vger.kernel.org, devicetree@vger.kernel.org,
	Dan Williams <dan.j.williams@intel.com>,
	Rob Herring <robh+dt@kernel.org>,
	Wan Ahmad Zainie <wan.ahmad.zainie.wan.mohamad@intel.com>,
	Alexey Brodkin <Alexey.Brodkin@synopsys.com>,
	Andy Shevchenko <andy.shevchenko@gmail.com>
Subject: Re: [PATCH v2 1/2] dmaengine: Introduce DW AXI DMAC driver
Date: Fri, 2 Mar 2018 13:43:26 +0530	[thread overview]
Message-ID: <20180302081326.GJ15443@localhost> (raw)
In-Reply-To: <20180226145628.11892-2-Eugeniy.Paltsev@synopsys.com>

On Mon, Feb 26, 2018 at 05:56:27PM +0300, Eugeniy Paltsev wrote:

> +/*
> + * Synopsys DesignWare AXI DMA Controller driver.
> + *
> + * Copyright (C) 2017-2018 Synopsys, Inc. (www.synopsys.com)
> + * Author: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
> + *
> + * SPDX-License-Identifier:	GPL-2.0
> + */

This needs to be in below style

// SPDX-License-Identifier:  GPL-2.0
// Copyright (C) ....

/*
 * other things u want to add
 */

> +#define DRV_NAME	"axi_dw_dmac"

how about use KBUILD_MODNAME here?

> +static enum dma_status
> +dma_chan_tx_status(struct dma_chan *dchan, dma_cookie_t cookie,
> +		  struct dma_tx_state *txstate)
> +{
> +	struct axi_dma_chan *chan = dchan_to_axi_dma_chan(dchan);
> +	enum dma_status ret;
> +
> +	ret = dma_cookie_status(dchan, cookie, txstate);
> +
> +	if (chan->is_paused && ret == DMA_IN_PROGRESS)
> +		return DMA_PAUSED;
> +
> +	return ret;

nitpick, how about

	if (chan->is_paused && ret == DMA_IN_PROGRESS)
		ret = DMA_PAUSED;

	return ret;

that way we have single point of return.

> +static int dma_chan_alloc_chan_resources(struct dma_chan *dchan)
> +{
> +	struct axi_dma_chan *chan = dchan_to_axi_dma_chan(dchan);
> +
> +	/* ASSERT: channel is idle */
> +	if (axi_chan_is_hw_enable(chan)) {
> +		dev_err(chan2dev(chan), "%s is non-idle!\n",
> +			axi_chan_name(chan));
> +		return -EBUSY;
> +	}
> +
> +	dev_vdbg(dchan2dev(dchan), "%s: allocating\n", axi_chan_name(chan));
> +
> +	dma_cookie_init(dchan);

This is already done as part of vchan_init(), so why is it called explicitly
and why is that not invoked here?

> +static void dma_chan_free_chan_resources(struct dma_chan *dchan)
> +{
> +	struct axi_dma_chan *chan = dchan_to_axi_dma_chan(dchan);
> +
> +	/* ASSERT: channel is idle */
> +	if (axi_chan_is_hw_enable(chan))
> +		dev_err(dchan2dev(dchan), "%s is non-idle!\n",
> +			axi_chan_name(chan));
> +
> +	axi_chan_disable(chan);
> +	axi_chan_irq_disable(chan, DWAXIDMAC_IRQ_ALL);
> +
> +	vchan_free_chan_resources(&chan->vc);
> +
> +	dev_vdbg(dchan2dev(dchan), "%s: free resources, descriptor still allocated: %u\n",

making the string in subsequent line make it lesser than 80 chars, here and
few other places can benefit..

> +static irqreturn_t dw_axi_dma_intretupt(int irq, void *dev_id)
/s/intretupt/interrupt/ ?

> +static int axi_dma_resume(struct axi_dma_chip *chip)
> +{
> +	int ret = 0;

superfluous init

> +static int parse_device_properties(struct axi_dma_chip *chip)
> +{
> +	struct device *dev = chip->dev;
> +	u32 tmp, carr[DMAC_MAX_CHANNELS];
> +	int ret;
> +
> +	ret = device_property_read_u32(dev, "dma-channels", &tmp);
> +	if (ret)
> +		return ret;
> +	if (tmp == 0 || tmp > DMAC_MAX_CHANNELS)
> +		return -EINVAL;
> +
> +	chip->dw->hdata->nr_channels = tmp;
> +
> +	ret = device_property_read_u32(dev, "snps,dma-masters", &tmp);

why is it snps,... shouldn't it be only dma-masters?

> +enum {
> +	DWAXIDMAC_ARWLEN_1		= 0x0,
> +	DWAXIDMAC_ARWLEN_2		= 0x1,
> +	DWAXIDMAC_ARWLEN_4		= 0x3,
> +	DWAXIDMAC_ARWLEN_8		= 0x7,
> +	DWAXIDMAC_ARWLEN_16		= 0xF,
> +	DWAXIDMAC_ARWLEN_32		= 0x1F,
> +	DWAXIDMAC_ARWLEN_64		= 0x3F,
> +	DWAXIDMAC_ARWLEN_128		= 0x7F,
> +	DWAXIDMAC_ARWLEN_256		= 0xFF,

GENMASK() for these?

-- 
~Vinod

  parent reply	other threads:[~2018-03-02  8:13 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-26 14:56 [PATCH v2 0/2] Introduce DW AXI DMAC driver Eugeniy Paltsev
2018-02-26 14:56 ` [PATCH v2 1/2] dmaengine: " Eugeniy Paltsev
2018-02-26 16:42   ` Andy Shevchenko
2018-03-05 15:26     ` Eugeniy Paltsev
2018-03-05 15:56     ` Eugeniy Paltsev
2018-03-02  8:13   ` Vinod Koul [this message]
2018-02-26 14:56 ` [PATCH v2 2/2] dt-bindings: Document the Synopsys DW AXI DMA bindings Eugeniy Paltsev
2018-03-02  8:14   ` Vinod Koul
2018-03-02  8:32     ` Alexey Brodkin
2018-03-05  5:32       ` Vinod Koul
2018-03-05 21:07         ` Rob Herring
2018-03-05 21:49           ` Alexey Brodkin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180302081326.GJ15443@localhost \
    --to=vinod.koul@intel.com \
    --cc=Alexey.Brodkin@synopsys.com \
    --cc=Eugeniy.Paltsev@synopsys.com \
    --cc=andy.shevchenko@gmail.com \
    --cc=dan.j.williams@intel.com \
    --cc=devicetree@vger.kernel.org \
    --cc=dmaengine@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-snps-arc@lists.infradead.org \
    --cc=robh+dt@kernel.org \
    --cc=wan.ahmad.zainie.wan.mohamad@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).