Skip to contentSkip to conversation

MTD: some cleanups

PATCH In review Adrian Bunk 3 participants 4 messages Nov 12, 2004 – Nov 21, 2004

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 MTD: some cleanups

The patch below makes the following cleanups for code under drivers/mtd/ :
- make some needlessly global code static
- remove the following unused code:
- function ftl_freepart in drivers/mtd/ftl.c
- functions nettel_eraseconfig and nettel_erasecallback, struct nettel_erase in drivers/mtd/maps/nettel.c
- function physmap_set_partitions in drivers/mtd/maps/physmap.c

Please review whether this patch is correct, or whether it might conflict with MTD patches pending for kernel inclusion adding users for the code in question.

diffstat output:

 drivers/mtd/chips/cfi_cmdset_0001.c |    2 
 drivers/mtd/chips/cfi_cmdset_0002.c |    2 
 drivers/mtd/chips/cfi_cmdset_0020.c |    2 
 drivers/mtd/chips/chipreg.c         |    2 
 drivers/mtd/chips/jedec_probe.c     |    6 +-
 drivers/mtd/chips/map_absent.c      |    2 
 drivers/mtd/chips/map_ram.c         |    2 
 drivers/mtd/chips/map_rom.c         |    6 +-
 drivers/mtd/cmdlinepart.c           |    2 
 drivers/mtd/devices/blkmtd.c        |    8 +--
 drivers/mtd/devices/doc2000.c       |    2 
 drivers/mtd/devices/doc2001.c       |    2 
 drivers/mtd/devices/doc2001plus.c   |    2 
 drivers/mtd/devices/docprobe.c      |    2 
 drivers/mtd/devices/mtdram.c        |    6 +-
 drivers/mtd/devices/phram.c         |   12 ++---
 drivers/mtd/devices/pmc551.c        |    2 
 drivers/mtd/devices/slram.c         |   30 ++++++-------
 drivers/mtd/ftl.c                   |   31 --------------
 drivers/mtd/inftlcore.c             |    6 +-
 drivers/mtd/maps/amd76xrom.c        |    2 
 drivers/mtd/maps/elan-104nc.c       |    2 
 drivers/mtd/maps/ichxrom.c          |    2 
 drivers/mtd/maps/l440gx.c           |    4 -
 drivers/mtd/maps/nettel.c           |   61 ----------------------------
 drivers/mtd/maps/physmap.c          |    5 --
 drivers/mtd/maps/pnc2000.c          |    4 -
 drivers/mtd/maps/sbc_gxx.c          |    2 
 drivers/mtd/maps/scb2_flash.c       |    2 
 drivers/mtd/maps/scx200_docflash.c  |    2 
 drivers/mtd/mtd_blkdevs.c           |    8 +--
 drivers/mtd/mtdblock.c              |    4 -
 drivers/mtd/mtdblock.h              |    3 -
 drivers/mtd/mtdblock_ro.c           |    2 
 drivers/mtd/mtdcore.c               |    2 
 drivers/mtd/mtdpart.c               |    2 
 drivers/mtd/nand/diskonchip.c       |    4 -
 drivers/mtd/nftlcore.c              |    6 +-
 include/linux/mtd/partitions.h      |    1 
 include/linux/mtd/physmap.h         |   16 -------
 40 files changed, 78 insertions(+), 185 deletions(-)
drivers/mtd/chips/cfi_cmdset_0001.c renamed from drivers/mtd/chips/cfi_cmdset_0001.c.old +1 -1
@@ -1774,7 +1774,7 @@
 static char im_name_1[]="cfi_cmdset_0001";
 static char im_name_3[]="cfi_cmdset_0003";
 
