Skip to contentSkip to conversation

CORE: adding mtd_get_partition_physaddr()

PATCH In review Jared Hulbert 3 participants 4 messages Aug 29, 2006 – Aug 30, 2006 Memory technology devices (MTD)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 CORE: adding mtd_get_partition_physaddr()

This is to allow axfs to get the physical address on the flash of it's partition.

drivers/mtd/mtdpart.c +0 -0
index 06a9303..37aed8a 100644
@@ -40,6 +40,17 @@ struct mtd_part {
 */

#define PART(x) ((struct mtd_part *)(x))

+/*
+ * Allow other modules to get the physical address of a given partition
+ */
+void * mtd_get_partition_physaddr (struct mtd_info *mtd)
+{
+ struct mtd_part *part = PART(mtd);
+ struct map_info *map = part->master->priv;
+
+ return (void *)(map->phys + part->offset);
+}
+EXPORT_SYMBOL_GPL(mtd_get_partition_physaddr);

/*
* MTD methods which simply translate the effective address and pass through

include/linux/mtd/partitions.h +0 -0
index da6b3d6..adf6207 100644
@@ -68,6 +68,7 @@ extern int register_mtd_parser(struct mt

extern int deregister_mtd_parser(struct mtd_part_parser *parser); extern int parse_mtd_partitions(struct mtd_info *master, const char **types,

				struct mtd_partition **pparts, unsigned long origin);

+extern void * mtd_get_partition_physaddr(struct mtd_info *mtd);

#define put_partition_parser(p) do { module_put((p)->owner); } while(0)

#1 lore raw
Quoted 10 lines · Jared Hulbert

This is to allow axfs to get the physical address on the flash of it's partition.

drivers/mtd/mtdpart.c +0 -0
index 06a9303..37aed8a 100644

drivers/mtd/mtdpart.c struct mtd_part { · line 46

Quoted 7 lines
drivers/mtd/mtdpart.c +4 -0
@@ -40,6 +40,17 @@ struct mtd_part {
  */
 #define PART(x)  ((struct mtd_part *)(x))
 
+/*
+ * Allow other modules to get the physical address of a given partition
+ */
+void * mtd_get_partition_physaddr (struct mtd_info *mtd)

Nit: No space between the paren and the function name please.

include/linux/mtd/partitions.h extern int register_mtd_parser(struct mt · line 71

Quoted 11 lines
drivers/mtd/mtdpart.c +0 -0
 /*
  * MTD methods which simply translate the effective address and pass through
include/linux/mtd/partitions.h +1 -0
index da6b3d6..adf6207 100644
@@ -68,6 +68,7 @@ extern int register_mtd_parser(struct mt
 extern int deregister_mtd_parser(struct mtd_part_parser *parser);
 extern int parse_mtd_partitions(struct mtd_info *master, const char **types,
 				struct mtd_partition **pparts, unsigned long origin);
+extern void * mtd_get_partition_physaddr(struct mtd_info *mtd);

Couldn't this be a proper prototype instead of an extern?

josh

#2 lore raw
Quoted 3 lines
Quoted 1 line

+void * mtd_get_partition_physaddr (struct mtd_info *mtd)

Nit: No space between the paren and the function name please.

oops

Quoted 3 lines
Quoted 1 line

+extern void * mtd_get_partition_physaddr(struct mtd_info *mtd);

Couldn't this be a proper prototype instead of an extern?

I thought EXPORT_SYMBOL_GPL() implied it should be extern. Is that incorrect?

#3 lore raw

Hello.

Quoted 5 lines · Jared Hulbert
Quoted 3 lines
Quoted 1 line

+extern void * mtd_get_partition_physaddr(struct mtd_info *mtd);

Couldn't this be a proper prototype instead of an extern?

I thought EXPORT_SYMBOL_GPL() implied it should be extern. Is that incorrect?

Function declarations in C imply 'extern' by default.

WBR, Sergei