add 'static' where sensible to physmap.c [PATCH]

Rainer Weikusat rainer.weikusat at sncag.com
Wed Jul 7 23:16:14 EDT 2004


This is a small patch that changes everything in physmap.c
that does not need external linkage to static linkage (ie
everything):

----------------
Index: physmap.c
===================================================================
RCS file: /home/cvs/repo/linux-rsg/drivers/mtd/maps/physmap.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- physmap.c	8 Jul 2004 03:00:41 -0000	1.6
+++ physmap.c	8 Jul 2004 03:01:23 -0000	1.7
@@ -22,50 +22,50 @@
 
 static struct mtd_info *mymtd;
 
-__u8 physmap_read8(struct map_info *map, unsigned long ofs)
+static __u8 physmap_read8(struct map_info *map, unsigned long ofs)
 {
 	return __raw_readb(map->map_priv_1 + ofs);
 }
 
-__u16 physmap_read16(struct map_info *map, unsigned long ofs)
+static __u16 physmap_read16(struct map_info *map, unsigned long ofs)
 {
 	return __raw_readw(map->map_priv_1 + ofs);
 }
 
-__u32 physmap_read32(struct map_info *map, unsigned long ofs)
+static __u32 physmap_read32(struct map_info *map, unsigned long ofs)
 {
 	return __raw_readl(map->map_priv_1 + ofs);
 }
 
-void physmap_copy_from(struct map_info *map, void *to, unsigned long from, ssize_t len)
+static void physmap_copy_from(struct map_info *map, void *to, unsigned long from, ssize_t len)
 {
 	memcpy_fromio(to, map->map_priv_1 + from, len);
 }
 
-void physmap_write8(struct map_info *map, __u8 d, unsigned long adr)
+static void physmap_write8(struct map_info *map, __u8 d, unsigned long adr)
 {
 	__raw_writeb(d, map->map_priv_1 + adr);
 	mb();
 }
 
-void physmap_write16(struct map_info *map, __u16 d, unsigned long adr)
+static void physmap_write16(struct map_info *map, __u16 d, unsigned long adr)
 {
 	__raw_writew(d, map->map_priv_1 + adr);
 	mb();
 }
 
-void physmap_write32(struct map_info *map, __u32 d, unsigned long adr)
+static void physmap_write32(struct map_info *map, __u32 d, unsigned long adr)
 {
 	__raw_writel(d, map->map_priv_1 + adr);
 	mb();
 }
 
-void physmap_copy_to(struct map_info *map, unsigned long to, const void *from, ssize_t len)
+static void physmap_copy_to(struct map_info *map, unsigned long to, const void *from, ssize_t len)
 {
 	memcpy_toio(map->map_priv_1 + to, from, len);
 }
 
-struct map_info physmap_map = {
+static struct map_info physmap_map = {
 	name: "Physically mapped flash",
 	size: WINDOW_SIZE,
 	buswidth: BUSWIDTH,
@@ -115,7 +115,7 @@
 #endif
 #endif
 
-int __init init_physmap(void)
+static int __init init_physmap(void)
 {
 	static const char *rom_probe_types[] = { "cfi_probe", "jedec_probe", "map_rom", 0 };
 	const char **type;
-------------

The device I am working on here happens to be equipped w/ AMD flash
chips of different types in a not necessarily continous memory
mapping (29LV160D, 29LV320D and 29DL640D). Instead of adding yet
another board-specific driver sitting atop a generic interface, I
would rather change the physmap-driver to deal w/ multiple different
flash chips (I tried to use a naive configuration, but the results
were less than encouraging). Which leads to a question: Would it be
better to create a "multi physmap"-driver, starting with a copy of the
existing one, or to modify physmap.c to handle both
cases. Personallly, I would prefer the latter, to avoid code
duplication where possible. But the file would certainly not get
prettier by adding a lot of #ifdefs to it. Any suggestions on this?




More information about the linux-mtd mailing list