Skip to contentSkip to conversation

remove 2.2 compat cruft from sound/

PATCH In review Christoph Hellwig 2 participants 5 messages May 18, 2003 – May 19, 2003

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 remove 2.2 compat cruft from sound/

Not that it actually is compilable due to random changes..

sound/core/control.c +0 -2
@@ -931,9 +931,7 @@
 
 static struct file_operations snd_ctl_f_ops =
 {
-#ifndef LINUX_2_2
 	.owner =	THIS_MODULE,
-#endif
 	.read =		snd_ctl_read,
 	.open =		snd_ctl_open,
 	.release =	snd_ctl_release,

===== sound/core/hwdep.c 1.12 vs edited =====

sound/core/hwdep.c +0 -2
@@ -292,9 +292,7 @@
 
 static struct file_operations snd_hwdep_f_ops =
 {
-#ifndef LINUX_2_2
 	.owner = 	THIS_MODULE,
-#endif
 	.llseek =	snd_hwdep_llseek,
 	.read = 	snd_hwdep_read,
 	.write =	snd_hwdep_write,

===== sound/core/init.c 1.16 vs edited =====

sound/core/init.c +0 -2
@@ -193,9 +193,7 @@
 		f_ops = &s_f_ops->f_ops;
 
 		memset(f_ops, 0, sizeof(*f_ops));
-#ifndef LINUX_2_2
 		f_ops->owner = file->f_op->owner;
-#endif
 		f_ops->release = file->f_op->release;
 		f_ops->poll = snd_disconnect_poll;
 

===== sound/core/memalloc.c 1.4 vs edited =====

sound/core/memalloc.c +1 -3
@@ -79,7 +79,6 @@
 #define snd_assert(expr, args...) /**/
 #endif
 
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 4, 0)
 #ifdef CONFIG_PCI
 #if defined(__i386__) || defined(__ppc__) || defined(__x86_64__)
 #define HACK_PCI_ALLOC_CONSISTENT
@@ -132,7 +131,6 @@
 
 #endif /* arch */
 #endif /* CONFIG_PCI */
-#endif /* LINUX >= 2.4.0 */
 
 
 /*
@@ -622,7 +620,7 @@
 }
 
 
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 4, 0) && defined(__i386__)
+#ifdef __i386__
 /*
  * on ix86, we allocate a page with GFP_KERNEL to assure the
  * allocation.  the code is almost same with kernel/i386/pci-dma.c but

===== sound/core/pcm_native.c 1.30 vs edited =====

sound/core/pcm_native.c +0 -96

243 lines not on this page · raw message

===== sound/core/rawmidi.c 1.23 vs edited =====

sound/core/rawmidi.c +0 -2
@@ -1316,9 +1316,7 @@
 
 static struct file_operations snd_rawmidi_f_ops =
 {
-#ifndef LINUX_2_2
 	.owner =	THIS_MODULE,
-#endif
 	.read =		snd_rawmidi_read,
 	.write =	snd_rawmidi_write,
 	.open =		snd_rawmidi_open,

===== sound/core/sound.c 1.27 vs edited =====

sound/core/sound.c +0 -8
@@ -157,9 +157,7 @@
 
 struct file_operations snd_fops =
 {
-#ifndef LINUX_2_2
 	.owner =	THIS_MODULE,
-#endif
 	.open =		snd_open
 };
 
@@ -358,9 +356,6 @@
 #ifndef MODULE
 	printk(KERN_INFO "Advanced Linux Sound Architecture Driver Version " CONFIG_SND_VERSION CONFIG_SND_DATE ".\n");
 #endif
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,3,0) && defined(CONFIG_APM)
-	pm_init();
-#endif
 	return err;
 }
 
@@ -375,9 +370,6 @@
 	snd_info_minor_unregister();
 #endif
 	snd_info_done();
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,3,0) && defined(CONFIG_APM)
-	pm_done();
-#endif
 #ifdef CONFIG_SND_DEBUG_MEMORY
 	snd_memory_done();
 #endif

===== sound/core/timer.c 1.16 vs edited =====

sound/core/timer.c +0 -2
@@ -1733,9 +1733,7 @@
 
 static struct file_operations snd_timer_f_ops =
 {
-#ifndef LINUX_2_2
 	.owner =	THIS_MODULE,
-#endif
 	.read =		snd_timer_user_read,
 	.open =		snd_timer_user_open,
 	.release =	snd_timer_user_release,

===== sound/core/oss/mixer_oss.c 1.16 vs edited =====

sound/core/oss/mixer_oss.c +0 -2
@@ -376,9 +376,7 @@
 
 static struct file_operations snd_mixer_oss_f_ops =
 {
-#ifndef LINUX_2_2
 	.owner =	THIS_MODULE,
-#endif
 	.open =		snd_mixer_oss_open,
 	.release =	snd_mixer_oss_release,
 	.ioctl =	snd_mixer_oss_ioctl,

===== sound/core/oss/pcm_oss.c 1.22 vs edited =====

sound/core/oss/pcm_oss.c +0 -6
@@ -1981,11 +1981,7 @@
 	if (runtime->oss.plugin_first != NULL)
 		return -EIO;
 
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 3, 25)
 	if (area->vm_pgoff != 0)
-#else
-	if (area->vm_offset != 0)
-#endif
 		return -EINVAL;
 
 	err = snd_pcm_mmap_data(substream, file, area);
@@ -2148,9 +2144,7 @@
 
 static struct file_operations snd_pcm_oss_f_reg =
 {
-#ifndef LINUX_2_2
 	.owner =	THIS_MODULE,
-#endif
 	.read =		snd_pcm_oss_read,
 	.write =	snd_pcm_oss_write,
 	.open =		snd_pcm_oss_open,

===== sound/core/seq/seq_clientmgr.c 1.16 vs edited =====

sound/core/seq/seq_clientmgr.c +0 -2
@@ -2458,9 +2458,7 @@
 
 static struct file_operations snd_seq_f_ops =
 {
-#ifndef LINUX_2_2
 	.owner =	THIS_MODULE,
-#endif
 	.read =		snd_seq_read,
 	.write =	snd_seq_write,
 	.open =		snd_seq_open,

===== sound/core/seq/seq_memory.c 1.7 vs edited =====

sound/core/seq/seq_memory.c +1 -11
@@ -235,18 +235,8 @@
 	while (pool->free == NULL && ! nonblock && ! pool->closing) {
 
 		spin_unlock(&pool->lock);
-#ifdef LINUX_2_2
-		/* change semaphore to allow other clients
-		   to access device file */
-		if (file)
-			up(&semaphore_of(file));
-#endif
+		/* XXX: this is racy and wants wait_event_interruptible_lock */
 		interruptible_sleep_on(&pool->output_sleep);
-#ifdef LINUX_2_2
-		/* restore semaphore again */
-		if (file)
-			down(&semaphore_of(file));
-#endif
 		spin_lock(&pool->lock);
 		/* interrupted? */
 		if (signal_pending(current)) {

===== sound/core/seq/oss/seq_oss.c 1.4 vs edited =====

sound/core/seq/oss/seq_oss.c +0 -2
@@ -194,9 +194,7 @@
 
 static struct file_operations seq_oss_f_ops =
 {
-#ifndef LINUX_2_2
 	.owner =	THIS_MODULE,
-#endif
 	.read =		odev_read,
 	.write =	odev_write,
 	.open =		odev_open,

===== sound/oss/msnd.c 1.6 vs edited =====

sound/oss/msnd.c +6 -31
@@ -25,9 +25,6 @@
  ********************************************************************/
 
 #include <linux/version.h>
-#if LINUX_VERSION_CODE < 0x020101
-#  define LINUX20
-#endif
 #include <linux/module.h>
 #include <linux/kernel.h>
 #include <linux/slab.h>
@@ -35,18 +32,10 @@
 #include <linux/types.h>
 #include <linux/delay.h>
 #include <linux/mm.h>
-#ifdef LINUX20
-#  include <linux/major.h>
-#  include <linux/fs.h>
-#  include <linux/sound.h>
-#  include <asm/segment.h>
-#  include "sound_config.h"
-#else
-#  include <linux/init.h>
-#  include <asm/io.h>
-#  include <asm/uaccess.h>
-#  include <linux/spinlock.h>
-#endif
+#include <linux/init.h>
+#include <asm/io.h>
+#include <asm/uaccess.h>
+#include <linux/spinlock.h>
 #include <asm/irq.h>
 #include "msnd.h"
 
@@ -364,7 +353,6 @@
 	return -EIO;
 }
 
-#ifndef LINUX20
 EXPORT_SYMBOL(msnd_register);
 EXPORT_SYMBOL(msnd_unregister);
 EXPORT_SYMBOL(msnd_get_num_devs);
@@ -387,20 +375,7 @@
 
 EXPORT_SYMBOL(msnd_enable_irq);
 EXPORT_SYMBOL(msnd_disable_irq);
-#endif
 
-#ifdef MODULE
-MODULE_AUTHOR				("Andrew Veliath <[email protected]>");
-MODULE_DESCRIPTION			("Turtle Beach MultiSound Driver Base");
+MODULE_AUTHOR("Andrew Veliath <[email protected]>");
+MODULE_DESCRIPTION("Turtle Beach MultiSound Driver Base");
 MODULE_LICENSE("GPL");
-
-
-int init_module(void)
-{
-	return 0;
-}
-
-void cleanup_module(void)
-{
-}
-#endif

===== sound/oss/os.h 1.7 vs edited =====

sound/oss/os.h +0 -7
@@ -6,12 +6,6 @@
 
 #include <linux/module.h>
 #include <linux/version.h>
-
-#if LINUX_VERSION_CODE > 131328
-#define LINUX21X
-#endif
-
-#ifdef __KERNEL__
 #include <linux/utsname.h>
 #include <linux/string.h>
 #include <linux/fs.h>
@@ -30,7 +24,6 @@
 #include <asm/uaccess.h>
 #include <linux/poll.h>
 #include <linux/pci.h>
-#endif
 
 #include <linux/soundcard.h>
 

===== sound/oss/rme96xx.c 1.13 vs edited =====

sound/oss/rme96xx.c +0 -4
@@ -1758,9 +1758,7 @@
 
 
 static struct file_operations rme96xx_audio_fops = {
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0)
 	.owner	 = THIS_MODULE,
-#endif
 	.read	 = rme96xx_read,
 	.write	 = rme96xx_write,
 	.poll	 = rme96xx_poll,
@@ -1857,9 +1855,7 @@
 }
 
 static /*const*/ struct file_operations rme96xx_mixer_fops = {
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0)
 	.owner	 = THIS_MODULE,
-#endif
 	.ioctl	 = rme96xx_mixer_ioctl,
 	.open	 = rme96xx_mixer_open,
 	.release = rme96xx_mixer_release,

===== sound/pci/rme9652/hammerfall_mem.c 1.13 vs edited =====

sound/pci/rme9652/hammerfall_mem.c +0 -20
@@ -98,15 +98,7 @@
 {
 	void *res;
 
-#if LINUX_VERSION_CODE > KERNEL_VERSION(2, 3, 0)
 	res = (void *) pci_alloc_consistent(pci, size, dmaaddr);
-#else
-	int pg;
-	for (pg = 0; PAGE_SIZE * (1 << pg) < size; pg++);
-	res = (void *)__get_free_pages(GFP_KERNEL, pg);
-	if (res != NULL)
-		*dmaaddr = virt_to_bus(res);
-#endif
 	if (res != NULL) {
 		struct page *page = virt_to_page(res);
 		struct page *last_page = page + (size + PAGE_SIZE - 1) / PAGE_SIZE;
@@ -127,19 +119,7 @@
 	last_page = virt_to_page(ptr) + (size + PAGE_SIZE - 1) / PAGE_SIZE;
 	while (page < last_page)
 		clear_bit(PG_reserved, &(page++)->flags);
-#if LINUX_VERSION_CODE > KERNEL_VERSION(2, 3, 0)
 	pci_free_consistent(pci, size, ptr, dmaaddr);
-#else
-	{
-		int pg;
-		for (pg = 0; PAGE_SIZE * (1 << pg) < size; pg++);
-		if (bus_to_virt(dmaaddr) != ptr) {
-			printk(KERN_ERR "hammerfall_free_pages: dmaaddr != ptr\n");
-			return;
-		}
-		free_pages((unsigned long)ptr, pg);
-	}
-#endif
 }
 
 void *snd_hammerfall_get_buffer (struct pci_dev *pcidev, dma_addr_t *dmaaddr)

===== sound/ppc/awacs.c 1.10 vs edited =====

sound/ppc/awacs.c +1 -5
@@ -32,7 +32,7 @@
 #define chip_t pmac_t
 
 
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,3,0) || defined(CONFIG_ADB_CUDA)
+#if defined(CONFIG_ADB_CUDA)
 #define PMAC_AMP_AVAIL
 #endif
 
@@ -43,11 +43,7 @@
 	unsigned char amp_tone[2];
 } awacs_amp_t;
 
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,3,0)
-#define CHECK_CUDA_AMP() (adb_hardware == ADB_VIACUDA)
-#else
 #define CHECK_CUDA_AMP() (sys_ctrler == SYS_CTRLER_CUDA)
-#endif
 
 #endif /* PMAC_AMP_AVAIL */
 

===== sound/ppc/pmac.c 1.13 vs edited =====

sound/ppc/pmac.c +0 -5
@@ -36,11 +36,6 @@
 #include <asm/feature.h>
 #endif
 
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,3,0)
-#define pmu_suspend()	/**/
-#define pmu_resume()	/**/
-#endif
-
 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,18)
 #define request_OF_resource(io,num,str)  1
 #define release_OF_resource(io,num) /**/

===== sound/ppc/pmac.h 1.4 vs edited =====

sound/ppc/pmac.h +0 -6
@@ -27,18 +27,12 @@
 #include <sound/pcm.h>
 #include "awacs.h"
 
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,3,0)
-#include <asm/adb.h>
-#include <asm/cuda.h>
-#include <asm/pmu.h>
-#else /* 2.4.0 kernel */
 #include <linux/adb.h>
 #ifdef CONFIG_ADB_CUDA
 #include <linux/cuda.h>
 #endif
 #ifdef CONFIG_ADB_PMU
 #include <linux/pmu.h>
-#endif
 #endif
 #include <linux/nvram.h>
 #include <linux/tty.h>
#1 lore raw
Quoted 6 lines · Christoph Hellwig

Not that it actually is compilable due to random changes..

sound/core/control.c line 937

Quoted 9 lines
sound/core/control.c +0 -2
@@ -931,9 +931,7 @@
 
 static struct file_operations snd_ctl_f_ops =
 {
-#ifndef LINUX_2_2
 	.owner =	THIS_MODULE,
-#endif
 	.read =		snd_ctl_read,
 	.open =		snd_ctl_open,
 	.release =	snd_ctl_release,

We still support the 2.2 kernel. We are trying to separate this "compatibility" code to another location, but in some cases, it is difficult. Please, make changes only for /sound/oss tree. Thank you.

Jaroslav

-----
Jaroslav Kysela <[email protected]>
Linux Kernel Sound Maintainer
ALSA Project, SuSE Labs

#2 lore raw
Quoted 3 lines · Jaroslav Kysela

We still support the 2.2 kernel. We are trying to separate this "compatibility" code to another location, but in some cases, it is difficult. Please, make changes only for /sound/oss tree. Thank you.

I sterongly disagree. As part of having your code in mainline you have to keep it readable. Neither the compat mess nor the typedef abuse help on this.

#3 lore raw
Quoted 9 lines · Christoph Hellwig
Quoted 3 lines · Jaroslav Kysela

We still support the 2.2 kernel. We are trying to separate this "compatibility" code to another location, but in some cases, it is difficult. Please, make changes only for /sound/oss tree. Thank you.

I sterongly disagree. As part of having your code in mainline you have to keep it readable. Neither the compat mess nor the typedef abuse help on this.

And it's not like the 2.2 code was actually working, e.g. the dropping of i_sem in ->write makes you allow multiple simultanous writes, your module refcounting on 2.2 is completly b0rked due to the lack of ->owner and many functions have change parameters..

#4 lore raw
Quoted 11 lines · Christoph Hellwig
Quoted 9 lines · Christoph Hellwig
Quoted 3 lines · Jaroslav Kysela

We still support the 2.2 kernel. We are trying to separate this "compatibility" code to another location, but in some cases, it is difficult. Please, make changes only for /sound/oss tree. Thank you.

I sterongly disagree. As part of having your code in mainline you have to keep it readable. Neither the compat mess nor the typedef abuse help on this.

Quoted 4 lines

And it's not like the 2.2 code was actually working, e.g. the dropping of i_sem in ->write makes you allow multiple simultanous writes, your module refcounting on 2.2 is completly b0rked due to the lack of ->owner and many functions have change parameters..

Note we already removed 99% of compatibility code, but the remaining pieces are very difficult to solve with C preprocesor. I know that you do not care about older kernels, but we have good reasons to share code. It very simplifies maintaince.

Please, let us to remove this compatibility stuff. I will probably use one more level of preprocessing to keep the compatibility in our build tree.

Jaroslav

-----
Jaroslav Kysela <[email protected]>
Linux Kernel Sound Maintainer
ALSA Project, SuSE Labs