aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mtd
diff options
context:
space:
mode:
authorDavid Woodhouse <David.Woodhouse@intel.com>2008-08-16 06:01:31 -0400
committerDavid Woodhouse <David.Woodhouse@intel.com>2008-08-16 06:01:31 -0400
commitccbcd6cba5ef6e071deb072188ad044921f6b91e (patch)
treeb6b290e1e46bcf820d42d795a0c7604cbc0d0973 /drivers/mtd
parente6cf5df1838c28bb060ac45b5585e48e71bbc740 (diff)
[MTD] [NAND] Minor cleanup of nand_ecc.c
Make the standalone stuff a little cleaner, fix some checkpatch warnings. Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
Diffstat (limited to 'drivers/mtd')
-rw-r--r--drivers/mtd/nand/nand_ecc.c20
1 files changed, 9 insertions, 11 deletions
diff --git a/drivers/mtd/nand/nand_ecc.c b/drivers/mtd/nand/nand_ecc.c
index 7129da51bb33..a8e8413ca2bc 100644
--- a/drivers/mtd/nand/nand_ecc.c
+++ b/drivers/mtd/nand/nand_ecc.c
@@ -4,15 +4,15 @@
4 * 4 *
5 * drivers/mtd/nand/nand_ecc.c 5 * drivers/mtd/nand/nand_ecc.c
6 * 6 *
7 * Copyright (C) 2008 Koninklijke Philips Electronics NV. 7 * Copyright © 2008 Koninklijke Philips Electronics NV.
8 * Author: Frans Meulenbroeks 8 * Author: Frans Meulenbroeks
9 * 9 *
10 * Completely replaces the previous ECC implementation which was written by: 10 * Completely replaces the previous ECC implementation which was written by:
11 * Steven J. Hill (sjhill@realitydiluted.com) 11 * Steven J. Hill (sjhill@realitydiluted.com)
12 * Thomas Gleixner (tglx@linutronix.de) 12 * Thomas Gleixner (tglx@linutronix.de)
13 * 13 *
14 * Information on how this algorithm works and how it was developed 14 * Information on how this algorithm works and how it was developed
15 * can be found in Documentation/nand/ecc.txt 15 * can be found in Documentation/mtd/nand_ecc.txt
16 * 16 *
17 * This file is free software; you can redistribute it and/or modify it 17 * This file is free software; you can redistribute it and/or modify it
18 * under the terms of the GNU General Public License as published by the 18 * under the terms of the GNU General Public License as published by the
@@ -35,7 +35,7 @@
35 * e.g. when running the code in a testbed or a benchmark program. 35 * e.g. when running the code in a testbed or a benchmark program.
36 * When STANDALONE is used, the module related macros are commented out 36 * When STANDALONE is used, the module related macros are commented out
37 * as well as the linux include files. 37 * as well as the linux include files.
38 * Instead a private definition of mtd_into is given to satisfy the compiler 38 * Instead a private definition of mtd_info is given to satisfy the compiler
39 * (the code does not use mtd_info, so the code does not care) 39 * (the code does not use mtd_info, so the code does not care)
40 */ 40 */
41#ifndef STANDALONE 41#ifndef STANDALONE
@@ -44,10 +44,8 @@
44#include <linux/module.h> 44#include <linux/module.h>
45#include <linux/mtd/nand_ecc.h> 45#include <linux/mtd/nand_ecc.h>
46#else 46#else
47typedef uint32_t unsigned long 47#include <stdint.h>
48struct mtd_info { 48struct mtd_info;
49 int dummy;
50};
51#define EXPORT_SYMBOL(x) /* x */ 49#define EXPORT_SYMBOL(x) /* x */
52 50
53#define MODULE_LICENSE(x) /* x */ 51#define MODULE_LICENSE(x) /* x */
@@ -409,7 +407,7 @@ int nand_correct_data(struct mtd_info *mtd, unsigned char *buf,
409 /* repeated if statements are slightly more efficient than switch ... */ 407 /* repeated if statements are slightly more efficient than switch ... */
410 /* ordered in order of likelihood */ 408 /* ordered in order of likelihood */
411 if (nr_bits == 0) 409 if (nr_bits == 0)
412 return (0); /* no error */ 410 return 0; /* no error */
413 if (nr_bits == 11) { /* correctable error */ 411 if (nr_bits == 11) { /* correctable error */
414 /* 412 /*
415 * rp15/13/11/9/7/5/3/1 indicate which byte is the faulty byte 413 * rp15/13/11/9/7/5/3/1 indicate which byte is the faulty byte
@@ -431,10 +429,10 @@ int nand_correct_data(struct mtd_info *mtd, unsigned char *buf,
431 bit_addr = addressbits[b2 >> 2]; 429 bit_addr = addressbits[b2 >> 2];
432 /* flip the bit */ 430 /* flip the bit */
433 buf[byte_addr] ^= (1 << bit_addr); 431 buf[byte_addr] ^= (1 << bit_addr);
434 return (1); 432 return 1;
435 } 433 }
436 if (nr_bits == 1) 434 if (nr_bits == 1)
437 return (1); /* error in ecc data; no action needed */ 435 return 1; /* error in ecc data; no action needed */
438 return -1; 436 return -1;
439} 437}
440EXPORT_SYMBOL(nand_correct_data); 438EXPORT_SYMBOL(nand_correct_data);