public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
* physmap without MTD partitions
@ 2008-06-07 15:01 Robert Jarzmik
  2008-06-16  9:50 ` Jörn Engel
  0 siblings, 1 reply; 4+ messages in thread
From: Robert Jarzmik @ 2008-06-07 15:01 UTC (permalink / raw)
  To: linux-mtd

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

Hello,

I'm using physmap driver without MTD partitions (accessing the memory directly
through /dev/mtd0).
On suspend/resume/shutdown I get kernel stacks.

This is my configuration :
CONFIG_ARCH_MTD_XIP=y
CONFIG_MTD=y
CONFIG_MTD_CHAR=y
CONFIG_MTD_MAP_BANK_WIDTH_1=y
CONFIG_MTD_MAP_BANK_WIDTH_2=y
CONFIG_MTD_MAP_BANK_WIDTH_4=y
CONFIG_MTD_CFI_I1=y
CONFIG_MTD_CFI_I2=y
CONFIG_MTD_ROM=y
CONFIG_MTD_PHYSMAP=y
CONFIG_MTD_PHYSMAP_START=0x00000000
CONFIG_MTD_PHYSMAP_LEN=0x0
CONFIG_MTD_PHYSMAP_BANKWIDTH=2

This is the patch I used to solve the problem. Would someone consider
merging/reviewing it please ?

--
Robert


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Fix-suspend-resume-shutdown-bugs.patch --]
[-- Type: text/x-diff, Size: 1685 bytes --]

>From 048b1131b186640c6d99be371698a035069f0fc8 Mon Sep 17 00:00:00 2001
From: Robert Jarzmik <rjarzmik@free.fr>
Date: Sat, 7 Jun 2008 16:59:05 +0200
Subject: [PATCH] Fix suspend/resume/shutdown bugs.

Don't call suspend/resume functions if they have not been
defined.

Signed-off-by: Robert Jarzmik <rjarzmik@free.fr>
---
 drivers/mtd/maps/physmap.c |   12 ++++++++----
 1 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/drivers/mtd/maps/physmap.c b/drivers/mtd/maps/physmap.c
index 183255f..541d582 100644
--- a/drivers/mtd/maps/physmap.c
+++ b/drivers/mtd/maps/physmap.c
@@ -203,7 +203,8 @@ static int physmap_flash_suspend(struct platform_device *dev, pm_message_t state
 	int i;
 
 	for (i = 0; i < MAX_RESOURCES && info->mtd[i]; i++)
-		ret |= info->mtd[i]->suspend(info->mtd[i]);
+		if (info->mtd[i]->suspend)
+			ret |= info->mtd[i]->suspend(info->mtd[i]);
 
 	return ret;
 }
@@ -213,8 +214,10 @@ static int physmap_flash_resume(struct platform_device *dev)
 	struct physmap_flash_info *info = platform_get_drvdata(dev);
 	int i;
 
+	return 0;
 	for (i = 0; i < MAX_RESOURCES && info->mtd[i]; i++)
-		info->mtd[i]->resume(info->mtd[i]);
+		if (info->mtd[i]->resume)
+			info->mtd[i]->resume(info->mtd[i]);
 
 	return 0;
 }
@@ -225,8 +228,9 @@ static void physmap_flash_shutdown(struct platform_device *dev)
 	int i;
 
 	for (i = 0; i < MAX_RESOURCES && info->mtd[i]; i++)
-		if (info->mtd[i]->suspend(info->mtd[i]) == 0)
-			info->mtd[i]->resume(info->mtd[i]);
+		if (info->mtd[i]->suspend && info->mtd[i]->resume)
+			if (info->mtd[i]->suspend(info->mtd[i]) == 0)
+				info->mtd[i]->resume(info->mtd[i]);
 }
 #else
 #define physmap_flash_suspend NULL
-- 
1.5.5.3


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

* Re: physmap without MTD partitions
  2008-06-07 15:01 physmap without MTD partitions Robert Jarzmik
@ 2008-06-16  9:50 ` Jörn Engel
  2008-06-16 12:34   ` Robert Jarzmik
  0 siblings, 1 reply; 4+ messages in thread
From: Jörn Engel @ 2008-06-16  9:50 UTC (permalink / raw)
  To: Robert Jarzmik; +Cc: linux-mtd

On Sat, 7 June 2008 17:01:41 +0200, Robert Jarzmik wrote:
> @@ -213,8 +214,10 @@ static int physmap_flash_resume(struct platform_device *dev)
>  	struct physmap_flash_info *info = platform_get_drvdata(dev);
>  	int i;
>  
> +	return 0;

Is this bit leftover from debugging?

>  	for (i = 0; i < MAX_RESOURCES && info->mtd[i]; i++)
> -		info->mtd[i]->resume(info->mtd[i]);
> +		if (info->mtd[i]->resume)
> +			info->mtd[i]->resume(info->mtd[i]);
>  
>  	return 0;
>  }

Jörn

-- 
It's just what we asked for, but not what we want!
-- anonymous

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

* Re: physmap without MTD partitions
  2008-06-16  9:50 ` Jörn Engel
@ 2008-06-16 12:34   ` Robert Jarzmik
  2008-06-16 13:08     ` Jörn Engel
  0 siblings, 1 reply; 4+ messages in thread
From: Robert Jarzmik @ 2008-06-16 12:34 UTC (permalink / raw)
  To: Jörn Engel; +Cc: Robert Jarzmik, linux-mtd

Jörn Engel <joern@logfs.org> writes:

> On Sat, 7 June 2008 17:01:41 +0200, Robert Jarzmik wrote:
> > @@ -213,8 +214,10 @@ static int physmap_flash_resume(struct platform_device *dev)
> >  	struct physmap_flash_info *info = platform_get_drvdata(dev);
> >  	int i;
> >  
> > +	return 0;
> 
> Is this bit leftover from debugging?

