Skip to contentSkip to conversation

MINOR(inode->i_rdev) vs. minor(inode->i_rdev)

PATCH Brendan Burns 2 participants 2 messages Jan 9, 2002

lore
Share & tools
lore
#0 lore raw

Hello,
In the process of compiling ALSA for my new 2.5.2pre10 kernel I noticed that MINOR(inode->i_rdev) causes compile errors and should be replaced with minor(inode->i_rdev) Looking at a number of the OSS sound drivers in the kernel I noticed that they to would not compile in 2.5.2pre10 (eg Turtle Beach Pinnacle) I fixed all of these modules and a patch is attached. However, looking further I noticed that there were similar problems in a number of other drivers. Before I undertook cleaning all of them I thought I would check in and make sure I was doing the right thing. Namely that every instance of MINOR(inode->i_rdev) or MINOR(i_rdev) should be replaced with minor(inode->i_rdev) or minor(i_rdev).

Please CC me on any replies since I am not subscribed to the list. Thanks,
Brendan

drivers/sound/btaudio.c +3 -3
diff -uNr linux/drivers/sound/btaudio.c linux.new/drivers/sound/btaudio.c
@@ -300,7 +300,7 @@
 
 static int btaudio_mixer_open(struct inode *inode, struct file *file)
 {
-	int minor = MINOR(inode->i_rdev);
+	int minor = minor(inode->i_rdev);
 	struct btaudio *bta;
 
 	for (bta = btaudios; bta != NULL; bta = bta->next)
@@ -459,7 +459,7 @@
 
 static int btaudio_dsp_open_digital(struct inode *inode, struct file *file)
 {
-	int minor = MINOR(inode->i_rdev);
+	int minor = minor(inode->i_rdev);
 	struct btaudio *bta;
 
 	for (bta = btaudios; bta != NULL; bta = bta->next)
@@ -475,7 +475,7 @@
 
 static int btaudio_dsp_open_analog(struct inode *inode, struct file *file)
 {
-	int minor = MINOR(inode->i_rdev);
+	int minor = minor(inode->i_rdev);
 	struct btaudio *bta;
 
 	for (bta = btaudios; bta != NULL; bta = bta->next)
drivers/sound/cmpci.c +4 -4
diff -uNr linux/drivers/sound/cmpci.c linux.new/drivers/sound/cmpci.c
@@ -1440,7 +1440,7 @@
 
 static int cm_open_mixdev(struct inode *inode, struct file *file)
 {
-	int minor = MINOR(inode->i_rdev);
+	int minor = minor(inode->i_rdev);
 	struct cm_state *s = devs;
 
 	while (s && s->dev_mixer != minor)
@@ -2190,7 +2190,7 @@
 
 static int cm_open(struct inode *inode, struct file *file)
 {
-	int minor = MINOR(inode->i_rdev);
+	int minor = minor(inode->i_rdev);
 	struct cm_state *s = devs;
 	unsigned char fmtm = ~0, fmts = 0;
 
@@ -2445,7 +2445,7 @@
 
 static int cm_midi_open(struct inode *inode, struct file *file)
 {
-	int minor = MINOR(inode->i_rdev);
+	int minor = minor(inode->i_rdev);
 	struct cm_state *s = devs;
 	unsigned long flags;
 
@@ -2662,7 +2662,7 @@
 
 static int cm_dmfm_open(struct inode *inode, struct file *file)
 {
-	int minor = MINOR(inode->i_rdev);
+	int minor = minor(inode->i_rdev);
 	struct cm_state *s = devs;
 
 	while (s && s->dev_dmfm != minor)
drivers/sound/ite8172.c +2 -2
diff -uNr linux/drivers/sound/ite8172.c linux.new/drivers/sound/ite8172.c
@@ -832,7 +832,7 @@
 
 static int it8172_open_mixdev(struct inode *inode, struct file *file)
 {
-    int minor = MINOR(inode->i_rdev);
+    int minor = minor(inode->i_rdev);
     struct list_head *list;
     struct it8172_state *s;
 
@@ -1543,7 +1543,7 @@
 
 static int it8172_open(struct inode *inode, struct file *file)
 {
-    int minor = MINOR(inode->i_rdev);
+    int minor = minor(inode->i_rdev);
     DECLARE_WAITQUEUE(wait, current);
     unsigned long flags;
     struct list_head *list;
drivers/sound/msnd_pinnacle.c +5 -5
diff -uNr linux/drivers/sound/msnd_pinnacle.c linux.new/drivers/sound/msnd_pinnacle.c
@@ -641,7 +641,7 @@
 
 static int dev_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg)
 {
-	int minor = MINOR(inode->i_rdev);
+	int minor = minor(inode->i_rdev);
 
 	if (cmd == OSS_GETVERSION) {
 		int sound_version = SOUND_VERSION;
@@ -753,7 +753,7 @@
 
 static int dev_open(struct inode *inode, struct file *file)
 {
-	int minor = MINOR(inode->i_rdev);
+	int minor = minor(inode->i_rdev);
 	int err = 0;
 
 	if (minor == dev.dsp_minor) {
@@ -788,7 +788,7 @@
 
 static int dev_release(struct inode *inode, struct file *file)
 {
-	int minor = MINOR(inode->i_rdev);
+	int minor = minor(inode->i_rdev);
 	int err = 0;
 
 	lock_kernel();
@@ -978,7 +978,7 @@
 
 static ssize_t dev_read(struct file *file, char *buf, size_t count, loff_t *off)
 {
-	int minor = MINOR(file->f_dentry->d_inode->i_rdev);
+	int minor = minor(file->f_dentry->d_inode->i_rdev);
 	if (minor == dev.dsp_minor)
 		return dsp_read(buf, count);
 	else
@@ -987,7 +987,7 @@
 
 static ssize_t dev_write(struct file *file, const char *buf, size_t count, loff_t *off)
 {
-	int minor = MINOR(file->f_dentry->d_inode->i_rdev);
+	int minor = minor(file->f_dentry->d_inode->i_rdev);
 	if (minor == dev.dsp_minor)
 		return dsp_write(buf, count);
 	else
drivers/sound/nec_vrc5477.c +2 -2
diff -uNr linux/drivers/sound/nec_vrc5477.c linux.new/drivers/sound/nec_vrc5477.c
@@ -813,7 +813,7 @@
 
 static int vrc5477_ac97_open_mixdev(struct inode *inode, struct file *file)
 {
-	int minor = MINOR(inode->i_rdev);
+	int minor = minor(inode->i_rdev);
 	struct list_head *list;
 	struct vrc5477_ac97_state *s;
 
@@ -1529,7 +1529,7 @@
 
 static int vrc5477_ac97_open(struct inode *inode, struct file *file)
 {
-	int minor = MINOR(inode->i_rdev);
+	int minor = minor(inode->i_rdev);
 	DECLARE_WAITQUEUE(wait, current);
 	unsigned long flags;
 	struct list_head *list;
drivers/sound/rme96xx.c +2 -2
diff -uNr linux/drivers/sound/rme96xx.c linux.new/drivers/sound/rme96xx.c
@@ -1162,7 +1162,7 @@
 
 static int rme96xx_open(struct inode *in, struct file *f)
 {
-	int minor = MINOR(in->i_rdev);
+	int minor = minor(in->i_rdev);
 	struct list_head *list;
 	int devnum = ((minor-3)/16) % devices; /* default = 0 */
 	rme96xx_info *s;
@@ -1490,7 +1490,7 @@
 
 static int rme96xx_mixer_open(struct inode *inode, struct file *file)
 {
-	int minor = MINOR(inode->i_rdev);
+	int minor = minor(inode->i_rdev);
 	struct list_head *list;
 	rme96xx_info *s;
 
drivers/sound/sonicvibes.c +4 -4
diff -uNr linux/drivers/sound/sonicvibes.c linux.new/drivers/sound/sonicvibes.c
@@ -1235,7 +1235,7 @@
 
 static int sv_open_mixdev(struct inode *inode, struct file *file)
 {
-	int minor = MINOR(inode->i_rdev);
+	int minor = minor(inode->i_rdev);
 	struct list_head *list;
 	struct sv_state *s;
 
@@ -1893,7 +1893,7 @@
 
 static int sv_open(struct inode *inode, struct file *file)
 {
-	int minor = MINOR(inode->i_rdev);
+	int minor = minor(inode->i_rdev);
 	DECLARE_WAITQUEUE(wait, current);
 	unsigned char fmtm = ~0, fmts = 0;
 	struct list_head *list;
@@ -2142,7 +2142,7 @@
 
 static int sv_midi_open(struct inode *inode, struct file *file)
 {
-	int minor = MINOR(inode->i_rdev);
+	int minor = minor(inode->i_rdev);
 	DECLARE_WAITQUEUE(wait, current);
 	unsigned long flags;
 	struct list_head *list;
@@ -2364,7 +2364,7 @@
 
 static int sv_dmfm_open(struct inode *inode, struct file *file)
 {
-	int minor = MINOR(inode->i_rdev);
+	int minor = minor(inode->i_rdev);
 	DECLARE_WAITQUEUE(wait, current);
 	struct list_head *list;
 	struct sv_state *s;
drivers/sound/trident.c +2 -2
diff -uNr linux/drivers/sound/trident.c linux.new/drivers/sound/trident.c
@@ -2555,7 +2555,7 @@
 static int trident_open(struct inode *inode, struct file *file)
 {
 	int i = 0;
-	int minor = MINOR(inode->i_rdev);
+	int minor = minor(inode->i_rdev);
 	struct trident_card *card = devs;
 	struct trident_state *state = NULL;
 	struct dmabuf *dmabuf = NULL;
@@ -3750,7 +3750,7 @@
 static int trident_open_mixdev(struct inode *inode, struct file *file)
 {
 	int i = 0;
-	int minor = MINOR(inode->i_rdev);
+	int minor = minor(inode->i_rdev);
 	struct trident_card *card = devs;
 
 	for (card = devs; card != NULL; card = card->next)
drivers/sound/via82cxxx_audio.c +2 -2
diff -uNr linux/drivers/sound/via82cxxx_audio.c linux.new/drivers/sound/via82cxxx_audio.c
@@ -1358,7 +1358,7 @@
 
 static int via_mixer_open (struct inode *inode, struct file *file)
 {
-	int minor = MINOR(inode->i_rdev);
+	int minor = minor(inode->i_rdev);
 	struct via_info *card;
 	struct pci_dev *pdev;
 	struct pci_driver *drvr;
@@ -2974,7 +2974,7 @@
 
 static int via_dsp_open (struct inode *inode, struct file *file)
 {
-	int minor = MINOR(inode->i_rdev);
+	int minor = minor(inode->i_rdev);
 	struct via_info *card;
 	struct pci_dev *pdev;
 	struct via_channel *chan;
drivers/sound/vwsnd.c +2 -2
diff -uNr linux/drivers/sound/vwsnd.c linux.new/drivers/sound/vwsnd.c
@@ -2907,7 +2907,7 @@
 static int vwsnd_audio_open(struct inode *inode, struct file *file)
 {
 	vwsnd_dev_t *devc;
-	dev_t minor = MINOR(inode->i_rdev);
+	dev_t minor = minor(inode->i_rdev);
 	int sw_samplefmt;
 
 	DBGE("(inode=0x%p, file=0x%p)\n", inode, file);
@@ -3054,7 +3054,7 @@
 
 	INC_USE_COUNT;
 	for (devc = vwsnd_dev_list; devc; devc = devc->next_dev)
-		if (devc->mixer_minor == MINOR(inode->i_rdev))
+		if (devc->mixer_minor == minor(inode->i_rdev))
 			break;
 
 	if (devc == NULL) {
#1 lore raw
Quoted 1 line · On 09 Jan 2002 14:20:23 -0500 Brendan Burns <[email protected]> wrote:

Hello,

Hello!

Quoted 11 lines

In the process of compiling ALSA for my new 2.5.2pre10 kernel I noticed that MINOR(inode->i_rdev) causes compile errors and should be replaced with minor(inode->i_rdev) Looking at a number of the OSS sound drivers in the kernel I noticed that they to would not compile in 2.5.2pre10 (eg Turtle Beach Pinnacle) I fixed all of these modules and a patch is attached. However, looking further I noticed that there were similar problems in a number of other drivers. Before I undertook cleaning all of them I thought I would check in and make sure I was doing the right thing. Namely that every instance of MINOR(inode->i_rdev) or MINOR(i_rdev) should be replaced with minor(inode->i_rdev) or minor(i_rdev).

I've contributed patch for emu10k1, because tests after 'MINOR' replacement successed. You're on the right way.

Regards.

Signature · 2 lines
Nikita Gergel					System Administrator
Moscow, Russia					YAUZA-Telecom