static int of_flash_remove(struct of_device *dev)
{
	struct of_flash *info;
	int i;

	info = dev_get_drvdata(&dev->dev);
	if (!info)
		return 0;
	dev_set_drvdata(&dev->dev, NULL);

#ifdef CONFIG_MTD_CONCAT
	if (info->cmtd != info->list[0].mtd) {
		del_mtd_device(info->cmtd);
		mtd_concat_destroy(info->cmtd);
	}
#endif

	if (info->cmtd) {
		if (OF_FLASH_PARTS(info)) {
			del_mtd_partitions(info->cmtd);
			kfree(OF_FLASH_PARTS(info));
		} else {
			del_mtd_device(info->cmtd);
		}
	}

	for (i = 0; i < info->list_size; i++) {
		if (info->list[i].mtd)
			map_destroy(info->list[i].mtd);

		if (info->list[i].map.virt)
			iounmap(info->list[i].map.virt);

		if (info->list[i].res) {
			release_resource(info->list[i].res);
			kfree(info->list[i].res);
		}
	}

	kfree(info);

	return 0;
}
Exemple #2
0
static void __exit cleanup_brcm_physmap(void)
{
	if (mymtd) {
		del_mtd_device(mymtd);
		map_destroy(mymtd);
	}
	if (brcm_physmap_map.map_priv_1) {
		brcm_physmap_map.map_priv_1 = 0;
	}
}
Exemple #3
0
static void __exit  cleanup_tsunami_flash(void)
{
	struct mtd_info *mtd;
	mtd = tsunami_flash_mtd;
	if (mtd) {
		del_mtd_device(mtd);
		map_destroy(mtd);
	}
	tsunami_flash_mtd = 0;
}
static void __exit cleanup_opb_mtd(void) {
	if (mtd_bank) {
		del_mtd_device(mtd_bank);
		map_destroy(mtd_bank);
	}
	if (map_bank.virt) {
		iounmap((void *)map_bank.virt);
		map_bank.virt = 0;
	}
}
Exemple #5
0
static void __exit cleanup_mpc8313rdb(void)
{
	if (mymtd) {
		del_mtd_device(mymtd);
		map_destroy(mymtd);
	}
	if (mpc8313rdb_map.virt) {
		iounmap((void *)mpc8313rdb_map.virt);
		mpc8313rdb_map.virt = 0;
	}
}
mod_exit_t cleanup_dragonix(void)
{
	if (mymtd) {
		del_mtd_device(mymtd);
		map_destroy(mymtd);
	}
	if (dragonix_map.map_priv_1) {
		iounmap((void *)dragonix_map.map_priv_1);
		dragonix_map.map_priv_1 = 0;
	}
}
static void __exit cleanup_s3c2410nor(void)
{
if (mymtd) {
del_mtd_device(mymtd);
map_destroy(mymtd);
}
if (s3c2410nor_map.virt) {
iounmap((void *)s3c2410nor_map.virt);
s3c2410nor_map.virt = 0;
}
}
Exemple #8
0
static void __exit cleanup_am8xx(void)
{
    if (mymtd) {
        del_mtd_device(mymtd);
        map_destroy(mymtd);
    }
    if (am8xx_map.map_priv_1) {
        iounmap((void *)am8xx_map.map_priv_1);
        am8xx_map.map_priv_1 = 0;
    }
}
Exemple #9
0
mod_exit_t
sflash_mtd_exit(void)
{
#ifdef CONFIG_MTD_PARTITIONS
	del_mtd_partitions(&sflash.mtd);
#else
	del_mtd_device(&sflash.mtd);
#endif
	iounmap((void *) sflash.cc);
	sb_detach(sflash.sbh);
}
Exemple #10
0
static void __exit cleanup_sc520cdp(void)
{
    int i;

    if (merged_mtd) {
        del_mtd_device(merged_mtd);
        mtd_concat_destroy(merged_mtd);
    }
    if (mymtd[2])
        del_mtd_device(mymtd[2]);

    for (i = 0; i < NUM_FLASH_BANKS; i++) {
        if (mymtd[i])
            map_destroy(mymtd[i]);
        if (sc520cdp_map[i].virt) {
            iounmap((void *)sc520cdp_map[i].virt);
            sc520cdp_map[i].virt = 0;
        }
    }
}
Exemple #11
0
static void __exit cleanup_physmap(void)
{
	if (mymtd) {
		del_mtd_device(mymtd);
		map_destroy(mymtd);
	}
	if (physmap_map.map_priv_1) {
		iounmap((void *)physmap_map.map_priv_1);
		physmap_map.map_priv_1 = 0;
	}
}
Exemple #12
0
static void __exit cleanup_mbx(void)
{
	if (mymtd) {
		del_mtd_device(mymtd);
		map_destroy(mymtd);
	}
	if (mbx_map.virt) {
		iounmap((void *)mbx_map.virt);
		mbx_map.virt = 0;
	}
}
Exemple #13
0
static void __exit cleanup_ag_hmc80_mtdmap(void)
{
	if (mymtd) {
		del_mtd_device(mymtd);
		map_destroy(mymtd);
	}
	if (ag_hmc80_map.virt) {
		iounmap((void *)ag_hmc80_map.virt);
		ag_hmc80_map.virt = 0;
	}
}
static void __exit cleanup_rpxlite(void)
{
	if (mymtd) {
		del_mtd_device(mymtd);
		map_destroy(mymtd);
	}
	if (rpxlite_map.virt) {
		iounmap((void *)rpxlite_map.virt);
		rpxlite_map.virt = 0;
	}
}
Exemple #15
0
static void __exit cleanup_edb7312nor(void)
{
	if (mymtd) {
		del_mtd_device(mymtd);
		map_destroy(mymtd);
	}
	if (edb7312nor_map.virt) {
		iounmap((void *)edb7312nor_map.virt);
		edb7312nor_map.virt = 0;
	}
}
Exemple #16
0
static void unregister_devices(void)
{
	struct ps3vram_priv *priv;

	priv = ps3vram_mtd.priv;
	del_mtd_device(&ps3vram_mtd);
	iounmap(priv->real_base);
	lv1_gpu_memory_free(priv->memory_handle);
	kfree(priv);

	printk(KERN_INFO "ps3vram mtd device unregistered\n");
}
Exemple #17
0
static void __exit nandemul2k_cleanup (void)
{

	nandemul2k_CleanUp();

	/* Unregister partitions */
	del_mtd_partitions(&nandemul2k_mtd);

	/* Unregister the device */
	del_mtd_device (&nandemul2k_mtd);

}
Exemple #18
0
static void __exit bcm476x_mtd_ram_map_exit(void)
{
#ifdef CONFIG_MTD_PARTITIONS
	del_mtd_partitions(bcm476x_mtd_ram);
#else /* CONFIG_MTD_PARTITIONS */
	del_mtd_device(bcm476x_mtd_ram);
#endif

	map_destroy(bcm476x_mtd_ram);
	iounmap((void *)bcm476x_mtd_ram_map.virt);
	bcm476x_mtd_ram_map.virt = 0;
}
static void efx_mtd_remove_partition(struct efx_mtd_partition *part)
{
	int rc;

	for (;;) {
		rc = del_mtd_device(&part->mtd);
		if (rc != -EBUSY)
			break;
		ssleep(1);
	}
	WARN_ON(rc);
}
Exemple #20
0
static void __exit cleanup_vmax301(void)
{
	int i;

	for (i=0; i<2; i++) {
		if (vmax_mtd[i]) {
			del_mtd_device(vmax_mtd[i]);
			map_destroy(vmax_mtd[i]);
		}
	}
	iounmap((void *)vmax_map[0].map_priv_1 - WINDOW_START);
}
Exemple #21
0
void pcmcia_sleeve_detach_flash(void)
{
	printk(" ### " __FUNCTION__ "\n");
        if (pcmcia_sleeve_mtd != NULL) {
		printk(" ### " __FUNCTION__ " 2\n");
                del_mtd_device(pcmcia_sleeve_mtd);
		printk(" #### " __FUNCTION__ " 3\n");
                map_destroy(pcmcia_sleeve_mtd);
		printk(" ### " __FUNCTION__ " 4\n"); 
		pcmcia_sleeve_mtd = NULL;
        }
}
Exemple #22
0
/**
 * ubi_destroy_gluebi - close gluebi for an UBI volume.
 * @vol: volume description object
 *
 * This function is called when an UBI volume is removed in order to remove
 * corresponding fake MTD device. Returns zero in case of success and a
 * negative error code in case of failure.
 */
int ubi_destroy_gluebi(struct ubi_volume *vol)
{
	int err;
	struct mtd_info *mtd = &vol->gluebi_mtd;

	dbg_gen("remove mtd%d", mtd->index);
	err = del_mtd_device(mtd);
	if (err)
		return err;
	kfree(mtd->name);
	return 0;
}
Exemple #23
0
int mtd_del_partition(struct mtd_info *part)
{
	if (!part->master)
		return -EINVAL;

	del_mtd_device(part);

	free(part->cdev.partname);
	free(part->name);
	free(part);

	return 0;
}
Exemple #24
0
static void __exit cleanup_dc21285(void)
{
#ifdef CONFIG_MTD_PARTITIONS
	if (dc21285_parts) {
		del_mtd_partitions(dc21285_mtd);
		kfree(dc21285_parts);
	} else
#endif
		del_mtd_device(dc21285_mtd);

	map_destroy(dc21285_mtd);
	iounmap((void *)dc21285_map.map_priv_1);
}
Exemple #25
0
/*
 * Clean up routine
 */
static void __exit ep7312_cleanup (void)
{
	struct nand_chip *this = (struct nand_chip *) &ep7312_mtd[1];
	
	/* Unregister the device */
	del_mtd_device (ep7312_mtd);
	
	/* Free internal data buffer */
	kfree (this->data_buf);
	
	/* Free the MTD device structure */
	kfree (ep7312_mtd);
}
static int physmap_flash_remove(struct platform_device *dev)
{
	struct physmap_flash_info *info;
	struct physmap_flash_data *physmap_data;
	int i;

	info = platform_get_drvdata(dev);
	if (info == NULL)
		return 0;
	platform_set_drvdata(dev, NULL);

	physmap_data = dev->dev.platform_data;

	if (info->cmtd) {
#ifdef CONFIG_MTD_PARTITIONS
		if (info->nr_parts || physmap_data->nr_parts)
			del_mtd_partitions(info->cmtd);
		else
			del_mtd_device(info->cmtd);
#else
		del_mtd_device(info->cmtd);
#endif
	}
#ifdef CONFIG_MTD_PARTITIONS
	if (info->nr_parts)
		kfree(info->parts);
#endif

#ifdef CONFIG_MTD_CONCAT
	if (info->cmtd != info->mtd[0])
		mtd_concat_destroy(info->cmtd);
#endif

	for (i = 0; i < MAX_RESOURCES; i++) {
		if (info->mtd[i] != NULL)
			map_destroy(info->mtd[i]);
	}
	return 0;
}
static void __exit cleanup_mtdram(void)
{
  if (mtd_info) {
    del_mtd_device(mtd_info);
    if (mtd_info->priv)
#if CONFIG_MTDRAM_ABS_POS > 0
      iounmap(mtd_info->priv);
#else
      vfree(mtd_info->priv);
#endif	
    kfree(mtd_info);
  }
}
Exemple #28
0
static int physmap_flash_remove(struct platform_device *dev)
{
	struct physmap_flash_info *info;
	struct physmap_flash_data *physmap_data;

	info = platform_get_drvdata(dev);
	if (info == NULL)
		return 0;
	platform_set_drvdata(dev, NULL);

	physmap_data = dev->dev.platform_data;

	if (info->mtd != NULL) {
#ifdef CONFIG_MTD_PARTITIONS
		if (info->nr_parts) {
			del_mtd_partitions(info->mtd);
			kfree(info->parts);
		} else if (physmap_data->nr_parts) {
			del_mtd_partitions(info->mtd);
		} else {
			del_mtd_device(info->mtd);
		}
#else
		del_mtd_device(info->mtd);
#endif
		map_destroy(info->mtd);
	}

	if (info->map.virt != NULL)
		iounmap(info->map.virt);

	if (info->res != NULL) {
		release_resource(info->res);
		kfree(info->res);
	}

	return 0;
}
Exemple #29
0
static void __exit epxa_mtd_cleanup(void)
{
	if (mymtd) {
		if (nr_parts)
			del_mtd_partitions(mymtd);
		else
			del_mtd_device(mymtd);
		map_destroy(mymtd);
	}
	if (epxa_map.map_priv_1) {
		iounmap((void *)epxa_map.map_priv_1);
		epxa_map.map_priv_1 = 0;
	}
}
Exemple #30
0
static void unregister_devices(void)
{
	slram_mtd_list_t *nextitem;

	while (slram_mtdlist) {
		nextitem = slram_mtdlist->next;
		del_mtd_device(slram_mtdlist->mtdinfo);
		iounmap(((slram_priv_t *)slram_mtdlist->mtdinfo->priv)->start);
		kfree(slram_mtdlist->mtdinfo->priv);
		kfree(slram_mtdlist->mtdinfo);
		kfree(slram_mtdlist);
		slram_mtdlist = nextitem;
	}
}