public inbox for linux-mmc@vger.kernel.org
 help / color / mirror / Atom feed
From: Lee Jones <lee.jones@linaro.org>
To: Ulf Hansson <ulf.hansson@linaro.org>
Cc: Arnd Bergmann <arnd@arndb.de>,
	Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>,
	Chris Ball <cjb@laptop.org>, Simon <horms@verge.net.au>,
	Linux-SH <linux-sh@vger.kernel.org>,
	linux-mmc <linux-mmc@vger.kernel.org>
Subject: Re: [PATCH 01/17] mmc: tmio: add tmio_mmc_host_alloc/free()
Date: Tue, 20 Jan 2015 09:38:42 +0000	[thread overview]
Message-ID: <20150120093842.GK5767@x1> (raw)
In-Reply-To: <CAPDyKFpYQ5tHeWHiZMwS1zJpgrgP_qC8vbv3ExLkLTbn9X8MyQ@mail.gmail.com>

On Tue, 20 Jan 2015, Ulf Hansson wrote:

> + MFD maintainer
> 
> On 13 January 2015 at 05:57, Kuninori Morimoto
> <kuninori.morimoto.gx@renesas.com> wrote:
> > From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
> >
> > Current tmio_mmc driver is using tmio_mmc_data for driver/platform
> > specific data/callback, and it is needed for tmio_mmc_host_probe()
> > function. Because of this style, include/linux/mfd/tmio.h header has
> > tmio driver/framework specific data which is not needed from platform.
> >
> > This patch adds new tmio_mmc_host_alloc/free() as cleanup preparation.
> > tmio driver specific data/callback will be implemented in tmio_mmc_host,
> > and platform specific data/callback will be implemented in tmio_mmc_data
> > in this cleanup.
> >
> > Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
> > ---
> >  drivers/mmc/host/sh_mobile_sdhi.c |   14 +++++++++---
> >  drivers/mmc/host/tmio_mmc.c       |   10 +++++++--
> >  drivers/mmc/host/tmio_mmc.h       |    5 +++--
> >  drivers/mmc/host/tmio_mmc_pio.c   |   43 +++++++++++++++++++++++--------------
> >  include/linux/mfd/tmio.h          |    1 -

Acked-by: Lee Jones <lee.jones@linaro.org>

