All of lore.kernel.org
 help / color / mirror / Atom feed
From: marex@denx.de (Marek Vasut)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v2 2/5] dma: mxs-dma: make platform_device_id more generic
Date: Sat, 5 May 2012 15:12:17 +0200	[thread overview]
Message-ID: <201205051512.17972.marex@denx.de> (raw)
In-Reply-To: <20120504143442.GL2194@S2101-09.ap.freescale.net>

Dear Shawn Guo,

> On Fri, May 04, 2012 at 02:15:03PM +0200, Marek Vasut wrote:
> > >  static int __init mxs_add_mxs_dma(void)
> > >  {
> > > 
> > > -	char *apbh = "mxs-dma-apbh";
> > > -	char *apbx = "mxs-dma-apbx";
> > > +	char *mx23_apbh = "imx23-dma-apbh";
> > > +	char *mx23_apbx = "imx23-dma-apbx";
> > > +	char *mx28_apbh = "imx28-dma-apbh";
> > > +	char *mx28_apbx = "imx28-dma-apbx";
> > 
> > Wild guess ... but const char * won't hurt here ?
> 
> Right.  I guess it just followed how the existing code looks like.
> Considering this whole function will be removed patch #4, it should
> not be a big problem, I guess.

Can't the patches be reordered then to avoid adding this altogether?

> > > -#define MXS_DMA_APBH		0
> > > -#define MXS_DMA_APBX		1
> > > -#define dma_is_apbh()		(mxs_dma->dev_id == MXS_DMA_APBH)
> > > -
> > > -#define APBH_VERSION_LATEST	3
> > > -#define apbh_is_old()		(mxs_dma->version < APBH_VERSION_LATEST)
> > > +#define dma_is_apbh()		(mxs_dma->type == MXS_DMA_APBH)
> > > +#define apbh_is_old()		(mxs_dma->dev_id == IMX23_DMA)
> 
> ...
> 
> > > +int mxs_dma_is_apbh(struct dma_chan *chan)
> > > +{
> > > +	struct mxs_dma_chan *mxs_chan = to_mxs_dma_chan(chan);
> > > +	struct mxs_dma_engine *mxs_dma = mxs_chan->mxs_dma;
> > 
> > Do you need the above here ? :)
> 
> I have to confess it's my bad.  I made the code hard to read when I
> created the driver.  The dma_is_apbh() should really takes mxs_dma
> as a parameter than hiding it in the macro.
> 
> While I agree this is something should be improved, it may be better
> to do it in another patch?

You don't have to add dead code in this patch and re-add it when needed. Or fix 
the macro to take the parameter then, though I don't understand why you'd want 
to take it and then hide it.

> > > +
> > > +	return dma_is_apbh();
> > > +}

Best regards,
Marek Vasut

WARNING: multiple messages have this Message-ID (diff)
From: Marek Vasut <marex-ynQEQJNshbs@public.gmane.org>
To: Shawn Guo <shawn.guo-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
Cc: vinod.koul-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org,
	devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org,
	rob.herring-bsGFqQB8/DxBDgjK7y7TUQ@public.gmane.org,
	b32955-KZfg59tc24xl57MIdRCFDg@public.gmane.org,
	kernel-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org,
	dan.j.williams-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org,
	s.hauer-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org
Subject: Re: [PATCH v2 2/5] dma: mxs-dma: make platform_device_id more generic
Date: Sat, 5 May 2012 15:12:17 +0200	[thread overview]
Message-ID: <201205051512.17972.marex@denx.de> (raw)
In-Reply-To: <20120504143442.GL2194-rvtDTF3kK1ictlrPMvKcciBecyulp+rMXqFh9Ls21Oc@public.gmane.org>

Dear Shawn Guo,

