To: linux-m68k@lists.linux-m68k.org
Subject: L68K: 2.1.61 patches
X-Yow: I'd like TRAINED SEALS and a CONVERTIBLE on my doorstep by NOON!!
From: Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
Date: 10 Nov 1997 10:49:40 +0100
Sender: owner-linux-m68k@phil.uni-sb.de

Hi!

Here is my patch for 2.1.61:

- joystick.c, lp_m68k.c, nvram.c: update read/write functions.
- amikeyb.c: avoid assembler, gcc knows about rotate instructions.
- lp_mfc.c: avoid hardcoding MAX_LP.
- Configure: avoid useless use of command substitution.
- the rest is to avoid warnings from gcc.

Andreas.

--- arch/m68k/atari/joystick.c.~1~	Sat Jul 19 00:39:38 1997
+++ arch/m68k/atari/joystick.c	Sat Nov  8 01:24:21 1997
@@ -82,15 +82,16 @@
     return 0;
 }
 
-static long write_joystick(struct inode *inode, struct file *file,
-			   const char *buffer, unsigned long count)
+static ssize_t write_joystick(struct file *file, const char *buffer,
+			      size_t count, loff_t *ppos)
 {
     return -EINVAL;
 }
 
-static long read_joystick(struct inode *inode, struct file *file,
-			  char *buffer, unsigned long count)
+static ssize_t read_joystick(struct file *file, char *buffer, size_t count,
+			     loff_t *ppos)
 {
+    struct inode *inode = file->f_dentry->d_inode;
     int minor = DEVICE_NR(inode->i_rdev);
 
     if (count < 2)
--- arch/m68k/kernel/time.c.~1~	Wed Apr 16 21:54:38 1997
+++ arch/m68k/kernel/time.c	Sat Nov  8 01:09:03 1997
@@ -66,11 +66,12 @@
 	 */
 	if (time_state != TIME_BAD && xtime.tv_sec > last_rtc_update + 660 &&
 	    xtime.tv_usec > 500000 - (tick >> 1) &&
-	    xtime.tv_usec < 500000 + (tick >> 1))
+	    xtime.tv_usec < 500000 + (tick >> 1)) {
 	  if (set_rtc_mmss(xtime.tv_sec) == 0)
 	    last_rtc_update = xtime.tv_sec;
 	  else
 	    last_rtc_update = xtime.tv_sec - 600; /* do it again in 60 s */
+	}
 }
 
 /* Converts Gregorian date to seconds since 1970-01-01 00:00:00.
--- drivers/block/genhd.c.~1~	Fri Nov  7 19:13:30 1997
+++ drivers/block/genhd.c	Fri Nov  7 22:13:47 1997
@@ -309,7 +309,9 @@
 		return;
 	}
 
+#if CONFIG_KERNELD && CONFIG_FOREIGN_PARTITIONS
     retry:
+#endif
 	printk(" %s:", disk_name(hd, MINOR(dev), buf));
 	for( parser = partition_parsers; parser; parser = parser->next ) {
 		if (parser->func(hd, dev, first_sector))
--- drivers/char/amikeyb.c.~1~	Fri Nov  7 19:13:38 1997
+++ drivers/char/amikeyb.c	Fri Nov  7 20:10:04 1997
@@ -233,11 +233,7 @@
     mark_bh(KEYBOARD_BH);
 
     /* rotate scan code to get up/down bit in proper position */
