LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH] physmap: Make map_info customizable
@ 2008-11-05 14:40 Atsushi Nemoto
  0 siblings, 0 replies; only message in thread
From: Atsushi Nemoto @ 2008-11-05 14:40 UTC (permalink / raw)
  To: linux-mtd; +Cc: David Woodhouse, linux-kernel

Add a hook to physmap_flash_data for map_info initialization.
This makes platform code can customize map operations.

Signed-off-by: Atsushi Nemoto <anemo@mba.ocn.ne.jp>
---
Background: I wrote this patch to support RBTX4939 board, which
requires custom map->{read,write,copy_from} function.  I think
extending the physmap driver is better than adding a new map driver.

 drivers/mtd/maps/physmap.c  |    5 ++++-
 include/linux/mtd/physmap.h |    1 +
 2 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/drivers/mtd/maps/physmap.c b/drivers/mtd/maps/physmap.c
index dfbf3f2..7ca048d 100644
--- a/drivers/mtd/maps/physmap.c
+++ b/drivers/mtd/maps/physmap.c
@@ -128,7 +128,10 @@ static int physmap_flash_probe(struct platform_device *dev)
 			goto err_out;
 		}
 
-		simple_map_init(&info->map[i]);
+		if (physmap_data->map_init)
+			(*physmap_data->map_init)(&info->map[i]);
+		else
+			simple_map_init(&info->map[i]);
 
 		probe_type = rom_probe_types;
 		for (; info->mtd[i] == NULL && *probe_type != NULL; probe_type++)
diff --git a/include/linux/mtd/physmap.h b/include/linux/mtd/physmap.h
index c8e63a5..bf51a63 100644
--- a/include/linux/mtd/physmap.h
+++ b/include/linux/mtd/physmap.h
@@ -25,6 +25,7 @@ struct physmap_flash_data {
 	void			(*set_vpp)(struct map_info *, int);
 	unsigned int		nr_parts;
 	struct mtd_partition	*parts;
+	void			(*map_init)(struct map_info *map);
 };
 
 /*
-- 
1.5.6.3


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2008-11-05 14:40 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-11-05 14:40 [PATCH] physmap: Make map_info customizable Atsushi Nemoto

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).