brcm47xx: generate image to flash on Netgear WNDR3400.
[openwrt.git] / target / linux / brcm47xx / patches-3.0 / 230-flash_linux_3_0.patch
1 --- a/drivers/mtd/maps/bcm47xx-flash.c
2 +++ b/drivers/mtd/maps/bcm47xx-flash.c
3 @@ -44,9 +44,7 @@
4  #include <linux/wait.h>
5  #include <linux/mtd/mtd.h>
6  #include <linux/mtd/map.h>
7 -#ifdef CONFIG_MTD_PARTITIONS
8  #include <linux/mtd/partitions.h>
9 -#endif
10  #include <linux/crc32.h>
11  #ifdef CONFIG_SSB
12  #include <linux/ssb/ssb.h>
13 @@ -120,7 +118,6 @@ static struct map_info bcm47xx_map = {
14         phys: WINDOW_ADDR,
15  };
16  
17 -#ifdef CONFIG_MTD_PARTITIONS
18  
19  static struct mtd_partition bcm47xx_parts[] = {
20         { name: "cfe",  offset: 0, size: 0, mask_flags: MTD_WRITEABLE, },
21 @@ -552,7 +549,6 @@ init_mtd_partitions(struct mtd_info *mtd
22  
23         return bcm47xx_parts;
24  }
25 -#endif
26  
27  int __init init_bcm47xx_map(void)
28  {
29 @@ -561,10 +557,8 @@ int __init init_bcm47xx_map(void)
30  #endif
31         size_t size;
32         int ret = 0;
33 -#ifdef CONFIG_MTD_PARTITIONS
34         struct mtd_partition *parts;
35         int i;
36 -#endif
37  
38  #ifdef CONFIG_SSB
39         u32 window = mcore->flash_window;
40 @@ -602,15 +596,13 @@ int __init init_bcm47xx_map(void)
41  
42         printk(KERN_NOTICE "Flash device: 0x%x at 0x%x\n", size, WINDOW_ADDR);
43  
44 -#ifdef CONFIG_MTD_PARTITIONS
45         parts = init_mtd_partitions(bcm47xx_mtd, size);
46         for (i = 0; parts[i].name; i++);
47 -       ret = add_mtd_partitions(bcm47xx_mtd, parts, i);
48 +       ret = mtd_device_register(bcm47xx_mtd, parts, i);
49         if (ret) {
50 -               printk(KERN_ERR "Flash: add_mtd_partitions failed\n");
51 +               printk(KERN_ERR "Flash: mtd_device_register failed\n");
52                 goto fail;
53         }
54 -#endif
55         return 0;
56  
57   fail:
58 @@ -624,9 +616,7 @@ int __init init_bcm47xx_map(void)
59  
60  void __exit cleanup_bcm47xx_map(void)
61  {
62 -#ifdef CONFIG_MTD_PARTITIONS
63 -       del_mtd_partitions(bcm47xx_mtd);
64 -#endif
65 +       mtd_device_unregister(bcm47xx_mtd);
66         map_destroy(bcm47xx_mtd);
67         iounmap((void *)bcm47xx_map.virt);
68  }