linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Adam J. Richter" <adam@yggdrasil.com>
To: eokerson@quicknet.net, linux-kernel@vger.kernel.org
Subject: linux-2.5.2-pre8/drivers/telephony kdev_t compilation fixes
Date: Sat, 5 Jan 2002 04:18:05 -0800	[thread overview]
Message-ID: <20020105041805.A24306@baldur.yggdrasil.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 590 bytes --]

	Here is a patch to make linux-2.5.2-pre8/drivers/telephony
compile.  It changes some MINOR() calls to minor().  gcc-3.0.2
also identified two places that could produce undefined behavior
under the C standard, so I fixed those too.

	I only know that this code compiles.  I don't know that it
works.

-- 
Adam J. Richter     __     ______________   4880 Stevens Creek Blvd, Suite 104
adam@yggdrasil.com     \ /                  San Jose, California 95129-1034
+1 408 261-6630         | g g d r a s i l   United States of America
fax +1 408 261-6631      "Free Software For The Rest Of Us."

[-- Attachment #2: telephony.diff --]
[-- Type: text/plain, Size: 3034 bytes --]

diff -u -r linux-2.5.2-pre8/drivers/telephony/ixj.c linux/drivers/telephony/ixj.c
--- linux-2.5.2-pre8/drivers/telephony/ixj.c	Fri Jan  4 19:40:37 2002
+++ linux/drivers/telephony/ixj.c	Sat Jan  5 04:09:23 2002
@@ -274,8 +274,8 @@
 
 #include "ixj.h"
 
-#define TYPE(dev) (MINOR(dev) >> 4)
-#define NUM(dev) (MINOR(dev) & 0xf)
+#define TYPE(dev) (minor(dev) >> 4)
+#define NUM(dev) (minor(dev) & 0xf)
 
 static int ixjdebug;
 static int hertz = HZ;
@@ -2805,8 +2835,10 @@
 		0xD6, 0xD6, 0xD7, 0xD7, 0xD4, 0xD4, 0xD5, 0xD5
 	};
 
-	while (len--)
-		*buff++ = table_ulaw2alaw[*(unsigned char *)buff];
+	while (len--) {
+		*buff = table_ulaw2alaw[*(unsigned char *)buff];
+		buff++;
+	}
 }
 
 static void alaw2ulaw(unsigned char *buff, unsigned long len)
@@ -2847,8 +2879,10 @@
 		0xCF, 0xCF, 0xCE, 0xCE, 0xD2, 0xD3, 0xD0, 0xD1
 	};
 
-        while (len--)
-                *buff++ = table_alaw2ulaw[*(unsigned char *)buff];
+        while (len--) {
+                *buff = table_alaw2ulaw[*(unsigned char *)buff];
+		buff++;
+	}
 }
 
 static ssize_t ixj_read(struct file * file_p, char *buf, size_t length, loff_t * ppos)
@@ -6202,7 +6236,7 @@
 	IXJ_FILTER_RAW jfr;
 
 	unsigned int raise, mant;
-	unsigned int minor = MINOR(inode->i_rdev);
+	unsigned int index = minor(inode->i_rdev);
 	int board = NUM(inode->i_rdev);
 
 	IXJ *j = get_ixj(NUM(inode->i_rdev));
@@ -6218,8 +6252,8 @@
 		schedule_timeout(1);
 	}
 	if (ixjdebug & 0x0040)
-		printk("phone%d ioctl, cmd: 0x%x, arg: 0x%lx\n", minor, cmd, arg);
-	if (minor >= IXJMAX) {
+		printk("phone%d ioctl, cmd: 0x%x, arg: 0x%lx\n", index, cmd, arg);
+	if (index >= IXJMAX) {
 		clear_bit(board, &j->busyflags);
 		return -ENODEV;
 	}
@@ -6746,7 +6780,7 @@
 		break;
 	}
 	if (ixjdebug & 0x0040)
-		printk("phone%d ioctl end, cmd: 0x%x, arg: 0x%lx\n", minor, cmd, arg);
+		printk("phone%d ioctl end, cmd: 0x%x, arg: 0x%lx\n", index, cmd, arg);
 	clear_bit(board, &j->busyflags);
 	return retval;
 }
diff -u -r linux-2.5.2-pre8/drivers/telephony/phonedev.c linux/drivers/telephony/phonedev.c
--- linux-2.5.2-pre8/drivers/telephony/phonedev.c	Fri Sep  7 09:28:37 2001
+++ linux/drivers/telephony/phonedev.c	Sat Jan  5 04:09:23 2002
@@ -46,26 +46,26 @@
 
 static int phone_open(struct inode *inode, struct file *file)
 {
-	unsigned int minor = MINOR(inode->i_rdev);
+	unsigned int index = minor(inode->i_rdev);
 	int err = 0;
 	struct phone_device *p;
 	struct file_operations *old_fops, *new_fops = NULL;
 
-	if (minor >= PHONE_NUM_DEVICES)
+	if (index >= PHONE_NUM_DEVICES)
 		return -ENODEV;
 
 	down(&phone_lock);
-	p = phone_device[minor];
+	p = phone_device[index];
 	if (p)
 		new_fops = fops_get(p->f_op);
 	if (!new_fops) {
 		char modname[32];
 
 		up(&phone_lock);
-		sprintf(modname, "char-major-%d-%d", PHONE_MAJOR, minor);
+		sprintf(modname, "char-major-%d-%d", PHONE_MAJOR, index);
 		request_module(modname);
 		down(&phone_lock);
-		p = phone_device[minor];
+		p = phone_device[index];
 		if (p == NULL || (new_fops = fops_get(p->f_op)) == NULL)
 		{
 			err=-ENODEV;

                 reply	other threads:[~2002-01-05 12:18 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20020105041805.A24306@baldur.yggdrasil.com \
    --to=adam@yggdrasil.com \
    --cc=eokerson@quicknet.net \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).