Yes, sorry for that. That got through.
Here is the amended patch.

--
Robert

>From f09b6952c2cb3ac307654f628f3899757b3a1023 Mon Sep 17 00:00:00 2001
From: Robert Jarzmik <rjarzmik@free.fr>
Date: Sat, 7 Jun 2008 16:59:05 +0200
Subject: [PATCH] Fix suspend/resume/shutdown bugs.

Don't call suspend/resume functions if they have not been
defined.

Signed-off-by: Robert Jarzmik <rjarzmik@free.fr>
---
 drivers/mtd/maps/physmap.c |   11 +++++++----
 1 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/drivers/mtd/maps/physmap.c b/drivers/mtd/maps/physmap.c
index 183255f..73c770b 100644
--- a/drivers/mtd/maps/physmap.c
+++ b/drivers/mtd/maps/physmap.c
@@ -203,7 +203,8 @@ static int physmap_flash_suspend(struct platform_device *dev, pm_message_t state
 	int i;
 
 	for (i = 0; i < MAX_RESOURCES && info->mtd[i]; i++)
-		ret |= info->mtd[i]->suspend(info->mtd[i]);
+		if (info->mtd[i]->suspend)
+			ret |= info->mtd[i]->suspend(info->mtd[i]);
 
 	return ret;
 }
@@ -214,7 +215,8 @@ static int physmap_flash_resume(struct platform_device *dev)
 	int i;
 
 	for (i = 0; i < MAX_RESOURCES && info->mtd[i]; i++)
-		info->mtd[i]->resume(info->mtd[i]);
+		if (info->mtd[i]->resume)
+			info->mtd[i]->resume(info->mtd[i]);
 
 	return 0;
 }
@@ -225,8 +227,9 @@ static void physmap_flash_shutdown(struct platform_device *dev)
 	int i;
 
 	for (i = 0; i < MAX_RESOURCES && info->mtd[i]; i++)
-		if (info->mtd[i]->suspend(info->mtd[i]) == 0)
-			info->mtd[i]->resume(info->mtd[i]);
+		if (info->mtd[i]->suspend && info->mtd[i]->resume)
+			if (info->mtd[i]->suspend(info->mtd[i]) == 0)
+				info->mtd[i]->resume(info->mtd[i]);
 }
 #else
 #define physmap_flash_suspend NULL
-- 
1.5.5.3

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

* Re: physmap without MTD partitions
  2008-06-16 12:34   ` Robert Jarzmik
@ 2008-06-16 13:08     ` Jörn Engel
  0 siblings, 0 replies; 4+ messages in thread
From: Jörn Engel @ 2008-06-16 13:08 UTC (permalink / raw)
  To: Robert Jarzmik; +Cc: linux-mtd

On Mon, 16 June 2008 14:34:56 +0200, Robert Jarzmik wrote:
> 
> Don't call suspend/resume functions if they have not been
> defined.
> 
> Signed-off-by: Robert Jarzmik <rjarzmik@free.fr>

Acked-By: Joern Engel <joern@logfs.org>

> ---
>  drivers/mtd/maps/physmap.c |   11 +++++++----
>  1 files changed, 7 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/mtd/maps/physmap.c b/drivers/mtd/maps/physmap.c
> index 183255f..73c770b 100644
> --- a/drivers/mtd/maps/physmap.c
> +++ b/drivers/mtd/maps/physmap.c
> @@ -203,7 +203,8 @@ static int physmap_flash_suspend(struct platform_device *dev, pm_message_t state
>  	int i;
>  
>  	for (i = 0; i < MAX_RESOURCES && info->mtd[i]; i++)
> -		ret |= info->mtd[i]->suspend(info->mtd[i]);
> +		if (info->mtd[i]->suspend)
> +			ret |= info->mtd[i]->suspend(info->mtd[i]);
>  
>  	return ret;
>  }
> @@ -214,7 +215,8 @@ static int physmap_flash_resume(struct platform_device *dev)
>  	int i;
>  
>  	for (i = 0; i < MAX_RESOURCES && info->mtd[i]; i++)
> -		info->mtd[i]->resume(info->mtd[i]);
> +		if (info->mtd[i]->resume)
> +			info->mtd[i]->resume(info->mtd[i]);
>  
>  	return 0;
>  }
> @@ -225,8 +227,9 @@ static void physmap_flash_shutdown(struct platform_device *dev)
>  	int i;
>  
>  	for (i = 0; i < MAX_RESOURCES && info->mtd[i]; i++)
> -		if (info->mtd[i]->suspend(info->mtd[i]) == 0)
> -			info->mtd[i]->resume(info->mtd[i]);
> +		if (info->mtd[i]->suspend && info->mtd[i]->resume)
> +			if (info->mtd[i]->suspend(info->mtd[i]) == 0)
> +				info->mtd[i]->resume(info->mtd[i]);
>  }
>  #else
>  #define physmap_flash_suspend NULL
> -- 
> 1.5.5.3
> 
> 
> 
> ______________________________________________________
> Linux MTD discussion mailing list
> http://lists.infradead.org/mailman/listinfo/linux-mtd/

Jörn

-- 
It is the mark of an educated mind to be able to entertain a thought
without accepting it.
-- Aristotle

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

end of thread, other threads:[~2008-06-16 13:08 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-06-07 15:01 physmap without MTD partitions Robert Jarzmik
2008-06-16  9:50 ` Jörn Engel
2008-06-16 12:34   ` Robert Jarzmik
2008-06-16 13:08     ` Jörn Engel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox