Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1275435 > unrolled thread

[PATCH] mtd: nand: use of_property_read_u8()

Started bySaurabh Sengar <saurabh.truth@gmail.com>
First post2015-11-23 15:30 +0100
Last post2015-11-23 19:10 +0100
Articles 4 — 3 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] mtd: nand: use of_property_read_u8() Saurabh Sengar <saurabh.truth@gmail.com> - 2015-11-23 15:30 +0100
    Re: [PATCH] mtd: nand: use of_property_read_u8() kbuild test robot <lkp@intel.com> - 2015-11-23 17:10 +0100
      [PATCH v2] mtd: nand: use of_property_read_u8() Saurabh Sengar <saurabh.truth@gmail.com> - 2015-11-23 17:20 +0100
        Re: [PATCH v2] mtd: nand: use of_property_read_u8() Geert Uytterhoeven <geert@linux-m68k.org> - 2015-11-23 19:10 +0100

#1275435 — [PATCH] mtd: nand: use of_property_read_u8()

FromSaurabh Sengar <saurabh.truth@gmail.com>
Date2015-11-23 15:30 +0100
Subject[PATCH] mtd: nand: use of_property_read_u8()
Message-ID<qy0hY-2Wb-35@gated-at.bofh.it>
use of_property_read_u8() for u8 values

Signed-off-by: Saurabh Sengar <saurabh.truth@gmail.com>
---
 drivers/mtd/nand/orion_nand.c | 22 +++++++---------------
 1 file changed, 7 insertions(+), 15 deletions(-)

diff --git a/drivers/mtd/nand/orion_nand.c b/drivers/mtd/nand/orion_nand.c
index ee83749..1a68145 100644
--- a/drivers/mtd/nand/orion_nand.c
+++ b/drivers/mtd/nand/orion_nand.c
@@ -83,7 +83,6 @@ static int __init orion_nand_probe(struct platform_device *pdev)
 	struct clk *clk;
 	void __iomem *io_base;
 	int ret = 0;
-	u32 val = 0;
 
 	nc = devm_kzalloc(&pdev->dev,
 			sizeof(struct nand_chip) + sizeof(struct mtd_info),
@@ -103,22 +102,15 @@ static int __init orion_nand_probe(struct platform_device *pdev)
 					GFP_KERNEL);
 		if (!board)
 			return -ENOMEM;
-		if (!of_property_read_u32(pdev->dev.of_node, "cle", &val))
-			board->cle = (u8)val;
-		else
-			board->cle = 0;
-		if (!of_property_read_u32(pdev->dev.of_node, "ale", &val))
-			board->ale = (u8)val;
-		else
+		of_property_read_u8(pdev->dev.of_node, "cle", &board->cle);
+
+		if (of_property_read_u8(pdev->dev.of_node, "ale", &board->ale))
 			board->ale = 1;
-		if (!of_property_read_u32(pdev->dev.of_node,
-						"bank-width", &val))
-			board->width = (u8)val * 8;
-		else
+		if (of_property_read_u8(pdev->dev.of_node,
+						"bank-width", &board->width))
 			board->width = 8;
-		if (!of_property_read_u32(pdev->dev.of_node,
-						"chip-delay", &val))
-			board->chip_delay = (u8)val;
+		of_property_read_u8(pdev->dev.of_node,
+					"chip-delay", &board->chip_delay)
 	} else {
 		board = dev_get_platdata(&pdev->dev);
 	}
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [next] | [standalone]


#1275521

Fromkbuild test robot <lkp@intel.com>
Date2015-11-23 17:10 +0100
Message-ID<qy1QL-48K-35@gated-at.bofh.it>
In reply to#1275435

[Multipart message — attachments visible in raw view] — view raw

Hi Saurabh,

[auto build test ERROR on mtd/master]
[also build test ERROR on v4.4-rc2 next-20151123]

url:    https://github.com/0day-ci/linux/commits/Saurabh-Sengar/mtd-nand-use-of_property_read_u8/20151123-222906
base:   git://git.infradead.org/linux-mtd.git master
config: arm-mvebu_v5_defconfig (attached as .config)
reproduce:
        wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # save the attached .config to linux build tree
        make.cross ARCH=arm 

All errors (new ones prefixed by >>):

   drivers/mtd/nand/orion_nand.c: In function 'orion_nand_probe':
>> drivers/mtd/nand/orion_nand.c:114:2: error: expected ';' before '}' token
     } else {
     ^

vim +114 drivers/mtd/nand/orion_nand.c

a0fabf722 Jamie Lentin      2012-04-18  108  			board->ale = 1;
c4d333ec0 Saurabh Sengar    2015-11-23  109  		if (of_property_read_u8(pdev->dev.of_node,
c4d333ec0 Saurabh Sengar    2015-11-23  110  						"bank-width", &board->width))
a0fabf722 Jamie Lentin      2012-04-18  111  			board->width = 8;
c4d333ec0 Saurabh Sengar    2015-11-23  112  		of_property_read_u8(pdev->dev.of_node,
c4d333ec0 Saurabh Sengar    2015-11-23  113  					"chip-delay", &board->chip_delay)
453810b79 Jingoo Han        2013-07-30 @114  	} else {
453810b79 Jingoo Han        2013-07-30  115  		board = dev_get_platdata(&pdev->dev);
453810b79 Jingoo Han        2013-07-30  116  	}
2a1dba293 Tzachi Perelstein 2007-10-17  117  

:::::: The code at line 114 was first introduced by commit
:::::: 453810b79571ff6622a481f0556fc4972f87a24f mtd: nand: use dev_get_platdata()

:::::: TO: Jingoo Han <jg1.han@samsung.com>
:::::: CC: David Woodhouse <David.Woodhouse@intel.com>

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

