public inbox for linux-mmc@vger.kernel.org
 help / color / mirror / Atom feed
From: Simon Horman <horms@verge.net.au>
To: Magnus Damm <magnus.damm@gmail.com>
Cc: linux-mmc@vger.kernel.org, linux-sh@vger.kernel.org,
	Guennadi Liakhovetski <g.liakhovetski@gmx.de>,
	Paul Mundt <lethal@linux-sh.org>, Chris Ball <cjb@laptop.org>
Subject: Re: [PATCH 3/5] mmc: sdhi: Add write16_hook
Date: Tue, 21 Jun 2011 10:13:03 +0900	[thread overview]
Message-ID: <20110621011257.GD16230@verge.net.au> (raw)
In-Reply-To: <BANLkTimRUnaMtk_zhLAquAKQre4E8ZJUJQ@mail.gmail.com>

On Tue, Jun 21, 2011 at 09:59:37AM +0900, Magnus Damm wrote:
> On Tue, Jun 21, 2011 at 9:50 AM, Simon Horman <horms@verge.net.au> wrote:
> > On Tue, Jun 21, 2011 at 09:36:03AM +0900, Magnus Damm wrote:
> >> On Tue, Jun 21, 2011 at 8:00 AM, Simon Horman <horms@verge.net.au> wrote:

[snip]

> >> > index 5a90266..0dc9804 100644
> >> > --- a/include/linux/mfd/tmio.h
> >> > +++ b/include/linux/mfd/tmio.h
> >> > @@ -94,6 +101,7 @@ struct tmio_mmc_data {
> >> >        void (*set_pwr)(struct platform_device *host, int state);
> >> >        void (*set_clk_div)(struct platform_device *host, int state);
> >> >        int (*get_cd)(struct platform_device *host);
> >> > +       int (*write16_hook)(struct tmio_mmc_host *host, int addr);
> >> >  };
> >> >
> >> >  static inline void tmio_mmc_cd_wakeup(struct tmio_mmc_data *pdata)
> >>
> >> What's the reason behind passing "struct tmio_mmc_host *"  as an
> >> argument to the new hook? Performance? All other callbacks seem to
> >> take a "struct platform_device *", so being consistent here may be
> >> good unless it comes with too much overhead.
> >
> > The reason is that
> > 1) The hook is called from sd_ctrl_write16 which takes
> >   struct tmio_mmc_host * as its first argument and;
> > 2) The hook that has been implemented calls sd_ctrl_read16() which takes a
> >   struct tmio_mmc_host * as its first argument.
> > So it seemed logical to pass that down.
> >
> > In the caes of 1) we can get the struct platform_device * using host->pdev.
> > However, in the case of 2) is it less clear to me how we can get the
> > struct tmio_mmc_host * from a struct platform_device *.
> 
> Have a look at the code in tmio_mmc_host_suspend() for some code that
> does struct device * -> struct tmio_mmc_host *:
> int tmio_mmc_host_suspend(struct device *dev)
> {
> 	struct mmc_host *mmc = dev_get_drvdata(dev);
> 	struct tmio_mmc_host *host = mmc_priv(mmc);
> 
> You can easily change the dev_get_drvdata() to platform_get_drvdata(),
> see include/linux/platform_device.h

Thanks, I'm happy to make that change if you think it is worth it.
(I will need to re-test on AG5, which I could do this afternoon
 if it is free)

> I guess a similar conversion can be done in tmio_mmc_enable_dma() to
> move from writew() to sd_ctrl_write16()?

Are you proposing changing tmio_mmc_enable_dma() to take
a struct platform_device * as its first argument?

tmio_mmc_enable_dma() is already altered in one of the
patches in this series to use sd_ctrl_write16() without
altering the arguments taht tmio_mmc_enable_dma() takes.

static void tmio_mmc_enable_dma(struct tmio_mmc_host *host, bool enable)
{
#if defined(CONFIG_SUPERH) || defined(CONFIG_ARCH_SHMOBILE)
	/* Switch DMA mode on or off - SuperH specific? */
	sd_ctrl_write16(host, enable ? 2 : 0, CTL_DMA_ENABLE);
#endif
}

  reply	other threads:[~2011-06-21  1:13 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-06-20 23:00 [PATCH 0/5 v2] mmc: sdhi: Allow waiting for idle Simon Horman
2011-06-20 23:00 ` [PATCH 1/5] mmc: tmio: name 0xd8 as CTL_DMA_ENABLE Simon Horman
2011-06-20 23:00 ` [PATCH 2/5] mmc: tmio: Share register access functions Simon Horman
2011-06-20 23:00 ` [PATCH 3/5] mmc: sdhi: Add write16_hook Simon Horman
2011-06-21  0:36   ` Magnus Damm
2011-06-21  0:50     ` Simon Horman
2011-06-21  0:59       ` Magnus Damm
2011-06-21  1:13         ` Simon Horman [this message]
2011-06-21  1:36           ` Magnus Damm
2011-06-21  2:09             ` Simon Horman
2011-06-21  2:34               ` Magnus Damm
2011-06-20 23:00 ` [PATCH 4/5] ARM: mach-shmobile: ag5evm: consistently name sdhi info structures Simon Horman
2011-06-21  8:50   ` Paul Mundt
2011-06-20 23:00 ` [PATCH 5/5] ARM: mach-shmobile: ag5evm: SDHI requires waiting for idle Simon Horman
2011-06-21 16:10   ` Chris Ball
2011-06-21 16:27     ` Paul Mundt
2011-06-21 16:37       ` Chris Ball
  -- strict thread matches above, loose matches on Subject: below --
2011-06-20  6:06 [PATCH 0/5] mmc: sdhi: Allow " Simon Horman
2011-06-20  6:06 ` [PATCH 3/5] mmc: sdhi: Add write16_hook Simon Horman
2011-06-20  6:25   ` Paul Mundt
2011-06-20 13:42     ` Simon Horman
2011-06-20  6:29   ` Guennadi Liakhovetski
2011-06-20 13:40     ` Simon Horman
2011-06-20  7:04   ` Magnus Damm
2011-06-20 13:40     ` Simon Horman

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=20110621011257.GD16230@verge.net.au \
    --to=horms@verge.net.au \
    --cc=cjb@laptop.org \
    --cc=g.liakhovetski@gmx.de \
    --cc=lethal@linux-sh.org \
    --cc=linux-mmc@vger.kernel.org \
    --cc=linux-sh@vger.kernel.org \
    --cc=magnus.damm@gmail.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