-int __init cfi_intelext_init(void)
+static int __init cfi_intelext_init(void)
 {
 	inter_module_register(im_name_1, THIS_MODULE, &cfi_cmdset_0001);
 	inter_module_register(im_name_3, THIS_MODULE, &cfi_cmdset_0001);
drivers/mtd/chips/cfi_cmdset_0002.c renamed from drivers/mtd/chips/cfi_cmdset_0002.c.old +1 -1
@@ -1506,7 +1506,7 @@
 static char im_name[]="cfi_cmdset_0002";
 
 
-int __init cfi_amdstd_init(void)
+static int __init cfi_amdstd_init(void)
 {
 	inter_module_register(im_name, THIS_MODULE, &cfi_cmdset_0002);
 	return 0;
drivers/mtd/chips/cfi_cmdset_0020.c renamed from drivers/mtd/chips/cfi_cmdset_0020.c.old +1 -1
@@ -1401,7 +1401,7 @@
 
 static char im_name[]="cfi_cmdset_0020";
 
-int __init cfi_staa_init(void)
+static int __init cfi_staa_init(void)
 {
 	inter_module_register(im_name, THIS_MODULE, &cfi_cmdset_0020);
 	return 0;
drivers/mtd/chips/chipreg.c renamed from drivers/mtd/chips/chipreg.c.old +1 -1
@@ -15,7 +15,7 @@
 #include <linux/mtd/mtd.h>
 #include <linux/mtd/compatmac.h>
 
-spinlock_t chip_drvs_lock = SPIN_LOCK_UNLOCKED;
+static spinlock_t chip_drvs_lock = SPIN_LOCK_UNLOCKED;
 static LIST_HEAD(chip_drvs_list);
 
 void register_mtd_chip_driver(struct mtd_chip_driver *drv)
drivers/mtd/chips/jedec_probe.c renamed from drivers/mtd/chips/jedec_probe.c.old +3 -3
@@ -1661,7 +1661,7 @@
 static int jedec_probe_chip(struct map_info *map, __u32 base,
 			    unsigned long *chip_map, struct cfi_private *cfi);
 
-struct mtd_info *jedec_probe(struct map_info *map);
+static struct mtd_info *jedec_probe(struct map_info *map);
 
 static inline u32 jedec_read_mfr(struct map_info *map, __u32 base, 
 	struct cfi_private *cfi)
@@ -2055,7 +2055,7 @@
 	.probe_chip = jedec_probe_chip
 };
 
-struct mtd_info *jedec_probe(struct map_info *map)
+static struct mtd_info *jedec_probe(struct map_info *map)
 {
 	/*
 	 * Just use the generic probe stuff to call our CFI-specific
@@ -2070,7 +2070,7 @@
 	.module	= THIS_MODULE
 };
 
-int __init jedec_probe_init(void)
+static int __init jedec_probe_init(void)
 {
 	register_mtd_chip_driver(&jedec_chipdrv);
 	return 0;
drivers/mtd/chips/map_absent.c renamed from drivers/mtd/chips/map_absent.c.old +1 -1
@@ -98,7 +98,7 @@
 	/* nop */
 }
 
-int __init map_absent_init(void)
+static int __init map_absent_init(void)
 {
 	register_mtd_chip_driver(&map_absent_chipdrv);
 	return 0;
drivers/mtd/chips/map_ram.c renamed from drivers/mtd/chips/map_ram.c.old +1 -1
@@ -124,7 +124,7 @@
 	/* Nothing to see here */
 }
 
-int __init map_ram_init(void)
+static int __init map_ram_init(void)
 {
 	register_mtd_chip_driver(&mapram_chipdrv);
 	return 0;
drivers/mtd/chips/map_rom.c renamed from drivers/mtd/chips/map_rom.c.old +3 -3
@@ -19,7 +19,7 @@
 static int maprom_read (struct mtd_info *, loff_t, size_t, size_t *, u_char *);
 static int maprom_write (struct mtd_info *, loff_t, size_t, size_t *, const u_char *);
 static void maprom_nop (struct mtd_info *);
-struct mtd_info *map_rom_probe(struct map_info *map);
+static struct mtd_info *map_rom_probe(struct map_info *map);
 
 static struct mtd_chip_driver maprom_chipdrv = {
 	.probe	= map_rom_probe,
@@ -27,7 +27,7 @@
 	.module	= THIS_MODULE
 };
 
-struct mtd_info *map_rom_probe(struct map_info *map)
+static struct mtd_info *map_rom_probe(struct map_info *map)
 {
 	struct mtd_info *mtd;
 
@@ -75,7 +75,7 @@
 	return -EIO;
 }
 
-int __init map_rom_init(void)
+static int __init map_rom_init(void)
 {
 	register_mtd_chip_driver(&maprom_chipdrv);
 	return 0;
drivers/mtd/cmdlinepart.c renamed from drivers/mtd/cmdlinepart.c.old +1 -1
@@ -339,7 +339,7 @@
  * main.c::checksetup(). Note that we can not yet kmalloc() anything,
  * so we only save the commandline for later processing.
  */
-int mtdpart_setup(char *s)
+static int mtdpart_setup(char *s)
 {
 	cmdline = s;
 	return 1;
drivers/mtd/devices/blkmtd.c renamed from drivers/mtd/devices/blkmtd.c.old +4 -4
@@ -59,10 +59,10 @@
 #define MAX_DEVICES 4
 
 /* Module parameters passed by insmod/modprobe */
-char *device[MAX_DEVICES];    /* the block device to use */
-int erasesz[MAX_DEVICES];     /* optional default erase size */
-int ro[MAX_DEVICES];          /* optional read only flag */
-int sync;
+static char *device[MAX_DEVICES];    /* the block device to use */
+static int erasesz[MAX_DEVICES];     /* optional default erase size */
+static int ro[MAX_DEVICES];          /* optional read only flag */
+static int sync;
 
 
 MODULE_LICENSE("GPL");
drivers/mtd/devices/doc2000.c renamed from drivers/mtd/devices/doc2000.c.old +1 -1
@@ -1290,7 +1290,7 @@
  *
  ****************************************************************************/
 
-int __init init_doc2000(void)
+static int __init init_doc2000(void)
 {
        inter_module_register(im_name, THIS_MODULE, &DoC2k_init);
        return 0;
drivers/mtd/devices/doc2001.c renamed from drivers/mtd/devices/doc2001.c.old +1 -1
@@ -856,7 +856,7 @@
  *
  ****************************************************************************/
 
-int __init init_doc2001(void)
+static int __init init_doc2001(void)
 {
 	inter_module_register(im_name, THIS_MODULE, &DoCMil_init);
 	return 0;
drivers/mtd/devices/doc2001plus.c renamed from drivers/mtd/devices/doc2001plus.c.old +1 -1
@@ -1122,7 +1122,7 @@
  *
  ****************************************************************************/
 
-int __init init_doc2001plus(void)
+static int __init init_doc2001plus(void)
 {
 	inter_module_register(im_name, THIS_MODULE, &DoCMilPlus_init);
 	return 0;
drivers/mtd/devices/docprobe.c renamed from drivers/mtd/devices/docprobe.c.old +1 -1
@@ -328,7 +328,7 @@
  *
  ****************************************************************************/
 
-int __init init_doc(void)
+static int __init init_doc(void)
 {
 	int i;
 	
drivers/mtd/devices/mtdram.c renamed from drivers/mtd/devices/mtdram.c.old +3 -3
@@ -153,7 +153,7 @@
 
 #if CONFIG_MTDRAM_TOTAL_SIZE > 0
 #if CONFIG_MTDRAM_ABS_POS > 0
-int __init init_mtdram(void)
+static int __init init_mtdram(void)
 {
   void *addr;
   int err;
@@ -186,7 +186,7 @@
 
 #else /* CONFIG_MTDRAM_ABS_POS > 0 */
 
-int __init init_mtdram(void)
+static int __init init_mtdram(void)
 {
   void *addr;
   int err;
@@ -220,7 +220,7 @@
 
 #else /* CONFIG_MTDRAM_TOTAL_SIZE > 0 */
 
-int __init init_mtdram(void)
+static int __init init_mtdram(void)
 {
   return 0;
 }
drivers/mtd/devices/phram.c renamed from drivers/mtd/devices/phram.c.old +6 -6
@@ -39,7 +39,7 @@
 
 
 
-int phram_erase(struct mtd_info *mtd, struct erase_info *instr)
+static int phram_erase(struct mtd_info *mtd, struct erase_info *instr)
 {
 	u_char *start = (u_char *)mtd->priv;
 
@@ -60,7 +60,7 @@
 	return 0;
 }
 
-int phram_point(struct mtd_info *mtd, loff_t from, size_t len,
+static int phram_point(struct mtd_info *mtd, loff_t from, size_t len,
 		size_t *retlen, u_char **mtdbuf)
 {
 	u_char *start = (u_char *)mtd->priv;
@@ -73,11 +73,11 @@
 	return 0;
 }
 
-void phram_unpoint(struct mtd_info *mtd, u_char *addr, loff_t from, size_t len)
+static void phram_unpoint(struct mtd_info *mtd, u_char *addr, loff_t from, size_t len)
 {
 }
 
-int phram_read(struct mtd_info *mtd, loff_t from, size_t len,
+static int phram_read(struct mtd_info *mtd, loff_t from, size_t len,
 		size_t *retlen, u_char *buf)
 {
 	u_char *start = (u_char *)mtd->priv;
@@ -91,7 +91,7 @@
 	return 0;
 }
 
-int phram_write(struct mtd_info *mtd, loff_t to, size_t len,
+static int phram_write(struct mtd_info *mtd, loff_t to, size_t len,
 		size_t *retlen, const u_char *buf)
 {
 	u_char *start = (u_char *)mtd->priv;
@@ -340,7 +340,7 @@
 MODULE_PARM_DESC(slram, "List of memory regions to map. \"map=<name>,<start><length/end>\"");
 
 
-int __init init_phram(void)
+static int __init init_phram(void)
 {
 	printk(KERN_ERR "phram loaded\n");
 	return 0;
drivers/mtd/devices/pmc551.c renamed from drivers/mtd/devices/pmc551.c.old +1 -1
@@ -648,7 +648,7 @@
 /*
  * PMC551 Card Initialization
  */
-int __init init_pmc551(void)
+static int __init init_pmc551(void)
 {
         struct pci_dev *PCI_Device = NULL;
         struct mypriv *priv;
drivers/mtd/devices/slram.c renamed from drivers/mtd/devices/slram.c.old +15 -15
@@ -75,13 +75,13 @@
 
 static slram_mtd_list_t *slram_mtdlist = NULL;
 
-int slram_erase(struct mtd_info *, struct erase_info *);
-int slram_point(struct mtd_info *, loff_t, size_t, size_t *, u_char **);
-void slram_unpoint(struct mtd_info *, u_char *, loff_t,	size_t);
-int slram_read(struct mtd_info *, loff_t, size_t, size_t *, u_char *);
-int slram_write(struct mtd_info *, loff_t, size_t, size_t *, const u_char *);
+static int slram_erase(struct mtd_info *, struct erase_info *);
+static int slram_point(struct mtd_info *, loff_t, size_t, size_t *, u_char **);
+static void slram_unpoint(struct mtd_info *, u_char *, loff_t,	size_t);
+static int slram_read(struct mtd_info *, loff_t, size_t, size_t *, u_char *);
+static int slram_write(struct mtd_info *, loff_t, size_t, size_t *, const u_char *);
 
-int slram_erase(struct mtd_info *mtd, struct erase_info *instr)
+static int slram_erase(struct mtd_info *mtd, struct erase_info *instr)
 {
 	slram_priv_t *priv = mtd->priv;
 
@@ -103,7 +103,7 @@
 	return(0);
 }
 
-int slram_point(struct mtd_info *mtd, loff_t from, size_t len,
+static int slram_point(struct mtd_info *mtd, loff_t from, size_t len,
 		size_t *retlen, u_char **mtdbuf)
 {
 	slram_priv_t *priv = (slram_priv_t *)mtd->priv;
@@ -113,11 +113,11 @@
 	return(0);
 }
 
-void slram_unpoint(struct mtd_info *mtd, u_char *addr, loff_t from, size_t len)
+static void slram_unpoint(struct mtd_info *mtd, u_char *addr, loff_t from, size_t len)
 {
 }
 
-int slram_read(struct mtd_info *mtd, loff_t from, size_t len,
+static int slram_read(struct mtd_info *mtd, loff_t from, size_t len,
 		size_t *retlen, u_char *buf)
 {
 	slram_priv_t *priv = (slram_priv_t *)mtd->priv;
@@ -128,7 +128,7 @@
 	return(0);
 }
 
-int slram_write(struct mtd_info *mtd, loff_t to, size_t len,
+static int slram_write(struct mtd_info *mtd, loff_t to, size_t len,
 		size_t *retlen, const u_char *buf)
 {
 	slram_priv_t *priv = (slram_priv_t *)mtd->priv;
@@ -141,7 +141,7 @@
 
 /*====================================================================*/
 
-int register_device(char *name, unsigned long start, unsigned long length)
+static int register_device(char *name, unsigned long start, unsigned long length)
 {
 	slram_mtd_list_t **curmtd;
 
@@ -213,7 +213,7 @@
 	return(0);	
 }
 
-void unregister_devices(void)
+static void unregister_devices(void)
 {
 	slram_mtd_list_t *nextitem;
 
@@ -228,7 +228,7 @@
 	}
 }
 
-unsigned long handle_unit(unsigned long value, char *unit)
+static unsigned long handle_unit(unsigned long value, char *unit)
 {
 	if ((*unit == 'M') || (*unit == 'm')) {
 		return(value * 1024 * 1024);
@@ -238,7 +238,7 @@
 	return(value);
 }
 
-int parse_cmdline(char *devname, char *szstart, char *szlength)
+static int parse_cmdline(char *devname, char *szstart, char *szlength)
 {
 	char *buffer;
 	unsigned long devstart;
@@ -285,7 +285,7 @@
 
 #endif
 
-int init_slram(void)
+static int init_slram(void)
 {
 	char *devname;
 	int i;
drivers/mtd/ftl.c renamed from drivers/mtd/ftl.c.old +2 -29
@@ -137,8 +137,6 @@
 #endif
 } partition_t;
 
-void ftl_freepart(partition_t *part);
-
 /* Partition state flags */
 #define FTL_FORMATTED	0x01
 
@@ -1014,31 +1012,6 @@
 
 /*====================================================================*/
 
-void ftl_freepart(partition_t *part)
-{
-    if (part->VirtualBlockMap) {
-	vfree(part->VirtualBlockMap);
-	part->VirtualBlockMap = NULL;
-    }
-    if (part->VirtualPageMap) {
-	kfree(part->VirtualPageMap);
-	part->VirtualPageMap = NULL;
-    }
-    if (part->EUNInfo) {
-	kfree(part->EUNInfo);
-	part->EUNInfo = NULL;
-    }
-    if (part->XferInfo) {
-	kfree(part->XferInfo);
-	part->XferInfo = NULL;
-    }
-    if (part->bam_cache) {
-	kfree(part->bam_cache);
-	part->bam_cache = NULL;
-    }
-    
-} /* ftl_freepart */
-
 static void ftl_add_mtd(struct mtd_blktrans_ops *tr, struct mtd_info *mtd)
 {
 	partition_t *partition;
@@ -1080,7 +1053,7 @@
 	kfree(dev);
 }
 
-struct mtd_blktrans_ops ftl_tr = {
+static struct mtd_blktrans_ops ftl_tr = {
 	.name		= "ftl",
 	.major		= FTL_MAJOR,
 	.part_bits	= PART_BITS,
@@ -1092,7 +1065,7 @@
 	.owner		= THIS_MODULE,
 };
 
-int init_ftl(void)
+static int init_ftl(void)
 {
 	DEBUG(0, "$Id: ftl.c,v 1.53 2004/08/09 13:55:43 dwmw2 Exp $\n");
 
drivers/mtd/inftlcore.c renamed from drivers/mtd/inftlcore.c.old +3 -3
@@ -352,7 +352,7 @@
 	return targetEUN;
 }
 
-u16 INFTL_makefreeblock(struct INFTLrecord *inftl, unsigned pendingblock)
+static u16 INFTL_makefreeblock(struct INFTLrecord *inftl, unsigned pendingblock)
 {
 	/*
 	 * This is the part that needs some cleverness applied. 
@@ -877,7 +877,7 @@
 	return 0;
 }
 
-struct mtd_blktrans_ops inftl_tr = {
+static struct mtd_blktrans_ops inftl_tr = {
 	.name		= "inftl",
 	.major		= INFTL_MAJOR,
 	.part_bits	= INFTL_PARTN_BITS,
@@ -891,7 +891,7 @@
 
 extern char inftlmountrev[];
 
-int __init init_inftl(void)
+static int __init init_inftl(void)
 {
 	printk(KERN_INFO "INFTL: inftlcore.c $Revision: 1.17 $, "
 		"inftlmount.c %s\n", inftlmountrev);
drivers/mtd/maps/amd76xrom.c renamed from drivers/mtd/maps/amd76xrom.c.old +1 -1
@@ -298,7 +298,7 @@
 };
 #endif
 
-int __init init_amd76xrom(void)
+static int __init init_amd76xrom(void)
 {
 	struct pci_dev *pdev;
 	struct pci_device_id *id;
drivers/mtd/maps/elan-104nc.c renamed from drivers/mtd/maps/elan-104nc.c.old +1 -1
@@ -185,7 +185,7 @@
 	iounmap((void *)iomapadr);
 }
 
-int __init init_elan_104nc(void)
+static int __init init_elan_104nc(void)
 {
 	/* Urg! We use I/O port 0x22 without request_region()ing it,
 	   because it's already allocated to the PIC. */
drivers/mtd/maps/ichxrom.c renamed from drivers/mtd/maps/ichxrom.c.old +1 -1
@@ -349,7 +349,7 @@
 };
 #endif
 
-int __init init_ichxrom(void)
+static int __init init_ichxrom(void)
 {
 	struct pci_dev *pdev;
 	struct pci_device_id *id;
drivers/mtd/maps/l440gx.c renamed from drivers/mtd/maps/l440gx.c.old +2 -2
@@ -30,7 +30,7 @@
 
 
 /* Is this really the vpp port? */
-void l440gx_set_vpp(struct map_info *map, int vpp)
+static void l440gx_set_vpp(struct map_info *map, int vpp)
 {
 	unsigned long l;
 
@@ -43,7 +43,7 @@
 	outl(l, VPP_PORT);
 }
 
-struct map_info l440gx_map = {
+static struct map_info l440gx_map = {
 	.name = "L440GX BIOS",
 	.size = WINDOW_SIZE,
 	.bankwidth = BUSWIDTH,
drivers/mtd/maps/nettel.c renamed from drivers/mtd/maps/nettel.c.old +2 -59

77 lines not on this page · raw message

include/linux/mtd/physmap.h renamed from include/linux/mtd/physmap.h.old +1 -15
@@ -41,21 +41,7 @@
 	physmap_map.set_vpp = set_vpp;
 }
 
-#if defined(CONFIG_MTD_PARTITIONS)
-
-/*
- * Machines that wish to do flash partition may want to call this function in 
- * their setup routine.  
- *
- *	physmap_set_partitions(mypartitions, num_parts);
- *
- * Note that one can always override this hard-coded partition with 
- * command line partition (you need to enable CONFIG_MTD_CMDLINE_PARTS).
- */
-void physmap_set_partitions(struct mtd_partition *parts, int num_parts);
-
-#endif /* defined(CONFIG_MTD_PARTITIONS) */
-#endif /* defined(CONFIG_MTD) */
+#endif /* defined(CONFIG_MTD_PHYSMAP) */
 
 #endif /* __LINUX_MTD_PHYSMAP__ */
 
drivers/mtd/maps/physmap.c renamed from drivers/mtd/maps/physmap.c.old +0 -5
@@ -38,11 +38,6 @@
 
 static const char *part_probes[] __initdata = {"cmdlinepart", "RedBoot", NULL};
 
-void physmap_set_partitions(struct mtd_partition *parts, int num_parts)
-{
-	physmap_partitions=parts;
-	num_physmap_partitions=num_parts;
-}
 #endif /* CONFIG_MTD_PARTITIONS */
 
 static int __init init_physmap(void)
drivers/mtd/maps/pnc2000.c renamed from drivers/mtd/maps/pnc2000.c.old +2 -2
@@ -26,7 +26,7 @@
  */
 
 
-struct map_info pnc_map = {
+static struct map_info pnc_map = {
 	.name = "PNC-2000",
 	.size = WINDOW_SIZE,
 	.bankwidth = 4,
@@ -62,7 +62,7 @@
  */
 static struct mtd_info *mymtd;
 
-int __init init_pnc2000(void)
+static int __init init_pnc2000(void)
 {
 	printk(KERN_NOTICE "Photron PNC-2000 flash mapping: %x at %x\n", WINDOW_SIZE, WINDOW_ADDR);
 
drivers/mtd/maps/sbc_gxx.c renamed from drivers/mtd/maps/sbc_gxx.c.old +1 -1
@@ -193,7 +193,7 @@
 	release_region(PAGE_IO,PAGE_IO_SIZE);
 }
 
-int __init init_sbc_gxx(void)
+static int __init init_sbc_gxx(void)
 {
   	iomapadr = (void __iomem *)ioremap(WINDOW_START, WINDOW_LENGTH);
 	if (!iomapadr) {
drivers/mtd/maps/scb2_flash.c renamed from drivers/mtd/maps/scb2_flash.c.old +1 -1
@@ -64,7 +64,7 @@
 
 static void *scb2_ioaddr;
 static struct mtd_info *scb2_mtd;
-struct map_info scb2_map = {
+static struct map_info scb2_map = {
 	.name =      "SCB2 BIOS Flash",
 	.size =      0,
 	.bankwidth =  1,
drivers/mtd/maps/scx200_docflash.c renamed from drivers/mtd/maps/scx200_docflash.c.old +1 -1
@@ -81,7 +81,7 @@
 	.name      = "NatSemi SCx200 DOCCS Flash",
 };
 
-int __init init_scx200_docflash(void)
+static int __init init_scx200_docflash(void)
 {
 	unsigned u;
 	unsigned base;
drivers/mtd/mtd_blkdevs.c renamed from drivers/mtd/mtd_blkdevs.c.old +4 -4
@@ -143,7 +143,7 @@
 }
 
 
-int blktrans_open(struct inode *i, struct file *f)
+static int blktrans_open(struct inode *i, struct file *f)
 {
 	struct mtd_blktrans_dev *dev;
 	struct mtd_blktrans_ops *tr;
@@ -174,7 +174,7 @@
 	return ret;
 }
 
-int blktrans_release(struct inode *i, struct file *f)
+static int blktrans_release(struct inode *i, struct file *f)
 {
 	struct mtd_blktrans_dev *dev;
 	struct mtd_blktrans_ops *tr;
@@ -326,7 +326,7 @@
 	return 0;
 }
 
-void blktrans_notify_remove(struct mtd_info *mtd)
+static void blktrans_notify_remove(struct mtd_info *mtd)
 {
 	struct list_head *this, *this2, *next;
 
@@ -342,7 +342,7 @@
 	}
 }
 
-void blktrans_notify_add(struct mtd_info *mtd)
+static void blktrans_notify_add(struct mtd_info *mtd)
 {
 	struct list_head *this;
 
drivers/mtd/mtdblock.h renamed from drivers/mtd/mtdblock.h.old +0 -3
@@ -29,7 +29,4 @@
 extern int do_cached_read (struct mtdblk_dev *mtdblk, unsigned long pos, 
 			   int len, char *buf);
 
-extern void __exit cleanup_mtdblock(void);
-extern int __init init_mtdblock(void);
-
 #endif
drivers/mtd/mtdblock.c renamed from drivers/mtd/mtdblock.c.old +2 -2
@@ -361,7 +361,7 @@
 	kfree(dev);
 }
 
-struct mtd_blktrans_ops mtdblock_tr = {
+static struct mtd_blktrans_ops mtdblock_tr = {
 	.name		= "mtdblock",
 	.major		= 31,
 	.part_bits	= 0,
@@ -375,7 +375,7 @@
 	.owner		= THIS_MODULE,
 };
 
-int __init init_mtdblock(void)
+static int __init init_mtdblock(void)
 {
 	return register_mtd_blktrans(&mtdblock_tr);
 }
drivers/mtd/mtdblock_ro.c renamed from drivers/mtd/mtdblock_ro.c.old +1 -1
@@ -58,7 +58,7 @@
 	kfree(dev);
 }
 
-struct mtd_blktrans_ops mtdblock_tr = {
+static struct mtd_blktrans_ops mtdblock_tr = {
 	.name		= "mtdblock",
 	.major		= 31,
 	.part_bits	= 0,
drivers/mtd/mtdcore.c renamed from drivers/mtd/mtdcore.c.old +1 -1
@@ -382,7 +382,7 @@
 /*====================================================================*/
 /* Init code */
 
-int __init init_mtd(void)
+static int __init init_mtd(void)
 {
 #ifdef CONFIG_PROC_FS
 	if ((proc_mtd = create_proc_entry( "mtd", 0, NULL )))
include/linux/mtd/partitions.h renamed from include/linux/mtd/partitions.h.old +0 -1
@@ -64,7 +64,6 @@
 	int (*parse_fn)(struct mtd_info *, struct mtd_partition **, unsigned long);
 };
 
-extern struct mtd_part_parser *get_partition_parser(const char *name);
 extern int register_mtd_parser(struct mtd_part_parser *parser);
 extern int deregister_mtd_parser(struct mtd_part_parser *parser);
 extern int parse_mtd_partitions(struct mtd_info *master, const char **types, 
drivers/mtd/mtdpart.c renamed from drivers/mtd/mtdpart.c.old +1 -1
@@ -526,7 +526,7 @@
 static spinlock_t part_parser_lock = SPIN_LOCK_UNLOCKED;
 static LIST_HEAD(part_parsers);
 
-struct mtd_part_parser *get_partition_parser(const char *name)
+static struct mtd_part_parser *get_partition_parser(const char *name)
 {
 	struct list_head *this;
 	void *ret = NULL;
drivers/mtd/nand/diskonchip.c renamed from drivers/mtd/nand/diskonchip.c.old +2 -2
@@ -1720,7 +1720,7 @@
 	}
 }
 
-int __init init_nanddoc(void)
+static int __init init_nanddoc(void)
 {
 	int i;
 
@@ -1758,7 +1758,7 @@
 	return 0;
 }
 
-void __exit cleanup_nanddoc(void)
+static void __exit cleanup_nanddoc(void)
 {
 	/* Cleanup the nand/DoC resources */
 	release_nanddoc();
drivers/mtd/nftlcore.c renamed from drivers/mtd/nftlcore.c.old +3 -3
@@ -421,7 +421,7 @@
 	return targetEUN;
 }
 
-u16 NFTL_makefreeblock( struct NFTLrecord *nftl , unsigned pendingblock)
+static u16 NFTL_makefreeblock( struct NFTLrecord *nftl , unsigned pendingblock)
 {
 	/* This is the part that needs some cleverness applied. 
 	   For now, I'm doing the minimum applicable to actually
@@ -731,7 +731,7 @@
  ****************************************************************************/
 
 
-struct mtd_blktrans_ops nftl_tr = {
+static struct mtd_blktrans_ops nftl_tr = {
 	.name		= "nftl",
 	.major		= NFTL_MAJOR,
 	.part_bits	= NFTL_PARTN_BITS,
@@ -747,7 +747,7 @@
 
 extern char nftlmountrev[];
 
-int __init init_nftl(void)
+static int __init init_nftl(void)
 {
 	printk(KERN_INFO "NFTL driver: nftlcore.c $Revision: 1.96 $, nftlmount.c %s\n", nftlmountrev);
 
#1 lore raw
Quoted 2 lines · Adrian Bunk

The patch below makes the following cleanups for code under drivers/mtd/ :
- make some needlessly global code static

OK.

Quoted 2 lines

- remove the following unused code:
- function ftl_freepart in drivers/mtd/ftl.c

It's a bug that we never free these. We should call the function occasionally instead of deleting it.

Quoted 2 lines

- functions nettel_eraseconfig and nettel_erasecallback, struct nettel_erase in drivers/mtd/maps/nettel.c

The nettel_eraseconfig() function isn't static -- I assume it was called from the nettel-specific platform code.

Quoted 1 line

- function physmap_set_partitions in drivers/mtd/maps/physmap.c

Again that's called from elsewhere.

Signature · 1 line
dwmw2
#2 lore raw
Quoted 5 lines · David Woodhouse
Quoted 2 lines · Adrian Bunk

The patch below makes the following cleanups for code under drivers/mtd/ :
- make some needlessly global code static

OK.

Thanks.

Quoted 5 lines
Quoted 2 lines

- remove the following unused code:
- function ftl_freepart in drivers/mtd/ftl.c

It's a bug that we never free these. We should call the function occasionally instead of deleting it.

OK.

Quoted 11 lines
Quoted 2 lines

- functions nettel_eraseconfig and nettel_erasecallback, struct nettel_erase in drivers/mtd/maps/nettel.c

The nettel_eraseconfig() function isn't static -- I assume it was called from the nettel-specific platform code.

From some platform code where the merging into the kernel is pending?

Quoted 1 line

- function physmap_set_partitions in drivers/mtd/maps/physmap.c

Again that's called from elsewhere.

The merging of the code calling it into the kernel is pending?

Quoted 1 line

dwmw2

cu
Adrian

Signature · 4 lines
       "Is there not promise of rain?" Ling Tan asked suddenly out
        of the darkness. There had been need of rain for many days.
       "Only a promise," Lao Er said.
                                       Pearl S. Buck - Dragon Seed
#3 lore raw
Quoted 3 lines · Adrian Bunk
Quoted 1 line

Again that's called from elsewhere.

The merging of the code calling it into the kernel is pending?

I believe so, yes.

Signature · 1 line
dwmw2