From mboxrd@z Thu Jan 1 00:00:00 1970 From: Masahiro Yamada Date: Tue, 9 Oct 2018 21:24:46 +0900 Subject: [U-Boot] [PATCH 1/2] mmc: tmio: Pass full address to tmio_sd_addr_is_dmaable() In-Reply-To: <20181009112351.17256-1-marek.vasut+renesas@gmail.com> References: <20181009112351.17256-1-marek.vasut+renesas@gmail.com> Message-ID: List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Hi Marek, On Tue, Oct 9, 2018 at 8:26 PM Marek Vasut wrote: > > Pass the entire source data pointer to tmio_sd_addr_is_dmaable() This statement sounds like the current code is passing the pointer address only partially. Is it right? > so we don't have to apply casts throughout the code. I do not understand this either since I see a cast in your code too. In the previous code, the caller casts src->address when it passes it to tmio_sd_addr_is_dmaable(). In the new code, 'src' is casted in tmio_sd_addr_is_dmaable(). To me, you just moved the location of casting. What is the difference (i.e. benefit)? If you want to change this code, I am fine. But, I'd like to know the reason. At least, I am so confused with your commit description. > Signed-off-by: Marek Vasut > Cc: Masahiro Yamada > --- > drivers/mmc/tmio-common.c | 6 ++++-- > 1 file changed, 4 insertions(+), 2 deletions(-) > > diff --git a/drivers/mmc/tmio-common.c b/drivers/mmc/tmio-common.c > index b311b80be8..6b21941991 100644 > --- a/drivers/mmc/tmio-common.c > +++ b/drivers/mmc/tmio-common.c > @@ -372,8 +372,10 @@ static int tmio_sd_dma_xfer(struct udevice *dev, struct mmc_data *data) > } > > /* check if the address is DMA'able */ > -static bool tmio_sd_addr_is_dmaable(unsigned long addr) > +static bool tmio_sd_addr_is_dmaable(const char *src) > { > + uintptr_t addr = (uintptr_t)src; > + > if (!IS_ALIGNED(addr, TMIO_SD_DMA_MINALIGN)) > return false; > > @@ -486,7 +488,7 @@ int tmio_sd_send_cmd(struct udevice *dev, struct mmc_cmd *cmd, > if (data) { > /* use DMA if the HW supports it and the buffer is aligned */ > if (priv->caps & TMIO_SD_CAP_DMA_INTERNAL && > - tmio_sd_addr_is_dmaable((long)data->src)) > + tmio_sd_addr_is_dmaable(data->src)) > ret = tmio_sd_dma_xfer(dev, data); > else > ret = tmio_sd_pio_xfer(dev, data); > -- > 2.18.0 > > _______________________________________________ > U-Boot mailing list > U-Boot at lists.denx.de > https://lists.denx.de/listinfo/u-boot -- Best Regards Masahiro Yamada