2.1.0 patches, aha1542, ncpfs, sound, umsdos

Keith Owens (kaos@audio.apana.org.au)
Tue, 1 Oct 1996 17:51:38 +1000 (EST)


drivers/scsi/aha1542.c - Correct out by one error (thanks to John Shifflett
<jshiffle@netcom.com>). Cosmetic change SCSI_PA to
SCSI_BUS to better match the memory model.
fs/ncpfs/dir.c, file.c - Correct definition of read/write routines to match
new file_operations.
Various sound modules - Correct definition of read/write/seek routines to
match new file_operations. Remove complaint about
unused routine.
fs/umsdos/emd.c - Correct definition of read/write routines to match
new file_operations.

diff -ur linux-2.1.0/drivers/scsi/aha1542.c linux/drivers/scsi/aha1542.c
--- linux-2.1.0/drivers/scsi/aha1542.c Tue Oct 1 16:02:16 1996
+++ linux/drivers/scsi/aha1542.c Tue Oct 1 14:15:33 1996
@@ -35,7 +35,7 @@

#include "aha1542.h"

-#define SCSI_PA(address) virt_to_bus(address)
+#define SCSI_BUS(address) (address ? virt_to_bus(address) : 0)

#define BAD_DMA(msg, address, length) \
{ \
@@ -435,7 +435,7 @@
return;
};

- mbo = (scsi2int(mb[mbi].ccbptr) - (SCSI_PA(&ccb[0]))) / sizeof(struct ccb);
+ mbo = (scsi2int(mb[mbi].ccbptr) - (SCSI_BUS(&ccb[0]))) / sizeof(struct ccb);
mbistatus = mb[mbi].status;
mb[mbi].status = 0;
HOSTDATA(shost)->aha1542_last_mbi_used = mbi;
@@ -595,7 +595,7 @@
printk("Sending command (%d %x)...",mbo, done);
#endif

- any2scsi(mb[mbo].ccbptr, SCSI_PA(&ccb[mbo])); /* This gets trashed for some reason*/
+ any2scsi(mb[mbo].ccbptr, SCSI_BUS(&ccb[mbo])); /* This gets trashed for some reason*/

memset(&ccb[mbo], 0, sizeof(struct ccb));

@@ -635,13 +635,13 @@
for(i=0;i<18;i++) printk("%02x ", ptr[i]);
panic("Foooooooood fight!");
};
- any2scsi(cptr[i].dataptr, SCSI_PA(sgpnt[i].address));
- if(SCSI_PA(sgpnt[i].address+sgpnt[i].length) > ISA_DMA_THRESHOLD)
+ any2scsi(cptr[i].dataptr, SCSI_BUS(sgpnt[i].address));
+ if(SCSI_BUS(sgpnt[i].address+sgpnt[i].length) > (ISA_DMA_THRESHOLD+1))
BAD_DMA("sgpnt", sgpnt[i].address, sgpnt[i].length);
any2scsi(cptr[i].datalen, sgpnt[i].length);
};
any2scsi(ccb[mbo].datalen, SCpnt->use_sg * sizeof(struct chain));
- any2scsi(ccb[mbo].dataptr, SCSI_PA(cptr));
+ any2scsi(ccb[mbo].dataptr, SCSI_BUS(cptr));
#ifdef DEBUG
printk("cptr %x: ",cptr);
ptr = (unsigned char *) cptr;
@@ -651,9 +651,9 @@
ccb[mbo].op = 0; /* SCSI Initiator Command */
SCpnt->host_scribble = NULL;
any2scsi(ccb[mbo].datalen, bufflen);
- if(buff && SCSI_PA(buff+bufflen) > ISA_DMA_THRESHOLD)
+ if(buff && SCSI_BUS(buff+bufflen) > (ISA_DMA_THRESHOLD+1))
BAD_DMA("buff", buff, bufflen);
- any2scsi(ccb[mbo].dataptr, SCSI_PA(buff));
+ any2scsi(ccb[mbo].dataptr, SCSI_BUS(buff));
};
ccb[mbo].idlun = (target&7)<<5 | direction | (lun & 7); /*SCSI Target Id*/
ccb[mbo].rsalen = 16;
@@ -712,10 +712,10 @@

for(i=0; i<AHA1542_MAILBOXES; i++){
mb[i].status = mb[AHA1542_MAILBOXES+i].status = 0;
- any2scsi(mb[i].ccbptr, SCSI_PA(&ccb[i]));
+ any2scsi(mb[i].ccbptr, SCSI_BUS(&ccb[i]));
};
aha1542_intr_reset(bse); /* reset interrupts, so they don't block */
- any2scsi((cmd+2), SCSI_PA(mb));
+ any2scsi((cmd+2), SCSI_BUS(mb));
aha1542_out(bse, cmd, 5);
WAIT(INTRFLAGS(bse), INTRMASK, HACC, 0);
while (0) {
@@ -950,7 +950,7 @@

/* For now we do this - until kmalloc is more intelligent
we are resigned to stupid hacks like this */
- if (SCSI_PA(shpnt+1) > ISA_DMA_THRESHOLD) {
+ if (SCSI_BUS(shpnt+1) > (ISA_DMA_THRESHOLD+1)) {
printk("Invalid address for shpnt with 1542.\n");
goto unregister;
}
diff -ur linux-2.1.0/fs/ncpfs/dir.c linux/fs/ncpfs/dir.c
--- linux-2.1.0/fs/ncpfs/dir.c Tue Oct 1 16:02:22 1996
+++ linux/fs/ncpfs/dir.c Tue Oct 1 15:48:33 1996
@@ -24,8 +24,8 @@
unsigned long f_pos;
};

-static int
-ncp_dir_read(struct inode *inode, struct file *filp, char *buf, int count);
+static long
+ncp_dir_read(struct inode *inode, struct file *filp, char *buf, unsigned long count);

static int
ncp_readdir(struct inode *inode, struct file *filp,
@@ -192,8 +192,8 @@
return NULL;
}

-static int
-ncp_dir_read(struct inode *inode, struct file *filp, char *buf, int count)
+static long
+ncp_dir_read(struct inode *inode, struct file *filp, char *buf, unsigned long count)
{
return -EISDIR;
}
diff -ur linux-2.1.0/fs/ncpfs/file.c linux/fs/ncpfs/file.c
--- linux-2.1.0/fs/ncpfs/file.c Sun Jun 2 18:21:10 1996
+++ linux/fs/ncpfs/file.c Tue Oct 1 15:52:38 1996
@@ -80,8 +80,8 @@
return -EACCES;
}

-static int
-ncp_file_read(struct inode *inode, struct file *file, char *buf, int count)
+static long
+ncp_file_read(struct inode *inode, struct file *file, char *buf, unsigned long count)
{
int bufsize, already_read;
off_t pos;
@@ -164,9 +164,9 @@
return already_read;
}

-static int
+static long
ncp_file_write(struct inode *inode, struct file *file, const char *buf,
- int count)
+ unsigned long count)
{
int bufsize, already_written;
off_t pos;
>From jrt@miel.demon.co.ukTue Oct 1 14:31:10 1996
Date: Mon, 30 Sep 1996 19:37:24 +0100 (BST)
From: Julian Thompson <jrt@miel.demon.co.uk>
To: linux-kernel <linux-kernel@vger.rutgers.edu>
Subject: Patch: linux-2.1.0/drivers/block/rd.c

Hi,

I had to apply the following patch in order to compile the "official"
2.1.0 kernel when using the ramdisk. The comments also contained
references to lseek, but I didn't change them as they don't appear to
have changed elsewhere :-)

Regards,
Julian

=========================== snip ===============================
--- linux/drivers/block/rd.c.orig Tue Jul 2 17:08:41 1996
+++ linux/drivers/block/rd.c Mon Sep 30 19:24:06 1996
@@ -350,8 +350,8 @@
/*
* Read block 0 to test for gzipped kernel
*/
- if (fp->f_op->lseek)
- fp->f_op->lseek(fp->f_inode, fp, start_block * BLOCK_SIZE, 0);
+ if (fp->f_op->llseek)
+ fp->f_op->llseek(fp->f_inode, fp, start_block * BLOCK_SIZE, 0);
fp->f_pos = start_block * BLOCK_SIZE;

fp->f_op->read(fp->f_inode, fp, buf, size);
@@ -370,8 +370,8 @@
/*
* Read block 1 to test for minix and ext2 superblock
*/
- if (fp->f_op->lseek)
- fp->f_op->lseek(fp->f_inode, fp,
+ if (fp->f_op->llseek)
+ fp->f_op->llseek(fp->f_inode, fp,
(start_block+1) * BLOCK_SIZE, 0);
fp->f_pos = (start_block+1) * BLOCK_SIZE;

@@ -400,8 +400,8 @@
start_block);

done:
- if (fp->f_op->lseek)
- fp->f_op->lseek(fp->f_inode, fp, start_block * BLOCK_SIZE, 0);
+ if (fp->f_op->llseek)
+ fp->f_op->llseek(fp->f_inode, fp, start_block * BLOCK_SIZE, 0);
fp->f_pos = start_block * BLOCK_SIZE;

