From 9a1e744eae53fa87f26549de2c398a63e0e9d400 Mon Sep 17 00:00:00 2001 From: Linus Torvalds Date: Fri, 23 Nov 2007 15:12:42 -0500 Subject: [PATCH] Import 2.1.13 --- Makefile | 2 +- arch/alpha/defconfig | 13 +- arch/alpha/kernel/bios32.c | 148 +++++++-------- arch/alpha/lib/checksum.c | 4 +- drivers/net/ibmtr.c | 10 +- drivers/scsi/sr.c | 5 +- drivers/sound/.blurb | 4 +- drivers/sound/.objects | 5 +- drivers/sound/.version | 4 +- drivers/sound/CHANGELOG | 8 +- drivers/sound/Makefile | 4 +- drivers/sound/Makefile.old | 164 +++++++++++++++++ drivers/sound/Readme | 2 +- drivers/sound/Readme.cards | 4 +- drivers/sound/ad1848.c | 63 +++++-- drivers/sound/ad1848_mixer.h | 10 + drivers/sound/dev_table.h | 1 - drivers/sound/dmabuf.c | 13 +- drivers/sound/gus_midi.c | 10 +- drivers/sound/gus_wave.c | 233 +----------------------- drivers/sound/ics2101.c | 52 +++--- drivers/sound/lowlevel/awe_wave.c | 11 -- drivers/sound/midi_synth.c | 6 - drivers/sound/midi_synth.h | 2 - drivers/sound/mpu401.c | 32 ++-- drivers/sound/opl3.c | 8 - drivers/sound/os.h | 20 +- drivers/sound/pas2_midi.c | 10 +- drivers/sound/pas2_mixer.c | 14 +- drivers/sound/pas2_pcm.c | 19 +- drivers/sound/patmgr.c | 292 ------------------------------ drivers/sound/sb_common.c | 11 +- drivers/sound/sb_mixer.c | 13 ++ drivers/sound/sequencer.c | 170 ++--------------- drivers/sound/sound_calls.h | 9 - drivers/sound/sound_timer.c | 70 ++++--- drivers/sound/soundvers.h | 4 +- drivers/sound/sscape.c | 31 +++- drivers/sound/sys_timer.c | 11 +- drivers/sound/uart6850.c | 1 + drivers/sound/vivo.c | 19 ++ include/asm-alpha/checksum.h | 2 +- include/asm-alpha/socket.h | 4 + include/linux/ctype.h | 58 ++++-- include/linux/kdev_t.h | 8 +- include/linux/net.h | 6 +- include/linux/skbuff.h | 33 ++-- include/linux/socket.h | 2 +- include/linux/soundcard.h | 104 +---------- include/linux/stddef.h | 5 - include/linux/swap.h | 10 +- include/linux/swapctl.h | 52 +++--- include/linux/wait.h | 6 +- include/net/inet_common.h | 2 +- include/net/sock.h | 4 +- include/net/tcp.h | 2 +- include/net/transp_v6.h | 2 +- include/net/udp.h | 2 +- init/main.c | 3 +- kernel/fork.c | 1 - lib/ctype.c | 3 +- mm/filemap.c | 2 +- mm/swapfile.c | 5 +- net/appletalk/ddp.c | 6 +- net/ax25/af_ax25.c | 6 +- net/core/skbuff.c | 10 +- net/ipv4/af_inet.c | 6 +- net/ipv4/packet.c | 2 +- net/ipv4/tcp_ipv4.c | 2 +- net/ipv4/tcp_output.c | 2 +- net/ipv4/udp.c | 2 +- net/ipv6/af_inet6.c | 4 +- net/ipv6/tcp_ipv6.c | 2 +- net/ipv6/udp.c | 2 +- net/ipx/af_ipx.c | 6 +- net/netrom/af_netrom.c | 6 +- net/rose/af_rose.c | 6 +- net/rose/rose_out | 254 -------------------------- net/socket.c | 10 +- net/unix/af_unix.c | 6 +- 80 files changed, 744 insertions(+), 1416 deletions(-) create mode 100644 drivers/sound/Makefile.old delete mode 100644 drivers/sound/patmgr.c create mode 100644 drivers/sound/vivo.c delete mode 100644 net/rose/rose_out diff --git a/Makefile b/Makefile index dd25f9b2ddb0..cc6f1b3d148c 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,6 @@ VERSION = 2 PATCHLEVEL = 1 -SUBLEVEL = 12 +SUBLEVEL = 13 ARCH = i386 diff --git a/arch/alpha/defconfig b/arch/alpha/defconfig index 0e4a4313420e..6108b393b8dd 100644 --- a/arch/alpha/defconfig +++ b/arch/alpha/defconfig @@ -67,6 +67,7 @@ CONFIG_BLK_DEV_RAM=y # # Networking options # +# CONFIG_NETLINK is not set # CONFIG_FIREWALL is not set # CONFIG_NET_ALIAS is not set CONFIG_INET=y @@ -89,7 +90,6 @@ CONFIG_SKB_LARGE=y # CONFIG_IPX is not set # CONFIG_ATALK is not set # CONFIG_AX25 is not set -# CONFIG_NETLINK is not set # # SCSI support @@ -145,12 +145,9 @@ CONFIG_SCSI_QLOGIC_ISP=y # Network device support # CONFIG_NETDEVICES=y +# CONFIG_ARCNET is not set CONFIG_DUMMY=m # CONFIG_EQUALIZER is not set -# CONFIG_PLIP is not set -# CONFIG_PPP is not set -# CONFIG_SLIP is not set -# CONFIG_NET_RADIO is not set CONFIG_NET_ETHERNET=y # CONFIG_NET_VENDOR_3COM is not set # CONFIG_LANCE is not set @@ -162,8 +159,12 @@ CONFIG_DE4X5=y # CONFIG_DEC_ELCP is not set # CONFIG_DGRS is not set # CONFIG_NET_POCKET is not set +# CONFIG_FDDI is not set +# CONFIG_PLIP is not set +# CONFIG_PPP is not set +# CONFIG_NET_RADIO is not set +# CONFIG_SLIP is not set # CONFIG_TR is not set -# CONFIG_ARCNET is not set # # ISDN subsystem diff --git a/arch/alpha/kernel/bios32.c b/arch/alpha/kernel/bios32.c index 37f03b3549c8..67c3c4f7a687 100644 --- a/arch/alpha/kernel/bios32.c +++ b/arch/alpha/kernel/bios32.c @@ -35,15 +35,15 @@ int pcibios_present(void) { - return 0; + return 0; } asmlinkage int sys_pciconfig_read() { - return 0; + return 0; } asmlinkage int sys_pciconfig_write() { - return 0; + return 0; } #else /* CONFIG_PCI */ @@ -56,7 +56,7 @@ asmlinkage int sys_pciconfig_write() #include #include -#include +#include #define KB 1024 @@ -133,10 +133,10 @@ static void disable_dev(struct pci_dev *dev) * HACK: the PCI-to-EISA bridge does not seem to identify * itself as a bridge... :-( */ - if (dev->vendor == 0x8086 && dev->device == 0x0482) { - DBG_DEVS(("disable_dev: ignoring PCEB...\n")); - return; - } + if (dev->vendor == 0x8086 && dev->device == 0x0482) { + DBG_DEVS(("disable_dev: ignoring PCEB...\n")); + return; + } #endif bus = dev->bus; @@ -165,10 +165,10 @@ static void layout_dev(struct pci_dev *dev) * HACK: the PCI-to-EISA bridge does not seem to identify * itself as a bridge... :-( */ - if (dev->vendor == 0x8086 && dev->device == 0x0482) { - DBG_DEVS(("layout_dev: ignoring PCEB...\n")); - return; - } + if (dev->vendor == 0x8086 && dev->device == 0x0482) { + DBG_DEVS(("layout_dev: ignoring PCEB...\n")); + return; + } #endif bus = dev->bus; @@ -287,7 +287,7 @@ static void layout_dev(struct pci_dev *dev) pcibios_write_config_dword(bus->number, dev->devfn, reg, base); } - } + } /* enable device: */ if (dev->class >> 8 == PCI_CLASS_NOT_DEFINED || dev->class >> 8 == PCI_CLASS_NOT_DEFINED_VGA || @@ -339,7 +339,7 @@ static void layout_bus(struct pci_bus *bus) */ for (dev = bus->devices; dev; dev = dev->sibling) { if (dev->class >> 16 != PCI_BASE_CLASS_BRIDGE) { - disable_dev(dev) ; + disable_dev(dev) ; } } @@ -360,7 +360,7 @@ static void layout_bus(struct pci_bus *bus) for (child = bus->children; child; child = child->next) { layout_bus(child); - } + } /* * Align the current bases on 4K and 1MB boundaries: */ @@ -417,7 +417,7 @@ int pcibios_find_device (unsigned short vendor, unsigned short device_id, unsigned short index, unsigned char *bus, unsigned char *devfn) { - unsigned int curr = 0; + unsigned int curr = 0; struct pci_dev *dev; for (dev = pci_devices; dev; dev = dev->next) { @@ -441,7 +441,7 @@ int pcibios_find_device (unsigned short vendor, unsigned short device_id, int pcibios_find_class (unsigned int class_code, unsigned short index, unsigned char *bus, unsigned char *devfn) { - unsigned int curr = 0; + unsigned int curr = 0; struct pci_dev *dev; for (dev = pci_devices; dev; dev = dev->next) { @@ -460,7 +460,7 @@ int pcibios_find_class (unsigned int class_code, unsigned short index, int pcibios_present(void) { - return 1; + return 1; } @@ -537,8 +537,8 @@ static inline void enable_ide(long ide_base) */ static inline unsigned char bridge_swizzle(unsigned char pin, unsigned int slot) { - /* swizzle */ - return (((pin-1) + slot) % 4) + 1 ; + /* swizzle */ + return (((pin-1) + slot) % 4) + 1 ; } /* @@ -559,14 +559,14 @@ static inline void common_fixup(long min_idsel, long max_idsel, long irqs_per_sl * Go through all devices, fixing up irqs as we see fit: */ for (dev = pci_devices; dev; dev = dev->next) { - if (dev->class >> 16 != PCI_BASE_CLASS_BRIDGE + if (dev->class >> 16 != PCI_BASE_CLASS_BRIDGE #if defined(CONFIG_ALPHA_MIKASA) || defined(CONFIG_ALPHA_ALCOR) /* PCEB (PCI to EISA bridge) does not identify itself as a bridge... :-( */ && !((dev->vendor==0x8086) && (dev->device==0x482)) #endif ) { - dev->irq = 0; + dev->irq = 0; /* * This device is not on the primary bus, we need to figure out which * interrupt pin it will come in on. We know which slot it will come @@ -575,7 +575,7 @@ static inline void common_fixup(long min_idsel, long max_idsel, long irqs_per_sl * (see the inline static routine above). */ if (dev->bus->number != 0) { - struct pci_dev *curr = dev ; + struct pci_dev *curr = dev ; /* read the pin and do the PCI-PCI bridge interrupt pin swizzle */ pcibios_read_config_byte(dev->bus->number, dev->devfn, PCI_INTERRUPT_PIN, &pin); @@ -583,16 +583,16 @@ static inline void common_fixup(long min_idsel, long max_idsel, long irqs_per_sl if (pin == 0) pin = 1 ; /* follow the chain of bridges, swizzling as we go */ do { - /* swizzle */ - pin = bridge_swizzle(pin, PCI_SLOT(curr->devfn)) ; + /* swizzle */ + pin = bridge_swizzle(pin, PCI_SLOT(curr->devfn)) ; /* move up the chain of bridges */ curr = curr->bus->self ; } while (curr->bus->self) ; /* The slot is the slot of the last bridge. */ slot = PCI_SLOT(curr->devfn) ; } else { - /* work out the slot */ - slot = PCI_SLOT(dev->devfn) ; + /* work out the slot */ + slot = PCI_SLOT(dev->devfn) ; /* read the pin */ pcibios_read_config_byte(dev->bus->number, dev->devfn, @@ -600,7 +600,7 @@ static inline void common_fixup(long min_idsel, long max_idsel, long irqs_per_sl &pin); } if (irq_tab[slot - min_idsel][pin] != -1) - dev->irq = irq_tab[slot - min_idsel][pin]; + dev->irq = irq_tab[slot - min_idsel][pin]; #if PCI_MODIFY /* tell the device: */ pcibios_write_config_byte(dev->bus->number, dev->devfn, @@ -1041,7 +1041,7 @@ static inline void sio_fixup(void) */ level_bits = 0; for (dev = pci_devices; dev; dev = dev->next) { - if (dev->class >> 16 == PCI_BASE_CLASS_BRIDGE) + if (dev->class >> 16 == PCI_BASE_CLASS_BRIDGE) continue; dev->irq = 0; if (dev->bus->number != 0) { @@ -1169,7 +1169,7 @@ unsigned long pcibios_fixup(unsigned long mem_start, unsigned long mem_end) #endif #ifdef CONFIG_TGA_CONSOLE - tga_console_init(); + tga_console_init(); #endif /* CONFIG_TGA_CONSOLE */ return mem_start; @@ -1178,28 +1178,28 @@ unsigned long pcibios_fixup(unsigned long mem_start, unsigned long mem_end) const char *pcibios_strerror (int error) { - static char buf[80]; + static char buf[80]; - switch (error) { - case PCIBIOS_SUCCESSFUL: - return "SUCCESSFUL"; + switch (error) { + case PCIBIOS_SUCCESSFUL: + return "SUCCESSFUL"; - case PCIBIOS_FUNC_NOT_SUPPORTED: - return "FUNC_NOT_SUPPORTED"; + case PCIBIOS_FUNC_NOT_SUPPORTED: + return "FUNC_NOT_SUPPORTED"; - case PCIBIOS_BAD_VENDOR_ID: - return "SUCCESSFUL"; + case PCIBIOS_BAD_VENDOR_ID: + return "SUCCESSFUL"; - case PCIBIOS_DEVICE_NOT_FOUND: - return "DEVICE_NOT_FOUND"; + case PCIBIOS_DEVICE_NOT_FOUND: + return "DEVICE_NOT_FOUND"; - case PCIBIOS_BAD_REGISTER_NUMBER: - return "BAD_REGISTER_NUMBER"; + case PCIBIOS_BAD_REGISTER_NUMBER: + return "BAD_REGISTER_NUMBER"; - default: - sprintf (buf, "UNKNOWN RETURN 0x%x", error); - return buf; - } + default: + sprintf (buf, "UNKNOWN RETURN 0x%x", error); + return buf; + } } asmlinkage int sys_pciconfig_read( @@ -1209,35 +1209,35 @@ asmlinkage int sys_pciconfig_read( unsigned long len, unsigned char *buf) { - unsigned char ubyte; - unsigned short ushort; - unsigned int uint; + unsigned char ubyte; + unsigned short ushort; + unsigned int uint; long err = 0; switch (len) { case 1: - err = pcibios_read_config_byte(bus, dfn, off, &ubyte); + err = pcibios_read_config_byte(bus, dfn, off, &ubyte); if (err != PCIBIOS_SUCCESSFUL) ubyte = 0xff; put_user(ubyte, buf); break; case 2: - err = pcibios_read_config_word(bus, dfn, off, &ushort); + err = pcibios_read_config_word(bus, dfn, off, &ushort); if (err != PCIBIOS_SUCCESSFUL) ushort = 0xffff; put_user(ushort, (unsigned short *)buf); break; case 4: - err = pcibios_read_config_dword(bus, dfn, off, &uint); + err = pcibios_read_config_dword(bus, dfn, off, &uint); if (err != PCIBIOS_SUCCESSFUL) uint = 0xffffffff; put_user(uint, (unsigned int *)buf); break; default: - err = -EINVAL; - break; + err = -EINVAL; + break; } - return err; + return err; } asmlinkage int sys_pciconfig_write( unsigned long bus, @@ -1246,37 +1246,43 @@ asmlinkage int sys_pciconfig_write( unsigned long len, unsigned char *buf) { - unsigned char ubyte; - unsigned short ushort; - unsigned int uint; - long err = 0; + unsigned char ubyte; + unsigned short ushort; + unsigned int uint; + long err = 0; switch (len) { case 1: - ubyte = get_user(buf); - err = pcibios_write_config_byte(bus, dfn, off, ubyte); - if (err != PCIBIOS_SUCCESSFUL) { + err = get_user(ubyte, buf); + if (err) + break; + err = pcibios_write_config_byte(bus, dfn, off, ubyte); + if (err != PCIBIOS_SUCCESSFUL) { err = -EFAULT; } break; case 2: - ushort = get_user((unsigned short *)buf); - err = pcibios_write_config_word(bus, dfn, off, ushort); - if (err != PCIBIOS_SUCCESSFUL) { + err = get_user(ushort, (unsigned short *)buf); + if (err) + break; + err = pcibios_write_config_word(bus, dfn, off, ushort); + if (err != PCIBIOS_SUCCESSFUL) { err = -EFAULT; } break; case 4: - uint = get_user((unsigned int *)buf); - err = pcibios_write_config_dword(bus, dfn, off, uint); - if (err != PCIBIOS_SUCCESSFUL) { + err = get_user(uint, (unsigned int *)buf); + if (err) + break; + err = pcibios_write_config_dword(bus, dfn, off, uint); + if (err != PCIBIOS_SUCCESSFUL) { err = -EFAULT; } break; default: - err = -EINVAL; - break; + err = -EINVAL; + break; } - return err; + return err; } #endif /* CONFIG_PCI */ diff --git a/arch/alpha/lib/checksum.c b/arch/alpha/lib/checksum.c index 78667c7e3e1d..f95b535ca4fc 100644 --- a/arch/alpha/lib/checksum.c +++ b/arch/alpha/lib/checksum.c @@ -44,7 +44,7 @@ unsigned short int csum_tcpudp_magic(unsigned long saddr, * inner loop could be unrolled a bit further, and there are better * ways to do the carry, but this is reasonable. */ -static inline unsigned long do_csum(unsigned char * buff, int len) +static inline unsigned long do_csum(const unsigned char * buff, int len) { int odd, count; unsigned long result = 0; @@ -127,7 +127,7 @@ unsigned short ip_fast_csum(unsigned char * iph, unsigned int ihl) * * it's best to have buff aligned on a 32-bit boundary */ -unsigned int csum_partial(unsigned char * buff, int len, unsigned int sum) +unsigned int csum_partial(const unsigned char * buff, int len, unsigned int sum) { unsigned long result = do_csum(buff, len); diff --git a/drivers/net/ibmtr.c b/drivers/net/ibmtr.c index 1b51ecf3b7e4..1238a9da9022 100644 --- a/drivers/net/ibmtr.c +++ b/drivers/net/ibmtr.c @@ -110,9 +110,6 @@ static char mcchannelid[]={0x04, 0x0d, 0x04, 0x01, #include #include #include -#include -#include -#include #include #include #include @@ -121,7 +118,12 @@ static char mcchannelid[]={0x04, 0x0d, 0x04, 0x01, #include #include #include -#include +#include + +#include +#include +#include + #include "ibmtr.h" diff --git a/drivers/scsi/sr.c b/drivers/scsi/sr.c index 1f4d53cff09a..72b207501c20 100644 --- a/drivers/scsi/sr.c +++ b/drivers/scsi/sr.c @@ -35,6 +35,7 @@ #include #include #include +#include #define MAJOR_NR SCSI_CDROM_MAJOR #include @@ -617,7 +618,7 @@ void requeue_sr_request (Scsi_Cmnd * SCpnt) if (count+1 != SCpnt->use_sg) panic("Bad sr request list"); break; }; - if (((long) sgpnt[count].address) + sgpnt[count].length - 1 > + if (virt_to_phys(sgpnt[count].address) + sgpnt[count].length - 1 > ISA_DMA_THRESHOLD && SCpnt->host->unchecked_isa_dma) { sgpnt[count].alt_address = sgpnt[count].address; /* We try to avoid exhausting the DMA pool, since it is easier @@ -681,7 +682,7 @@ void requeue_sr_request (Scsi_Cmnd * SCpnt) { this_count -= this_count % 4; buffer = (unsigned char *) SCpnt->request.buffer; - if (((long) buffer) + (this_count << 9) > ISA_DMA_THRESHOLD && + if (virt_to_phys(buffer) + (this_count << 9) > ISA_DMA_THRESHOLD && SCpnt->host->unchecked_isa_dma) buffer = (unsigned char *) scsi_malloc(this_count << 9); } diff --git a/drivers/sound/.blurb b/drivers/sound/.blurb index cdb6f9e90528..5203d3fbe24d 100644 --- a/drivers/sound/.blurb +++ b/drivers/sound/.blurb @@ -1,10 +1,10 @@ ********************************************************* * Readme.cards (this directory) contains some card * * specific instructions. * -* See http://www.4front-tech.com/usslite for most up * +* See http://www.4front-tech.com/ossfree for most up * * to date info. * * (European mirror http://personal.eunet.fi/pp/voxware) * * * -* DON'T USE PROGRAMS FROM SND_UTIL PACKAGE EARLIER THAN * +* DON'T USE PROGRAMS FROM snd-util PACKAGE EARLIER THAN * * snd-util-3.5 WITH THIS SOUND DRIVER VERSION. * ********************************************************* diff --git a/drivers/sound/.objects b/drivers/sound/.objects index df5184e6de01..20f44261f304 100644 --- a/drivers/sound/.objects +++ b/drivers/sound/.objects @@ -56,10 +56,6 @@ ifdef CONFIG_PAS OBJS := $(OBJS) pas2_card.o pas2_midi.o pas2_mixer.o pas2_pcm.o endif -ifdef CONFIG_SEQUENCER - OBJS := $(OBJS) patmgr.o -endif - ifdef CONFIG_PSS OBJS := $(OBJS) pss.o endif @@ -72,6 +68,7 @@ ifdef CONFIG_SEQUENCER OBJS := $(OBJS) sequencer.o endif + ifdef CONFIG_SEQUENCER OBJS := $(OBJS) sound_timer.o endif diff --git a/drivers/sound/.version b/drivers/sound/.version index 08b3451796cc..d2bf6cccaeb2 100644 --- a/drivers/sound/.version +++ b/drivers/sound/.version @@ -1,2 +1,2 @@ -3.7-beta6 -0x030701 +3.7-beta12 +0x030707 diff --git a/drivers/sound/CHANGELOG b/drivers/sound/CHANGELOG index e383ff1d986d..c1437820f4e5 100644 --- a/drivers/sound/CHANGELOG +++ b/drivers/sound/CHANGELOG @@ -1,5 +1,9 @@ -Changelog for version 3.7-beta5 -------------------------------- +Changelog for version 3.7-beta10 +-------------------------------- + +Since 3.5-beta5 +- Disabled MIDI input with GUS PnP (Interwave). There seems to be constant +stream of received 0x00 bytes when the MIDI receiver is enabled. Since 3.5 - Changes almost everywhere. diff --git a/drivers/sound/Makefile b/drivers/sound/Makefile index fb0ab87e3397..499521c9f73b 100644 --- a/drivers/sound/Makefile +++ b/drivers/sound/Makefile @@ -148,10 +148,10 @@ modules: local.h sound.o lowlevel/lowlevel.o: dummy - cd lowlevel;make + cd lowlevel;make CC="$(CC)" CFLAGS="$(CFLAGS)" contrib: - cd lowlevel;make clean;make module CFLAGS="$(CFLAGS)" + cd lowlevel;make clean;make module "CC=$(CC)" CFLAGS="$(CFLAGS)" ifdef USE_DEPEND # diff --git a/drivers/sound/Makefile.old b/drivers/sound/Makefile.old new file mode 100644 index 000000000000..6f070e65b985 --- /dev/null +++ b/drivers/sound/Makefile.old @@ -0,0 +1,164 @@ +# Makefile for the Linux sound card driver +# +# Note 2! The CFLAGS definitions are now inherited from the +# parent makes. (hopefully) +# +# + +.PHONY: dummy +SUB_DIRS = lowlevel +VERSION = `head -1 .version` +TARGET_OS = linux +USRINCDIR = /usr/include +MODULEDIR = /lib/modules/misc + +FIXEDOBJS = soundcard.o dev_table.o sound_switch.o + +ifndef NO_LOWLEVEL + FIXEDOBJS := $(FIXEDOBJS) lowlevel/lowlevel.o +endif + +ifeq (.defines,$(wildcard .defines)) +include .defines +include .objects +endif + +ifndef TOPDIR +TOPDIR=/usr/src/linux +endif + + +ifndef HOSTCC +build: + @echo Compiling modularized sound driver + @make sound.o + @echo Sound module compiled. + +install: sound.o + cp sound.o $(MODULEDIR) +endif + +.c.o: + $(CC) $(CFLAGS) -c $< + +ifeq ($(CONFIG_SOUND),y) + +all: local.h sound.a + +OBJS += $(FIXEDOBJS) + +else +all: +endif + +ifndef HOSTCC +# +# Running outside the kernel build. +# +CC = gcc +HOSTCC = gcc +CFLAGS = -O2 -D__KERNEL__ -DMODULE -I/usr/src/linux/include -Wall -Wstrict-prototypes -fomit-frame-pointer -pipe -m486 +USE_DEPEND=y +else +include $(TOPDIR)/Rules.make +endif + +sound.a: $(OBJS) + -rm -f sound.a + $(AR) rcs sound.a $(OBJS) + sync + +clean: + rm -f core core.* *.o *.a tmp_make *~ x y z *% + rm -f configure + cd lowlevel;make clean + cd vivo;make clean + +indent: + for n in *.c;do echo indent $$n;indent $$n;done + +local.h: + $(MAKE) clean + $(MAKE) setup + $(MAKE) oldconfig + $(MAKE) dep + @echo + @echo + @echo + @echo NOTE! Object file dependencies may not be up to date. Run + @echo make again if kernel/driver doesn''t link properly. Restarting + @echo it now may save some time. + @echo + @echo + +config: configure + @$(MAKE) setup + @./configure > local.h + @echo \#define SOUND_CONFIG_DATE \"`date`\" >> local.h + @echo \#define SOUND_CONFIG_BY \"`whoami`\" >> local.h +# @echo \#define SOUND_CONFIG_HOST \"`hostname`\" >> local.h 2>/dev/null +# @echo \#define SOUND_CONFIG_DOMAIN \"`hostname -d`\" >> local.h 2>/dev/null + @echo \#define SOUND_UNAME_A \"`uname -a`\" >> local.h + +oldconfig: setup configure + @./configure -o > local.h + @echo \#define SOUND_CONFIG_DATE \"`date`\" >> local.h + @echo \#define SOUND_CONFIG_BY \"`whoami`\" >> local.h +# @echo \#define SOUND_CONFIG_HOST \"`hostname`\" >> local.h 2>/dev/null +# @echo \#define SOUND_CONFIG_DOMAIN \"`hostname -d`\" >> local.h 2>/dev/null + @echo \#define SOUND_UNAME_A \"`uname -a`\" >> local.h + +kernelconfig: setup + rm -f configure + $(HOSTCC) -o configure configure.c + ./configure fixedlocal > local.h + ./configure fixeddefines > .defines + @echo \#define SOUND_CONFIG_DATE \"`date`\" >> local.h + @echo \#define SOUND_CONFIG_BY \"`whoami`\" >> local.h +# @echo \#define SOUND_CONFIG_HOST \"`hostname`\" >> local.h 2>/dev/null +# @echo \#define SOUND_CONFIG_DOMAIN \"`hostname -d`\" >> local.h 2>/dev/null + @echo \#define SOUND_UNAME_A \"`uname -a`\" >> local.h + +mkscript: setup + rm -f configure + $(HOSTCC) -o configure configure.c + ./configure script > Config.in + cat lowlevel/Config.tmpl >> Config.in + ./configure fixedlocal > local.h + ./configure fixeddefines > .defines + +clrconf: + rm -f local.h .depend synth-ld.h trix_boot.h smw-midi0001.h maui_boot.h .defines + +configure: configure.c + $(HOSTCC) -o configure configure.c + @cat .blurb + +dep: + $(CPP) -M $(CFLAGS) -I. *.c > .depend + +setup: + @echo Compiling Sound Driver v $(VERSION) for Linux + +sound.o: local.h $(FIXEDOBJS) sound.a + -rm -f sound.o + $(LD) -r -o sound.o $(FIXEDOBJS) sound.a + +modules: local.h sound.o + ln -fs `pwd`/sound.o $(TOPDIR)/modules/sound.o + + +lowlevel/lowlevel.o: dummy + cd lowlevel;make CC="$(CC)" CFLAGS="$(CFLAGS)" + +contrib: + cd lowlevel;make clean;make module "CC=$(CC)" CFLAGS="$(CFLAGS)" + +ifdef USE_DEPEND +# +# include a dependency file if one exists +# +ifeq (.depend,$(wildcard .depend)) +include .depend +endif +endif diff --git a/drivers/sound/Readme b/drivers/sound/Readme index 16f7746cb5ea..0658b0128ab5 100644 --- a/drivers/sound/Readme +++ b/drivers/sound/Readme @@ -19,7 +19,7 @@ check http://www.4front-tech.com/pguide for more info. - THIS VERSION ____REQUIRES____ Linux 2.1.5 OR LATER. ==================================================== -Packages "snd-util-3.5.tar.gz" and "snd-data-0.1.tar.Z" +Packages "snd-util-3.7.tar.gz" and "snd-data-0.1.tar.Z" contain useful utilities to be used with this driver. See http://www.4front-tech.com/ossfree/getting.html for download instructions. diff --git a/drivers/sound/Readme.cards b/drivers/sound/Readme.cards index 25fd775de596..25afef2ac0d9 100644 --- a/drivers/sound/Readme.cards +++ b/drivers/sound/Readme.cards @@ -85,7 +85,9 @@ support for PnP cards. There are bugs in setting DMA channels in earlier versions of isapnptools so at least version 1.6 is required with soundcards. Yet another way to use PnP cards is to use (commercial) OSS/Linux drivers. -See http://www.4front-tech.com/linux.html for more info. +See http://www.4front-tech.com/linux.html for more info. This is the way +you propably like to do it if you don't waste hours of time in recompiling +kernel and the required tools. Read this before trying to configure the driver ----------------------------------------------- diff --git a/drivers/sound/ad1848.c b/drivers/sound/ad1848.c index 5556718f432c..d40e4eb85543 100644 --- a/drivers/sound/ad1848.c +++ b/drivers/sound/ad1848.c @@ -74,6 +74,7 @@ typedef struct int timer_running; int irq_ok; mixer_ents *mix_devices; + int mixer_output_port; } ad1848_info; @@ -509,6 +510,11 @@ ad1848_mixer_reset (ad1848_info * devc) if (devc->supported_devices & (1 << i)) ad1848_mixer_set (devc, i, devc->levels[i]); ad1848_set_recmask (devc, SOUND_MASK_MIC); + devc->mixer_output_port = devc->levels[31] | AUDIO_HEADPHONE | AUDIO_LINE_OUT; + if (devc->mixer_output_port & AUDIO_SPEAKER) + ad_write (devc, 26, ad_read (devc, 26) & ~0x40); /* Unmute mono out */ + else + ad_write (devc, 26, ad_read (devc, 26) | 0x40); /* Mute mono out */ } static int @@ -516,6 +522,29 @@ ad1848_mixer_ioctl (int dev, unsigned int cmd, caddr_t arg) { ad1848_info *devc = mixer_devs[dev]->devc; + if (cmd == SOUND_MIXER_PRIVATE1) + { + int val; + + get_user (val, (int *) arg); + + if (val == 0xffff) + return ioctl_out (arg, devc->mixer_output_port); + + val &= (AUDIO_SPEAKER | AUDIO_HEADPHONE | AUDIO_LINE_OUT); + + devc->mixer_output_port = val; + val |= AUDIO_HEADPHONE | AUDIO_LINE_OUT; /* Always on */ + devc->mixer_output_port = val; + + if (val & AUDIO_SPEAKER) + ad_write (devc, 26, ad_read (devc, 26) & ~0x40); /* Unmute mono out */ + else + ad_write (devc, 26, ad_read (devc, 26) | 0x40); /* Mute mono out */ + + return ioctl_out (arg, devc->mixer_output_port); + } + if (((cmd >> 8) & 0xff) == 'M') { int val; @@ -961,25 +990,26 @@ ad1848_prepare_for_output (int dev, int bsize, int bcount) ad1848_info *devc = (ad1848_info *) audio_devs[dev]->devc; ad_mute (devc); - { + if (devc->model != MD_4232) + { /* * This code fragment ensures that the playback FIFO is empty before * setting the codec for playback. Enabling playback for a moment should * be enough to do that. */ - int tmout; + int tmout; - ad_write (devc, 9, ad_read (devc, 9) | 0x01); /* Enable playback */ - disable_dma (audio_devs[dev]->dmachan1); - for (tmout = 0; tmout < 1000000; tmout++) - if (ad_read (devc, 11) & 0x10) /* DRQ active */ - if (tmout > 10000) - break; - ad_write (devc, 9, ad_read (devc, 9) & ~0x01); /* Stop playback */ + ad_write (devc, 9, ad_read (devc, 9) | 0x01); /* Enable playback */ + disable_dma (audio_devs[dev]->dmachan1); + for (tmout = 0; tmout < 1000000; tmout++) + if (ad_read (devc, 11) & 0x10) /* DRQ active */ + if (tmout > 10000) + break; + ad_write (devc, 9, ad_read (devc, 9) & ~0x01); /* Stop playback */ - enable_dma (audio_devs[dev]->dmachan1); - devc->audio_mode &= ~PCM_ENABLE_OUTPUT; - } + enable_dma (audio_devs[dev]->dmachan1); + devc->audio_mode &= ~PCM_ENABLE_OUTPUT; + } return ad1848_prepare_for_IO (dev, bsize, bcount); } @@ -1415,7 +1445,7 @@ ad1848_detect (int io_base, int *ad_flags, int *osp) for (i = 0; i < 16; i++) if ((tmp1 = ad_read (devc, i)) != (tmp2 = ad_read (devc, i + 16))) { - DDB (printk ("ad1848 detect step F(%d/%x/%x) - OPTi chip?\n", i, tmp1, tmp2)); + DDB (printk ("ad1848 detect step F(%d/%x/%x) - OPTi chip???\n", i, tmp1, tmp2)); if (!ad1847_flag) optiC930 = 1; break; @@ -1511,6 +1541,12 @@ ad1848_detect (int io_base, int *ad_flags, int *osp) devc->model = MD_4232; break; + case 0x03: + case 0x83: + devc->chip_name = "CS4236"; + devc->model = MD_4232; + break; + case 0x80: { /* @@ -1539,6 +1575,7 @@ ad1848_detect (int io_base, int *ad_flags, int *osp) break; default: /* Assume CS4231 or OPTi 82C930 */ + DDB (printk ("ad1848: I25 = %02x\n", ad_read (devc, 25))); if (optiC930) { devc->chip_name = "82C930"; diff --git a/drivers/sound/ad1848_mixer.h b/drivers/sound/ad1848_mixer.h index 809b858bb399..25b7455a6eda 100644 --- a/drivers/sound/ad1848_mixer.h +++ b/drivers/sound/ad1848_mixer.h @@ -166,3 +166,13 @@ static int default_mixer_levels[32] = #define LEFT_CHN 0 #define RIGHT_CHN 1 + +/* + * Channel enable bits for ioctl(SOUND_MIXER_PRIVATE1) + */ + +#ifndef AUDIO_SPEAKER +#define AUDIO_SPEAKER 0x01 /* Enable mono output */ +#define AUDIO_HEADPHONE 0x02 /* Sparc only */ +#define AUDIO_LINE_OUT 0x04 /* Sparc only */ +#endif diff --git a/drivers/sound/dev_table.h b/drivers/sound/dev_table.h index 84dd114863ab..b07f9168bc27 100644 --- a/drivers/sound/dev_table.h +++ b/drivers/sound/dev_table.h @@ -210,7 +210,6 @@ struct synth_operations { void (*controller) (int dev, int voice, int ctrl_num, int value); void (*panning) (int dev, int voice, int value); void (*volume_method) (int dev, int mode); - int (*pmgr_interface) (int dev, struct patmgr_info *info); void (*bender) (int dev, int chn, int value); int (*alloc_voice) (int dev, int chn, int note, struct voice_alloc_info *alloc); void (*setup_voice) (int dev, int voice, int chn); diff --git a/drivers/sound/dmabuf.c b/drivers/sound/dmabuf.c index bca21d0232ce..28aa8e836479 100644 --- a/drivers/sound/dmabuf.c +++ b/drivers/sound/dmabuf.c @@ -203,7 +203,10 @@ open_dmap (int dev, int mode, struct dma_buffparms *dmap, int chan) } if (dmap->raw_buf == NULL) - return -ENOSPC; /* Memory allocation failed during boot */ + { + printk ("Sound: DMA buffers not available\n"); + return -ENOSPC; /* Memory allocation failed during boot */ + } if (sound_open_dma (chan, audio_devs[dev]->name)) { @@ -452,6 +455,9 @@ launch_output (int dev, struct dma_buffparms *dmap) dmap->dma_mode |= DMODE_OUTPUT; + if (dmap->counts[dmap->qhead] == 0) + dmap->counts[dmap->qhead] = dmap->fragment_size; + audio_devs[dev]->d->output_block (dev, dmap->raw_buf_phys + dmap->qhead * dmap->fragment_size, dmap->counts[dmap->qhead], 0, @@ -870,7 +876,7 @@ get_buffer_pointer (int dev, int chan, struct dma_buffparms *dmap) pos = get_dma_residue (chan); if (chan > 3) /* Word count */ pos *= 2; - pos = dmap->bytes_in_use - pos; + pos = dmap->bytes_in_use - pos - 1; if (pos < 0) pos = 0; if (pos > dmap->bytes_in_use) @@ -1605,6 +1611,9 @@ DMAbuf_outputintr (int dev, int event_type) if (!(audio_devs[dev]->flags & DMA_AUTOMODE)) { + if (dmap->counts[dmap->qhead] == 0) + dmap->counts[dmap->qhead] = dmap->fragment_size; + audio_devs[dev]->d->output_block (dev, dmap->raw_buf_phys + dmap->qhead * dmap->fragment_size, dmap->counts[dmap->qhead], 1, diff --git a/drivers/sound/gus_midi.c b/drivers/sound/gus_midi.c index 89fb3be2caa2..f09edd6937a0 100644 --- a/drivers/sound/gus_midi.c +++ b/drivers/sound/gus_midi.c @@ -27,6 +27,7 @@ static volatile unsigned char gus_midi_control; static void (*midi_input_intr) (int dev, unsigned char data); static unsigned char tmp_queue[256]; +extern int gus_pnp_flag; static volatile int qlen; static volatile unsigned char qhead, qtail; extern int gus_base, gus_irq, gus_dma; @@ -58,10 +59,11 @@ gus_midi_open (int dev, int mode, input_opened = 0; if (mode == OPEN_READ || mode == OPEN_READWRITE) - { - gus_midi_control |= MIDI_ENABLE_RCV; - input_opened = 1; - } + if (!gus_pnp_flag) + { + gus_midi_control |= MIDI_ENABLE_RCV; + input_opened = 1; + } outb ((gus_midi_control), u_MidiControl); /* Enable */ diff --git a/drivers/sound/gus_wave.c b/drivers/sound/gus_wave.c index 7166556382fe..a4caf4f8aa2c 100644 --- a/drivers/sound/gus_wave.c +++ b/drivers/sound/gus_wave.c @@ -1749,9 +1749,6 @@ guswave_load_patch (int dev, int format, const char *addr, count -= sizeof_patch; - if (gus_mem_size == 0) - return -ENOSPC; - if (free_sample >= MAX_SAMPLE) { printk ("GUS: Sample table full\n"); @@ -1765,6 +1762,12 @@ guswave_load_patch (int dev, int format, const char *addr, copy_from_user (&((char *) &patch)[offs], &(addr)[offs], sizeof_patch - offs); + if (patch.mode & WAVE_ROM) + return -EINVAL; + if (gus_mem_size == 0) + + return -ENOSPC; + instr = patch.instr_no; if (instr < 0 || instr > MAX_PATCH) @@ -1993,8 +1996,6 @@ guswave_load_patch (int dev, int format, const char *addr, free_mem_ptr += patch.len; - if (!pmgr_flag) - pmgr_inform (dev, PM_E_PATCH_LOADED, instr, free_sample, 0, 0); free_sample++; return 0; } @@ -2275,40 +2276,6 @@ gus_audio_ioctl (int dev, unsigned int cmd, caddr_t arg, int local) return ioctl_out (arg, -EINVAL); break; -/* This is just a temporary hack used for reading the ROM patch set. */ - - case SNDCTL_PMGR_ACCESS: - { - copr_msg *buf; - int i, pos; - - buf = (copr_msg *) vmalloc (sizeof (copr_msg)); - if (buf == NULL) - return -ENOSPC; - - copy_from_user ((char *) buf, &((char *) arg)[0], sizeof (*buf)); - - pos = buf->len; - - gus_write8 (0x53, gus_look8 (0x53) | 0x02); /* Select ROM I/O access */ - - for (i = 0; i < 2048; i++) - { - buf->data[i] = gus_peek (pos + i); - } - gus_write8 (0x53, gus_look8 (0x53) & ~0x02); /* Select DRAM I/O access */ - buf->len = 2048; /* feed back number of WORDs sent */ - { - char *fixit = (char *) buf; - - copy_to_user (&((char *) arg)[0], fixit, sizeof (*buf)); - }; - vfree (buf); - - return 0; - } - break; - } return -EINVAL; } @@ -2810,189 +2777,6 @@ guswave_bender (int dev, int voice, int value) restore_flags (flags); } -static int -guswave_patchmgr (int dev, struct patmgr_info *rec) -{ - int i, n; - - switch (rec->command) - { - case PM_GET_DEVTYPE: - rec->parm1 = PMTYPE_WAVE; - return 0; - break; - - case PM_GET_NRPGM: - rec->parm1 = MAX_PATCH; - return 0; - break; - - case PM_GET_PGMMAP: - rec->parm1 = MAX_PATCH; - - for (i = 0; i < MAX_PATCH; i++) - { - int ptr = patch_table[i]; - - rec->data.data8[i] = 0; - - while (ptr >= 0 && ptr < free_sample && ptr != NOT_SAMPLE) - { - rec->data.data8[i]++; - ptr = samples[ptr].key; /* Follow link */ - } - } - return 0; - break; - - case PM_GET_PGM_PATCHES: - { - int ptr = patch_table[rec->parm1]; - - n = 0; - - while (ptr >= 0 && ptr < free_sample && ptr != NOT_SAMPLE) - { - rec->data.data32[n++] = ptr; - ptr = samples[ptr].key; /* Follow link */ - } - } - rec->parm1 = n; - return 0; - break; - - case PM_GET_PATCH: - { - int ptr = rec->parm1; - struct patch_info *pat; - - if (ptr < 0 || ptr >= free_sample) - return -EINVAL; - - memcpy (rec->data.data8, (char *) &samples[ptr], - sizeof (struct patch_info)); - - pat = (struct patch_info *) rec->data.data8; - - pat->key = GUS_PATCH; /* Restore patch type */ - rec->parm1 = sample_ptrs[ptr]; /* DRAM location */ - rec->parm2 = sizeof (struct patch_info); - } - return 0; - break; - - case PM_SET_PATCH: - { - int ptr = rec->parm1; - struct patch_info *pat; - - if (ptr < 0 || ptr >= free_sample) - return -EINVAL; - - pat = (struct patch_info *) rec->data.data8; - - if (pat->len > samples[ptr].len) /* Cannot expand sample */ - return -EINVAL; - - pat->key = samples[ptr].key; /* Ensure the link is correct */ - - memcpy ((char *) &samples[ptr], rec->data.data8, - sizeof (struct patch_info)); - - pat->key = GUS_PATCH; - } - return 0; - break; - - case PM_READ_PATCH: /* Returns a block of wave data from the DRAM */ - { - int sample = rec->parm1; - int n; - long offs = rec->parm2; - int l = rec->parm3; - - if (sample < 0 || sample >= free_sample) - return -EINVAL; - - if (offs < 0 || offs >= samples[sample].len) - return -EINVAL; /* Invalid offset */ - - n = samples[sample].len - offs; /* Num of bytes left */ - - if (l > n) - l = n; - - if (l > sizeof (rec->data.data8)) - l = sizeof (rec->data.data8); - - if (l <= 0) - return -EINVAL; /* - * Was there a bug? - */ - - offs += sample_ptrs[sample]; /* - * Begin offset + offset to DRAM - */ - - for (n = 0; n < l; n++) - rec->data.data8[n] = gus_peek (offs++); - rec->parm1 = n; /* - * Nr of bytes copied - */ - } - return 0; - break; - - case PM_WRITE_PATCH: /* - * Writes a block of wave data to the DRAM - */ - { - int sample = rec->parm1; - int n; - long offs = rec->parm2; - int l = rec->parm3; - - if (sample < 0 || sample >= free_sample) - return -EINVAL; - - if (offs < 0 || offs >= samples[sample].len) - return -EINVAL; /* - * Invalid offset - */ - - n = samples[sample].len - offs; /* - * Nr of bytes left - */ - - if (l > n) - l = n; - - if (l > sizeof (rec->data.data8)) - l = sizeof (rec->data.data8); - - if (l <= 0) - return -EINVAL; /* - * Was there a bug? - */ - - offs += sample_ptrs[sample]; /* - * Begin offsets + offset to DRAM - */ - - for (n = 0; n < l; n++) - gus_poke (offs++, rec->data.data8[n]); - rec->parm1 = n; /* - * Nr of bytes copied - */ - } - return 0; - break; - - default: - return -EINVAL; - } -} - static int guswave_alloc (int dev, int chn, int note, struct voice_alloc_info *alloc) { @@ -3058,7 +2842,6 @@ static struct synth_operations guswave_operations = guswave_controller, guswave_panning, guswave_volume_method, - guswave_patchmgr, guswave_bender, guswave_alloc, guswave_setup_voice @@ -3440,8 +3223,8 @@ gus_wave_init (struct address_info *hw_config) } conf_printf (tmp2, hw_config); - strncpy (gus_info.name, tmp2, sizeof (tmp2)); - gus_info.name[sizeof (tmp2) - 1] = 0; + tmp2[sizeof (gus_info.name) - 1] = 0; + strncpy (gus_info.name, tmp2, strlen (tmp2)); if (num_synths >= MAX_SYNTH_DEV) printk ("GUS Error: Too many synthesizers\n"); diff --git a/drivers/sound/ics2101.c b/drivers/sound/ics2101.c index ab04953a451b..732c1c431fb4 100644 --- a/drivers/sound/ics2101.c +++ b/drivers/sound/ics2101.c @@ -121,35 +121,41 @@ ics2101_mixer_ioctl (int dev, unsigned int cmd, caddr_t arg) if (((cmd >> 8) & 0xff) == 'M') { if (_IOC_DIR (cmd) & _IOC_WRITE) - switch (cmd & 0xff) - { - case SOUND_MIXER_RECSRC: - return gus_default_mixer_ioctl (dev, cmd, arg); - break; + { + int val; - case SOUND_MIXER_MIC: - return ioctl_out (arg, set_volumes (DEV_MIC, ioctl_in (arg))); - break; + get_user (val, (int *) arg); - case SOUND_MIXER_CD: - return ioctl_out (arg, set_volumes (DEV_CD, ioctl_in (arg))); - break; + switch (cmd & 0xff) + { + case SOUND_MIXER_RECSRC: + return gus_default_mixer_ioctl (dev, cmd, arg); + break; - case SOUND_MIXER_LINE: - return ioctl_out (arg, set_volumes (DEV_LINE, ioctl_in (arg))); - break; + case SOUND_MIXER_MIC: + return ioctl_out (arg, set_volumes (DEV_MIC, val)); + break; - case SOUND_MIXER_SYNTH: - return ioctl_out (arg, set_volumes (DEV_GF1, ioctl_in (arg))); - break; + case SOUND_MIXER_CD: + return ioctl_out (arg, set_volumes (DEV_CD, val)); + break; - case SOUND_MIXER_VOLUME: - return ioctl_out (arg, set_volumes (DEV_VOL, ioctl_in (arg))); - break; + case SOUND_MIXER_LINE: + return ioctl_out (arg, set_volumes (DEV_LINE, val)); + break; - default: - return -EINVAL; - } + case SOUND_MIXER_SYNTH: + return ioctl_out (arg, set_volumes (DEV_GF1, val)); + break; + + case SOUND_MIXER_VOLUME: + return ioctl_out (arg, set_volumes (DEV_VOL, val)); + break; + + default: + return -EINVAL; + } + } else switch (cmd & 0xff) /* * Return parameters diff --git a/drivers/sound/lowlevel/awe_wave.c b/drivers/sound/lowlevel/awe_wave.c index e44d5a2210ec..7b49e9ada31a 100644 --- a/drivers/sound/lowlevel/awe_wave.c +++ b/drivers/sound/lowlevel/awe_wave.c @@ -245,7 +245,6 @@ static void awe_aftertouch(int dev, int voice, int pressure); static void awe_controller(int dev, int voice, int ctrl_num, int value); static void awe_panning(int dev, int voice, int value); static void awe_volume_method(int dev, int mode); -static int awe_patchmgr(int dev, struct patmgr_info *rec); static void awe_bender(int dev, int voice, int value); static int awe_alloc(int dev, int chn, int note, struct voice_alloc_info *alloc); static void awe_setup_voice(int dev, int voice, int chn); @@ -374,7 +373,6 @@ static struct synth_operations awe_operations = awe_controller, awe_panning, awe_volume_method, - awe_patchmgr, awe_bender, awe_alloc, awe_setup_voice @@ -2544,15 +2542,6 @@ awe_volume_method(int dev, int mode) } -/* patch manager */ -static int -awe_patchmgr(int dev, struct patmgr_info *rec) -{ - FATALERR(printk("AWE32 Warning: patch manager control not supported\n")); - return 0; -} - - /* pitch wheel change: 0-16384 */ static void awe_bender(int dev, int voice, int value) diff --git a/drivers/sound/midi_synth.c b/drivers/sound/midi_synth.c index 64cde661a97a..4e26b3464da7 100644 --- a/drivers/sound/midi_synth.c +++ b/drivers/sound/midi_synth.c @@ -652,12 +652,6 @@ midi_synth_controller (int dev, int channel, int ctrl_num, int value) midi_outc (orig_dev, value & 0x7f); } -int -midi_synth_patchmgr (int dev, struct patmgr_info *rec) -{ - return -EINVAL; -} - void midi_synth_bender (int dev, int channel, int value) { diff --git a/drivers/sound/midi_synth.h b/drivers/sound/midi_synth.h index a2c812b30c22..e29618fd542a 100644 --- a/drivers/sound/midi_synth.h +++ b/drivers/sound/midi_synth.h @@ -12,7 +12,6 @@ int midi_synth_load_patch (int dev, int format, const char * addr, void midi_synth_panning (int dev, int channel, int pressure); void midi_synth_aftertouch (int dev, int channel, int pressure); void midi_synth_controller (int dev, int channel, int ctrl_num, int value); -int midi_synth_patchmgr (int dev, struct patmgr_info *rec); void midi_synth_bender (int dev, int chn, int value); void midi_synth_setup_voice (int dev, int voice, int chn); int midi_synth_send_sysex(int dev, unsigned char *bytes,int len); @@ -40,7 +39,6 @@ static struct synth_operations std_midi_synth = midi_synth_controller, midi_synth_panning, NULL, - midi_synth_patchmgr, midi_synth_bender, NULL, /* alloc_voice */ midi_synth_setup_voice, diff --git a/drivers/sound/mpu401.c b/drivers/sound/mpu401.c index 132d63e20ac6..9256685ce964 100644 --- a/drivers/sound/mpu401.c +++ b/drivers/sound/mpu401.c @@ -21,8 +21,6 @@ #if (defined(CONFIG_MPU401) || defined(CONFIG_MPU_EMU)) && defined(CONFIG_MIDI) #include "coproc.h" -static int init_sequence[20]; /* NOTE! pos 0 = len, start pos 1. */ - #ifdef CONFIG_SEQUENCER static int timer_mode = TMR_INTERNAL, timer_caps = TMR_INTERNAL; @@ -775,23 +773,20 @@ static int mpu401_ioctl (int dev, unsigned cmd, caddr_t arg) { struct mpu_config *devc; + int val; devc = &dev_conf[dev]; switch (cmd) { - case 1: - copy_from_user ((char *) init_sequence, &((char *) arg)[0], sizeof (init_sequence)); - return 0; - break; - case SNDCTL_MIDI_MPUMODE: if (!(devc->capabilities & MPU_CAP_INTLG)) /* No intelligent mode */ { printk ("MPU-401: Intelligent mode not supported by the HW\n"); return -EINVAL; } - set_uart_mode (dev, devc, !ioctl_in (arg)); + get_user (val, (int *) arg); + set_uart_mode (dev, devc, !val); return 0; break; @@ -976,7 +971,6 @@ static struct synth_operations mpu401_synth_proto = midi_synth_controller, midi_synth_panning, NULL, - midi_synth_patchmgr, midi_synth_bender, NULL, /* alloc */ midi_synth_setup_voice, @@ -1639,8 +1633,9 @@ mpu_timer_ioctl (int dev, case SNDCTL_TMR_TIMEBASE: { - int val = (int) ioctl_in (arg); + int val; + get_user (val, (int *) arg); if (val) set_timebase (midi_dev, val); @@ -1650,9 +1645,11 @@ mpu_timer_ioctl (int dev, case SNDCTL_TMR_TEMPO: { - int val = (int) ioctl_in (arg); + int val; int ret; + get_user (val, (int *) arg); + if (val) { if (val < 8) @@ -1673,10 +1670,15 @@ mpu_timer_ioctl (int dev, break; case SNDCTL_SEQ_CTRLRATE: - if (ioctl_in (arg) != 0) /* Can't change */ - return -EINVAL; + { + int val; + + get_user (val, (int *) arg); + if (val != 0) /* Can't change */ + return -EINVAL; - return ioctl_out (arg, ((curr_tempo * curr_timebase) + 30) / 60); + return ioctl_out (arg, ((curr_tempo * curr_timebase) + 30) / 60); + } break; case SNDCTL_SEQ_GETTIME: @@ -1684,7 +1686,7 @@ mpu_timer_ioctl (int dev, break; case SNDCTL_TMR_METRONOME: - metronome_mode = (int) ioctl_in (arg); + get_user (metronome_mode, (int *) arg); setup_metronome (midi_dev); return 0; break; diff --git a/drivers/sound/opl3.c b/drivers/sound/opl3.c index c501cc7c0683..afd19317fd03 100644 --- a/drivers/sound/opl3.c +++ b/drivers/sound/opl3.c @@ -127,7 +127,6 @@ opl3_ioctl (int dev, return -EINVAL; } - pmgr_inform (dev, PM_E_PATCH_LOADED, ins.channel, 0, 0, 0); return store_instr (ins.channel, &ins); } break; @@ -1015,12 +1014,6 @@ opl3_controller (int dev, int voice, int ctrl_num, int value) } } -static int -opl3_patchmgr (int dev, struct patmgr_info *rec) -{ - return -EINVAL; -} - static void opl3_bender (int dev, int voice, int value) { @@ -1131,7 +1124,6 @@ static struct synth_operations opl3_operations = opl3_controller, opl3_panning, opl3_volume_method, - opl3_patchmgr, opl3_bender, opl3_alloc_voice, opl3_setup_voice diff --git a/drivers/sound/os.h b/drivers/sound/os.h index 04a79fbbd563..d07f6735c424 100644 --- a/drivers/sound/os.h +++ b/drivers/sound/os.h @@ -1,3 +1,9 @@ + +#define ALLOW_SELECT +#undef NO_INLINE_ASM +#define SHORT_BANNERS +#define MANUAL_PNP + #ifdef MODULE #define __NO_VERSION__ #include @@ -6,6 +12,9 @@ #include #endif #endif +#if LINUX_VERSION_CODE > 131328 +#define LINUX21X +#endif #include #include @@ -15,12 +24,13 @@ #include #include #include -#include +#include #include #include #include #include #include +#include #include #include #include @@ -32,6 +42,8 @@ #define FALSE 0 #define TRUE 1 + + struct snd_wait { int opts; }; @@ -41,5 +53,11 @@ extern int sound_open_dma(int chn, char *deviceID); extern void sound_free_dma(int chn); extern void sound_close_dma(int chn); +#define RUNTIME_DMA_ALLOC + extern caddr_t sound_mem_blocks[1024]; extern int sound_nblocks; + +#undef PSEUDO_DMA_AUTOINIT +#define ALLOW_BUFFER_MAPPING + diff --git a/drivers/sound/pas2_midi.c b/drivers/sound/pas2_midi.c index 974443c9611c..74d04750e432 100644 --- a/drivers/sound/pas2_midi.c +++ b/drivers/sound/pas2_midi.c @@ -3,9 +3,17 @@ * * The low level driver for the PAS Midi Interface. */ +/* + * Copyright (C) by Hannu Savolainen 1993-1996 + * + * OSS/Free for Linux is distributed under the GNU GENERAL PUBLIC LICENSE (GPL) + * Version 2 (June 1991). See the "COPYING" file distributed with this software + * for more info. + */ +#include + #include "sound_config.h" -#include #if defined(CONFIG_PAS) && defined(CONFIG_MIDI) diff --git a/drivers/sound/pas2_mixer.c b/drivers/sound/pas2_mixer.c index 0e05d9b8bd3e..917d37809e48 100644 --- a/drivers/sound/pas2_mixer.c +++ b/drivers/sound/pas2_mixer.c @@ -6,7 +6,15 @@ * Mixer routines for the Pro Audio Spectrum cards. */ +/* + * Copyright (C) by Hannu Savolainen 1993-1996 + * + * OSS/Free for Linux is distributed under the GNU GENERAL PUBLIC LICENSE (GPL) + * Version 2 (June 1991). See the "COPYING" file distributed with this software + * for more info. + */ #include + #include "sound_config.h" #if defined(CONFIG_PAS) @@ -296,8 +304,12 @@ pas_mixer_ioctl (int dev, unsigned int cmd, caddr_t arg) if (((cmd >> 8) & 0xff) == 'M') { + int v; + + get_user (v, (int *) arg); + if (_IOC_DIR (cmd) & _IOC_WRITE) - return ioctl_out (arg, pas_mixer_set (cmd & 0xff, ioctl_in (arg))); + return ioctl_out (arg, pas_mixer_set (cmd & 0xff, v)); else { /* * Read parameters diff --git a/drivers/sound/pas2_pcm.c b/drivers/sound/pas2_pcm.c index 11639299f27e..63f6762a5635 100644 --- a/drivers/sound/pas2_pcm.c +++ b/drivers/sound/pas2_pcm.c @@ -148,6 +148,8 @@ pcm_set_bits (int arg) static int pas_audio_ioctl (int dev, unsigned int cmd, caddr_t arg, int local) { + int val; + DEB (printk ("pas2_pcm.c: static int pas_audio_ioctl(unsigned int cmd = %X, unsigned int arg = %X)\n", cmd, arg)); switch (cmd) @@ -155,7 +157,8 @@ pas_audio_ioctl (int dev, unsigned int cmd, caddr_t arg, int local) case SOUND_PCM_WRITE_RATE: if (local) return pcm_set_speed ((int) arg); - return ioctl_out (arg, pcm_set_speed (ioctl_in (arg))); + get_user (val, (int *) arg); + return ioctl_out (arg, pcm_set_speed (val)); break; case SOUND_PCM_READ_RATE: @@ -167,13 +170,15 @@ pas_audio_ioctl (int dev, unsigned int cmd, caddr_t arg, int local) case SNDCTL_DSP_STEREO: if (local) return pcm_set_channels ((int) arg + 1) - 1; - return ioctl_out (arg, pcm_set_channels (ioctl_in (arg) + 1) - 1); + get_user (val, (int *) arg); + return ioctl_out (arg, pcm_set_channels (val + 1) - 1); break; case SOUND_PCM_WRITE_CHANNELS: if (local) return pcm_set_channels ((int) arg); - return ioctl_out (arg, pcm_set_channels (ioctl_in (arg))); + get_user (val, (int *) arg); + return ioctl_out (arg, pcm_set_channels (val)); break; case SOUND_PCM_READ_CHANNELS: @@ -185,7 +190,8 @@ pas_audio_ioctl (int dev, unsigned int cmd, caddr_t arg, int local) case SNDCTL_DSP_SETFMT: if (local) return pcm_set_bits ((int) arg); - return ioctl_out (arg, pcm_set_bits (ioctl_in (arg))); + get_user (val, (int *) arg); + return ioctl_out (arg, pcm_set_bits (val)); break; case SOUND_PCM_READ_BITS: @@ -196,9 +202,10 @@ pas_audio_ioctl (int dev, unsigned int cmd, caddr_t arg, int local) case SOUND_PCM_WRITE_FILTER: /* * NOT YET IMPLEMENTED */ - if (ioctl_in (arg) > 1) + get_user (val, (int *) arg); + if (val > 1) return -EINVAL; - pcm_filter = ioctl_in (arg); + pcm_filter = val; break; case SOUND_PCM_READ_FILTER: diff --git a/drivers/sound/patmgr.c b/drivers/sound/patmgr.c deleted file mode 100644 index 95c49dc31aef..000000000000 --- a/drivers/sound/patmgr.c +++ /dev/null @@ -1,292 +0,0 @@ -/* - * sound/patmgr.c - * - * The patch manager interface for the /dev/sequencer - */ -/* - * Copyright (C) by Hannu Savolainen 1993-1996 - * - * OSS/Free for Linux is distributed under the GNU GENERAL PUBLIC LICENSE (GPL) - * Version 2 (June 1991). See the "COPYING" file distributed with this software - * for more info. - */ -#include - - -#define PATMGR_C -#include "sound_config.h" - -#if defined(CONFIG_SEQUENCER) - -static struct wait_queue *server_procs[MAX_SYNTH_DEV] = -{NULL}; -static volatile struct snd_wait server_wait_flag[MAX_SYNTH_DEV] = -{ - {0}}; - -static struct patmgr_info *mbox[MAX_SYNTH_DEV] = -{NULL}; -static volatile int msg_direction[MAX_SYNTH_DEV] = -{0}; - -static int pmgr_opened[MAX_SYNTH_DEV] = -{0}; - -#define A_TO_S 1 -#define S_TO_A 2 - -static struct wait_queue *appl_proc = NULL; -static volatile struct snd_wait appl_wait_flag = -{0}; - -int -pmgr_open (int dev) -{ - if (dev < 0 || dev >= num_synths) - return -ENXIO; - - if (pmgr_opened[dev]) - return -EBUSY; - pmgr_opened[dev] = 1; - - server_wait_flag[dev].opts = WK_NONE; - - return 0; -} - -void -pmgr_release (int dev) -{ - - if (mbox[dev]) /* - * Killed in action. Inform the client - */ - { - - mbox[dev]->key = PM_ERROR; - mbox[dev]->parm1 = -EIO; - - if ((appl_wait_flag.opts & WK_SLEEP)) - { - appl_wait_flag.opts = WK_WAKEUP; - wake_up (&appl_proc); - }; - } - - pmgr_opened[dev] = 0; -} - -int -pmgr_read (int dev, struct fileinfo *file, char *buf, int count) -{ - unsigned long flags; - int ok = 0; - - if (count != sizeof (struct patmgr_info)) - { - printk ("PATMGR%d: Invalid read count\n", dev); - return -EIO; - } - - while (!ok && !(current->signal & ~current->blocked)) - { - save_flags (flags); - cli (); - - while (!(mbox[dev] && msg_direction[dev] == A_TO_S) && - !(current->signal & ~current->blocked)) - { - - server_wait_flag[dev].opts = WK_SLEEP; - interruptible_sleep_on (&server_procs[dev]); - server_wait_flag[dev].opts &= ~WK_SLEEP;; - } - - if (mbox[dev] && msg_direction[dev] == A_TO_S) - { - { - char *fixit = (char *) mbox[dev]; - - copy_to_user (&(buf)[0], fixit, count); - }; - msg_direction[dev] = 0; - ok = 1; - } - - restore_flags (flags); - - } - - if (!ok) - return -EINTR; - return count; -} - -int -pmgr_write (int dev, struct fileinfo *file, const char *buf, int count) -{ - unsigned long flags; - - if (count < 4) - { - printk ("PATMGR%d: Write count < 4\n", dev); - return -EIO; - } - - copy_from_user ((char *) mbox[dev], &(buf)[0], 4); - - if (*(unsigned char *) mbox[dev] == SEQ_FULLSIZE) - { - int tmp_dev; - - tmp_dev = ((unsigned short *) mbox[dev])[2]; - if (tmp_dev != dev) - return -ENXIO; - - return synth_devs[dev]->load_patch (dev, *(unsigned short *) mbox[dev], - buf, 4, count, 1); - } - - if (count != sizeof (struct patmgr_info)) - { - printk ("PATMGR%d: Invalid write count\n", dev); - return -EIO; - } - - /* - * If everything went OK, there should be a preallocated buffer in the - * mailbox and a client waiting. - */ - - save_flags (flags); - cli (); - - if (mbox[dev] && !msg_direction[dev]) - { - copy_from_user (&((char *) mbox[dev])[4], &(buf)[4], count - 4); - msg_direction[dev] = S_TO_A; - - if ((appl_wait_flag.opts & WK_SLEEP)) - { - { - appl_wait_flag.opts = WK_WAKEUP; - wake_up (&appl_proc); - }; - } - } - - restore_flags (flags); - - return count; -} - -int -pmgr_access (int dev, struct patmgr_info *rec) -{ - unsigned long flags; - int err = 0; - - save_flags (flags); - cli (); - - if (mbox[dev]) - printk (" PATMGR: Server %d mbox full. Why?\n", dev); - else - { - rec->key = PM_K_COMMAND; - mbox[dev] = rec; - msg_direction[dev] = A_TO_S; - - if ((server_wait_flag[dev].opts & WK_SLEEP)) - { - { - server_wait_flag[dev].opts = WK_WAKEUP; - wake_up (&server_procs[dev]); - }; - } - - - appl_wait_flag.opts = WK_SLEEP; - interruptible_sleep_on (&appl_proc); - appl_wait_flag.opts &= ~WK_SLEEP;; - - if (msg_direction[dev] != S_TO_A) - { - rec->key = PM_ERROR; - rec->parm1 = -EIO; - } - else if (rec->key == PM_ERROR) - { - err = rec->parm1; - if (err > 0) - err = -err; - } - - mbox[dev] = NULL; - msg_direction[dev] = 0; - } - - restore_flags (flags); - - return err; -} - -int -pmgr_inform (int dev, int event, unsigned long p1, unsigned long p2, - unsigned long p3, unsigned long p4) -{ - unsigned long flags; - int err = 0; - - struct patmgr_info *tmp_mbox; - - if (!pmgr_opened[dev]) - return 0; - - tmp_mbox = (struct patmgr_info *) vmalloc (sizeof (struct patmgr_info)); - - if (tmp_mbox == NULL) - { - printk ("pmgr: Couldn't allocate memory for a message\n"); - return 0; - } - - save_flags (flags); - cli (); - - if (mbox[dev]) - printk (" PATMGR: Server %d mbox full. Why?\n", dev); - else - { - - mbox[dev] = tmp_mbox; - mbox[dev]->key = PM_K_EVENT; - mbox[dev]->command = event; - mbox[dev]->parm1 = p1; - mbox[dev]->parm2 = p2; - mbox[dev]->parm3 = p3; - msg_direction[dev] = A_TO_S; - - if ((server_wait_flag[dev].opts & WK_SLEEP)) - { - { - server_wait_flag[dev].opts = WK_WAKEUP; - wake_up (&server_procs[dev]); - }; - } - - - appl_wait_flag.opts = WK_SLEEP; - interruptible_sleep_on (&appl_proc); - appl_wait_flag.opts &= ~WK_SLEEP;; - mbox[dev] = NULL; - msg_direction[dev] = 0; - } - - restore_flags (flags); - vfree (tmp_mbox); - - return err; -} - -#endif diff --git a/drivers/sound/sb_common.c b/drivers/sound/sb_common.c index dc6d0e7e7510..f449286e5b6c 100644 --- a/drivers/sound/sb_common.c +++ b/drivers/sound/sb_common.c @@ -191,6 +191,8 @@ sb_dsp_reset (sb_devc * devc) { int loopc; + DDB (printk ("Entered sb_dsp_reset()\n")); + if (devc->model == MDL_ESS) outb ((3), DSP_RESET); /* Reset FIFO too */ else @@ -205,11 +207,15 @@ sb_dsp_reset (sb_devc * devc) for (loopc = 0; loopc < 1000 && !(inb (DSP_DATA_AVAIL) & 0x80); loopc++); if (inb (DSP_READ) != 0xAA) - return 0; /* Sorry */ + { + DDB (printk ("sb: No response to RESET\n")); + return 0; /* Sorry */ + } if (devc->model == MDL_ESS) sb_dsp_command (devc, 0xc6); /* Enable extended mode */ + DDB (printk ("sb_dsp_reset() OK\n")); return 1; } @@ -220,6 +226,7 @@ dsp_get_vers (sb_devc * devc) unsigned long flags; + DDB (printk ("Entered dsp_get_vers()\n")); save_flags (flags); cli (); devc->major = devc->minor = 0; @@ -238,6 +245,7 @@ dsp_get_vers (sb_devc * devc) } } } + DDB (printk ("DSP version %d.%d\n", devc->major, devc->minor)); restore_flags (flags); } @@ -897,6 +905,7 @@ sb_getmixer (sb_devc * devc, unsigned int port) tenmicrosec (devc->osp); val = inb (MIXER_DATA); tenmicrosec (devc->osp); + tenmicrosec (devc->osp); restore_flags (flags); return val; diff --git a/drivers/sound/sb_mixer.c b/drivers/sound/sb_mixer.c index ae562fd6909b..0c156753955e 100644 --- a/drivers/sound/sb_mixer.c +++ b/drivers/sound/sb_mixer.c @@ -304,6 +304,19 @@ sb_mixer_ioctl (int dev, unsigned int cmd, caddr_t arg) sb_devc *devc = mixer_devs[dev]->devc; int val; +/* + * Use ioctl(fd, SOUND_MIXER_PRIVATE1, &mode) to turn AGC off (0) or on (1). + */ + if (cmd == SOUND_MIXER_PRIVATE1 && devc->model == MDL_SB16) + { + int tmp; + + get_user (tmp, (int *) arg); + + sb_setmixer (devc, 0x43, (~tmp) & 0x01); + return 0; + } + if (((cmd >> 8) & 0xff) == 'M') { if (_IOC_DIR (cmd) & _IOC_WRITE) diff --git a/drivers/sound/sequencer.c b/drivers/sound/sequencer.c index 6b4717c8e235..e5faa37a0157 100644 --- a/drivers/sound/sequencer.c +++ b/drivers/sound/sequencer.c @@ -77,8 +77,6 @@ static int seq_queue (unsigned char *note, char nonblock); static void seq_startplay (void); static int seq_sync (void); static void seq_reset (void); -static int pmgr_present[MAX_SYNTH_DEV] = -{0}; #if MAX_SYNTH_DEV > 15 #error Too many synthesizer devices enabled. @@ -95,11 +93,6 @@ sequencer_read (int dev, struct fileinfo *file, char *buf, int count) ev_len = seq_mode == SEQ_1 ? 4 : 8; - if (dev) /* - * Patch manager device - */ - return pmgr_read (dev - 1, file, buf, count); - save_flags (flags); cli (); if (!iqlen) @@ -264,9 +257,6 @@ sequencer_write (int dev, struct fileinfo *file, const char *buf, int count) if (mode == OPEN_READ) return -EIO; - if (dev) - return pmgr_write (dev - 1, file, buf, count); - c = count; while (c >= 4) @@ -1087,9 +1077,8 @@ sequencer_open (int dev, struct fileinfo *file) return -ENXIO; } - if (dev) /* Patch manager device */ + if (dev) /* Patch manager device (obsolete) */ { - printk ("Patch manager interface is currently broken. Sorry\n"); return -ENXIO; } @@ -1209,10 +1198,6 @@ sequencer_open (int dev, struct fileinfo *file) midi_sleep_flag.opts = WK_NONE; output_threshold = SEQ_MAX_QUEUE / 2; - for (i = 0; i < num_synths; i++) - if (pmgr_present[i]) - pmgr_inform (i, PM_E_OPENED, 0, 0, 0, 0); - return 0; } @@ -1273,16 +1258,6 @@ sequencer_release (int dev, struct fileinfo *file) DEB (printk ("sequencer_release(dev=%d)\n", dev)); - if (dev) /* - * Patch manager device - */ - { - dev--; - pmgr_release (dev); - pmgr_present[dev] = 0; - return; - } - /* * * Wait until the queue is empty (if we don't have nonblock) */ @@ -1318,10 +1293,6 @@ sequencer_release (int dev, struct fileinfo *file) } } - for (i = 0; i < num_synths; i++) - if (pmgr_present[i]) - pmgr_inform (i, PM_E_CLOSED, 0, 0, 0, 0); - for (i = 0; i < max_mididev; i++) { if (midi_opened[i]) @@ -1523,7 +1494,7 @@ int sequencer_ioctl (int dev, struct fileinfo *file, unsigned int cmd, caddr_t arg) { - int midi_dev, orig_dev; + int midi_dev, orig_dev, val; int mode = file->mode & O_ACCMODE; orig_dev = dev = dev >> 4; @@ -1537,8 +1508,6 @@ sequencer_ioctl (int dev, struct fileinfo *file, case SNDCTL_TMR_CONTINUE: case SNDCTL_TMR_METRONOME: case SNDCTL_TMR_SOURCE: - if (dev) /* Patch manager */ - return -EIO; if (seq_mode != SEQ_2) return -EINVAL; @@ -1546,8 +1515,6 @@ sequencer_ioctl (int dev, struct fileinfo *file, break; case SNDCTL_TMR_SELECT: - if (dev) /* Patch manager */ - return -EIO; if (seq_mode != SEQ_2) return -EINVAL; @@ -1567,10 +1534,6 @@ sequencer_ioctl (int dev, struct fileinfo *file, break; case SNDCTL_SEQ_SYNC: - if (dev) /* - * Patch manager - */ - return -EIO; if (mode == OPEN_READ) return 0; @@ -1583,23 +1546,14 @@ sequencer_ioctl (int dev, struct fileinfo *file, break; case SNDCTL_SEQ_RESET: - if (dev) /* - * Patch manager - */ - return -EIO; seq_reset (); return 0; break; case SNDCTL_SEQ_TESTMIDI: - if (dev) /* - * Patch manager - */ - return -EIO; - get_user (midi_dev, (int *) arg); - if (midi_dev >= max_mididev) + if (midi_dev < 0 || midi_dev >= max_mididev) return -ENXIO; if (!midi_opened[midi_dev]) @@ -1619,11 +1573,6 @@ sequencer_ioctl (int dev, struct fileinfo *file, break; case SNDCTL_SEQ_GETINCOUNT: - if (dev) /* - * Patch manager - */ - return -EIO; - if (mode == OPEN_WRITE) return 0; return ioctl_out (arg, iqlen); @@ -1644,16 +1593,14 @@ sequencer_ioctl (int dev, struct fileinfo *file, break; case SNDCTL_SEQ_CTRLRATE: - if (dev) /* Patch manager */ - return -EIO; - /* * If *arg == 0, just return the current rate */ if (seq_mode == SEQ_2) return tmr->ioctl (tmr_no, cmd, arg); - if (ioctl_in (arg) != 0) + get_user (val, (int *) arg); + if (val != 0) return -EINVAL; return ioctl_out (arg, HZ); @@ -1674,9 +1621,6 @@ sequencer_ioctl (int dev, struct fileinfo *file, return -EBUSY; } - if (!orig_dev && pmgr_present[dev]) - pmgr_inform (dev, PM_E_PATCH_RESET, 0, 0, 0, 0); - err = synth_devs[dev]->ioctl (dev, cmd, arg); return err; } @@ -1708,7 +1652,9 @@ sequencer_ioctl (int dev, struct fileinfo *file, case SNDCTL_FM_4OP_ENABLE: { - int dev = ioctl_in (arg); + int dev; + + get_user (dev, (int *) arg); if (dev < 0 || dev >= num_synths) return -ENXIO; @@ -1777,98 +1723,11 @@ sequencer_ioctl (int dev, struct fileinfo *file, } break; - case SNDCTL_PMGR_IFACE: - { - struct patmgr_info *inf; - int dev, err; - - if ((inf = (struct patmgr_info *) vmalloc (sizeof (*inf))) == NULL) - { - printk ("patmgr: Can't allocate memory for a message\n"); - return -EIO; - } - - copy_from_user ((char *) inf, &((char *) arg)[0], sizeof (*inf)); - dev = inf->device; - - if (dev < 0 || dev >= num_synths) - { - vfree (inf); - return -ENXIO; - } - - if (!synth_devs[dev]->pmgr_interface) - { - vfree (inf); - return -ENXIO; - } - - if ((err = synth_devs[dev]->pmgr_interface (dev, inf)) == -1) - { - vfree (inf); - return err; - } - - { - char *fixit = (char *) inf; - - copy_to_user (&((char *) arg)[0], fixit, sizeof (*inf)); - }; - vfree (inf); - return 0; - } - break; - - case SNDCTL_PMGR_ACCESS: - { - struct patmgr_info *inf; - int dev, err; - - if ((inf = (struct patmgr_info *) vmalloc (sizeof (*inf))) == NULL) - { - printk ("patmgr: Can't allocate memory for a message\n"); - return -EIO; - } - - copy_from_user ((char *) inf, &((char *) arg)[0], sizeof (*inf)); - dev = inf->device; - - if (dev < 0 || dev >= num_synths) - { - vfree (inf); - return -ENXIO; - } - - if (!pmgr_present[dev]) - { - vfree (inf); - return -ESRCH; - } - - if ((err = pmgr_access (dev, inf)) < 0) - { - vfree (inf); - return err; - } - - { - char *fixit = (char *) inf; - - copy_to_user (&((char *) arg)[0], fixit, sizeof (*inf)); - }; - vfree (inf); - return 0; - } - break; - case SNDCTL_SEQ_THRESHOLD: { - int tmp = ioctl_in (arg); + int tmp; - if (dev) /* - * Patch manager - */ - return -EIO; + get_user (tmp, (int *) arg); if (tmp < 1) tmp = 1; @@ -1881,7 +1740,9 @@ sequencer_ioctl (int dev, struct fileinfo *file, case SNDCTL_MIDI_PRETIME: { - int val = ioctl_in (arg); + int val; + + get_user (val, (int *) arg); if (val < 0) val = 0; @@ -1893,11 +1754,6 @@ sequencer_ioctl (int dev, struct fileinfo *file, break; default: - if (dev) /* - * Patch manager - */ - return -EIO; - if (mode == OPEN_READ) return -EIO; diff --git a/drivers/sound/sound_calls.h b/drivers/sound/sound_calls.h index ad51adf671a7..0d943c6a2884 100644 --- a/drivers/sound/sound_calls.h +++ b/drivers/sound/sound_calls.h @@ -182,15 +182,6 @@ int probe_uart6850(struct address_info *hw_config); /* From opl3.c */ void enable_opl3_mode(int left, int right, int both); -/* From patmgr.c */ -int pmgr_open(int dev); -void pmgr_release(int dev); -int pmgr_read (int dev, struct fileinfo *file, char * buf, int count); -int pmgr_write (int dev, struct fileinfo *file, const char * buf, int count); -int pmgr_access(int dev, struct patmgr_info *rec); -int pmgr_inform(int dev, int event, unsigned long parm1, unsigned long parm2, - unsigned long parm3, unsigned long parm4); - /* From ics2101.c */ void ics2101_mixer_init(void); diff --git a/drivers/sound/sound_timer.c b/drivers/sound/sound_timer.c index 6195c132f487..eea01c3fe809 100644 --- a/drivers/sound/sound_timer.c +++ b/drivers/sound/sound_timer.c @@ -190,6 +190,8 @@ static int timer_ioctl (int dev, unsigned int cmd, caddr_t arg) { + int val; + switch (cmd) { case SNDCTL_TMR_SOURCE: @@ -213,49 +215,43 @@ timer_ioctl (int dev, break; case SNDCTL_TMR_TIMEBASE: - { - int val; - - get_user (val, (int *) arg); - - if (val) - { - if (val < 1) - val = 1; - if (val > 1000) - val = 1000; - curr_timebase = val; - } - - return ioctl_out (arg, curr_timebase); - } + get_user (val, (int *) arg); + + if (val) + { + if (val < 1) + val = 1; + if (val > 1000) + val = 1000; + curr_timebase = val; + } + + return ioctl_out (arg, curr_timebase); break; case SNDCTL_TMR_TEMPO: - { - int val; - - get_user (val, (int *) arg); - - if (val) - { - if (val < 8) - val = 8; - if (val > 250) - val = 250; - tmr_offs = tmr_ctr; - ticks_offs += tmr2ticks (tmr_ctr); - tmr_ctr = 0; - curr_tempo = val; - reprogram_timer (); - } - - return ioctl_out (arg, curr_tempo); - } + get_user (val, (int *) arg); + + if (val) + { + if (val < 8) + val = 8; + if (val > 250) + val = 250; + tmr_offs = tmr_ctr; + ticks_offs += tmr2ticks (tmr_ctr); + tmr_ctr = 0; + curr_tempo = val; + reprogram_timer (); + } + + return ioctl_out (arg, curr_tempo); break; case SNDCTL_SEQ_CTRLRATE: - if (ioctl_in (arg) != 0) /* Can't change */ + get_user (val, (int *) arg); + + if (val != 0) /* Can't change */ return -EINVAL; return ioctl_out (arg, ((curr_tempo * curr_timebase) + 30) / 60); diff --git a/drivers/sound/soundvers.h b/drivers/sound/soundvers.h index 5a8c4c8cd1e6..7c6870d25c2b 100644 --- a/drivers/sound/soundvers.h +++ b/drivers/sound/soundvers.h @@ -1,2 +1,2 @@ -#define SOUND_VERSION_STRING "3.7-beta6-961029" -#define SOUND_INTERNAL_VERSION 0x030701 +#define SOUND_VERSION_STRING "3.7-beta12-961115" +#define SOUND_INTERNAL_VERSION 0x030707 diff --git a/drivers/sound/sscape.c b/drivers/sound/sscape.c index 0cf0ed26ec72..644e25934fdc 100644 --- a/drivers/sound/sscape.c +++ b/drivers/sound/sscape.c @@ -813,18 +813,14 @@ attach_sscape (struct address_info *hw_config) devc->failed = 0; } -int -probe_sscape (struct address_info *hw_config) +static int +detect_ga (sscape_info * devc) { unsigned char save; - devc->base = hw_config->io_base; - devc->irq = hw_config->irq; - devc->dma = hw_config->dma; - - devc->failed = 1; + DDB (printk ("Entered Soundscape detect_ga(%x)\n", devc->base)); - if (sscape_detected != 0 && sscape_detected != hw_config->io_base) + if (check_region (devc->base, 8)) return 0; /* @@ -877,6 +873,25 @@ probe_sscape (struct address_info *hw_config) return 0; } + return 1; +} + +int +probe_sscape (struct address_info *hw_config) +{ + + devc->base = hw_config->io_base; + devc->irq = hw_config->irq; + devc->dma = hw_config->dma; + + if (sscape_detected != 0 && sscape_detected != hw_config->io_base) + return 0; + + devc->failed = 1; + + if (!detect_ga (devc)) + return 0; + #ifdef SSCAPE_DEBUG1 /* * Temporary debugging aid. Print contents of the registers before diff --git a/drivers/sound/sys_timer.c b/drivers/sound/sys_timer.c index 8904e9fd0181..bec7445880e5 100644 --- a/drivers/sound/sys_timer.c +++ b/drivers/sound/sys_timer.c @@ -253,10 +253,15 @@ def_tmr_ioctl (int dev, break; case SNDCTL_SEQ_CTRLRATE: - if (ioctl_in (arg) != 0) /* Can't change */ - return -EINVAL; + { + int val; - return ioctl_out (arg, ((curr_tempo * curr_timebase) + 30) / 60); + get_user (val, (int *) arg); + if (val != 0) /* Can't change */ + return -EINVAL; + + return ioctl_out (arg, ((curr_tempo * curr_timebase) + 30) / 60); + } break; case SNDCTL_SEQ_GETTIME: diff --git a/drivers/sound/uart6850.c b/drivers/sound/uart6850.c index f86b13895437..1043cfcb3629 100644 --- a/drivers/sound/uart6850.c +++ b/drivers/sound/uart6850.c @@ -14,6 +14,7 @@ * added 6850 support, used with COVOX SoundMaster II and custom cards. */ +#include #include "sound_config.h" #if defined(CONFIG_UART6850) && defined(CONFIG_MIDI) diff --git a/drivers/sound/vivo.c b/drivers/sound/vivo.c new file mode 100644 index 000000000000..d3296064c607 --- /dev/null +++ b/drivers/sound/vivo.c @@ -0,0 +1,19 @@ + +/* + * sound/vivo.c + * + * Support routines for Ensoniq Soundscape VIVO. The actual driver is + * in the vivo subdirectory. + */ +/* + * Copyright (C) by Hannu Savolainen 1993-1996 + * + * OSS/Free for Linux is distributed under the GNU GENERAL PUBLIC LICENSE (GPL) + * Version 2 (June 1991). See the "COPYING" file distributed with this software + * for more info. + */ + +#include "sound_config.h" + +extern void otto_init (int options); +extern void synth_init (void); diff --git a/include/asm-alpha/checksum.h b/include/asm-alpha/checksum.h index ff42ed9f858c..26c67252122d 100644 --- a/include/asm-alpha/checksum.h +++ b/include/asm-alpha/checksum.h @@ -39,7 +39,7 @@ extern unsigned int csum_partial(const unsigned char * buff, int len, unsigned i * here even more important to align src and dst on a 32-bit (or even * better 64-bit) boundary */ -unsigned int csum_partial_copy( const char *src, char *dst, int len, int sum); +unsigned int csum_partial_copy(const char *src, char *dst, int len, unsigned int sum); /* * the same as csum_partial, but copies from user space (but on the alpha diff --git a/include/asm-alpha/socket.h b/include/asm-alpha/socket.h index 47bdbf7ce818..a35c31dd237e 100644 --- a/include/asm-alpha/socket.h +++ b/include/asm-alpha/socket.h @@ -27,6 +27,10 @@ #define SO_ERROR 0x1007 #define SO_SNDBUF 0x1001 #define SO_RCVBUF 0x1002 +#define SO_RCVLOWAT 0x1010 +#define SO_SNDLOWAT 0x1011 +#define SO_RCVTIMEO 0x1012 +#define SO_SNDTIMEO 0x1013 /* linux-specific, might as well be the same as on i386 */ #define SO_NO_CHECK 11 diff --git a/include/linux/ctype.h b/include/linux/ctype.h index 838ef933d16c..bac58b52f1eb 100644 --- a/include/linux/ctype.h +++ b/include/linux/ctype.h @@ -1,6 +1,11 @@ #ifndef _LINUX_CTYPE_H #define _LINUX_CTYPE_H +/* + * NOTE! This ctype does not handle EOF like the standarc C + * library is required to. + */ + #define _U 0x01 /* upper */ #define _L 0x02 /* lower */ #define _D 0x04 /* digit */ @@ -11,24 +16,39 @@ #define _SP 0x80 /* hard space (0x20) */ extern unsigned char _ctype[]; -extern char _ctmp; - -#define isalnum(c) ((_ctype+1)[c]&(_U|_L|_D)) -#define isalpha(c) ((_ctype+1)[c]&(_U|_L)) -#define iscntrl(c) ((_ctype+1)[c]&(_C)) -#define isdigit(c) ((_ctype+1)[c]&(_D)) -#define isgraph(c) ((_ctype+1)[c]&(_P|_U|_L|_D)) -#define islower(c) ((_ctype+1)[c]&(_L)) -#define isprint(c) ((_ctype+1)[c]&(_P|_U|_L|_D|_SP)) -#define ispunct(c) ((_ctype+1)[c]&(_P)) -#define isspace(c) ((_ctype+1)[c]&(_S)) -#define isupper(c) ((_ctype+1)[c]&(_U)) -#define isxdigit(c) ((_ctype+1)[c]&(_D|_X)) - -#define isascii(c) (((unsigned) c)<=0x7f) -#define toascii(c) (((unsigned) c)&0x7f) - -#define tolower(c) (_ctmp=c,isupper(_ctmp)?_ctmp-('A'-'a'):_ctmp) -#define toupper(c) (_ctmp=c,islower(_ctmp)?_ctmp-('a'-'A'):_ctmp) + +#define __ismask(x) (_ctype[(int)(unsigned char)(x)]) + +#define isalnum(c) ((__ismask(c)&(_U|_L|_D)) != 0) +#define isalpha(c) ((__ismask(c)&(_U|_L)) != 0) +#define iscntrl(c) ((__ismask(c)&(_C)) != 0) +#define isdigit(c) ((__ismask(c)&(_D)) != 0) +#define isgraph(c) ((__ismask(c)&(_P|_U|_L|_D)) != 0) +#define islower(c) ((__ismask(c)&(_L)) != 0) +#define isprint(c) ((__ismask(c)&(_P|_U|_L|_D|_SP)) != 0) +#define ispunct(c) ((__ismask(c)&(_P)) != 0) +#define isspace(c) ((__ismask(c)&(_S)) != 0) +#define isupper(c) ((__ismask(c)&(_U)) != 0) +#define isxdigit(c) ((__ismask(c)&(_D|_X)) != 0) + +#define isascii(c) (((unsigned char)(c))<=0x7f) +#define toascii(c) (((unsigned char)(c))&0x7f) + +static inline unsigned char __tolower(unsigned char c) +{ + if (isupper(c)) + c -= 'A'-'a'; + return c; +} + +static inline unsigned char __toupper(unsigned char c) +{ + if (islower(c)) + c -= 'a'-'A'; + return c; +} + +#define tolower(c) __tolower(c) +#define toupper(c) __toupper(c) #endif diff --git a/include/linux/kdev_t.h b/include/linux/kdev_t.h index 0497ea8cc198..a06cdb9ed193 100644 --- a/include/linux/kdev_t.h +++ b/include/linux/kdev_t.h @@ -62,13 +62,13 @@ aeb - 950811 However, everything runs fine with an arbitrary kdev_t type. */ #define MINORBITS 8 -#define MINORMASK ((1<> MINORBITS) -#define MINOR(dev) ((dev) & MINORMASK) -#define HASHDEV(dev) (dev) +#define MAJOR(dev) ((unsigned int) ((dev) >> MINORBITS)) +#define MINOR(dev) ((unsigned int) ((dev) & MINORMASK)) +#define HASHDEV(dev) ((unsigned int) (dev)) #define NODEV 0 #define MKDEV(ma,mi) (((ma) << MINORBITS) | (mi)) #define B_FREE 0xffff /* yuk */ diff --git a/include/linux/net.h b/include/linux/net.h index 5673b7e42077..a338a8efda66 100644 --- a/include/linux/net.h +++ b/include/linux/net.h @@ -92,14 +92,14 @@ struct proto_ops { int (*dup) (struct socket *newsock, struct socket *oldsock); int (*release) (struct socket *sock, struct socket *peer); int (*bind) (struct socket *sock, struct sockaddr *umyaddr, - size_t sockaddr_len); + int sockaddr_len); int (*connect) (struct socket *sock, struct sockaddr *uservaddr, - size_t sockaddr_len, int flags); + int sockaddr_len, int flags); int (*socketpair) (struct socket *sock1, struct socket *sock2); int (*accept) (struct socket *sock, struct socket *newsock, int flags); int (*getname) (struct socket *sock, struct sockaddr *uaddr, - size_t *usockaddr_len, int peer); + int *usockaddr_len, int peer); int (*select) (struct socket *sock, int sel_type, select_table *wait); int (*ioctl) (struct socket *sock, unsigned int cmd, diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h index 342e5a3352a9..da7763da3318 100644 --- a/include/linux/skbuff.h +++ b/include/linux/skbuff.h @@ -88,8 +88,8 @@ struct sk_buff struct neighbour *nexthop; #endif - unsigned long len; /* Length of actual data */ - unsigned long csum; /* Checksum */ + unsigned int len; /* Length of actual data */ + unsigned int csum; /* Checksum */ __u32 saddr; /* IP source address */ __u32 daddr; /* IP target address */ __u32 raddr; /* IP next hop address */ @@ -171,13 +171,13 @@ extern void skb_device_lock(struct sk_buff *skb); extern void skb_device_unlock(struct sk_buff *skb); extern void dev_kfree_skb(struct sk_buff *skb, int mode); extern int skb_device_locked(struct sk_buff *skb); -extern unsigned char * skb_put(struct sk_buff *skb, int len); -extern unsigned char * skb_push(struct sk_buff *skb, int len); -extern unsigned char * skb_pull(struct sk_buff *skb, int len); +extern unsigned char * skb_put(struct sk_buff *skb, unsigned int len); +extern unsigned char * skb_push(struct sk_buff *skb, unsigned int len); +extern unsigned char * skb_pull(struct sk_buff *skb, unsigned int len); extern int skb_headroom(struct sk_buff *skb); extern int skb_tailroom(struct sk_buff *skb); -extern void skb_reserve(struct sk_buff *skb, int len); -extern void skb_trim(struct sk_buff *skb, int len); +extern void skb_reserve(struct sk_buff *skb, unsigned int len); +extern void skb_trim(struct sk_buff *skb, unsigned int len); extern __inline__ int skb_queue_empty(struct sk_buff_head *list) { @@ -410,7 +410,7 @@ extern __inline__ void skb_unlink(struct sk_buff *skb) * Add data to an sk_buff */ -extern __inline__ unsigned char *skb_put(struct sk_buff *skb, int len) +extern __inline__ unsigned char *skb_put(struct sk_buff *skb, unsigned int len) { extern char *skb_put_errstr; unsigned char *tmp=skb->tail; @@ -425,7 +425,7 @@ here: return tmp; } -extern __inline__ unsigned char *skb_push(struct sk_buff *skb, int len) +extern __inline__ unsigned char *skb_push(struct sk_buff *skb, unsigned int len) { extern char *skb_push_errstr; skb->data-=len; @@ -439,9 +439,9 @@ here: return skb->data; } -extern __inline__ unsigned char * skb_pull(struct sk_buff *skb, int len) +extern __inline__ unsigned char * skb_pull(struct sk_buff *skb, unsigned int len) { - if(len > skb->len) + if (len > skb->len) return NULL; skb->data+=len; skb->len-=len; @@ -458,18 +458,17 @@ extern __inline__ int skb_tailroom(struct sk_buff *skb) return skb->end-skb->tail; } -extern __inline__ void skb_reserve(struct sk_buff *skb, int len) +extern __inline__ void skb_reserve(struct sk_buff *skb, unsigned int len) { skb->data+=len; skb->tail+=len; } -extern __inline__ void skb_trim(struct sk_buff *skb, int len) +extern __inline__ void skb_trim(struct sk_buff *skb, unsigned int len) { - if(skb->len>len) - { - skb->len=len; - skb->tail=skb->data+len; + if (skb->len > len) { + skb->len = len; + skb->tail = skb->data+len; } } diff --git a/include/linux/socket.h b/include/linux/socket.h index 9c8e228dc2ff..4c3db533967d 100644 --- a/include/linux/socket.h +++ b/include/linux/socket.h @@ -31,7 +31,7 @@ struct linger { struct msghdr { void * msg_name; /* Socket name */ - size_t msg_namelen; /* Length of name */ + int msg_namelen; /* Length of name */ struct iovec * msg_iov; /* Data blocks */ size_t msg_iovlen; /* Number of blocks */ void * msg_control; /* Per protocol magic (eg BSD file descriptor passing) */ diff --git a/include/linux/soundcard.h b/include/linux/soundcard.h index 6254c2440cde..3b6af75fa412 100644 --- a/include/linux/soundcard.h +++ b/include/linux/soundcard.h @@ -117,17 +117,15 @@ #define SNDCTL_SEQ_GETOUTCOUNT _SIOR ('Q', 4, int) #define SNDCTL_SEQ_GETINCOUNT _SIOR ('Q', 5, int) #define SNDCTL_SEQ_PERCMODE _SIOW ('Q', 6, int) -#define SNDCTL_FM_LOAD_INSTR _SIOW ('Q', 7, struct sbi_instrument) /* Valid for FM only */ +#define SNDCTL_FM_LOAD_INSTR _SIOW ('Q', 7, struct sbi_instrument) /* Obsolete */ #define SNDCTL_SEQ_TESTMIDI _SIOW ('Q', 8, int) #define SNDCTL_SEQ_RESETSAMPLES _SIOW ('Q', 9, int) #define SNDCTL_SEQ_NRSYNTHS _SIOR ('Q',10, int) #define SNDCTL_SEQ_NRMIDIS _SIOR ('Q',11, int) #define SNDCTL_MIDI_INFO _SIOWR('Q',12, struct midi_info) #define SNDCTL_SEQ_THRESHOLD _SIOW ('Q',13, int) -#define SNDCTL_SEQ_TRESHOLD SNDCTL_SEQ_THRESHOLD /* there was once a typo */ #define SNDCTL_SYNTH_MEMAVL _SIOWR('Q',14, int) /* in=dev#, out=memsize */ #define SNDCTL_FM_4OP_ENABLE _SIOW ('Q',15, int) /* in=dev# */ -#define SNDCTL_PMGR_ACCESS _SIOWR('Q',16, struct patmgr_info) #define SNDCTL_SEQ_PANIC _SIO ('Q',17) #define SNDCTL_SEQ_OUTOFBAND _SIOW ('Q',18, struct seq_event_rec) #define SNDCTL_SEQ_GETTIME _SIOR ('Q',19, int) @@ -197,6 +195,9 @@ struct patch_info { #define WAVE_TREMOLO 0x00020000 /* The tremolo info is valid */ #define WAVE_SCALE 0x00040000 /* The scaling info is valid */ #define WAVE_FRACTIONS 0x00080000 /* Fraction information is valid */ +/* Reserved bits */ +#define WAVE_ROM 0x40000000 /* For future use */ +#define WAVE_MULAW 0x20000000 /* For future use */ /* Other bits must be zeroed */ int len; /* Size of the wave data in bytes */ @@ -250,7 +251,8 @@ struct patch_info { int volume; int fractions; - int spare[3]; + int reserved1; + int spare[2]; char data[1]; /* The waveform data starts here */ }; @@ -263,90 +265,6 @@ struct sysex_info { unsigned char data[1]; /* Sysex data starts here */ }; -/* - * Patch management interface (/dev/sequencer, /dev/patmgr#) - * Don't use these calls if you want to maintain compatibility with - * the future versions of the driver. - */ - -#define PS_NO_PATCHES 0 /* No patch support on device */ -#define PS_MGR_NOT_OK 1 /* Plain patch support (no mgr) */ -#define PS_MGR_OK 2 /* Patch manager supported */ -#define PS_MANAGED 3 /* Patch manager running */ - -#define SNDCTL_PMGR_IFACE _SIOWR('P', 1, struct patmgr_info) - -/* - * The patmgr_info is a fixed size structure which is used for two - * different purposes. The intended use is for communication between - * the application using /dev/sequencer and the patch manager daemon - * associated with a synthesizer device (ioctl(SNDCTL_PMGR_ACCESS)). - * - * This structure is also used with ioctl(SNDCTL_PGMR_IFACE) which allows - * a patch manager daemon to read and write device parameters. This - * ioctl available through /dev/sequencer also. Avoid using it since it's - * extremely hardware dependent. In addition access trough /dev/sequencer - * may confuse the patch manager daemon. - */ - -struct patmgr_info { - unsigned int key; /* Don't worry. Reserved for communication - between the patch manager and the driver. */ -#define PM_K_EVENT 1 /* Event from the /dev/sequencer driver */ -#define PM_K_COMMAND 2 /* Request from an application */ -#define PM_K_RESPONSE 3 /* From patmgr to application */ -#define PM_ERROR 4 /* Error returned by the patmgr */ - int device; - int command; - -/* - * Commands 0x000 to 0xfff reserved for patch manager programs - */ -#define PM_GET_DEVTYPE 1 /* Returns type of the patch mgr interface of dev */ -#define PMTYPE_FM2 1 /* 2 OP fm */ -#define PMTYPE_FM4 2 /* Mixed 4 or 2 op FM (OPL-3) */ -#define PMTYPE_WAVE 3 /* Wave table synthesizer (GUS) */ -#define PM_GET_NRPGM 2 /* Returns max # of midi programs in parm1 */ -#define PM_GET_PGMMAP 3 /* Returns map of loaded midi programs in data8 */ -#define PM_GET_PGM_PATCHES 4 /* Return list of patches of a program (parm1) */ -#define PM_GET_PATCH 5 /* Return patch header of patch parm1 */ -#define PM_SET_PATCH 6 /* Set patch header of patch parm1 */ -#define PM_READ_PATCH 7 /* Read patch (wave) data */ -#define PM_WRITE_PATCH 8 /* Write patch (wave) data */ - -/* - * Commands 0x1000 to 0xffff are for communication between the patch manager - * and the client - */ -#define _PM_LOAD_PATCH 0x100 - -/* - * Commands above 0xffff reserved for device specific use - */ - - int parm1; - int parm2; - int parm3; - - union { - unsigned char data8[4000]; - unsigned short data16[2000]; - unsigned int data32[1000]; - struct patch_info patch; - } data; - }; - -/* - * When a patch manager daemon is present, it will be informed by the - * driver when something important happens. For example when the - * /dev/sequencer is opened or closed. A record with key == PM_K_EVENT is - * returned. The command field contains the event type: - */ -#define PM_E_OPENED 1 /* /dev/sequencer opened */ -#define PM_E_CLOSED 2 /* /dev/sequencer closed */ -#define PM_E_PATCH_RESET 3 /* SNDCTL_RESETSAMPLES called */ -#define PM_E_PATCH_LOADED 4 /* A patch has been loaded by appl */ - /* * /dev/sequencer input events. * @@ -1036,7 +954,6 @@ void seqbuf_dump(void); /* This function must be provided by programs */ #define SEQ_DEFINEBUF(len) unsigned char _seqbuf[len]; int _seqbuflen = len;int _seqbufptr = 0 #define SEQ_USE_EXTBUF() extern unsigned char _seqbuf[]; extern int _seqbuflen;extern int _seqbufptr #define SEQ_DECLAREBUF() SEQ_USE_EXTBUF() -#define SEQ_PM_DEFINES struct patmgr_info _pm_info #define _SEQ_NEEDBUF(len) if ((_seqbufptr+(len)) > _seqbuflen) seqbuf_dump() #define _SEQ_ADVBUF(len) _seqbufptr += len #define SEQ_DUMPBUF seqbuf_dump @@ -1058,15 +975,6 @@ void seqbuf_dump(void); /* This function must be provided by programs */ #define _SEQ_NEEDBUF(len) /* empty */ #endif -#define PM_LOAD_PATCH(dev, bank, pgm) (SEQ_DUMPBUF(), _pm_info.command = _PM_LOAD_PATCH, \ - _pm_info.device=dev, _pm_info.data.data8[0]=pgm, \ - _pm_info.parm1 = bank, _pm_info.parm2 = 1, \ - ioctl(seqfd, SNDCTL_PMGR_ACCESS, &_pm_info)) -#define PM_LOAD_PATCHES(dev, bank, pgm) (SEQ_DUMPBUF(), _pm_info.command = _PM_LOAD_PATCH, \ - _pm_info.device=dev, memcpy(_pm_info.data.data8, pgm, 128), \ - _pm_info.parm1 = bank, _pm_info.parm2 = 128, \ - ioctl(seqfd, SNDCTL_PMGR_ACCESS, &_pm_info)) - #define SEQ_VOLUME_MODE(dev, mode) {_SEQ_NEEDBUF(8);\ _seqbuf[_seqbufptr] = SEQ_EXTENDED;\ _seqbuf[_seqbufptr+1] = SEQ_VOLMODE;\ diff --git a/include/linux/stddef.h b/include/linux/stddef.h index c6221e7126af..39da8088d942 100644 --- a/include/linux/stddef.h +++ b/include/linux/stddef.h @@ -1,11 +1,6 @@ #ifndef _LINUX_STDDEF_H #define _LINUX_STDDEF_H -#ifndef _SIZE_T -#define _SIZE_T -typedef unsigned int size_t; -#endif - #undef NULL #define NULL ((void *)0) diff --git a/include/linux/swap.h b/include/linux/swap.h index 6cfb7df0bb9d..18fe74e8eff4 100644 --- a/include/linux/swap.h +++ b/include/linux/swap.h @@ -22,10 +22,10 @@ struct swap_info_struct { struct inode * swap_file; unsigned char * swap_map; unsigned char * swap_lockmap; - int lowest_bit; - int highest_bit; - int cluster_next; - int cluster_nr; + unsigned int lowest_bit; + unsigned int highest_bit; + unsigned int cluster_next; + unsigned int cluster_nr; int prio; /* swap priority */ int pages; unsigned long max; @@ -70,7 +70,7 @@ extern unsigned long init_swap_cache(unsigned long, unsigned long); extern void swap_duplicate(unsigned long); /* linux/mm/swapfile.c */ -extern int nr_swapfiles; +extern unsigned int nr_swapfiles; extern struct swap_info_struct swap_info[]; void si_swapinfo(struct sysinfo *); unsigned long get_swap_page(void); diff --git a/include/linux/swapctl.h b/include/linux/swapctl.h index 896910de829a..c85aa6c24802 100644 --- a/include/linux/swapctl.h +++ b/include/linux/swapctl.h @@ -11,21 +11,21 @@ enum RCL_POLICY {RCL_ROUND_ROBIN, RCL_BUFF_FIRST, RCL_PERSIST}; typedef struct swap_control_v5 { - int sc_max_page_age; - int sc_page_advance; - int sc_page_decline; - int sc_page_initial_age; - int sc_max_buff_age; - int sc_buff_advance; - int sc_buff_decline; - int sc_buff_initial_age; - int sc_age_cluster_fract; - int sc_age_cluster_min; - int sc_pageout_weight; - int sc_bufferout_weight; - int sc_buffer_grace; - int sc_nr_buffs_to_free; - int sc_nr_pages_to_free; + unsigned int sc_max_page_age; + unsigned int sc_page_advance; + unsigned int sc_page_decline; + unsigned int sc_page_initial_age; + unsigned int sc_max_buff_age; + unsigned int sc_buff_advance; + unsigned int sc_buff_decline; + unsigned int sc_buff_initial_age; + unsigned int sc_age_cluster_fract; + unsigned int sc_age_cluster_min; + unsigned int sc_pageout_weight; + unsigned int sc_bufferout_weight; + unsigned int sc_buffer_grace; + unsigned int sc_nr_buffs_to_free; + unsigned int sc_nr_pages_to_free; enum RCL_POLICY sc_policy; } swap_control_v5; typedef struct swap_control_v5 swap_control_t; @@ -33,22 +33,22 @@ extern swap_control_t swap_control; typedef struct kswapd_control_v1 { - int maxpages; - int pages_buff; - int pages_shm; - int pages_mmap; - int pages_swap; + unsigned int maxpages; + unsigned int pages_buff; + unsigned int pages_shm; + unsigned int pages_mmap; + unsigned int pages_swap; } kswapd_control_v1; typedef kswapd_control_v1 kswapd_control_t; extern kswapd_control_t kswapd_ctl; typedef struct swapstat_v1 { - int wakeups; - int pages_reclaimed; - int pages_shm; - int pages_mmap; - int pages_swap; + unsigned int wakeups; + unsigned int pages_reclaimed; + unsigned int pages_shm; + unsigned int pages_mmap; + unsigned int pages_swap; } swapstat_v1; typedef swapstat_v1 swapstat_t; extern swapstat_t swapstats; @@ -94,7 +94,7 @@ extern int min_free_pages, free_pages_low, free_pages_high; * scan the resource list. */ static inline int AGE_CLUSTER_SIZE(int resources) { - int n = (resources * AGE_CLUSTER_FRACT) >> 10; + unsigned int n = (resources * AGE_CLUSTER_FRACT) >> 10; if (n < AGE_CLUSTER_MIN) return AGE_CLUSTER_MIN; else diff --git a/include/linux/wait.h b/include/linux/wait.h index 46f1e4f19106..be24fa2423a8 100644 --- a/include/linux/wait.h +++ b/include/linux/wait.h @@ -8,6 +8,8 @@ #ifdef __KERNEL__ +#include + struct wait_queue { struct task_struct * task; struct wait_queue * next; @@ -32,11 +34,11 @@ struct select_table_entry { }; typedef struct select_table_struct { - int nr; + unsigned int nr; struct select_table_entry * entry; } select_table; -#define __MAX_SELECT_TABLE_ENTRIES (4096 / sizeof (struct select_table_entry)) +#define __MAX_SELECT_TABLE_ENTRIES (PAGE_SIZE / sizeof (struct select_table_entry)) #endif /* __KERNEL__ */ diff --git a/include/net/inet_common.h b/include/net/inet_common.h index 7fa56112d0dd..c72c7533336b 100644 --- a/include/net/inet_common.h +++ b/include/net/inet_common.h @@ -17,7 +17,7 @@ extern int inet_release(struct socket *sock, struct socket *peer); extern int inet_connect(struct socket *sock, struct sockaddr * uaddr, - size_t addr_len, int flags); + int addr_len, int flags); extern int inet_accept(struct socket *sock, struct socket *newsock, int flags); extern int inet_recvmsg(struct socket *sock, diff --git a/include/net/sock.h b/include/net/sock.h index 10aa486d474a..055aae19cb17 100644 --- a/include/net/sock.h +++ b/include/net/sock.h @@ -517,7 +517,7 @@ struct proto unsigned long timeout); int (*connect)(struct sock *sk, struct sockaddr *uaddr, - size_t addr_len); + int addr_len); struct sock * (*accept) (struct sock *sk, int flags); void (*retransmit)(struct sock *sk, int all); @@ -543,7 +543,7 @@ struct proto int len, int noblock, int flags, int *addr_len); int (*bind)(struct sock *sk, - struct sockaddr *uaddr, size_t addr_len); + struct sockaddr *uaddr, int addr_len); int (*backlog_rcv) (struct sock *sk, struct sk_buff *skb); diff --git a/include/net/tcp.h b/include/net/tcp.h index aa1e74bb2b22..23fd545018f8 100644 --- a/include/net/tcp.h +++ b/include/net/tcp.h @@ -316,7 +316,7 @@ extern int tcp_v4_backlog_rcv(struct sock *sk, struct sk_buff *skb); extern int tcp_v4_connect(struct sock *sk, struct sockaddr *uaddr, - size_t addr_len); + int addr_len); extern void tcp_read_wakeup(struct sock *); diff --git a/include/net/transp_v6.h b/include/net/transp_v6.h index 2bce60f38fef..412943e4d1bc 100644 --- a/include/net/transp_v6.h +++ b/include/net/transp_v6.h @@ -19,7 +19,7 @@ extern void tcpv6_init(void); extern int udpv6_connect(struct sock *sk, struct sockaddr *uaddr, - size_t addr_len); + int addr_len); extern int datagram_recv_ctl(struct sock *sk, struct msghdr *msg, diff --git a/include/net/udp.h b/include/net/udp.h index 5a86f93fc7f5..d834feb6d5e7 100644 --- a/include/net/udp.h +++ b/include/net/udp.h @@ -37,7 +37,7 @@ extern void udp_err(int type, int code, unsigned char *header, extern void udp_send_check(struct udphdr *uh, __u32 saddr, __u32 daddr, int len, struct sock *sk); extern int udp_connect(struct sock *sk, - struct sockaddr *usin, size_t addr_len); + struct sockaddr *usin, int addr_len); extern int udp_sendmsg(struct sock *sk, struct msghdr *msg, int len, int noblock, int flags); diff --git a/init/main.c b/init/main.c index 2119f0e12ffb..310afe82f5dc 100644 --- a/init/main.c +++ b/init/main.c @@ -482,8 +482,7 @@ unsigned long loops_per_sec = (1<<12); void calibrate_delay(void) { - int ticks; - int loopbit; + unsigned long ticks, loopbit; int lps_precision = LPS_PREC; loops_per_sec = (1<<12); diff --git a/kernel/fork.c b/kernel/fork.c index 617e7d3ed180..864bc52e8497 100644 --- a/kernel/fork.c +++ b/kernel/fork.c @@ -15,7 +15,6 @@ #include #include #include -#include #include #include #include diff --git a/lib/ctype.c b/lib/ctype.c index c5be264127af..b5f72a5763ac 100644 --- a/lib/ctype.c +++ b/lib/ctype.c @@ -6,8 +6,7 @@ #include -char _ctmp; -unsigned char _ctype[] = {0x00, /* EOF */ +unsigned char _ctype[] = { _C,_C,_C,_C,_C,_C,_C,_C, /* 0-7 */ _C,_C|_S,_C|_S,_C|_S,_C|_S,_C|_S,_C,_C, /* 8-15 */ _C,_C,_C,_C,_C,_C,_C,_C, /* 16-23 */ diff --git a/mm/filemap.c b/mm/filemap.c index bc785801c238..d5cca2d86ad3 100644 --- a/mm/filemap.c +++ b/mm/filemap.c @@ -127,7 +127,7 @@ repeat: int shrink_mmap(int priority, int dma) { - static int clock = 0; + static unsigned long clock = 0; struct page * page; unsigned long limit = max_mapnr; struct buffer_head *tmp, *bh; diff --git a/mm/swapfile.c b/mm/swapfile.c index c35a7ffc1e13..fe3bc0b91572 100644 --- a/mm/swapfile.c +++ b/mm/swapfile.c @@ -25,7 +25,8 @@ #include #include -int nr_swapfiles = 0; +unsigned int nr_swapfiles = 0; + static struct { int head; /* head of priority-ordered swapfile list */ int next; /* swapfile to be used next */ @@ -36,7 +37,7 @@ struct swap_info_struct swap_info[MAX_SWAPFILES]; static inline int scan_swap_map(struct swap_info_struct *si) { - int offset; + unsigned long offset; /* * We try to cluster swap pages by allocating them * sequentially in swap. Once we've allocated diff --git a/net/appletalk/ddp.c b/net/appletalk/ddp.c index 24758530a71b..211842144074 100644 --- a/net/appletalk/ddp.c +++ b/net/appletalk/ddp.c @@ -1234,7 +1234,7 @@ static int atalk_autobind(atalk_socket *sk) * Set the address 'our end' of the connection. */ -static int atalk_bind(struct socket *sock, struct sockaddr *uaddr,size_t addr_len) +static int atalk_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len) { atalk_socket *sk; struct sockaddr_at *addr=(struct sockaddr_at *)uaddr; @@ -1289,7 +1289,7 @@ static int atalk_bind(struct socket *sock, struct sockaddr *uaddr,size_t addr_le */ static int atalk_connect(struct socket *sock, struct sockaddr *uaddr, - size_t addr_len, int flags) + int addr_len, int flags) { atalk_socket *sk=(atalk_socket *)sock->data; struct sockaddr_at *addr; @@ -1350,7 +1350,7 @@ static int atalk_accept(struct socket *sock, struct socket *newsock, int flags) */ static int atalk_getname(struct socket *sock, struct sockaddr *uaddr, - size_t *uaddr_len, int peer) + int *uaddr_len, int peer) { struct sockaddr_at sat; atalk_socket *sk; diff --git a/net/ax25/af_ax25.c b/net/ax25/af_ax25.c index d5c8322bab58..7d08fed107c4 100644 --- a/net/ax25/af_ax25.c +++ b/net/ax25/af_ax25.c @@ -1368,7 +1368,7 @@ static int ax25_release(struct socket *sock, struct socket *peer) * BSD 4.4 ADDIFADDR type support. It is however small and trivially backward * compatible 8) */ -static int ax25_bind(struct socket *sock, struct sockaddr *uaddr,size_t addr_len) +static int ax25_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len) { struct sock *sk; struct full_sockaddr_ax25 *addr = (struct full_sockaddr_ax25 *)uaddr; @@ -1431,7 +1431,7 @@ static int ax25_bind(struct socket *sock, struct sockaddr *uaddr,size_t addr_len } static int ax25_connect(struct socket *sock, struct sockaddr *uaddr, - size_t addr_len, int flags) + int addr_len, int flags) { struct sock *sk = (struct sock *)sock->data; struct sockaddr_ax25 *addr = (struct sockaddr_ax25 *)uaddr; @@ -1608,7 +1608,7 @@ static int ax25_accept(struct socket *sock, struct socket *newsock, int flags) } static int ax25_getname(struct socket *sock, struct sockaddr *uaddr, - size_t *uaddr_len, int peer) + int *uaddr_len, int peer) { struct full_sockaddr_ax25 *sax = (struct full_sockaddr_ax25 *)uaddr; struct sock *sk; diff --git a/net/core/skbuff.c b/net/core/skbuff.c index 0fb11f1178e8..a4c3cc6fa768 100644 --- a/net/core/skbuff.c +++ b/net/core/skbuff.c @@ -505,7 +505,7 @@ void __skb_unlink(struct sk_buff *skb) * Add data to an sk_buff */ -unsigned char *skb_put(struct sk_buff *skb, int len) +unsigned char *skb_put(struct sk_buff *skb, unsigned int len) { unsigned char *tmp=skb->tail; IS_SKB(skb); @@ -517,7 +517,7 @@ unsigned char *skb_put(struct sk_buff *skb, int len) return tmp; } -unsigned char *skb_push(struct sk_buff *skb, int len) +unsigned char *skb_push(struct sk_buff *skb, unsigned int len) { IS_SKB(skb); skb->data-=len; @@ -528,7 +528,7 @@ unsigned char *skb_push(struct sk_buff *skb, int len) return skb->data; } -unsigned char * skb_pull(struct sk_buff *skb, int len) +unsigned char * skb_pull(struct sk_buff *skb, unsigned int len) { IS_SKB(skb); if(len>skb->len) @@ -550,7 +550,7 @@ int skb_tailroom(struct sk_buff *skb) return skb->end-skb->tail; } -void skb_reserve(struct sk_buff *skb, int len) +void skb_reserve(struct sk_buff *skb, unsigned int len) { IS_SKB(skb); skb->data+=len; @@ -562,7 +562,7 @@ void skb_reserve(struct sk_buff *skb, int len) IS_SKB(skb); } -void skb_trim(struct sk_buff *skb, int len) +void skb_trim(struct sk_buff *skb, unsigned int len) { IS_SKB(skb); if(skb->len>len) diff --git a/net/ipv4/af_inet.c b/net/ipv4/af_inet.c index b28fc1e0c764..34379849d5cc 100644 --- a/net/ipv4/af_inet.c +++ b/net/ipv4/af_inet.c @@ -767,7 +767,7 @@ int inet_release(struct socket *sock, struct socket *peer) static int inet_bind(struct socket *sock, struct sockaddr *uaddr, - size_t addr_len) + int addr_len) { struct sockaddr_in *addr=(struct sockaddr_in *)uaddr; struct sock *sk=(struct sock *)sock->data, *sk2; @@ -923,7 +923,7 @@ static int inet_bind(struct socket *sock, struct sockaddr *uaddr, */ int inet_connect(struct socket *sock, struct sockaddr * uaddr, - size_t addr_len, int flags) + int addr_len, int flags) { struct sock *sk=(struct sock *)sock->data; int err; @@ -1090,7 +1090,7 @@ int inet_accept(struct socket *sock, struct socket *newsock, int flags) */ static int inet_getname(struct socket *sock, struct sockaddr *uaddr, - size_t *uaddr_len, int peer) + int *uaddr_len, int peer) { struct sockaddr_in *sin=(struct sockaddr_in *)uaddr; struct sock *sk; diff --git a/net/ipv4/packet.c b/net/ipv4/packet.c index 66f79cc446eb..89dd6549e7e3 100644 --- a/net/ipv4/packet.c +++ b/net/ipv4/packet.c @@ -282,7 +282,7 @@ int packet_attach(struct sock *sk, struct device *dev) * Bind a packet socket to a device */ -static int packet_bind(struct sock *sk, struct sockaddr *uaddr, size_t addr_len) +static int packet_bind(struct sock *sk, struct sockaddr *uaddr, int addr_len) { char name[15]; struct device *dev; diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c index fcc139056631..a36860c7a447 100644 --- a/net/ipv4/tcp_ipv4.c +++ b/net/ipv4/tcp_ipv4.c @@ -127,7 +127,7 @@ static int tcp_unique_address(u32 saddr, u16 snum, u32 daddr, u16 dnum) * This will initiate an outgoing connection. */ -int tcp_v4_connect(struct sock *sk, struct sockaddr *uaddr, size_t addr_len) +int tcp_v4_connect(struct sock *sk, struct sockaddr *uaddr, int addr_len) { struct sk_buff *buff; struct sk_buff *skb1; diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c index 2dff0b6d8e83..016cee54ceaa 100644 --- a/net/ipv4/tcp_output.c +++ b/net/ipv4/tcp_output.c @@ -110,7 +110,7 @@ int tcp_send_skb(struct sock *sk, struct sk_buff *skb) if (size < sizeof(struct tcphdr) || size > skb->len) { - printk("tcp_send_skb: bad skb (skb = %p, data = %p, th = %p, len = %lu)\n", + printk("tcp_send_skb: bad skb (skb = %p, data = %p, th = %p, len = %u)\n", skb, skb->data, th, skb->len); kfree_skb(skb, FREE_WRITE); return 0; diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c index af592b412017..29e44e88a15f 100644 --- a/net/ipv4/udp.c +++ b/net/ipv4/udp.c @@ -599,7 +599,7 @@ int udp_recvmsg(struct sock *sk, struct msghdr *msg, int len, return(copied); } -int udp_connect(struct sock *sk, struct sockaddr *uaddr, size_t addr_len) +int udp_connect(struct sock *sk, struct sockaddr *uaddr, int addr_len) { struct sockaddr_in *usin = (struct sockaddr_in *) uaddr; struct rtable *rt; diff --git a/net/ipv6/af_inet6.c b/net/ipv6/af_inet6.c index 8dc0a7c567f8..41d1c4e9001d 100644 --- a/net/ipv6/af_inet6.c +++ b/net/ipv6/af_inet6.c @@ -254,7 +254,7 @@ static int inet6_dup(struct socket *newsock, struct socket *oldsock) */ static int inet6_bind(struct socket *sock, struct sockaddr *uaddr, - size_t addr_len) + int addr_len) { struct sockaddr_in6 *addr=(struct sockaddr_in6 *)uaddr; struct sock *sk=(struct sock *)sock->data, *sk2; @@ -434,7 +434,7 @@ static int inet6_socketpair(struct socket *sock1, struct socket *sock2) */ static int inet6_getname(struct socket *sock, struct sockaddr *uaddr, - size_t *uaddr_len, int peer) + int *uaddr_len, int peer) { struct sockaddr_in6 *sin=(struct sockaddr_in6 *)uaddr; struct sock *sk; diff --git a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c index 11a542c206e2..bb03b34dd496 100644 --- a/net/ipv6/tcp_ipv6.c +++ b/net/ipv6/tcp_ipv6.c @@ -85,7 +85,7 @@ static __u32 tcp_v6_init_sequence(struct sock *sk, struct sk_buff *skb) } static int tcp_v6_connect(struct sock *sk, struct sockaddr *uaddr, - size_t addr_len) + int addr_len) { struct sockaddr_in6 *usin = (struct sockaddr_in6 *) uaddr; struct ipv6_pinfo *np = &sk->net_pinfo.af_inet6; diff --git a/net/ipv6/udp.c b/net/ipv6/udp.c index 595529d161ab..380122210f08 100644 --- a/net/ipv6/udp.c +++ b/net/ipv6/udp.c @@ -47,7 +47,7 @@ struct udp_mib udp_stats_in6; * */ -int udpv6_connect(struct sock *sk, struct sockaddr *uaddr, size_t addr_len) +int udpv6_connect(struct sock *sk, struct sockaddr *uaddr, int addr_len) { struct sockaddr_in6 *usin = (struct sockaddr_in6 *) uaddr; struct in6_addr *daddr; diff --git a/net/ipx/af_ipx.c b/net/ipx/af_ipx.c index 721ef6221641..82a85f685512 100644 --- a/net/ipx/af_ipx.c +++ b/net/ipx/af_ipx.c @@ -1792,7 +1792,7 @@ ipx_first_free_socketnum(ipx_interface *intrfc) return ntohs(socketNum); } -static int ipx_bind(struct socket *sock, struct sockaddr *uaddr,size_t addr_len) +static int ipx_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len) { ipx_socket *sk; ipx_interface *intrfc; @@ -1893,7 +1893,7 @@ static int ipx_bind(struct socket *sock, struct sockaddr *uaddr,size_t addr_len) } static int ipx_connect(struct socket *sock, struct sockaddr *uaddr, - size_t addr_len, int flags) + int addr_len, int flags) { ipx_socket *sk=(ipx_socket *)sock->data; struct sockaddr_ipx *addr; @@ -1949,7 +1949,7 @@ static int ipx_accept(struct socket *sock, struct socket *newsock, int flags) } static int ipx_getname(struct socket *sock, struct sockaddr *uaddr, - size_t *uaddr_len, int peer) + int *uaddr_len, int peer) { ipx_address *addr; struct sockaddr_ipx sipx; diff --git a/net/netrom/af_netrom.c b/net/netrom/af_netrom.c index 3f86be2ee27d..6eac7e8a83ac 100644 --- a/net/netrom/af_netrom.c +++ b/net/netrom/af_netrom.c @@ -780,7 +780,7 @@ static int nr_release(struct socket *sock, struct socket *peer) return 0; } -static int nr_bind(struct socket *sock, struct sockaddr *uaddr, size_t addr_len) +static int nr_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len) { struct sock *sk; struct full_sockaddr_ax25 *addr = (struct full_sockaddr_ax25 *)uaddr; @@ -834,7 +834,7 @@ static int nr_bind(struct socket *sock, struct sockaddr *uaddr, size_t addr_len) } static int nr_connect(struct socket *sock, struct sockaddr *uaddr, - size_t addr_len, int flags) + int addr_len, int flags) { struct sock *sk = (struct sock *)sock->data; struct sockaddr_ax25 *addr = (struct sockaddr_ax25 *)uaddr; @@ -985,7 +985,7 @@ static int nr_accept(struct socket *sock, struct socket *newsock, int flags) } static int nr_getname(struct socket *sock, struct sockaddr *uaddr, - size_t *uaddr_len, int peer) + int *uaddr_len, int peer) { struct full_sockaddr_ax25 *sax = (struct full_sockaddr_ax25 *)uaddr; struct sock *sk; diff --git a/net/rose/af_rose.c b/net/rose/af_rose.c index 0c845f2680d2..c5280efa64d0 100644 --- a/net/rose/af_rose.c +++ b/net/rose/af_rose.c @@ -765,7 +765,7 @@ static int rose_release(struct socket *sock, struct socket *peer) return 0; } -static int rose_bind(struct socket *sock, struct sockaddr *uaddr, size_t addr_len) +static int rose_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len) { struct sock *sk; struct sockaddr_rose *addr = (struct sockaddr_rose *)uaddr; @@ -813,7 +813,7 @@ static int rose_bind(struct socket *sock, struct sockaddr *uaddr, size_t addr_le return 0; } -static int rose_connect(struct socket *sock, struct sockaddr *uaddr, size_t addr_len, int flags) +static int rose_connect(struct socket *sock, struct sockaddr *uaddr, int addr_len, int flags) { struct sock *sk = (struct sock *)sock->data; struct sockaddr_rose *addr = (struct sockaddr_rose *)uaddr; @@ -963,7 +963,7 @@ static int rose_accept(struct socket *sock, struct socket *newsock, int flags) } static int rose_getname(struct socket *sock, struct sockaddr *uaddr, - size_t *uaddr_len, int peer) + int *uaddr_len, int peer) { struct sockaddr_rose *srose = (struct sockaddr_rose *)uaddr; struct sock *sk; diff --git a/net/rose/rose_out b/net/rose/rose_out deleted file mode 100644 index 745cb5a2ba1a..000000000000 --- a/net/rose/rose_out +++ /dev/null @@ -1,254 +0,0 @@ -/* - * Rose release 001 - * - * This is ALPHA test software. This code may break your machine, randomly fail to work with new - * releases, misbehave and/or generally screw up. It might even work. - * - * This code REQUIRES 2.1.0 or higher/ NET3.029 - * - * This module: - * This module is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version - * 2 of the License, or (at your option) any later version. - * - * History - * Rose 001 Jonathan(G4KLX) Cloned from nr_out.c - */ - -#include -#if defined(CONFIG_ROSE) || defined(CONFIG_ROSE_MODULE) -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -/* - * This is where all Rose frames pass; - */ -void rose_output(struct sock *sk, struct sk_buff *skb) -{ - struct sk_buff *skbn; - unsigned char header[ROSE_MIN_LEN]; - int err, frontlen, len; - - if (skb->len - ROSE_MIN_LEN > ROSE_PACLEN) { - /* Save a copy of the Header */ - memcpy(header, skb->data, ROSE_MIN_LEN); - skb_pull(skb, ROSE_MIN_LEN); - - frontlen = skb_headroom(skb); - - while (skb->len > 0) { - if ((skbn = sock_alloc_send_skb(sk, frontlen + ROSE_PACLEN, 0, 0, &err)) == NULL) - return; - - skbn->sk = sk; - skbn->free = 1; - skbn->arp = 1; - - skb_reserve(skbn, frontlen); - - len = (ROSE_PACLEN > skb->len) ? skb->len : ROSE_PACLEN; - - /* Copy the user data */ - memcpy(skb_put(skbn, len), skb->data, len); - skb_pull(skb, len); - - /* Duplicate the Header */ - skb_push(skbn, ROSE_MIN_LEN); - memcpy(skbn->data, header, ROSE_MIN_LEN); - - if (skb->len > 0) - skbn->data[2] |= M_BIT; - - skb_queue_tail(&sk->write_queue, skbn); /* Throw it on the queue */ - } - - skb->free = 1; - kfree_skb(skb, FREE_WRITE); - } else { - skb_queue_tail(&sk->write_queue, skb); /* Throw it on the queue */ - } - - if (sk->protinfo.rose->state == ROSE_STATE_3) - rose_kick(sk); -} - -/* - * This procedure is passed a buffer descriptor for an iframe. It builds - * the rest of the control part of the frame and then writes it out. - */ -static void rose_send_iframe(struct sock *sk, struct sk_buff *skb, int last) -{ - if (skb == NULL) - return; - - if (last) - skb->data[0] |= D_BIT; - - skb->data[2] |= (sk->protinfo.rose->vr << 5) & 0xE0; - skb->data[2] |= (sk->protinfo.rose->vs << 1) & 0x0E; - - rose_transmit_buffer(sk, skb); -} - -void rose_send_nak_frame(struct sock *sk) -{ - struct sk_buff *skb, *skbn; - - if ((skb = skb_peek(&sk->protinfo.rose->ack_queue)) == NULL) - return; - - if ((skbn = skb_clone(skb, GFP_ATOMIC)) == NULL) - return; - - skbn->data[2] = sk->protinfo.rose->va; - skbn->data[3] = sk->protinfo.rose->vr; - - if (sk->protinfo.rose->condition & OWN_RX_BUSY_CONDITION) - skbn->data[4] |= NR_CHOKE_FLAG; - - rose_transmit_buffer(sk, skbn); - - sk->protinfo.rose->condition &= ~ACK_PENDING_CONDITION; - sk->protinfo.rose->vl = sk->protinfo.rose->vr; - sk->protinfo.rose->t1timer = 0; -} - -void rose_kick(struct sock *sk) -{ - struct sk_buff *skb, *skbn; - int last = 1; - unsigned short start, end, next; - - del_timer(&sk->timer); - - start = (skb_peek(&sk->protinfo.rose->ack_queue) == NULL) ? sk->protinfo.rose->va : sk->protinfo.rose->vs; - end = (sk->protinfo.rose->va + sk->window) % ROSE_MODULUS; - - if (!(sk->protinfo.rose->condition & PEER_RX_BUSY_CONDITION) && - start != end && - skb_peek(&sk->write_queue) != NULL) { - - sk->protinfo.rose->vs = start; - - /* - * Transmit data until either we're out of data to send or - * the window is full. - */ - - /* - * Dequeue the frame and copy it. - */ - skb = skb_dequeue(&sk->write_queue); - - do { - if ((skbn = skb_clone(skb, GFP_ATOMIC)) == NULL) { - skb_queue_head(&sk->write_queue, skb); - break; - } - - next = (sk->protinfo.rose->vs + 1) % ROSE_MODULUS; - last = (next == end); - - /* - * Transmit the frame copy. - */ - rose_send_iframe(sk, skbn, last); - - sk->protinfo.rose->vs = next; - - /* - * Requeue the original data frame. - */ - skb_queue_tail(&sk->protinfo.rose->ack_queue, skb); - - } while (!last && (skb = skb_dequeue(&sk->write_queue)) != NULL); - - sk->protinfo.rose->vl = sk->protinfo.rose->vr; - sk->protinfo.rose->condition &= ~ACK_PENDING_CONDITION; - } - - rose_set_timer(sk); -} - -void rose_transmit_buffer(struct sock *sk, struct sk_buff *skb) -{ - unsigned char *dptr; - - dptr = skb_push(skb, 1); - *dptr = AX25_P_ROSE; - - skb->arp = 1; - - if (!ax25_send_frame(skb, (ax25_address *)sk->protinfo.rose->neighbour->dev->dev_addr, &sk->protinfo.rose->neighbour->callsign, sk->protinfo.rose->neighbour->digipeat, sk->protinfo.rose->neighbour->dev)) { - kfree_skb(skb, FREE_WRITE); - - sk->state = TCP_CLOSE; - sk->err = ENETUNREACH; - if (!sk->dead) - sk->state_change(sk); - sk->dead = 1; - } -} - -/* - * The following routines are taken from page 170 of the 7th ARRL Computer - * Networking Conference paper, as is the whole state machine. - */ - -void rose_establish_data_link(struct sock *sk) -{ - sk->protinfo.rose->condition = 0x00; - - rose_write_internal(sk, ROSE_CALL_REQUEST); - - sk->protinfo.rose->t1timer = sk->protinfo.rose->t1; -} - -/* - * Never send a NAK when we are CHOKEd. - */ -void rose_enquiry_response(struct sock *sk) -{ - int frametype = NR_INFOACK; - - if (sk->protinfo.rose->condition & OWN_RX_BUSY_CONDITION) - frametype |= NR_CHOKE_FLAG; - - rose_write_internal(sk, frametype); - - sk->protinfo.rose->vl = sk->protinfo.rose->vr; - sk->protinfo.rose->condition &= ~ACK_PENDING_CONDITION; -} - -void rose_check_iframes_acked(struct sock *sk, unsigned short nr) -{ - if (sk->protinfo.rose->vs == nr) { - rose_frames_acked(sk, nr); - } else { - if (sk->protinfo.rose->va != nr) { - rose_frames_acked(sk, nr); - } - } -} - -#endif diff --git a/net/socket.c b/net/socket.c index 0e00aa9306fd..e96ec9d052a6 100644 --- a/net/socket.c +++ b/net/socket.c @@ -806,7 +806,7 @@ asmlinkage int sys_accept(int fd, struct sockaddr *upeer_sockaddr, int *upeer_ad * include the -EINPROGRESS status for such sockets. */ -asmlinkage int sys_connect(int fd, struct sockaddr *uservaddr, size_t addrlen) +asmlinkage int sys_connect(int fd, struct sockaddr *uservaddr, int addrlen) { struct socket *sock; struct file *file; @@ -857,7 +857,7 @@ asmlinkage int sys_connect(int fd, struct sockaddr *uservaddr, size_t addrlen) * name to user space. */ -asmlinkage int sys_getsockname(int fd, struct sockaddr *usockaddr, size_t *usockaddr_len) +asmlinkage int sys_getsockname(int fd, struct sockaddr *usockaddr, int *usockaddr_len) { struct socket *sock; char address[MAX_SOCK_ADDR]; @@ -882,7 +882,7 @@ asmlinkage int sys_getsockname(int fd, struct sockaddr *usockaddr, size_t *usock * name to user space. */ -asmlinkage int sys_getpeername(int fd, struct sockaddr *usockaddr, size_t *usockaddr_len) +asmlinkage int sys_getpeername(int fd, struct sockaddr *usockaddr, int *usockaddr_len) { struct socket *sock; char address[MAX_SOCK_ADDR]; @@ -942,7 +942,7 @@ asmlinkage int sys_send(int fd, void * buff, size_t len, unsigned flags) */ asmlinkage int sys_sendto(int fd, void * buff, size_t len, unsigned flags, - struct sockaddr *addr, size_t addr_len) + struct sockaddr *addr, int addr_len) { struct socket *sock; struct file *file; @@ -1025,7 +1025,7 @@ asmlinkage int sys_recv(int fd, void * ubuf, size_t size, unsigned flags) */ asmlinkage int sys_recvfrom(int fd, void * ubuf, size_t size, unsigned flags, - struct sockaddr *addr, size_t *addr_len) + struct sockaddr *addr, int *addr_len) { struct socket *sock; struct file *file; diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c index aaddee6beb6a..aeb752d96d6f 100644 --- a/net/unix/af_unix.c +++ b/net/unix/af_unix.c @@ -397,7 +397,7 @@ static unix_socket *unix_find_other(char *path, int *error) } -static int unix_bind(struct socket *sock, struct sockaddr *uaddr, size_t addr_len) +static int unix_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len) { struct sockaddr_un *sunaddr=(struct sockaddr_un *)uaddr; unix_socket *sk=sock->data; @@ -444,7 +444,7 @@ static int unix_bind(struct socket *sock, struct sockaddr *uaddr, size_t addr_le } -static int unix_connect(struct socket *sock, struct sockaddr *uaddr, size_t addr_len, int flags) +static int unix_connect(struct socket *sock, struct sockaddr *uaddr, int addr_len, int flags) { unix_socket *sk=sock->data; struct sockaddr_un *sunaddr=(struct sockaddr_un *)uaddr; @@ -669,7 +669,7 @@ static int unix_accept(struct socket *sock, struct socket *newsock, int flags) return 0; } -static int unix_getname(struct socket *sock, struct sockaddr *uaddr, size_t *uaddr_len, int peer) +static int unix_getname(struct socket *sock, struct sockaddr *uaddr, int *uaddr_len, int peer) { unix_socket *sk=sock->data; struct sockaddr_un *sunaddr=(struct sockaddr_un *)uaddr; -- 2.39.5