linux-mtd.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] plat_ram: call mtd_device_register only if partition data exists
@ 2011-12-12 23:37 Ilya Yanok
  2011-12-17 15:31 ` Artem Bityutskiy
  0 siblings, 1 reply; 4+ messages in thread
From: Ilya Yanok @ 2011-12-12 23:37 UTC (permalink / raw)
  To: linux-mtd; +Cc: Ilya Yanok

mtd_device_parse_register() registers the device as a whole if no
partition data is passed so there is no reason to call
mtd_device_register() after that.

Signed-off-by: Ilya Yanok <yanok@emcraft.com>
---
 drivers/mtd/maps/plat-ram.c |   12 ++++++++----
 1 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/drivers/mtd/maps/plat-ram.c b/drivers/mtd/maps/plat-ram.c
index 94f5534..45876d0 100644
--- a/drivers/mtd/maps/plat-ram.c
+++ b/drivers/mtd/maps/plat-ram.c
@@ -227,10 +227,14 @@ static int platram_probe(struct platform_device *pdev)
 	if (!err)
 		dev_info(&pdev->dev, "registered mtd device\n");
 
-	/* add the whole device. */
-	err = mtd_device_register(info->mtd, NULL, 0);
-	if (err)
-		dev_err(&pdev->dev, "failed to register the entire device\n");
+	if (pdata->nr_partitions) {
+		/* add the whole device. */
+		err = mtd_device_register(info->mtd, NULL, 0);
+		if (err) {
+			dev_err(&pdev->dev,
+				"failed to register the entire device\n");
+		}
+	}
 
 	return err;
 
-- 
1.7.6.4

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] plat_ram: call mtd_device_register only if partition data exists
  2011-12-12 23:37 [PATCH] plat_ram: call mtd_device_register only if partition data exists Ilya Yanok
@ 2011-12-17 15:31 ` Artem Bityutskiy
  2011-12-17 22:26   ` Ilya Yanok
  0 siblings, 1 reply; 4+ messages in thread
From: Artem Bityutskiy @ 2011-12-17 15:31 UTC (permalink / raw)
  To: Ilya Yanok; +Cc: linux-mtd

[-- Attachment #1: Type: text/plain, Size: 428 bytes --]

On Tue, 2011-12-13 at 00:37 +0100, Ilya Yanok wrote:
> mtd_device_parse_register() registers the device as a whole if no
> partition data is passed so there is no reason to call
> mtd_device_register() after that.
> 
> Signed-off-by: Ilya Yanok <yanok@emcraft.com>

This seems to be a bug-fix, right? What happens without this patch?
We end up with 2 MTD equivalent MTD devices?

-- 
Best Regards,
Artem Bityutskiy

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] plat_ram: call mtd_device_register only if partition data exists
  2011-12-17 15:31 ` Artem Bityutskiy
@ 2011-12-17 22:26   ` Ilya Yanok
  2011-12-18 11:49     ` Artem Bityutskiy
  0 siblings, 1 reply; 4+ messages in thread
From: Ilya Yanok @ 2011-12-17 22:26 UTC (permalink / raw)
  To: dedekind1; +Cc: linux-mtd

Hi Artem,

On 17.12.2011 19:31, Artem Bityutskiy wrote:
>> mtd_device_parse_register() registers the device as a whole if no
>> partition data is passed so there is no reason to call
>> mtd_device_register() after that.
>>
>> Signed-off-by: Ilya Yanok <yanok@emcraft.com>
> 
> This seems to be a bug-fix, right? What happens without this patch?

Right.

> We end up with 2 MTD equivalent MTD devices?

Yes (only second one shown in /proc/mtd) and a warning for kobject:

kobject (cf2c10e0): tried to init an initialized object, something is
seriously wrong.

Regards, Ilya.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] plat_ram: call mtd_device_register only if partition data exists
  2011-12-17 22:26   ` Ilya Yanok
@ 2011-12-18 11:49     ` Artem Bityutskiy
  0 siblings, 0 replies; 4+ messages in thread
From: Artem Bityutskiy @ 2011-12-18 11:49 UTC (permalink / raw)
  To: Ilya Yanok; +Cc: linux-mtd

[-- Attachment #1: Type: text/plain, Size: 822 bytes --]

On Sun, 2011-12-18 at 02:26 +0400, Ilya Yanok wrote:
> Hi Artem,
> 
> On 17.12.2011 19:31, Artem Bityutskiy wrote:
> >> mtd_device_parse_register() registers the device as a whole if no
> >> partition data is passed so there is no reason to call
> >> mtd_device_register() after that.
> >>
> >> Signed-off-by: Ilya Yanok <yanok@emcraft.com>
> > 
> > This seems to be a bug-fix, right? What happens without this patch?
> 
> Right.
> 
> > We end up with 2 MTD equivalent MTD devices?
> 
> Yes (only second one shown in /proc/mtd) and a warning for kobject:
> 
> kobject (cf2c10e0): tried to init an initialized object, something is
> seriously wrong.

OK, then I'll ping David Woodhouse to merge this before 3.2 release.
Taken to l2-mtd-2.6.git so far, thanks!

-- 
Best Regards,
Artem Bityutskiy

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2011-12-18 11:47 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-12-12 23:37 [PATCH] plat_ram: call mtd_device_register only if partition data exists Ilya Yanok
2011-12-17 15:31 ` Artem Bityutskiy
2011-12-17 22:26   ` Ilya Yanok
2011-12-18 11:49     ` Artem Bityutskiy

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).