diff mbox

[v2,01/13] nand/fsmc: Pass partition information through platform data

Message ID cde13f8b2efacc7588963d4ca978f42514e2759c.1331705527.git.vipin.kumar@st.com
State New, archived
Headers show

Commit Message

Vipin Kumar March 14, 2012, 6:17 a.m. UTC
This patch reimplements the passing of partition information through platform
data. This was unintentionally deleted in commit
0d04eda1430e9a796214bee644b7e05d99cfe613
"mtd: fsmc_nand.c: use mtd_device_parse_register"

Signed-off-by: Vipin Kumar <vipin.kumar@st.com>
---
 drivers/mtd/nand/fsmc_nand.c |   15 ++++++++-------
 1 files changed, 8 insertions(+), 7 deletions(-)

Comments

Linus Walleij March 14, 2012, 11:06 a.m. UTC | #1
On Wed, Mar 14, 2012 at 7:17 AM, Vipin Kumar <vipin.kumar@st.com> wrote:

> This patch reimplements the passing of partition information through platform
> data. This was unintentionally deleted in commit
> 0d04eda1430e9a796214bee644b7e05d99cfe613
> "mtd: fsmc_nand.c: use mtd_device_parse_register"
>
> Signed-off-by: Vipin Kumar <vipin.kumar@st.com>

Acked/Reviewed/Signed -off-by: Linus Walleij <linus.walleij@linaro.org>

Also recommend adding Cc: stable@kernel.org on this then.

Thanks!
Linus Walleij
Stefan Roese March 14, 2012, 11:24 a.m. UTC | #2
On Wednesday 14 March 2012 07:17:07 Vipin Kumar wrote:
> This patch reimplements the passing of partition information through
> platform data. This was unintentionally deleted in commit
> 0d04eda1430e9a796214bee644b7e05d99cfe613
> "mtd: fsmc_nand.c: use mtd_device_parse_register"
> 
> Signed-off-by: Vipin Kumar <vipin.kumar@st.com>

Acked-by: Stefan Roese <sr@denx.de>

Thanks,
Stefan
Artem Bityutskiy March 14, 2012, 12:12 p.m. UTC | #3
On Wed, 2012-03-14 at 11:47 +0530, Vipin Kumar wrote:
> +	ret = mtd_device_parse_register(&host->mtd, NULL, 0, host->partitions,
> +			host->nr_partitions);

This causes a GCC warning about passing plain 0 as NULL. But I'll amend
the patch myself and fix this.
Artem Bityutskiy March 14, 2012, 12:13 p.m. UTC | #4
On Wed, 2012-03-14 at 12:06 +0100, Linus Walleij wrote:

> Acked/Reviewed/Signed -off-by: Linus Walleij <linus.walleij@linaro.org>
> 
> Also recommend adding Cc: stable@kernel.org on this then.

Thanks, I will add -stable to CC.
Vipin Kumar March 15, 2012, 3:34 a.m. UTC | #5
On 3/14/2012 5:42 PM, Artem Bityutskiy wrote:
> On Wed, 2012-03-14 at 11:47 +0530, Vipin Kumar wrote:
>> +	ret = mtd_device_parse_register(&host->mtd, NULL, 0, host->partitions,
>> +			host->nr_partitions);
>
> This causes a GCC warning about passing plain 0 as NULL. But I'll amend
> the patch myself and fix this.
>

Thanks Artem
diff mbox

Patch

diff --git a/drivers/mtd/nand/fsmc_nand.c b/drivers/mtd/nand/fsmc_nand.c
index 588e373..2d7683b 100644
--- a/drivers/mtd/nand/fsmc_nand.c
+++ b/drivers/mtd/nand/fsmc_nand.c
@@ -333,6 +333,8 @@  static struct mtd_partition partition_info_128KB_blk[] = {
  * @pid:		Part ID on the AMBA PrimeCell format
  * @mtd:		MTD info for a NAND flash.
  * @nand:		Chip related info for a NAND flash.
+ * @partitions:		Partition info for a NAND Flash.
+ * @nr_partitions:	Total number of partition of a NAND flash.
  *
  * @ecc_place:		ECC placing locations in oobfree type format.
  * @bank:		Bank number for probed device.
@@ -347,6 +349,8 @@  struct fsmc_nand_data {
 	u32			pid;
 	struct mtd_info		mtd;
 	struct nand_chip	nand;
+	struct mtd_partition	*partitions;
+	unsigned int		nr_partitions;
 
 	struct fsmc_eccplace	*ecc_place;
 	unsigned int		bank;
@@ -833,6 +837,8 @@  static int __init fsmc_nand_probe(struct platform_device *pdev)
 
 	host->bank = pdata->bank;
 	host->select_chip = pdata->select_bank;
+	host->partitions = pdata->partitions;
+	host->nr_partitions = pdata->nr_partitions;
 	regs = host->regs_va;
 
 	/* Link all private pointers */
@@ -942,13 +948,8 @@  static int __init fsmc_nand_probe(struct platform_device *pdev)
 	 * Check for partition info passed
 	 */
 	host->mtd.name = "nand";
-	ret = mtd_device_parse_register(&host->mtd, NULL, NULL,
-					host->mtd.size <= 0x04000000 ?
-					partition_info_16KB_blk :
-					partition_info_128KB_blk,
-					host->mtd.size <= 0x04000000 ?
-					ARRAY_SIZE(partition_info_16KB_blk) :
-					ARRAY_SIZE(partition_info_128KB_blk));
+	ret = mtd_device_parse_register(&host->mtd, NULL, 0, host->partitions,
+			host->nr_partitions);
 	if (ret)
 		goto err_probe;