* [PATCH RFC 0/2] mtd updates
@ 2012-01-23 8:12 Shubhrajyoti D
2012-01-23 8:12 ` [PATCH RFC 1/2] mtd : Prevent the NULL pointer access Shubhrajyoti D
2012-01-23 8:12 ` [PATCH RFC 2/2] mtd : Make the mtd_suspend return 0 if the suspend is not implemented Shubhrajyoti D
0 siblings, 2 replies; 14+ messages in thread
From: Shubhrajyoti D @ 2012-01-23 8:12 UTC (permalink / raw)
To: linux-arm-kernel
This patch series does the following
Patch 1:
- Prevents the null pointer access
Also fixes the following crash
echo mem > /sys/power/state
[ 263.507019] PM: Syncing filesystems ... done.
[ 263.516876] PM: Preparing system for mem sleep
[ 263.548065] Freezing user space processes ... (elapsed 0.02 seconds) done.
[ 263.578308] Freezing remaining freezable tasks ... (elapsed 0.02
seconds) done.
[ 263.609374] PM: Entering mem sleep
[ 263.620361] Unable to handle kernel NULL pointer dereference at
virtual address 000000a0
[ 263.628997] pgd = c7034000
[ 263.631866] [000000a0] *pgd=87b9e831, *pte=00000000, *ppte=00000000
[ 263.638580] Internal error: Oops: 17 [#1] SMP
[ 263.643157] Modules linked in:
[ 263.646392] CPU: 0 Tainted: G W (3.3.0-rc1-gda9a8ca #12)
[ 263.653289] PC is at mtd_cls_suspend+0x8/0x20
[ 263.657897] LR is at mtd_cls_suspend+0x8/0x20
[ 263.662475] pc : [<c02e7804>] lr : [<c02e7804>] psr: a0000113
[ 263.662506] sp : c7011e60 ip : 22222222 fp : c06e52a0
[ 263.674591] r10: c06e5250 r9 : 00000000 r8 : c02e77fc
[ 263.680084] r7 : 00000000 r6 : 00000000 r5 : 00000002 r4 : c7afec00
[ 263.686950] r3 : c7afbac0 r2 : 00000000 r1 : 00000002 r0 : 00000000
[ 263.693847] Flags: NzCv IRQs on FIQs on Mode SVC_32 ISA ARM Segment user
[ 263.701354] Control: 10c5387d Table: 87034019 DAC: 00000015
[ 263.707397] Process sh (pid: 654, stack limit = 0xc70102f8)
[ 263.713287] Stack: (0xc7011e60 to 0xc7012000)
[ 263.717864] 1e60: 00000000 c02c2dc0 00000000 c7afec00 00000000
00000000 c7afec00 c0c47ed8
[ 263.726501] 1e80: c7afec34 00000002 c06d0fc0 c02c32b8 c02c3464
0047325c c7afec00 c7afec00
[ 263.735107] 1ea0: c0c47ed8 00000004 c06e5250 c02c33e0 c7001c00
00000002 60a157bf 0000003d
[ 263.743743] 1ec0: 60a157bf 0000003d 00000002 c0710698 00000000
00000003 c06fb910 00000000
[ 263.752349] 1ee0: c049bf78 c78019a0 00000002 c007fec8 00000003
c0587e94 00000000 00000004
[ 263.760986] 1f00: 00000000 c049bf78 c78019a0 c0080264 c7bd3000
00000003 c0587e94 c007f008
[ 263.769592] 1f20: c7b90aa0 c7b90ab8 c7011f80 c783e7a0 c02528b0
c02528c8 00000004 c0166cd4
[ 263.778198] 1f40: c7bfb6e0 00000004 b6f88000 c7011f80 00000000
00000000 00000000 c01071b4
[ 263.786834] 1f60: c0014280 c7b34240 c7bfb6e0 b6f88000 00000004
00000004 00000000 c0107308
[ 263.795440] 1f80: 00000000 00000000 00000004 00000000 00000004
001f6e80 00000004 c0014328
[ 263.804077] 1fa0: c7010000 c0014160 00000004 001f6e80 00000001
b6f88000 00000004 00000000
[ 263.812683] 1fc0: 00000004 001f6e80 00000004 00000004 b6f88000
001fcfc8 b6f88000 00000002
[ 263.821289] 1fe0: 00000000 be8895e0 000fded8 0000921c 60000010
00000001 00000000 00000000
[ 263.829956] [<c02e7804>] (mtd_cls_suspend+0x8/0x20) from
[<c02c2dc0>] (legacy_suspend+0x30
/0x78)
[ 263.839202] [<c02c2dc0>] (legacy_suspend+0x30/0x78) from
[<c02c32b8>] (__device_suspend+0x
2c8/0x30c)
[ 263.848846] [<c02c32b8>] (__device_suspend+0x2c8/0x30c) from
[<c02c33e0>] (dpm_suspend+0x5
8/0x214)
[ 263.858306] [<c02c33e0>] (dpm_suspend+0x58/0x214) from [<c007fec8>]
(suspend_devices_and_e
nter+0x78/0x2d8)
[ 263.868499] [<c007fec8>] (suspend_devices_and_enter+0x78/0x2d8)
from [<c0080264>] (enter_s
tate+0x13c/0x17c)
[ 263.878753] [<c0080264>] (enter_state+0x13c/0x17c) from
[<c007f008>] (state_store+0xd0/0x1
70)
[ 263.887756] [<c007f008>] (state_store+0xd0/0x170) from [<c02528c8>]
(kobj_attr_store+0x18/
0x1c)
[ 263.896942] [<c02528c8>] (kobj_attr_store+0x18/0x1c) from
[<c0166cd4>] (sysfs_write_file+0
xfc/0x180)
[ 263.906585] [<c0166cd4>] (sysfs_write_file+0xfc/0x180) from
[<c01071b4>] (vfs_write+0xb0/0
x134)
[ 263.915771] [<c01071b4>] (vfs_write+0xb0/0x134) from [<c0107308>]
(sys_write+0x40/0x70)
[ 263.924224] [<c0107308>] (sys_write+0x40/0x70) from [<c0014160>]
(ret_fast_syscall+0x0/0x3
c)
[ 263.933105] Code: e3a00000 e8bd8008 e92d4008 ebff57f9 (e59030a0)
[ 263.939849] ---[ end trace 1b75b31a2719ed20 ]---
Patch 2:
- Currently mtd_suspend returns an error value -EOPNOTSUPP
if the suspend function is not implemented which prevents the
suspend. This patch prevents the nack of suspend if suspend
is not implemented
Shubhrajyoti D (2):
mtd : Prevent the NULL pointer access
mtd : Make the mtd_suspend return 0 if the suspend is not implemented
drivers/mtd/mtdcore.c | 5 +++--
include/linux/mtd/mtd.h | 6 +++---
2 files changed, 6 insertions(+), 5 deletions(-)
^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCH RFC 1/2] mtd : Prevent the NULL pointer access
2012-01-23 8:12 [PATCH RFC 0/2] mtd updates Shubhrajyoti D
@ 2012-01-23 8:12 ` Shubhrajyoti D
2012-01-27 19:08 ` Brian Norris
2012-01-23 8:12 ` [PATCH RFC 2/2] mtd : Make the mtd_suspend return 0 if the suspend is not implemented Shubhrajyoti D
1 sibling, 1 reply; 14+ messages in thread
From: Shubhrajyoti D @ 2012-01-23 8:12 UTC (permalink / raw)
To: linux-arm-kernel
This patch intends to fix the null pointer access.
Signed-off-by: Shubhrajyoti D <shubhrajyoti@ti.com>
---
drivers/mtd/mtdcore.c | 5 +++--
1 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/mtd/mtdcore.c b/drivers/mtd/mtdcore.c
index 6ae9ca0..2b3bda7 100644
--- a/drivers/mtd/mtdcore.c
+++ b/drivers/mtd/mtdcore.c
@@ -118,8 +118,9 @@ static void mtd_release(struct device *dev)
static int mtd_cls_suspend(struct device *dev, pm_message_t state)
{
struct mtd_info *mtd = dev_get_drvdata(dev);
-
- return mtd_suspend(mtd);
+ if (mtd)
+ return mtd_suspend(mtd);
+ return 0;
}
static int mtd_cls_resume(struct device *dev)
--
1.7.1
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH RFC 2/2] mtd : Make the mtd_suspend return 0 if the suspend is not implemented
2012-01-23 8:12 [PATCH RFC 0/2] mtd updates Shubhrajyoti D
2012-01-23 8:12 ` [PATCH RFC 1/2] mtd : Prevent the NULL pointer access Shubhrajyoti D
@ 2012-01-23 8:12 ` Shubhrajyoti D
2012-01-24 8:09 ` Brian Norris
1 sibling, 1 reply; 14+ messages in thread
From: Shubhrajyoti D @ 2012-01-23 8:12 UTC (permalink / raw)
To: linux-arm-kernel
Currently mtd_suspend returns an error value -EOPNOTSUPP
if the suspend function is not implemented which prevents the
suspend. This patch prevents the nack of suspend if suspend
is not implemented.
Signed-off-by: Shubhrajyoti D <shubhrajyoti@ti.com>
---
include/linux/mtd/mtd.h | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/include/linux/mtd/mtd.h b/include/linux/mtd/mtd.h
index 1a81fde..c717bb6 100644
--- a/include/linux/mtd/mtd.h
+++ b/include/linux/mtd/mtd.h
@@ -427,9 +427,9 @@ static inline int mtd_is_locked(struct mtd_info *mtd, loff_t ofs, uint64_t len)
static inline int mtd_suspend(struct mtd_info *mtd)
{
- if (!mtd->suspend)
- return -EOPNOTSUPP;
- return mtd->suspend(mtd);
+ if (mtd->suspend)
+ return mtd->suspend(mtd);
+ return 0;
}
static inline void mtd_resume(struct mtd_info *mtd)
--
1.7.1
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH RFC 2/2] mtd : Make the mtd_suspend return 0 if the suspend is not implemented
2012-01-23 8:12 ` [PATCH RFC 2/2] mtd : Make the mtd_suspend return 0 if the suspend is not implemented Shubhrajyoti D
@ 2012-01-24 8:09 ` Brian Norris
2012-01-24 8:52 ` Shubhrajyoti
2012-01-24 9:06 ` Russell King - ARM Linux
0 siblings, 2 replies; 14+ messages in thread
From: Brian Norris @ 2012-01-24 8:09 UTC (permalink / raw)
To: linux-arm-kernel
Hi,
On Mon, Jan 23, 2012 at 12:12 AM, Shubhrajyoti D <shubhrajyoti@ti.com> wrote:
...
> ?include/linux/mtd/mtd.h | ? ?6 +++---
> ?1 files changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/include/linux/mtd/mtd.h b/include/linux/mtd/mtd.h
> index 1a81fde..c717bb6 100644
> --- a/include/linux/mtd/mtd.h
> +++ b/include/linux/mtd/mtd.h
> @@ -427,9 +427,9 @@ static inline int mtd_is_locked(struct mtd_info *mtd, loff_t ofs, uint64_t len)
>
> ?static inline int mtd_suspend(struct mtd_info *mtd)
> ?{
> - ? ? ? if (!mtd->suspend)
> - ? ? ? ? ? ? ? return -EOPNOTSUPP;
> - ? ? ? return mtd->suspend(mtd);
> + ? ? ? if (mtd->suspend)
> + ? ? ? ? ? ? ? return mtd->suspend(mtd);
> + ? ? ? return 0;
> ?}
>
> ?static inline void mtd_resume(struct mtd_info *mtd)
I believe this fix is already accounted for in Artem Bityutskiy's
l2-mtd-2.6 repository as:
commit 091a7fe219ee8d3e76be9e02221433af10c6f574
mtd: fix MTD suspend
(http://git.infradead.org/users/dedekind/l2-mtd-2.6.git/commit/091a7fe219ee8d3e76be9e02221433af10c6f574)
However, the bug made it into the 3.3 merge window, so shouldn't this
bugfix be sent upstream immediately?
Brian
^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCH RFC 2/2] mtd : Make the mtd_suspend return 0 if the suspend is not implemented
2012-01-24 8:09 ` Brian Norris
@ 2012-01-24 8:52 ` Shubhrajyoti
2012-01-24 9:06 ` Russell King - ARM Linux
1 sibling, 0 replies; 14+ messages in thread
From: Shubhrajyoti @ 2012-01-24 8:52 UTC (permalink / raw)
To: linux-arm-kernel
On Tuesday 24 January 2012 01:39 PM, Brian Norris wrote:
> Hi,
>
> On Mon, Jan 23, 2012 at 12:12 AM, Shubhrajyoti D <shubhrajyoti@ti.com> wrote:
> ...
>> include/linux/mtd/mtd.h | 6 +++---
>> 1 files changed, 3 insertions(+), 3 deletions(-)
>>
>> diff --git a/include/linux/mtd/mtd.h b/include/linux/mtd/mtd.h
>> index 1a81fde..c717bb6 100644
>> --- a/include/linux/mtd/mtd.h
>> +++ b/include/linux/mtd/mtd.h
>> @@ -427,9 +427,9 @@ static inline int mtd_is_locked(struct mtd_info *mtd, loff_t ofs, uint64_t len)
>>
>> static inline int mtd_suspend(struct mtd_info *mtd)
>> {
>> - if (!mtd->suspend)
>> - return -EOPNOTSUPP;
>> - return mtd->suspend(mtd);
>> + if (mtd->suspend)
>> + return mtd->suspend(mtd);
>> + return 0;
>> }
>>
>> static inline void mtd_resume(struct mtd_info *mtd)
> I believe this fix is already accounted for in Artem Bityutskiy's
> l2-mtd-2.6 repository as:
>
> commit 091a7fe219ee8d3e76be9e02221433af10c6f574
> mtd: fix MTD suspend
> (http://git.infradead.org/users/dedekind/l2-mtd-2.6.git/commit/091a7fe219ee8d3e76be9e02221433af10c6f574)
>
> However, the bug made it into the 3.3 merge window, so shouldn't this
> bugfix be sent upstream immediately?
OK thanks for pointing that.
> Brian
^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCH RFC 2/2] mtd : Make the mtd_suspend return 0 if the suspend is not implemented
2012-01-24 8:09 ` Brian Norris
2012-01-24 8:52 ` Shubhrajyoti
@ 2012-01-24 9:06 ` Russell King - ARM Linux
2012-01-25 5:16 ` Brian Norris
2012-01-30 11:45 ` Artem Bityutskiy
1 sibling, 2 replies; 14+ messages in thread
From: Russell King - ARM Linux @ 2012-01-24 9:06 UTC (permalink / raw)
To: linux-arm-kernel
On Tue, Jan 24, 2012 at 12:09:04AM -0800, Brian Norris wrote:
> Hi,
>
> On Mon, Jan 23, 2012 at 12:12 AM, Shubhrajyoti D <shubhrajyoti@ti.com> wrote:
> ...
> > ?include/linux/mtd/mtd.h | ? ?6 +++---
> > ?1 files changed, 3 insertions(+), 3 deletions(-)
> >
> > diff --git a/include/linux/mtd/mtd.h b/include/linux/mtd/mtd.h
> > index 1a81fde..c717bb6 100644
> > --- a/include/linux/mtd/mtd.h
> > +++ b/include/linux/mtd/mtd.h
> > @@ -427,9 +427,9 @@ static inline int mtd_is_locked(struct mtd_info *mtd, loff_t ofs, uint64_t len)
> >
> > ?static inline int mtd_suspend(struct mtd_info *mtd)
> > ?{
> > - ? ? ? if (!mtd->suspend)
> > - ? ? ? ? ? ? ? return -EOPNOTSUPP;
> > - ? ? ? return mtd->suspend(mtd);
> > + ? ? ? if (mtd->suspend)
> > + ? ? ? ? ? ? ? return mtd->suspend(mtd);
> > + ? ? ? return 0;
> > ?}
> >
> > ?static inline void mtd_resume(struct mtd_info *mtd)
>
> I believe this fix is already accounted for in Artem Bityutskiy's
> l2-mtd-2.6 repository as:
>
> commit 091a7fe219ee8d3e76be9e02221433af10c6f574
> mtd: fix MTD suspend
> (http://git.infradead.org/users/dedekind/l2-mtd-2.6.git/commit/091a7fe219ee8d3e76be9e02221433af10c6f574)
>
> However, the bug made it into the 3.3 merge window, so shouldn't this
> bugfix be sent upstream immediately?
David is the MTD maintainer, and Artem just helps out. I believe Artem
is waiting for David to finish travelling before asking David (last seen
at Hong Kong airport) to pull these fixes. David in turn will pass them
onto Linus. Plus, Linus only started adding to -rc1 yesterday, so its a
little early to expect this to be fixed.
^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCH RFC 2/2] mtd : Make the mtd_suspend return 0 if the suspend is not implemented
2012-01-24 9:06 ` Russell King - ARM Linux
@ 2012-01-25 5:16 ` Brian Norris
2012-01-30 11:45 ` Artem Bityutskiy
1 sibling, 0 replies; 14+ messages in thread
From: Brian Norris @ 2012-01-25 5:16 UTC (permalink / raw)
To: linux-arm-kernel
On Tue, Jan 24, 2012 at 1:06 AM, Russell King - ARM Linux
<linux@arm.linux.org.uk> wrote:
> On Tue, Jan 24, 2012 at 12:09:04AM -0800, Brian Norris wrote:
>> However, the bug made it into the 3.3 merge window, so shouldn't this
>> bugfix be sent upstream immediately?
>
> David is the MTD maintainer, and Artem just helps out. ?I believe Artem
> is waiting for David to finish travelling before asking David (last seen
> at Hong Kong airport) to pull these fixes. ?David in turn will pass them
> onto Linus. ?Plus, Linus only started adding to -rc1 yesterday, so its a
> little early to expect this to be fixed.
Right, thanks for the reality check. I was just ensuring that this
bugfix was on the right track. I probably should have said "in
3.3-rcX", not "immediately."
Regards,
Brian
^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCH RFC 1/2] mtd : Prevent the NULL pointer access
2012-01-23 8:12 ` [PATCH RFC 1/2] mtd : Prevent the NULL pointer access Shubhrajyoti D
@ 2012-01-27 19:08 ` Brian Norris
0 siblings, 0 replies; 14+ messages in thread
From: Brian Norris @ 2012-01-27 19:08 UTC (permalink / raw)
To: linux-arm-kernel
On Mon, Jan 23, 2012 at 12:12 AM, Shubhrajyoti D <shubhrajyoti@ti.com> wrote:
> This patch intends to fix the null pointer access.
>
> Signed-off-by: Shubhrajyoti D <shubhrajyoti@ti.com>
> ---
> ?drivers/mtd/mtdcore.c | ? ?5 +++--
> ?1 files changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/mtd/mtdcore.c b/drivers/mtd/mtdcore.c
> index 6ae9ca0..2b3bda7 100644
> --- a/drivers/mtd/mtdcore.c
> +++ b/drivers/mtd/mtdcore.c
> @@ -118,8 +118,9 @@ static void mtd_release(struct device *dev)
> ?static int mtd_cls_suspend(struct device *dev, pm_message_t state)
> ?{
> ? ? ? ?struct mtd_info *mtd = dev_get_drvdata(dev);
> -
> - ? ? ? return mtd_suspend(mtd);
> + ? ? ? if (mtd)
> + ? ? ? ? ? ? ? return mtd_suspend(mtd);
> + ? ? ? return 0;
> ?}
>
> ?static int mtd_cls_resume(struct device *dev)
Forgot this patch was here; this fix is also covered in
l2-mtd-2.6.git, waiting for inclusion in the 3.3-rcX release cycle.
Thanks for the work though!
Brian
^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCH RFC 2/2] mtd : Make the mtd_suspend return 0 if the suspend is not implemented
2012-01-24 9:06 ` Russell King - ARM Linux
2012-01-25 5:16 ` Brian Norris
@ 2012-01-30 11:45 ` Artem Bityutskiy
2012-01-30 22:58 ` Rafael J. Wysocki
1 sibling, 1 reply; 14+ messages in thread
From: Artem Bityutskiy @ 2012-01-30 11:45 UTC (permalink / raw)
To: linux-arm-kernel
On Tue, 2012-01-24 at 09:06 +0000, Russell King - ARM Linux wrote:
> > However, the bug made it into the 3.3 merge window, so shouldn't this
> > bugfix be sent upstream immediately?
>
> David is the MTD maintainer, and Artem just helps out. I believe Artem
> is waiting for David to finish travelling before asking David (last seen
> at Hong Kong airport) to pull these fixes. David in turn will pass them
> onto Linus. Plus, Linus only started adding to -rc1 yesterday, so its a
> little early to expect this to be fixed.
Hi,
here is the latest version of the fix.
http://git.infradead.org/users/dedekind/l2-mtd-2.6.git/commit/283d43b9ce2952535aa89c0195085e2a1b7e5fce
Also attached.
>From 283d43b9ce2952535aa89c0195085e2a1b7e5fce Mon Sep 17 00:00:00 2001
From: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
Date: Mon, 16 Jan 2012 11:07:16 +0200
Subject: [PATCH] mtd: fix MTD suspend
Commits 3fe4bae88460869a8e553397cd9057a4ee7ca341 and
079c985e7a6f4ce60f931cebfdd5ee3c3 broke MTD suspend in 2 ways:
1. When the '->suspend' method is not present, we return -EOPNOTSUPP,
but
the callers of 'mtd_suspend()' expects 0 instead.
2. Checking of the 'mtd' parameter against NULL has been incorrectly
removed
in 'mtd_cls_suspend()'.
This patch fixes the breakages. This has been found, analyzed, reported
and tested by Rafael J. Wysocki <rjw@sisk.pl>.
Note, this patch is not needed in the stable tree because it causes a
regression introduced during the v3.3 merge window.
Reported-by: Rafael J. Wysocki <rjw@sisk.pl>
Tested-by: Rafael J. Wysocki <rjw@sisk.pl>
Tested-by: Russell King <rmk+kernel@arm.linux.org.uk>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
---
drivers/mtd/mtdcore.c | 2 +-
include/linux/mtd/mtd.h | 4 +---
2 files changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/mtd/mtdcore.c b/drivers/mtd/mtdcore.c
index b265188..de96865 100644
--- a/drivers/mtd/mtdcore.c
+++ b/drivers/mtd/mtdcore.c
@@ -119,7 +119,7 @@ static int mtd_cls_suspend(struct device *dev,
pm_message_t state)
{
struct mtd_info *mtd = dev_get_drvdata(dev);
- return mtd_suspend(mtd);
+ return mtd ? mtd_suspend(mtd) : 0;
}
static int mtd_cls_resume(struct device *dev)
diff --git a/include/linux/mtd/mtd.h b/include/linux/mtd/mtd.h
index 1a81fde..d8c7aad 100644
--- a/include/linux/mtd/mtd.h
+++ b/include/linux/mtd/mtd.h
@@ -427,9 +427,7 @@ static inline int mtd_is_locked(struct mtd_info
*mtd, loff_t ofs, uint64_t len)
static inline int mtd_suspend(struct mtd_info *mtd)
{
- if (!mtd->suspend)
- return -EOPNOTSUPP;
- return mtd->suspend(mtd);
+ return mtd->suspend ? mtd->suspend(mtd) : 0;
}
static inline void mtd_resume(struct mtd_info *mtd)
--
1.7.7.6
--
Best Regards,
Artem Bityutskiy
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-mtd-fix-MTD-suspend.patch
Type: text/x-patch
Size: 2094 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20120130/70d913c5/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20120130/70d913c5/attachment.sig>
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH RFC 2/2] mtd : Make the mtd_suspend return 0 if the suspend is not implemented
2012-01-30 11:45 ` Artem Bityutskiy
@ 2012-01-30 22:58 ` Rafael J. Wysocki
2012-02-02 11:43 ` Artem Bityutskiy
0 siblings, 1 reply; 14+ messages in thread
From: Rafael J. Wysocki @ 2012-01-30 22:58 UTC (permalink / raw)
To: linux-arm-kernel
On Monday, January 30, 2012, Artem Bityutskiy wrote:
> On Tue, 2012-01-24 at 09:06 +0000, Russell King - ARM Linux wrote:
> > > However, the bug made it into the 3.3 merge window, so shouldn't this
> > > bugfix be sent upstream immediately?
> >
> > David is the MTD maintainer, and Artem just helps out. I believe Artem
> > is waiting for David to finish travelling before asking David (last seen
> > at Hong Kong airport) to pull these fixes. David in turn will pass them
> > onto Linus. Plus, Linus only started adding to -rc1 yesterday, so its a
> > little early to expect this to be fixed.
>
> Hi,
>
> here is the latest version of the fix.
>
> http://git.infradead.org/users/dedekind/l2-mtd-2.6.git/commit/283d43b9ce2952535aa89c0195085e2a1b7e5fce
>
> Also attached.
>
> From 283d43b9ce2952535aa89c0195085e2a1b7e5fce Mon Sep 17 00:00:00 2001
> From: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
> Date: Mon, 16 Jan 2012 11:07:16 +0200
> Subject: [PATCH] mtd: fix MTD suspend
>
> Commits 3fe4bae88460869a8e553397cd9057a4ee7ca341 and
> 079c985e7a6f4ce60f931cebfdd5ee3c3 broke MTD suspend in 2 ways:
>
> 1. When the '->suspend' method is not present, we return -EOPNOTSUPP,
> but
> the callers of 'mtd_suspend()' expects 0 instead.
> 2. Checking of the 'mtd' parameter against NULL has been incorrectly
> removed
> in 'mtd_cls_suspend()'.
>
> This patch fixes the breakages. This has been found, analyzed, reported
> and tested by Rafael J. Wysocki <rjw@sisk.pl>.
>
> Note, this patch is not needed in the stable tree because it causes a
> regression introduced during the v3.3 merge window.
>
> Reported-by: Rafael J. Wysocki <rjw@sisk.pl>
> Tested-by: Rafael J. Wysocki <rjw@sisk.pl>
> Tested-by: Russell King <rmk+kernel@arm.linux.org.uk>
> Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
Thanks, but is anyone actually going to push it to Linus any time soon?
If not, then I can do that through the linux-pm tree. I'll be sending
at least one more pull request with fixes for v3.3.
Thanks,
Rafael
> ---
> drivers/mtd/mtdcore.c | 2 +-
> include/linux/mtd/mtd.h | 4 +---
> 2 files changed, 2 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/mtd/mtdcore.c b/drivers/mtd/mtdcore.c
> index b265188..de96865 100644
> --- a/drivers/mtd/mtdcore.c
> +++ b/drivers/mtd/mtdcore.c
> @@ -119,7 +119,7 @@ static int mtd_cls_suspend(struct device *dev,
> pm_message_t state)
> {
> struct mtd_info *mtd = dev_get_drvdata(dev);
>
> - return mtd_suspend(mtd);
> + return mtd ? mtd_suspend(mtd) : 0;
> }
>
> static int mtd_cls_resume(struct device *dev)
> diff --git a/include/linux/mtd/mtd.h b/include/linux/mtd/mtd.h
> index 1a81fde..d8c7aad 100644
> --- a/include/linux/mtd/mtd.h
> +++ b/include/linux/mtd/mtd.h
> @@ -427,9 +427,7 @@ static inline int mtd_is_locked(struct mtd_info
> *mtd, loff_t ofs, uint64_t len)
>
> static inline int mtd_suspend(struct mtd_info *mtd)
> {
> - if (!mtd->suspend)
> - return -EOPNOTSUPP;
> - return mtd->suspend(mtd);
> + return mtd->suspend ? mtd->suspend(mtd) : 0;
> }
>
> static inline void mtd_resume(struct mtd_info *mtd)
>
^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCH RFC 2/2] mtd : Make the mtd_suspend return 0 if the suspend is not implemented
2012-01-30 22:58 ` Rafael J. Wysocki
@ 2012-02-02 11:43 ` Artem Bityutskiy
2012-02-02 18:40 ` Rafael J. Wysocki
0 siblings, 1 reply; 14+ messages in thread
From: Artem Bityutskiy @ 2012-02-02 11:43 UTC (permalink / raw)
To: linux-arm-kernel
On Mon, 2012-01-30 at 23:58 +0100, Rafael J. Wysocki wrote:
> Thanks, but is anyone actually going to push it to Linus any time soon?
I agree, but I am not the maintainer so cannot answer. David Woodhouse
is aware of this, but I do not know when he gonna send the pull request.
--
Best Regards,
Artem Bityutskiy
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20120202/ffee2351/attachment.sig>
^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCH RFC 2/2] mtd : Make the mtd_suspend return 0 if the suspend is not implemented
2012-02-02 11:43 ` Artem Bityutskiy
@ 2012-02-02 18:40 ` Rafael J. Wysocki
2012-02-02 20:21 ` Russell King - ARM Linux
0 siblings, 1 reply; 14+ messages in thread
From: Rafael J. Wysocki @ 2012-02-02 18:40 UTC (permalink / raw)
To: linux-arm-kernel
On Thursday, February 02, 2012, Artem Bityutskiy wrote:
> On Mon, 2012-01-30 at 23:58 +0100, Rafael J. Wysocki wrote:
> > Thanks, but is anyone actually going to push it to Linus any time soon?
>
> I agree, but I am not the maintainer so cannot answer. David Woodhouse
> is aware of this, but I do not know when he gonna send the pull request.
Well, the problem is being reported by more and more people, so I'd
like to push the fix quickly.
David, please let me know if you don't want me to include the $subject patch
into the next PM fixes pull request. If I don't hear from you, I'll push it
next week for -rc4.
Thanks,
Rafael
^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCH RFC 2/2] mtd : Make the mtd_suspend return 0 if the suspend is not implemented
2012-02-02 18:40 ` Rafael J. Wysocki
@ 2012-02-02 20:21 ` Russell King - ARM Linux
2012-02-02 20:36 ` Rafael J. Wysocki
0 siblings, 1 reply; 14+ messages in thread
From: Russell King - ARM Linux @ 2012-02-02 20:21 UTC (permalink / raw)
To: linux-arm-kernel
On Thu, Feb 02, 2012 at 07:40:26PM +0100, Rafael J. Wysocki wrote:
> On Thursday, February 02, 2012, Artem Bityutskiy wrote:
> > On Mon, 2012-01-30 at 23:58 +0100, Rafael J. Wysocki wrote:
> > > Thanks, but is anyone actually going to push it to Linus any time soon?
> >
> > I agree, but I am not the maintainer so cannot answer. David Woodhouse
> > is aware of this, but I do not know when he gonna send the pull request.
>
> Well, the problem is being reported by more and more people, so I'd
> like to push the fix quickly.
>
> David, please let me know if you don't want me to include the $subject patch
> into the next PM fixes pull request. If I don't hear from you, I'll push it
> next week for -rc4.
I too have it in my tree as a patch which Artem sent me, as it's rather
fundamental to not oopsing the kernel when you suspend/resume on any ARM
platform.
^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCH RFC 2/2] mtd : Make the mtd_suspend return 0 if the suspend is not implemented
2012-02-02 20:21 ` Russell King - ARM Linux
@ 2012-02-02 20:36 ` Rafael J. Wysocki
0 siblings, 0 replies; 14+ messages in thread
From: Rafael J. Wysocki @ 2012-02-02 20:36 UTC (permalink / raw)
To: linux-arm-kernel
On Thursday, February 02, 2012, Russell King - ARM Linux wrote:
> On Thu, Feb 02, 2012 at 07:40:26PM +0100, Rafael J. Wysocki wrote:
> > On Thursday, February 02, 2012, Artem Bityutskiy wrote:
> > > On Mon, 2012-01-30 at 23:58 +0100, Rafael J. Wysocki wrote:
> > > > Thanks, but is anyone actually going to push it to Linus any time soon?
> > >
> > > I agree, but I am not the maintainer so cannot answer. David Woodhouse
> > > is aware of this, but I do not know when he gonna send the pull request.
> >
> > Well, the problem is being reported by more and more people, so I'd
> > like to push the fix quickly.
> >
> > David, please let me know if you don't want me to include the $subject patch
> > into the next PM fixes pull request. If I don't hear from you, I'll push it
> > next week for -rc4.
>
> I too have it in my tree as a patch which Artem sent me, as it's rather
> fundamental to not oopsing the kernel when you suspend/resume on any ARM
> platform.
It actually affects everyone using MTD and suspend (not only ARM) and that's
why I thought I'd take it, but I'm fine with any other resolution as long as
the patch goes to Linus before 3.3-final.
Thanks,
Rafael
^ permalink raw reply [flat|nested] 14+ messages in thread
end of thread, other threads:[~2012-02-02 20:36 UTC | newest]
Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-01-23 8:12 [PATCH RFC 0/2] mtd updates Shubhrajyoti D
2012-01-23 8:12 ` [PATCH RFC 1/2] mtd : Prevent the NULL pointer access Shubhrajyoti D
2012-01-27 19:08 ` Brian Norris
2012-01-23 8:12 ` [PATCH RFC 2/2] mtd : Make the mtd_suspend return 0 if the suspend is not implemented Shubhrajyoti D
2012-01-24 8:09 ` Brian Norris
2012-01-24 8:52 ` Shubhrajyoti
2012-01-24 9:06 ` Russell King - ARM Linux
2012-01-25 5:16 ` Brian Norris
2012-01-30 11:45 ` Artem Bityutskiy
2012-01-30 22:58 ` Rafael J. Wysocki
2012-02-02 11:43 ` Artem Bityutskiy
2012-02-02 18:40 ` Rafael J. Wysocki
2012-02-02 20:21 ` Russell King - ARM Linux
2012-02-02 20:36 ` Rafael J. Wysocki
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).