]> git.karo-electronics.de Git - mv-sheeva.git/commitdiff
Merge git://git.infradead.org/users/dwmw2/mtd-2.6.38
authorLinus Torvalds <torvalds@linux-foundation.org>
Sun, 13 Mar 2011 22:56:22 +0000 (15:56 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Sun, 13 Mar 2011 22:56:22 +0000 (15:56 -0700)
* git://git.infradead.org/users/dwmw2/mtd-2.6.38:
  mtd: add "platform:" prefix for platform modalias
  mtd: mtd_blkdevs: fix double free on error path
  mtd: amd76xrom: fix oops at boot when resources are not available
  mtd: fix race in cfi_cmdset_0001 driver
  mtd: jedec_probe: initialise make sector erase command variable
  mtd: jedec_probe: Change variable name from cfi_p to cfi

drivers/mtd/chips/cfi_cmdset_0001.c
drivers/mtd/chips/jedec_probe.c
drivers/mtd/maps/amd76xrom.c
drivers/mtd/mtd_blkdevs.c
drivers/mtd/nand/omap2.c
drivers/mtd/onenand/generic.c
drivers/mtd/onenand/omap2.c

index a8c3e1c9b02a78a64a79f5701abac9d1ba29a3e4..4aaa88f8ab5f0323f015dd34c46c4d0f98703ada 100644 (file)
@@ -1230,10 +1230,32 @@ static int inval_cache_and_wait_for_operation(
        sleep_time = chip_op_time / 2;
 
        for (;;) {
+               if (chip->state != chip_state) {
+                       /* Someone's suspended the operation: sleep */
+                       DECLARE_WAITQUEUE(wait, current);
+                       set_current_state(TASK_UNINTERRUPTIBLE);
+                       add_wait_queue(&chip->wq, &wait);
+                       mutex_unlock(&chip->mutex);
+                       schedule();
+                       remove_wait_queue(&chip->wq, &wait);
+                       mutex_lock(&chip->mutex);
+                       continue;
+               }
+
                status = map_read(map, cmd_adr);
                if (map_word_andequal(map, status, status_OK, status_OK))
                        break;
 
+               if (chip->erase_suspended && chip_state == FL_ERASING)  {
+                       /* Erase suspend occured while sleep: reset timeout */
+                       timeo = reset_timeo;
+                       chip->erase_suspended = 0;
+               }
+               if (chip->write_suspended && chip_state == FL_WRITING)  {
+                       /* Write suspend occured while sleep: reset timeout */
+                       timeo = reset_timeo;
+                       chip->write_suspended = 0;
+               }
                if (!timeo) {
                        map_write(map, CMD(0x70), cmd_adr);
                        chip->state = FL_STATUS;
@@ -1257,27 +1279,6 @@ static int inval_cache_and_wait_for_operation(
                        timeo--;
                }
                mutex_lock(&chip->mutex);
-
-               while (chip->state != chip_state) {
-                       /* Someone's suspended the operation: sleep */
-                       DECLARE_WAITQUEUE(wait, current);
-                       set_current_state(TASK_UNINTERRUPTIBLE);
-                       add_wait_queue(&chip->wq, &wait);
-                       mutex_unlock(&chip->mutex);
-                       schedule();
-                       remove_wait_queue(&chip->wq, &wait);
-                       mutex_lock(&chip->mutex);
-               }
-               if (chip->erase_suspended && chip_state == FL_ERASING)  {
-                       /* Erase suspend occured while sleep: reset timeout */
-                       timeo = reset_timeo;
-                       chip->erase_suspended = 0;
-               }
-               if (chip->write_suspended && chip_state == FL_WRITING)  {
-                       /* Write suspend occured while sleep: reset timeout */
-                       timeo = reset_timeo;
-                       chip->write_suspended = 0;
-               }
        }
 
        /* Done and happy. */
index d72a5fb2d041eb7f57a4257c9de708d061f63e35..4e1be51cc122618d60b69297726b96dcb896a0ef 100644 (file)
@@ -1935,14 +1935,14 @@ static void jedec_reset(u32 base, struct map_info *map, struct cfi_private *cfi)
 }
 
 
-static int cfi_jedec_setup(struct cfi_private *p_cfi, int index)
+static int cfi_jedec_setup(struct map_info *map, struct cfi_private *cfi, int index)
 {
        int i,num_erase_regions;
        uint8_t uaddr;
 
-       if (! (jedec_table[index].devtypes & p_cfi->device_type)) {
+       if (!(jedec_table[index].devtypes & cfi->device_type)) {
                DEBUG(MTD_DEBUG_LEVEL1, "Rejecting potential %s with incompatible %d-bit device type\n",
-                     jedec_table[index].name, 4 * (1<<p_cfi->device_type));
+                     jedec_table[index].name, 4 * (1<<cfi->device_type));
                return 0;
        }
 
@@ -1950,27 +1950,28 @@ static int cfi_jedec_setup(struct cfi_private *p_cfi, int index)
 
        num_erase_regions = jedec_table[index].nr_regions;
 
-       p_cfi->cfiq = kmalloc(sizeof(struct cfi_ident) + num_erase_regions * 4, GFP_KERNEL);
-       if (!p_cfi->cfiq) {
+       cfi->cfiq = kmalloc(sizeof(struct cfi_ident) + num_erase_regions * 4, GFP_KERNEL);
+       if (!cfi->cfiq) {
                //xx printk(KERN_WARNING "%s: kmalloc failed for CFI ident structure\n", map->name);
                return 0;
        }
 
-       memset(p_cfi->cfiq,0,sizeof(struct cfi_ident));
+       memset(cfi->cfiq, 0, sizeof(struct cfi_ident));
 
-       p_cfi->cfiq->P_ID = jedec_table[index].cmd_set;
-       p_cfi->cfiq->NumEraseRegions = jedec_table[index].nr_regions;
-       p_cfi->cfiq->DevSize = jedec_table[index].dev_size;
-       p_cfi->cfi_mode = CFI_MODE_JEDEC;
+       cfi->cfiq->P_ID = jedec_table[index].cmd_set;
+       cfi->cfiq->NumEraseRegions = jedec_table[index].nr_regions;
+       cfi->cfiq->DevSize = jedec_table[index].dev_size;
+       cfi->cfi_mode = CFI_MODE_JEDEC;
+       cfi->sector_erase_cmd = CMD(0x30);
 
        for (i=0; i<num_erase_regions; i++){
-               p_cfi->cfiq->EraseRegionInfo[i] = jedec_table[index].regions[i];
+               cfi->cfiq->EraseRegionInfo[i] = jedec_table[index].regions[i];
        }
-       p_cfi->cmdset_priv = NULL;
+       cfi->cmdset_priv = NULL;
 
        /* This may be redundant for some cases, but it doesn't hurt */
-       p_cfi->mfr = jedec_table[index].mfr_id;
-       p_cfi->id = jedec_table[index].dev_id;
+       cfi->mfr = jedec_table[index].mfr_id;
+       cfi->id = jedec_table[index].dev_id;
 
        uaddr = jedec_table[index].uaddr;
 
@@ -1978,8 +1979,8 @@ static int cfi_jedec_setup(struct cfi_private *p_cfi, int index)
           our brains explode when we see the datasheets talking about address
           lines numbered from A-1 to A18. The CFI table has unlock addresses
           in device-words according to the mode the device is connected in */
-       p_cfi->addr_unlock1 = unlock_addrs[uaddr].addr1 / p_cfi->device_type;
-       p_cfi->addr_unlock2 = unlock_addrs[uaddr].addr2 / p_cfi->device_type;
+       cfi->addr_unlock1 = unlock_addrs[uaddr].addr1 / cfi->device_type;
+       cfi->addr_unlock2 = unlock_addrs[uaddr].addr2 / cfi->device_type;
 
        return 1;       /* ok */
 }
@@ -2175,7 +2176,7 @@ static int jedec_probe_chip(struct map_info *map, __u32 base,
                                       "MTD %s(): matched device 0x%x,0x%x unlock_addrs: 0x%.4x 0x%.4x\n",
                                       __func__, cfi->mfr, cfi->id,
                                       cfi->addr_unlock1, cfi->addr_unlock2 );
-                               if (!cfi_jedec_setup(cfi, i))
+                               if (!cfi_jedec_setup(map, cfi, i))
                                        return 0;
                                goto ok_out;
                        }
index 77d64ce19e9f51828e301d6f6eb23f038fef6951..92de7e3a49a5e3b1c6c0590c8c3687cdebd1c132 100644 (file)
@@ -151,6 +151,7 @@ static int __devinit amd76xrom_init_one (struct pci_dev *pdev,
                printk(KERN_ERR MOD_NAME
                       " %s(): Unable to register resource %pR - kernel bug?\n",
                       __func__, &window->rsrc);
+               return -EBUSY;
        }
 
 
index cb20c67995d8ba52652d8765b80dbceb82eba2b8..e0a2373bf0e2fe5ad6fc9423d5db19f96e25de5a 100644 (file)
@@ -413,7 +413,6 @@ error3:
 error2:
        list_del(&new->list);
 error1:
-       kfree(new);
        return ret;
 }
 
index 15682ec8530ed008f8f3f8ddbd16e577306a6407..28af71c61834e8d08bd474a88cddbf8cf5d4bbe0 100644 (file)
@@ -968,6 +968,6 @@ static void __exit omap_nand_exit(void)
 module_init(omap_nand_init);
 module_exit(omap_nand_exit);
 
-MODULE_ALIAS(DRIVER_NAME);
+MODULE_ALIAS("platform:" DRIVER_NAME);
 MODULE_LICENSE("GPL");
 MODULE_DESCRIPTION("Glue layer for NAND flash on TI OMAP boards");
index e78914938c5c6930cee9b9462bd33cd271bdda2d..ac08750748a351ec3e70dd32825b5385f2a8966e 100644 (file)
@@ -131,7 +131,7 @@ static struct platform_driver generic_onenand_driver = {
        .remove         = __devexit_p(generic_onenand_remove),
 };
 
-MODULE_ALIAS(DRIVER_NAME);
+MODULE_ALIAS("platform:" DRIVER_NAME);
 
 static int __init generic_onenand_init(void)
 {
index ac31f461cc1c11cef486a5c2b6d7f37f47813e90..c849cacf4b2faab2679f1231982f6cb12e0aa192 100644 (file)
@@ -860,7 +860,7 @@ static void __exit omap2_onenand_exit(void)
 module_init(omap2_onenand_init);
 module_exit(omap2_onenand_exit);
 
-MODULE_ALIAS(DRIVER_NAME);
+MODULE_ALIAS("platform:" DRIVER_NAME);
 MODULE_LICENSE("GPL");
 MODULE_AUTHOR("Jarkko Lavinen <jarkko.lavinen@nokia.com>");
 MODULE_DESCRIPTION("Glue layer for OneNAND flash on OMAP2 / OMAP3");