> >  5 files changed, 49 insertions(+), 24 deletions(-)
> >
> > diff --git a/drivers/mmc/host/sh_mobile_sdhi.c b/drivers/mmc/host/sh_mobile_sdhi.c
> > index 00c8ebd..cf062c4 100644
> > --- a/drivers/mmc/host/sh_mobile_sdhi.c
> > +++ b/drivers/mmc/host/sh_mobile_sdhi.c
> > @@ -113,7 +113,7 @@ static int sh_mobile_sdhi_wait_idle(struct tmio_mmc_host *host)
> >                 udelay(1);
> >
> >         if (!timeout) {
> > -               dev_warn(host->pdata->dev, "timeout waiting for SD bus idle\n");
> > +               dev_warn(&host->pdev->dev, "timeout waiting for SD bus idle\n");
> >                 return -EBUSY;
> >         }
> >
> > @@ -207,6 +207,12 @@ static int sh_mobile_sdhi_probe(struct platform_device *pdev)
> >                 goto eclkget;
> >         }
> >
> > +       host = tmio_mmc_host_alloc(pdev);
> > +       if (!host) {
> > +               ret = -ENOMEM;
> > +               goto eprobe;
> > +       }
> > +
> >         mmc_data->clk_enable = sh_mobile_sdhi_clk_enable;
> >         mmc_data->clk_disable = sh_mobile_sdhi_clk_disable;
> >         mmc_data->capabilities = MMC_CAP_MMC_HIGHSPEED;
> > @@ -274,9 +280,9 @@ static int sh_mobile_sdhi_probe(struct platform_device *pdev)
> >         /* SD control register space size is 0x100, 0x200 for bus_shift=1 */
> >         mmc_data->bus_shift = resource_size(res) >> 9;
> >
> > -       ret = tmio_mmc_host_probe(&host, pdev, mmc_data);
> > +       ret = tmio_mmc_host_probe(host, mmc_data);
> >         if (ret < 0)
> > -               goto eprobe;
> > +               goto efree;
> >
> >         /*
> >          * FIXME:
> > @@ -351,6 +357,8 @@ static int sh_mobile_sdhi_probe(struct platform_device *pdev)
> >
> >  eirq:
> >         tmio_mmc_host_remove(host);
> > +efree:
> > +       tmio_mmc_host_free(host);
> >  eprobe:
> >  eclkget:
> >         if (p && p->cleanup)
> > diff --git a/drivers/mmc/host/tmio_mmc.c b/drivers/mmc/host/tmio_mmc.c
> > index 2616fdf..f47ae08 100644
> > --- a/drivers/mmc/host/tmio_mmc.c
> > +++ b/drivers/mmc/host/tmio_mmc.c
> > @@ -92,10 +92,14 @@ static int tmio_mmc_probe(struct platform_device *pdev)
> >         pdata->bus_shift = resource_size(res) >> 10;
> >         pdata->flags |= TMIO_MMC_HAVE_HIGH_REG;
> >
> > -       ret = tmio_mmc_host_probe(&host, pdev, pdata);
> > -       if (ret)
> > +       host = tmio_mmc_host_alloc(pdev);
> > +       if (!host)
> >                 goto cell_disable;
> >
> > +       ret = tmio_mmc_host_probe(host, pdata);
> > +       if (ret)
> > +               goto host_free;
> > +
> >         ret = request_irq(irq, tmio_mmc_irq, IRQF_TRIGGER_FALLING,
> >                                 dev_name(&pdev->dev), host);
> >         if (ret)
> > @@ -108,6 +112,8 @@ static int tmio_mmc_probe(struct platform_device *pdev)
> >
> >  host_remove:
> >         tmio_mmc_host_remove(host);
> > +host_free:
> > +       tmio_mmc_host_free(host);
> >  cell_disable:
> >         if (cell->disable)
> >                 cell->disable(pdev);
> > diff --git a/drivers/mmc/host/tmio_mmc.h b/drivers/mmc/host/tmio_mmc.h
> > index a34ecbe..60d6747 100644
> > --- a/drivers/mmc/host/tmio_mmc.h
> > +++ b/drivers/mmc/host/tmio_mmc.h
> > @@ -85,8 +85,9 @@ struct tmio_mmc_host {
> >         bool                    sdio_irq_enabled;
> >  };
> >
> > -int tmio_mmc_host_probe(struct tmio_mmc_host **host,
> > -                       struct platform_device *pdev,
> > +struct tmio_mmc_host *tmio_mmc_host_alloc(struct platform_device *pdev);
> > +void tmio_mmc_host_free(struct tmio_mmc_host *host);
> > +int tmio_mmc_host_probe(struct tmio_mmc_host *host,
> >                         struct tmio_mmc_data *pdata);
> >  void tmio_mmc_host_remove(struct tmio_mmc_host *host);
> >  void tmio_mmc_do_data_irq(struct tmio_mmc_host *host);
> > diff --git a/drivers/mmc/host/tmio_mmc_pio.c b/drivers/mmc/host/tmio_mmc_pio.c
> > index 250bf8c..1a9a13f 100644
> > --- a/drivers/mmc/host/tmio_mmc_pio.c
> > +++ b/drivers/mmc/host/tmio_mmc_pio.c
> > @@ -1054,12 +1054,35 @@ static void tmio_mmc_of_parse(struct platform_device *pdev,
> >                 pdata->flags |= TMIO_MMC_WRPROTECT_DISABLE;
> >  }
> >
> > -int tmio_mmc_host_probe(struct tmio_mmc_host **host,
> > -                                 struct platform_device *pdev,
> > -                                 struct tmio_mmc_data *pdata)
> > +struct tmio_mmc_host*
> > +tmio_mmc_host_alloc(struct platform_device *pdev)
> >  {
> > -       struct tmio_mmc_host *_host;
> > +       struct tmio_mmc_host *host;
> >         struct mmc_host *mmc;
> > +
> > +       mmc = mmc_alloc_host(sizeof(struct tmio_mmc_host), &pdev->dev);
> > +       if (!mmc)
> > +               return NULL;
> > +
> > +       host = mmc_priv(mmc);
> > +       host->mmc = mmc;
> > +       host->pdev = pdev;
> > +
> > +       return host;
> > +}
> > +
> > +void tmio_mmc_host_free(struct tmio_mmc_host *host)
> > +{
> > +       mmc_free_host(host->mmc);
> > +
> > +       host->mmc = NULL;
> > +}
> > +
> > +int tmio_mmc_host_probe(struct tmio_mmc_host *_host,
> > +                       struct tmio_mmc_data *pdata)
> > +{
> > +       struct platform_device *pdev = _host->pdev;
> > +       struct mmc_host *mmc = _host->mmc;
> >         struct resource *res_ctl;
> >         int ret;
> >         u32 irq_mask = TMIO_MASK_CMD;
> > @@ -1073,19 +1096,11 @@ int tmio_mmc_host_probe(struct tmio_mmc_host **host,
> >         if (!res_ctl)
> >                 return -EINVAL;
> >
> > -       mmc = mmc_alloc_host(sizeof(struct tmio_mmc_host), &pdev->dev);
> > -       if (!mmc)
> > -               return -ENOMEM;
> > -
> >         ret = mmc_of_parse(mmc);
> >         if (ret < 0)
> >                 goto host_free;
> >
> > -       pdata->dev = &pdev->dev;
> > -       _host = mmc_priv(mmc);
> >         _host->pdata = pdata;
> > -       _host->mmc = mmc;
> > -       _host->pdev = pdev;
> >         platform_set_drvdata(pdev, mmc);
> >
> >         _host->set_pwr = pdata->set_pwr;
> > @@ -1192,12 +1207,9 @@ int tmio_mmc_host_probe(struct tmio_mmc_host **host,
> >                 mmc_gpiod_request_cd_irq(mmc);
> >         }
> >
> > -       *host = _host;
> > -
> >         return 0;
> >
> >  host_free:
> > -       mmc_free_host(mmc);
> >
> >         return ret;
> >  }
> > @@ -1222,7 +1234,6 @@ void tmio_mmc_host_remove(struct tmio_mmc_host *host)
> >         pm_runtime_disable(&pdev->dev);
> >
> >         iounmap(host->ctl);
> > -       mmc_free_host(mmc);
> >  }
> >  EXPORT_SYMBOL(tmio_mmc_host_remove);
> >
> > diff --git a/include/linux/mfd/tmio.h b/include/linux/mfd/tmio.h
> > index 5738817..c7d9af0 100644
> > --- a/include/linux/mfd/tmio.h
> > +++ b/include/linux/mfd/tmio.h
> > @@ -135,7 +135,6 @@ struct tmio_mmc_data {
> >         unsigned long                   bus_shift;
> >         u32                             ocr_mask;       /* available voltages */
> >         struct tmio_mmc_dma             *dma;
> > -       struct device                   *dev;
> >         unsigned int                    cd_gpio;
> >         void (*set_pwr)(struct platform_device *host, int state);
> >         void (*set_clk_div)(struct platform_device *host, int state);
> >

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog

  reply	other threads:[~2015-01-20  9:38 UTC|newest]

