Patchwork mtd: use the NAND_STATUS_FAIL to replace the hardcode

login
register
mail settings
Submitter Huang Shijie
Date Oct. 15, 2012, 3:47 a.m.
Message ID <1350272844-21866-1-git-send-email-shijie8@gmail.com>
Download mbox | patch
Permalink /patch/191367/
State New
Headers show

Comments

Huang Shijie - Oct. 15, 2012, 3:47 a.m.
Use the NAND_STATUS_FAIL to replace the hardcode "0x01",
which make the code more readable.

Signed-off-by: Huang Shijie <shijie8@gmail.com>
---
 drivers/mtd/nand/nand_base.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
Huang Shijie - Oct. 24, 2012, 6:14 a.m.
ping

On Mon, Oct 15, 2012 at 11:47 AM, Huang Shijie <shijie8@gmail.com> wrote:
> Use the NAND_STATUS_FAIL to replace the hardcode "0x01",
> which make the code more readable.
>
> Signed-off-by: Huang Shijie <shijie8@gmail.com>
> ---
>  drivers/mtd/nand/nand_base.c |    4 ++--
>  1 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c
> index d5ece6e..4569174 100644
> --- a/drivers/mtd/nand/nand_base.c
> +++ b/drivers/mtd/nand/nand_base.c
> @@ -899,7 +899,7 @@ static int __nand_unlock(struct mtd_info *mtd, loff_t ofs,
>         /* Call wait ready function */
>         status = chip->waitfunc(mtd, chip);
>         /* See if device thinks it succeeded */
> -       if (status & 0x01) {
> +       if (status & NAND_STATUS_FAIL) {
>                 pr_debug("%s: error status = 0x%08x\n",
>                                         __func__, status);
>                 ret = -EIO;
> @@ -1004,7 +1004,7 @@ int nand_lock(struct mtd_info *mtd, loff_t ofs, uint64_t len)
>         /* Call wait ready function */
>         status = chip->waitfunc(mtd, chip);
>         /* See if device thinks it succeeded */
> -       if (status & 0x01) {
> +       if (status & NAND_STATUS_FAIL) {
>                 pr_debug("%s: error status = 0x%08x\n",
>                                         __func__, status);
>                 ret = -EIO;
> --
> 1.7.4.4
>
Brian Norris - Oct. 25, 2012, 4:07 p.m.
FWIW

On Sun, Oct 14, 2012 at 8:47 PM, Huang Shijie <shijie8@gmail.com> wrote:
> Use the NAND_STATUS_FAIL to replace the hardcode "0x01",
> which make the code more readable.
>
> Signed-off-by: Huang Shijie <shijie8@gmail.com>

Acked-by: Brian Norris <computersforpeace@gmail.com>
Artem Bityutskiy - Oct. 26, 2012, 2:22 p.m.
On Sun, 2012-10-14 at 23:47 -0400, Huang Shijie wrote:
> Use the NAND_STATUS_FAIL to replace the hardcode "0x01",
> which make the code more readable.
> 
> Signed-off-by: Huang Shijie <shijie8@gmail.com>

Pushed to l2-mtd.git, thanks!

Patch

diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c
index d5ece6e..4569174 100644
--- a/drivers/mtd/nand/nand_base.c
+++ b/drivers/mtd/nand/nand_base.c
@@ -899,7 +899,7 @@  static int __nand_unlock(struct mtd_info *mtd, loff_t ofs,
 	/* Call wait ready function */
 	status = chip->waitfunc(mtd, chip);
 	/* See if device thinks it succeeded */
-	if (status & 0x01) {
+	if (status & NAND_STATUS_FAIL) {
 		pr_debug("%s: error status = 0x%08x\n",
 					__func__, status);
 		ret = -EIO;
@@ -1004,7 +1004,7 @@  int nand_lock(struct mtd_info *mtd, loff_t ofs, uint64_t len)
 	/* Call wait ready function */
 	status = chip->waitfunc(mtd, chip);
 	/* See if device thinks it succeeded */
-	if (status & 0x01) {
+	if (status & NAND_STATUS_FAIL) {
 		pr_debug("%s: error status = 0x%08x\n",
 					__func__, status);
 		ret = -EIO;