-#ifdef __mc68000__
-    __asm__ __volatile__ ("rorb #1,%0" : "=g" (scancode) : "0" (scancode));
-#else
-    scancode = (((scancode >> 1) & 0x7f ) | ((scancode & 1) ? 0x80 : 0));
-#endif
+    scancode = ((scancode >> 1) & 0x7f) | ((scancode << 7) & 0x80);
 
     /*
      * Check make/break first
--- drivers/char/lp_m68k.c.~1~	Fri Sep 26 18:09:22 1997
+++ drivers/char/lp_m68k.c	Fri Nov  7 20:33:30 1997
@@ -173,13 +173,14 @@
 }
 
 #if WHICH_DRIVER == FORCE_INTERRUPT
-static long lp_write(struct inode *inode, struct file *file,
-		    const char *buf, unsigned long count)
+static ssize_t lp_write(struct file *file, const char *buf, size_t count,
+			loff_t *ppos)
 #else
-static long lp_write_interrupt(struct inode *inode, struct file *file,
-			      const char *buf, unsigned long count)
+static ssize_t lp_write_interrupt(struct file *file, const char *buf,
+				  size_t count, loff_t *ppos)
 #endif
 {
+  struct inode *inode = file->f_dentry->d_inode;
   unsigned long total_bytes_written = 0;
   unsigned int flags;
   int rc;
@@ -267,13 +268,14 @@
 
 #if WHICH_DRIVER != FORCE_INTERRUPT
 #if WHICH_DRIVER == FORCE_POLLING
-static long lp_write(struct inode *inode, struct file *file,
-		    const char *buf, unsigned long count)
+static ssize_t lp_write(struct file *file, const char *buf, size_t count,
+			loff_t *ppos)
 #else
-static long lp_write_polled(struct inode *inode, struct file *file,
-			   const char *buf, unsigned long count)
+static ssize_t lp_write_polled(struct file *file, const char *buf,
+			       size_t count, loff_t *ppos)
 #endif
 {
+	struct inode *inode = file->f_dentry->d_inode;
 	char *temp = buf;
 	int dev = MINOR(inode->i_rdev);
 
@@ -343,13 +345,13 @@
 unsigned int lp_irq = 0;
 
 #if WHICH_DRIVER == PREFER_INTERRUPT
-static long lp_write(struct inode *inode, struct file *file,
-		    const char *buf, unsigned long count)
+static ssize_t lp_write(struct file *file, const char *buf, size_t count,
+			loff_t *ppos)
 {
 	if (lp_irq)
-		return lp_write_interrupt(inode, file, buf, count);
+		return lp_write_interrupt(file, buf, count, ppos);
 	else
-		return lp_write_polled(inode, file, buf, count);
+		return lp_write_polled(file, buf, count, ppos);
 }
 #endif
 
--- drivers/char/lp_mfc.c.~1~	Fri Nov  7 19:13:42 1997
+++ drivers/char/lp_mfc.c	Fri Nov  7 19:38:21 1997
@@ -34,7 +34,7 @@
 
 static volatile int dummy; /* for trigger reads */
 static int minor[MAX_LP] = { -1, -1, -1, -1, -1 };
-MODULE_PARM(minor,"1-5i");
+MODULE_PARM(minor,"1-" __MODULE_STRING(MAX_LP) "i");
 #ifdef MODULE
 static unsigned int board_key[MAX_LP];
 #endif
--- drivers/char/nvram.c.~1~	Mon Sep 22 18:05:59 1997
+++ drivers/char/nvram.c	Fri Nov  7 22:16:02 1997
@@ -227,8 +227,8 @@
 	return( (offset >= 0) ? (file->f_pos = offset) : -EINVAL );
 }
 
-static long nvram_read( struct inode * inode, struct file * file,
-						char * buf, unsigned long count )
+static ssize_t nvram_read(struct file *file, char *buf, size_t count,
+			  loff_t *ppos)
 {
 	unsigned long flags;
 	unsigned i = file->f_pos;
@@ -250,8 +250,8 @@
 	return( tmp - buf );
 }
 
