From mboxrd@z Thu Jan 1 00:00:00 1970 From: Guennadi Liakhovetski Date: Mon, 14 Mar 2011 08:01:30 +0000 Subject: Re: [PATCH 3/6] mmc: tmio: convert the SDHI MMC driver from MFD to Message-Id: List-Id: References: In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable To: Magnus Damm Cc: linux-sh@vger.kernel.org, linux-mmc@vger.kernel.org, Chris Ball , Ian Molton On Sun, 13 Mar 2011, Magnus Damm wrote: > On Fri, Mar 11, 2011 at 4:52 PM, Guennadi Liakhovetski > wrote: > > On sh-mobile platforms the SDHI driver was using the tmio_mmc SD/SDIO > > MFD cell driver. Now that the tmio_mmc driver has been split into a > > core and a separate MFD glue, we can support SDHI natively without the > > need to emulate an MFD controller. This also allows to support systems > > with an on-SoC SDHI controller and a separate MFD with a TMIO core. > > > > Signed-off-by: Guennadi Liakhovetski > > --- >=20 > Nice, I believe this is the right direction.. >=20 > > --- a/drivers/mmc/host/tmio_mmc.h > > +++ b/drivers/mmc/host/tmio_mmc.h > > @@ -92,7 +92,7 @@ struct tmio_mmc_host { > > =A0 =A0 =A0 =A0struct tasklet_struct =A0 dma_complete; > > =A0 =A0 =A0 =A0struct tasklet_struct =A0 dma_issue; > > =A0 =A0 =A0 =A0struct scatterlist =A0 =A0 =A0bounce_sg; > > -#ifdef CONFIG_TMIO_MMC_DMA > > +#if defined(CONFIG_MMC_SDHI) || defined(CONFIG_MMC_SDHI_MODULE) > > =A0 =A0 =A0 =A0u8 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0bounce_buf= [PAGE_CACHE_SIZE] __attribute__((aligned(TMIO_MAX_ALIGN))); > > =A0#else > > =A0 =A0 =A0 =A0u8 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0bounce_buf= [1]; =A0/* A dummy in no-DMA case */ >=20 > ... but it would be nice if all this #ifdeffery could be avoided somehow. >=20 > Is it possible to use devres to allocate the bounce buffer dynamically > in the dma portion of the code? Well, this #ifdef has been there before, it's not new. But sure, we could=20 get rid of it. Basically, what you're suggesting, is to allocate that=20 bounce buffer dynamically - whether or not using devres. Just calling=20 __get_free_page() in tmio_mmc_request_dma() and __free_pages() in=20 tmio_mmc_release_dma() should work without any memory-leaking too. Would=20 this be ok? Thanks Guennadi --- Guennadi Liakhovetski, Ph.D. Freelance Open-Source Software Developer http://www.open-technology.de/