> On Fri, May 04, 2012 at 02:15:03PM +0200, Marek Vasut wrote:
> > >  static int __init mxs_add_mxs_dma(void)
> > >  {
> > > 
> > > -	char *apbh = "mxs-dma-apbh";
> > > -	char *apbx = "mxs-dma-apbx";
> > > +	char *mx23_apbh = "imx23-dma-apbh";
> > > +	char *mx23_apbx = "imx23-dma-apbx";
> > > +	char *mx28_apbh = "imx28-dma-apbh";
> > > +	char *mx28_apbx = "imx28-dma-apbx";
> > 
> > Wild guess ... but const char * won't hurt here ?
> 
> Right.  I guess it just followed how the existing code looks like.
> Considering this whole function will be removed patch #4, it should
> not be a big problem, I guess.

Can't the patches be reordered then to avoid adding this altogether?

> > > -#define MXS_DMA_APBH		0
> > > -#define MXS_DMA_APBX		1
> > > -#define dma_is_apbh()		(mxs_dma->dev_id == MXS_DMA_APBH)
> > > -
> > > -#define APBH_VERSION_LATEST	3
> > > -#define apbh_is_old()		(mxs_dma->version < APBH_VERSION_LATEST)
> > > +#define dma_is_apbh()		(mxs_dma->type == MXS_DMA_APBH)
> > > +#define apbh_is_old()		(mxs_dma->dev_id == IMX23_DMA)
> 
> ...
> 
> > > +int mxs_dma_is_apbh(struct dma_chan *chan)
> > > +{
> > > +	struct mxs_dma_chan *mxs_chan = to_mxs_dma_chan(chan);
> > > +	struct mxs_dma_engine *mxs_dma = mxs_chan->mxs_dma;
> > 
> > Do you need the above here ? :)
> 
> I have to confess it's my bad.  I made the code hard to read when I
> created the driver.  The dma_is_apbh() should really takes mxs_dma
> as a parameter than hiding it in the macro.
> 
> While I agree this is something should be improved, it may be better
> to do it in another patch?

You don't have to add dead code in this patch and re-add it when needed. Or fix 
the macro to take the parameter then, though I don't understand why you'd want 
to take it and then hide it.

> > > +
> > > +	return dma_is_apbh();
> > > +}

Best regards,
Marek Vasut

  reply	other threads:[~2012-05-05 13:12 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-05-04 12:12 [PATCH v2 1/5] dma: mxs-dma: use global stmp_device functionality Dong Aisheng
2012-05-04 12:12 ` Dong Aisheng
2012-05-04 12:12 ` [PATCH v2 2/5] dma: mxs-dma: make platform_device_id more generic Dong Aisheng
2012-05-04 12:12   ` Dong Aisheng
2012-05-04 12:15   ` Marek Vasut
2012-05-04 12:15     ` Marek Vasut
2012-05-04 14:34     ` Shawn Guo
2012-05-04 14:34       ` Shawn Guo
2012-05-05 13:12       ` Marek Vasut [this message]
2012-05-05 13:12         ` Marek Vasut
2012-05-05 13:25         ` Shawn Guo
2012-05-05 13:25           ` Shawn Guo
2012-05-05 14:32           ` Marek Vasut
2012-05-05 14:32             ` Marek Vasut
2012-05-07  3:55             ` Dong Aisheng
2012-05-07  3:55               ` Dong Aisheng
2012-05-07  3:52               ` Shawn Guo
2012-05-07  3:52                 ` Shawn Guo
2012-05-07  4:07                 ` Marek Vasut
2012-05-07  4:07                   ` Marek Vasut
2012-05-07  4:14                   ` Shawn Guo
2012-05-07  4:14                     ` Shawn Guo
2012-05-04 12:12 ` [PATCH v2 3/5] dma: mxs-dma: add device tree probe support Dong Aisheng
2012-05-04 12:12   ` Dong Aisheng
2012-05-04 12:12 ` [PATCH v2 4/5] ARM: mxs: do not add dma device by default Dong Aisheng
2012-05-04 12:12   ` Dong Aisheng
2012-05-04 12:12 ` [PATCH v2 5/5] ARM: mx28evk: add mxs-dma dt support Dong Aisheng
2012-05-04 12:12   ` Dong Aisheng
2012-05-04 14:44 ` [PATCH v2 1/5] dma: mxs-dma: use global stmp_device functionality Shawn Guo
2012-05-04 14:44   ` Shawn Guo
2012-05-07  3:20   ` Dong Aisheng
2012-05-07  3:20     ` Dong Aisheng
2012-05-04 16:02 ` Wolfram Sang
2012-05-04 16:02   ` Wolfram Sang

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=201205051512.17972.marex@denx.de \
    --to=marex@denx.de \
    --cc=linux-arm-kernel@lists.infradead.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.