patch-2.1.86 linux/drivers/block/paride/pt.c

Next file: linux/drivers/block/ps2esdi.c
Previous file: linux/drivers/block/md.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.1.85/linux/drivers/block/paride/pt.c linux/drivers/block/paride/pt.c
@@ -680,7 +680,7 @@
 	return -1;
 }
 
-#define DEVICE_NR(x)	(x % 128)
+#define DEVICE_NR(dev)	(MINOR(dev) % 128)
 
 static int pt_open (struct inode *inode, struct file *file)
 
@@ -711,7 +711,8 @@
 		return -EROFS;
 		}
 
-	if (!(inode->i_rdev & 128)) PT.flags |= PT_REWIND;
+	if (!(MINOR(inode->i_rdev) & 128))
+		PT.flags |= PT_REWIND;
 
 	PT.bufptr = kmalloc(PT_BUFSIZE,GFP_KERNEL);
 	if (PT.bufptr == NULL) {
@@ -726,18 +727,19 @@
 
 static int pt_ioctl(struct inode *inode,struct file *file,
                     unsigned int cmd, unsigned long arg)
-
-{       int unit;
+{
+	int unit;
 	struct mtop mtop;
 
-
-        if ((!inode) || (!inode->i_rdev)) return -EINVAL;
+        if (!inode || !inode->i_rdev)
+		return -EINVAL;
         unit = DEVICE_NR(inode->i_rdev);
-        if (unit >= PT_UNITS) return -EINVAL;
-        if (!PT.present) return -ENODEV;
+        if (unit >= PT_UNITS)
+		return -EINVAL;
+        if (!PT.present)
+		return -ENODEV;
 
         switch (cmd) {
-
 	    case MTIOCTOP:	
 		if (copy_from_user((char *)&mtop, (char *)arg, 
 			           sizeof(struct mtop))) return -EFAULT;
@@ -763,8 +765,8 @@
 
 
 static int pt_release (struct inode *inode, struct file *file)
-
-{       int	unit = DEVICE_NR(inode->i_rdev);
+{
+        int	unit = DEVICE_NR(inode->i_rdev);
 
         if ((unit >= PT_UNITS) || (PT.access <= 0)) 
                 return -EINVAL;
@@ -786,8 +788,8 @@
 
 static ssize_t pt_read(struct file * filp, char * buf, 
                        size_t count, loff_t *ppos)
-
-{  	struct 	inode *ino = filp->f_dentry->d_inode;
+{
+  	struct 	inode *ino = filp->f_dentry->d_inode;
 	int	unit = DEVICE_NR(ino->i_rdev);
 	char	rd_cmd[12] = {ATAPI_READ_6,1,0,0,0,0,0,0,0,0,0,0};
 	int	k, n, r, p, s, t, b;
@@ -870,8 +872,8 @@
 
 static ssize_t pt_write(struct file * filp, const char * buf, 
                         size_t count, loff_t *ppos)
-
-{       struct inode *ino = filp->f_dentry->d_inode;
+{
+        struct inode *ino = filp->f_dentry->d_inode;
         int unit = DEVICE_NR(ino->i_rdev);
         char    wr_cmd[12] = {ATAPI_WRITE_6,1,0,0,0,0,0,0,0,0,0,0};
         int     k, n, r, p, s, t, b;

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov