patch-2.4.0-test9 linux/drivers/char/mem.c

Next file: linux/drivers/char/misc.c
Previous file: linux/drivers/char/lp.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.4.0-test8/linux/drivers/char/mem.c linux/drivers/char/mem.c
@@ -28,12 +28,6 @@
 #ifdef CONFIG_I2C
 extern int i2c_init_all(void);
 #endif
-#ifdef CONFIG_SOUND
-void soundcore_init(void);
-#ifdef CONFIG_SOUND_OSS
-void soundcard_init(void);
-#endif
-#endif
 #ifdef CONFIG_SPARCAUDIO
 extern int sparcaudio_init(void);
 #endif
@@ -55,9 +49,6 @@
 #if defined(CONFIG_ADB)
 extern void adbdev_init(void);
 #endif
-#ifdef CONFIG_PHONE
-extern void telephony_init(void);
-#endif
      
 static ssize_t do_write_mem(struct file * file, void *p, unsigned long realp,
 			    const char * buf, size_t count, loff_t *ppos)
@@ -258,25 +249,27 @@
 		count -= read;
 	}
 
-	kbuf = (char *)__get_free_page(GFP_KERNEL);
-	if (!kbuf)
-		return -ENOMEM;
-	while (count > 0) {
-		int len = count;
-
-		if (len > PAGE_SIZE)
-			len = PAGE_SIZE;
-		len = vread(kbuf, (char *)p, len);
-		if (len && copy_to_user(buf, kbuf, len)) {
-			free_page((unsigned long)kbuf);
-			return -EFAULT;
+	if (count > 0) {
+		kbuf = (char *)__get_free_page(GFP_KERNEL);
+		if (!kbuf)
+			return -ENOMEM;
+		while (count > 0) {
+			int len = count;
+
+			if (len > PAGE_SIZE)
+				len = PAGE_SIZE;
+			len = vread(kbuf, (char *)p, len);
+			if (len && copy_to_user(buf, kbuf, len)) {
+				free_page((unsigned long)kbuf);
+				return -EFAULT;
+			}
+			count -= len;
+			buf += len;
+			virtr += len;
+			p += len;
 		}
-		count -= len;
-		buf += len;
-		virtr += len;
-		p += len;
+		free_page((unsigned long)kbuf);
 	}
-	free_page((unsigned long)kbuf);
  	*ppos = p;
  	return virtr + read;
 }
@@ -642,15 +635,6 @@
 	lp_m68k_init();
 #endif
 	misc_init();
-#ifdef CONFIG_SOUND
-	soundcore_init();
-#ifdef CONFIG_SOUND_OSS
-	soundcard_init();
-#endif
-#endif
-#ifdef CONFIG_SPARCAUDIO
-	sparcaudio_init();
-#endif
 #if CONFIG_QIC02_TAPE
 	qic02_tape_init();
 #endif
@@ -666,8 +650,5 @@
 #ifdef CONFIG_VIDEO_DEV
 	videodev_init();
 #endif
-#ifdef CONFIG_PHONE
-	telephony_init();
-#endif	
 	return 0;
 }

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)