--- zzzz-none-000/linux-2.4.17/drivers/mtd/nftlcore.c 2001-10-25 20:58:35.000000000 +0000 +++ sangam-fb-322/linux-2.4.17/drivers/mtd/nftlcore.c 2004-11-24 13:22:49.000000000 +0000 @@ -1,7 +1,7 @@ /* Linux driver for NAND Flash Translation Layer */ /* (c) 1999 Machine Vision Holdings, Inc. */ /* Author: David Woodhouse */ -/* $Id: nftlcore.c,v 1.82 2001/10/02 15:05:11 dwmw2 Exp $ */ +/* $Id: nftlcore.c,v 1.1.1.1 2003/06/23 22:18:28 jharrell Exp $ */ /* The contents of this file are distributed under the GNU General @@ -77,6 +77,14 @@ sizes: nftl_sizes, /* block sizes */ }; +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,14) +#define BLK_INC_USE_COUNT MOD_INC_USE_COUNT +#define BLK_DEC_USE_COUNT MOD_DEC_USE_COUNT +#else +#define BLK_INC_USE_COUNT do {} while(0) +#define BLK_DEC_USE_COUNT do {} while(0) +#endif + struct NFTLrecord *NFTLs[MAX_NFTLS]; static void NFTL_setup(struct mtd_info *mtd) @@ -805,9 +813,12 @@ case BLKGETSIZE: /* Return device size */ return put_user(part_table[MINOR(inode->i_rdev)].nr_sects, (unsigned long *) arg); + +#ifdef BLKGETSIZE64 case BLKGETSIZE64: return put_user((u64)part_table[MINOR(inode->i_rdev)].nr_sects << 9, (u64 *)arg); +#endif case BLKFLSBUF: if (!capable(CAP_SYS_ADMIN)) return -EACCES; @@ -984,8 +995,11 @@ #endif /* !CONFIG_NFTL_RW */ thisNFTL->usecount++; - if (!get_mtd_device(thisNFTL->mtd, -1)) - return /* -E'SBUGGEREDOFF */ -ENXIO; + BLK_INC_USE_COUNT; + if (!get_mtd_device(thisNFTL->mtd, -1)) { + BLK_DEC_USE_COUNT; + return -ENXIO; + } return 0; } @@ -998,11 +1012,10 @@ DEBUG(MTD_DEBUG_LEVEL2, "NFTL_release\n"); - invalidate_device(inode->i_rdev, 1); - if (thisNFTL->mtd->sync) thisNFTL->mtd->sync(thisNFTL->mtd); thisNFTL->usecount--; + BLK_DEC_USE_COUNT; put_mtd_device(thisNFTL->mtd); @@ -1020,7 +1033,9 @@ #else static struct block_device_operations nftl_fops = { +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,14) owner: THIS_MODULE, +#endif open: nftl_open, release: nftl_release, ioctl: nftl_ioctl @@ -1047,7 +1062,7 @@ int i; #ifdef PRERELEASE - printk(KERN_INFO "NFTL driver: nftlcore.c $Revision: 1.82 $, nftlmount.c %s\n", nftlmountrev); + printk(KERN_INFO "NFTL driver: nftlcore.c $Revision: 1.1.1.1 $, nftlmount.c %s\n", nftlmountrev); #endif if (register_blkdev(MAJOR_NR, "nftl", &nftl_fops)){