-static long nvram_write( struct inode * inode, struct file * file,
-						 const char * buf, unsigned long count )
+static ssize_t nvram_write(struct file *file, const char *buf, size_t count,
+			   loff_t *ppos)
 {
 	unsigned long flags;
 	unsigned i = file->f_pos;
--- drivers/video/atafb.c.~2~	Fri Nov  7 19:59:46 1997
+++ drivers/video/atafb.c	Fri Nov  7 22:17:05 1997
@@ -691,13 +691,13 @@
 	linelen=var->xres_virtual * var->bits_per_pixel / 8;
 	if (! use_hwscroll)
 		var->yres_virtual=var->yres;
-	else if (screen_len)
+	else if (screen_len) {
 		if (par->yres_virtual)
 			var->yres_virtual = par->yres_virtual;
 		else
 			/* yres_virtual==0 means use maximum */
 			var->yres_virtual = screen_len / linelen;
-	else {
+	} else {
 		if (hwscroll < 0)
 			var->yres_virtual = 2 * var->yres;
 		else
--- drivers/video/fbcon-mfb.c.~1~	Thu Sep 18 17:50:54 1997
+++ drivers/video/fbcon-mfb.c	Sat Nov  8 03:09:20 1997
@@ -106,12 +106,12 @@
 
     dest = p->screen_base+sy*p->fontheight*p->next_line+sx;
 
-    if (sx == 0 && width == p->next_line)
+    if (sx == 0 && width == p->next_line) {
 	if (attr_reverse(p,conp))
 	    mymemset(dest, height*p->fontheight*width);
 	else
 	    mymemclear(dest, height*p->fontheight*width);
-    else
+    } else
 	for (rows = height*p->fontheight; rows--; dest += p->next_line)
 	    if (attr_reverse(p,conp))
 		mymemset(dest, width);
--- drivers/video/fbcon.c.~1~	Fri Nov  7 20:00:12 1997
+++ drivers/video/fbcon.c	Fri Nov  7 22:16:40 1997
@@ -831,7 +831,7 @@
 
     fbcon_cursor(p->conp, blank ? CM_ERASE : CM_DRAW);
 
-    if (!p->can_soft_blank)
+    if (!p->can_soft_blank) {
 	if (blank) {
 	    if (p->visual == FB_VISUAL_MONO01)
 		mymemset(p->screen_base,
@@ -846,6 +846,7 @@
 	    /* Tell console.c that it has to restore the screen itself */
 	    return(1);
 	}
+    }
     (*p->fb_info->blank)(blank);
     return(0);
 }
--- fs/ext2/truncate.c.~1~	Wed Sep 10 17:42:13 1997
+++ fs/ext2/truncate.c	Sat Nov  8 00:06:09 1997
@@ -181,7 +181,7 @@
 	for (i = 0; i < addr_per_block; i++)
 		if (le32_to_cpu(*(ind++)))
 			break;
-	if (i >= addr_per_block)
+	if (i >= addr_per_block) {
 		if (ind_bh->b_count != 1)
 			retry = 1;
 		else {
@@ -193,6 +193,7 @@
 			bforget(ind_bh);
 			ind_bh = NULL;
 		}
+	}
 	if (IS_SYNC(inode) && ind_bh && buffer_dirty(ind_bh)) {
 		ll_rw_block (WRITE, 1, &ind_bh);
 		wait_on_buffer (ind_bh);
@@ -243,7 +244,7 @@
 	for (i = 0; i < addr_per_block; i++)
 		if (le32_to_cpu(*(dind++)))
 			break;
-	if (i >= addr_per_block)
+	if (i >= addr_per_block) {
 		if (dind_bh->b_count != 1)
 			retry = 1;
 		else {
@@ -255,6 +256,7 @@
 			bforget(dind_bh);
 			dind_bh = 0;
 		}
+	}
 	if (IS_SYNC(inode) && dind_bh && buffer_dirty(dind_bh)) {
 		ll_rw_block (WRITE, 1, &dind_bh);
 		wait_on_buffer (dind_bh);
@@ -304,7 +306,7 @@
 	for (i = 0; i < addr_per_block; i++)
 		if (le32_to_cpu(*(tind++)))
 			break;
-	if (i >= addr_per_block)
+	if (i >= addr_per_block) {
 		if (tind_bh->b_count != 1)
 			retry = 1;
 		else {
@@ -316,6 +318,7 @@
 			bforget(tind_bh);
 			tind_bh = 0;
 		}
+	}
 	if (IS_SYNC(inode) && tind_bh && buffer_dirty(tind_bh)) {
 		ll_rw_block (WRITE, 1, &tind_bh);
 		wait_on_buffer (tind_bh);
--- fs/minix/truncate.c.~1~	Fri Jul 18 19:18:54 1997
+++ fs/minix/truncate.c	Sat Nov  8 00:05:31 1997
@@ -117,7 +117,7 @@
 	for (i = 0; i < 512; i++)
 		if (*(ind++))
 			break;
-	if (i >= 512)
+	if (i >= 512) {
 		if (ind_bh->b_count != 1)
 			retry = 1;
 		else {
@@ -125,6 +125,7 @@
 			*p = 0;
 			minix_free_block(inode->i_sb,tmp);
 		}
+	}
 	brelse(ind_bh);
 	return retry;
 }
@@ -161,7 +162,7 @@
 	for (i = 0; i < 512; i++)
 		if (*(dind++))
 			break;
-	if (i >= 512)
+	if (i >= 512) {
 		if (dind_bh->b_count != 1)
 			retry = 1;
 		else {
@@ -170,6 +171,7 @@
 			mark_inode_dirty(inode);
 			minix_free_block(inode->i_sb,tmp);
 		}
+	}
 	brelse(dind_bh);
 	return retry;
 }
@@ -279,7 +281,7 @@
 	for (i = 0; i < 256; i++)
 		if (*(ind++))
 			break;
-	if (i >= 256)
+	if (i >= 256) {
 		if (ind_bh->b_count != 1)
 			retry = 1;
 		else {
@@ -287,6 +289,7 @@
 			*p = 0;
 			minix_free_block(inode->i_sb,tmp);
 		}
+	}
 	brelse(ind_bh);
 	return retry;
 }
@@ -323,7 +326,7 @@
 	for (i = 0; i < 256; i++)
 		if (*(dind++))
 			break;
-	if (i >= 256)
+	if (i >= 256) {
 		if (dind_bh->b_count != 1)
 			retry = 1;
 		else {
@@ -332,6 +335,7 @@
 			mark_inode_dirty(inode);
 			minix_free_block(inode->i_sb,tmp);
 		}
+	}
 	brelse(dind_bh);
 	return retry;
 }
@@ -368,7 +372,7 @@
         for (i = 0; i < 256; i++)
                 if (*(tind++))
                         break;
-        if (i >= 256)
+        if (i >= 256) {
                 if (tind_bh->b_count != 1)
                         retry = 1;
                 else {
@@ -377,6 +381,7 @@
                         mark_inode_dirty(inode);
                         minix_free_block(inode->i_sb,tmp);
 		}
+	}
         brelse(tind_bh);
         return retry;
 }
--- fs/pipe.c.~1~	Fri Nov  7 19:15:53 1997
+++ fs/pipe.c	Sat Nov  8 00:07:01 1997
@@ -46,11 +46,12 @@
 	if (filp->f_flags & O_NONBLOCK) {
 		if (PIPE_LOCK(*inode))
 			return -EAGAIN;
-		if (PIPE_EMPTY(*inode))
+		if (PIPE_EMPTY(*inode)) {
 			if (PIPE_WRITERS(*inode))
 				return -EAGAIN;
 			else
 				return 0;
+		}
 	} else while (PIPE_EMPTY(*inode) || PIPE_LOCK(*inode)) {
 		if (PIPE_EMPTY(*inode)) {
 			if (!PIPE_WRITERS(*inode))
--- include/asm-m68k/serial.h.~1~	Mon Jul 28 17:30:53 1997
+++ include/asm-m68k/serial.h	Thu Oct 16 11:30:36 1997
@@ -371,7 +371,7 @@
 	info->icount.cts++;
 	wake_up_interruptible(&info->delta_msr_wait);
 	
-	if ((info->flags & ASYNC_CTS_FLOW) && info->tty)
+	if ((info->flags & ASYNC_CTS_FLOW) && info->tty) {
 		if (info->tty->hw_stopped) {
 			if (cts) {
 #if (defined(SERIAL_DEBUG_INTR) || defined(SERIAL_DEBUG_FLOW))
@@ -388,7 +388,7 @@
 				rs_stop( info->tty );
 			}
 		}
-		
+	}
 }
 
 
--- kernel/time.c.~1~	Mon Sep  8 18:13:46 1997
+++ kernel/time.c	Fri Nov  7 21:06:38 1997
@@ -261,7 +261,7 @@
 	    if (txc.modes & ADJ_TIMECONST)
 		time_constant = txc.constant;
 
-	    if (txc.modes & ADJ_OFFSET)
+	    if (txc.modes & ADJ_OFFSET) {
 	      if ((txc.modes == ADJ_OFFSET_SINGLESHOT)
 		  || !(time_status & STA_PLL))
 		{
@@ -326,6 +326,7 @@
 		  else if (time_freq < -time_tolerance)
 		    time_freq = -time_tolerance;
 		} /* STA_PLL || STA_PPSTIME */
+	    }
 	    if (txc.modes & ADJ_TICK)
 	      tick = txc.tick;
 
--- lib/vsprintf.c.~1~	Mon Sep  8 18:14:01 1997
+++ lib/vsprintf.c	Sat Nov  8 01:08:46 1997
@@ -112,13 +112,14 @@
 			*str++ = ' ';
 	if (sign)
 		*str++ = sign;
-	if (type & SPECIAL)
+	if (type & SPECIAL) {
 		if (base==8)
 			*str++ = '0';
 		else if (base==16) {
 			*str++ = '0';
 			*str++ = digits[33];
 		}
+	}
 	if (!(type & LEFT))
 		while (size-- > 0)
 			*str++ = c;
@@ -281,12 +282,12 @@
 		}
 		if (qualifier == 'l')
 			num = va_arg(args, unsigned long);
-		else if (qualifier == 'h')
+		else if (qualifier == 'h') {
 			if (flags & SIGN)
 				num = va_arg(args, short);
 			else
 				num = va_arg(args, unsigned short);
-		else if (flags & SIGN)
+		} else if (flags & SIGN)
 			num = va_arg(args, int);
 		else
 			num = va_arg(args, unsigned int);
--- mm/mprotect.c.~1~	Fri Jul 18 19:49:23 1997
+++ mm/mprotect.c	Fri Nov  7 22:48:17 1997
@@ -183,12 +183,12 @@
 	if (newflags == vma->vm_flags)
 		return 0;
 	newprot = protection_map[newflags & 0xf];
-	if (start == vma->vm_start)
+	if (start == vma->vm_start) {
 		if (end == vma->vm_end)
 			error = mprotect_fixup_all(vma, newflags, newprot);
 		else
 			error = mprotect_fixup_start(vma, end, newflags, newprot);
-	else if (end == vma->vm_end)
+	} else if (end == vma->vm_end)
 		error = mprotect_fixup_end(vma, start, newflags, newprot);
 	else
 		error = mprotect_fixup_middle(vma, start, end, newflags, newprot);
--- scripts/Configure.~1~	Wed Jun 18 20:21:19 1997
+++ scripts/Configure	Sat Nov  8 17:33:34 1997
@@ -169,7 +169,7 @@
 #	bool question define
 #
 function bool () {
-	old=$(eval echo "\${$2}")
+	eval old="\${$2}"
 	def=${old:-'n'}
 	case "$def" in
 	 "y" | "m") defprompt="Y/n/?"
@@ -200,7 +200,7 @@
 	if [ "$CONFIG_MODULES" != "y" ]; then
 	  bool "$1" "$2"
 	else 
-	  old=$(eval echo "\${$2}")
+	  eval old="\${$2}"
 	  def=${old:-'n'}
 	  case "$def" in
 	   "y") defprompt="Y/m/n/?"
