Patchwork [v2] mtd/docg3: fixes and cleanups

login
register
mail settings
Submitter Robert Jarzmik
Date Nov. 29, 2011, 10:09 p.m.
Message ID <1322604577-12309-1-git-send-email-robert.jarzmik@free.fr>
Download mbox | patch
Permalink /patch/128348/
State New
Headers show

Comments

Robert Jarzmik - Nov. 29, 2011, 10:09 p.m.
This patch takes into account checkpatch, sparse and ECC
comments.

Signed-off-by: Robert Jarzmik <robert.jarzmik@free.fr>

---
Since V1: Stephen Rothwell comment
---
 drivers/mtd/devices/docg3.c |   16 ++++++++--------
 drivers/mtd/devices/docg3.h |    1 +
 2 files changed, 9 insertions(+), 8 deletions(-)
Artem Bityutskiy - Dec. 1, 2011, 8:05 a.m.
On Tue, 2011-11-29 at 23:09 +0100, Robert Jarzmik wrote:
> This patch takes into account checkpatch, sparse and ECC
> comments.
> 
> Signed-off-by: Robert Jarzmik <robert.jarzmik@free.fr>

Could you please send a patch which cleanly applies to l2-mtd-2.6.git -
this does not. This one does not apply both before and after Dan's
patch.

Artem.
Robert Jarzmik - Dec. 2, 2011, 6:57 p.m.
Artem Bityutskiy <dedekind1@gmail.com> writes:

> On Tue, 2011-11-29 at 23:09 +0100, Robert Jarzmik wrote:
>> This patch takes into account checkpatch, sparse and ECC
>> comments.
>> 
>> Signed-off-by: Robert Jarzmik <robert.jarzmik@free.fr>
>
> Could you please send a patch which cleanly applies to l2-mtd-2.6.git -
> this does not. This one does not apply both before and after Dan's
> patch.

Yes, of course. I don't know what happened there.
The v3 in a next mail (which is what v2 should have been).

Cheers.

--
Robert

Patch

diff --git a/drivers/mtd/devices/docg3.c b/drivers/mtd/devices/docg3.c
index d6c9599..867226e 100644
--- a/drivers/mtd/devices/docg3.c
+++ b/drivers/mtd/devices/docg3.c
@@ -61,7 +61,7 @@ 
  *
  */
 
-static unsigned int reliable_mode = 0;
+static unsigned int reliable_mode;
 module_param(reliable_mode, uint, 0);
 MODULE_PARM_DESC(reliable_mode, "Set the docg3 mode (0=normal MLC, 1=fast, "
 		 "2=reliable) : MLC normal operations are in normal mode");
@@ -573,7 +573,7 @@  static int doc_read_page_ecc_init(struct docg3 *docg3, int len)
  */
 static int doc_write_page_ecc_init(struct docg3 *docg3, int len)
 {
-	doc_writew(docg3, !DOC_ECCCONF0_READ_MODE
+	doc_writew(docg3, DOC_ECCCONF0_WRITE_MODE
 		   | DOC_ECCCONF0_BCH_ENABLE | DOC_ECCCONF0_HAMMING_ENABLE
 		   | (len & DOC_ECCCONF0_DATA_BYTES_MASK),
 		   DOC_ECCCONF0);
@@ -763,14 +763,14 @@  static void doc_write_page_putbytes(struct docg3 *docg3, int len,
 /**
  * doc_get_bch_hw_ecc - Get hardware calculated BCH ECC
  * @docg3: the device
- * @syns:  the array of 7 integers where the hardware ecc will be stored
+ * @hwecc:  the array of 7 integers where the hardware ecc will be stored
  */
-static void doc_get_bch_hw_ecc(struct docg3 *docg3, u8 *syns)
+static void doc_get_bch_hw_ecc(struct docg3 *docg3, u8 *hwecc)
 {
 	int i;
 
 	for (i = 0; i < DOC_ECC_BCH_SIZE; i++)
-		syns[i] = doc_register_readb(docg3, DOC_BCH_HW_ECC(i));
+		hwecc[i] = doc_register_readb(docg3, DOC_BCH_HW_ECC(i));
 }
 
 /**
@@ -1248,7 +1248,7 @@  static int doc_write_page(struct docg3 *docg3, loff_t to, const u_char *buf,
 			  const u_char *oob, int autoecc)
 {
 	int block0, block1, page, ret, ofs = 0;
-	u8 syn[DOC_ECC_BCH_SIZE], hamming;
+	u8 hwecc[DOC_ECC_BCH_SIZE], hamming;
 
 	doc_dbg("doc_write_page(to=%lld)\n", to);
 	calc_block_sector(to, &block0, &block1, &page, &ofs, docg3->reliable);
@@ -1278,8 +1278,8 @@  static int doc_write_page(struct docg3 *docg3, loff_t to, const u_char *buf,
 					&hamming);
 		doc_delay(docg3, 2);
 
-		doc_get_bch_hw_ecc(docg3, syn);
-		doc_write_page_putbytes(docg3, DOC_LAYOUT_OOB_BCH_SZ, syn);
+		doc_get_bch_hw_ecc(docg3, hwecc);
+		doc_write_page_putbytes(docg3, DOC_LAYOUT_OOB_BCH_SZ, hwecc);
 		doc_delay(docg3, 2);
 
 		doc_write_page_putbytes(docg3, DOC_LAYOUT_OOB_UNUSED_SZ, oob);
diff --git a/drivers/mtd/devices/docg3.h b/drivers/mtd/devices/docg3.h
index b1ae919..db0da43 100644
--- a/drivers/mtd/devices/docg3.h
+++ b/drivers/mtd/devices/docg3.h
@@ -193,6 +193,7 @@ 
 /*
  * Flash register : DOC_ECCCONF0
  */
+#define DOC_ECCCONF0_WRITE_MODE		0x0000
 #define DOC_ECCCONF0_READ_MODE		0x8000
 #define DOC_ECCCONF0_AUTO_ECC_ENABLE	0x4000
 #define DOC_ECCCONF0_HAMMING_ENABLE	0x1000