physmap without MTD partitions
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=yCONFIG_MTD=yCONFIG_MTD_CHAR=yCONFIG_MTD_MAP_BANK_WIDTH_1=yCONFIG_MTD_MAP_BANK_WIDTH_2=yCONFIG_MTD_MAP_BANK_WIDTH_4=yCONFIG_MTD_CFI_I1=yCONFIG_MTD_CFI_I2=yCONFIG_MTD_ROM=yCONFIG_MTD_PHYSMAP=yCONFIG_MTD_PHYSMAP_START=0x00000000CONFIG_MTD_PHYSMAP_LEN=0x0CONFIG_MTD_PHYSMAP_BANKWIDTH=2
This is the patch I used to solve the problem. Would someone consider merging/reviewing it please ?
--
Robert
Quoted 1 line
From
048b1131b186640c6d99be371698a035069f0fc8Mon Sep 17 00:00:00 2001
From: Robert Jarzmik <[email protected]>
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.
--- drivers/mtd/maps/physmap.c | 12 ++++++++---- 1 files changed, 8 insertions(+), 4 deletions(-)
drivers/mtd/maps/physmap.c +8 -4
@@ -203,7 +203,8 @@ static int physmap_flash_suspend(struct platform_device *dev, pm_message_t stateint 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
Signature · 1 line
1.5.5.3
drivers/mtd/maps/physmap.c static int physmap_flash_resume(struct platform_device *dev) · line 217
Quoted 5 lines · Robert Jarzmik
drivers/mtd/maps/physmap.c +1
-0@@ -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?
drivers/mtd/maps/physmap.c static int physmap_flash_resume(struct platform_device *dev) · line 223
Quoted 7 lines
drivers/mtd/maps/physmap.c +2
-1for (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
Signature · 2 lines
It's just what we asked for, but not what we want! -- anonymous
Quoted 8 lines · Jörn Engel
Review static int physmap_flash_resume(struct platform_device *dev) · line 217
Quoted 5 lines · Robert Jarzmik
(quoted diff) +1
-0@@ -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
Quoted 1 line
From
f09b6952c2cb3ac307654f628f3899757b3a1023Mon Sep 17 00:00:00 2001
From: Robert Jarzmik <[email protected]>
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.
--- drivers/mtd/maps/physmap.c | 11 +++++++---- 1 files changed, 7 insertions(+), 4 deletions(-)
drivers/mtd/maps/physmap.c +7 -4
@@ -203,7 +203,8 @@ static int physmap_flash_suspend(struct platform_device *dev, pm_message_t stateint 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
Signature · 1 line
1.5.5.3
Jörn Engel
Acked-byQuoted 5 lines · Robert Jarzmik
Don't call suspend/resume functions if they have not been defined.
Signed-off-by Robert Jarzmik <[email protected]>
Quoted 48 lines
--- drivers/mtd/maps/physmap.c | 11 +++++++---- 1 files changed, 7 insertions(+), 4 deletions(-)drivers/mtd/maps/physmap.c +7
-4@@ -203,7 +203,8 @@ static int physmap_flash_suspend(struct platform_device *dev, pm_message_t stateint 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 NULLSignature · 7 lines
1.5.5.3 ______________________________________________________ Linux MTD discussion mailing list http://lists.infradead.org/mailman/listinfo/linux-mtd/
Jörn
Signature · 3 lines
It is the mark of an educated mind to be able to entertain a thought without accepting it. -- Aristotle