From: Sascha Hauer <s.hauer@pengutronix.de>
To: linux-mtd@lists.infradead.org
Cc: Ben Dooks <ben@simtec.co.uk>
Subject: plat-ram driver
Date: Mon, 28 Nov 2005 14:30:03 +0100 [thread overview]
Message-ID: <20051128133003.GA10558@localhost.localdomain> (raw)
Hi list and Ben,
I was half way through implementing a mapping driver which allows
initialization of a mtd device using a platform_device when I found the
plat-ram.c driver. With some small changes one could use the driver for
flash devices as well.
Would a patch like this be acceptible? Maybe we should rename the driver
to something like plat-mtd. I did not do this to keep the patch small,
but I would do the changes if there is a chance to get this upstream.
BTW there is a goto exit_free missing when add_mtd_device fails, the
attached patch fixes this.
Sascha Hauer
Index: include/linux/mtd/plat-ram.h
===================================================================
--- a/include/linux/mtd/plat-ram.h (revision 1061)
+++ b/include/linux/mtd/plat-ram.h (working copy)
@@ -22,7 +22,8 @@
struct platdata_mtd_ram {
char *mapname;
- char **probes;
+ char **mtd_probes;
+ char **part_probes;
struct mtd_partition *partitions;
int nr_partitions;
int bankwidth;
Index: drivers/mtd/maps/plat-ram.c
===================================================================
--- a/drivers/mtd/maps/plat-ram.c (revision 1061)
+++ b/drivers/mtd/maps/plat-ram.c (working copy)
@@ -134,6 +134,7 @@
struct platdata_mtd_ram *pdata;
struct platram_info *info;
struct resource *res;
+ char **type;
int err = 0;
dev_dbg(dev, "probe entered\n");
@@ -202,9 +203,14 @@
dev_dbg(dev, "initialised map, probing for mtd\n");
- /* probe for the right mtd map driver */
+ /* probe for the right map driver */
+ if(pdata->mtd_probes) {
+ type = pdata->mtd_probes;
+ for(; !info->mtd && *type; type++)
+ info->mtd = do_map_probe(*type, &info->map);
+ } else
+ do_map_probe("map_ram", &info->map);
- info->mtd = do_map_probe("map_ram" , &info->map);
if (info->mtd == NULL) {
dev_err(dev, "failed to probe for map_ram\n");
err = -ENOMEM;
@@ -219,11 +225,11 @@
* to add this device whole */
#ifdef CONFIG_MTD_PARTITIONS
- if (pdata->nr_partitions > 0) {
+ {
const char **probes = { NULL };
- if (pdata->probes)
- probes = (const char **)pdata->probes;
+ if (pdata->part_probes)
+ probes = (const char **)pdata->part_probes;
err = parse_mtd_partitions(info->mtd, probes,
&info->partitions, 0);
@@ -237,6 +243,7 @@
if (add_mtd_device(info->mtd)) {
dev_err(dev, "add_mtd_device() failed\n");
err = -ENOMEM;
+ goto exit_free;
}
dev_info(dev, "registered mtd device\n");
reply other threads:[~2005-11-28 13:30 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20051128133003.GA10558@localhost.localdomain \
--to=s.hauer@pengutronix.de \
--cc=ben@simtec.co.uk \
--cc=linux-mtd@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