public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: Chaithrika U S <chaithrika@ti.com>
Cc: linux-kernel@vger.kernel.org,
	davinci-linux-open-source@linux.davincidsp.com,
	khilman@deeprootsystems.com
Subject: Re: [PATCH v3 1/2] davinci: MMC: Add a function to control reset state of the controller
Date: Tue, 12 Jan 2010 15:36:57 -0800	[thread overview]
Message-ID: <20100112153657.f3474ab8.akpm@linux-foundation.org> (raw)
In-Reply-To: <1262950729-12502-1-git-send-email-chaithrika@ti.com>

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.

      reply	other threads:[~2010-01-12 23:37 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-01-08 11:38 [PATCH v3 1/2] davinci: MMC: Add a function to control reset state of the controller Chaithrika U S
2010-01-12 23:36 ` Andrew Morton [this message]

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=20100112153657.f3474ab8.akpm@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=chaithrika@ti.com \
    --cc=davinci-linux-open-source@linux.davincidsp.com \
    --cc=khilman@deeprootsystems.com \
    --cc=linux-kernel@vger.kernel.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