All of lore.kernel.org
 help / color / mirror / Atom feed
From: Roger Quadros <rogerq@ti.com>
To: Adam Ford <aford173@gmail.com>,
	Boris Brezillon <boris.brezillon@free-electrons.com>
Cc: "Leto, Enrico" <enrico.leto@siemens.com>,
	linux-omap@vger.kernel.org, linux-mtd@lists.infradead.org
Subject: Re: Passing NAND mtdparts to OMAP2+ Kernel
Date: Wed, 29 Mar 2017 15:41:07 +0300	[thread overview]
Message-ID: <04afe149-24b2-daec-5ef0-2d662ed79040@ti.com> (raw)
In-Reply-To: <CAHCN7xKhRub4k8BpkPPjPFhjJU5c2xRd_VKPMfVOc88ZaTUmGQ@mail.gmail.com>

Adam,

On 29/03/17 14:39, Adam Ford wrote:
> On Tue, Mar 28, 2017 at 2:57 PM, Boris Brezillon
> <boris.brezillon@free-electrons.com> wrote:
>> +Roger and Enrico
>>
>> On Tue, 28 Mar 2017 10:43:01 -0500
>> Adam Ford <aford173@gmail.com> wrote:
>>
>>> I posted this on the linux-omap list, and I was asked to post this on
>>> the linux-mtd list:
>>>
>>>
>>> I tried to remove the MTD partitions from the Linux device tree, and I
>>> noticed that there was no partition information being pushed anymore
>>> unless I changed the mtdparts name in U-Boot.
>>>
>>> It appears as if the MTD drivers have changed a bit.  I found a few
>>> e-mails floating around that attempt to fix this
>>>
>>> Commit f7a8e38f07a17be907585 ("mtd: nand: assign reasonable default
>>> name for NAND drivers") attempts to address this, and someone over at
>>> https://patchwork.ozlabs.org/patch/707065/ attempted to address it as
>>> well in a slightly different way.
>>
>> Can you test the patch and let me know if solves the problem. If it
>> does, I'll send a clean version of the patch and queue it for 4.12.
>>
> 
> I tried to apply the patch directly, but it failed.  I then manually
> copy-pasted it into the proper place, but it fails to compile.
> 
> drivers/mtd/nand/omap2.c: In function ‘omap_nand_probe’:
> drivers/mtd/nand/omap2.c:1859:14: error: implicit declaration of
> function ‘devm_kasprinf’ [-Werror=implicit-function-declaration]
>   mtd->name = devm_kasprinf(&pdev->dev, "omap2-nand.%d", info->gpmc_cs);
>               ^~~~~~~~~~~~~
> drivers/mtd/nand/omap2.c:1859:12: warning: assignment makes pointer
> from integer without a cast [-Wint-conversion]
>   mtd->name = devm_kasprinf(&pdev->dev, "omap2-nand.%d", info->gpmc_cs);
>             ^
> cc1: some warnings being treated as errors
> 
> I use buildroot to build my toolchain and I am using gcc version 6.3.0
> with glibc 2.24.  Is there supposed to be an include somewhere?  I am
> not familiar with devm_kasprinf.
> 
> 

Does the below patch work for you?

cheers,
-roger

---
 drivers/mtd/nand/omap2.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/drivers/mtd/nand/omap2.c b/drivers/mtd/nand/omap2.c
index 2a52101..f693b8d 100644
--- a/drivers/mtd/nand/omap2.c
+++ b/drivers/mtd/nand/omap2.c
@@ -1856,6 +1856,13 @@ static int omap_nand_probe(struct platform_device *pdev)
 	nand_chip->ecc.priv	= NULL;
 	nand_set_flash_node(nand_chip, dev->of_node);
 
+	mtd->name = devm_kasprintf(&pdev->dev, GFP_KERNEL, "omap2-nand.%d",
+				   info->gpmc_cs);
+	if (!mtd->name) {
+		dev_err(&pdev->dev, "Failed to set MTD name\n");
+		return -ENOMEM;
+	}
+
 	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
 	nand_chip->IO_ADDR_R = devm_ioremap_resource(&pdev->dev, res);
 	if (IS_ERR(nand_chip->IO_ADDR_R))
-- 
2.7.4



______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

WARNING: multiple messages have this Message-ID (diff)
From: Roger Quadros <rogerq@ti.com>
To: Adam Ford <aford173@gmail.com>,
	Boris Brezillon <boris.brezillon@free-electrons.com>
Cc: <linux-omap@vger.kernel.org>, <linux-mtd@lists.infradead.org>,
	"Leto, Enrico" <enrico.leto@siemens.com>
Subject: Re: Passing NAND mtdparts to OMAP2+ Kernel
Date: Wed, 29 Mar 2017 15:41:07 +0300	[thread overview]
Message-ID: <04afe149-24b2-daec-5ef0-2d662ed79040@ti.com> (raw)
In-Reply-To: <CAHCN7xKhRub4k8BpkPPjPFhjJU5c2xRd_VKPMfVOc88ZaTUmGQ@mail.gmail.com>

Adam,

On 29/03/17 14:39, Adam Ford wrote:
> On Tue, Mar 28, 2017 at 2:57 PM, Boris Brezillon
> <boris.brezillon@free-electrons.com> wrote:
>> +Roger and Enrico
>>
>> On Tue, 28 Mar 2017 10:43:01 -0500
>> Adam Ford <aford173@gmail.com> wrote:
>>
>>> I posted this on the linux-omap list, and I was asked to post this on
>>> the linux-mtd list:
>>>
>>>
>>> I tried to remove the MTD partitions from the Linux device tree, and I
>>> noticed that there was no partition information being pushed anymore
>>> unless I changed the mtdparts name in U-Boot.
>>>
>>> It appears as if the MTD drivers have changed a bit.  I found a few
>>> e-mails floating around that attempt to fix this
>>>
>>> Commit f7a8e38f07a17be907585 ("mtd: nand: assign reasonable default
>>> name for NAND drivers") attempts to address this, and someone over at
>>> https://patchwork.ozlabs.org/patch/707065/ attempted to address it as
>>> well in a slightly different way.
>>
>> Can you test the patch and let me know if solves the problem. If it
>> does, I'll send a clean version of the patch and queue it for 4.12.
>>
> 
> I tried to apply the patch directly, but it failed.  I then manually
> copy-pasted it into the proper place, but it fails to compile.
> 
> drivers/mtd/nand/omap2.c: In function ‘omap_nand_probe’:
> drivers/mtd/nand/omap2.c:1859:14: error: implicit declaration of
> function ‘devm_kasprinf’ [-Werror=implicit-function-declaration]
>   mtd->name = devm_kasprinf(&pdev->dev, "omap2-nand.%d", info->gpmc_cs);
>               ^~~~~~~~~~~~~
> drivers/mtd/nand/omap2.c:1859:12: warning: assignment makes pointer
> from integer without a cast [-Wint-conversion]
>   mtd->name = devm_kasprinf(&pdev->dev, "omap2-nand.%d", info->gpmc_cs);
>             ^
> cc1: some warnings being treated as errors
> 
> I use buildroot to build my toolchain and I am using gcc version 6.3.0
> with glibc 2.24.  Is there supposed to be an include somewhere?  I am
> not familiar with devm_kasprinf.
> 
> 

Does the below patch work for you?

cheers,
-roger

---
 drivers/mtd/nand/omap2.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/drivers/mtd/nand/omap2.c b/drivers/mtd/nand/omap2.c
index 2a52101..f693b8d 100644
--- a/drivers/mtd/nand/omap2.c
+++ b/drivers/mtd/nand/omap2.c
@@ -1856,6 +1856,13 @@ static int omap_nand_probe(struct platform_device *pdev)
 	nand_chip->ecc.priv	= NULL;
 	nand_set_flash_node(nand_chip, dev->of_node);
 
+	mtd->name = devm_kasprintf(&pdev->dev, GFP_KERNEL, "omap2-nand.%d",
+				   info->gpmc_cs);
+	if (!mtd->name) {
+		dev_err(&pdev->dev, "Failed to set MTD name\n");
+		return -ENOMEM;
+	}
+
 	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
 	nand_chip->IO_ADDR_R = devm_ioremap_resource(&pdev->dev, res);
 	if (IS_ERR(nand_chip->IO_ADDR_R))
-- 
2.7.4

  reply	other threads:[~2017-03-29 12:41 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-28 15:43 Passing NAND mtdparts to OMAP2+ Kernel Adam Ford
2017-03-28 15:43 ` Adam Ford
2017-03-28 19:57 ` Boris Brezillon
2017-03-28 19:57   ` Boris Brezillon
2017-03-29 11:39   ` Adam Ford
2017-03-29 11:39     ` Adam Ford
2017-03-29 12:41     ` Roger Quadros [this message]
2017-03-29 12:41       ` Roger Quadros
2017-03-29 13:10       ` Boris Brezillon
2017-03-29 13:10         ` Boris Brezillon
2017-03-29 13:18         ` Boris Brezillon
2017-03-29 13:18           ` Boris Brezillon
2017-03-29 14:06           ` Roger Quadros
2017-03-29 14:06             ` Roger Quadros
2017-03-29 19:59             ` Adam Ford
2017-03-29 19:59               ` Adam Ford

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=04afe149-24b2-daec-5ef0-2d662ed79040@ti.com \
    --to=rogerq@ti.com \
    --cc=aford173@gmail.com \
    --cc=boris.brezillon@free-electrons.com \
    --cc=enrico.leto@siemens.com \
    --cc=linux-mtd@lists.infradead.org \
    --cc=linux-omap@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.