if ((nblocks > 0) && blk_size[MAJOR(device)]) {
=========================== snip ===============================

-- 
Julian Thompson (jrt@miel.demon.co.uk)
diff -ur linux-2.1.0/drivers/sound/sb_common.c linux/drivers/sound/sb_common.c
--- linux-2.1.0/drivers/sound/sb_common.c	Tue Sep 10 17:08:12 1996
+++ linux/drivers/sound/sb_common.c	Tue Oct  1 15:41:16 1996
@@ -261,6 +261,7 @@
   return 1;
 }
 
+#if defined(CONFIG_MIDI) && defined(CONFIG_UART401)
 static void
 sb16_set_mpu_port(sb_devc *devc, struct address_info *hw_config)
 {
@@ -283,6 +284,7 @@
 		printk("SB16: Invalid MIDI I/O port %x\n", hw_config->io_base);
 	}
 }
+#endif
 
 static int
 sb16_set_irq_hw (sb_devc * devc, int level)
diff -ur linux-2.1.0/drivers/sound/soundcard.c linux/drivers/sound/soundcard.c
--- linux-2.1.0/drivers/sound/soundcard.c	Tue Oct  1 16:02:19 1996
+++ linux/drivers/sound/soundcard.c	Tue Oct  1 15:29:26 1996
@@ -52,8 +52,8 @@
   return 0;
 }
 
-static int
-sound_read (inode_handle * inode, file_handle * file, char *buf, int count)
+static long
+sound_read (inode_handle * inode, file_handle * file, char *buf, unsigned long count)
 {
   int             dev;
 
@@ -64,8 +64,8 @@
   return sound_read_sw (dev, &files[dev], buf, count);
 }
 
-static int
-sound_write (inode_handle * inode, file_handle * file, const char *buf, int count)
+static long
+sound_write (inode_handle * inode, file_handle * file, const char *buf, unsigned long count)
 {
   int             dev;
 
@@ -76,8 +76,8 @@
   return sound_write_sw (dev, &files[dev], buf, count);
 }
 
-static int
-sound_lseek (inode_handle * inode, file_handle * file, off_t offset, int orig)
+static long long
+sound_llseek (inode_handle * inode, file_handle * file, long long offset, int orig)
 {
   return -(EPERM);
 }
@@ -307,7 +307,7 @@
 
 static struct file_operation_handle sound_fops =
 {
-  sound_lseek,
+  sound_llseek,
   sound_read,
   sound_write,
   NULL,				/* sound_readdir */
diff -ur linux-2.1.0/fs/umsdos/emd.c linux/fs/umsdos/emd.c
--- linux-2.1.0/fs/umsdos/emd.c	Wed Feb  7 18:39:29 1996
+++ linux/fs/umsdos/emd.c	Tue Oct  1 15:54:35 1996
@@ -23,11 +23,11 @@
 /*
 	Read a file into kernel space memory
 */
-int umsdos_file_read_kmem(
+long umsdos_file_read_kmem(
 	struct inode *inode,
 	struct file *filp,
 	char *buf,
-	int count)
+	unsigned long count)
 {
 	int ret;
 	int old_fs = get_fs();	
@@ -39,11 +39,11 @@
 /*
 	Write to a file from kernel space
 */
-int umsdos_file_write_kmem(
+long umsdos_file_write_kmem(
 	struct inode *inode,
 	struct file *filp,
 	const char *buf,
-	int count)
+	unsigned long count)
 {
 	int ret;
 	int old_fs = get_fs();
@@ -60,11 +60,11 @@
 
 	Return 0 if ok, a negative error code if not.
 */
-int umsdos_emd_dir_write (
+long umsdos_emd_dir_write (
 	struct inode *emd_dir,
 	struct file *filp,
 	char *buf,	/* buffer in kernel memory, not in user space */
-	int count)
+	unsigned long count)
 {
 	int written;
 	filp->f_flags = 0;
@@ -76,18 +76,18 @@
 	The block of data is NOT in user space.
 	Return 0 if ok, -EIO if any error.
 */
-int umsdos_emd_dir_read (
+long umsdos_emd_dir_read (
 	struct inode *emd_dir,
 	struct file *filp,
 	char *buf,	/* buffer in kernel memory, not in user space */
-	int count)
+	unsigned long count)
 {
 	int ret = 0;
 	int sizeread;
 	filp->f_flags = 0;
 	sizeread = umsdos_file_read_kmem (emd_dir,filp,buf,count);
 	if (sizeread != count){
-		printk ("UMSDOS: problem with EMD file. Can't read pos = %Ld (%d != %d)\n"
+		printk ("UMSDOS: problem with EMD file. Can't read pos = %Ld (%d != %ld)\n"
 			,filp->f_pos,sizeread,count);
 		ret = -EIO;
 	}