Thread overview: 43+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <201501131902.WqokttpY%fengguang.wu@intel.com>
2015-01-13  4:56 ` [PATCH 0/17 v2] tmio: mmc: header cleanup / sh_mobile_cleanup Kuninori Morimoto
2015-01-13  4:57   ` [PATCH 01/17] mmc: tmio: add tmio_mmc_host_alloc/free() Kuninori Morimoto
2015-01-20  9:10     ` Ulf Hansson
2015-01-20  9:38       ` Lee Jones [this message]
2015-01-13  4:57   ` [PATCH 02/17] mmc: tmio: tmio_mmc_host has .dma Kuninori Morimoto
2015-01-20  9:10     ` Ulf Hansson
2015-01-20  9:37       ` Lee Jones
2015-01-13  4:57   ` [PATCH 03/17] mmc: tmio: tmio_mmc_host has .write16_hook Kuninori Morimoto
2015-01-20  9:11     ` Ulf Hansson
2015-01-20  9:37       ` Lee Jones
2015-01-13  4:57   ` [PATCH 04/17] mmc: tmio: tmio_mmc_host has .clk_enable Kuninori Morimoto
2015-01-20  9:11     ` Ulf Hansson
2015-01-20  9:36       ` Lee Jones
2015-01-13  4:58   ` [PATCH 05/17] mmc: tmio: tmio_mmc_host has .clk_disable Kuninori Morimoto
2015-01-20  9:11     ` Ulf Hansson
2015-01-20  9:36       ` Lee Jones
2015-01-13  4:58   ` [PATCH 06/17] mmc: tmio: tmio_mmc_host has .multi_io_quirk Kuninori Morimoto
2015-01-20  9:12     ` Ulf Hansson
2015-01-20  9:35       ` Lee Jones
2015-01-13  4:58   ` [PATCH 07/17] mmc: tmio: tmio_mmc_host has .bus_shift Kuninori Morimoto
2015-01-20  9:12     ` Ulf Hansson
2015-01-20  9:35       ` Lee Jones
2015-01-13  4:58   ` [PATCH 08/17] mmc: tmio: tmio_mmc_data has .alignment_shift Kuninori Morimoto
2015-01-20  9:13     ` Ulf Hansson
2015-01-20  9:34       ` Lee Jones
2015-01-13  4:58   ` [PATCH 09/17] mmc: tmio: tmio_mmc_data has .dma_rx_offset Kuninori Morimoto
2015-01-20  9:13     ` Ulf Hansson
2015-01-20  9:34       ` Lee Jones
2015-01-13  4:59   ` [PATCH 10/17] mmc: tmio: add .enable_dma on tmio_mmc_data Kuninori Morimoto
2015-01-13  4:59   ` [PATCH 11/17] mmc: tmio: enable SoC specific DMA buswidth settings Kuninori Morimoto
2015-01-13  4:59   ` [PATCH 12/17] mmc: sh_mobile_sdhi: remove .init/.cleanup Kuninori Morimoto
2015-01-13  4:59   ` [PATCH 13/17] mmc: sh_mobile_sdhi: tidyup mmc_data->bus_shift for latest SoC Kuninori Morimoto
2015-01-13  4:59   ` [PATCH 14/17] mmc: sh_mobile_sdhi: add new macro for mmc_host to sh_mobile_sdhi Kuninori Morimoto
2015-01-13  4:59   ` [PATCH 15/17] mmc: sh_mobile_sdhi: use .enable_dma Kuninori Morimoto
2015-01-13  5:00   ` [PATCH 16/17] mmc: sh_mobile_sdhi: enable 32bit DMA access Kuninori Morimoto
2015-01-13  5:00   ` [PATCH 17/17] mmc: tmio: remove TMIO_MMC_HAVE_CTL_DMA_REG flag Kuninori Morimoto
2015-01-20  9:14     ` Ulf Hansson
2015-01-20  9:33       ` Lee Jones
2015-01-13  9:35   ` [PATCH 0/17 v2] tmio: mmc: header cleanup / sh_mobile_cleanup Ulf Hansson
2015-01-14  8:30   ` [PATCH] mmc: tmio: add missing EXPORT_SYMBOL for tmio_mmc_host_alloc/free Ulf Hansson
2015-01-14  8:57     ` Kuninori Morimoto
2015-01-20  9:15     ` Ulf Hansson
2015-01-20  9:09   ` [PATCH 0/17 v2] tmio: mmc: header cleanup / sh_mobile_cleanup Ulf Hansson

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=20150120093842.GK5767@x1 \
    --to=lee.jones@linaro.org \
    --cc=arnd@arndb.de \
    --cc=cjb@laptop.org \
    --cc=horms@verge.net.au \
    --cc=kuninori.morimoto.gx@renesas.com \
    --cc=linux-mmc@vger.kernel.org \
    --cc=linux-sh@vger.kernel.org \
    --cc=ulf.hansson@linaro.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox