struct platform_device *pdev = to_platform_device(dev); struct s3c2410_platform_nand *plat = to_nand_plat(dev); struct s3c2410_nand_info *info; struct s3c2410_nand_mtd *nmtd; struct s3c2410_nand_set *sets; struct resource *res; int err = 0; int size; int nr_sets; int setno;  pr_debug("s3c2410_nand_probe(%p)\n", dev);  info = kmalloc(sizeof(*info), GFP_KERNEL); if (info == NULL) { printk(KERN_ERR PFX "no memory for flash info\n"); err = -ENOMEM; goto exit_error; }  memzero(info, sizeof(*info)); dev_set_drvdata(dev, info);  spin_lock_init(&info->controller.lock);  /* get the clock source and enable it */  info->clk = clk_get(dev, "nand"); if (IS_ERR(info->clk)) { printk(KERN_ERR PFX "failed to get clock"); err = -ENOENT; goto exit_error; }  clk_use(info->clk); clk_enable(info->clk);  /* allocate and map the resource */  res = pdev->resource;  /* assume that the flash has one resource */ size = res->end - res->start + 1;  info->area = request_mem_region(res->start, size, pdev->name);  if (info->area == NULL) { printk(KERN_ERR PFX "cannot reserve register region\n"); err = -ENOENT; goto exit_error; }  info->device = dev; info->platform = plat; info->regs = ioremap(res->start, size);  if (info->regs == NULL) { printk(KERN_ERR PFX "cannot reserve register region\n"); err = -EIO; goto exit_error; }  printk(KERN_INFO PFX "mapped registers at %p\n", info->regs);  /* initialise the hardware */  err = s3c2410_nand_inithw(info, dev); if (err != 0) goto exit_error;  sets = (plat != NULL) ? plat->sets : NULL; nr_sets = (plat != NULL) ? plat->nr_sets : 1;  info->mtd_count = nr_sets;  /* allocate our information */  size = nr_sets * sizeof(*info->mtds); info->mtds = kmalloc(size, GFP_KERNEL); if (info->mtds == NULL) { printk(KERN_ERR PFX "failed to allocate mtd storage\n"); err = -ENOMEM; goto exit_error; }  memzero(info->mtds, size);  /* initialise all possible chips */  nmtd = info->mtds;  for (setno = 0; setno < nr_sets; setno++, nmtd++) { pr_debug("initialising set %d (%p, info %p)\n", setno, nmtd, info);  s3c2410_nand_init_chip(info, nmtd, sets);  nmtd->scan_res = nand_scan(&nmtd->mtd, (sets) ? sets->nr_chips : 1);  if (nmtd->scan_res == 0) { s3c2410_nand_add_partition(info, nmtd, sets); }  if (sets != NULL) sets++; }  pr_debug("initialised ok\n"); return 0;  exit_error: s3c2410_nand_remove(dev);  if (err == 0) err = -EINVAL; return err; 
return s3c24xx_nand_probe(dev, 0); 
static int s3c2410_nand_probe(struct device *dev){	struct platform_device *pdev = to_platform_device(dev);	struct s3c2410_platform_nand *plat = to_nand_plat(dev);	struct s3c2410_nand_info *info;	struct s3c2410_nand_mtd *nmtd;	struct s3c2410_nand_set *sets;	struct resource *res;	int err = 0;	int size;	int nr_sets;	int setno;	pr_debug("s3c2410_nand_probe(%p)\n", dev);	info = kmalloc(sizeof(*info), GFP_KERNEL);	if (info == NULL) {		printk(KERN_ERR PFX "no memory for flash info\n");		err = -ENOMEM;		goto exit_error;	}	memzero(info, sizeof(*info));	dev_set_drvdata(dev, info);	spin_lock_init(&info->controller.lock);	/* get the clock source and enable it */	info->clk = clk_get(dev, "nand");	if (IS_ERR(info->clk)) {		printk(KERN_ERR PFX "failed to get clock");		err = -ENOENT;		goto exit_error;	}	clk_use(info->clk);	clk_enable(info->clk);	/* allocate and map the resource */	res = pdev->resource;  /* assume that the flash has one resource */	size = res->end - res->start + 1;	info->area = request_mem_region(res->start, size, pdev->name);	if (info->area == NULL) {		printk(KERN_ERR PFX "cannot reserve register region\n");		err = -ENOENT;		goto exit_error;	}	info->device = dev;	info->platform = plat;	info->regs = ioremap(res->start, size);	if (info->regs == NULL) {		printk(KERN_ERR PFX "cannot reserve register region\n");		err = -EIO;		goto exit_error;	}			printk(KERN_INFO PFX "mapped registers at %p\n", info->regs);	/* initialise the hardware */	err = s3c2410_nand_inithw(info, dev);	if (err != 0)		goto exit_error;	sets = (plat != NULL) ? plat->sets : NULL;	nr_sets = (plat != NULL) ? plat->nr_sets : 1;	info->mtd_count = nr_sets;	/* allocate our information */	size = nr_sets * sizeof(*info->mtds);	info->mtds = kmalloc(size, GFP_KERNEL);	if (info->mtds == NULL) {		printk(KERN_ERR PFX "failed to allocate mtd storage\n");		err = -ENOMEM;		goto exit_error;	}	memzero(info->mtds, size);	/* initialise all possible chips */	nmtd = info->mtds;	for (setno = 0; setno < nr_sets; setno++, nmtd++) {		pr_debug("initialising set %d (%p, info %p)\n",			 setno, nmtd, info);				s3c2410_nand_init_chip(info, nmtd, sets);		nmtd->scan_res = nand_scan(&nmtd->mtd,					   (sets) ? sets->nr_chips : 1);		if (nmtd->scan_res == 0) {			s3c2410_nand_add_partition(info, nmtd, sets);		}		if (sets != NULL)			sets++;	}		pr_debug("initialised ok\n");	return 0; exit_error:	s3c2410_nand_remove(dev);	if (err == 0)		err = -EINVAL;	return err;}
4520	/local/tlutelli/issta_data/temp/c/2005_temp/2005/4520/a4f957f16d41b9ff944dddd84c4892496a129f68/s3c2410.c/clean/drivers/mtd/nand/s3c2410.c