public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: dougthompson@xmission.com
Cc: greg@kroah.com, ralf@linux-mips.org, egor@pasemi.com,
	alan@lxorguk.ukuu.org.uk, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 3/4] include asm-mips add missing edac h file
Date: Wed, 25 Jul 2007 22:25:00 -0700	[thread overview]
Message-ID: <20070725222500.e537531d.akpm@linux-foundation.org> (raw)
In-Reply-To: <46a7b8a5.iyNdV9o+A3Vzog2D%dougthompson@xmission.com>

On Wed, 25 Jul 2007 14:55:01 -0600 dougthompson@xmission.com wrote:

> --- /dev/null
> +++ linux-2.6.23-rc1/include/asm-mips/edac.h
> @@ -0,0 +1,35 @@
> +#ifndef ASM_EDAC_H
> +#define ASM_EDAC_H
> +
> +/* ECC atomic, DMA, SMP and interrupt safe scrub function */
> +
> +static __inline__ void atomic_scrub(void *va, u32 size)

Please don't use __inline__ or __inline.  Good old "inline" will do.

<cc's the checkpatch maintainer>

<edits the diff>

> +{
> +	unsigned long *virt_addr = va;
> +	unsigned long temp;
> +	u32 i;
> +
> +	for (i = 0; i < size / sizeof(unsigned long); i++, virt_addr++) {
> +
> +		/*
> +		 * Very carefully read and write to memory atomically
> +		 * so we are interrupt, DMA and SMP safe.
> +		 *
> +		 * Intel: asm("lock; addl $0, %0"::"m"(*virt_addr));
> +		 */
> +
> +		__asm__ __volatile__ (
> +		"       .set    mips3                                   \n"
> +		"1:     ll      %0, %1          # atomic_add            \n"
> +		"       ll      %0, %1          # atomic_add            \n"
> +		"       addu    %0, $0                                  \n"
> +		"       sc      %0, %1                                  \n"
> +		"       beqz    %0, 1b                                  \n"
> +		"       .set    mips0                                   \n"
> +		: "=&r" (temp), "=m" (*virt_addr)
> +		: "m" (*virt_addr));
> +
> +	}
> +}

hm, I'd have thought that we could us plain old atomic_add() for this.

  reply	other threads:[~2007-07-26  5:25 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-07-25 20:55 [PATCH 3/4] include asm-mips add missing edac h file dougthompson
2007-07-26  5:25 ` Andrew Morton [this message]
2007-07-26 15:19   ` Doug Thompson

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=20070725222500.e537531d.akpm@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=dougthompson@xmission.com \
    --cc=egor@pasemi.com \
    --cc=greg@kroah.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=ralf@linux-mips.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