From: dedekind1@gmail.com (Artem Bityutskiy)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH RFC 2/2] mtd : Make the mtd_suspend return 0 if the suspend is not implemented
Date: Mon, 30 Jan 2012 13:45:53 +0200 [thread overview]
Message-ID: <1327923953.2487.13.camel@sauron.fi.intel.com> (raw)
In-Reply-To: <20120124090630.GR16726@n2100.arm.linux.org.uk>
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>
next prev parent reply other threads:[~2012-01-30 11:45 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
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 [this message]
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
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=1327923953.2487.13.camel@sauron.fi.intel.com \
--to=dedekind1@gmail.com \
--cc=linux-arm-kernel@lists.infradead.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 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).