aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@suse.de>2009-08-25 19:26:56 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2009-09-15 15:02:33 -0400
commit88ff720865fb8f9d18196810ed6a9553e034834f (patch)
treef8ff3aec19c6b844cecb3ace15edab3a6919a187 /drivers
parenta3b2e09333ce811e69ac71379a2dd8ccd1b2ca6f (diff)
Staging: cowloop: remove kernel version checks
Now that the code is in the kernel tree, remove the unneeded version checks. Cc: "H.J. Thomassen" <hjt@ATComputing.nl> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/staging/cowloop/cowloop.c69
1 files changed, 7 insertions, 62 deletions
diff --git a/drivers/staging/cowloop/cowloop.c b/drivers/staging/cowloop/cowloop.c
index c43654bc83cf..a71c743a1196 100644
--- a/drivers/staging/cowloop/cowloop.c
+++ b/drivers/staging/cowloop/cowloop.c
@@ -254,11 +254,7 @@ char revision[] = "$Revision: 3.1 $"; /* cowlo_init_module() has
254#include <linux/stat.h> 254#include <linux/stat.h>
255#include <linux/vmalloc.h> 255#include <linux/vmalloc.h>
256#include <linux/slab.h> 256#include <linux/slab.h>
257#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27))
258#include <linux/semaphore.h> 257#include <linux/semaphore.h>
259#else
260#include <asm/semaphore.h>
261#endif
262#include <asm/uaccess.h> 258#include <asm/uaccess.h>
263#include <linux/proc_fs.h> 259#include <linux/proc_fs.h>
264#include <linux/blkdev.h> 260#include <linux/blkdev.h>
@@ -421,15 +417,8 @@ static long int cowlo_readcow (struct cowloop_device *, void *, int, loff_t);
421static long int cowlo_readcowraw (struct cowloop_device *, void *, int, loff_t); 417static long int cowlo_readcowraw (struct cowloop_device *, void *, int, loff_t);
422static long int cowlo_writecow (struct cowloop_device *, void *, int, loff_t); 418static long int cowlo_writecow (struct cowloop_device *, void *, int, loff_t);
423static long int cowlo_writecowraw(struct cowloop_device *, void *, int, loff_t); 419static long int cowlo_writecowraw(struct cowloop_device *, void *, int, loff_t);
424
425#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,28))
426static int cowlo_ioctl (struct block_device *, fmode_t, 420static int cowlo_ioctl (struct block_device *, fmode_t,
427 unsigned int, unsigned long); 421 unsigned int, unsigned long);
428#else
429static int cowlo_ioctl (struct inode *, struct file *,
430 unsigned int, unsigned long);
431#endif
432
433static int cowlo_makepair (struct cowpair __user *); 422static int cowlo_makepair (struct cowpair __user *);
434static int cowlo_removepair (unsigned long __user *); 423static int cowlo_removepair (unsigned long __user *);
435static int cowlo_watch (struct cowpair __user *); 424static int cowlo_watch (struct cowpair __user *);
@@ -452,16 +441,10 @@ static void cowlo_undo_opencow(struct cowloop_device *);
452** 0 - okay 441** 0 - okay
453** < 0 - error value 442** < 0 - error value
454*/ 443*/
455static int 444static int cowlo_open(struct block_device *bdev, fmode_t mode)
456#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,28))
457cowlo_open(struct block_device *bdev, fmode_t mode)
458#else
459cowlo_open(struct inode *inode, struct file *file)
460#endif
461{ 445{
462#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,28))
463 struct inode *inode = bdev->bd_inode; 446 struct inode *inode = bdev->bd_inode;
464#endif 447
465 if (!inode) 448 if (!inode)
466 return -EINVAL; 449 return -EINVAL;
467 450
@@ -497,20 +480,13 @@ cowlo_open(struct inode *inode, struct file *file)
497** returns: 480** returns:
498** 0 - okay 481** 0 - okay
499*/ 482*/
500static int 483static int cowlo_release(struct gendisk *gd, fmode_t mode)
501#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,28))
502cowlo_release(struct gendisk *gd, fmode_t mode)
503#else
504cowlo_release(struct inode *inode, struct file *file)
505#endif
506{ 484{
507#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,28))
508 struct block_device *bdev; 485 struct block_device *bdev;
509 struct inode *inode; 486 struct inode *inode;
510 487
511 bdev = bdget_disk(gd, 0); 488 bdev = bdget_disk(gd, 0);
512 inode = bdev->bd_inode; 489 inode = bdev->bd_inode;
513#endif
514 if (!inode) 490 if (!inode)
515 return 0; 491 return 0;
516 492
@@ -529,19 +505,11 @@ cowlo_release(struct inode *inode, struct file *file)
529** 0 - okay 505** 0 - okay
530** < 0 - error value 506** < 0 - error value
531*/ 507*/
532static int 508static int cowlo_ioctl(struct block_device *bdev, fmode_t mode,
533#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,28)) 509 unsigned int cmd, unsigned long arg)
534cowlo_ioctl(struct block_device *bdev, fmode_t mode,
535 unsigned int cmd, unsigned long arg)
536#else
537cowlo_ioctl(struct inode *inode, struct file *filp,
538 unsigned int cmd, unsigned long arg)
539#endif
540{ 510{
541 struct hd_geometry geo; 511 struct hd_geometry geo;
542#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,28))
543 struct inode *inode = bdev->bd_inode; 512 struct inode *inode = bdev->bd_inode;
544#endif
545 513
546 DEBUGP(DCOW "cowloop - ioctl cmd %x\n", cmd); 514 DEBUGP(DCOW "cowloop - ioctl cmd %x\n", cmd);
547 515
@@ -955,12 +923,7 @@ cowlo_cowctl(unsigned long __user *arg, int cmd)
955** function to be called by core-kernel to handle the I/O-requests 923** function to be called by core-kernel to handle the I/O-requests
956** in the queue 924** in the queue
957*/ 925*/
958static void 926static void cowlo_request(struct request_queue *q)
959#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,25))
960cowlo_request(struct request_queue *q)
961#else
962cowlo_request(request_queue_t *q)
963#endif
964{ 927{
965 struct request *req; 928 struct request *req;
966 struct cowloop_device *cowdev; 929 struct cowloop_device *cowdev;
@@ -1549,11 +1512,7 @@ cowlo_writecow(struct cowloop_device *cowdev, void *buf, int len, loff_t offset)
1549 (cowdev->cowwrites % SPCDFLINTVL == 0) ) { 1512 (cowdev->cowwrites % SPCDFLINTVL == 0) ) {
1550 struct kstatfs ks; 1513 struct kstatfs ks;
1551 1514
1552#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,18))
1553 if (vfs_statfs(cowdev->cowfp->f_dentry, &ks)==0){ 1515 if (vfs_statfs(cowdev->cowfp->f_dentry, &ks)==0){
1554#else
1555 if (vfs_statfs(cowdev->cowfp->f_dentry->d_inode->i_sb, &ks)==0){
1556#endif
1557 if (ks.f_bavail <= SPCMINBLK) { 1516 if (ks.f_bavail <= SPCMINBLK) {
1558 switch (ks.f_bavail) { 1517 switch (ks.f_bavail) {
1559 case 0: 1518 case 0:
@@ -1860,11 +1819,7 @@ cowlo_openpair(char *rdof, char *cowf, int autorecover, int minor)
1860 /* 1819 /*
1861 ** administer total and available size of filesystem holding cowfile 1820 ** administer total and available size of filesystem holding cowfile
1862 */ 1821 */
1863#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,18)) 1822 if (vfs_statfs(cowdev->cowfp->f_dentry, &ks)==0) {
1864 if (vfs_statfs(cowdev->cowfp->f_dentry, &ks)==0){
1865#else
1866 if (vfs_statfs(cowdev->cowfp->f_dentry->d_inode->i_sb, &ks)==0){
1867#endif
1868 cowdev->blksize = ks.f_bsize; 1823 cowdev->blksize = ks.f_bsize;
1869 cowdev->blktotal = ks.f_blocks; 1824 cowdev->blktotal = ks.f_blocks;
1870 cowdev->blkavail = ks.f_bavail; 1825 cowdev->blkavail = ks.f_bavail;
@@ -2120,13 +2075,8 @@ cowlo_openrdo(struct cowloop_device *cowdev, char *rdof)
2120 cowdev->belowq = cowdev->belowgd->queue; 2075 cowdev->belowq = cowdev->belowgd->queue;
2121 2076
2122 if (cowdev->numblocks == 0) { 2077 if (cowdev->numblocks == 0) {
2123#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27))
2124 cowdev->numblocks = get_capacity(cowdev->belowgd) 2078 cowdev->numblocks = get_capacity(cowdev->belowgd)
2125 / (MAPUNIT/512); 2079 / (MAPUNIT/512);
2126#else
2127 cowdev->numblocks = cowdev->belowgd->capacity
2128 / (MAPUNIT/512);
2129#endif
2130 } 2080 }
2131 } 2081 }
2132 2082
@@ -2869,12 +2819,7 @@ cowlo_cleanup_module(void)
2869 for (minor=0; minor < maxcows; minor++) 2819 for (minor=0; minor < maxcows; minor++)
2870 (void) cowlo_closepair(cowdevall[minor]); 2820 (void) cowlo_closepair(cowdevall[minor]);
2871 2821
2872#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,23))
2873 unregister_blkdev(COWMAJOR, DEVICE_NAME); 2822 unregister_blkdev(COWMAJOR, DEVICE_NAME);
2874#else
2875 if (unregister_blkdev(COWMAJOR, DEVICE_NAME) != 0)
2876 printk(KERN_WARNING "cowloop - cannot unregister blkdev\n");
2877#endif
2878 2823
2879 /* 2824 /*
2880 ** get rid of /proc/cow and unregister the driver 2825 ** get rid of /proc/cow and unregister the driver