[toc] | [prev] | [next] | [standalone]


#1275564 — [PATCH v2] mtd: nand: use of_property_read_u8()

FromSaurabh Sengar <saurabh.truth@gmail.com>
Date2015-11-23 17:20 +0100
Subject[PATCH v2] mtd: nand: use of_property_read_u8()
Message-ID<qy20t-4cV-79@gated-at.bofh.it>
In reply to#1275521
use of_property_read_u8() for u8 values

Signed-off-by: Saurabh Sengar <saurabh.truth@gmail.com>
---
v2 :  added the missed semi colon
 drivers/mtd/nand/orion_nand.c | 22 +++++++---------------
 1 file changed, 7 insertions(+), 15 deletions(-)

diff --git a/drivers/mtd/nand/orion_nand.c b/drivers/mtd/nand/orion_nand.c
index ee83749..0cbebc5 100644
--- a/drivers/mtd/nand/orion_nand.c
+++ b/drivers/mtd/nand/orion_nand.c
@@ -83,7 +83,6 @@ static int __init orion_nand_probe(struct platform_device *pdev)
 	struct clk *clk;
 	void __iomem *io_base;
 	int ret = 0;
-	u32 val = 0;
 
 	nc = devm_kzalloc(&pdev->dev,
 			sizeof(struct nand_chip) + sizeof(struct mtd_info),
@@ -103,22 +102,15 @@ static int __init orion_nand_probe(struct platform_device *pdev)
 					GFP_KERNEL);
 		if (!board)
 			return -ENOMEM;
-		if (!of_property_read_u32(pdev->dev.of_node, "cle", &val))
-			board->cle = (u8)val;
-		else
-			board->cle = 0;
-		if (!of_property_read_u32(pdev->dev.of_node, "ale", &val))
-			board->ale = (u8)val;
-		else
+		of_property_read_u8(pdev->dev.of_node, "cle", &board->cle);
+
+		if (of_property_read_u8(pdev->dev.of_node, "ale", &board->ale))
 			board->ale = 1;
-		if (!of_property_read_u32(pdev->dev.of_node,
-						"bank-width", &val))
-			board->width = (u8)val * 8;
-		else
+		if (of_property_read_u8(pdev->dev.of_node,
+						"bank-width", &board->width))
 			board->width = 8;
-		if (!of_property_read_u32(pdev->dev.of_node,
-						"chip-delay", &val))
-			board->chip_delay = (u8)val;
+		of_property_read_u8(pdev->dev.of_node,
+					"chip-delay", &board->chip_delay);
 	} else {
 		board = dev_get_platdata(&pdev->dev);
 	}
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1275698 — Re: [PATCH v2] mtd: nand: use of_property_read_u8()

FromGeert Uytterhoeven <geert@linux-m68k.org>
Date2015-11-23 19:10 +0100
SubjectRe: [PATCH v2] mtd: nand: use of_property_read_u8()
Message-ID<qy3IS-5o5-7@gated-at.bofh.it>
In reply to#1275564
Hi Saurab,

On Mon, Nov 23, 2015 at 5:15 PM, Saurabh Sengar <saurabh.truth@gmail.com> wrote:
> use of_property_read_u8() for u8 values

Why are you making this change?
Have you tested this?

drivers/of/base.c says

     * dts entry of array should be like:
     *      property = /bits/ 8 <0x50 0x60 0x70>;

but Documentation/devicetree/bindings/mtd/orion-nand.txt doesn't say
anything about the "/bits/ 8" part, thus "normal" 32-bit cells are assumed.

> Signed-off-by: Saurabh Sengar <saurabh.truth@gmail.com>
> ---
> v2 :  added the missed semi colon
>  drivers/mtd/nand/orion_nand.c | 22 +++++++---------------
>  1 file changed, 7 insertions(+), 15 deletions(-)
>
> diff --git a/drivers/mtd/nand/orion_nand.c b/drivers/mtd/nand/orion_nand.c
> index ee83749..0cbebc5 100644
>
> --- a/drivers/mtd/nand/orion_nand.c
> +++ b/drivers/mtd/nand/orion_nand.c
> @@ -83,7 +83,6 @@ static int __init orion_nand_probe(struct platform_device *pdev)
>         struct clk *clk;
>         void __iomem *io_base;
>         int ret = 0;
> -       u32 val = 0;
>
>         nc = devm_kzalloc(&pdev->dev,
>                         sizeof(struct nand_chip) + sizeof(struct mtd_info),
> @@ -103,22 +102,15 @@ static int __init orion_nand_probe(struct platform_device *pdev)
>                                         GFP_KERNEL);
>                 if (!board)
>                         return -ENOMEM;
> -               if (!of_property_read_u32(pdev->dev.of_node, "cle", &val))
> -                       board->cle = (u8)val;
> -               else
> -                       board->cle = 0;
> -               if (!of_property_read_u32(pdev->dev.of_node, "ale", &val))
> -                       board->ale = (u8)val;
> -               else
> +               of_property_read_u8(pdev->dev.of_node, "cle", &board->cle);
> +
> +               if (of_property_read_u8(pdev->dev.of_node, "ale", &board->ale))
>                         board->ale = 1;
> -               if (!of_property_read_u32(pdev->dev.of_node,
> -                                               "bank-width", &val))
> -                       board->width = (u8)val * 8;
> -               else
> +               if (of_property_read_u8(pdev->dev.of_node,
> +                                               "bank-width", &board->width))
>                         board->width = 8;
> -               if (!of_property_read_u32(pdev->dev.of_node,
> -                                               "chip-delay", &val))
> -                       board->chip_delay = (u8)val;
> +               of_property_read_u8(pdev->dev.of_node,
> +                                       "chip-delay", &board->chip_delay);

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web