Some fixes...

Thomas Sailer (sailer@ife.ee.ethz.ch)
Sat, 27 Dec 1997 15:26:15 +0100


This is a multi-part message in MIME format.

--------------255A47AB3A5B
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

These are some small fixes to 2.1.x

The first one is a (slight) cleanup of my stuff; Some paths were
forgotten in the great moving around of files, and I've cleaned
up some header files, the idea is less namespace pollution
so user space tools including these headers get compiled even
with glibc. This one is against 2.1.75.

The second one is a fix for config dependencies of the ethertap
driver, against 2.1.76.

The third is a fix for the sound driver. Somebody broke
the SETFRAGMENT ioctl in 2.1.75. The problem is that when
you open the sound driver O_RDWR on a card that is _not_ full
duplex, dmap_in as well as dmap_out are aliases.
But dma_set_fragment was called in that case on both dmap_in and
dmap_out, but every but the first call to dma_set_fragment
on a given dmap is guaranteed to fail. The end result of this
is that just about every software I know of that uses
DMA buffer mapping broke, such as AMP.

Alan, do you believe me now when I wrote the current
sound driver API is way too complex? 8)

I wouldn't claim my fix is overly beautiful, but it works for me.
Maybe something like this would work?

ret = dma_set_fragment(dev, dmap_out, arg, fact);
if (ret < 0)
return ret;
if (dmap_out != dmap_in)
ret = dma_set_fragment(dev, dmap_in, arg, fact);

NB: the sound driver has a vmalloc/vfree in the ioctl
code path - not exactly what you want for speed, especially
as there are quite speed critical ioctls (GETxPTR and TRIGGER).
Anyone any objections against removing those and using
put_user/get_user and friends in the ioctl routines?

Tom

--------------255A47AB3A5B
Content-Type: text/plain; charset=us-ascii; name="linux-2.1.75-cleanup.diff"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline; filename="linux-2.1.75-cleanup.diff"

diff -u -r -N linux-2.1.75-orig/Makefile linux/Makefile
--- linux-2.1.75-orig/Makefile Mon Dec 22 02:58:14 1997
+++ linux/Makefile Wed Dec 24 17:00:53 1997
@@ -347,10 +347,10 @@
mrproper: clean
rm -f include/linux/autoconf.h include/linux/version.h
rm -f drivers/sound/local.h drivers/sound/.defines
- rm -f drivers/net/soundmodem/sm_tbl_{afsk1200,afsk2666,fsk9600}.h
- rm -f drivers/net/soundmodem/sm_tbl_{hapn4800,psk4800}.h
- rm -f drivers/net/soundmodem/sm_tbl_{afsk2400_7,afsk2400_8}.h
- rm -f drivers/net/soundmodem/gentbl
+ rm -f drivers/net/hamradio/soundmodem/sm_tbl_{afsk1200,afsk2666,fsk9600}.h
+ rm -f drivers/net/hamradio/soundmodem/sm_tbl_{hapn4800,psk4800}.h
+ rm -f drivers/net/hamradio/soundmodem/sm_tbl_{afsk2400_7,afsk2400_8}.h
+ rm -f drivers/net/hamradio/soundmodem/gentbl
rm -f drivers/char/hfmodem/gentbl drivers/char/hfmodem/tables.h
rm -f .version .config* config.in config.old
rm -f scripts/tkparse scripts/kconfig.tk scripts/kconfig.tmp
diff -u -r -N linux-2.1.75-orig/drivers/net/hamradio/baycom_par.c linux/drivers/net/hamradio/baycom_par.c
--- linux-2.1.75-orig/drivers/net/hamradio/baycom_par.c Mon Dec 22 02:41:24 1997
+++ linux/drivers/net/hamradio/baycom_par.c Wed Dec 24 16:44:06 1997
@@ -392,18 +392,18 @@
return -ENXIO;
}
if (pp->irq < 0) {
- printk(KERN_ERR "baycom_par: parport at 0x%x has no irq\n", pp->base);
+ printk(KERN_ERR "baycom_par: parport at 0x%lx has no irq\n", pp->base);
return -ENXIO;
}
memset(&bc->modem, 0, sizeof(bc->modem));
bc->hdrv.par.bitrate = 9600;
if (!(bc->pdev = parport_register_device(pp, dev->name, par96_preempt, par96_wakeup,
par96_interrupt, PARPORT_DEV_LURK, dev))) {
- printk(KERN_ERR "baycom_par: cannot register parport at 0x%x\n", pp->base);
+ printk(KERN_ERR "baycom_par: cannot register parport at 0x%lx\n", pp->base);
return -ENXIO;
}
if (parport_claim(bc->pdev)) {
- printk(KERN_ERR "baycom_par: parport at 0x%x busy\n", pp->base);
+ printk(KERN_ERR "baycom_par: parport at 0x%lx busy\n", pp->base);
parport_unregister_device(bc->pdev);
return -EBUSY;
}
diff -u -r -N linux-2.1.75-orig/include/linux/baycom.h linux/include/linux/baycom.h
--- linux-2.1.75-orig/include/linux/baycom.h Sun Nov 30 19:30:19 1997
+++ linux/include/linux/baycom.h Wed Dec 24 16:35:17 1997
@@ -1,14 +1,11 @@
/*
* The Linux BAYCOM driver for the Baycom serial 1200 baud modem
* and the parallel 9600 baud modem
- * (C) 1997 by Thomas Sailer, HB9JNX/AE4WA
+ * (C) 1997-1998 by Thomas Sailer, HB9JNX/AE4WA
*/

