lkml.org 
[lkml]   [2010]   [Jan]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v3 1/2] davinci: MMC: Add a function to control reset state of the controller
On Fri,  8 Jan 2010 17:08:49 +0530
Chaithrika U S <chaithrika@ti.com> wrote:

> -static void
> -davinci_abort_data(struct mmc_davinci_host *host, struct mmc_data *data)
> +static inline void mmc_davinci_reset_ctrl(struct mmc_davinci_host *host,
> + int val)
> {
> u32 temp;
>
> - /* reset command and data state machines */
> temp = readl(host->base + DAVINCI_MMCCTL);
> - writel(temp | MMCCTL_CMDRST | MMCCTL_DATRST,
> - host->base + DAVINCI_MMCCTL);
> + if (val) /* reset */
> + temp |= MMCCTL_CMDRST | MMCCTL_DATRST;
> + else /* enable */
> + temp &= ~(MMCCTL_CMDRST | MMCCTL_DATRST);
>
> - temp &= ~(MMCCTL_CMDRST | MMCCTL_DATRST);
> - udelay(10);
> writel(temp, host->base + DAVINCI_MMCCTL);
> + udelay(10);
> +}

nit: it's hard for a reader of the code to work out why a udelay() such
as the above was included. Perhaps the data sheet for the hardware
would tell him, if he has access to it.

But generally speaking, the code is better code if it explains the
reasoning to the reader.


\
 
 \ /
  Last update: 2010-01-13 00:39    [W:0.036 / U:0.556 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site