[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1459937147-8173-1-git-send-email-zengzhaoxiu@163.com>
Date: Wed, 6 Apr 2016 18:05:47 +0800
From: zengzhaoxiu@....com
To: dwmw2@...radead.org, computersforpeace@...il.com
Cc: linux-mtd@...ts.infradead.org, linux-kernel@...r.kernel.org,
Zhaoxiu Zeng <zhaoxiu.zeng@...il.com>
Subject: [PATCH v2 23/30] mtd: use parity16 in sm_ftl
From: Zhaoxiu Zeng <zhaoxiu.zeng@...il.com>
Signed-off-by: Zhaoxiu Zeng <zhaoxiu.zeng@...il.com>
---
drivers/mtd/sm_ftl.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/drivers/mtd/sm_ftl.c b/drivers/mtd/sm_ftl.c
index b096f8b..345ff1a 100644
--- a/drivers/mtd/sm_ftl.c
+++ b/drivers/mtd/sm_ftl.c
@@ -136,7 +136,7 @@ static int sm_get_lba(uint8_t *lba)
return -2;
/* check parity - endianness doesn't matter */
- if (hweight16(*(uint16_t *)lba) & 1)
+ if (parity16(*(uint16_t *)lba))
return -2;
return (lba[1] >> 1) | ((lba[0] & 0x07) << 7);
@@ -183,8 +183,7 @@ static void sm_write_lba(struct sm_oob *oob, uint16_t lba)
tmp[0] = 0x10 | ((lba >> 7) & 0x07);
tmp[1] = (lba << 1) & 0xFF;
- if (hweight16(*(uint16_t *)tmp) & 0x01)
- tmp[1] |= 1;
+ tmp[1] |= parity16(*(uint16_t *)tmp);
oob->lba_copy1[0] = oob->lba_copy2[0] = tmp[0];
oob->lba_copy1[1] = oob->lba_copy2[1] = tmp[1];
--
2.5.0
Powered by blists - more mailing lists