ramips: fix cd-poll sd card remove randomly
[openwrt/openwrt.git] / target / linux / generic / patches-3.18 / 440-block2mtd_init.patch
index a5819984bfbf0c9f8593df41544046eb541293a6..5ab60265a3fa97095fbe1fb6167db2b859adaff4 100644 (file)
@@ -8,10 +8,10 @@
  #include <linux/mutex.h>
  #include <linux/mount.h>
  #include <linux/slab.h>
-@@ -210,11 +211,12 @@ static void block2mtd_free_device(struct
+@@ -209,11 +210,12 @@ static void block2mtd_free_device(struct
+ }
  
  
- /* FIXME: ensure that mtd->size % erase_size == 0 */
 -static struct block2mtd_dev *add_device(char *devname, int erase_size)
 +static struct block2mtd_dev *add_device(char *devname, int erase_size, const char *mtdname)
  {
@@ -22,7 +22,7 @@
        char *name;
  
        if (!devname)
-@@ -253,13 +255,16 @@ static struct block2mtd_dev *add_device(
+@@ -257,13 +259,16 @@ static struct block2mtd_dev *add_device(
  
        /* Setup the MTD structure */
        /* make the name contain the block device in */
@@ -31,7 +31,7 @@
 +              mtdname = devname;
 +      name = kmalloc(strlen(mtdname) + 1, GFP_KERNEL);
        if (!name)
-               goto devinit_err;
+               goto err_destroy_mutex;
  
 +      strcpy(name, mtdname);
        dev->mtd.name = name;
@@ -41,7 +41,7 @@
        dev->mtd.erasesize = erase_size;
        dev->mtd.writesize = 1;
        dev->mtd.writebufsize = PAGE_SIZE;
-@@ -272,15 +277,18 @@ static struct block2mtd_dev *add_device(
+@@ -276,15 +281,18 @@ static struct block2mtd_dev *add_device(
        dev->mtd.priv = dev;
        dev->mtd.owner = THIS_MODULE;
  
@@ -52,7 +52,7 @@
 +      part->size = dev->mtd.size;
 +      if (mtd_device_register(&dev->mtd, part, 1)) {
                /* Device didn't get added, so free the entry */
-               goto devinit_err;
+               goto err_destroy_mutex;
        }
        list_add(&dev->list, &blkmtd_device_list);
        pr_info("mtd%d: [%s] erase_size = %dKiB [%d]\n",
@@ -62,8 +62,8 @@
 +              mtdname, dev->mtd.erasesize >> 10, dev->mtd.erasesize);
        return dev;
  
devinit_err:
-@@ -347,9 +355,9 @@ static char block2mtd_paramline[80 + 12]
err_destroy_mutex:
+@@ -353,9 +361,9 @@ static char block2mtd_paramline[80 + 12]
  
  static int block2mtd_setup2(const char *val)
  {
@@ -75,7 +75,7 @@
        char *name;
        size_t erase_size = PAGE_SIZE;
        int i, ret;
-@@ -362,7 +370,7 @@ static int block2mtd_setup2(const char *
+@@ -368,7 +376,7 @@ static int block2mtd_setup2(const char *
        strcpy(str, val);
        kill_final_newline(str);
  
@@ -84,7 +84,7 @@
                token[i] = strsep(&str, ",");
  
        if (str) {
-@@ -388,8 +396,10 @@ static int block2mtd_setup2(const char *
+@@ -394,8 +402,10 @@ static int block2mtd_setup2(const char *
                        return 0;
                }
        }
@@ -96,7 +96,7 @@
  
        return 0;
  }
-@@ -423,7 +433,7 @@ static int block2mtd_setup(const char *v
+@@ -429,7 +439,7 @@ static int block2mtd_setup(const char *v
  
  
  module_param_call(block2mtd, block2mtd_setup, NULL, NULL, 0200);