@@ -237,7 +237,7 @@
 #	tristate question define default ...
 #
 function dep_tristate () {
-	old=$(eval echo "\${$2}")
+	eval old="\${$2}"
 	def=${old:-'n'}
 	ques=$1
 	var=$2
@@ -307,7 +307,7 @@
 #	int question define default [min max]
 #
 function int () {
-	old=$(eval echo "\${$2}")
+	eval old="\${$2}"
 	def=${old:-$3}
 	if [ $# -gt 3 ]; then
 	  min=$4
@@ -347,7 +347,7 @@
 #	hex question define default
 #
 function hex () {
-	old=$(eval echo "\${$2}")
+	eval old="\${$2}"
 	def=${old:-$3}
 	def=${def#*[x,X]}
 	while :; do
@@ -379,7 +379,7 @@
 #	string question define default
 #
 function string () {
-	old=$(eval echo "\${$2}")
+	eval old="\${$2}"
 	def=${old:-$3}
 	readln "$1 ($2) [$def] " "$def" "$old"
 	define_string "$2" "$ans"
@@ -414,7 +414,7 @@
 		else
 			names="$1"
 		fi
-		if [ "$(eval echo \"\${$2}\")" = "y" ]; then
+		if eval [ \"\${$2}\" = "y" ]; then
 			old=$1
 			def=$1
 		fi
