public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
From: Yang Ruirui <ruirui.r.yang@tieto.com>
To: <dwmw2@infradead.org>, <linux-mtd@lists.infradead.org>,
	<Artem.Bityutskiy@nokia.com>, <ext-jani.1.nikula@nokia.com>,
	<ext-phil.2.carmody@nokia.com>, <ruirui.r.yang@tietoenator.com>
Subject: [PATCH 02/02] force module loaded with partitions set
Date: Mon, 14 Mar 2011 09:51:48 +0800	[thread overview]
Message-ID: <20110314015148.GA6827@darkstar> (raw)

From: Yang Ruirui<ruirui.r.yang@tieto.com>

partitions can not be set after module loaded, the moduel param mode is 0444.

this patch force module loaded with param partitions set, if user does not
set partitions then give out a warning and return -EINVAL

Signed-off-by: Yang Ruirui<ruirui.r.yang@tieto.com>
Tested-by: Shao Yanqing<yanqing.shao@tieto.com>
Tested-by: Xiao Yang<yang.xiao@tieto.com>
---
 drivers/mtd/mtdswap.c |    6 ++++++
 1 file changed, 6 insertions(+)

--- mtd-2.6-fc2ff59.orig/drivers/mtd/mtdswap.c	2011-03-14 09:36:09.283329099 +0800
+++ mtd-2.6-fc2ff59/drivers/mtd/mtdswap.c	2011-03-14 09:46:30.229993534 +0800
@@ -1569,6 +1569,12 @@ static struct mtd_blktrans_ops mtdswap_o
 
 static int __init mtdswap_modinit(void)
 {
+	if (!partitions[0]) {
+		printk(KERN_WARNING
+			"Please load mtdswap with correct partitions param\n");
+		return -EINVAL;
+	}
+
 	return register_mtd_blktrans(&mtdswap_ops);
 }
 

             reply	other threads:[~2011-03-14  1:42 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-14  1:51 Yang Ruirui [this message]
2011-03-14  8:43 ` [PATCH 02/02] force module loaded with partitions set Artem Bityutskiy
2011-03-14  8:57   ` Yang Rui Rui
2011-03-14  8:53     ` Artem Bityutskiy
2011-03-14  9:12       ` Yang Rui Rui
2011-03-14  9:33         ` Artem Bityutskiy
2011-03-17  8:50           ` Yang Rui Rui
2011-03-17  8:51             ` Artem Bityutskiy
2011-03-17  9:24               ` Yang Rui Rui

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=20110314015148.GA6827@darkstar \
    --to=ruirui.r.yang@tieto.com \
    --cc=Artem.Bityutskiy@nokia.com \
    --cc=dwmw2@infradead.org \
    --cc=ext-jani.1.nikula@nokia.com \
    --cc=ext-phil.2.carmody@nokia.com \
    --cc=linux-mtd@lists.infradead.org \
    --cc=ruirui.r.yang@tietoenator.com \
    /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