#ifndef _BAYCOM_H
#define _BAYCOM_H
-
-#include <linux/sockios.h>
-#include <linux/if_ether.h>

/* -------------------------------------------------------------------- */
/*
diff -u -r -N linux-2.1.75-orig/include/linux/hdlcdrv.h linux/include/linux/hdlcdrv.h
--- linux-2.1.75-orig/include/linux/hdlcdrv.h Tue Aug 5 18:49:51 1997
+++ linux/include/linux/hdlcdrv.h Wed Dec 24 16:39:21 1997
@@ -1,20 +1,12 @@
/*
* hdlcdrv.h -- HDLC packet radio network driver.
* The Linux soundcard driver for 1200 baud and 9600 baud packet radio
- * (C) 1996 by Thomas Sailer, HB9JNX/AE4WA
+ * (C) 1996-1998 by Thomas Sailer, HB9JNX/AE4WA
*/

#ifndef _HDLCDRV_H
#define _HDLCDRV_H

-#include <linux/version.h>
-#include <linux/sockios.h>
-#include <linux/version.h>
-#if LINUX_VERSION_CODE < 0x20119
-#include <linux/if_ether.h>
-#endif
-#include <linux/netdevice.h>
-
/* -------------------------------------------------------------------- */
/*
* structs for the IOCTL commands
@@ -43,9 +35,6 @@
int ptt;
int dcd;
int ptt_keyed;
-#if LINUX_VERSION_CODE < 0x20100
- struct enet_statistics stats;
-#endif
};

struct hdlcdrv_channel_state {
@@ -114,6 +103,9 @@
/* -------------------------------------------------------------------- */

#ifdef __KERNEL__
+
+#include <linux/netdevice.h>
+#include <linux/if.h>

#define HDLCDRV_MAGIC 0x5ac6e778
#define HDLCDRV_IFNAMELEN 6
diff -u -r -N linux-2.1.75-orig/include/linux/soundmodem.h linux/include/linux/soundmodem.h
--- linux-2.1.75-orig/include/linux/soundmodem.h Thu Dec 19 08:51:48 1996
+++ linux/include/linux/soundmodem.h Wed Dec 24 16:35:19 1997
@@ -1,13 +1,10 @@
/*
* The Linux soundcard driver for 1200 baud and 9600 baud packet radio
- * (C) 1996 by Thomas Sailer, HB9JNX/AE4WA
+ * (C) 1996-1998 by Thomas Sailer, HB9JNX/AE4WA
*/

#ifndef _SOUNDMODEM_H
#define _SOUNDMODEM_H
-
-#include <linux/sockios.h>
-#include <linux/if_ether.h>

/* -------------------------------------------------------------------- */
/*

--------------255A47AB3A5B
Content-Type: text/plain; charset=us-ascii; name="linux-2.1.76-netlink.diff"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline; filename="linux-2.1.76-netlink.diff"

--- linux/drivers/net/Config.in.orig Fri Dec 26 22:33:45 1997
+++ linux/drivers/net/Config.in Fri Dec 26 22:34:14 1997
@@ -15,7 +15,7 @@
tristate 'Dummy net driver support' CONFIG_DUMMY
tristate 'EQL (serial line load balancing) support' CONFIG_EQUALIZER
if [ "$CONFIG_EXPERIMENTAL" = "y" ]; then
- if [ "CONFIG_NETLINK_DEV" != "n" ]; then
+ if [ "$CONFIG_NETLINK_DEV" != "n" ]; then
dep_tristate 'Ethertap network tap' CONFIG_ETHERTAP $CONFIG_NETLINK_DEV
fi
fi

--------------255A47AB3A5B
Content-Type: text/plain; charset=us-ascii; name="linux-2.1.76-audio.diff"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline; filename="linux-2.1.76-audio.diff"

--- linux/drivers/sound/audio.c.orig Fri Dec 26 23:49:18 1997
+++ linux/drivers/sound/audio.c Fri Dec 26 23:47:43 1997
@@ -1019,11 +1019,11 @@
if (audio_devs[dev]->open_mode & OPEN_WRITE)
reorganize_buffers(dev, dmap_out,
(audio_devs[dev]->open_mode == OPEN_READ));
- if (audio_devs[dev]->open_mode != OPEN_WRITE ||
- (audio_devs[dev]->flags & DMA_DUPLEX &&
- audio_devs[dev]->open_mode & OPEN_READ))
- reorganize_buffers(dev, dmap_in,
- (audio_devs[dev]->open_mode == OPEN_READ));
+ if (audio_devs[dev]->open_mode == OPEN_READ ||
+ (audio_devs[dev]->flags & DMA_DUPLEX &&
+ audio_devs[dev]->open_mode & OPEN_READ))
+ reorganize_buffers(dev, dmap_in,
+ (audio_devs[dev]->open_mode == OPEN_READ));
if (audio_devs[dev]->open_mode == OPEN_READ)
dmap = dmap_in;
fragment_size = dmap->fragment_size;
@@ -1041,9 +1041,9 @@
if (ret < 0)
return ret;

- if (audio_devs[dev]->open_mode != OPEN_WRITE ||
- (audio_devs[dev]->flags & DMA_DUPLEX &&
- audio_devs[dev]->open_mode & OPEN_READ))
+ if (audio_devs[dev]->open_mode == OPEN_READ ||
+ (audio_devs[dev]->flags & DMA_DUPLEX &&
+ audio_devs[dev]->open_mode & OPEN_READ))
ret = dma_set_fragment(dev, dmap_in, arg, fact);

return ret;

--------------255A47AB3A5B--