printk(KERN_INFO "mtd%d: %s at 0x%08lx, size %uMiB.\n", 
printk(KERN_INFO "mtd%d: %s at 0x%08lx, size %zuMiB.\n", 
static int __init ms02nv_init_one(ulong addr){	struct mtd_info *mtd;	struct ms02nv_private *mp;	struct resource *mod_res;	struct resource *diag_res;	struct resource *user_res;	struct resource *csr_res;	ulong fixaddr;	size_t size, fixsize;	static int version_printed;	int ret = -ENODEV;	/* The module decodes 8MiB of address space. */	mod_res = kmalloc(sizeof(*mod_res), GFP_KERNEL);	if (!mod_res)		return -ENOMEM;	memset(mod_res, 0, sizeof(*mod_res));	mod_res->name = ms02nv_name;	mod_res->start = addr;	mod_res->end = addr + MS02NV_SLOT_SIZE - 1;	mod_res->flags = IORESOURCE_MEM | IORESOURCE_BUSY;	if (request_resource(&iomem_resource, mod_res) < 0)		goto err_out_mod_res;	size = ms02nv_probe_one(addr);	if (!size)		goto err_out_mod_res_rel;	if (!version_printed) {		printk(KERN_INFO "%s", version);		version_printed = 1;	}	ret = -ENOMEM;	mtd = kmalloc(sizeof(*mtd), GFP_KERNEL);	if (!mtd)		goto err_out_mod_res_rel;	memset(mtd, 0, sizeof(*mtd));	mp = kmalloc(sizeof(*mp), GFP_KERNEL);	if (!mp)		goto err_out_mtd;	memset(mp, 0, sizeof(*mp));	mtd->priv = mp;	mp->resource.module = mod_res;	/* Firmware's diagnostic NVRAM area. */	diag_res = kmalloc(sizeof(*diag_res), GFP_KERNEL);	if (!diag_res)		goto err_out_mp;	memset(diag_res, 0, sizeof(*diag_res));	diag_res->name = ms02nv_res_diag_ram;	diag_res->start = addr;	diag_res->end = addr + MS02NV_RAM - 1;	diag_res->flags = IORESOURCE_BUSY;	request_resource(mod_res, diag_res);	mp->resource.diag_ram = diag_res;	/* User-available general-purpose NVRAM area. */	user_res = kmalloc(sizeof(*user_res), GFP_KERNEL);	if (!user_res)		goto err_out_diag_res;	memset(user_res, 0, sizeof(*user_res));	user_res->name = ms02nv_res_user_ram;	user_res->start = addr + MS02NV_RAM;	user_res->end = addr + size - 1;	user_res->flags = IORESOURCE_BUSY;	request_resource(mod_res, user_res);	mp->resource.user_ram = user_res;	/* Control and status register. */	csr_res = kmalloc(sizeof(*csr_res), GFP_KERNEL);	if (!csr_res)		goto err_out_user_res;	memset(csr_res, 0, sizeof(*csr_res));	csr_res->name = ms02nv_res_csr;	csr_res->start = addr + MS02NV_CSR;	csr_res->end = addr + MS02NV_CSR + 3;	csr_res->flags = IORESOURCE_BUSY;	request_resource(mod_res, csr_res);	mp->resource.csr = csr_res;	mp->addr = phys_to_virt(addr);	mp->size = size;	/*	 * Hide the firmware's diagnostic area.  It may get destroyed	 * upon a reboot.  Take paging into account for mapping support.	 */	fixaddr = (addr + MS02NV_RAM + PAGE_SIZE - 1) & ~(PAGE_SIZE - 1);	fixsize = (size - (fixaddr - addr)) & ~(PAGE_SIZE - 1);	mp->uaddr = phys_to_virt(fixaddr);	mtd->type = MTD_RAM;	mtd->flags = MTD_CAP_RAM | MTD_XIP;	mtd->size = fixsize;	mtd->name = (char *)ms02nv_name;	mtd->owner = THIS_MODULE;	mtd->read = ms02nv_read;	mtd->write = ms02nv_write;	ret = -EIO;	if (add_mtd_device(mtd)) {		printk(KERN_ERR			"ms02-nv: Unable to register MTD device, aborting!\n");		goto err_out_csr_res;	}	printk(KERN_INFO "mtd%d: %s at 0x%08lx, size %uMiB.\n",		mtd->index, ms02nv_name, addr, size >> 20);	mp->next = root_ms02nv_mtd;	root_ms02nv_mtd = mtd;	return 0;err_out_csr_res:	release_resource(csr_res);	kfree(csr_res);err_out_user_res:	release_resource(user_res);	kfree(user_res);err_out_diag_res:	release_resource(diag_res);	kfree(diag_res);err_out_mp:	kfree(mp);err_out_mtd:	kfree(mtd);err_out_mod_res_rel:	release_resource(mod_res);err_out_mod_res:	kfree(mod_res);	return ret;}
4520	/local/tlutelli/issta_data/temp/c/2005_temp/2005/4520/af2c80e926ad5335d00a8d507928aff4e8ff1877/ms02-nv.c/clean/drivers/mtd/devices/ms02-nv.c