]> git.hungrycats.org Git - linux/commitdiff
v2.4.8.4 -> v2.4.9
authorLinus Torvalds <torvalds@athlon.transmeta.com>
Tue, 5 Feb 2002 04:10:26 +0000 (20:10 -0800)
committerLinus Torvalds <torvalds@athlon.transmeta.com>
Tue, 5 Feb 2002 04:10:26 +0000 (20:10 -0800)
  - David Miller: sparc updates, FAT fs fixes, btaudio build fix
  - David Gibson: Orinoco driver update
  - Kevin Fleming: more disks the HPT controller doesn't like
  - David Miller: "min()/max()" cleanups. Understands signs and sizes.
  - Ben LaHaise: make vma merging more generous, help Mozilla /proc/<>/maps
  - Jens Axboe: CD updates
  - Trond Myklebust: save away NFS credentials in inode, so that mmap can
  writeout.
  - Mark Hemment: HIGHMEM ops cleanups
  - Jes Sorensen: use "unsigned long" for flags in various drivers

204 files changed:
Documentation/DMA-mapping.txt
Makefile
arch/cris/drivers/usb-host.c
arch/cris/drivers/usb-host.h
arch/i386/kernel/i386_ksyms.c
arch/sparc/kernel/head.S
arch/sparc/kernel/sys_sunos.c
arch/sparc64/defconfig
arch/sparc64/kernel/dtlb_backend.S
arch/sparc64/kernel/dtlb_base.S
arch/sparc64/kernel/entry.S
arch/sparc64/kernel/pci_common.c
arch/sparc64/kernel/pci_psycho.c
arch/sparc64/kernel/pci_sabre.c
arch/sparc64/kernel/pci_schizo.c
arch/sparc64/kernel/sparc64_ksyms.c
arch/sparc64/kernel/sys_sparc32.c
arch/sparc64/kernel/sys_sunos32.c
arch/sparc64/kernel/ttable.S
arch/sparc64/solaris/timod.c
drivers/acorn/scsi/acornscsi.c
drivers/acorn/scsi/acornscsi.h
drivers/block/acsi.c
drivers/cdrom/cdrom.c
drivers/char/agp/agp.h
drivers/char/agp/agpgart_be.c
drivers/char/cyclades.c
drivers/char/dsp56k.c
drivers/char/dz.c
drivers/char/n_r3964.c
drivers/char/ppdev.c
drivers/char/rio/rio.h
drivers/char/rio/riointr.c
drivers/i2o/i2o_block.c
drivers/i2o/i2o_config.c
drivers/i2o/i2o_core.c
drivers/ide/hpt366.c
drivers/ide/ide-cd.c
drivers/ide/ide-cd.h
drivers/ieee1394/nodemgr.c
drivers/ieee1394/ohci1394.c
drivers/ieee1394/sbp2.c
drivers/ieee1394/video1394.c
drivers/md/lvm-snap.c
drivers/mtd/devices/docecc.c
drivers/net/acenic.c
drivers/net/de600.c
drivers/net/dgrs.c
drivers/net/hamradio/baycom_epp.c
drivers/net/hamradio/baycom_par.c
drivers/net/hamradio/baycom_ser_fdx.c
drivers/net/hamradio/baycom_ser_hdx.c
drivers/net/hamradio/hdlcdrv.c
drivers/net/hamradio/soundmodem/sm.h
drivers/net/sk98lin/skproc.c
drivers/net/sungem.c
drivers/net/sunhme.c
drivers/net/wan/comx-hw-comx.c
drivers/net/wan/comx-hw-locomx.c
drivers/net/wan/comx-hw-mixcom.c
drivers/net/wan/comx-proto-fr.c
drivers/net/wan/comx-proto-lapb.c
drivers/net/wan/comx.c
drivers/net/wan/comx.h
drivers/net/wan/cycx_main.c
drivers/net/wan/cycx_x25.c
drivers/net/wan/sbni.c
drivers/net/wan/sbni.h
drivers/net/wan/sdla_chdlc.c
drivers/net/wan/sdla_fr.c
drivers/net/wan/sdla_ppp.c
drivers/net/wan/sdla_x25.c
drivers/net/wan/wanpipe_multppp.c
drivers/net/wireless/airo.c
drivers/net/wireless/airport.c
drivers/net/wireless/hermes.c
drivers/net/wireless/hermes.h
drivers/net/wireless/orinoco.c
drivers/net/wireless/orinoco.h
drivers/net/wireless/orinoco_cs.c
drivers/s390/net/iucv.c
drivers/s390/net/netiucv.c
drivers/sbus/audio/audio.c
drivers/sbus/char/aurora.c
drivers/sbus/char/pcikbd.c
drivers/sbus/char/rtc.c
drivers/sbus/char/uctrl.c
drivers/scsi/3w-xxxx.c
drivers/scsi/eata_generic.h
drivers/scsi/eata_pio.c
drivers/scsi/ips.c
drivers/scsi/scsi_ioctl.c
drivers/scsi/sr_ioctl.c
drivers/sound/btaudio.c
drivers/sound/dmasound/dmasound.h
drivers/sound/dmasound/dmasound_atari.c
drivers/sound/dmasound/dmasound_awacs.c
drivers/sound/dmasound/dmasound_paula.c
drivers/sound/dmasound/dmasound_q40.c
drivers/sound/emu10k1/audio.c
drivers/sound/emu10k1/cardwi.c
drivers/sound/emu10k1/cardwo.c
drivers/sound/emu10k1/hwaccess.h
drivers/telephony/ixj.c
drivers/telephony/ixj.h
drivers/usb/devio.c
drivers/usb/serial/io_usbvend.h
drivers/usb/storage/datafab.c
drivers/usb/storage/datafab.h
drivers/usb/storage/jumpshot.c
drivers/usb/storage/jumpshot.h
drivers/usb/uhci.c
drivers/usb/usb-ohci.c
drivers/usb/usb-ohci.h
drivers/usb/usb-uhci.c
drivers/usb/usb-uhci.h
drivers/video/amifb.c
drivers/video/cyberfb.h
fs/buffer.c
fs/coda/upcall.c
fs/fat/cache.c
fs/fat/dir.c
fs/jffs/inode-v23.c
fs/jffs/intrep.c
fs/jffs/intrep.h
fs/ncpfs/file.c
fs/ncpfs/mmap.c
fs/ncpfs/ncplib_kernel.c
fs/ncpfs/ncpsign_kernel.c
fs/nfs/file.c
fs/nfs/inode.c
fs/nfs/unlink.c
fs/nfs/write.c
fs/ntfs/attr.c
fs/ntfs/fs.c
fs/ntfs/inode.c
fs/ntfs/macros.h
fs/ntfs/support.c
fs/ntfs/unistr.c
fs/romfs/inode.c
fs/ufs/balloc.c
fs/ufs/truncate.c
fs/ufs/util.c
fs/ufs/util.h
include/asm-sparc/hw_irq.h [new file with mode: 0644]
include/asm-sparc64/hw_irq.h [new file with mode: 0644]
include/asm-sparc64/keyboard.h
include/asm-sparc64/mmu_context.h
include/asm-sparc64/pbm.h
include/asm-sparc64/pgtable.h
include/linux/cyclomx.h
include/linux/kernel.h
include/linux/lvm.h
include/linux/mtd/cfi.h
include/linux/nfs_fs.h
include/linux/nfs_fs_i.h
include/linux/sunrpc/auth.h
include/linux/swap.h
include/linux/wanpipe.h
include/net/sock.h
include/net/tcp.h
mm/filemap.c
mm/highmem.c
mm/vmscan.c
net/appletalk/ddp.c
net/ax25/af_ax25.c
net/bridge/br_device.c
net/bridge/br_forward.c
net/bridge/br_input.c
net/core/iovec.c
net/ipv4/ip_sockglue.c
net/ipv4/ipmr.c
net/ipv4/netfilter/ipchains_core.c
net/ipv4/netfilter/ipfwadm_core.c
net/ipv4/route.c
net/ipv4/tcp.c
net/ipv4/tcp_input.c
net/ipv4/tcp_minisocks.c
net/ipv4/tcp_output.c
net/ipv4/tcp_timer.c
net/ipv6/icmp.c
net/ipv6/ipv6_sockglue.c
net/ipv6/mcast.c
net/ipv6/ndisc.c
net/ipv6/raw.c
net/ipv6/route.c
net/ipx/af_ipx.c
net/irda/af_irda.c
net/khttpd/datasending.c
net/khttpd/prototypes.h
net/khttpd/rfc.c
net/khttpd/waitheaders.c
net/netrom/af_netrom.c
net/rose/af_rose.c
net/sched/sch_tbf.c
net/sunrpc/auth.c
net/sunrpc/auth_null.c
net/sunrpc/auth_unix.c
net/sunrpc/sunrpc_syms.c
net/sunrpc/xprt.c
net/unix/af_unix.c
net/wanrouter/wanmain.c
net/wanrouter/wanproc.c
net/x25/af_x25.c

index 988561f90d0aa517834eee7e8a970d9d6743490c..f7dd05294f4e477b3f3c6e0340a34362b9f6324c 100644 (file)
@@ -180,6 +180,19 @@ There are two types of DMA mappings:
   to memory is immediately visible to the device, and vice
   versa.  Consistent mappings guarantee this.
 
+  IMPORTANT: Consistent DMA memory does not preclude the usage of
+             proper memory barriers.  The cpu may reorder stores to
+            consistent memory just as it may normal memory.  Example:
+            if it is important for the device to see the first word
+            of a descriptor updated before the second, you must do
+            something like:
+
+               desc->word0 = address;
+               wmb();
+               desc->word1 = DESC_VALID;
+
+             in order to get correct behavior on all platforms.
+
 - Streaming DMA mappings which are usually mapped for one DMA transfer,
   unmapped right after it (unless you use pci_dma_sync below) and for which
   hardware can optimize for sequential accesses.
index 3427810fb0f9c206b7bb043cb5ba01be23c09e2c..44472377c37f622873ba6ed83a97f43692a58d43 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,7 +1,7 @@
 VERSION = 2
 PATCHLEVEL = 4
 SUBLEVEL = 9
-EXTRAVERSION =-pre4
+EXTRAVERSION =
 
 KERNELRELEASE=$(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION)
 
index f2655d6f8800d0b284e1f03242e373eef6859a80..87bad1b280f209f406edf95309db697905c3c357 100644 (file)
@@ -2258,11 +2258,11 @@ static int etrax_rh_submit_urb(urb_t *urb)
        case RH_GET_DESCRIPTOR:
                switch ((wValue & 0xff00) >> 8) {
                case (0x01):    /* device descriptor */
-                       len = min (leni, min (sizeof (root_hub_dev_des), wLength));
+                       len = min(unsigned int, leni, min(unsigned int, sizeof (root_hub_dev_des), wLength));
                        memcpy (data, root_hub_dev_des, len);
                        OK (len);
                case (0x02):    /* configuration descriptor */
-                       len = min (leni, min (sizeof (root_hub_config_des), wLength));
+                       len = min(unsigned int, leni, min(unsigned int, sizeof (root_hub_config_des), wLength));
                        memcpy (data, root_hub_config_des, len);
                        OK (len);
                case (0x03):    /* string descriptors */
@@ -2270,7 +2270,7 @@ static int etrax_rh_submit_urb(urb_t *urb)
                                                   0xff, "ETRAX 100LX",
                                                   data, wLength);
                        if (len > 0) {
-                               OK (min (leni, len));
+                               OK(min(int, leni, len));
                        } else 
                                stat = -EPIPE;
                }
@@ -2278,7 +2278,7 @@ static int etrax_rh_submit_urb(urb_t *urb)
                
        case RH_GET_DESCRIPTOR | RH_CLASS:
                root_hub_hub_des[2] = hc->rh.numports;
-               len = min (leni, min (sizeof (root_hub_hub_des), wLength));
+               len = min(unsigned int, leni, min(unsigned int, sizeof (root_hub_hub_des), wLength));
                memcpy (data, root_hub_hub_des, len);
                OK (len);
                
index 933b595403afb47ab49113428dae42372ea4cebb..434d50b26021e9098822ac0c23a5390dd27ac544 100644 (file)
@@ -146,8 +146,6 @@ struct in_chunk
 #define RH_REQ_ERR                 -1
 #define RH_NACK                    0x00
 
-#define min(a,b) (((a)<(b))?(a):(b))
-
 /* Field definitions for */
 
 #define USB_IN_command__eol__BITNR      0 /* command macros */
index 526a00e7461dd0d2777ce3f6ad85330c3446d49d..3ebf74d18d3fafebba5216953589e1bffa470826 100644 (file)
@@ -161,3 +161,7 @@ EXPORT_SYMBOL_NOVERS(memset);
 #ifdef CONFIG_X86_PAE
 EXPORT_SYMBOL(empty_zero_page);
 #endif
+
+#ifdef CONFIG_HAVE_DEC_LOCK
+EXPORT_SYMBOL(atomic_dec_and_lock);
+#endif
index b609bb102d641d39c8ca0cc5bd0b8c8c1aec0222..d8e65b0ff4c7bbe11baeedeeb8412e9b81e32fc7 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: head.S,v 1.104 2001/04/27 07:02:41 davem Exp $
+/* $Id: head.S,v 1.105 2001/08/12 09:08:56 davem Exp $
  * head.S: The initial boot code for the Sparc port of Linux.
  *
  * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu)
@@ -160,7 +160,7 @@ t_bad79:BAD_TRAP(0x79) BAD_TRAP(0x7a) BAD_TRAP(0x7b) BAD_TRAP(0x7c) BAD_TRAP(0x7
 t_bad7e:BAD_TRAP(0x7e) BAD_TRAP(0x7f)
 t_sunos:SUNOS_SYSCALL_TRAP                  /* SunOS System Call             */
 t_sbkpt:BREAKPOINT_TRAP                     /* Software Breakpoint/KGDB      */
-t_divz:        BAD_TRAP(0x82)                      /* Divide by zero trap           */
+t_divz:        TRAP_ENTRY(0x82, do_hw_divzero)     /* Divide by zero trap           */
 t_flwin:TRAP_ENTRY(0x83, do_flush_windows)  /* Flush Windows Trap            */
 t_clwin:BAD_TRAP(0x84)                      /* Clean Windows Trap            */
 t_rchk:        BAD_TRAP(0x85)                      /* Range Check                   */
@@ -245,7 +245,7 @@ C_LABEL(trapbase_cpu1):
        BAD_TRAP(0x7e) BAD_TRAP(0x7f)
        SUNOS_SYSCALL_TRAP 
        BREAKPOINT_TRAP
-       BAD_TRAP(0x82)
+       TRAP_ENTRY(0x82, do_hw_divzero)
        TRAP_ENTRY(0x83, do_flush_windows) BAD_TRAP(0x84) BAD_TRAP(0x85)
        BAD_TRAP(0x86) BAD_TRAP(0x87) SOLARIS_SYSCALL_TRAP
        NETBSD_SYSCALL_TRAP BAD_TRAP(0x8a) BAD_TRAP(0x8b) BAD_TRAP(0x8c)
@@ -313,7 +313,7 @@ C_LABEL(trapbase_cpu2):
        BAD_TRAP(0x7e) BAD_TRAP(0x7f)
        SUNOS_SYSCALL_TRAP 
        BREAKPOINT_TRAP
-       BAD_TRAP(0x82)
+       TRAP_ENTRY(0x82, do_hw_divzero)
        TRAP_ENTRY(0x83, do_flush_windows) BAD_TRAP(0x84) BAD_TRAP(0x85)
        BAD_TRAP(0x86) BAD_TRAP(0x87) SOLARIS_SYSCALL_TRAP
        NETBSD_SYSCALL_TRAP BAD_TRAP(0x8a) BAD_TRAP(0x8b) BAD_TRAP(0x8c)
@@ -381,7 +381,7 @@ C_LABEL(trapbase_cpu3):
        BAD_TRAP(0x7e) BAD_TRAP(0x7f)
        SUNOS_SYSCALL_TRAP  
        BREAKPOINT_TRAP
-       BAD_TRAP(0x82)
+       TRAP_ENTRY(0x82, do_hw_divzero)
        TRAP_ENTRY(0x83, do_flush_windows) BAD_TRAP(0x84) BAD_TRAP(0x85)
        BAD_TRAP(0x86) BAD_TRAP(0x87) SOLARIS_SYSCALL_TRAP
        NETBSD_SYSCALL_TRAP BAD_TRAP(0x8a) BAD_TRAP(0x8b) BAD_TRAP(0x8c)
index 88933354d0fb860355ce0268e2ec6b73f868d706..3180994194b84946615644f61bc746c32e25cf4d 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: sys_sunos.c,v 1.134 2001/04/27 07:02:42 davem Exp $
+/* $Id: sys_sunos.c,v 1.135 2001/08/13 14:40:10 davem Exp $
  * sys_sunos.c: SunOS specific syscall compatibility support.
  *
  * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu)
index 4051913366aa69da69c21a7a8f5c4c7e169dcd01..085efdd15554e30e2cbcd0f568abf3028a71ffd2 100644 (file)
@@ -661,8 +661,10 @@ CONFIG_NLS_DEFAULT="iso8859-1"
 # Sound
 #
 CONFIG_SOUND=m
+CONFIG_SOUND_BT878=m
 # CONFIG_SOUND_CMPCI is not set
 # CONFIG_SOUND_EMU10K1 is not set
+# CONFIG_MIDI_EMU10K1 is not set
 # CONFIG_SOUND_FUSION is not set
 # CONFIG_SOUND_CS4281 is not set
 # CONFIG_SOUND_ES1370 is not set
@@ -671,6 +673,7 @@ CONFIG_SOUND_ES1371=m
 # CONFIG_SOUND_MAESTRO is not set
 # CONFIG_SOUND_MAESTRO3 is not set
 # CONFIG_SOUND_ICH is not set
+# CONFIG_SOUND_RME96XX is not set
 # CONFIG_SOUND_SONICVIBES is not set
 CONFIG_SOUND_TRIDENT=m
 # CONFIG_SOUND_MSNDCLAS is not set
index e801cd4b6cbd98fd953bf86df20b27b5f03799d9..2a428c5f7f2d9cc3a92047f2822fc0ac60d6d957 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: dtlb_backend.S,v 1.11 2001/08/08 08:01:28 davem Exp $
+/* $Id: dtlb_backend.S,v 1.12 2001/08/13 20:41:54 kanoj Exp $
  * dtlb_backend.S: Back end to DTLB miss replacement strategy.
  *                 This is included directly into the trap table.
  *
@@ -23,7 +23,7 @@
        ldxa            [%g1 + %g1] ASI_DMMU, %g4       ! Get TAG_ACCESS
        add             %g3, %g3, %g5                   ! Compute VPTE base
        cmp             %g4, %g5                        ! VPTE miss?
-       blu,pn          %xcc, .-0x4004                  ! Fall to tl0 miss
+       blu,pn          %xcc, from_tl1_trap             ! Fall to tl0 miss
         andcc          %g4, TAG_CONTEXT_BITS, %g5      ! From Nucleus? (for tl0 miss)
        sllx            %g6, VPTE_SHIFT, %g4            ! Position TAG_ACCESS
        or              %g4, %g5, %g4                   ! Prepare TAG_ACCESS
@@ -57,10 +57,9 @@ sparc64_vpte_continue:
        stxa            %g5, [%g0] ASI_DTLB_DATA_IN     ! Load VPTE into TLB
        stxa            %g4, [%g1 + %g1] ASI_DMMU       ! Restore previous TAG_ACCESS
        retry                                           ! Load PTE once again
-vpte_noent:
-       mov             TLB_SFSR, %g1                   ! Restore %g1 value
-       stxa            %g4, [%g1 + %g1] ASI_DMMU       ! Restore previous TAG_ACCESS
-       done                                            ! Slick trick
+       nop
+       nop
+       nop
 
 #undef TAG_CONTEXT_BITS
 #undef VPTE_SHIFT
index f3a32d71406fd6213d0af07ea1fba591c19ae029..0d155e9b889611cf634a2c233ea949770651ff78 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: dtlb_base.S,v 1.9 2001/03/22 00:12:32 davem Exp $
+/* $Id: dtlb_base.S,v 1.10 2001/08/13 20:41:54 kanoj Exp $
  * dtlb_base.S:        Front end to DTLB miss replacement strategy.
  *              This is included directly into the trap table.
  *
@@ -51,6 +51,7 @@
 /* DTLB ** ICACHE line 1: Quick user TLB misses                */
        ldxa            [%g1 + %g1] ASI_DMMU, %g4       ! Get TAG_ACCESS
        andcc           %g4, TAG_CONTEXT_BITS, %g0      ! From Nucleus?
+from_tl1_trap:
        be,pn           %xcc, 3f                        ! Yep, special processing
         srax           %g4, VPTE_SHIFT, %g6            ! Create VPTE offset
        ldxa            [%g3 + %g6] ASI_S, %g5          ! Load VPTE
index d76c85942a0da40b807784bac512a9712bad1ecf..76918a29a4bca594d7f39832f85c02d7d59b5c66 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: entry.S,v 1.128 2001/03/28 10:56:34 davem Exp $
+/* $Id: entry.S,v 1.129 2001/08/13 20:41:54 kanoj Exp $
  * arch/sparc64/kernel/entry.S:  Sparc64 trap low-level entry points.
  *
  * Copyright (C) 1995,1997 David S. Miller (davem@caip.rutgers.edu)
@@ -40,6 +40,11 @@ sparc64_vpte_patchme2:
        ba,pt           %xcc, sparc64_kpte_continue     ! Part of dtlb_backend
         add            %g1, %g1, %g1                   ! Finish PMD offset adjustment
 
+vpte_noent:
+       mov             TLB_SFSR, %g1                   ! Restore %g1 value
+       stxa            %g4, [%g1 + %g1] ASI_DMMU       ! Restore previous TAG_ACCESS
+       done                                            ! Slick trick
+
        /* This is trivial with the new code... */
        .globl          do_fpdis
 do_fpdis:
index 02dfa9b7904b464872c8f3ebe72679e6a2a51724..6b2f28077c4e463c11b6a83a6ba671b5090b7f94 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: pci_common.c,v 1.26 2001/06/28 01:32:18 davem Exp $
+/* $Id: pci_common.c,v 1.27 2001/08/12 13:18:22 davem Exp $
  * pci_common.c: PCI controller common support.
  *
  * Copyright (C) 1999 David S. Miller (davem@redhat.com)
@@ -723,12 +723,12 @@ static void __init pdev_fixup_irq(struct pci_dev *pdev)
                 * ranges. -DaveM
                 */
                if (pdev->bus->number == pbm->pci_first_busno) {
-                       slot = (pdev->devfn >> 3) - 1;
+                       slot = (pdev->devfn >> 3) - pbm->pci_first_slot;
                } else {
                        /* Underneath a bridge, use slot number of parent
                         * bridge.
                         */
-                       slot = (pdev->bus->self->devfn >> 3) - 1;
+                       slot = (pdev->bus->self->devfn >> 3) - pbm->pci_first_slot;
                }
                slot = slot << 2;
 
index 9503de64c6b95c276529d7e22d7de26ec024de7f..7333eeebf5540c17d06f0c86f449129bb8aba284 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: pci_psycho.c,v 1.26 2001/06/13 06:34:30 davem Exp $
+/* $Id: pci_psycho.c,v 1.27 2001/08/12 13:18:23 davem Exp $
  * pci_psycho.c: PSYCHO/U2P specific PCI controller support.
  *
  * Copyright (C) 1997, 1998, 1999 David S. Miller (davem@caipfs.rutgers.edu)
@@ -1477,14 +1477,23 @@ static void psycho_pbm_init(struct pci_controller_info *p,
 {
        unsigned int busrange[2];
        struct pci_pbm_info *pbm;
-       int err;
+       char namebuf[64];
+       int err, len;
 
        if (is_pbm_a) {
                pbm = &p->pbm_A;
+               pbm->pci_first_slot = 1;
                pbm->io_space.start = p->controller_regs + PSYCHO_IOSPACE_A;
                pbm->mem_space.start = p->controller_regs + PSYCHO_MEMSPACE_A;
        } else {
                pbm = &p->pbm_B;
+               pbm->pci_first_slot = 1;
+               len = prom_getproperty(prom_root_node, "name",
+                                      namebuf, sizeof(namebuf));
+               if (len > 0) {
+                       if (!strcmp(namebuf, "SUNW,Ultra-1-Engine"))
+                               pbm->pci_first_slot = 2;
+               }
                pbm->io_space.start = p->controller_regs + PSYCHO_IOSPACE_B;
                pbm->mem_space.start = p->controller_regs + PSYCHO_MEMSPACE_B;
        }
index 1146d85ca4597c5041dee7f833f221bbfcfd0d6e..f106c0998024aae288fc2cbdf30051a5947a38d7 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: pci_sabre.c,v 1.37 2001/06/13 06:34:30 davem Exp $
+/* $Id: pci_sabre.c,v 1.38 2001/08/12 13:18:23 davem Exp $
  * pci_sabre.c: Sabre specific PCI controller support.
  *
  * Copyright (C) 1997, 1998, 1999 David S. Miller (davem@caipfs.rutgers.edu)
@@ -1395,6 +1395,7 @@ static void __init sabre_pbm_init(struct pci_controller_info *p, int sabre_node,
                        pbm = &p->pbm_A;
                pbm->parent = p;
                pbm->prom_node = node;
+               pbm->pci_first_slot = 1;
                pbm->pci_first_busno = busrange[0];
                pbm->pci_last_busno = busrange[1];
                for (err = pbm->pci_first_busno;
index af7fe5b0245fa410708252f63d67aa08d25367bc..05965f14aa24eab349588c6ba488b52c629517b1 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: pci_schizo.c,v 1.19 2001/06/20 21:31:00 davem Exp $
+/* $Id: pci_schizo.c,v 1.20 2001/08/12 13:18:23 davem Exp $
  * pci_schizo.c: SCHIZO specific PCI controller support.
  *
  * Copyright (C) 2001 David S. Miller (davem@redhat.com)
@@ -1684,6 +1684,7 @@ static void schizo_pbm_init(struct pci_controller_info *p,
 
        pbm->parent = p;
        pbm->prom_node = prom_node;
+       pbm->pci_first_slot = 1;
        prom_getstring(prom_node, "name",
                       pbm->prom_name,
                       sizeof(pbm->prom_name));
index fb73ba1e38651c190a6241cead3a01465feeee0f..4409886f00ba3cedfc58754c7d9f2f70a1d97877 100644 (file)
@@ -163,6 +163,7 @@ EXPORT_SYMBOL(__up);
 /* Atomic counter implementation. */
 EXPORT_SYMBOL(__atomic_add);
 EXPORT_SYMBOL(__atomic_sub);
+EXPORT_SYMBOL(atomic_dec_and_lock);
 
 /* Atomic bit operations. */
 EXPORT_SYMBOL(___test_and_set_bit);
index d4a8c18564dbf1d6772f37279c95d177c50e5fe0..1deac8f74ce88ed631afdce57e689bb970a21ef1 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: sys_sparc32.c,v 1.177 2001/06/10 06:48:46 davem Exp $
+/* $Id: sys_sparc32.c,v 1.178 2001/08/13 14:40:07 davem Exp $
  * sys_sparc32.c: Conversion between 32bit and 64bit native syscalls.
  *
  * Copyright (C) 1997,1998 Jakub Jelinek (jj@sunsite.mff.cuni.cz)
index bba037f2c587139f943cbfcf8d27229744761214..39e2781f57d3ba2836363ad9eeb7390ce97ea2ec 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: sys_sunos32.c,v 1.60 2001/04/27 07:02:42 davem Exp $
+/* $Id: sys_sunos32.c,v 1.61 2001/08/13 14:40:07 davem Exp $
  * sys_sunos32.c: SunOS binary compatability layer on sparc64.
  *
  * Copyright (C) 1995, 1996, 1997 David S. Miller (davem@caip.rutgers.edu)
index bda69c8f2f7b3e63f72b101191d8d54c115305c5..008c780fd1cd7bd07e4349fee8a2c7c38f193868 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: ttable.S,v 1.33 2001/03/28 10:56:34 davem Exp $
+/* $Id: ttable.S,v 1.34 2001/08/12 09:08:56 davem Exp $
  * ttable.S: Sparc V9 Trap Table(s) with SpitFire/Cheetah extensions.
  *
  * Copyright (C) 1996, 2001 David S. Miller (davem@caip.rutgers.edu)
@@ -106,7 +106,7 @@ tl0_f6o:    FILL_6_OTHER
 tl0_f7o:       FILL_7_OTHER
 tl0_sunos:     SUNOS_SYSCALL_TRAP
 tl0_bkpt:      BREAKPOINT_TRAP
-tl0_resv102:   BTRAP(0x102)
+tl0_divz:      TRAP(do_div0)
 tl0_flushw:    FLUSH_WINDOW_TRAP
 tl0_resv104:   BTRAP(0x104) BTRAP(0x105) BTRAP(0x106) BTRAP(0x107)
                .globl tl0_solaris
index 6ec858af0696cda09637a91b0ed004b54eef4a9e..283e0e37c241131c3ec8622343dd72864c7d16df 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: timod.c,v 1.11 2001/04/14 21:12:01 davem Exp $
+/* $Id: timod.c,v 1.15 2001/08/13 18:56:10 davem Exp $
  * timod.c: timod emulation.
  *
  * Copyright (C) 1998 Patrik Rak (prak3264@ss1000.ms.mff.cuni.cz)
@@ -699,10 +699,7 @@ int timod_getmsg(unsigned int fd, char *ctl_buf, int ctl_maxlen, s32 *ctl_len,
        }
        if (ctl_maxlen >= 0 && sock->pfirst) {
                struct T_primsg *it = sock->pfirst;
-#ifndef min
-#define min(a,b) ((a)<(b)?(a):(b))
-#endif
-               int l = min(ctl_maxlen, it->length);
+               int l = min(int, ctl_maxlen, it->length);
                SCHECK_MAGIC((char*)((u64)(((char *)&it->type)+sock->offset+it->length+7)&~7),MKCTL_MAGIC);
                SOLD("purting ctl data");
                if(copy_to_user(ctl_buf,
@@ -815,7 +812,7 @@ int timod_getmsg(unsigned int fd, char *ctl_buf, int ctl_maxlen, s32 *ctl_len,
        filp->f_flags |= O_NONBLOCK;
        SOLD("calling recvfrom");
        sys_recvfrom = (int (*)(int, void *, size_t, unsigned, struct sockaddr *, int *))SYS(recvfrom);
-       error = sys_recvfrom(fd, data_buf, min(0,data_maxlen), 0, (struct sockaddr*)tmpbuf, ctl_len);
+       error = sys_recvfrom(fd, data_buf, data_maxlen, 0, (struct sockaddr*)tmpbuf, ctl_len);
        filp->f_flags = oldflags;
        if (error < 0)
                return error;
index a5184513f7fd1e1f74b34d2e11e87f500267ea0d..66525f3043746bccda6ef62652a0e0548dc8bb73 100644 (file)
@@ -1059,7 +1059,7 @@ void acornscsi_dma_setup(AS_Host *host, dmadir_t direction)
     /*
      * Allocate some buffer space, limited to half the buffer size
      */
-    length = min(host->scsi.SCp.this_residual, DMAC_BUFFER_SIZE / 2);
+    length = min(unsigned int, host->scsi.SCp.this_residual, DMAC_BUFFER_SIZE / 2);
     if (length) {
        host->dma.start_addr = address = host->dma.free_addr;
        host->dma.free_addr = (host->dma.free_addr + length) &
@@ -1187,7 +1187,7 @@ void acornscsi_dma_intr(AS_Host *host)
     /*
      * Allocate some buffer space, limited to half the on-board RAM size
      */
-    length = min(host->scsi.SCp.this_residual, DMAC_BUFFER_SIZE / 2);
+    length = min(unsigned int, host->scsi.SCp.this_residual, DMAC_BUFFER_SIZE / 2);
     if (length) {
        host->dma.start_addr = address = host->dma.free_addr;
        host->dma.free_addr = (host->dma.free_addr + length) &
@@ -1656,8 +1656,8 @@ void acornscsi_message(AS_Host *host)
                 * to be in operation AFTER the target leaves message out phase.
                 */
                acornscsi_sbic_issuecmd(host, CMND_ASSERTATN);
-               period = max(message[3], sdtr_period / 4);
-               length = min(message[4], sdtr_size);
+               period = max(unsigned int, message[3], sdtr_period / 4);
+               length = min(unsigned int, message[4], sdtr_size);
                msgqueue_addmsg(&host->scsi.msgs, 5, EXTENDED_MESSAGE, 3,
                                 EXTENDED_SDTR, period, length);
                host->device[host->SCpnt->target].sync_xfer =
index 74a92d525c0a8ee9c8db8fc2913df6a40168aadd..191d16af8c4555266d07213e0c29e74a80757655 100644 (file)
 #define MASK_ON                (MASKREG_M3|MASKREG_M2|MASKREG_M1|MASKREG_M0)
 #define MASK_OFF       (MASKREG_M3|MASKREG_M2|MASKREG_M1)
 
-#define min(x,y) ((x) < (y) ? (x) : (y))
-#define max(x,y) ((x) < (y) ? (y) : (x))
-
 /*
  * SCSI driver phases
  */
index 7992a87395163a8852ecccea3c7d80304cf177e8..e1d1a3566674fe922d1c3ae0ce6477faa80ffa01 100644 (file)
@@ -292,9 +292,6 @@ static char pa_med_rem_cmd[6] = { 0x1e, 0, 0, 0, 0, 0 };
                cmd[4] = (len);                                                 \
        } while(0)
 
-#define min(a,b)       (((a)<(b))?(a):(b))
-
-
 /* ACSI errors (from REQUEST SENSE); There are two tables, one for the
  * old Atari disks and one for SCSI on ACSI disks.
  */
index b3b6c9d6c24955e9808d270c482ca17e1aec82a4..6e68c18d7bca484e11b96fce0d40f58201b48952 100644 (file)
@@ -2246,8 +2246,13 @@ int cdrom_get_track_info(kdev_t dev, __u16 track, __u8 type,
        if ((ret = cdo->generic_packet(cdi, &cgc)))
                return ret;
        
-       cgc.cmd[8] = cgc.buflen = be16_to_cpu(ti->track_information_length) +
+       cgc.buflen = be16_to_cpu(ti->track_information_length) +
                     sizeof(ti->track_information_length);
+
+       if (cgc.buflen > sizeof(track_information))
+               cgc.buflen = sizeof(track_information);
+
+       cgc.cmd[8] = cgc.buflen;
        return cdo->generic_packet(cdi, &cgc);
 }
 
index ac94c07dcf319d21f827b6c33ec74174a383dd02..7057a62d73fe603b9695de7e686deae703773311 100644 (file)
@@ -142,10 +142,6 @@ struct agp_bridge_data {
 #define A_IDXFIX()     (A_SIZE_FIX(agp_bridge.aperture_sizes) + i)
 #define MAXKEY         (4096 * 32)
 
-#ifndef min
-#define min(a,b)       (((a)<(b))?(a):(b))
-#endif
-
 #define AGPGART_MODULE_NAME    "agpgart"
 #define PFX                    AGPGART_MODULE_NAME ": "
 
index e1bd9f6b74b21b72c173497677e21c6d36e6cae1..3658ef10cbd5486108925f5dcf330000c3d51683 100644 (file)
@@ -428,8 +428,8 @@ static void agp_generic_agp_enable(u32 mode)
                        /* adjust RQ depth */
                        command =
                            ((command & ~0xff000000) |
-                            min((mode & 0xff000000),
-                                min((command & 0xff000000),
+                            min(u32, (mode & 0xff000000),
+                                min(u32, (command & 0xff000000),
                                     (scratch & 0xff000000))));
 
                        /* disable SBA if it's not supported */
@@ -2657,8 +2657,8 @@ static void serverworks_agp_enable(u32 mode)
                        /* adjust RQ depth */
                        command =
                            ((command & ~0xff000000) |
-                            min((mode & 0xff000000),
-                                min((command & 0xff000000),
+                            min(u32, (mode & 0xff000000),
+                                min(u32, (command & 0xff000000),
                                     (scratch & 0xff000000))));
 
                        /* disable SBA if it's not supported */
index ba42e8e2853cf8249deb06fde312428d8678c6e3..a9c385602cde3498cf79b99b1e4e0f7224b17695 100644 (file)
@@ -628,8 +628,6 @@ static char rcsid[] =
 #define PAUSE ;
 #endif
 
-#define cy_min(a,b) (((a)<(b))?(a):(b))
-
 /*
  * Include section 
  */
@@ -1631,8 +1629,8 @@ cyz_handle_rx(struct cyclades_port *info, volatile struct CH_CTRL *ch_ctrl,
               for performance, but because of buffer boundaries, there
               may be several steps to the operation */
            while(0 < (small_count = 
-                      cy_min((rx_bufsize - new_rx_get),
-                      cy_min((TTY_FLIPBUF_SIZE - tty->flip.count), char_count))
+                      min(unsigned int, (rx_bufsize - new_rx_get),
+                      min(unsigned int, (TTY_FLIPBUF_SIZE - tty->flip.count), char_count))
                 )) {
                memcpy_fromio(tty->flip.char_buf_ptr,
                              (char *)(cinfo->base_addr
@@ -1726,9 +1724,9 @@ cyz_handle_tx(struct cyclades_port *info, volatile struct CH_CTRL *ch_ctrl,
        }
 #ifdef BLOCKMOVE
        while(0 < (small_count = 
-                  cy_min((tx_bufsize - tx_put),
-                  cy_min ((SERIAL_XMIT_SIZE - info->xmit_tail),
-                       cy_min(info->xmit_cnt, char_count))))){
+                  min(unsigned int, (tx_bufsize - tx_put),
+                      min(unsigned int, (SERIAL_XMIT_SIZE - info->xmit_tail),
+                          min(unsigned int, info->xmit_cnt, char_count))))) {
 
            memcpy_toio((char *)(cinfo->base_addr + tx_bufaddr + tx_put),
                        &info->xmit_buf[info->xmit_tail],
index 845b5d61e03cdc735425175c28a81ef83dc4e2f0..28d92604b111a82c5181cc5938184a7578023657 100644 (file)
@@ -59,9 +59,6 @@
 #define DSP56K_TRANSMIT                (dsp56k_host_interface.isr & DSP56K_ISR_TXDE)
 #define DSP56K_RECEIVE         (dsp56k_host_interface.isr & DSP56K_ISR_RXDF)
 
-#define max(a,b) ((a) > (b) ? (a) : (b))
-#define min(a,b) ((a) < (b) ? (a) : (b))
-
 #define wait_some(n) \
 { \
        set_current_state(TASK_INTERRUPTIBLE); \
@@ -72,7 +69,7 @@
 { \
        long i, t, m; \
        while (count > 0) { \
-               m = min(count, maxio); \
+               m = min(unsigned long, count, maxio); \
                for (i = 0; i < m; i++) { \
                        for (t = 0; t < timeout && !ENABLE; t++) \
                                wait_some(HZ/50); \
index 94876285307cfd8fb795dde9de6cf0c9d75ddfed..9104b838d41d6dba84f4f1ae34bd32941fe4b27f 100644 (file)
@@ -1279,7 +1279,8 @@ static void show_serial_version (void)
 
 int __init dz_init(void)
 {
-  int i, flags;
+  int i;
+  unsigned long flags;
   struct dz_serial *info;
 
   /* Setup base handler, and timer table. */
index 5c34fd07f5cfa7a1b8a5ca6555710e9c3a53137e..ca5e0c7521919d6efe8f37b319cfc4bc18505cb8 100644 (file)
@@ -1421,7 +1421,7 @@ static unsigned int r3964_poll(struct tty_struct * tty, struct file * file,
    int pid=current->pid;
    struct r3964_client_info *pClient;
    struct r3964_message *pMsg=NULL;
-   unsigned int flags;
+   unsigned long flags;
    int result = POLLOUT;
 
    TRACE_L("POLL");
index 3124ccf965bd706afae00786509dbf863712b543..d4c94cc492f2293c680655a2ee1f5cbc54891b13 100644 (file)
 #define PP_VERSION "ppdev: user-space parallel port driver"
 #define CHRDEV "ppdev"
 
-#ifndef min
-#define min(a,b) ((a) < (b) ? (a) : (b))
-#endif
-
 struct pp_struct {
        struct pardevice * pdev;
        wait_queue_head_t irq_wait;
@@ -122,7 +118,7 @@ static ssize_t pp_read (struct file * file, char * buf, size_t count,
                return -EINVAL;
        }
 
-       kbuffer = kmalloc (min (count, PP_BUFFER_SIZE), GFP_KERNEL);
+       kbuffer = kmalloc(min(unsigned int, count, PP_BUFFER_SIZE), GFP_KERNEL);
        if (!kbuffer) {
                return -ENOMEM;
        }
@@ -130,7 +126,7 @@ static ssize_t pp_read (struct file * file, char * buf, size_t count,
        mode = pport->ieee1284.mode & ~(IEEE1284_DEVICEID | IEEE1284_ADDR);
 
        while (bytes_read < count) {
-               ssize_t need = min(count - bytes_read, PP_BUFFER_SIZE);
+               ssize_t need = min(unsigned long, count - bytes_read, PP_BUFFER_SIZE);
 
                if (mode == IEEE1284_MODE_EPP) {
                        /* various specials for EPP mode */
@@ -202,7 +198,7 @@ static ssize_t pp_write (struct file * file, const char * buf, size_t count,
                return -EINVAL;
        }
 
-       kbuffer = kmalloc (min (count, PP_BUFFER_SIZE), GFP_KERNEL);
+       kbuffer = kmalloc(min(unsigned int, count, PP_BUFFER_SIZE), GFP_KERNEL);
        if (!kbuffer) {
                return -ENOMEM;
        }
@@ -210,7 +206,7 @@ static ssize_t pp_write (struct file * file, const char * buf, size_t count,
        mode = pport->ieee1284.mode & ~(IEEE1284_DEVICEID | IEEE1284_ADDR);
 
        while (bytes_written < count) {
-               ssize_t n = min(count - bytes_written, PP_BUFFER_SIZE);
+               ssize_t n = min(unsigned long, count - bytes_written, PP_BUFFER_SIZE);
 
                if (copy_from_user (kbuffer, buf + bytes_written, n)) {
                        bytes_written = -EFAULT;
index a66e4efa280db1e6c090fae2898ce2f920f5b13e..88aa1f34254e1c792fcc2376a0b5ac4ec91b8c8a 100644 (file)
@@ -210,16 +210,6 @@ static char *_rio_h_sccs_ = "@(#)rio.h     1.3";
 #define RIO_PORT(DEV,FIRST_MAJ)        ( (major(DEV) - FIRST_MAJ) * PORTS_PER_HOST) \
                                        + minor(DEV)
 
-/*
-**     Min and Max
-*/
-#ifndef min
-#define        min(A,B)        ((A)<(B)?(A):(B))
-#endif
-#ifndef max
-#define        max(A,B)        ((A)>(B)?(A):(B))
-#endif
-
 #define        splrio  spltty
 
 #define        RIO_IPL 5
index c97f88640f408105b6db6bffd329a4af8d79aa7d..ad8a70df19f8f39d8c9b3ef482e95a1981c7625d 100644 (file)
@@ -819,7 +819,7 @@ struct Port *               PortP;
          ** and available space.
          */
                        
-         transCount = min(PacketP->len & PKT_LEN_MASK,
+         transCount = min(unsigned int, PacketP->len & PKT_LEN_MASK,
                           TTY_FLIPBUF_SIZE - TtyP->flip.count);
          rio_dprintk (RIO_DEBUG_REC,  "port %d: Copy %d bytes\n", 
                                      PortP->PortNum, transCount);
index c2b755546d6f0dc5d4f2d055ddcf75cde468a4d7..039a176c49e675c7fd1bb5e8d4475f20e0461693 100644 (file)
@@ -713,7 +713,7 @@ static void i2o_block_reply(struct i2o_handler *h, struct i2o_controller *c, str
 static int i2ob_evt(void *dummy)
 {
        unsigned int evt;
-       unsigned int flags;
+       unsigned long flags;
        int unit;
        int i;
        //The only event that has data is the SCSI_SMART event.
@@ -1698,7 +1698,7 @@ void i2ob_del_device(struct i2o_controller *c, struct i2o_device *d)
 {      
        int unit = 0;
        int i = 0;
-       int flags;
+       unsigned long flags;
 
        spin_lock_irqsave(&io_request_lock, flags);
 
index 02d0946dbe8639960f44ab464615d27b4050ca84..311b535279cf709639fdc3c073b792a9091e7baf 100644 (file)
@@ -790,7 +790,7 @@ static int ioctl_evt_get(unsigned long arg, struct file *fp)
        struct i2o_cfg_info *p = NULL;
        struct i2o_evt_get *uget = (struct i2o_evt_get*)arg;
        struct i2o_evt_get kget;
-       unsigned int flags;
+       unsigned long flags;
 
        for(p = open_files; p; p = p->next)
                if(p->q_id == id)
@@ -819,7 +819,7 @@ static int cfg_open(struct inode *inode, struct file *file)
 {
        struct i2o_cfg_info *tmp = 
                (struct i2o_cfg_info *)kmalloc(sizeof(struct i2o_cfg_info), GFP_KERNEL);
-       unsigned int flags;
+       unsigned long flags;
 
        if(!tmp)
                return -ENOMEM;
@@ -845,7 +845,7 @@ static int cfg_release(struct inode *inode, struct file *file)
 {
        u32 id = (u32)file->private_data;
        struct i2o_cfg_info *p1, *p2;
-       unsigned int flags;
+       unsigned long flags;
 
        lock_kernel();
        p1 = p2 = NULL;
index 61ae192b8cb963ebab99c22b6bc5050a3b5dd6e7..d4d0d0e753519c780d3540b9b8106d52f957a67a 100644 (file)
@@ -890,7 +890,7 @@ static int i2o_core_evt(void *reply_data)
        struct reply_info *reply = (struct reply_info *) reply_data;
        u32 *msg = reply->msg;
        struct i2o_controller *c = NULL;
-       int flags;
+       unsigned long flags;
 
        lock_kernel();
        daemonize();
@@ -2535,7 +2535,7 @@ int i2o_post_wait_mem(struct i2o_controller *c, u32 *msg, int len, int timeout,
        DECLARE_WAIT_QUEUE_HEAD(wq_i2o_post);
        int complete = 0;
        int status;
-       int flags = 0;
+       unsigned long flags = 0;
        struct i2o_post_wait_data *wait_data =
                kmalloc(sizeof(struct i2o_post_wait_data), GFP_KERNEL);
 
index 1e07e0736a2a71dad3b2f1458ee0bc74f80d9735..9e98c56969d3579b11bdb5b0e6f62473663c60c6 100644 (file)
@@ -60,6 +60,11 @@ const char *bad_ata100_5[] = {
        "IBM-DTLA-305040",
        "IBM-DTLA-305030",
        "IBM-DTLA-305020",
+       "IC35L010AVER07-0",
+       "IC35L020AVER07-0",
+       "IC35L030AVER07-0",
+       "IC35L040AVER07-0",
+       "IC35L060AVER07-0",
        "WDC AC310200R",
        NULL
 };
@@ -74,6 +79,11 @@ const char *bad_ata66_4[] = {
        "IBM-DTLA-305040",
        "IBM-DTLA-305030",
        "IBM-DTLA-305020",
+       "IC35L010AVER07-0",
+       "IC35L020AVER07-0",
+       "IC35L030AVER07-0",
+       "IC35L040AVER07-0",
+       "IC35L060AVER07-0",
        "WDC AC310200R",
        NULL
 };
index 87ae9b61d438cdaaa72767dcef3de4af432c7be7..7320b177e7bd2851b75be60e164e5534389164b0 100644 (file)
@@ -1885,7 +1885,7 @@ static int cdrom_eject(ide_drive_t *drive, int ejectflag,
        return cdrom_queue_packet_command (drive, &pc);
 }
 
-static int cdrom_read_capacity(ide_drive_t *drive, unsigned *capacity,
+static int cdrom_read_capacity(ide_drive_t *drive, unsigned long *capacity,
                               struct request_sense *sense)
 {
        struct {
@@ -2927,7 +2927,7 @@ void ide_cdrom_revalidate (ide_drive_t *drive)
 static
 unsigned long ide_cdrom_capacity (ide_drive_t *drive)
 {
-       unsigned capacity;
+       unsigned long capacity;
 
        if (cdrom_read_capacity(drive, &capacity, NULL))
                return 0;
index 702f3be3c85cc21e442c41831eb2ce3afb27adf3..aa46a912ab31f6b9b8a845c42a395f67bfa069b2 100644 (file)
@@ -150,7 +150,7 @@ struct atapi_toc_entry {
 struct atapi_toc {
        int    last_session_lba;
        int    xa_flag;
-       unsigned capacity;
+       unsigned long capacity;
        struct atapi_toc_header hdr;
        struct atapi_toc_entry  ent[MAX_TRACKS+1];
          /* One extra for the leadout. */
index 0b3228949be39d2d061fb3454276d2eb5448fdfe..fffc893b7774dace9a0f5ec3e17b49f511f0b42b 100644 (file)
@@ -358,7 +358,7 @@ static void nodemgr_node_probe(void *data)
         nodeid_t nodeid = LOCAL_BUS;
        quadlet_t buffer[5], quad;
        octlet_t base = CSR_REGISTER_BASE + CSR_CONFIG_ROM;
-       int flags;
+       unsigned long flags;
 
        /* We need to detect when the ConfigROM's generation has changed,
         * so we only update the node's info when it needs to be.  */
@@ -508,7 +508,7 @@ int hpsb_guid_fill_packet(struct node_entry *ne, struct hpsb_packet *pkt)
 static void nodemgr_add_host(struct hpsb_host *host)
 {
        struct host_info *hi = kmalloc (sizeof (struct host_info), GFP_KERNEL);
-       int flags;
+       unsigned long flags;
 
        if (!hi) {
                HPSB_ERR ("Out of memory in Node Manager");
@@ -532,7 +532,7 @@ static void nodemgr_host_reset(struct hpsb_host *host)
 {
        struct list_head *lh;
        struct host_info *hi = NULL;
-       int flags;
+       unsigned long flags;
 
        spin_lock_irqsave (&host_info_lock, flags);
        list_for_each(lh, &host_info_list) {
@@ -561,7 +561,7 @@ static void nodemgr_remove_host(struct hpsb_host *host)
        struct list_head *lh;
        struct host_info *hi = NULL;
        struct node_entry *ne;
-       int flags;
+       unsigned long flags;
 
        /* Make sure we have no active scans */
        flush_scheduled_tasks();
index 090104a81a739c5e10648dfa92ef5f00a57c0a01..8e0509de9ac6415c466b8c575455af963183369e 100644 (file)
@@ -200,7 +200,8 @@ static void dma_trm_reset(struct dma_trm_ctx *d);
 
 static u8 get_phy_reg(struct ti_ohci *ohci, u8 addr) 
 {
-       int i, flags;
+       int i;
+       unsigned long flags;
        quadlet_t r;
 
        spin_lock_irqsave (&ohci->phy_reg_lock, flags);
@@ -227,7 +228,8 @@ static u8 get_phy_reg(struct ti_ohci *ohci, u8 addr)
 
 static void set_phy_reg(struct ti_ohci *ohci, u8 addr, u8 data)
 {
-       int i, flags;
+       int i;
+       unsigned long flags;
        u32 r;
 
        spin_lock_irqsave (&ohci->phy_reg_lock, flags);
@@ -1078,7 +1080,8 @@ static void ohci_irq_handler(int irq, void *dev_id,
        quadlet_t event, node_id;
        struct ti_ohci *ohci = (struct ti_ohci *)dev_id;
        struct hpsb_host *host = ohci->host;
-       int phyid = -1, isroot = 0, flags;
+       int phyid = -1, isroot = 0;
+       unsigned long flags;
 
        /* Read the interrupt event register. We don't clear the bus reset
         * here. We wait till we get a selfid complete interrupt and clear
@@ -1343,7 +1346,8 @@ static void dma_rcv_tasklet (unsigned long data)
        struct ti_ohci *ohci = (struct ti_ohci*)(d->ohci);
        unsigned int split_left, idx, offset, rescount;
        unsigned char tcode;
-       int length, bytes_left, ack, flags;
+       int length, bytes_left, ack;
+       unsigned long flags;
        quadlet_t *buf_ptr;
        char *split_ptr;
        char msg[256];
index 2fb0d374a6e9970cf855f79d9f800d8fc7f6fb21..a69131f98d823ba39894e7c3cd5762a5ce34400a 100644 (file)
@@ -965,7 +965,7 @@ void sbp2_cleanup(void)
 static void sbp2_add_host(struct hpsb_host *host)
 {
        struct sbp2scsi_host_info *hi;
-       unsigned int flags;
+       unsigned long flags;
 
        SBP2_DEBUG("sbp2: sbp2_add_host");
 
@@ -1048,7 +1048,7 @@ static void sbp2_remove_host(struct hpsb_host *host)
 {
        struct sbp2scsi_host_info *hi;
        int i;
-       unsigned int flags;
+       unsigned long flags;
 
        SBP2_DEBUG("sbp2: sbp2_remove_host");
 
index bea5d771057dcca71aee6e7a6f4fe2d451af5ed1..291d2579d600a2c7daaef4becb0a03ce3eb94138 100644 (file)
@@ -1313,7 +1313,8 @@ int video1394_mmap(struct file *file, struct vm_area_struct *vma)
 {
        struct video_card *video = NULL;
        struct ti_ohci *ohci;
-       int res = -EINVAL, flags;
+       int res = -EINVAL;
+       unsigned long flags;
        struct list_head *lh;
 
         spin_lock_irqsave(&video1394_cards_lock, flags);
@@ -1350,7 +1351,8 @@ int video1394_mmap(struct file *file, struct vm_area_struct *vma)
 
 static int video1394_open(struct inode *inode, struct file *file)
 {
-       int i = MINOR(inode->i_rdev), flags;
+       int i = MINOR(inode->i_rdev);
+       unsigned long flags;
        struct video_card *video = NULL;
        struct list_head *lh;
 
@@ -1380,7 +1382,8 @@ static int video1394_release(struct inode *inode, struct file *file)
        struct video_card *video = NULL;
        struct ti_ohci *ohci;
        u64 mask;
-       int i, flags;
+       int i;
+       unsigned long flags;
        struct list_head *lh;
 
         spin_lock_irqsave(&video1394_cards_lock, flags);
@@ -1446,7 +1449,8 @@ static int video1394_release(struct inode *inode, struct file *file)
 static void irq_handler(int card, quadlet_t isoRecvIntEvent, 
                 quadlet_t isoXmitIntEvent)
 {
-       int i, flags;
+       int i;
+       unsigned long flags;
        struct video_card *video = NULL;
        struct list_head *lh;
 
@@ -1495,7 +1499,7 @@ static struct file_operations video1394_fops=
 static int video1394_init(struct ti_ohci *ohci)
 {
        struct video_card *video = kmalloc(sizeof(struct video_card), GFP_KERNEL);
-       int flags;
+       unsigned long flags;
        char name[16];
 
        if (video == NULL) {
@@ -1555,7 +1559,8 @@ static int video1394_init(struct ti_ohci *ohci)
 /* Must be called under spinlock */
 static void remove_card(struct video_card *video)
 {
-       int i, flags;
+       int i;
+       unsigned long flags;
 
        ohci1394_unregister_video(video->ohci, &video_tmpl);
 
@@ -1586,7 +1591,7 @@ static void remove_card(struct video_card *video)
 static void video1394_remove_host (struct hpsb_host *host)
 {
        struct ti_ohci *ohci;
-       int flags;
+       unsigned long flags;
        struct list_head *lh;
 
        /* We only work with the OHCI-1394 driver */
index 20e40c022e9056e4a57accab2d395756095410c6..ed19d45fc89536a1729e5c13c2a38413636fc60c 100644 (file)
@@ -386,8 +386,8 @@ int lvm_snapshot_COW(kdev_t org_phys_dev,
 
        blksize_org = lvm_get_blksize(org_phys_dev);
        blksize_snap = lvm_get_blksize(snap_phys_dev);
-       max_blksize = max(blksize_org, blksize_snap);
-       min_blksize = min(blksize_org, blksize_snap);
+       max_blksize = max(int, blksize_org, blksize_snap);
+       min_blksize = min(int, blksize_org, blksize_snap);
        max_sectors = KIO_MAX_SECTORS * (min_blksize>>9);
 
        if (chunk_size % (max_blksize>>9))
@@ -395,7 +395,7 @@ int lvm_snapshot_COW(kdev_t org_phys_dev,
 
        while (chunk_size)
        {
-               nr_sectors = min(chunk_size, max_sectors);
+               nr_sectors = min(int, chunk_size, max_sectors);
                chunk_size -= nr_sectors;
 
                iobuf->length = nr_sectors << 9;
@@ -503,7 +503,7 @@ int lvm_snapshot_alloc_hash_table(lv_t * lv)
 
        buckets = lv->lv_remap_end;
        max_buckets = calc_max_buckets();
-       buckets = min(buckets, max_buckets);
+       buckets = min(unsigned long, buckets, max_buckets);
        while (buckets & (buckets-1))
                buckets &= (buckets-1);
 
index c10ff2b88bccfc9ab0d59f55c8c32431ebe85773..f161a130a12fc62cdc728012f7c60558091ac696 100644 (file)
@@ -80,8 +80,6 @@ modnn(int x)
   return x;
 }
 
-#define        min(a,b)        ((a) < (b) ? (a) : (b))
-
 #define        CLEAR(a,n) {\
 int ci;\
 for(ci=(n)-1;ci >=0;ci--)\
@@ -404,7 +402,7 @@ eras_dec_rs(dtype Alpha_to[NN + 1], dtype Index_of[NN + 1],
     den = 0;
     
     /* lambda[i+1] for i even is the formal derivative lambda_pr of lambda[i] */
-    for (i = min(deg_lambda,NN-KK-1) & ~1; i >= 0; i -=2) {
+    for (i = min(int, deg_lambda,NN-KK-1) & ~1; i >= 0; i -=2) {
       if(lambda[i+1] != A0)
        den ^= Alpha_to[modnn(lambda[i+1] + i * root[j])];
     }
index bc8ef6891a33672a9089381ea729e8a86f1714c1..3b5f6df4f1300d311cba1be4f368be1dae4d6a38 100644 (file)
@@ -157,10 +157,6 @@ MODULE_DEVICE_TABLE(pci, acenic_pci_tbl);
 #define __devinit      __init
 #endif
 
-#ifndef min
-#define min(a,b)       (((a)<(b))?(a):(b))
-#endif
-
 #ifndef SMP_CACHE_BYTES
 #define SMP_CACHE_BYTES        L1_CACHE_BYTES
 #endif
@@ -2999,8 +2995,8 @@ static void __init ace_copy(struct ace_regs *regs, void *src,
                return;
 
        while (size > 0) {
-               tsize = min(((~dest & (ACE_WINDOW_SIZE - 1)) + 1),
-                           min(size, ACE_WINDOW_SIZE));
+               tsize = min(u32, ((~dest & (ACE_WINDOW_SIZE - 1)) + 1),
+                           min(u32, size, ACE_WINDOW_SIZE));
                tdest = (unsigned long)&regs->Window +
                        (dest & (ACE_WINDOW_SIZE - 1));
                writel(dest & ~(ACE_WINDOW_SIZE - 1), &regs->WinBase);
@@ -3030,8 +3026,8 @@ static void __init ace_clear(struct ace_regs *regs, u32 dest, int size)
                return;
 
        while (size > 0) {
-               tsize = min(((~dest & (ACE_WINDOW_SIZE - 1)) + 1),
-                           min(size, ACE_WINDOW_SIZE));
+               tsize = min(u32, ((~dest & (ACE_WINDOW_SIZE - 1)) + 1),
+                           min(u32, size, ACE_WINDOW_SIZE));
                tdest = (unsigned long)&regs->Window +
                        (dest & (ACE_WINDOW_SIZE - 1));
                writel(dest & ~(ACE_WINDOW_SIZE - 1), &regs->WinBase);
index d161342c08964c24eab4aa029f36ead80f46a186..d582b16db9369c124b24d034e1401cfec0207450 100644 (file)
@@ -801,7 +801,6 @@ adapter_init(struct net_device *dev)
  * This differs from the standard function, that can return an
  * arbitrarily small window!
  */
-#define min(a,b)       ((a)<(b)?(a):(b))
 static unsigned long
 de600_rspace(struct sock *sk)
 {
@@ -815,7 +814,7 @@ de600_rspace(struct sock *sk)
  */
 
        if (atomic_read(&sk->rmem_alloc) >= sk->rcvbuf-2*DE600_MIN_WINDOW) return(0);
-       amt = min((sk->rcvbuf-atomic_read(&sk->rmem_alloc))/2/*-DE600_MIN_WINDOW*/, DE600_MAX_WINDOW);
+       amt = min(int, (sk->rcvbuf-atomic_read(&sk->rmem_alloc))/2/*-DE600_MIN_WINDOW*/, DE600_MAX_WINDOW);
        if (amt < 0) return(0);
        return(amt);
   }
index 65616e6971793c1a8a7f54969f1820d81710c9fb..542f526a004defa855101709694fda868c925941 100644 (file)
@@ -693,7 +693,6 @@ static int dgrs_start_xmit(struct sk_buff *skb, struct net_device *devN)
        I596_RBD        *rbdp;
        int             count;
        int             i, len, amt;
-#      define          mymin(A,B)      ( (A) < (B) ? (A) : (B) )
 
        /*
         *      Determine 0th priv and dev structure pointers
@@ -734,7 +733,7 @@ static int dgrs_start_xmit(struct sk_buff *skb, struct net_device *devN)
                        goto no_resources;
                }
 
-               amt = mymin(len, rbdp->size - count);
+               amt = min(unsigned int, len, rbdp->size - count);
                memcpy( (char *) S2H(rbdp->buf) + count, skb->data + i, amt);
                i += amt;
                count += amt;
index 7c8aef881001dcfce0c4a706992d840d0210f59a..403577fda957aa7fce59cb190b7cca4356f85ecd 100644 (file)
@@ -246,11 +246,6 @@ struct baycom_state {
 
 /* --------------------------------------------------------------------- */
 
-#define min(a, b) (((a) < (b)) ? (a) : (b))
-#define max(a, b) (((a) > (b)) ? (a) : (b))
-
-/* --------------------------------------------------------------------- */
-
 #define KISS_VERBOSE
 
 /* --------------------------------------------------------------------- */
@@ -615,7 +610,7 @@ static int transmit(struct baycom_state *bc, int cnt, unsigned char stat)
        while (cnt > 0) {
                switch (bc->hdlctx.state) {
                case tx_keyup:
-                       i = min(cnt, bc->hdlctx.flags);
+                       i = min(int, cnt, bc->hdlctx.flags);
                        cnt -= i;
                        bc->hdlctx.flags -= i;
                        if (bc->hdlctx.flags <= 0)
@@ -638,7 +633,7 @@ static int transmit(struct baycom_state *bc, int cnt, unsigned char stat)
                                        break;
                                }
                        }
-                       i = min(cnt, bc->hdlctx.bufcnt);
+                       i = min(int, cnt, bc->hdlctx.bufcnt);
                        bc->hdlctx.bufcnt -= i;
                        cnt -= i;
                        if (i != pp->ops->epp_write_data(pp, bc->hdlctx.bufptr, i, 0))
@@ -652,7 +647,7 @@ static int transmit(struct baycom_state *bc, int cnt, unsigned char stat)
                                bc->hdlctx.state = tx_data;
                                break;
                        }
-                       i = min(cnt, bc->hdlctx.flags);
+                       i = min(int, cnt, bc->hdlctx.flags);
                        if (i) {
                                cnt -= i;
                                bc->hdlctx.flags -= i;
@@ -669,7 +664,7 @@ static int transmit(struct baycom_state *bc, int cnt, unsigned char stat)
                default:  /* fall through */
                        if (bc->hdlctx.calibrate <= 0)
                                return 0;
-                       i = min(cnt, bc->hdlctx.calibrate);
+                       i = min(int, cnt, bc->hdlctx.calibrate);
                        cnt -= i;
                        bc->hdlctx.calibrate -= i;
                        memset(tmp, 0, sizeof(tmp));
index 61cfd41480b20b56e83357b79faa66a987186cd8..508b6dc37463780c10063203d98f14591ec802ff 100644 (file)
@@ -157,11 +157,6 @@ struct baycom_state {
 
 /* --------------------------------------------------------------------- */
 
-#define min(a, b) (((a) < (b)) ? (a) : (b))
-#define max(a, b) (((a) > (b)) ? (a) : (b))
-
-/* --------------------------------------------------------------------- */
-
 static void __inline__ baycom_int_freq(struct baycom_state *bc)
 {
 #ifdef BAYCOM_DEBUG
index 2b19dc9058a6c337feb9d36aadedbe978d2ec25f..c1c3fc6ca0239f48fdea9e0a795b8d15e0e4d359 100644 (file)
@@ -152,11 +152,6 @@ struct baycom_state {
 
 /* --------------------------------------------------------------------- */
 
-#define min(a, b) (((a) < (b)) ? (a) : (b))
-#define max(a, b) (((a) > (b)) ? (a) : (b))
-
-/* --------------------------------------------------------------------- */
-
 static void inline baycom_int_freq(struct baycom_state *bc)
 {
 #ifdef BAYCOM_DEBUG
index f3d84911edcd7113f5a74281fe720cbdf99f2b3c..d2b82e589a5adf9044ac2317d9e5d89caf4de2ef 100644 (file)
@@ -143,11 +143,6 @@ struct baycom_state {
 
 /* --------------------------------------------------------------------- */
 
-#define min(a, b) (((a) < (b)) ? (a) : (b))
-#define max(a, b) (((a) > (b)) ? (a) : (b))
-
-/* --------------------------------------------------------------------- */
-
 static void inline baycom_int_freq(struct baycom_state *bc)
 {
 #ifdef BAYCOM_DEBUG
index 7ff2c9cfae52b18d0d086270b3406ac6cfc04eef..57320360602743fc9bc826e26ebc65cabc13ffac 100644 (file)
@@ -94,11 +94,6 @@ static char ax25_nocall[AX25_ADDR_LEN] =
 #define PARAM_HARDWARE  6
 #define PARAM_RETURN    255
 
-/* --------------------------------------------------------------------- */
-
-#define min(a, b) (((a) < (b)) ? (a) : (b))
-#define max(a, b) (((a) > (b)) ? (a) : (b))
-
 /* --------------------------------------------------------------------- */
 /*
  * the CRC routines are stolen from WAMPES
index 045e7e053402f3c4695a86f7c487a82c442e7053..367b045b808617eb452e68104d341c271c1fda6c 100644 (file)
@@ -150,11 +150,6 @@ struct hardware_info {
 
 /* --------------------------------------------------------------------- */
 
-#define min(a, b) (((a) < (b)) ? (a) : (b))
-#define max(a, b) (((a) > (b)) ? (a) : (b))
-
-/* --------------------------------------------------------------------- */
-
 extern const char sm_drvname[];
 extern const char sm_drvinfo[];
 
index 9c07f9c270bb2cb88f7e5b844bc45ebe61c7cbda..1abb4dd124bb84efeeab7be05d692b88b87cdd97 100644 (file)
@@ -293,7 +293,7 @@ void *data)
        if (buffer_length >= len - offset) {
                *eof = 1;
        }
-       return (min(buffer_length, len - offset));
+       return (min(int, buffer_length, len - offset));
 }
 
 
index 230ae012f71ec2ea86b3f1831408e97cbd817eaf..b80a4d8a4a588d0b4faef4c5e8eafbca9d0ea9a1 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: sungem.c,v 1.18 2001/08/06 13:34:47 davem Exp $
+/* $Id: sungem.c,v 1.19 2001/08/13 14:40:07 davem Exp $
  * sungem.c: Sun GEM ethernet driver.
  *
  * Copyright (C) 2000, 2001 David S. Miller (davem@redhat.com)
@@ -558,7 +558,7 @@ static void gem_rx(struct gem *gp)
                        skb = copy_skb;
                }
 
-               skb->csum = ((status & RXDCTRL_TCPCSUM) ^ 0xffff);
+               skb->csum = ntohs((status & RXDCTRL_TCPCSUM) ^ 0xffff);
                skb->ip_summed = CHECKSUM_HW;
                skb->protocol = eth_type_trans(skb, gp->dev);
                netif_rx(skb);
index 42f737de5fd45d8541be17d59bbe1b59ebc9ebbb..654e2db9256c9efe0626eba450c357a556fbc1c4 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: sunhme.c,v 1.121 2001/07/27 10:22:57 davem Exp $
+/* $Id: sunhme.c,v 1.122 2001/08/13 14:40:07 davem Exp $
  * sunhme.c: Sparc HME/BigMac 10/100baseT half/full duplex auto switching,
  *           auto carrier detecting ethernet driver.  Also known as the
  *           "Happy Meal Ethernet" found on SunSwift SBUS cards.
@@ -2109,7 +2109,7 @@ static void happy_meal_rx(struct happy_meal *hp, struct net_device *dev)
                }
 
                /* This card is _fucking_ hot... */
-               skb->csum = (csum ^ 0xffff);
+               skb->csum = ntohs(csum ^ 0xffff);
                skb->ip_summed = CHECKSUM_HW;
 
                RXD(("len=%d csum=%4x]", len, csum));
index e3b72a5af5255fc9cc7822bd4d4738caeefc45a8..86737b11e28a065f59220c8da0d1017963c67703 100644 (file)
@@ -1044,7 +1044,7 @@ static int comxhw_write_proc(struct file *file, const char *buffer,
                if (!(page = (char *)__get_free_page(GFP_KERNEL))) {
                        return -ENOMEM;
                }
-               if(copy_from_user(page, buffer, count = (min(count, PAGE_SIZE))))
+               if(copy_from_user(page, buffer, count = (min(int, count, PAGE_SIZE))))
                {
                        count = -EFAULT;
                        goto out;
@@ -1182,8 +1182,10 @@ static int comxhw_read_proc(char *page, char **start, off_t off, int count,
                        len = sprintf(page, "external\n");
                }
        } else if (strcmp(file->name, FILENAME_FIRMWARE) == 0) {
-               len = min(FILE_PAGESIZE, min(count, 
-                       hw->firmware ? (hw->firmware->len - off) :  0));
+               len = min(int, FILE_PAGESIZE,
+                         min(int, count, 
+                             hw->firmware ?
+                             (hw->firmware->len - off) : 0));
                if (len < 0) {
                        len = 0;
                }
@@ -1203,7 +1205,7 @@ static int comxhw_read_proc(char *page, char **start, off_t off, int count,
        if (count >= len - off) {
                *eof = 1;
        }
-       return(min(count, len - off));
+       return min(int, count, len - off);
 }
 
 /* Called on echo comx >boardtype */
index 3714c6e606401dee2ae5eeec028cf2d3cec12155..4b64939e864e87e2b477a7d10f2cb638a3aac59c 100644 (file)
@@ -324,7 +324,7 @@ static int locomx_read_proc(char *page, char **start, off_t off, int count,
        if (count >= len - off) {
                *eof = 1;
        }
-       return ( min(count, len - off) );
+       return min(int, count, len - off);
 }
 
 static int locomx_write_proc(struct file *file, const char *buffer,
@@ -339,7 +339,7 @@ static int locomx_write_proc(struct file *file, const char *buffer,
                return -ENOMEM;
        }
 
-       copy_from_user(page, buffer, count = min(count, PAGE_SIZE));
+       copy_from_user(page, buffer, count = min(unsigned long, count, PAGE_SIZE));
        if (*(page + count - 1) == '\n') {
                *(page + count - 1) = 0;
        }
index 8c367b5cca023752078e67ee3fbd86d9b485baa9..adf829894ff2f12eafad69c3701078d3af5dc217 100644 (file)
@@ -121,7 +121,7 @@ static inline void hscx_fill_fifo(struct net_device *dev)
 
 
        outsb(dev->base_addr + HSCX_FIFO,
-               &(hw->sending->data[hw->tx_ptr]), min(to_send, 32));
+               &(hw->sending->data[hw->tx_ptr]), min(unsigned int, to_send, 32));
        if (to_send <= 32) {
                hscx_cmd(dev, HSCX_XTF | HSCX_XME);
                kfree_skb(hw->sending);
@@ -696,7 +696,7 @@ static int mixcom_read_proc(char *page, char **start, off_t off, int count,
        }
        *start = page + off;
        if (count >= len - off) *eof = 1;
-       return ( min(count, len - off) );
+       return min(int, count, len - off);
 }
 
 
@@ -763,7 +763,7 @@ static int mixcom_write_proc(struct file *file, const char *buffer,
                return -ENOMEM;
        }
 
-       copy_from_user(page, buffer, count = min(count, PAGE_SIZE));
+       copy_from_user(page, buffer, count = min(unsigned long, count, PAGE_SIZE));
        if (*(page + count - 1) == '\n') {
                *(page + count - 1) = 0;
        }
index 124c66e102f3b7aa21c57efc39e01be893b3f0e8..75ef5c56c9a4b4c210edef83836ae45d954047fb 100644 (file)
@@ -634,7 +634,7 @@ static int fr_read_proc(char *page, char **start, off_t off, int count,
 
        *start = page + off;
        if (count >= len - off) *eof = 1;
-       return ( min(count, len - off) );
+       return min(int, count, len - off);
 }
 
 static int fr_write_proc(struct file *file, const char *buffer, 
index 64129018bdf1774f814f090ae2e1364b2c7e4972..520074f72f949d389d2e44262b8291f0cad69703 100644 (file)
@@ -212,7 +212,7 @@ static int comxlapb_read_proc(char *page, char **start, off_t off, int count,
        if (count >= len - off) {
                *eof = 1;
        }
-       return ( min(count, len - off) );
+       return min(int, count, len - off);
 }
 
 static int comxlapb_write_proc(struct file *file, const char *buffer, 
index 8e76b39b9bd447893496f35faa8b3360e8aaa033..3d4986ea7ca1d86d03b7b1960ed87ffcce2715e7 100644 (file)
@@ -151,8 +151,8 @@ int comx_debug(struct net_device *dev, char *fmt, ...)
                int free = (ch->debug_start - ch->debug_end + ch->debug_size) 
                        % ch->debug_size;
 
-               to_copy = min( free ? free : ch->debug_size, 
-                       min (ch->debug_size - ch->debug_end, len) );
+               to_copy = min(int, free ? free : ch->debug_size, 
+                             min(int, ch->debug_size - ch->debug_end, len));
                memcpy(ch->debug_area + ch->debug_end, str, to_copy);
                str += to_copy;
                len -= to_copy;
@@ -567,7 +567,7 @@ static int comx_read_proc(char *page, char **start, off_t off, int count,
        if (count >= len - off) {
                *eof = 1;
        }
-       return( min(count, len - off) );
+       return min(int, count, len - off);
 }
 
 
@@ -597,7 +597,7 @@ static int comx_root_read_proc(char *page, char **start, off_t off, int count,
        if (count >= len - off) {
                *eof = 1;
        }
-       return( min(count, len - off) );
+       return min(int, count, len - off);
 }
 
 
index 1461d5fb18cb40a779bc9c2dee3cf54442c50ade..0f7404f2147053416517af6623cfd9a85ba3ab10 100644 (file)
@@ -190,14 +190,6 @@ struct comx_debugflags_struct {
 #endif
 
 
-#ifndef min
-#define min(a,b)               ((a) > (b) ? (b) : (a))
-#endif
-#ifndef max
-#define max(a,b)               ((a) > (b) ? (a) : (b))
-#endif
-
-
 #define COMX_CHANNEL(dev) ((struct comx_channel*)dev->priv)
 
 #define TWIN(dev) (COMX_CHANNEL(dev)->twin)
index 0c5e72d05d39d5371f49101658c6411069ab87bc..22ffa2e56a34b8fd97fcded1c192b9b8300e7ba6 100644 (file)
@@ -111,8 +111,8 @@ int __init cyclomx_init (void)
                fullname, DRV_VERSION, DRV_RELEASE, copyright);
 
        /* Verify number of cards and allocate adapter data space */
-       ncards = min(ncards, MAX_CARDS);
-       ncards = max(ncards, 1);
+       ncards = min(int, ncards, MAX_CARDS);
+       ncards = max(int, ncards, 1);
        card_array = kmalloc(sizeof(cycx_t) * ncards, GFP_KERNEL);
        if (!card_array)
                goto out;
index a65238c704b4a656c548a8ac5326b641a13963f6..125a07b7eab2eaec7fb643dda0bd56e8a5c183f3 100644 (file)
@@ -260,13 +260,13 @@ int cyx_init (cycx_t *card, wandev_conf_t *conf)
                cfg.flags = 0;      /* FIXME just reset the 2nd bit */
 
        if (conf->u.x25.hi_pvc) {
-               card->u.x.hi_pvc = min(conf->u.x25.hi_pvc, 4095);
-               card->u.x.lo_pvc = min(conf->u.x25.lo_pvc, card->u.x.hi_pvc);
+               card->u.x.hi_pvc = min(unsigned int, conf->u.x25.hi_pvc, 4095);
+               card->u.x.lo_pvc = min(unsigned int, conf->u.x25.lo_pvc, card->u.x.hi_pvc);
        }
 
        if (conf->u.x25.hi_svc) {
-               card->u.x.hi_svc = min(conf->u.x25.hi_svc, 4095);
-               card->u.x.lo_svc = min(conf->u.x25.lo_svc, card->u.x.hi_svc);
+               card->u.x.hi_svc = min(unsigned int, conf->u.x25.hi_svc, 4095);
+               card->u.x.lo_svc = min(unsigned int, conf->u.x25.lo_svc, card->u.x.hi_svc);
        }
 
        if (card->u.x.lo_pvc == 255)
@@ -277,25 +277,25 @@ int cyx_init (cycx_t *card, wandev_conf_t *conf)
        cfg.nvc = card->u.x.hi_svc - card->u.x.lo_svc + 1 + cfg.npvc;
 
        if (conf->u.x25.hdlc_window)
-               cfg.n2win = min(conf->u.x25.hdlc_window, 7);
+               cfg.n2win = min(unsigned int, conf->u.x25.hdlc_window, 7);
 
        if (conf->u.x25.pkt_window)
-               cfg.n3win = min(conf->u.x25.pkt_window, 7);
+               cfg.n3win = min(unsigned int, conf->u.x25.pkt_window, 7);
 
        if (conf->u.x25.t1)
-               cfg.t1 = min(conf->u.x25.t1, 30);
+               cfg.t1 = min(unsigned int, conf->u.x25.t1, 30);
 
        if (conf->u.x25.t2)
-               cfg.t2 = min(conf->u.x25.t2, 30);
+               cfg.t2 = min(unsigned int, conf->u.x25.t2, 30);
 
        if (conf->u.x25.t11_t21)
-               cfg.t21 = min(conf->u.x25.t11_t21, 30);
+               cfg.t21 = min(unsigned int, conf->u.x25.t11_t21, 30);
 
        if (conf->u.x25.t13_t23)
-               cfg.t23 = min(conf->u.x25.t13_t23, 30);
+               cfg.t23 = min(unsigned int, conf->u.x25.t13_t23, 30);
 
        if (conf->u.x25.n2)
-               cfg.n2 = min(conf->u.x25.n2, 30);
+               cfg.n2 = min(unsigned int, conf->u.x25.n2, 30);
 
        /* initialize adapter */
        if (x25_configure(card, &cfg))
index 61c3f79f3ec8fd5c8e35f1c47bedc823e608b4a1..3b3bd1707ac8fb760d40264c778868320ac041b7 100644 (file)
@@ -659,7 +659,7 @@ download_data( struct net_device  *dev,  u32  *crc_p )
        struct net_local  *nl    = (struct net_local *) dev->priv;
        struct sk_buff    *skb   = nl->tx_buf_p;
 
-       unsigned  len = min( skb->len - nl->outpos, nl->framelen );
+       unsigned  len = min(unsigned int, skb->len - nl->outpos, nl->framelen);
 
        outsb( dev->base_addr + DAT, skb->data + nl->outpos, len );
        *crc_p = calc_crc32( *crc_p, skb->data + nl->outpos, len );
@@ -760,8 +760,9 @@ interpret_ack( struct net_device  *dev,  unsigned  ack )
                        nl->outpos += nl->framelen;
 
                        if( --nl->tx_frameno )
-                               nl->framelen = min( nl->maxframe,
-                                       nl->tx_buf_p->len - nl->outpos );
+                               nl->framelen = min(unsigned int,
+                                                  nl->maxframe,
+                                                  nl->tx_buf_p->len - nl->outpos);
                        else
                                send_complete( nl ),
 #ifdef CONFIG_SBNI_MULTILINE
index 335dbf13f4d67010f200d97e7bc64424641acdbb..8e83e274824dbbb0abfbb165213311b6637a5884 100644 (file)
@@ -137,7 +137,5 @@ struct sbni_flags {
 #define __initdata
 #endif
 
-#define min( x, y )    ( (x) < (y)  ?  (x)  :  (y) )
-
 #endif
 
index afd1fef9bc2964f49b50104c09862858eea51c28..b5f027c17c41ff0f6aafe1c3ae043fdbfb1cf2e2 100644 (file)
@@ -505,13 +505,13 @@ int wpc_init (sdla_t* card, wandev_conf_t* conf)
                /* For Primary Port 0 */
                card->wandev.mtu =
                        (conf->mtu >= MIN_LGTH_CHDLC_DATA_CFG) ?
-                       min(conf->mtu, PRI_MAX_NO_DATA_BYTES_IN_FRAME) :
+                       min(unsigned int, conf->mtu, PRI_MAX_NO_DATA_BYTES_IN_FRAME) :
                        CHDLC_DFLT_DATA_LEN;
        } else if(port_num == WANOPT_SEC) { 
                /* For Secondary Port 1 */
                card->wandev.mtu =
                        (conf->mtu >= MIN_LGTH_CHDLC_DATA_CFG) ?
-                       min(conf->mtu, SEC_MAX_NO_DATA_BYTES_IN_FRAME) :
+                       min(unsigned int, conf->mtu, SEC_MAX_NO_DATA_BYTES_IN_FRAME) :
                        CHDLC_DFLT_DATA_LEN;
        }
 
@@ -827,19 +827,19 @@ static int new_if (wan_device_t* wandev, netdevice_t* dev, wanif_conf_t* conf)
                        card->u.c.kpalv_tx =
                                ((conf->keepalive_tx_tmr - MIN_Tx_KPALV_TIMER)
                                >= 0) ?
-                               min(conf->keepalive_tx_tmr,MAX_Tx_KPALV_TIMER) :
+                               min(unsigned int, conf->keepalive_tx_tmr,MAX_Tx_KPALV_TIMER) :
                                DEFAULT_Tx_KPALV_TIMER;
 
                        card->u.c.kpalv_rx =
                                ((conf->keepalive_rx_tmr - MIN_Rx_KPALV_TIMER)
                                >= 0) ?
-                               min(conf->keepalive_rx_tmr,MAX_Rx_KPALV_TIMER) :
+                               min(unsigned int, conf->keepalive_rx_tmr,MAX_Rx_KPALV_TIMER) :
                                DEFAULT_Rx_KPALV_TIMER;
 
                        card->u.c.kpalv_err =
                                ((conf->keepalive_err_margin-MIN_KPALV_ERR_TOL)
                                >= 0) ?
-                               min(conf->keepalive_err_margin,
+                               min(unsigned int, conf->keepalive_err_margin,
                                MAX_KPALV_ERR_TOL) : 
                                DEFAULT_KPALV_ERR_TOL;
                }
@@ -847,7 +847,7 @@ static int new_if (wan_device_t* wandev, netdevice_t* dev, wanif_conf_t* conf)
                /* Setup slarp timer to control delay between slarps */
                card->u.c.slarp_timer = 
                        ((conf->slarp_timer - MIN_SLARP_REQ_TIMER) >= 0) ?
-                       min (conf->slarp_timer, MAX_SLARP_REQ_TIMER) :
+                       min(unsigned int, conf->slarp_timer, MAX_SLARP_REQ_TIMER) :
                        DEFAULT_SLARP_REQ_TIMER;
 
 #ifdef LINUX_2_0
index 4f5a9def99aeee04cf7c460b14cf2211f037885a..1032346d596acd9df194103d486ea337f967adc1 100644 (file)
@@ -548,10 +548,10 @@ int wpf_init(sdla_t *card, wandev_conf_t *conf)
        /* Adjust configuration */
        conf->mtu += FR_HEADER_LEN;
        conf->mtu = (conf->mtu >= MIN_LGTH_FR_DATA_CFG) ?
-                       min(conf->mtu, FR_MAX_NO_DATA_BYTES_IN_FRAME) :
+                       min(unsigned int, conf->mtu, FR_MAX_NO_DATA_BYTES_IN_FRAME) :
                         FR_CHANNEL_MTU + FR_HEADER_LEN;
      
-       conf->bps = min(conf->bps, 2048000);
+       conf->bps = min(unsigned int, conf->bps, 2048000);
 
        /* Initialze the configuration structure sent to the board to zero */
        memset(&u.cfg, 0, sizeof(u.cfg));
@@ -618,7 +618,7 @@ int wpf_init(sdla_t *card, wandev_conf_t *conf)
                 * command in fr_configure() routine. 
                 */
 
-               card->u.f.dlci_num  = min(max(conf->u.fr.dlci_num, 1), 100);
+               card->u.f.dlci_num  = min(unsigned int, max(unsigned int, conf->u.fr.dlci_num, 1), 100);
        
                for ( i = 0; i < card->u.f.dlci_num; i++) {
 
@@ -635,27 +635,27 @@ int wpf_init(sdla_t *card, wandev_conf_t *conf)
                u.cfg.port |= 0x0002;
 
        if (conf->u.fr.t391)
-               u.cfg.t391 = min(conf->u.fr.t391, 30);
+               u.cfg.t391 = min(unsigned int, conf->u.fr.t391, 30);
        else
                u.cfg.t391 = 5;
 
        if (conf->u.fr.t392)
-               u.cfg.t392 = min(conf->u.fr.t392, 30);
+               u.cfg.t392 = min(unsigned int, conf->u.fr.t392, 30);
        else
                u.cfg.t392 = 15;
 
        if (conf->u.fr.n391)
-               u.cfg.n391 = min(conf->u.fr.n391, 255);
+               u.cfg.n391 = min(unsigned int, conf->u.fr.n391, 255);
        else
                u.cfg.n391 = 2;
 
        if (conf->u.fr.n392)
-               u.cfg.n392 = min(conf->u.fr.n392, 10);
+               u.cfg.n392 = min(unsigned int, conf->u.fr.n392, 10);
        else
                u.cfg.n392 = 3; 
 
        if (conf->u.fr.n393)
-               u.cfg.n393 = min(conf->u.fr.n393, 10);
+               u.cfg.n393 = min(unsigned int, conf->u.fr.n393, 10);
        else
                u.cfg.n393 = 4;
 
@@ -952,7 +952,8 @@ static int new_if (wan_device_t* wandev, netdevice_t* dev, wanif_conf_t* conf)
          */
        if (conf->cir) {
 
-               chan->cir = max( 1, min( conf->cir, 512 ) );
+               chan->cir = max(unsigned int, 1,
+                               min(unsigned int, conf->cir, 512));
                chan->cir_status = CIR_ENABLED; 
 
                
@@ -963,7 +964,8 @@ static int new_if (wan_device_t* wandev, netdevice_t* dev, wanif_conf_t* conf)
                chan->bc = chan->cir;
 
                if (conf->be){
-                       chan->be = max( 0, min( conf->be, 511) ); 
+                       chan->be = max(unsigned int,
+                                      0, min(unsigned int, conf->be, 511));
                }else{  
                        conf->be = 0;
                }
index 9af93fa18b697e77282962789c12c58783014847..00d53beb38d067840c8d620b9055d0aac4d9f635 100644 (file)
@@ -400,7 +400,7 @@ int wpp_init(sdla_t *card, wandev_conf_t *conf)
        printk(KERN_INFO "%s: running PPP firmware v%s\n",card->devname, u.str); 
        /* Adjust configuration and set defaults */
        card->wandev.mtu = (conf->mtu) ?
-               min(conf->mtu, PPP_MAX_MTU) : PPP_DFLT_MTU;
+               min(unsigned int, conf->mtu, PPP_MAX_MTU) : PPP_DFLT_MTU;
 
        card->wandev.bps        = conf->bps;
        card->wandev.interface  = conf->interface;
@@ -629,7 +629,7 @@ static int new_if(wan_device_t *wandev, netdevice_t *dev, wanif_conf_t *conf)
        
        dev->init = &if_init;
        dev->priv = ppp_priv_area;
-       dev->mtu = min(dev->mtu, card->wandev.mtu);
+       dev->mtu = min(unsigned int, dev->mtu, card->wandev.mtu);
 
        /* Initialize the polling task routine */
 #ifndef LINUX_2_4
index c60d00f68901295a9f865a225d6917dd892fa172..928327df0f220fcdaa054592c100619d9824aa69 100644 (file)
@@ -653,13 +653,13 @@ int wpx_init (sdla_t* card, wandev_conf_t* conf)
        u.cfg.defPktSize = u.cfg.pktMTU = card->wandev.mtu;
 
        if (conf->u.x25.hi_pvc){
-               card->u.x.hi_pvc = min(conf->u.x25.hi_pvc, MAX_LCN_NUM);
-               card->u.x.lo_pvc = min(conf->u.x25.lo_pvc, card->u.x.hi_pvc);
+               card->u.x.hi_pvc = min(unsigned int, conf->u.x25.hi_pvc, MAX_LCN_NUM);
+               card->u.x.lo_pvc = min(unsigned int, conf->u.x25.lo_pvc, card->u.x.hi_pvc);
        }
 
        if (conf->u.x25.hi_svc){
-               card->u.x.hi_svc = min(conf->u.x25.hi_svc, MAX_LCN_NUM);
-               card->u.x.lo_svc = min(conf->u.x25.lo_svc, card->u.x.hi_svc);
+               card->u.x.hi_svc = min(unsigned int, conf->u.x25.hi_svc, MAX_LCN_NUM);
+               card->u.x.lo_svc = min(unsigned int, conf->u.x25.lo_svc, card->u.x.hi_svc);
        }
 
        /* Figure out the total number of channels to configure */
@@ -684,38 +684,38 @@ int wpx_init (sdla_t* card, wandev_conf_t* conf)
        u.cfg.hiTwoWaySVC = card->u.x.hi_svc;
 
        if (conf->u.x25.hdlc_window)
-               u.cfg.hdlcWindow = min(conf->u.x25.hdlc_window, 7);
+               u.cfg.hdlcWindow = min(unsigned int, conf->u.x25.hdlc_window, 7);
        if (conf->u.x25.pkt_window)
-               u.cfg.pktWindow = min(conf->u.x25.pkt_window, 7);
+               u.cfg.pktWindow = min(unsigned int, conf->u.x25.pkt_window, 7);
 
        if (conf->u.x25.t1)
-               u.cfg.t1 = min(conf->u.x25.t1, 30);
+               u.cfg.t1 = min(unsigned int, conf->u.x25.t1, 30);
        if (conf->u.x25.t2)
-               u.cfg.t2 = min(conf->u.x25.t2, 29);
+               u.cfg.t2 = min(unsigned int, conf->u.x25.t2, 29);
        if (conf->u.x25.t4)
-               u.cfg.t4 = min(conf->u.x25.t4, 240);
+               u.cfg.t4 = min(unsigned int, conf->u.x25.t4, 240);
        if (conf->u.x25.n2)
-               u.cfg.n2 = min(conf->u.x25.n2, 30);
+               u.cfg.n2 = min(unsigned int, conf->u.x25.n2, 30);
 
        if (conf->u.x25.t10_t20)
-               u.cfg.t10t20 = min(conf->u.x25.t10_t20,255);
+               u.cfg.t10t20 = min(unsigned int, conf->u.x25.t10_t20,255);
        if (conf->u.x25.t11_t21)
-               u.cfg.t11t21 = min(conf->u.x25.t11_t21,255);
+               u.cfg.t11t21 = min(unsigned int, conf->u.x25.t11_t21,255);
        if (conf->u.x25.t12_t22)
-               u.cfg.t12t22 = min(conf->u.x25.t12_t22,255);
+               u.cfg.t12t22 = min(unsigned int, conf->u.x25.t12_t22,255);
        if (conf->u.x25.t13_t23)        
-               u.cfg.t13t23 = min(conf->u.x25.t13_t23,255);
+               u.cfg.t13t23 = min(unsigned int, conf->u.x25.t13_t23,255);
        if (conf->u.x25.t16_t26)
-               u.cfg.t16t26 = min(conf->u.x25.t16_t26, 255);
+               u.cfg.t16t26 = min(unsigned int, conf->u.x25.t16_t26, 255);
        if (conf->u.x25.t28)
-               u.cfg.t28 = min(conf->u.x25.t28, 255);
+               u.cfg.t28 = min(unsigned int, conf->u.x25.t28, 255);
 
        if (conf->u.x25.r10_r20)
-               u.cfg.r10r20 = min(conf->u.x25.r10_r20,250);
+               u.cfg.r10r20 = min(unsigned int, conf->u.x25.r10_r20,250);
        if (conf->u.x25.r12_r22)
-               u.cfg.r12r22 = min(conf->u.x25.r12_r22,250);
+               u.cfg.r12r22 = min(unsigned int, conf->u.x25.r12_r22,250);
        if (conf->u.x25.r13_r23)
-               u.cfg.r13r23 = min(conf->u.x25.r13_r23,250);
+               u.cfg.r13r23 = min(unsigned int, conf->u.x25.r13_r23,250);
 
 
        if (conf->u.x25.ccitt_compat)
index 448341d5bbd750d7c4fee4b7ed49b4d62492fb13..d190eb322e2c26ff5db4cee34994b26356326552 100644 (file)
@@ -375,13 +375,13 @@ int wsppp_init (sdla_t* card, wandev_conf_t* conf)
                /* For Primary Port 0 */
                card->wandev.mtu =
                        (conf->mtu >= MIN_LGTH_CHDLC_DATA_CFG) ?
-                       min(conf->mtu, PRI_MAX_NO_DATA_BYTES_IN_FRAME) :
+                       min(unsigned int, conf->mtu, PRI_MAX_NO_DATA_BYTES_IN_FRAME) :
                        CHDLC_DFLT_DATA_LEN;
        } else if(port_num == WANOPT_SEC) { 
                /* For Secondary Port 1 */
                card->wandev.mtu =
                        (conf->mtu >= MIN_LGTH_CHDLC_DATA_CFG) ?
-                       min(conf->mtu, SEC_MAX_NO_DATA_BYTES_IN_FRAME) :
+                       min(unsigned int, conf->mtu, SEC_MAX_NO_DATA_BYTES_IN_FRAME) :
                        CHDLC_DFLT_DATA_LEN;
        }
 
index ff2ac1ccd2d66a015e9d3cd7391aee9dea986ecc..78b666462b01b2ebc19a052688b8a9548bb7c8bf 100644 (file)
@@ -259,8 +259,6 @@ MODULE_PARM_DESC(proc_perm, "The permission bits of the files in /proc");
 
 #include <asm/uaccess.h>
 
-#define min(x,y) ((x<y)?x:y)
-
 /* This is a kind of sloppy hack to get this information to OUT4500 and
    IN4500.  I would be extremely interested in the situation where this
    doesnt work though!!! */
@@ -1755,7 +1753,7 @@ static int PC4500_readrid(struct airo_info *ai, u16 rid, void *pBuf, int len)
        // read the rid length field
        bap_read(ai, pBuf, 2, BAP1);
        // length for remaining part of rid
-       len = min(len, le16_to_cpu(*(u16*)pBuf)) - 2;
+       len = min(unsigned int, len, le16_to_cpu(*(u16*)pBuf)) - 2;
        
        if ( len <= 2 ) {
                printk( KERN_ERR 
@@ -3998,7 +3996,8 @@ static int readrids(struct net_device *dev, aironet_ioctl *comp) {
         * 9/22/2000 Honor user given length
         */
 
-       if (copy_to_user(comp->data, iobuf, min (comp->len, sizeof(iobuf))))
+       if (copy_to_user(comp->data, iobuf,
+                        min(unsigned int, comp->len, sizeof(iobuf))))
                return -EFAULT;
        return 0;
 }
@@ -4057,7 +4056,8 @@ static int writerids(struct net_device *dev, aironet_ioctl *comp) {
 
                PC4500_readrid(dev->priv,ridcode,iobuf,sizeof(iobuf));
 
-               if (copy_to_user(comp->data,iobuf,min(comp->len,sizeof(iobuf))))
+               if (copy_to_user(comp->data, iobuf,
+                                min(unsigned int, comp->len, sizeof(iobuf))))
                        return -EFAULT;
                return 0;
 
index daa24801b818ae26b55908117613ee69ce4e3503..3cd86b130d4acaf3eaedc9da199b77ab16b71572 100644 (file)
@@ -1,4 +1,4 @@
-/* airport.c 0.05
+/* airport.c 0.06f
  *
  * A driver for "Hermes" chipset based Apple Airport wireless
  * card.
 #include "hermes.h"
 #include "orinoco.h"
 
+static const char version[] __initdata = "airport.c 0.06f (Benjamin Herrenschmidt <benh@kernel.crashing.org>)";
+MODULE_AUTHOR("Benjamin Herrenschmidt <benh@kernel.crashing.org>");
+MODULE_DESCRIPTION("Driver for the Apple Airport wireless card.");
+
 typedef struct dldwd_card {
        struct device_node* node;
        int irq_requested;
@@ -40,8 +44,6 @@ typedef struct dldwd_card {
        struct dldwd_priv priv;
 } dldwd_card_t;
 
-static char *version = "airport.c 0.05 (Benjamin Herrenschmidt <benh@kernel.crashing.org>)";
-
 /*
  * Function prototypes
  */
@@ -186,7 +188,7 @@ airport_attach(struct device_node* of_node)
                printk(KERN_ERR "airport: register_netdev() failed\n");
                goto failed;
        }
-       printk(KERN_INFO "airport: card registered for interface %s\n", ndev->name);
+       printk(KERN_DEBUG "airport: card registered for interface %s\n", ndev->name);
        card->ndev_registered = 1;
 
        SET_MODULE_OWNER(ndev);
@@ -242,7 +244,7 @@ init_airport(void)
 {
        struct device_node* airport_node;
 
-       printk(KERN_INFO "%s\n", version);
+       printk(KERN_DEBUG "%s\n", version);
 
        MOD_INC_USE_COUNT;
 
index 923850119e419ec5e47bc17d1d187d38c948d334..c6a684b7a57968c9974c490ff9b43dd16edd3d03 100644 (file)
@@ -3,21 +3,19 @@
  * Driver core for the "Hermes" wireless MAC controller, as used in
  * the Lucent Orinoco and Cabletron RoamAbout cards. It should also
  * work on the hfa3841 and hfa3842 MAC controller chips used in the
- * Prism I & II chipsets.
+ * Prism II chipsets.
  *
  * This is not a complete driver, just low-level access routines for
  * the MAC controller itself.
  *
  * Based on the prism2 driver from Absolute Value Systems' linux-wlan
  * project, the Linux wvlan_cs driver, Lucent's HCF-Light
- * (wvlan_hcf.c) library, and the NetBSD wireless driver.
+ * (wvlan_hcf.c) library, and the NetBSD wireless driver (in no
+ * particular order).
  *
  * Copyright (C) 2000, David Gibson, Linuxcare Australia <hermes@gibson.dropbear.id.au>
  * 
- * This file distributed under the GPL, version 2.
- */
-
-static const char *version = "hermes.c: 12 Dec 2000 David Gibson <hermes@gibson.dropbear.id.au>";
+ * This file distributed under the GPL, version 2.  */
 
 #include <linux/module.h>
 #include <linux/types.h>
@@ -32,6 +30,10 @@ static const char *version = "hermes.c: 12 Dec 2000 David Gibson <hermes@gibson.
 
 #include "hermes.h"
 
+static const char version[] __initdata = "hermes.c: 1 Aug 2001 David Gibson <hermes@gibson.dropbear.id.au>";
+MODULE_DESCRIPTION("Low-level driver helper for Lucent Hermes chipset and Prism II HFA384x wireless MAC controller");
+MODULE_AUTHOR("David Gibson <hermes@gibson.dropbear.id.au>");
+
 /* These are maximum timeouts. Most often, card wil react much faster */
 #define CMD_BUSY_TIMEOUT (100) /* In iterations of ~1us */
 #define CMD_INIT_TIMEOUT (50000) /* in iterations of ~10us */
@@ -69,10 +71,6 @@ static const char *version = "hermes.c: 12 Dec 2000 David Gibson <hermes@gibson.
 
 static int hermes_issue_cmd(hermes_t *hw, uint16_t cmd, uint16_t param0);
 
-/*
- * Internal inline functions
- */
-
 /*
  * Internal functions
  */
@@ -87,7 +85,6 @@ static int hermes_issue_cmd(hermes_t *hw, uint16_t cmd, uint16_t param0);
 static int hermes_issue_cmd(hermes_t *hw, uint16_t cmd, uint16_t param0)
 {
        uint16_t reg;
-/*     unsigned long k = CMD_BUSY_TIMEOUT; */
 
        /* First check that the command register is not busy */
        reg = hermes_read_regn(hw, CMD);
@@ -124,9 +121,12 @@ int hermes_reset(hermes_t *hw)
        hermes_write_regn(hw, INTEN, 0);
        hermes_write_regn(hw, EVACK, 0xffff);
 
-       /* Because we hope we can reset the card even if it gets into
-          a stupid state, we actually wait to see if the command
-          register will unbusy itself */
+       /* Normally it's a "can't happen" for the command register to
+           be busy when we go to issue a command because we are
+           serializing all commands.  However we want to have some
+           chance of resetting the card even if it gets into a stupid
+           state, so we actually wait to see if the command register
+           will unbusy itself here. */
        k = CMD_BUSY_TIMEOUT;
        reg = hermes_read_regn(hw, CMD);
        while (k && (reg & HERMES_CMD_BUSY)) {
@@ -139,8 +139,8 @@ int hermes_reset(hermes_t *hw)
                reg = hermes_read_regn(hw, CMD);
        }
        
-       /* No need to explicitly handle the timeout - hermes_issue_cmd() will
-          probably return -EBUSY */
+       /* No need to explicitly handle the timeout - if we've timed
+          out hermes_issue_cmd() will probably return -EBUSY below */
 
        /* According to the documentation, EVSTAT may contain
           obsolete event occurrence information.  We have to acknowledge
@@ -503,7 +503,7 @@ EXPORT_SYMBOL(hermes_write_ltv);
 
 static int __init init_hermes(void)
 {
-       printk(KERN_INFO "%s\n", version);
+       printk(KERN_DEBUG "%s\n", version);
 
        return 0;
 }
index 10c84131674345771915b621c61dd6ec4b073108..bc74036f247c793d335213e9319c83ae859aea4f 100644 (file)
 #define                HERMES_STATUS_CMDCODE           (0x003f)
 
 /*
- * OFFSET refister bitmasks
+ * OFFSET register bitmasks
  */
 #define                HERMES_OFFSET_BUSY              (0x8000)
 #define                HERMES_OFFSET_ERR               (0x4000)
index 76a913335ba9ecc3f55b5060a6d375a1c3807157..2560a38c884d31a3b1c4de10240e8ce7c307b56a 100644 (file)
@@ -1,4 +1,4 @@
-/* orinoco.c 0.06      - (formerly known as dldwd_cs.c and orinoco_cs.c)
+/* orinoco.c 0.06f     - (formerly known as dldwd_cs.c and orinoco_cs.c)
  *
  * A driver for "Hermes" chipset based PCMCIA wireless adaptors, such
  * as the Lucent WavelanIEEE/Orinoco cards and their OEM (Cabletron/
  * Reserved.
  *
  * Alternatively, the contents of this file may be used under the
- * terms of the GNU Public License version 2 (the "GPL"), in which
- * case the provisions of the GPL are applicable instead of the above.
- * If you wish to allow the use of your version of this file only
- * under the terms of the GPL and not to allow others to use your
+ * terms of the GNU General Public License version 2 (the "GPL"), in
+ * which case the provisions of the GPL are applicable instead of the
+ * above.  If you wish to allow the use of your version of this file
+ * only under the terms of the GPL and not to allow others to use your
  * version of this file under the MPL, indicate your decision by
  * deleting the provisions above and replace them with the notice and
  * other provisions required by the GPL.  If you do not delete the
  * v0.06b -> v0.06c - 29/5/2001 - Jean II
  *     o Show first spy address in /proc/net/wireless for IBSS mode as well
  *
+ * v0.06c -> v0.06d - 6/7/2001 - David Gibson
+ *      o Change a bunch of KERN_INFO messages to KERN_DEBUG, as per Linus'
+ *        wishes to reduce the number of unecessary messages.
+ *     o Removed bogus message on CRC error.
+ *     o Merged fixeds for v0.08 Prism 2 firmware from William Waghorn
+ *       <willwaghorn@yahoo.co.uk>
+ *     o Slight cleanup/re-arrangement of firmware detection code.
+ *
+ * v0.06d -> v0.06e - 1/8/2001 - David Gibson
+ *     o Removed some redundant global initializers (orinoco_cs.c).
+ *     o Added some module metadataa
+ *
+ * v0.06e -> v0.06f - 14/8/2001 - David Gibson
+ *     o Wording fix to license
+ *     o Added a 'use_alternate_encaps' module parameter for APs which need an oui of
+ *       00:00:00.  We really need a better way of handling this, but the module flag
+ *       is better than nothing for now.
+ *
  * TODO - Jean II
  *     o inline functions (lot's of candidate, need to reorder code)
  *     o Test PrismII/Symbol cards & firmware versions
 #include "hermes.h"
 #include "orinoco.h"
 
-static char *version = "orinoco.c 0.06c (David Gibson <hermes@gibson.dropbear.id.au> and others)";
+static const char version[] __initdata = "orinoco.c 0.06f (David Gibson <hermes@gibson.dropbear.id.au> and others)";
+MODULE_AUTHOR("David Gibson <hermes@gibson.dropbear.id.au>");
+MODULE_DESCRIPTION("Driver for Lucent Orinoco, Prism II based and similar wireless cards");
 
 /* Level of debugging. Used in the macros in orinoco.h */
 #ifdef ORINOCO_DEBUG
@@ -210,6 +230,11 @@ int dldwd_debug = ORINOCO_DEBUG;
 MODULE_PARM(dldwd_debug, "i");
 #endif
 
+/* FIXME: We need a better way of handling this */
+/* Set this flag to use 00:00:00 for the encapsulation oui instead of 00:00:F8 */
+static int use_alternate_encaps; /* =0 */
+MODULE_PARM(use_alternate_encaps, "i");
+
 const long channel_frequency[] = {
        2412, 2417, 2422, 2427, 2432, 2437, 2442,
        2447, 2452, 2457, 2462, 2467, 2472, 2484
@@ -274,6 +299,9 @@ struct dldwd_frame_hdr {
 struct p8022_hdr encaps_hdr = {
        0xaa, 0xaa, 0x03, {0x00, 0x00, 0xf8}
 };
+struct p8022_hdr alternate_encaps_hdr = {
+       0xaa, 0xaa, 0x03, {0x00, 0x00, 0x00}
+};
 
 /*
  * Function prototypes
@@ -396,6 +424,7 @@ set_port_type(dldwd_priv_t *priv)
                                priv->port_type = 4;
                        else
                                priv->port_type = 1;
+                       priv->port_type = priv->ibss_port;
                        priv->allow_ibss = 1;
                }
                break;
@@ -1050,8 +1079,7 @@ static void __dldwd_ev_rx(dldwd_priv_t *priv, hermes_t *hw)
        if (status & HERMES_RXSTAT_ERR) {
                if ((status & HERMES_RXSTAT_ERR) == HERMES_RXSTAT_BADCRC) {
                        stats->rx_crc_errors++;
-                       printk(KERN_WARNING "%s: Bad CRC on Rx. Frame dropped.\n",
-                              dev->name);
+                       DEBUG(1, "%s: Bad CRC on Rx. Frame dropped.\n", dev->name);
                        show_rx_frame(&hdr);
                } else if ((status & HERMES_RXSTAT_ERR)
                           == HERMES_RXSTAT_UNDECRYPTABLE) {
@@ -1198,34 +1226,14 @@ static void __dldwd_ev_alloc(dldwd_priv_t *priv, hermes_t *hw)
 /*     hermes_write_regn(hw, ALLOCFID, 0); */
 }
 
-/*
- * struct net_device methods
- */
-
-int
-dldwd_init(struct net_device *dev)
+static void determine_firmware(struct net_device *dev)
 {
        dldwd_priv_t *priv = dev->priv;
        hermes_t *hw = &priv->hw;
-       int err = 0;
-       hermes_id_t nickbuf;
-       uint16_t reclen;
-       int len;
-       char *vendor_str;
+       int err;
        uint32_t firmver;
+       char *vendor_str;
 
-       TRACE_ENTER("dldwd");
-       
-       dldwd_lock(priv);
-
-       /* Do standard firmware reset */
-       err = hermes_reset(hw);
-       if (err != 0) {
-               printk(KERN_ERR "%s: failed to reset hardware (err = %d)\n",
-                      dev->name, err);
-               goto out;
-       }
-       
        /* Get the firmware version */
        err = hermes_read_staidentity(hw, USER_BAP, &priv->firmware_info);
        if (err) {
@@ -1361,18 +1369,54 @@ dldwd_init(struct net_device *dev)
                priv->has_pm = 0;
                priv->has_preamble = 0;
        }
+       
+       if (priv->firmware_type == FIRMWARE_TYPE_SYMBOL)
+               priv->ibss_port = 4;
+       else if ( (priv->firmware_type == FIRMWARE_TYPE_PRISM2) && (firmver >= 0x00008) )
+               priv->ibss_port = 0;
+       else
+               priv->ibss_port = 1;
 
-       printk(KERN_INFO "%s: Firmware ID %02X vendor 0x%x (%s) version %d.%02d\n",
+       printk(KERN_DEBUG "%s: Firmware ID %02X vendor 0x%x (%s) version %d.%02d\n",
               dev->name, priv->firmware_info.id, priv->firmware_info.vendor,
               vendor_str, priv->firmware_info.major, priv->firmware_info.minor);
+}
+
+/*
+ * struct net_device methods
+ */
+
+int
+dldwd_init(struct net_device *dev)
+{
+       dldwd_priv_t *priv = dev->priv;
+       hermes_t *hw = &priv->hw;
+       int err = 0;
+       hermes_id_t nickbuf;
+       uint16_t reclen;
+       int len;
+
+       TRACE_ENTER("dldwd");
+       
+       dldwd_lock(priv);
+
+       /* Do standard firmware reset */
+       err = hermes_reset(hw);
+       if (err != 0) {
+               printk(KERN_ERR "%s: failed to reset hardware (err = %d)\n",
+                      dev->name, err);
+               goto out;
+       }
+
+       determine_firmware(dev);
 
        if (priv->has_port3)
-               printk(KERN_INFO "%s: Ad-hoc demo mode supported.\n", dev->name);
+               printk(KERN_DEBUG "%s: Ad-hoc demo mode supported.\n", dev->name);
        if (priv->has_ibss)
-               printk(KERN_INFO "%s: IEEE standard IBSS ad-hoc mode supported.\n",
+               printk(KERN_DEBUG "%s: IEEE standard IBSS ad-hoc mode supported.\n",
                       dev->name);
        if (priv->has_wep) {
-               printk(KERN_INFO "%s: WEP supported, ", dev->name);
+               printk(KERN_DEBUG "%s: WEP supported, ", dev->name);
                if (priv->has_big_wep)
                        printk("\"128\"-bit key.\n");
                else
@@ -1388,7 +1432,7 @@ dldwd_init(struct net_device *dev)
                goto out;
        }
 
-       printk(KERN_INFO "%s: MAC address %02X:%02X:%02X:%02X:%02X:%02X\n",
+       printk(KERN_DEBUG "%s: MAC address %02X:%02X:%02X:%02X:%02X:%02X\n",
               dev->name, dev->dev_addr[0], dev->dev_addr[1],
               dev->dev_addr[2], dev->dev_addr[3], dev->dev_addr[4],
               dev->dev_addr[5]);
@@ -1408,7 +1452,7 @@ dldwd_init(struct net_device *dev)
        memcpy(priv->nick, &nickbuf.val, len);
        priv->nick[len] = '\0';
 
-       printk(KERN_INFO "%s: Station name \"%s\"\n", dev->name, priv->nick);
+       printk(KERN_DEBUG "%s: Station name \"%s\"\n", dev->name, priv->nick);
 
        /* Get allowed channels */
        err = hermes_read_wordrec(hw, USER_BAP, HERMES_RID_CHANNEL_LIST, &priv->channel_mask);
@@ -1482,7 +1526,7 @@ dldwd_init(struct net_device *dev)
        priv->wep_on = 0;
        priv->tx_key = 0;
 
-       printk(KERN_INFO "%s: ready\n", dev->name);
+       printk(KERN_DEBUG "%s: ready\n", dev->name);
 
  out:
        dldwd_unlock(priv);
@@ -1668,7 +1712,11 @@ dldwd_xmit(struct sk_buff *skb, struct net_device *dev)
                hdr.p8023.h_proto = htons(data_len + ENCAPS_OVERHEAD);
                
                /* 802.2 header */
-               memcpy(&hdr.p8022, &encaps_hdr, sizeof(encaps_hdr));
+               /* FIXME: ugh, what a hack for the 00:00:00 APs.  Need to find a better way */
+               if (use_alternate_encaps)
+                       memcpy(&hdr.p8022, &alternate_encaps_hdr, sizeof(alternate_encaps_hdr));
+               else
+                       memcpy(&hdr.p8022, &encaps_hdr, sizeof(encaps_hdr));
 
                hdr.ethertype = eh->h_proto;
                err  = hermes_bap_pwrite(hw, USER_BAP, &hdr, sizeof(hdr),
@@ -2546,6 +2594,33 @@ static int dldwd_ioctl_getretry(struct net_device *dev, struct iw_param *rrq)
 }
 #endif /* WIRELESS_EXT > 10 */
 
+static int dldwd_ioctl_setibssport(struct net_device *dev, struct iwreq *wrq)
+{
+       dldwd_priv_t *priv = dev->priv;
+       int val = *( (int *) wrq->u.name );
+
+       dldwd_lock(priv);
+       priv->ibss_port = val ;
+
+       /* Actually update the mode we are using */
+       set_port_type(priv);
+
+       dldwd_unlock(priv);
+       return 0;
+}
+
+static int dldwd_ioctl_getibssport(struct net_device *dev, struct iwreq *wrq)
+{
+       dldwd_priv_t *priv = dev->priv;
+       int *val = (int *)wrq->u.name;
+
+       dldwd_lock(priv);
+       *val = priv->ibss_port;
+       dldwd_unlock(priv);
+
+       return 0;
+}
+
 static int dldwd_ioctl_setport3(struct net_device *dev, struct iwreq *wrq)
 {
        dldwd_priv_t *priv = dev->priv;
@@ -2941,7 +3016,13 @@ dldwd_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
                                  0, "set_preamble" },
                                { SIOCDEVPRIVATE + 0x5, 0,
                                  IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
-                                 "get_preamble" }
+                                 "get_preamble" },
+                               { SIOCDEVPRIVATE + 0x6,
+                                 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
+                                 0, "set_ibssport" },
+                               { SIOCDEVPRIVATE + 0x7, 0,
+                                 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
+                                 "get_ibssport" }
                        };
 
                        err = verify_area(VERIFY_WRITE, wrq->u.data.pointer, sizeof(privtab));
@@ -3038,6 +3119,25 @@ dldwd_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
                } else
                        err = -EOPNOTSUPP;
                break;
+       case SIOCDEVPRIVATE + 0x6: /* set_ibssport */
+               DEBUG(1, "%s: SIOCDEVPRIVATE + 0x6 (set_ibssport)\n",
+                     dev->name);
+               if (! capable(CAP_NET_ADMIN)) {
+                       err = -EPERM;
+                       break;
+               }
+
+               err = dldwd_ioctl_setibssport(dev, wrq);
+               if (! err)
+                       changed = 1;
+               break;
+
+       case SIOCDEVPRIVATE + 0x7: /* get_ibssport */
+               DEBUG(1, "%s: SIOCDEVPRIVATE + 0x7 (get_ibssport)\n",
+                     dev->name);
+               err = dldwd_ioctl_getibssport(dev, wrq);
+               break;
+
 
        default:
                err = -EOPNOTSUPP;
@@ -3601,7 +3701,7 @@ static int __init init_dldwd(void)
 
        err = dldwd_proc_init();
 
-       printk(KERN_INFO "%s\n", version);
+       printk(KERN_DEBUG "%s\n", version);
 
        return 0;
 }
index b90d323d2fa1efa3b34e68f44f7260fabc6bffc4..db2b6638cc4a96e3d8959dcbbcaad7e88921db42 100644 (file)
@@ -69,7 +69,7 @@ typedef struct dldwd_priv {
 #define FIRMWARE_TYPE_LUCENT 1
 #define FIRMWARE_TYPE_PRISM2 2
 #define FIRMWARE_TYPE_SYMBOL 3
-       int has_ibss, has_port3, prefer_port3, has_ibss_any;
+       int has_ibss, has_port3, prefer_port3, has_ibss_any, ibss_port;
        int has_wep, has_big_wep;
        int has_mwo;
        int has_pm;
@@ -107,10 +107,10 @@ typedef struct dldwd_priv {
 
 /*====================================================================*/
 
-extern int dldwd_debug;
 extern struct list_head dldwd_instances;
 
 #ifdef ORINOCO_DEBUG
+extern int dldwd_debug;
 #define DEBUG(n, args...) if (dldwd_debug>(n)) printk(KERN_DEBUG args)
 #define DEBUGMORE(n, args...) do { if (dldwd_debug>(n)) printk(args); } while (0)
 #else
index 8bf94dc46acd21f01b418e7a6aeb28493a249fca..2a26a07c4c1c147f708e106923ea8ea431c0e905 100644 (file)
@@ -1,4 +1,4 @@
-/* orinoco_cs.c 0.06   - (formerly known as dldwd_cs.c)
+/* orinoco_cs.c 0.06f  - (formerly known as dldwd_cs.c)
  *
  * A driver for "Hermes" chipset based PCMCIA wireless adaptors, such
  * as the Lucent WavelanIEEE/Orinoco cards and their OEM (Cabletron/
 #include "hermes.h"
 #include "orinoco.h"
 
-/* Pcmcia specific structure */
-typedef struct dldwd_card {
-       dev_link_t link;
-       dev_node_t node;
-       int instance;
-
-       /* Common structure (fully included), see orinoco.h */
-       struct dldwd_priv  priv;
-} dldwd_card_t;
+/*====================================================================*/
 
-static char version[] __initdata =
-"orinoco_cs.c 0.06 (David Gibson <hermes@gibson.dropbear.id.au> and others)";
+static const char version[] __initdata = "orinoco_cs.c 0.06f (David Gibson <hermes@gibson.dropbear.id.au> and others)";
 
-/*====================================================================*/
+MODULE_AUTHOR("David Gibson <hermes@gibson.dropbear.id.au>");
+MODULE_DESCRIPTION("Driver for PCMCIA Lucent Orinoco, Prism II based and similar wireless cards");
 
 /* Parameters that can be set with 'insmod' */
 
@@ -66,13 +58,24 @@ static int irq_list[4] = { -1 };
 static int reset_cor = 0;
 /* Some D-Link cards have buggy CIS. They do work at 5v properly, but
  * don't have any CIS entry for it. This workaround it... */
-static int ignore_cis_vcc = 0;
+static int ignore_cis_vcc; /* = 0 */
 
 MODULE_PARM(irq_mask, "i");
 MODULE_PARM(irq_list, "1-4i");
 MODULE_PARM(reset_cor, "i");
 MODULE_PARM(ignore_cis_vcc, "i");
 
+
+/* Pcmcia specific structure */
+typedef struct dldwd_card {
+       dev_link_t link;
+       dev_node_t node;
+       int instance;
+
+       /* Common structure (fully included), see orinoco.h */
+       struct dldwd_priv  priv;
+} dldwd_card_t;
+
 /*
  * Function prototypes
  */
@@ -108,8 +111,8 @@ static dev_info_t dev_info = "orinoco_cs";
    device numbers are used to derive the corresponding array index.
 */
 
-static dev_link_t *dev_list;
-static int num_instances;
+static dev_link_t *dev_list; /* = NULL */
+static int num_instances; /* = 0 */
 
 /*====================================================================*/
 
@@ -595,7 +598,7 @@ dldwd_cs_config(dev_link_t * link)
        strcpy(card->node.dev_name, ndev->name);
 
        /* Finally, report what we've done */
-       printk(KERN_INFO "%s: index 0x%02x: Vcc %d.%d",
+       printk(KERN_DEBUG "%s: index 0x%02x: Vcc %d.%d",
               ndev->name, link->conf.ConfigIndex,
               link->conf.Vcc / 10, link->conf.Vcc % 10);
        if (link->conf.Vpp1)
@@ -777,8 +780,8 @@ init_dldwd_cs(void)
 
        TRACE_ENTER("dldwd");
 
-       printk(KERN_INFO "dldwd: David's Less Dodgy WaveLAN/IEEE Driver\n"
-              KERN_INFO "%s\n", version);
+       printk(KERN_DEBUG "dldwd: David's Less Dodgy WaveLAN/IEEE Driver\n"
+              KERN_DEBUG "%s\n", version);
 
        CardServices(GetCardServicesInfo, &serv);
        if (serv.Revision != CS_RELEASE_CODE) {
index 4f1caa5210eb0756d5cf0d4e8ec7cf8185ecffe8..8b6b662f112425ffc7aa720305f9ea5b315a2cb8 100644 (file)
 #include <asm/s390_ext.h>
 #include <asm/ebcdic.h>
 
-#ifndef min
-#define min(a,b) (((a)<(b))?(a):(b))
-#endif
-#ifndef max
-#define max(a,b) (((a)>(b))?(a):(b))
-#endif
-
 #ifdef DEBUG
 #undef KERN_INFO
 #undef KERN_DEBUG
@@ -1316,7 +1309,7 @@ iucv_receive (u16 pathid, u32 msgid, u32 trgcls,
                        if (residual_buffer)
                                *residual_buffer = parm.ipbfadr1;
                } else {
-                       moved = min (buflen, 8);
+                       moved = min(unsigned int, buflen, 8);
 
                        memcpy ((char *) buffer,
                                (char *) &parm.ipbfadr1, moved);
@@ -1409,7 +1402,8 @@ iucv_receive_array (u16 pathid,
 
                        while ((moved < 8) && (moved < buflen)) {
                                dyn_len =
-                                   min ((buffer + i)->length, need_to_move);
+                                   min(unsigned int,
+                                       (buffer + i)->length, need_to_move);
 
                                memcpy ((char *)((ulong)((buffer + i)->address)),
                                        ((char *) &parm.ipbfadr1) + moved,
index da068f42a5177df89480a77a9b2e0afeab6722ae..09660e03ac7502546e324dafcd4dba56381ff9a6 100644 (file)
@@ -91,7 +91,6 @@ MODULE_PARM_DESC (iucv,
 #include <linux/init.h>                /* __setup()                    */
 #include <asm/string.h>                /* memset, memcpy, etc.         */
 #include "iucv.h"
-#define min(a,b) (a < b) ? a : b
 
 #if defined( DEBUG )
 #undef KERN_INFO
@@ -828,7 +827,8 @@ register_iucv_dev (int devnumber, char *userid)
        net_device *dev;
 
        memset (iucv_userid[devnumber], ' ', 8);
-       memcpy (iucv_userid[devnumber], userid, min (strlen (userid), 8));
+       memcpy (iucv_userid[devnumber], userid,
+               min(unsigned int, strlen(userid), 8));
        dev = &iucv_netdev[devnumber];
        sprintf (dev->name, "iucv%i", devnumber);
 
index 581bdc847c2cd094355b94ba624f047df39db684..e8d9daca2de7c5b66d4ad6442832cef62ba3b9c2 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: audio.c,v 1.60 2001/05/21 09:05:05 davem Exp $
+/* $Id: audio.c,v 1.61 2001/08/13 14:40:12 davem Exp $
  * drivers/sbus/audio/audio.c
  *
  * Copyright 1996 Thomas K. Dyas (tdyas@noc.rutgers.edu)
index 0d7cf3557ed063cfed403c510cf6ff227344fc12..1e43c35111b8f674d033cdf65f986fdf38ebdf0a 100644 (file)
@@ -1,4 +1,4 @@
-/*     $Id: aurora.c,v 1.14 2001/06/29 23:07:37 davem Exp $
+/*     $Id: aurora.c,v 1.15 2001/08/13 14:40:08 davem Exp $
  *     linux/drivers/sbus/char/aurora.c -- Aurora multiport driver
  *
  *     Copyright (c) 1999 by Oliver Aldulea (oli at bv dot ro)
index 4163a131cad23d705f60d131d8cad7a3ca88c5db..dd650c6836fe7956456a23fb54e3b3ff2225e707 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: pcikbd.c,v 1.58 2001/06/10 06:51:03 davem Exp $
+/* $Id: pcikbd.c,v 1.59 2001/08/13 14:40:08 davem Exp $
  * pcikbd.c: Ultra/AX PC keyboard support.
  *
  * Copyright (C) 1997  Eddie C. Dost  (ecd@skynet.be)
@@ -478,6 +478,11 @@ void pcikbd_leds(unsigned char leds)
                send_data(KBD_CMD_ENABLE);
 }
 
+int pcikbd_rate(struct kbd_repeat *rep)
+{
+       return -EIO;
+}
+
 static int pcikbd_wait_for_input(void)
 {
        int status, data;
index f380538c14c596eaa55d9c193d663ac0731cbb0a..37fd2110a0f5bb749ec0d4773a9a302e1d4348b6 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: rtc.c,v 1.26 2001/03/14 09:30:31 davem Exp $
+/* $Id: rtc.c,v 1.27 2001/08/13 14:40:08 davem Exp $
  *
  * Linux/SPARC Real Time Clock Driver
  * Copyright (C) 1996 Thomas K. Dyas (tdyas@eden.rutgers.edu)
index 01739b537c567e0a6256c541058cf54ea463d2ae..3a12bbe1003180bf3bb9aba157d2d2b6e59bef5a 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: uctrl.c,v 1.10 2001/02/13 01:17:00 davem Exp $
+/* $Id: uctrl.c,v 1.11 2001/08/13 14:40:08 davem Exp $
  * uctrl.c: TS102 Microcontroller interface on Tadpole Sparcbook 3
  *
  * Copyright 1999 Derrick J Brashear (shadow@dementia.org)
index 3ab0811a8e57976f0d23f93e576c96be8e54ee4f..d748be4e4fb17a7c740f00c6e3a0133bc3e86cff 100644 (file)
@@ -1202,15 +1202,14 @@ static void tw_interrupt(int irq, void *dev_instance, struct pt_regs *regs)
        int do_attention_interrupt=0;
        int do_host_interrupt=0;
        int do_command_interrupt=0;
-       int flags = 0;
-       int flags2 = 0;
+       unsigned long flags = 0;
        TW_Command *command_packet;
        if (test_and_set_bit(TW_IN_INTR, &tw_dev->flags))
                return;
        spin_lock_irqsave(&io_request_lock, flags);
 
        if (tw_dev->tw_pci_dev->irq == irq) {
-               spin_lock_irqsave(&tw_dev->tw_lock, flags2);
+               spin_lock(&tw_dev->tw_lock);
                dprintk(KERN_NOTICE "3w-xxxx: tw_interrupt()\n");
 
                /* Read the registers */
@@ -1349,7 +1348,7 @@ static void tw_interrupt(int irq, void *dev_instance, struct pt_regs *regs)
                                }
                        }
                }
-               spin_unlock_irqrestore(&tw_dev->tw_lock, flags2);
+               spin_unlock(&tw_dev->tw_lock);
        }
        spin_unlock_irqrestore(&io_request_lock, flags);
        clear_bit(TW_IN_INTR, &tw_dev->flags);
@@ -1918,7 +1917,7 @@ int tw_scsi_queue(Scsi_Cmnd *SCpnt, void (*done)(Scsi_Cmnd *))
        unsigned char *command = SCpnt->cmnd;
        int request_id = 0;
        int error = 0;
-       int flags = 0;
+       unsigned long flags = 0;
        TW_Device_Extension *tw_dev = (TW_Device_Extension *)SCpnt->host->hostdata;
 
        if (tw_dev == NULL) {
index c884def02a2ffd3344fdbd473be9b390cd8bffd2..b25cfbf9e7b3c599a4114c10d3644d6100a10549 100644 (file)
@@ -25,8 +25,6 @@
 #define FALSE 0
 #endif
 
-#define min(a,b) ((a<b)?(a):(b))
-
 #define R_LIMIT 0x20000
 
 #define MAXISA    4
index ce5b3800106ec0a01fa54b67cacb0b84e731e523..7a070be69aa4562d9a750172c80ea633305ff66b 100644 (file)
@@ -161,7 +161,7 @@ void eata_pio_int_handler(int irq, void *dev_id, struct pt_regs * regs)
                            IncStat(&cmd->SCp,1);
                            odd=FALSE;
                        }
-                       x=min(z,cmd->SCp.this_residual/2);
+                       x=min(unsigned int,z,cmd->SCp.this_residual/2);
                        insw(base+HA_RDATA,cmd->SCp.ptr,x);
                        z-=x; 
                        IncStat(&cmd->SCp,2*x);
@@ -191,7 +191,7 @@ void eata_pio_int_handler(int irq, void *dev_id, struct pt_regs * regs)
                            z--; 
                            odd=FALSE; 
                        }
-                       x=min(z,cmd->SCp.this_residual/2);
+                       x=min(unsigned int,z,cmd->SCp.this_residual/2);
                        outsw(base+HA_RDATA,cmd->SCp.ptr,x);
                        z-=x; 
                        IncStat(&cmd->SCp,2*x);
index d75f0f29e5897d35879ec4dcf9d10ad39ead3659..f8f37161b8384259d01c32f0c6db278e2c286e6c 100644 (file)
@@ -1416,7 +1416,7 @@ int
 ips_eh_reset(Scsi_Cmnd *SC) {
    int                   ret;
    int                   i;
-   u32                   cpu_flags;
+   unsigned long         cpu_flags;
    ips_ha_t             *ha;
    ips_scb_t            *scb;
    ips_copp_wait_item_t *item;
@@ -1607,7 +1607,7 @@ ips_eh_reset(Scsi_Cmnd *SC) {
 int
 ips_queue(Scsi_Cmnd *SC, void (*done) (Scsi_Cmnd *)) {
    ips_ha_t         *ha;
-   u32               cpu_flags;
+   unsigned long     cpu_flags;
    DECLARE_MUTEX_LOCKED(sem);
 
    METHOD_TRACE("ips_queue", 1);
@@ -1854,7 +1854,7 @@ ips_select_queue_depth(struct Scsi_Host *host, Scsi_Device *scsi_devs) {
 void
 do_ipsintr(int irq, void *dev_id, struct pt_regs *regs) {
    ips_ha_t         *ha;
-   u32               cpu_flags;
+   unsigned long     cpu_flags;
 
    METHOD_TRACE("do_ipsintr", 2);
 
@@ -1909,7 +1909,7 @@ ips_intr_copperhead(ips_ha_t *ha) {
    ips_scb_t        *scb;
    IPS_STATUS        cstatus;
    int               intrstatus;
-   u32               cpu_flags;
+   unsigned long     cpu_flags;
 
    METHOD_TRACE("ips_intr", 2);
 
@@ -1981,7 +1981,7 @@ ips_intr_morpheus(ips_ha_t *ha) {
    ips_scb_t        *scb;
    IPS_STATUS        cstatus;
    int               intrstatus;
-   u32               cpu_flags;
+   unsigned long     cpu_flags;
 
    METHOD_TRACE("ips_intr_morpheus", 2);
 
@@ -3548,8 +3548,8 @@ ips_next(ips_ha_t *ha, int intr) {
    ips_copp_wait_item_t *item;
    int                   ret;
    int                   intr_status;
-   u32                   cpu_flags;
-   u32                   cpu_flags2;
+   unsigned long         cpu_flags;
+   unsigned long         cpu_flags2;
 
    METHOD_TRACE("ips_next", 1);
 
@@ -4403,7 +4403,7 @@ ipsintr_done(ips_ha_t *ha, ips_scb_t *scb) {
 static void
 ips_done(ips_ha_t *ha, ips_scb_t *scb) {
    int ret;
-   u32 cpu_flags;
+   unsigned long cpu_flags;
 
    METHOD_TRACE("ips_done", 1);
 
@@ -5520,7 +5520,7 @@ ips_init_scb(ips_ha_t *ha, ips_scb_t *scb) {
 static ips_scb_t *
 ips_getscb(ips_ha_t *ha) {
    ips_scb_t     *scb;
-   u32            cpu_flags;
+   unsigned long  cpu_flags;
 
    METHOD_TRACE("ips_getscb", 1);
 
@@ -5554,7 +5554,7 @@ ips_getscb(ips_ha_t *ha) {
 /****************************************************************************/
 static void
 ips_freescb(ips_ha_t *ha, ips_scb_t *scb) {
-   u32          cpu_flags;
+   unsigned long cpu_flags;
 
    METHOD_TRACE("ips_freescb", 1);
 
@@ -5967,7 +5967,7 @@ ips_init_morpheus(ips_ha_t *ha) {
 static int
 ips_reset_copperhead(ips_ha_t *ha) {
    int reset_counter;
-   u32 cpu_flags;
+   unsigned long cpu_flags;
 
    METHOD_TRACE("ips_reset_copperhead", 1);
 
@@ -6012,7 +6012,7 @@ ips_reset_copperhead(ips_ha_t *ha) {
 static int
 ips_reset_copperhead_memio(ips_ha_t *ha) {
    int reset_counter;
-   u32 cpu_flags;
+   unsigned long cpu_flags;
 
    METHOD_TRACE("ips_reset_copperhead_memio", 1);
 
@@ -6058,7 +6058,7 @@ static int
 ips_reset_morpheus(ips_ha_t *ha) {
    int reset_counter;
    u8  junk;
-   u32 cpu_flags;
+   unsigned long cpu_flags;
 
    METHOD_TRACE("ips_reset_morpheus", 1);
 
@@ -6237,7 +6237,7 @@ static int
 ips_issue_copperhead(ips_ha_t *ha, ips_scb_t *scb) {
    u32       TimeOut;
    u16       val;
-   u32       cpu_flags;
+   unsigned long       cpu_flags;
 
    METHOD_TRACE("ips_issue_copperhead", 1);
 
@@ -6300,7 +6300,7 @@ static int
 ips_issue_copperhead_memio(ips_ha_t *ha, ips_scb_t *scb) {
    u32       TimeOut;
    u32       val;
-   u32       cpu_flags;
+   unsigned long cpu_flags;
 
    METHOD_TRACE("ips_issue_copperhead_memio", 1);
 
@@ -6361,7 +6361,7 @@ ips_issue_copperhead_memio(ips_ha_t *ha, ips_scb_t *scb) {
 /****************************************************************************/
 static int
 ips_issue_i2o(ips_ha_t *ha, ips_scb_t *scb) {
-   u32       cpu_flags;
+   unsigned long cpu_flags;
 
    METHOD_TRACE("ips_issue_i2o", 1);
 
@@ -6401,7 +6401,7 @@ ips_issue_i2o(ips_ha_t *ha, ips_scb_t *scb) {
 /****************************************************************************/
 static int
 ips_issue_i2o_memio(ips_ha_t *ha, ips_scb_t *scb) {
-   u32       cpu_flags;
+   unsigned long cpu_flags;
 
    METHOD_TRACE("ips_issue_i2o_memio", 1);
 
index e3af0dbcfc29c87c5338501dd0f963294e2f5da1..dc4681cd4d7c0058fd5b7cf04605f14f38cda816 100644 (file)
@@ -34,8 +34,6 @@
 
 #define MAX_BUF PAGE_SIZE
 
-#define max(a,b) (((a) > (b)) ? (a) : (b))
-
 /*
  * If we are told to probe a host, we will return 0 if  the host is not
  * present, 1 if the host is present, and will return an identifying
index 65439514eeceeb15533de5c092e7949faedd3ed7..6abdd0360e6c636c9042067505dc4677bdfa2e03 100644 (file)
@@ -545,7 +545,7 @@ int sr_dev_ioctl(struct cdrom_device_info *cdi,
 
        switch (cmd) {
        case BLKGETSIZE:
-               return put_user(scsi_CDs[target].capacity >> 1, (long *) arg);
+               return put_user(scsi_CDs[target].capacity, (long *) arg);
        case BLKROSET:
        case BLKROGET:
        case BLKRASET:
index 66cf93a9aa3a6c8d898718bf917c703920c6bc0f..f52500046f3f4ea52d25a77fb8f65d8cb490fcb8 100644 (file)
@@ -32,7 +32,9 @@
 #include <linux/poll.h>
 #include <linux/sound.h>
 #include <linux/soundcard.h>
+#include <linux/slab.h>
 #include <asm/uaccess.h>
+#include <asm/io.h>
 
 
 /* mmio access */
@@ -850,7 +852,7 @@ static int __devinit btaudio_probe(struct pci_dev *pci_dev,
        /* init hw */
         btwrite(0, REG_GPIO_DMA_CTL);
         btwrite(0, REG_INT_MASK);
-        btwrite(~0x0UL, REG_INT_STAT);
+        btwrite(~(u32)0x0, REG_INT_STAT);
        pci_set_master(pci_dev);
 
        if ((rc = request_irq(bta->irq, btaudio_irq, SA_SHIRQ|SA_INTERRUPT,
@@ -902,7 +904,7 @@ static void __devexit btaudio_remove(struct pci_dev *pci_dev)
        /* turn off all DMA / IRQs */
         btand(~15, REG_GPIO_DMA_CTL);
         btwrite(0, REG_INT_MASK);
-        btwrite(~0x0UL, REG_INT_STAT);
+        btwrite(~(u32)0x0, REG_INT_STAT);
 
        /* unregister devices */
        unregister_sound_dsp(bta->dsp_dev);
index ff799552269d18b405df014fc79e63feb7ae37dc..7d77b9f7ae418c5a9e3997474f5d31cf51b84b23 100644 (file)
@@ -47,7 +47,6 @@
 #define MAX_BUFSIZE            128     /* Limit for Amiga in KB */
 
 
-#define min(x, y)      ((x) < (y) ? (x) : (y))
 #define le2be16(x)     (((x)<<8 & 0xff00) | ((x)>>8 & 0x00ff))
 #define le2be16dbl(x)  (((x)<<8 & 0xff00ff00) | ((x)>>8 & 0x00ff00ff))
 
index 0845ecd522ba3dcc60cea3d4249267f6642664cc..619a3e874c28c59cde774132741c5ecc7ce6306a 100644 (file)
@@ -154,7 +154,7 @@ static ssize_t ata_ct_law(const u_char *userPtr, size_t userCount,
        ssize_t count, used;
        u_char *p = &frame[*frameUsed];
 
-       count = min(userCount, frameLeft);
+       count = min(unsigned long, userCount, frameLeft);
        if (dmasound.soft.stereo)
                count &= ~1;
        used = count;
@@ -177,7 +177,7 @@ static ssize_t ata_ct_s8(const u_char *userPtr, size_t userCount,
        ssize_t count, used;
        void *p = &frame[*frameUsed];
 
-       count = min(userCount, frameLeft);
+       count = min(unsigned long, userCount, frameLeft);
        if (dmasound.soft.stereo)
                count &= ~1;
        used = count;
@@ -196,7 +196,7 @@ static ssize_t ata_ct_u8(const u_char *userPtr, size_t userCount,
 
        if (!dmasound.soft.stereo) {
                u_char *p = &frame[*frameUsed];
-               count = min(userCount, frameLeft);
+               count = min(unsigned long, userCount, frameLeft);
                used = count;
                while (count > 0) {
                        u_char data;
@@ -207,7 +207,7 @@ static ssize_t ata_ct_u8(const u_char *userPtr, size_t userCount,
                }
        } else {
                u_short *p = (u_short *)&frame[*frameUsed];
-               count = min(userCount, frameLeft)>>1;
+               count = min(unsigned long, userCount, frameLeft)>>1;
                used = count*2;
                while (count > 0) {
                        u_short data;
@@ -230,7 +230,7 @@ static ssize_t ata_ct_s16be(const u_char *userPtr, size_t userCount,
 
        if (!dmasound.soft.stereo) {
                u_short *p = (u_short *)&frame[*frameUsed];
-               count = min(userCount, frameLeft)>>1;
+               count = min(unsigned long, userCount, frameLeft)>>1;
                used = count*2;
                while (count > 0) {
                        u_short data;
@@ -243,7 +243,7 @@ static ssize_t ata_ct_s16be(const u_char *userPtr, size_t userCount,
                *frameUsed += used*2;
        } else {
                void *p = (u_short *)&frame[*frameUsed];
-               count = min(userCount, frameLeft) & ~3;
+               count = min(unsigned long, userCount, frameLeft) & ~3;
                used = count;
                if (copy_from_user(p, userPtr, count))
                        return -EFAULT;
@@ -261,7 +261,7 @@ static ssize_t ata_ct_u16be(const u_char *userPtr, size_t userCount,
 
        if (!dmasound.soft.stereo) {
                u_short *p = (u_short *)&frame[*frameUsed];
-               count = min(userCount, frameLeft)>>1;
+               count = min(unsigned long, userCount, frameLeft)>>1;
                used = count*2;
                while (count > 0) {
                        u_short data;
@@ -275,7 +275,7 @@ static ssize_t ata_ct_u16be(const u_char *userPtr, size_t userCount,
                *frameUsed += used*2;
        } else {
                u_long *p = (u_long *)&frame[*frameUsed];
-               count = min(userCount, frameLeft)>>2;
+               count = min(unsigned long, userCount, frameLeft)>>2;
                used = count*4;
                while (count > 0) {
                        u_long data;
@@ -299,7 +299,7 @@ static ssize_t ata_ct_s16le(const u_char *userPtr, size_t userCount,
        count = frameLeft;
        if (!dmasound.soft.stereo) {
                u_short *p = (u_short *)&frame[*frameUsed];
-               count = min(userCount, frameLeft)>>1;
+               count = min(unsigned long, userCount, frameLeft)>>1;
                used = count*2;
                while (count > 0) {
                        u_short data;
@@ -313,7 +313,7 @@ static ssize_t ata_ct_s16le(const u_char *userPtr, size_t userCount,
                *frameUsed += used*2;
        } else {
                u_long *p = (u_long *)&frame[*frameUsed];
-               count = min(userCount, frameLeft)>>2;
+               count = min(unsigned long, userCount, frameLeft)>>2;
                used = count*4;
                while (count > 0) {
                        u_long data;
@@ -338,7 +338,7 @@ static ssize_t ata_ct_u16le(const u_char *userPtr, size_t userCount,
        count = frameLeft;
        if (!dmasound.soft.stereo) {
                u_short *p = (u_short *)&frame[*frameUsed];
-               count = min(userCount, frameLeft)>>1;
+               count = min(unsigned long, userCount, frameLeft)>>1;
                used = count*2;
                while (count > 0) {
                        u_short data;
@@ -351,7 +351,7 @@ static ssize_t ata_ct_u16le(const u_char *userPtr, size_t userCount,
                *frameUsed += used*2;
        } else {
                u_long *p = (u_long *)&frame[*frameUsed];
-               count = min(userCount, frameLeft)>>2;
+               count = min(unsigned long, userCount, frameLeft)>>2;
                used = count;
                while (count > 0) {
                        u_long data;
index 2f85ffc27234b293dd2edfb56e7f218429e3014b..9143101a52ea077ef7ed5a8b84e93b79a92f5fc8 100644 (file)
@@ -267,7 +267,7 @@ static ssize_t pmac_ct_law(const u_char *userPtr, size_t userCount,
        frameLeft >>= 2;
        if (stereo)
                userCount >>= 1;
-       used = count = min(userCount, frameLeft);
+       used = count = min(unsigned long, userCount, frameLeft);
        while (count > 0) {
                u_char data;
                if (get_user(data, userPtr++))
@@ -298,7 +298,7 @@ static ssize_t pmac_ct_s8(const u_char *userPtr, size_t userCount,
        frameLeft >>= 2;
        if (stereo)
                userCount >>= 1;
-       used = count = min(userCount, frameLeft);
+       used = count = min(unsigned long, userCount, frameLeft);
        while (count > 0) {
                u_char data;
                if (get_user(data, userPtr++))
@@ -329,7 +329,7 @@ static ssize_t pmac_ct_u8(const u_char *userPtr, size_t userCount,
        frameLeft >>= 2;
        if (stereo)
                userCount >>= 1;
-       used = count = min(userCount, frameLeft);
+       used = count = min(unsigned long, userCount, frameLeft);
        while (count > 0) {
                u_char data;
                if (get_user(data, userPtr++))
@@ -359,7 +359,7 @@ static ssize_t pmac_ct_s16(const u_char *userPtr, size_t userCount,
 
        frameLeft >>= 2;
        userCount >>= (stereo? 2: 1);
-       used = count = min(userCount, frameLeft);
+       used = count = min(unsigned long, userCount, frameLeft);
        if (!stereo) {
                short *up = (short *) userPtr;
                while (count > 0) {
@@ -390,7 +390,7 @@ static ssize_t pmac_ct_u16(const u_char *userPtr, size_t userCount,
 
        frameLeft >>= 2;
        userCount >>= (stereo? 2: 1);
-       used = count = min(userCount, frameLeft);
+       used = count = min(unsigned long, userCount, frameLeft);
        while (count > 0) {
                int data;
                if (get_user(data, up++))
@@ -648,7 +648,7 @@ static ssize_t pmac_ct_s8_read(const u_char *userPtr, size_t userCount,
        frameLeft >>= 2;
        if (stereo)
                userCount >>= 1;
-       used = count = min(userCount, frameLeft);
+       used = count = min(unsigned long, userCount, frameLeft);
        while (count > 0) {
                u_char data;
 
@@ -681,7 +681,7 @@ static ssize_t pmac_ct_u8_read(const u_char *userPtr, size_t userCount,
        frameLeft >>= 2;
        if (stereo)
                userCount >>= 1;
-       used = count = min(userCount, frameLeft);
+       used = count = min(unsigned long, userCount, frameLeft);
        while (count > 0) {
                u_char data;
 
@@ -713,7 +713,7 @@ static ssize_t pmac_ct_s16_read(const u_char *userPtr, size_t userCount,
 
        frameLeft >>= 2;
        userCount >>= (stereo? 2: 1);
-       used = count = min(userCount, frameLeft);
+       used = count = min(unsigned long, userCount, frameLeft);
        if (!stereo) {
                short *up = (short *) userPtr;
                while (count > 0) {
@@ -744,7 +744,7 @@ static ssize_t pmac_ct_u16_read(const u_char *userPtr, size_t userCount,
 
        frameLeft >>= 2;
        userCount >>= (stereo? 2: 1);
-       used = count = min(userCount, frameLeft);
+       used = count = min(unsigned long, userCount, frameLeft);
        while (count > 0) {
                int data;
 
index d76c079371d23fad509fd26626a75f3b0d3a2339..1ec6382759e52100edc3efefd8cc119f7fd38584 100644 (file)
@@ -155,14 +155,14 @@ static ssize_t ami_ct_s8(const u_char *userPtr, size_t userCount,
 
        if (!dmasound.soft.stereo) {
                void *p = &frame[*frameUsed];
-               count = min(userCount, frameLeft) & ~1;
+               count = min(unsigned long, userCount, frameLeft) & ~1;
                used = count;
                if (copy_from_user(p, userPtr, count))
                        return -EFAULT;
        } else {
                u_char *left = &frame[*frameUsed>>1];
                u_char *right = left+write_sq_block_size_half;
-               count = min(userCount, frameLeft)>>1 & ~1;
+               count = min(unsigned long, userCount, frameLeft)>>1 & ~1;
                used = count*2;
                while (count > 0) {
                        if (get_user(*left++, userPtr++)
@@ -189,7 +189,7 @@ static ssize_t funcname(const u_char *userPtr, size_t userCount,    \
                                                                        \
        if (!dmasound.soft.stereo) {                                    \
                u_char *p = &frame[*frameUsed];                         \
-               count = min(userCount, frameLeft) & ~1;                 \
+               count = min(unsigned long, userCount, frameLeft) & ~1;  \
                used = count;                                           \
                while (count > 0) {                                     \
                        u_char data;                                    \
@@ -201,7 +201,7 @@ static ssize_t funcname(const u_char *userPtr, size_t userCount,    \
        } else {                                                        \
                u_char *left = &frame[*frameUsed>>1];                   \
                u_char *right = left+write_sq_block_size_half;          \
-               count = min(userCount, frameLeft)>>1 & ~1;              \
+               count = min(unsigned long, userCount, frameLeft)>>1 & ~1;\
                used = count*2;                                         \
                while (count > 0) {                                     \
                        u_char data;                                    \
@@ -242,7 +242,7 @@ static ssize_t funcname(const u_char *userPtr, size_t userCount,    \
        if (!dmasound.soft.stereo) {                                    \
                u_char *high = &frame[*frameUsed>>1];                   \
                u_char *low = high+write_sq_block_size_half;            \
-               count = min(userCount, frameLeft)>>1 & ~1;              \
+               count = min(unsigned long, userCount, frameLeft)>>1 & ~1;\
                used = count*2;                                         \
                while (count > 0) {                                     \
                        if (get_user(data, ((u_short *)userPtr)++))     \
@@ -257,7 +257,7 @@ static ssize_t funcname(const u_char *userPtr, size_t userCount,    \
                u_char *leftl = lefth+write_sq_block_size_quarter;      \
                u_char *righth = lefth+write_sq_block_size_half;        \
                u_char *rightl = righth+write_sq_block_size_quarter;    \
-               count = min(userCount, frameLeft)>>2 & ~1;              \
+               count = min(unsigned long, userCount, frameLeft)>>2 & ~1;\
                used = count*4;                                         \
                while (count > 0) {                                     \
                        if (get_user(data, ((u_short *)userPtr)++))     \
index db6960c147da972be1e758e55f6ee6eb184e24c7..542935113ecf0341220c51031e90032bc339e434 100644 (file)
@@ -58,7 +58,7 @@ static ssize_t q40_ct_law(const u_char *userPtr, size_t userCount,
        ssize_t count, used;
        u_char *p = (u_char *) &frame[*frameUsed];
 
-       used = count = min(userCount, frameLeft);
+       used = count = min(unsigned long, userCount, frameLeft);
        if (copy_from_user(p,userPtr,count))
          return -EFAULT;
        while (count > 0) {
@@ -84,7 +84,7 @@ static ssize_t q40_ct_law(const u_char *userPtr, size_t userCount,
        frameLeft >>= 1;
        if (stereo)
                userCount >>= 1;
-       used = count = min(userCount, frameLeft);
+       used = count = min(unsigned long, userCount, frameLeft);
        while (count > 0) {
                u_char data;
                if (get_user(data, userPtr++))
@@ -112,7 +112,7 @@ static ssize_t q40_ct_s8(const u_char *userPtr, size_t userCount,
        ssize_t count, used;
        u_char *p = (u_char *) &frame[*frameUsed];
 
-       used = count = min(userCount, frameLeft);
+       used = count = min(unsigned long, userCount, frameLeft);
        if (copy_from_user(p,userPtr,count))
          return -EFAULT;
        while (count > 0) {
@@ -136,7 +136,7 @@ static ssize_t q40_ct_s8(const u_char *userPtr, size_t userCount,
        frameLeft >>= 1;
        if (stereo)
                userCount >>= 1;
-       used = count = min(userCount, frameLeft);
+       used = count = min(unsigned long, userCount, frameLeft);
        while (count > 0) {
                u_char data;
                if (get_user(data, userPtr++))
@@ -164,7 +164,7 @@ static ssize_t q40_ct_u8(const u_char *userPtr, size_t userCount,
        ssize_t count, used;
        u_char *p = (u_char *) &frame[*frameUsed];
 
-       used = count = min(userCount, frameLeft);
+       used = count = min(unsigned long, userCount, frameLeft);
        if (copy_from_user(p,userPtr,count))
          return -EFAULT;
        *frameUsed += used;
@@ -184,7 +184,7 @@ static ssize_t q40_ct_u8(const u_char *userPtr, size_t userCount,
        frameLeft >>= 1;
        if (stereo)
                userCount >>= 1;
-       used = count = min(userCount, frameLeft);
+       used = count = min(unsigned long, userCount, frameLeft);
        while (count > 0) {
                u_char data;
                if (get_user(data, userPtr++))
index 15b5e3fb5de0f50fd2428f9d846fed0e15c64011..dd49c2f4a128fc6c8bd783941f1d4e524094f54e 100644 (file)
@@ -115,7 +115,7 @@ static ssize_t emu10k1_audio_read(struct file *file, char *buffer, size_t count,
 
                if ((bytestocopy >= wiinst->buffer.fragment_size)
                    || (bytestocopy >= count)) {
-                       bytestocopy = min(bytestocopy, count);
+                       bytestocopy = min(u32, bytestocopy, count);
 
                        emu10k1_wavein_xferdata(wiinst, (u8 *) buffer, &bytestocopy);
 
@@ -215,7 +215,7 @@ static ssize_t emu10k1_audio_write(struct file *file, const char *buffer, size_t
                if ((bytestocopy >= woinst->buffer.fragment_size)
                    || (bytestocopy >= count)) {
 
-                       bytestocopy = min(bytestocopy, count);
+                       bytestocopy = min(u32, bytestocopy, count);
 
                        emu10k1_waveout_xferdata(woinst, (u8 *) buffer, &bytestocopy);
 
index 03c459512bd647af5975901b9e6b076c571755ff..184dcd5a8c8d39b0b34babac4ede02b00786c415 100644 (file)
@@ -325,7 +325,7 @@ void emu10k1_wavein_xferdata(struct wiinst *wiinst, u8 * data, u32 * size)
        u32 sizetocopy, sizetocopy_now, start;
        unsigned long flags;
 
-       sizetocopy = min(buffer->size, *size);
+       sizetocopy = min(u32, buffer->size, *size);
        *size = sizetocopy;
 
        if (!sizetocopy)
index 0d72f4d6348f68eee40cc9b0ee87404ea3edce11..c0191962766308c11726ed9fcbb649603fe7f3a2 100644 (file)
@@ -581,7 +581,7 @@ void emu10k1_waveout_xferdata(struct woinst *woinst, u8 *data, u32 *size)
        u32 sizetocopy, sizetocopy_now, start;
        unsigned long flags;
 
-       sizetocopy = min(buffer->size, *size);
+       sizetocopy = min(u32, buffer->size, *size);
        *size = sizetocopy;
 
        if (!sizetocopy)
index 300ca5e4fbd5459cf283f4aed5190fd6f386b888..bde2e866bc7082e5d9ee2a34bdcd84543ef8b6a7 100644 (file)
@@ -53,8 +53,6 @@
 #define FLAGS_AVAILABLE     0x0001
 #define FLAGS_READY         0x0002
 
-#define min(x,y) ((x) < (y)) ? (x) : (y)
-
 struct memhandle
 {
        dma_addr_t dma_handle;
index 18e82fdf9ca7d8313ad4b91470a54f4e09523b69..1089b94088178a7a4ccfb64e24225fa52776fcf4 100644 (file)
@@ -1844,14 +1844,15 @@ ssize_t ixj_read(struct file * file_p, char *buf, size_t length, loff_t * ppos)
        remove_wait_queue(&j->read_q, &wait);
        set_current_state(TASK_RUNNING);
        /* Don't ever copy more than the user asks */
-       i = copy_to_user(buf, j->read_buffer, min(length, j->read_buffer_size));
+       i = copy_to_user(buf, j->read_buffer,
+                        min(unsigned int, length, j->read_buffer_size));
        j->read_buffer_ready = 0;
        if (i) {
                j->flags.inread = 0;
                return -EFAULT;
        } else {
                j->flags.inread = 0;
-               return min(length, j->read_buffer_size);
+               return min(unsigned int, length, j->read_buffer_size);
        }
 }
 
@@ -1934,13 +1935,14 @@ ssize_t ixj_write(struct file *file_p, const char *buf, size_t count, loff_t * p
        remove_wait_queue(&j->write_q, &wait);
        if (j->write_buffer_wp + count >= j->write_buffer_end)
                j->write_buffer_wp = j->write_buffer;
-       i = copy_from_user(j->write_buffer_wp, buf, min(count, j->write_buffer_size));
+       i = copy_from_user(j->write_buffer_wp, buf,
+                          min(unsigned int, count, j->write_buffer_size));
        if (i) {
                j->flags.inwrite = 0;
                return -EFAULT;
        }
        j->flags.inwrite = 0;
-       return min(count, j->write_buffer_size);
+       return min(unsigned int, count, j->write_buffer_size);
 }
 
 ssize_t ixj_enhanced_write(struct file * file_p, const char *buf, size_t count, loff_t * ppos)
index 560c10271f5dc1e403e6789b9e991d626f6919de..43cc9fe436e147e648d8b7a1ba0765390c4968bf 100644 (file)
@@ -54,13 +54,6 @@ typedef __u8 BOOL;
 #define TRUE 1
 #define FALSE 0
 
-#ifndef min
-#define min(a,b) (((a)<(b))?(a):(b))
-#endif
-#ifndef max
-#define max(a,b) (((a)>(b))?(a):(b))
-#endif
-
 /******************************************************************************
 *
 *  This structure when unioned with the structures below makes simple byte
index 7f0c0df732c584766596ed7d47cdecbc917d6d37..714449eb437ddcfd5d8116a438501f290b081c8e 100644 (file)
@@ -1082,7 +1082,7 @@ static int proc_ioctl (struct dev_state *ps, void *arg)
                if (retval == 0)
                        /* ifno might usefully be passed ... */
                        retval = ifp->driver->ioctl (ps->dev, ctrl.ioctl_code, buf);
-                       /* size = min (size, retval)? */
+                       /* size = min(int, size, retval)? */
        }
 
        /* cleanup and return */
index 9a0f75198c3049265709b1ba9bd13fbeb7511e8a..3cfac6cf68385ad46da7e7de84d358dc3399cfe6 100644 (file)
 
 // TxCredits value below which driver won't bother sending (to prevent too many small writes).
 // Send only if above 25%
-#define EDGE_FW_GET_TX_CREDITS_SEND_THRESHOLD(InitialCredit)   (max( ((InitialCredit) / 4), EDGE_FW_BULK_MAX_PACKET_SIZE ))
+#define EDGE_FW_GET_TX_CREDITS_SEND_THRESHOLD(InitialCredit)   (max(int, ((InitialCredit) / 4), EDGE_FW_BULK_MAX_PACKET_SIZE))
 
 #define        EDGE_FW_BULK_MAX_PACKET_SIZE            64      // Max Packet Size for Bulk In Endpoint (EP1)
 #define EDGE_FW_BULK_READ_BUFFER_SIZE          1024    // Size to use for Bulk reads
index 57b18b765a550f49eb5d3eb1ff6c5ae3bd5e7be8..c98b8caac6800998767e1bb636c9f3eec4d99cc9 100644 (file)
@@ -204,7 +204,7 @@ static int datafab_read_data(struct us_data *us,
 
        do {
                // loop, never allocate or transfer more than 64k at once (min(128k, 255*info->ssize) is the real limit)
-               len = min(totallen, 65536);
+               len = min(int, totallen, 65536);
 
                if (use_sg) {
                        sg = (struct scatterlist *) dest;
@@ -329,7 +329,7 @@ static int datafab_write_data(struct us_data *us,
 
        do {
                // loop, never allocate or transfer more than 64k at once (min(128k, 255*info->ssize) is the real limit)
-               len = min(totallen, 65536);
+               len = min(int, totallen, 65536);
 
                if (use_sg) {
                        sg = (struct scatterlist *) src;
index 7453d8b39aa3aae9ac40fbdc9b776470eba8f7be..5515583ddce31e8ffe72e09c34de2036aeece531 100644 (file)
@@ -24,8 +24,6 @@
 #ifndef _USB_DATAFAB_MDCFE_B_H
 #define _USB_DATAFAB_MDCFE_B_H
 
-#define min(a,b) (((a)<(b))?(a):(b))  // this is defined in tons of header files, i wish it had a standard single definition...
-
 extern int datafab_transport(Scsi_Cmnd *srb, struct us_data *us);
 
 struct datafab_info {
index 0730eac4ca4f78eda28c82381b77e5de5b4a337e..9462a601572a96d18c38b80e0b964c5abb2b3dd0 100644 (file)
@@ -280,7 +280,7 @@ static int jumpshot_read_data(struct us_data *us,
 
        do {
                // loop, never allocate or transfer more than 64k at once (min(128k, 255*info->ssize) is the real limit)
-                len = min(totallen, 65536);
+                len = min(int, totallen, 65536);
 
                 if (use_sg) {
                         sg = (struct scatterlist *) dest;
@@ -395,7 +395,7 @@ static int jumpshot_write_data(struct us_data *us,
 
        do {
                 // loop, never allocate or transfer more than 64k at once (min(128k, 255*info->ssize) is the real limit)
-                len = min(totallen, 65536);
+                len = min(int, totallen, 65536);
 
                 if (use_sg) {
                         sg = (struct scatterlist *) src;
index 6d28cb204f1fa3a9abee49ab483e4216acb8be91..8147197cd4fc47438062cfd857b60365d2e48402 100644 (file)
@@ -24,8 +24,6 @@
 #ifndef _USB_JUMPSHOT_H
 #define _USB_JUMPSHOT_H
 
-#define min(a,b) (((a)<(b))?(a):(b))  // this is defined in tons of header files, i wish it had a standar single definition...
-
 extern int jumpshot_transport(Scsi_Cmnd *srb, struct us_data *us);
 
 struct jumpshot_info {
index 1edd3b1ae1ea4ccba403183be317adb7428995e1..dbba809ff82ee9e0857a5344e1d7a13140995371 100644 (file)
@@ -98,8 +98,6 @@ static int  ports_active(struct uhci *uhci);
 static void suspend_hc(struct uhci *uhci);
 static void wakeup_hc(struct uhci *uhci);
 
-#define min(a,b) (((a)<(b))?(a):(b))
-
 /* If a transfer is still active after this much time, turn off FSBR */
 #define IDLE_TIMEOUT   (HZ / 20)       /* 50 ms */
 
@@ -2133,11 +2131,15 @@ static int rh_submit_urb(struct urb *urb)
        case RH_GET_DESCRIPTOR:
                switch ((wValue & 0xff00) >> 8) {
                case 0x01:      /* device descriptor */
-                       len = min(leni, min(sizeof(root_hub_dev_des), wLength));
+                       len = min(unsigned int, leni,
+                                 min(unsigned int,
+                                     sizeof(root_hub_dev_des), wLength));
                        memcpy(data, root_hub_dev_des, len);
                        OK(len);
                case 0x02:      /* configuration descriptor */
-                       len = min(leni, min(sizeof(root_hub_config_des), wLength));
+                       len = min(unsigned int, leni,
+                                 min(unsigned int,
+                                     sizeof(root_hub_config_des), wLength));
                        memcpy (data, root_hub_config_des, len);
                        OK(len);
                case 0x03:      /* string descriptors */
@@ -2145,14 +2147,15 @@ static int rh_submit_urb(struct urb *urb)
                                uhci->io_addr, "UHCI-alt",
                                data, wLength);
                        if (len > 0) {
-                               OK (min (leni, len));
+                               OK(min(int, leni, len));
                        } else 
                                stat = -EPIPE;
                }
                break;
        case RH_GET_DESCRIPTOR | RH_CLASS:
                root_hub_hub_des[2] = uhci->rh.numports;
-               len = min(leni, min(sizeof(root_hub_hub_des), wLength));
+               len = min(unsigned int, leni,
+                         min(unsigned int, sizeof(root_hub_hub_des), wLength));
                memcpy(data, root_hub_hub_des, len);
                OK(len);
        case RH_GET_CONFIGURATION:
index 5e264d766fca3f7d10bc988eea80600bc421703c..dd1c2d0d2f31339ad95ac7686e9e1dc11d505a85 100644 (file)
@@ -1805,7 +1805,9 @@ static int rh_send_irq (ohci_t * ohci, void * rh_data, int rh_len)
        len = i/8 + 1;
   
        if (ret > 0) { 
-               memcpy (rh_data, data, min (len, min (rh_len, sizeof(data))));
+               memcpy(rh_data, data,
+                      min(unsigned int, len,
+                          min(unsigned int, rh_len, sizeof(data))));
                return len;
        }
        return 0;
@@ -1987,10 +1989,18 @@ static int rh_submit_urb (urb_t * urb)
                case RH_GET_DESCRIPTOR:
                        switch ((wValue & 0xff00) >> 8) {
                                case (0x01): /* device descriptor */
-                                       len = min (leni, min (sizeof (root_hub_dev_des), wLength));
+                                       len = min(unsigned int,
+                                                 leni,
+                                                 min(unsigned int,
+                                                     sizeof (root_hub_dev_des),
+                                                     wLength));
                                        data_buf = root_hub_dev_des; OK(len);
                                case (0x02): /* configuration descriptor */
-                                       len = min (leni, min (sizeof (root_hub_config_des), wLength));
+                                       len = min(unsigned int,
+                                                 leni,
+                                                 min(unsigned int,
+                                                     sizeof (root_hub_config_des),
+                                                     wLength));
                                        data_buf = root_hub_config_des; OK(len);
                                case (0x03): /* string descriptors */
                                        len = usb_root_hub_string (wValue & 0xff,
@@ -1998,7 +2008,7 @@ static int rh_submit_urb (urb_t * urb)
                                                data, wLength);
                                        if (len > 0) {
                                                data_buf = data;
-                                               OK (min (leni, len));
+                                               OK(min(int, leni, len));
                                        }
                                        // else fallthrough
                                default: 
@@ -2033,7 +2043,8 @@ static int rh_submit_urb (urb_t * urb)
                                data_buf [10] = data_buf [9] = 0xff;
                            }
                                
-                           len = min (leni, min (data_buf [0], wLength));
+                           len = min(unsigned int, leni,
+                                     min(unsigned int, data_buf [0], wLength));
                            OK (len);
                        }
  
@@ -2050,7 +2061,7 @@ static int rh_submit_urb (urb_t * urb)
        // ohci_dump_roothub (ohci, 0);
 #endif
 
-       len = min(len, leni);
+       len = min(int, len, leni);
        if (data != data_buf)
            memcpy (data, data_buf, len);
        urb->actual_length = len;
index 75288d333f7e99b524d71373630261159226f15b..0ad3813ae32e1cda5cb64715a258a44c590d888e 100644 (file)
@@ -329,9 +329,6 @@ struct virt_root_hub {
 #define        RH_A_NOCP       (1 << 12)               /* no over current protection */
 #define        RH_A_POTPGT     (0xff << 24)            /* power on to power good time */
 
-#define min(a,b) (((a)<(b))?(a):(b))  
-
 /* urb */
 typedef struct 
 {
index 4aa3080d39c263c73bb9a25267c8f9a17b2a900a..4b23cfe1adcc1346a058fb7e9c5e320b15af7cf0 100644 (file)
@@ -2159,11 +2159,15 @@ _static int rh_submit_urb (urb_t *urb)
        case RH_GET_DESCRIPTOR:
                switch ((wValue & 0xff00) >> 8) {
                case (0x01):    /* device descriptor */
-                       len = min (leni, min (sizeof (root_hub_dev_des), wLength));
+                       len = min(unsigned int, leni,
+                                 min(unsigned int,
+                                     sizeof (root_hub_dev_des), wLength));
                        memcpy (data, root_hub_dev_des, len);
                        OK (len);
                case (0x02):    /* configuration descriptor */
-                       len = min (leni, min (sizeof (root_hub_config_des), wLength));
+                       len = min(unsigned int, leni,
+                                 min(unsigned int,
+                                     sizeof (root_hub_config_des), wLength));
                        memcpy (data, root_hub_config_des, len);
                        OK (len);
                case (0x03):    /* string descriptors */
@@ -2171,7 +2175,7 @@ _static int rh_submit_urb (urb_t *urb)
                                uhci->io_addr, "UHCI",
                                data, wLength);
                        if (len > 0) {
-                               OK (min (leni, len));
+                               OK(min(int, leni, len));
                        } else 
                                stat = -EPIPE;
                }
@@ -2179,7 +2183,8 @@ _static int rh_submit_urb (urb_t *urb)
 
        case RH_GET_DESCRIPTOR | RH_CLASS:
                root_hub_hub_des[2] = uhci->rh.numports;
-               len = min (leni, min (sizeof (root_hub_hub_des), wLength));
+               len = min(unsigned int, leni,
+                         min(unsigned int, sizeof (root_hub_hub_des), wLength));
                memcpy (data, root_hub_hub_des, len);
                OK (len);
 
index 84b47949c7696c6fac41078e149b10cc49c4c85d..7ab3757bb8ae144946c829323cd84fda94ce8dba 100644 (file)
@@ -282,6 +282,4 @@ typedef struct uhci {
 #define RH_REQ_ERR                 -1
 #define RH_NACK                    0x00
 
-#define min(a,b) (((a)<(b))?(a):(b))
-
 #endif
index 38633668ebd7cf3b4bf01d57cb9113fcef5e40fe..825959e18998e9072b291888d4c636c7d5683fec 100644 (file)
@@ -592,9 +592,6 @@ static u_short maxfmode, chipset;
        ((((long)((unsigned long long)x1 >> 8) % x2) << 8) / x2))
 #endif
 
-#define min(a, b)      ((a) < (b) ? (a) : (b))
-#define max(a, b)      ((a) > (b) ? (a) : (b))
-
 #define highw(x)       ((u_long)(x)>>16 & 0xffff)
 #define loww(x)                ((u_long)(x) & 0xffff)
 
index 2acff941a099835ca0191adf6ceecc3d628fcf35..8435c430ad270c08d4add3e54ce781c2499d260a 100644 (file)
 
 /**************************************************/
 
-#ifndef min
-#define min(a,b)       ((a) < (b) ? (a) : (b))
-#endif /* !min */
-
-#ifndef max
-#define max(a,b)       ((a) > (b) ? (a) : (b))
-#endif /* !max */
-
 /* support for a BitBlt operation. The op-codes are identical
    to X11 GCs */
 #define        GRFBBOPclear            0x0     /* 0 */
index 55c416e8a63ccb9588196af363bf21dac028e508..3a5b99524225873906c29f72e8ed2ae22f2afd08 100644 (file)
@@ -794,6 +794,17 @@ void set_blocksize(kdev_t dev, int size)
                goto retry;
 }
 
+static void free_more_memory(void)
+{
+       balance_dirty(NODEV);
+       page_launder(GFP_NOFS, 0);              
+       wakeup_bdflush();
+       wakeup_kswapd();
+       current->policy |= SCHED_YIELD;
+       __set_current_state(TASK_RUNNING);
+       schedule();
+}
+
 /*
  * We used to try various strange things. Let's not.
  * We'll just try to balance dirty buffers, and possibly
@@ -802,15 +813,8 @@ void set_blocksize(kdev_t dev, int size)
  */
 static void refill_freelist(int size)
 {
-       if (!grow_buffers(size)) {
-               balance_dirty(NODEV);
-               page_launder(GFP_NOFS, 0);              
-               wakeup_bdflush();
-               wakeup_kswapd();
-               current->policy |= SCHED_YIELD;
-               __set_current_state(TASK_RUNNING);
-               schedule();
-       }
+       if (!grow_buffers(size))
+               free_more_memory();
 }
 
 void init_buffer(struct buffer_head *bh, bh_end_io_t *handler, void *private)
@@ -1408,9 +1412,7 @@ no_grow:
         */
        run_task_queue(&tq_disk);
 
-       current->policy |= SCHED_YIELD;
-       __set_current_state(TASK_RUNNING);
-       schedule();
+       free_more_memory();
        goto try_again;
 }
 
index 7c8afc26dc92f104376c689c901baa885a61fd81..dac80dc811cdd1391ba45de27aa59431150b6ebd 100644 (file)
@@ -69,17 +69,9 @@ do {\
         outsize = insize; \
 } while (0)
 
-static inline int max(int a, int b) 
-{
-       if ( a > b )
-               return a; 
-       else
-               return b;
-}
-
 #define INSIZE(tag) sizeof(struct coda_ ## tag ## _in)
 #define OUTSIZE(tag) sizeof(struct coda_ ## tag ## _out)
-#define SIZE(tag)  max(INSIZE(tag), OUTSIZE(tag))
+#define SIZE(tag)  max(unsigned int, INSIZE(tag), OUTSIZE(tag))
 
 
 /* the upcalls */
@@ -159,7 +151,7 @@ int venus_lookup(struct super_block *sb, struct ViceFid *fid,
        int offset;
 
        offset = INSIZE(lookup);
-        insize = max(offset + length +1, OUTSIZE(lookup));
+        insize = max(unsigned int, offset + length +1, OUTSIZE(lookup));
        UPARG(CODA_LOOKUP);
 
         inp->coda_lookup.VFid = *fid;
@@ -275,7 +267,7 @@ int venus_mkdir(struct super_block *sb, struct ViceFid *dirfid,
         int offset;
 
        offset = INSIZE(mkdir);
-       insize = max(offset + length + 1, OUTSIZE(mkdir));
+       insize = max(unsigned int, offset + length + 1, OUTSIZE(mkdir));
        UPARG(CODA_MKDIR);
 
         inp->coda_mkdir.VFid = *dirfid;
@@ -306,7 +298,7 @@ int venus_rename(struct super_block *sb, struct ViceFid *old_fid,
        int offset, s;
        
        offset = INSIZE(rename);
-       insize = max(offset + new_length + old_length + 8,
+       insize = max(unsigned int, offset + new_length + old_length + 8,
                     OUTSIZE(rename)); 
        UPARG(CODA_RENAME);
 
@@ -344,7 +336,7 @@ int venus_create(struct super_block *sb, struct ViceFid *dirfid,
         int offset;
 
         offset = INSIZE(create);
-       insize = max(offset + length + 1, OUTSIZE(create));
+       insize = max(unsigned int, offset + length + 1, OUTSIZE(create));
        UPARG(CODA_CREATE);
 
         inp->coda_create.VFid = *dirfid;
@@ -376,7 +368,7 @@ int venus_rmdir(struct super_block *sb, struct ViceFid *dirfid,
         int offset;
 
         offset = INSIZE(rmdir);
-       insize = max(offset + length + 1, OUTSIZE(rmdir));
+       insize = max(unsigned int, offset + length + 1, OUTSIZE(rmdir));
        UPARG(CODA_RMDIR);
 
         inp->coda_rmdir.VFid = *dirfid;
@@ -398,7 +390,7 @@ int venus_remove(struct super_block *sb, struct ViceFid *dirfid,
         int error=0, insize, outsize, offset;
 
         offset = INSIZE(remove);
-       insize = max(offset + length + 1, OUTSIZE(remove));
+       insize = max(unsigned int, offset + length + 1, OUTSIZE(remove));
        UPARG(CODA_REMOVE);
 
         inp->coda_remove.VFid = *dirfid;
@@ -421,7 +413,8 @@ int venus_readlink(struct super_block *sb, struct ViceFid *fid,
         int retlen;
         char *result;
         
-       insize = max(INSIZE(readlink), OUTSIZE(readlink)+ *length + 1);
+       insize = max(unsigned int,
+                    INSIZE(readlink), OUTSIZE(readlink)+ *length + 1);
        UPARG(CODA_READLINK);
 
         inp->coda_readlink.VFid = *fid;
@@ -455,7 +448,7 @@ int venus_link(struct super_block *sb, struct ViceFid *fid,
         int offset;
 
        offset = INSIZE(link);
-       insize = max(offset  + len + 1, OUTSIZE(link));
+       insize = max(unsigned int, offset  + len + 1, OUTSIZE(link));
         UPARG(CODA_LINK);
 
         inp->coda_link.sourceFid = *fid;
@@ -484,7 +477,7 @@ int venus_symlink(struct super_block *sb, struct ViceFid *fid,
         int offset, s;
 
         offset = INSIZE(symlink);
-       insize = max(offset + len + symlen + 8, OUTSIZE(symlink));
+       insize = max(unsigned int, offset + len + symlen + 8, OUTSIZE(symlink));
        UPARG(CODA_SYMLINK);
         
         /*        inp->coda_symlink.attr = *tva; XXXXXX */ 
@@ -624,7 +617,7 @@ int venus_statfs(struct super_block *sb, struct statfs *sfs)
         union outputArgs *outp;
         int insize, outsize, error;
         
-       insize = max(INSIZE(statfs), OUTSIZE(statfs));
+       insize = max(unsigned int, INSIZE(statfs), OUTSIZE(statfs));
        UPARG(CODA_STATFS);
 
         error = coda_upcall(coda_sbp(sb), insize, &outsize, inp);
index 7240bc8a2e52e108e9196e40d11cace3527c134c..f5fea6704d6f9d88ae873145cc66fe441c720e2e 100644 (file)
@@ -15,6 +15,8 @@
 #include <linux/stat.h>
 #include <linux/fat_cvf.h>
 
+#include "msbuffer.h"
+
 #if 0
 #  define PRINTK(x) printk x
 #else
index 7e83e79f777bd336601979ab0c26a0ca6adec2b6..0b047c3bbe053ec3d91ec335242d90a6828dbde4 100644 (file)
@@ -590,7 +590,7 @@ static int vfat_ioctl_fill(
        void * buf,
        const char * name,
        int name_len,
-       off_t offset,
+       loff_t offset,
        ino_t ino,
        unsigned int d_type)
 {
index 7ea3d4a10168efb2ea52738cf7700d8a4206a054..a480ab70b8800daff3ca538084e14a1875699885 100644 (file)
@@ -718,7 +718,7 @@ jffs_readpage(struct file *file, struct page *page)
 
        offset = page->index << PAGE_CACHE_SHIFT;
        if (offset < inode->i_size) {
-               read_len = jffs_min(inode->i_size - offset, PAGE_SIZE);
+               read_len = min(long, inode->i_size - offset, PAGE_SIZE);
                r = jffs_read_data(f, buf, offset, read_len);
                if (r == read_len) {
                        if (read_len < PAGE_SIZE) {
@@ -1373,7 +1373,9 @@ jffs_file_write(struct file *filp, const char *buf, size_t count,
                goto out_isem;
        }
        
-       thiscount = jffs_min(c->fmc->max_chunk_size - sizeof(struct jffs_raw_inode), count);
+       thiscount = min(unsigned int,
+                       c->fmc->max_chunk_size - sizeof(struct jffs_raw_inode),
+                       count);
 
        if (!(vbuf = kmalloc(thiscount, GFP_KERNEL))) {
                D(printk("jffs_file_write(): failed to allocate bounce buffer. Fix me to use page cache\n"));
@@ -1437,7 +1439,8 @@ jffs_file_write(struct file *filp, const char *buf, size_t count,
                raw_inode.deleted = 0;
                
                if (pos < f->size) {
-                       node->removed_size = raw_inode.rsize = jffs_min(thiscount, f->size - pos);
+                       node->removed_size = raw_inode.rsize =
+                               min(unsigned int, thiscount, f->size - pos);
                        
                        /* If this node is going entirely over the top of old data, 
                           we can allow it to go into the reserved space, because 
@@ -1479,7 +1482,9 @@ jffs_file_write(struct file *filp, const char *buf, size_t count,
 
                D3(printk("jffs_file_write(): new f_pos %ld.\n", (long)pos));
 
-               thiscount = jffs_min(c->fmc->max_chunk_size - sizeof(struct jffs_raw_inode), count);
+               thiscount = min(unsigned int,
+                       c->fmc->max_chunk_size - sizeof(struct jffs_raw_inode),
+                       count);
        }
  out:
        D3(printk (KERN_NOTICE "file_write(): up biglock\n"));
index 62af52c92a8b4b3fea4a964d46a017d38d4a8eeb..d8d3c90077959210bd80fea98467ecd418396265 100644 (file)
@@ -292,21 +292,6 @@ flash_erase_region(struct mtd_info *mtd, loff_t start,
        return 0;
 }
 
-
-inline int
-jffs_min(int a, int b)
-{
-       return (a < b ? a : b);
-}
-
-
-inline int
-jffs_max(int a, int b)
-{
-       return (a > b ? a : b);
-}
-
-
 /* This routine calculates checksums in JFFS.  */
 __u32
 jffs_checksum(const void *data, int size)
@@ -1624,7 +1609,7 @@ jffs_get_node_data(struct jffs_file *f, struct jffs_node *node,
                  "version: %u, node_offset: %u\n",
                  f->name, node->ino, node->version, node_offset));
 
-       r = jffs_min(avail, max_size);
+       r = min(u32, avail, max_size);
        D3(printk(KERN_NOTICE "jffs_get_node_data\n"));
        flash_safe_read(fmc->mtd, pos, buf, r);
 
@@ -1677,8 +1662,8 @@ jffs_read_data(struct jffs_file *f, unsigned char *buf, __u32 read_offset,
                int r;
                if (!node->fm) {
                        /* This node does not refer to real data.  */
-                       r = jffs_min(size - read_data,
-                                    node->data_size - node_offset);
+                       r = min(u32, size - read_data,
+                               node->data_size - node_offset);
                        memset(&buf[read_data], 0, r);
                }
                else if ((r = jffs_get_node_data(f, node, &buf[read_data],
@@ -1919,8 +1904,8 @@ jffs_delete_data(struct jffs_file *f, struct jffs_node *node)
                else {
                        /* No.  No need to split the node.  Just remove
                           the end of the node.  */
-                       int r = jffs_min(n->data_offset + n->data_size
-                                        - offset, remove_size);
+                       int r = min(u32, n->data_offset + n->data_size
+                                   - offset, remove_size);
                        n->data_size -= r;
                        remove_size -= r;
                        n = n->range_next;
@@ -2475,7 +2460,7 @@ jffs_rewrite_data(struct jffs_file *f, struct jffs_node *node, int size)
                }
 
                while (size) {
-                       __u32 s = jffs_min(size, PAGE_SIZE);
+                       __u32 s = min(int, size, PAGE_SIZE);
                        if ((r = jffs_read_data(f, (char *)page,
                                                offset, s)) < s) {
                                free_page((unsigned long)page);
@@ -2836,7 +2821,7 @@ jffs_try_to_erase(struct jffs_control *c)
                                printk("JFFS: Erase failed! pos = 0x%lx\n",
                                       (long)pos);
                                jffs_hexdump(fmc->mtd, pos,
-                                            jffs_min(256, end - pos));
+                                            min(u32, 256, end - pos));
                                err = -1;
                                break;
                        }
index f10a994b4e06ffb41d355053fca991836f95acd8..64930d867efef17ee09550b9eda83d62a9751ed0 100644 (file)
@@ -17,8 +17,6 @@
 #ifndef __LINUX_JFFS_INTREP_H__
 #define __LINUX_JFFS_INTREP_H__
 #include "jffs_fm.h"
-inline int jffs_min(int a, int b);
-inline int jffs_max(int a, int b);
 __u32 jffs_checksum(const void *data, int size);
 
 void jffs_cleanup_control(struct jffs_control *c);
index dd54dea041527d37df5556610c95c83079d5f90c..a72ed803d014afdd50023a0950314f8b0e34b9fd 100644 (file)
 #include <linux/ncp_fs.h>
 #include "ncplib_kernel.h"
 
-static inline unsigned int min(unsigned int a, unsigned int b)
-{
-       return a < b ? a : b;
-}
-
 static int ncp_fsync(struct file *file, struct dentry *dentry, int datasync)
 {
        return 0;
@@ -157,8 +152,9 @@ ncp_file_read(struct file *file, char *buf, size_t count, loff_t *ppos)
        /* First read in as much as possible for each bufsize. */
        while (already_read < count) {
                int read_this_time;
-               size_t to_read = min(bufsize - (pos % bufsize),
-                                 count - already_read);
+               size_t to_read = min(unsigned int,
+                                    bufsize - (pos % bufsize),
+                                    count - already_read);
 
                error = ncp_read_bounce(NCP_SERVER(inode),
                                NCP_FINFO(inode)->file_handle,
@@ -238,8 +234,9 @@ ncp_file_write(struct file *file, const char *buf, size_t count, loff_t *ppos)
        }
        while (already_written < count) {
                int written_this_time;
-               size_t to_write = min(bufsize - (pos % bufsize),
-                                  count - already_written);
+               size_t to_write = min(unsigned int,
+                                     bufsize - (pos % bufsize),
+                                     count - already_written);
 
                if (copy_from_user(bouncebuffer, buf, to_write)) {
                        errno = -EFAULT;
index ed4153dd61ca1752ae04be236ed534be2e0111e9..ad74d57b8d0b6a4087cb3a4fa7c734298aea726a 100644 (file)
 #include <asm/uaccess.h>
 #include <asm/system.h>
 
-static inline int min(int a, int b)
-{
-       return a < b ? a : b;
-}
-
 /*
  * Fill in the supplied page for mmap
  */
@@ -66,7 +61,7 @@ static struct page* ncp_file_mmap_nopage(struct vm_area_struct *area,
 
                        to_read = bufsize - (pos % bufsize);
 
-                       to_read = min(to_read, count - already_read);
+                       to_read = min(unsigned int, to_read, count - already_read);
 
                        if (ncp_read_kernel(NCP_SERVER(inode),
                                     NCP_FINFO(inode)->file_handle,
index 6e09c8bf2613d3578f1a114f10e8cffcb1e69a49..3a0fd85d8f73465841bbef573bd6f4e9145ddcb6 100644 (file)
 
 #include "ncplib_kernel.h"
 
-static inline int min(int a, int b)
-{
-       return a < b ? a : b;
-}
-
 static inline void assert_server_locked(struct ncp_server *server)
 {
        if (server->lock == 0) {
@@ -132,7 +127,7 @@ ncp_negotiate_buffersize(struct ncp_server *server, int size, int *target)
                ncp_unlock_server(server);
                return result;
        }
-       *target = min(ntohs(ncp_reply_word(server, 0)), size);
+       *target = min(unsigned int, ntohs(ncp_reply_word(server, 0)), size);
 
        ncp_unlock_server(server);
        return 0;
@@ -163,7 +158,8 @@ ncp_negotiate_size_and_options(struct ncp_server *server,
 
        /* NCP over UDP returns 0 (!!!) */
        result = ntohs(ncp_reply_word(server, 0));
-       if (result >= NCP_BLOCK_SIZE) size=min(result, size);
+       if (result >= NCP_BLOCK_SIZE)
+               size = min(int, result, size);
        *ret_size = size;
        *ret_options = ncp_reply_byte(server, 4);
 
index f945da65798addb7548f9da9b70f8ee141609dc4..ea8482611fcda6f94d7debce7fb42d3077c75863 100644 (file)
@@ -52,8 +52,6 @@ DSET_LH(__u8 * buf, int pos, __u32 val)
 #define PUT_LE32(p,v) DSET_LH(p,0,v)
 #endif
 
-#define min(a,b) ((a)<(b)?(a):(b))
-
 static void nwsign(char *r_data1, char *r_data2, char *outdata) {
  int i;
  unsigned int w0,w1,w2,w3;
@@ -102,7 +100,7 @@ void sign_packet(struct ncp_server *server, int *size) {
  memcpy(data,server->sign_root,8);
  PUT_LE32(data+8,(*size));
  memcpy(data+12,server->packet+sizeof(struct ncp_request_header)-1,
-  min((*size)-sizeof(struct ncp_request_header)+1,52));
+  min(unsigned int,(*size)-sizeof(struct ncp_request_header)+1,52));
 
  nwsign(server->sign_last,data,server->sign_last);
 
index 66d102bae6def0fa90b9f0a8190793c931627c68..92ed9fb5ebc64f1c589a3a55588edea6a5c1f226 100644 (file)
@@ -39,7 +39,6 @@ static ssize_t nfs_file_read(struct file *, char *, size_t, loff_t *);
 static ssize_t nfs_file_write(struct file *, const char *, size_t, loff_t *);
 static int  nfs_file_flush(struct file *);
 static int  nfs_fsync(struct file *, struct dentry *dentry, int datasync);
-static int  nfs_file_release(struct inode *, struct file *);
 
 struct file_operations nfs_file_operations = {
        llseek:         generic_file_llseek,
@@ -48,7 +47,7 @@ struct file_operations nfs_file_operations = {
        mmap:           nfs_file_mmap,
        open:           nfs_open,
        flush:          nfs_file_flush,
-       release:        nfs_file_release,
+       release:        nfs_release,
        fsync:          nfs_fsync,
        lock:           nfs_lock,
 };
@@ -89,13 +88,6 @@ nfs_file_flush(struct file *file)
        return status;
 }
 
-static int
-nfs_file_release(struct inode *inode, struct file *file)
-{
-       filemap_fdatasync(inode->i_mapping);
-       return nfs_release(inode,file);
-}
-
 static ssize_t
 nfs_file_read(struct file * file, char * buf, size_t count, loff_t *ppos)
 {
index 2d79aefe1940ea7bd87127ce216288fb2fe18e25..c48ebbc15c81df52b38e920b07c8ad1b4e877627 100644 (file)
@@ -48,6 +48,7 @@ static void nfs_read_inode(struct inode *);
 static void nfs_write_inode(struct inode *,int);
 static void nfs_delete_inode(struct inode *);
 static void nfs_put_super(struct super_block *);
+static void nfs_clear_inode(struct inode *);
 static void nfs_umount_begin(struct super_block *);
 static int  nfs_statfs(struct super_block *, struct statfs *);
 
@@ -57,6 +58,7 @@ static struct super_operations nfs_sops = {
        delete_inode:   nfs_delete_inode,
        put_super:      nfs_put_super,
        statfs:         nfs_statfs,
+       clear_inode:    nfs_clear_inode,
        umount_begin:   nfs_umount_begin,
 };
 
@@ -141,6 +143,19 @@ nfs_delete_inode(struct inode * inode)
        clear_inode(inode);
 }
 
+/*
+ * For the moment, the only task for the NFS clear_inode method is to
+ * release the mmap credential
+ */
+static void
+nfs_clear_inode(struct inode *inode)
+{
+       struct rpc_cred *cred = NFS_I(inode)->mm_cred;
+
+       if (cred)
+               put_rpccred(cred);
+}
+
 void
 nfs_put_super(struct super_block *sb)
 {
@@ -600,7 +615,6 @@ nfs_fill_inode(struct inode *inode, struct nfs_fh *fh, struct nfs_fattr *fattr)
                inode->i_ctime = nfs_time_to_secs(fattr->ctime);
                NFS_CACHE_CTIME(inode) = fattr->ctime;
                NFS_CACHE_MTIME(inode) = fattr->mtime;
-               NFS_CACHE_ATIME(inode) = fattr->atime;
                NFS_CACHE_ISIZE(inode) = fattr->size;
                NFS_ATTRTIMEO(inode) = NFS_MINATTRTIMEO(inode);
                NFS_ATTRTIMEO_UPDATE(inode) = jiffies;
@@ -793,6 +807,21 @@ nfs_revalidate(struct dentry *dentry)
        return nfs_revalidate_inode(NFS_SERVER(inode), inode);
 }
 
+/*
+ * Ensure that mmap has a recent RPC credential for use when writing out
+ * shared pages
+ */
+static inline void
+nfs_set_mmcred(struct inode *inode, struct rpc_cred *cred)
+{
+       struct rpc_cred **p = &NFS_I(inode)->mm_cred,
+                       *oldcred = *p;
+
+       *p = get_rpccred(cred);
+       if (oldcred)
+               put_rpccred(oldcred);
+}
+
 /*
  * These are probably going to contain hooks for
  * allocating and releasing RPC credentials for
@@ -808,20 +837,20 @@ int nfs_open(struct inode *inode, struct file *filp)
        auth = NFS_CLIENT(inode)->cl_auth;
        cred = rpcauth_lookupcred(auth, 0);
        filp->private_data = cred;
+       if (filp->f_mode & FMODE_WRITE)
+               nfs_set_mmcred(inode, cred);
        unlock_kernel();
        return 0;
 }
 
 int nfs_release(struct inode *inode, struct file *filp)
 {
-       struct rpc_auth *auth;
        struct rpc_cred *cred;
 
        lock_kernel();
-       auth = NFS_CLIENT(inode)->cl_auth;
        cred = nfs_file_cred(filp);
        if (cred)
-               rpcauth_releasecred(auth, cred);
+               put_rpccred(cred);
        unlock_kernel();
        return 0;
 }
@@ -976,7 +1005,6 @@ __nfs_refresh_inode(struct inode *inode, struct nfs_fattr *fattr)
        NFS_CACHE_CTIME(inode) = fattr->ctime;
        inode->i_ctime = nfs_time_to_secs(fattr->ctime);
 
-       NFS_CACHE_ATIME(inode) = fattr->atime;
        inode->i_atime = nfs_time_to_secs(fattr->atime);
 
        NFS_CACHE_MTIME(inode) = new_mtime;
index 51150971478cfd67c7cb20fcc1aeb462e16085ec..800fc5767459ff13d2f2f4da6b1da177f7f88d7e 100644 (file)
@@ -128,7 +128,7 @@ nfs_async_unlink_done(struct rpc_task *task)
        dir_i = dir->d_inode;
        nfs_zap_caches(dir_i);
        NFS_PROTO(dir_i)->unlink_done(dir, &task->tk_msg);
-       rpcauth_releasecred(task->tk_auth, data->cred);
+       put_rpccred(data->cred);
        data->cred = NULL;
        dput(dir);
 }
index 3055940692adc04db24606d8c1c307fd9affab71..42f5f90677d9eae814bd354af28d5fe24a0dd197 100644 (file)
@@ -181,7 +181,9 @@ nfs_writepage_sync(struct file *file, struct inode *inode, struct page *page,
 
 
        if (file)
-               cred = nfs_file_cred(file);
+               cred = get_rpccred(nfs_file_cred(file));
+       if (!cred)
+               cred = get_rpccred(NFS_I(inode)->mm_cred);
 
        dprintk("NFS:      nfs_writepage_sync(%x/%Ld %d@%Ld)\n",
                inode->i_dev, (long long)NFS_FILEID(inode),
@@ -226,6 +228,8 @@ nfs_writepage_sync(struct file *file, struct inode *inode, struct page *page,
 
 io_error:
        kunmap(page);
+       if (cred)
+               put_rpccred(cred);
 
        return written? written : result;
 }
@@ -241,6 +245,9 @@ nfs_writepage_async(struct file *file, struct inode *inode, struct page *page,
        status = (IS_ERR(req)) ? PTR_ERR(req) : 0;
        if (status < 0)
                goto out;
+       if (!req->wb_cred)
+               req->wb_cred = get_rpccred(NFS_I(inode)->mm_cred);
+       nfs_unlock_request(req);
        nfs_release_request(req);
        nfs_strategy(inode);
  out:
@@ -557,13 +564,11 @@ struct nfs_page *nfs_create_request(struct file *file, struct inode *inode,
        req->wb_bytes   = count;
        req->wb_file    = file;
 
-       /* If we have a struct file, use its cached credentials
-        * else cache the current process' credentials. */
+       /* If we have a struct file, use its cached credentials */
        if (file) {
                get_file(file);
                req->wb_cred    = nfs_file_cred(file);
-       } else
-               req->wb_cred = rpcauth_lookupcred(NFS_CLIENT(inode)->cl_auth, 0);
+       }
        req->wb_inode   = inode;
        req->wb_count   = 1;
 
@@ -608,8 +613,8 @@ nfs_release_request(struct nfs_page *req)
        /* Release struct file or cached credential */
        if (req->wb_file)
                fput(req->wb_file);
-       else
-               rpcauth_releasecred(NFS_CLIENT(inode)->cl_auth, req->wb_cred);
+       else if (req->wb_cred)
+               put_rpccred(req->wb_cred);
        page_cache_release(page);
        nfs_page_free(req);
        /* wake up anyone waiting to allocate a request */
@@ -927,8 +932,6 @@ nfs_update_request(struct file* file, struct inode *inode, struct page *page,
        if (end > rqend)
                req->wb_bytes = end - req->wb_offset;
 
-       nfs_unlock_request(req);
-
        return req;
 }
 
@@ -1049,6 +1052,7 @@ nfs_updatepage(struct file *file, struct page *page, unsigned int offset, unsign
                goto done;
 
        status = 0;
+       nfs_unlock_request(req);
        /* If we wrote past the end of the page.
         * Call the strategy routine so it can send out a bunch
         * of requests.
index 57be1396297f01449a31088854b2cf82a20ae464..80706fdf0d0e06f00c047eaa442e89294d3580bd 100644 (file)
@@ -148,7 +148,7 @@ int ntfs_new_attr(ntfs_inode *ino, int type, void *name, int namelen,
                                        "attribute non-resident. Bug!\n");
                                return -EINVAL;
                        }
-                       m = memcmp(value, a->d.data, min(value_len, a->size));
+                       m = memcmp(value, a->d.data, min(int, value_len, a->size));
                        if (m > 0)
                                continue;
                        if (m < 0) {
@@ -379,7 +379,7 @@ int ntfs_resize_attr(ntfs_inode *ino, ntfs_attribute *attr, __s64 newsize)
                                ntfs_bzero((char*)attr->d.data + oldsize,
                                           newsize - oldsize);
                        ntfs_memcpy((char*)attr->d.data, v,
-                                   min(newsize, oldsize));
+                                   min(s64, newsize, oldsize));
                } else
                        attr->d.data = 0;
                ntfs_free(v);
@@ -668,7 +668,7 @@ int ntfs_read_zero(ntfs_io *dest, int size)
        if (!sparse)
                return -ENOMEM;
        while (size) {
-               int i = min(size, 512);
+               int i = min(int, size, 512);
                dest->fn_put(dest, sparse, i);
                size -= i;
        }
@@ -723,7 +723,7 @@ int ntfs_read_compressed(ntfs_inode *ino, ntfs_attribute *attr, __s64 offset,
                        __s64 l1;
                        if ((len - (s_vcn - vcn)) & 15)
                                ntfs_error("Unexpected sparse chunk size.");
-                       l1 = chunk = min(((__s64)(vcn + len) << clustersizebits)
+                       l1 = chunk = min(s64, ((__s64)(vcn + len) << clustersizebits)
                                                                - offset, l);
                        error = ntfs_read_zero(dest, l1);
                        if (error)
@@ -742,13 +742,13 @@ int ntfs_read_compressed(ntfs_inode *ino, ntfs_attribute *attr, __s64 offset,
                        comp1 = comp;
                        do {
                                io.param = comp1;
-                               l1 = min(len - max(s_vcn - vcn, 0), 16 - got);
+                               l1 = min(int, len - max(int, s_vcn - vcn, 0), 16 - got);
                                io.size = (__s64)l1 << clustersizebits;
                                error = ntfs_getput_clusters(ino->vol, cl1, 0,
                                                             &io);
                                if (error)
                                        goto out;
-                               if (l1 + max(s_vcn - vcn, 0) == len) {
+                               if (l1 + max(int, s_vcn - vcn, 0) == len) {
                                        rnum++;
                                        rl++;
                                        vcn += len;
@@ -779,8 +779,8 @@ int ntfs_read_compressed(ntfs_inode *ino, ntfs_attribute *attr, __s64 offset,
                                comp1 = decomp;
                        }
                        offs1 = offset - ((__s64)s_vcn << clustersizebits);
-                       chunk = min((16 << clustersizebits) - offs1, chunk);
-                       chunk = min(l, chunk);
+                       chunk = min(s64, (16 << clustersizebits) - offs1, chunk);
+                       chunk = min(s64, l, chunk);
                        dest->fn_put(dest, comp1 + offs1, chunk);
                }
                l -= chunk;
index 5a618251951bbe71b2e96d4acbec9b11509096c3..42659955ecdc4925fb48c8fd1641f57b0e83261f 100644 (file)
@@ -1048,12 +1048,12 @@ struct super_block * ntfs_read_super(struct super_block *sb, void *options,
        set_blocksize(sb->s_dev, sb->s_blocksize);
        ntfs_debug(DEBUG_OTHER, "set_blocksize\n");
        /* Allocate an MFT record (MFT record can be smaller than a cluster). */
-       if (!(vol->mft = ntfs_malloc(max(vol->mft_record_size,
-                                                        vol->cluster_size))))
+       if (!(vol->mft = ntfs_malloc(max(int, vol->mft_record_size,
+                                        vol->cluster_size))))
                goto ntfs_read_super_unl;
 
        /* Read at least the MFT record for $Mft. */
-       for (i = 0; i < max(vol->mft_clusters_per_record, 1); i++) {
+       for (i = 0; i < max(int, vol->mft_clusters_per_record, 1); i++) {
                if (!(bh = bread(sb->s_dev, vol->mft_lcn + i,
                                                          vol->cluster_size))) {
                        ntfs_error("Could not read $Mft record 0\n");
index 06ea87109e47353625588c192e281c03fa6e79d3..bf66e1eb969fcec3e2316865a6c95dbf34ec7ffa 100644 (file)
@@ -105,7 +105,7 @@ static int ntfs_extend_mft(ntfs_volume *vol)
                 * will fall back to the minimal size allocation below. (AIA) */
                block = vol->mft_record_size;
                blockbits = vol->mft_record_size_bits;
-               size = max(size >> 10, mdata->size + vol->mft_record_size);
+               size = max(s64, size >> 10, mdata->size + vol->mft_record_size);
                size = (__s64)((size + block - 1) >> blockbits) << blockbits;
                /* Require this to be a single chunk. */
                error = ntfs_extend_attr(vol->mft_ino, mdata, &size,
@@ -394,7 +394,7 @@ static void ntfs_load_attributes(ntfs_inode* ino)
                io.fn_put = ntfs_put;
                io.fn_get = 0;
                io.param = buf + delta;
-               io.size = len = min(datasize, 1024 - delta);
+               io.size = len = min(int, datasize, 1024 - delta);
                ntfs_debug(DEBUG_FILE2, "load_attributes %x: len = %i\n",
                                                ino->i_number, len);
                ntfs_debug(DEBUG_FILE2, "load_attributes %x: delta = %i\n",
@@ -729,7 +729,7 @@ int ntfs_readwrite_attr(ntfs_inode *ino, ntfs_attribute *attr, __s64 offset,
                cluster = attr->d.r.runlist[rnum].cluster;
                len = attr->d.r.runlist[rnum].len;
                s_cluster = cluster + s_vcn - vcn;
-               chunk = min(((__s64)(vcn + len) << clustersizebits) - offset,
+               chunk = min(s64, ((__s64)(vcn + len) << clustersizebits) - offset,
                                                                        l);
                dest->size = chunk;
                error = ntfs_getput_clusters(ino->vol, s_cluster, offset -
index 829da2579f1b0a3bcd43ac5452588d6abb828878..1210de524f472de0e449171b230259defeee4525 100644 (file)
 #define NTFS_INO2VOL(ino)      (&((ino)->i_sb->u.ntfs_sb))
 #define NTFS_LINO2NINO(ino)     (&((ino)->u.ntfs_i))
 
-/* Classical min and max macros still missing in standard headers... */
-#ifndef min
-#define min(a,b)       ((a) <= (b) ? (a) : (b))
-#define max(a,b)       ((a) >= (b) ? (a) : (b))
-#endif
-
 #define IS_MAGIC(a,b)          (*(int*)(a) == *(int*)(b))
 #define IS_MFT_RECORD(a)       IS_MAGIC((a),"FILE")
 #define IS_INDEX_RECORD(a)     IS_MAGIC((a),"INDX")
index de4b82f81c026981e9a4782f16758e6f37810026..962378b0832cf9e4e3417373a5212a4e8ded10dc 100644 (file)
@@ -180,7 +180,7 @@ int ntfs_getput_clusters(ntfs_volume *vol, int cluster,     ntfs_size_t start_offs,
                        error = -EIO;
                        goto error_ret;
                }
-               to_copy = min(vol->cluster_size - start_offs, length);
+               to_copy = min(unsigned int, vol->cluster_size - start_offs, length);
                lock_buffer(bh);
                if (buf->do_read) {
                        buf->fn_put(buf, bh->b_data + start_offs, to_copy);
index 5908765e95087cc8d438b636b2161b014271e6e8..e9d5a9effdf349dc3792604373f7f829ae4684a4 100644 (file)
@@ -96,7 +96,7 @@ int ntfs_collate_names(wchar_t *upcase, __u32 upcase_len,
        __u32 cnt;
        wchar_t c1, c2;
 
-       for (cnt = 0; cnt < min(name1_len, name2_len); ++cnt)
+       for (cnt = 0; cnt < min(unsigned int, name1_len, name2_len); ++cnt)
        {
                c1 = le16_to_cpu(*name1++);
                c2 = le16_to_cpu(*name2++);
index df6eb974be063d4bd25f567a8577718dbc4e6ecc..41e1841d94ab8470af4cf400cf6d7cff5759347c 100644 (file)
 
 #include <asm/uaccess.h>
 
-static int inline min(int a, int b)
-{
-       return a<b ? a : b;
-}
-
 static __s32
 romfs_checksum(void *data, int size)
 {
@@ -129,7 +124,7 @@ romfs_read_super(struct super_block *s, void *data, int silent)
                                "%s.\n", kdevname(dev));
                goto out;
        }
-       if (romfs_checksum(rsb, min(sz,512))) {
+       if (romfs_checksum(rsb, min(int, sz, 512))) {
                printk ("romfs: bad initial checksum on dev "
                        "%s.\n", kdevname(dev));
                goto out;
@@ -198,7 +193,7 @@ romfs_strnlen(struct inode *i, unsigned long offset, unsigned long count)
                return -1;              /* error */
 
        avail = ROMBSIZE - (offset & ROMBMASK);
-       maxsize = min(count, avail);
+       maxsize = min(unsigned long, count, avail);
        res = strnlen(((char *)bh->b_data)+(offset&ROMBMASK), maxsize);
        brelse(bh);
 
@@ -211,7 +206,7 @@ romfs_strnlen(struct inode *i, unsigned long offset, unsigned long count)
                bh = bread(i->i_dev, offset>>ROMBSBITS, ROMBSIZE);
                if (!bh)
                        return -1;
-               maxsize = min(count-res, ROMBSIZE);
+               maxsize = min(unsigned long, count - res, ROMBSIZE);
                avail = strnlen(bh->b_data, maxsize);
                res += avail;
                brelse(bh);
@@ -236,7 +231,7 @@ romfs_copyfrom(struct inode *i, void *dest, unsigned long offset, unsigned long
                return -1;              /* error */
 
        avail = ROMBSIZE - (offset & ROMBMASK);
-       maxsize = min(count, avail);
+       maxsize = min(unsigned long, count, avail);
        memcpy(dest, ((char *)bh->b_data) + (offset & ROMBMASK), maxsize);
        brelse(bh);
 
@@ -249,7 +244,7 @@ romfs_copyfrom(struct inode *i, void *dest, unsigned long offset, unsigned long
                bh = bread(i->i_dev, offset>>ROMBSBITS, ROMBSIZE);
                if (!bh)
                        return -1;
-               maxsize = min(count-res, ROMBSIZE);
+               maxsize = min(unsigned long, count - res, ROMBSIZE);
                memcpy(dest, bh->b_data, maxsize);
                brelse(bh);
                res += maxsize;
@@ -413,7 +408,7 @@ romfs_readpage(struct file *file, struct page * page)
        offset = page->index << PAGE_CACHE_SHIFT;
        if (offset < inode->i_size) {
                avail = inode->i_size-offset;
-               readlen = min(avail, PAGE_SIZE);
+               readlen = min(unsigned long, avail, PAGE_SIZE);
                if (romfs_copyfrom(inode, buf, inode->u.romfs_i.i_dataoffset+offset, readlen) == readlen) {
                        if (readlen < PAGE_SIZE) {
                                memset(buf + readlen,0,PAGE_SIZE-readlen);
index fa83ba5bee9a8649286c93a8a6a3632a0c2c09a9..9aa7a9f31fcfea25f1c94a17d6b1855fc7d45ba0 100644 (file)
@@ -312,7 +312,7 @@ unsigned ufs_new_fragments (struct inode * inode, u32 * p, unsigned fragment,
                        *p = SWAB32(result);
                        *err = 0;
                        inode->i_blocks += count << uspi->s_nspfshift;
-                       inode->u.ufs_i.i_lastfrag = max (inode->u.ufs_i.i_lastfrag, fragment + count);
+                       inode->u.ufs_i.i_lastfrag = max(u32, inode->u.ufs_i.i_lastfrag, fragment + count);
                        NULLIFY_FRAGMENTS
                }
                unlock_super(sb);
@@ -327,7 +327,7 @@ unsigned ufs_new_fragments (struct inode * inode, u32 * p, unsigned fragment,
        if (result) {
                *err = 0;
                inode->i_blocks += count << uspi->s_nspfshift;
-               inode->u.ufs_i.i_lastfrag = max (inode->u.ufs_i.i_lastfrag, fragment + count);
+               inode->u.ufs_i.i_lastfrag = max(u32, inode->u.ufs_i.i_lastfrag, fragment + count);
                NULLIFY_FRAGMENTS
                unlock_super(sb);
                UFSD(("EXIT, result %u\n", result))
@@ -380,7 +380,7 @@ unsigned ufs_new_fragments (struct inode * inode, u32 * p, unsigned fragment,
                *p = SWAB32(result);
                *err = 0;
                inode->i_blocks += count << uspi->s_nspfshift;
-               inode->u.ufs_i.i_lastfrag = max (inode->u.ufs_i.i_lastfrag, fragment + count);
+               inode->u.ufs_i.i_lastfrag = max(u32, inode->u.ufs_i.i_lastfrag, fragment + count);
                NULLIFY_FRAGMENTS
                unlock_super(sb);
                if (newcount < request)
index d154f58d168706f1507a50a00790558e1426f6e6..cae11a7cae697be7d5a536dcc5e03f002803fe37 100644 (file)
@@ -88,7 +88,7 @@ static int ufs_trunc_direct (struct inode * inode)
        retry = 0;
        
        frag1 = DIRECT_FRAGMENT;
-       frag4 = min (UFS_NDIR_FRAGMENT, inode->u.ufs_i.i_lastfrag);
+       frag4 = min(u32, UFS_NDIR_FRAGMENT, inode->u.ufs_i.i_lastfrag);
        frag2 = ((frag1 & uspi->s_fpbmask) ? ((frag1 | uspi->s_fpbmask) + 1) : frag1);
        frag3 = frag4 & ~uspi->s_fpbmask;
        block1 = block2 = 0;
index 54a0ab80f59a268a1431c0f98904e84186ef7304..9380ccbc6b174ab55da7b8631699d06f7728d0d4 100644 (file)
@@ -166,11 +166,11 @@ void _ubh_ubhcpymem_(struct ufs_sb_private_info * uspi,
        unsigned char * mem, struct ufs_buffer_head * ubh, unsigned size)
 {
        unsigned len, bhno;
-       if ( size > (ubh->count << uspi->s_fshift) )
+       if (size > (ubh->count << uspi->s_fshift))
                size = ubh->count << uspi->s_fshift;
        bhno = 0;
-       while ( size ) {
-               len = min (size, uspi->s_fsize);
+       while (size) {
+               len = min(unsigned int, size, uspi->s_fsize);
                memcpy (mem, ubh->bh[bhno]->b_data, len);
                mem += uspi->s_fsize;
                size -= len;
@@ -182,11 +182,11 @@ void _ubh_memcpyubh_(struct ufs_sb_private_info * uspi,
        struct ufs_buffer_head * ubh, unsigned char * mem, unsigned size)
 {
        unsigned len, bhno;
-       if ( size > (ubh->count << uspi->s_fshift) )
+       if (size > (ubh->count << uspi->s_fshift))
                size = ubh->count << uspi->s_fshift;
        bhno = 0;
-       while ( size ) {
-               len = min (size, uspi->s_fsize);
+       while (size) {
+               len = min(unsigned int, size, uspi->s_fsize);
                memcpy (ubh->bh[bhno]->b_data, mem, len);
                mem += uspi->s_fsize;
                size -= len;
index 0def49d959a9c43c268531dcd6be1bd370571224..a1e5889d0bb51459de14e41524213c77578113c1 100644 (file)
  * some useful macros
  */
 #define in_range(b,first,len)  ((b)>=(first)&&(b)<(first)+(len))
-#define min(x,y)               ((x)<(y)?(x):(y))
-#define max(x,y)               ((x)>(y)?(x):(y))
-
-
 
 /*
  * macros used for retyping
@@ -335,7 +331,7 @@ static inline unsigned _ubh_find_next_zero_bit_(
        base = offset >> uspi->s_bpfshift;
        offset &= uspi->s_bpfmask;
        for (;;) {
-               count = min (size + offset, uspi->s_bpf);
+               count = min(unsigned int, size + offset, uspi->s_bpf);
                size -= count - offset;
                pos = ext2_find_next_zero_bit (ubh->bh[base]->b_data, count, offset);
                if (pos < count || !size)
@@ -382,7 +378,8 @@ static inline unsigned _ubh_find_last_zero_bit_(
        base = start >> uspi->s_bpfshift;
        start &= uspi->s_bpfmask;
        for (;;) {
-               count = min (size + (uspi->s_bpf - start), uspi->s_bpf)
+               count = min(unsigned int,
+                           size + (uspi->s_bpf - start), uspi->s_bpf)
                        - (uspi->s_bpf - start);
                size -= count;
                pos = find_last_zero_bit (ubh->bh[base]->b_data,
diff --git a/include/asm-sparc/hw_irq.h b/include/asm-sparc/hw_irq.h
new file mode 100644 (file)
index 0000000..8d30a76
--- /dev/null
@@ -0,0 +1,6 @@
+#ifndef __ASM_SPARC_HW_IRQ_H
+#define __ASM_SPARC_HW_IRQ_H
+
+/* Dummy include. */
+
+#endif
diff --git a/include/asm-sparc64/hw_irq.h b/include/asm-sparc64/hw_irq.h
new file mode 100644 (file)
index 0000000..153cae2
--- /dev/null
@@ -0,0 +1,6 @@
+#ifndef __ASM_SPARC64_HW_IRQ_H
+#define __ASM_SPARC64_HW_IRQ_H
+
+/* Dummy include. */
+
+#endif
index 15f24c33f5a498f4f69df11ec0628f216b4376ec..1813bed622c6ea5c70690ca432090e1d3c2221d0 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: keyboard.h,v 1.3 1999/04/28 11:59:12 davem Exp $
+/* $Id: keyboard.h,v 1.4 2001/08/13 14:40:07 davem Exp $
  * linux/include/asm-sparc64/keyboard.h
  *
  * Created Aug 29 1997 by Eddie C. Dost (ecd@skynet.be)
@@ -13,6 +13,9 @@
 
 #ifdef __KERNEL__
 
+#include <linux/kernel.h>
+#include <linux/kd.h>
+
 #define KEYBOARD_IRQ                   1
 #define DISABLE_KBD_DURING_INTERRUPTS  0
 
@@ -22,6 +25,7 @@ extern int pcikbd_translate(unsigned char scancode, unsigned char *keycode,
                            char raw_mode);
 extern char pcikbd_unexpected_up(unsigned char keycode);
 extern void pcikbd_leds(unsigned char leds);
+extern int pcikbd_rate(struct kbd_repeat *rep);
 extern void pcikbd_init_hw(void);
 extern unsigned char pcikbd_sysrq_xlate[128];
 
@@ -30,6 +34,7 @@ extern unsigned char pcikbd_sysrq_xlate[128];
 #define kbd_translate                  pcikbd_translate
 #define kbd_unexpected_up              pcikbd_unexpected_up
 #define kbd_leds                       pcikbd_leds
+#define kbd_rate                       pcikbd_rate
 #define kbd_init_hw                    pcikbd_init_hw
 #define kbd_sysrq_xlate                        pcikbd_sysrq_xlate
 #define kbd_init                       pcikbd_init
index 76e23b44d07dfdb042e52a2f6e7579821a0d6acf..357d0e7ef763c18ef086138bb77eb65618a557ac 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: mmu_context.h,v 1.49 2001/08/09 21:10:20 davem Exp $ */
+/* $Id: mmu_context.h,v 1.50 2001/08/13 20:24:34 kanoj Exp $ */
 #ifndef __SPARC64_MMU_CONTEXT_H
 #define __SPARC64_MMU_CONTEXT_H
 
@@ -9,6 +9,7 @@
 #include <linux/spinlock.h>
 #include <asm/system.h>
 #include <asm/spitfire.h>
+#include <asm/page.h>
 
 static inline void enter_lazy_tlb(struct mm_struct *mm, struct task_struct *tsk, unsigned cpu)
 {
@@ -18,7 +19,19 @@ extern spinlock_t ctx_alloc_lock;
 extern unsigned long tlb_context_cache;
 extern unsigned long mmu_context_bmap[];
 
-#define CTX_VERSION_SHIFT      (PAGE_SHIFT - 3)
+/*
+ * For the 8k pagesize kernel, use only 10 hw context bits to optimize some shifts in
+ * the fast tlbmiss handlers, instead of all 13 bits (specifically for vpte offset
+ * calculation). For other pagesizes, this optimization in the tlbhandlers can not be 
+ * done; but still, all 13 bits can not be used because the tlb handlers use "andcc"
+ * instruction which sign extends 13 bit arguments.
+ */
+#if PAGE_SHIFT == 13
+#define CTX_VERSION_SHIFT      10
+#else
+#define CTX_VERSION_SHIFT      12
+#endif
+
 #define CTX_VERSION_MASK       ((~0UL) << CTX_VERSION_SHIFT)
 #define CTX_FIRST_VERSION      ((1UL << CTX_VERSION_SHIFT) + 1UL)
 #define CTX_VALID(__ctx)       \
index 7e4fb85ac9d9343228486db2d8ea167a905fcb3c..af595343fefce403ca2a8af8f99d2ec839e6cdff 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: pbm.h,v 1.26 2001/05/15 08:54:30 davem Exp $
+/* $Id: pbm.h,v 1.27 2001/08/12 13:18:23 davem Exp $
  * pbm.h: UltraSparc PCI controller software state.
  *
  * Copyright (C) 1997, 1998, 1999 David S. Miller (davem@redhat.com)
@@ -157,6 +157,9 @@ struct pci_pbm_info {
        /* IOMMU state, potentially shared by both PBM segments. */
        struct pci_iommu                *iommu;
 
+       /* PCI slot mapping. */
+       unsigned int                    pci_first_slot;
+
        /* Now things for the actual PCI bus probes. */
        unsigned int                    pci_first_busno;
        unsigned int                    pci_last_busno;
index 614fec33f3390ab835fdeeaf72c0f927ff1159da..3b506d4146adf3e1ac806adbecc190a7a11ce774 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: pgtable.h,v 1.140 2001/04/12 22:41:15 davem Exp $
+/* $Id: pgtable.h,v 1.141 2001/08/13 20:24:34 kanoj Exp $
  * pgtable.h: SpitFire page table operations.
  *
  * Copyright 1996,1997 David S. Miller (davem@caip.rutgers.edu)
@@ -16,6 +16,7 @@
 #include <asm/asi.h>
 #include <asm/mmu_context.h>
 #include <asm/system.h>
+#include <asm/page.h>
 
 #ifndef __ASSEMBLY__
 
  * XXX cheetah's full 64-bit virtual address space, ie. no more hole
  * XXX in the middle like on spitfire. -DaveM
  */
+/*
+ * Given a virtual address, the lowest PAGE_SHIFT bits determine offset
+ * into the page; the next higher PAGE_SHIFT-3 bits determine the pte#
+ * in the proper pagetable (the -3 is from the 8 byte ptes, and each page
+ * table is a single page long). The next higher PMD_BITS determine pmd# 
+ * in the proper pmdtable (where we must have PMD_BITS <= (PAGE_SHIFT-2) 
+ * since the pmd entries are 4 bytes, and each pmd page is a single page 
+ * long). Finally, the higher few bits determine pgde#.
+ */
+
+#define VA_BITS        44
 
 /* PMD_SHIFT determines the size of the area a second-level page table can map */
 #define PMD_SHIFT      (PAGE_SHIFT + (PAGE_SHIFT-3))
 #define PMD_SIZE       (1UL << PMD_SHIFT)
 #define PMD_MASK       (~(PMD_SIZE-1))
+#define PMD_BITS       11
 
 /* PGDIR_SHIFT determines what a third-level page table entry can map */
-#define PGDIR_SHIFT    (PAGE_SHIFT + (PAGE_SHIFT-3) + (PAGE_SHIFT-2))
+#define PGDIR_SHIFT    (PAGE_SHIFT + (PAGE_SHIFT-3) + PMD_BITS)
 #define PGDIR_SIZE     (1UL << PGDIR_SHIFT)
 #define PGDIR_MASK     (~(PGDIR_SIZE-1))
 
 /* We the first one in this file, what we export to the kernel
  * is different so we can optimize correctly for 32-bit tasks.
  */
-#define REAL_PTRS_PER_PMD      (1UL << (PAGE_SHIFT-2))
+#define REAL_PTRS_PER_PMD      (1UL << PMD_BITS)
 #define PTRS_PER_PMD           ((const int)((current->thread.flags & SPARC_FLAG_32BIT) ? \
-                                (REAL_PTRS_PER_PMD >> 2) : (REAL_PTRS_PER_PMD)))
+                                (1UL << (32 - (PAGE_SHIFT-3) - PAGE_SHIFT)) : (REAL_PTRS_PER_PMD)))
 
 /* We cannot use the top 16G because VPTE table lives there. */
-#define PTRS_PER_PGD           ((1UL << (PAGE_SHIFT-3))-1)
+#define PTRS_PER_PGD           ((1UL << (VA_BITS - PAGE_SHIFT - (PAGE_SHIFT-3) - PMD_BITS))-1)
 
 /* Kernel has a separate 44bit address space. */
 #define USER_PTRS_PER_PGD      ((const int)((current->thread.flags & SPARC_FLAG_32BIT) ? \
@@ -62,7 +75,6 @@
 
 #define PTE_TABLE_SIZE 0x2000  /* 1024 entries 8 bytes each */
 #define PMD_TABLE_SIZE 0x2000  /* 2048 entries 4 bytes each */
-#define PGD_TABLE_SIZE 0x1000  /* 1024 entries 4 bytes each */
 
 /* NOTE: TLB miss handlers depend heavily upon where this is. */
 #define VMALLOC_START          0x0000000140000000UL
index 555d38fbeed65e42afbdc7272606cb23cf6b1a17..1d39011731b631cd2242146904e5d8caf8905c15 100644 (file)
 #include <linux/cycx_x25.h>
 #endif
 
-#ifndef        min
-#define min(a,b) (((a)<(b))?(a):(b))
-#endif
-#ifndef        max
-#define max(a,b) (((a)>(b))?(a):(b))
-#endif
-
 #define        is_digit(ch) (((ch)>=(unsigned)'0'&&(ch)<=(unsigned)'9')?1:0)
 
 /* Adapter Data Space.
index 6f1882dbaeb5b012b7d1063d703c48b44f4e4ff5..bafb80e8cae263aae19129ccb5c73f86f85d5c86 100644 (file)
@@ -112,6 +112,11 @@ static inline void console_verbose(void)
        ((unsigned char *)&addr)[1], \
        ((unsigned char *)&addr)[0]
 
+#define min(type,x,y) \
+       ({ type __x = (x), __y = (y); __x < __y ? __x: __y; })
+#define max(type,x,y) \
+       ({ type __x = (x), __y = (y); __x > __y ? __x: __y; })
+
 #endif /* __KERNEL__ */
 
 #define SI_LOAD_SHIFT  16
index 6aa20e4ccf64c1ecab5c8203c1d9e9658fc33bc8..e4f6c1f44a3b7c171d3e310ded016ffc5cc4a263 100644 (file)
 
 #define        LVM_DIR_PREFIX  "/dev/"
 
-#ifndef min
-#define min(a,b) (((a)<(b))?(a):(b))
-#endif
-#ifndef max
-#define max(a,b) (((a)>(b))?(a):(b))
-#endif
-
 /* set the default structure version */
 #if ( LVM_STRUCT_VERSION == 1)
 #define pv_t pv_v2_t
index d32afe265335ae13bc9ae622e57b73ccd1f712f2..3424ef2bc70e9b493581f7ff24a94f53a61aa06b 100644 (file)
@@ -365,10 +365,6 @@ static inline __u8 cfi_read_query(struct map_info *map, __u32 addr)
        }
 }
 
-#ifndef min
-#define min(x,y) ( (x)<(y)?(x):(y) )
-#endif
-
 static inline void cfi_udelay(int us)
 {
 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,2,0)
index 0219a979a95fa8a922e66f370f0324b17b19affb..64d9850695a91137c7ae8c6ae2d8573f93f49fd7 100644 (file)
  */
 #define NFS_SUPER_MAGIC                        0x6969
 
+static inline struct nfs_inode_info *NFS_I(struct inode *inode)
+{
+       return &inode->u.nfs_i;
+}
+
 #define NFS_FH(inode)                  (&(inode)->u.nfs_i.fh)
 #define NFS_SERVER(inode)              (&(inode)->i_sb->u.nfs_sb.s_server)
 #define NFS_CLIENT(inode)              (NFS_SERVER(inode)->client)
@@ -74,7 +79,6 @@
 #define NFS_READTIME(inode)            ((inode)->u.nfs_i.read_cache_jiffies)
 #define NFS_CACHE_CTIME(inode)         ((inode)->u.nfs_i.read_cache_ctime)
 #define NFS_CACHE_MTIME(inode)         ((inode)->u.nfs_i.read_cache_mtime)
-#define NFS_CACHE_ATIME(inode)         ((inode)->u.nfs_i.read_cache_atime)
 #define NFS_CACHE_ISIZE(inode)         ((inode)->u.nfs_i.read_cache_isize)
 #define NFS_NEXTSCAN(inode)            ((inode)->u.nfs_i.nextscan)
 #define NFS_CACHEINV(inode) \
index f14f3d8d9c8e38b6b45440f8d461d3b4f3658dcc..2903f4c83b6c7a27cc8b38bddd3dc682803a1eb9 100644 (file)
@@ -45,7 +45,6 @@ struct nfs_inode_info {
        unsigned long           read_cache_jiffies;
        __u64                   read_cache_ctime;
        __u64                   read_cache_mtime;
-       __u64                   read_cache_atime;
        __u64                   read_cache_isize;
        unsigned long           attrtimeo;
        unsigned long           attrtimeo_timestamp;
@@ -73,6 +72,9 @@ struct nfs_inode_info {
        struct inode            *hash_next,
                                *hash_prev;
        unsigned long           nextscan;
+
+       /* Credentials for shared mmap */
+       struct rpc_cred         *mm_cred;
 };
 
 /*
index d66474b60c427c30b13d4dfc7f2835177e5e42d8..9ea631ace80034e63e4ff15892b034f6337b49e2 100644 (file)
@@ -14,6 +14,8 @@
 #include <linux/config.h>
 #include <linux/sunrpc/sched.h>
 
+#include <asm/atomic.h>
+
 /* size of the nodename buffer */
 #define UNX_MAXNODENAME        32
 
  */
 struct rpc_cred {
        struct rpc_cred *       cr_next;        /* linked list */
+       struct rpc_auth *       cr_auth;
+       struct rpc_credops *    cr_ops;
        unsigned long           cr_expire;      /* when to gc */
-       unsigned short          cr_count;       /* ref count */
+       atomic_t                cr_count;       /* ref count */
        unsigned short          cr_flags;       /* various flags */
 #ifdef RPC_DEBUG
        unsigned long           cr_magic;       /* 0x0f4aa4f0 */
@@ -71,6 +75,9 @@ struct rpc_authops {
        void                    (*destroy)(struct rpc_auth *);
 
        struct rpc_cred *       (*crcreate)(int);
+};
+
+struct rpc_credops {
        void                    (*crdestroy)(struct rpc_cred *);
 
        int                     (*crmatch)(struct rpc_cred *, int);
@@ -92,8 +99,7 @@ void                  rpcauth_destroy(struct rpc_auth *);
 struct rpc_cred *      rpcauth_lookupcred(struct rpc_auth *, int);
 struct rpc_cred *      rpcauth_bindcred(struct rpc_task *);
 void                   rpcauth_holdcred(struct rpc_task *);
-void                   rpcauth_releasecred(struct rpc_auth *,
-                                           struct rpc_cred *);
+void                   put_rpccred(struct rpc_cred *);
 void                   rpcauth_unbindcred(struct rpc_task *);
 int                    rpcauth_matchcred(struct rpc_auth *,
                                          struct rpc_cred *, int);
@@ -107,5 +113,12 @@ void                       rpcauth_free_credcache(struct rpc_auth *);
 void                   rpcauth_insert_credcache(struct rpc_auth *,
                                                struct rpc_cred *);
 
+static inline
+struct rpc_cred *      get_rpccred(struct rpc_cred *cred)
+{
+       atomic_inc(&cred->cr_count);
+       return cred;
+}
+
 #endif /* __KERNEL__ */
 #endif /* _LINUX_SUNRPC_AUTH_H */
index dd83dac6be0d1cbb8fbdadbd7e71bedffb6b5e50..26619cf335af9c9086b3d07c190081d7931f4a28 100644 (file)
@@ -256,9 +256,9 @@ extern spinlock_t pagemap_lru_lock;
  * 64 (1 << INACTIVE_SHIFT) seconds.
  */
 #define INACTIVE_SHIFT 6
-#define inactive_min(a,b) ((a) < (b) ? (a) : (b))
-#define inactive_target inactive_min((memory_pressure >> INACTIVE_SHIFT), \
-               (num_physpages / 4))
+#define inactive_target min(unsigned long, \
+                           (memory_pressure >> INACTIVE_SHIFT), \
+                           (num_physpages / 4))
 
 /*
  * Ugly ugly ugly HACK to make sure the inactive lists
index b1954a442bce3d9a66d57fdd2e3b7f30d48bee26..061090a368f8176419004307e9ad87941888b557 100644 (file)
@@ -332,13 +332,6 @@ typedef struct {
 #include <linux/tty_flip.h>
 
 
-#ifndef        min
-#define min(a,b) (((a)<(b))?(a):(b))
-#endif
-#ifndef        max
-#define max(a,b) (((a)>(b))?(a):(b))
-#endif
-
 #define        is_digit(ch) (((ch)>=(unsigned)'0'&&(ch)<=(unsigned)'9')?1:0)
 #define        is_alpha(ch) ((((ch)>=(unsigned)'a'&&(ch)<=(unsigned)'z')||\
                  ((ch)>=(unsigned)'A'&&(ch)<=(unsigned)'Z'))?1:0)
index bc2a1192e50b6d5653be666f0030168ca27f6d97..403e842f6d78175e762464cc4931813375c4999c 100644 (file)
@@ -803,26 +803,6 @@ do {       spin_lock_bh(&((__sk)->lock.slock)); \
 #define bh_lock_sock(__sk)     spin_lock(&((__sk)->lock.slock))
 #define bh_unlock_sock(__sk)   spin_unlock(&((__sk)->lock.slock))
 
-/*
- *     This might not be the most appropriate place for this two        
- *     but since they are used by a lot of the net related code
- *     at least they get declared on a include that is common to all
- */
-
-static __inline__ int min(unsigned int a, unsigned int b)
-{
-       if (a > b)
-               a = b; 
-       return a;
-}
-
-static __inline__ int max(unsigned int a, unsigned int b)
-{
-       if (a < b)
-               a = b;
-       return a;
-}
-
 extern struct sock *           sk_alloc(int family, int priority, int zero_it);
 extern void                    sk_free(struct sock *sk);
 
@@ -1265,7 +1245,7 @@ static inline long sock_sndtimeo(struct sock *sk, int noblock)
 
 static inline int sock_rcvlowat(struct sock *sk, int waitall, int len)
 {
-       return (waitall ? len : min(sk->rcvlowat, len)) ? : 1;
+       return (waitall ? len : min(int, sk->rcvlowat, len)) ? : 1;
 }
 
 /* Alas, with timeout socket operations are not restartable.
index e7f4598198653cef930633e29a0425466fbef642..8edcd920facd97f39bd62e02950e08d6382a14e8 100644 (file)
@@ -919,11 +919,14 @@ static __inline__ unsigned int tcp_current_mss(struct sock *sk)
 static inline void tcp_initialize_rcv_mss(struct sock *sk)
 {
        struct tcp_opt *tp = &sk->tp_pinfo.af_tcp;
-       int hint = min(tp->advmss, tp->mss_cache);
+       unsigned int hint = min(unsigned int, tp->advmss, tp->mss_cache);
 
-       hint = min(hint, tp->rcv_wnd/2);
+       hint = min(unsigned int, hint, tp->rcv_wnd/2);
                
-       tp->ack.rcv_mss = max(min(hint, TCP_MIN_RCVMSS), TCP_MIN_MSS);
+       tp->ack.rcv_mss = max(unsigned int,
+                             min(unsigned int,
+                                 hint, TCP_MIN_RCVMSS),
+                             TCP_MIN_MSS);
 }
 
 static __inline__ void __tcp_fast_path_on(struct tcp_opt *tp, u32 snd_wnd)
@@ -1074,7 +1077,7 @@ static __inline__ int tcp_packets_in_flight(struct tcp_opt *tp)
  */
 static inline __u32 tcp_recalc_ssthresh(struct tcp_opt *tp)
 {
-       return max(tp->snd_cwnd>>1, 2);
+       return max(u32, tp->snd_cwnd >> 1, 2);
 }
 
 /* If cwnd > ssthresh, we may raise ssthresh to be half-way to cwnd.
@@ -1086,7 +1089,9 @@ static inline __u32 tcp_current_ssthresh(struct tcp_opt *tp)
        if ((1<<tp->ca_state)&(TCPF_CA_CWR|TCPF_CA_Recovery))
                return tp->snd_ssthresh;
        else
-               return max(tp->snd_ssthresh, (tp->snd_cwnd>>1)+(tp->snd_cwnd>>2));
+               return max(u32, tp->snd_ssthresh,
+                          ((tp->snd_cwnd >> 1) +
+                           (tp->snd_cwnd >> 2)));
 }
 
 static inline void tcp_sync_left_out(struct tcp_opt *tp)
@@ -1121,7 +1126,8 @@ static inline void __tcp_enter_cwr(struct tcp_opt *tp)
 {
        tp->undo_marker = 0;
        tp->snd_ssthresh = tcp_recalc_ssthresh(tp);
-       tp->snd_cwnd = min(tp->snd_cwnd, tcp_packets_in_flight(tp)+1);
+       tp->snd_cwnd = min(u32, tp->snd_cwnd,
+                          tcp_packets_in_flight(tp) + 1);
        tp->snd_cwnd_cnt = 0;
        tp->high_seq = tp->snd_nxt;
        tp->snd_cwnd_stamp = tcp_time_stamp;
@@ -1486,12 +1492,12 @@ static inline void tcp_select_initial_window(int space, __u32 mss,
 {
        /* If no clamp set the clamp to the max possible scaled window */
        if (*window_clamp == 0)
-               (*window_clamp) = (65535<<14);
-       space = min(*window_clamp,space);
+               (*window_clamp) = (65535 << 14);
+       space = min(u32, *window_clamp, space);
 
        /* Quantize space offering to a multiple of mss if possible. */
        if (space > mss)
-               space = (space/mss)*mss;
+               space = (space / mss) * mss;
 
        /* NOTE: offering an initial window larger than 32767
         * will break some buggy TCP stacks. We try to be nice.
@@ -1499,7 +1505,7 @@ static inline void tcp_select_initial_window(int space, __u32 mss,
         * our initial window offering to 32k. There should also
         * be a sysctl option to stop being nice.
         */
-       (*rcv_wnd) = min(space, MAX_TCP_WINDOW);
+       (*rcv_wnd) = min(int, space, MAX_TCP_WINDOW);
        (*rcv_wscale) = 0;
        if (wscale_ok) {
                /* See RFC1323 for an explanation of the limit to 14 */
@@ -1508,7 +1514,7 @@ static inline void tcp_select_initial_window(int space, __u32 mss,
                        (*rcv_wscale)++;
                }
                if (*rcv_wscale && sysctl_tcp_app_win && space>=mss &&
-                   space - max((space>>sysctl_tcp_app_win), mss>>*rcv_wscale) < 65536/2)
+                   space - max(unsigned int, (space>>sysctl_tcp_app_win), mss>>*rcv_wscale) < 65536/2)
                        (*rcv_wscale)--;
        }
 
@@ -1526,7 +1532,7 @@ static inline void tcp_select_initial_window(int space, __u32 mss,
                        *rcv_wnd = init_cwnd*mss;
        }
        /* Set the clamp no higher than max representable value */
-       (*window_clamp) = min(65535<<(*rcv_wscale),*window_clamp);
+       (*window_clamp) = min(u32, 65535 << (*rcv_wscale), *window_clamp);
 }
 
 static inline int tcp_win_from_space(int space)
@@ -1692,8 +1698,8 @@ static inline void tcp_enter_memory_pressure(void)
 static inline void tcp_moderate_sndbuf(struct sock *sk)
 {
        if (!(sk->userlocks&SOCK_SNDBUF_LOCK)) {
-               sk->sndbuf = min(sk->sndbuf, sk->wmem_queued/2);
-               sk->sndbuf = max(sk->sndbuf, SOCK_MIN_SNDBUF);
+               sk->sndbuf = min(int, sk->sndbuf, sk->wmem_queued/2);
+               sk->sndbuf = max(int, sk->sndbuf, SOCK_MIN_SNDBUF);
        }
 }
 
index 3ba39b97dd6a064f0d46199eb3e3bac85a1eb1b5..aa1072b04bca5a5b6ba9655260a76ba8df10aa97 100644 (file)
@@ -45,12 +45,12 @@ atomic_t page_cache_size = ATOMIC_INIT(0);
 unsigned int page_hash_bits;
 struct page **page_hash_table;
 
-spinlock_t pagecache_lock = SPIN_LOCK_UNLOCKED;
+spinlock_t __cacheline_aligned pagecache_lock = SPIN_LOCK_UNLOCKED;
 /*
  * NOTE: to avoid deadlocking you must never acquire the pagecache_lock with
  *       the pagemap_lru_lock held.
  */
-spinlock_t pagemap_lru_lock = SPIN_LOCK_UNLOCKED;
+spinlock_t __cacheline_aligned pagemap_lru_lock = SPIN_LOCK_UNLOCKED;
 
 #define CLUSTER_PAGES          (1 << page_cluster)
 #define CLUSTER_OFFSET(x)      (((x) >> page_cluster) << page_cluster)
index 5f3cef59c05f1b5fe7a8cd6c37671f0bb52834ea..a54e4e4372aa2b3655428fd322a9211bc89d1c61 100644 (file)
@@ -46,7 +46,7 @@ static void flush_all_zero_pkmaps(void)
 
        for (i = 0; i < LAST_PKMAP; i++) {
                struct page *page;
-               pte_t pte;
+
                /*
                 * zero means we don't have anything to do,
                 * >1 means that it is still in use. Only
@@ -56,10 +56,21 @@ static void flush_all_zero_pkmaps(void)
                if (pkmap_count[i] != 1)
                        continue;
                pkmap_count[i] = 0;
-               pte = ptep_get_and_clear(pkmap_page_table+i);
-               if (pte_none(pte))
+
+               /* sanity check */
+               if (pte_none(pkmap_page_table[i]))
                        BUG();
-               page = pte_page(pte);
+
+               /*
+                * Don't need an atomic fetch-and-clear op here;
+                * no-one has the page mapped, and cannot get at
+                * its virtual address (and hence PTE) without first
+                * getting the kmap_lock (which is held here).
+                * So no dangers, even with speculative execution.
+                */
+               page = pte_page(pkmap_page_table[i]);
+               pte_clear(&pkmap_page_table[i]);
+
                page->virtual = NULL;
        }
        flush_tlb_all();
@@ -139,6 +150,7 @@ void kunmap_high(struct page *page)
 {
        unsigned long vaddr;
        unsigned long nr;
+       int need_wakeup;
 
        spin_lock(&kmap_lock);
        vaddr = (unsigned long) page->virtual;
@@ -150,13 +162,28 @@ void kunmap_high(struct page *page)
         * A count must never go down to zero
         * without a TLB flush!
         */
+       need_wakeup = 0;
        switch (--pkmap_count[nr]) {
        case 0:
                BUG();
        case 1:
-               wake_up(&pkmap_map_wait);
+               /*
+                * Avoid an unnecessary wake_up() function call.
+                * The common case is pkmap_count[] == 1, but
+                * no waiters.
+                * The tasks queued in the wait-queue are guarded
+                * by both the lock in the wait-queue-head and by
+                * the kmap_lock.  As the kmap_lock is held here,
+                * no need for the wait-queue-head's lock.  Simply
+                * test if the queue is empty.
+                */
+               need_wakeup = waitqueue_active(&pkmap_map_wait);
        }
        spin_unlock(&kmap_lock);
+
+       /* do wake-up, if needed, race-free outside of the spin lock */
+       if (need_wakeup)
+               wake_up(&pkmap_map_wait);
 }
 
 #define POOL_SIZE 32
@@ -182,20 +209,12 @@ static inline void copy_from_high_bh (struct buffer_head *to,
 {
        struct page *p_from;
        char *vfrom;
-       unsigned long flags;
 
        p_from = from->b_page;
 
-       /*
-        * Since this can be executed from IRQ context, reentrance
-        * on the same CPU must be avoided:
-        */
-       __save_flags(flags);
-       __cli();
        vfrom = kmap_atomic(p_from, KM_BOUNCE_WRITE);
        memcpy(to->b_data, vfrom + bh_offset(from), to->b_size);
        kunmap_atomic(vfrom, KM_BOUNCE_WRITE);
-       __restore_flags(flags);
 }
 
 static inline void copy_to_high_bh_irq (struct buffer_head *to,
index cc1a556e9f214b8326400f4927aa5b38c9a43233..1dfb9d1b76a0cbd632ac3095d8414a5e25a875f2 100644 (file)
@@ -788,6 +788,9 @@ int inactive_shortage(void)
                        zone_t *zone = pgdat->node_zones + i;
                        unsigned int inactive;
 
+                       if (!zone->size)
+                               continue;
+
                        inactive  = zone->inactive_dirty_pages;
                        inactive += zone->inactive_clean_pages;
                        inactive += zone->free_pages;
index d1a1ecf4893ab75ce28d0a0103b528fc9e494385..d40aefcfd71240c3e750fb1f20856a76fc737b17 100644 (file)
@@ -113,8 +113,6 @@ extern inline void atalk_unregister_sysctl(void);
 struct datalink_proto *ddp_dl, *aarp_dl;
 static struct proto_ops atalk_dgram_ops;
 
-#define min(a,b)       (((a)<(b))?(a):(b))
-
 /**************************************************************************\
 *                                                                          *
 * Handlers for the socket list.                                            *
@@ -1392,7 +1390,7 @@ static int atalk_rcv(struct sk_buff *skb, struct net_device *dev,
 
        /* Trim buffer in case of stray trailing data */
        origlen = skb->len;
-       skb_trim(skb, min(skb->len, ddphv.deh_len));
+       skb_trim(skb, min(unsigned int, skb->len, ddphv.deh_len));
 
        /*
         * Size check to see if ddp->deh_len was crap
@@ -1457,7 +1455,7 @@ static int atalk_rcv(struct sk_buff *skb, struct net_device *dev,
                }
 
                 /* Fix up skb->len field */
-                skb_trim(skb, min(origlen, rt->dev->hard_header_len +
+                skb_trim(skb, min(unsigned int, origlen, rt->dev->hard_header_len +
                        ddp_dl->header_length + ddphv.deh_len));
 
                /* Mend the byte order */
index 1d767b9d7d5068a9b46dada101a2a6753d3e8c0d..da409ee2094600b28bc6de859cfdd7754b96dd7e 100644 (file)
@@ -751,7 +751,7 @@ static int ax25_getsockopt(struct socket *sock, int level, int optname, char *op
                return -EFAULT;
 
        valptr = (void *) &val;
-       length = min(maxlen, sizeof(int));
+       length = min(unsigned int, maxlen, sizeof(int));
 
        switch (optname) {
                case AX25_WINDOW:
@@ -803,7 +803,7 @@ static int ax25_getsockopt(struct socket *sock, int level, int optname, char *op
 
                        if (ax25_dev != NULL && ax25_dev->dev != NULL) {
                                strncpy(devname, ax25_dev->dev->name, IFNAMSIZ);
-                               length = min(strlen(ax25_dev->dev->name)+1, maxlen);
+                               length = min(unsigned int, strlen(ax25_dev->dev->name)+1, maxlen);
                                devname[length-1] = '\0';
                        } else {
                                *devname = '\0';
index 3d047851d9525dc77b15288bd111eb19a4efd6b8..95772a1e3dc648086f2ea13d35256f1589a9e23a 100644 (file)
@@ -5,7 +5,7 @@
  *     Authors:
  *     Lennert Buytenhek               <buytenh@gnu.org>
  *
- *     $Id: br_device.c,v 1.4 2001/06/01 09:28:28 davem Exp $
+ *     $Id: br_device.c,v 1.5 2001/08/14 22:05:57 davem Exp $
  *
  *     This program is free software; you can redistribute it and/or
  *     modify it under the terms of the GNU General Public License
@@ -53,7 +53,8 @@ static int __br_dev_xmit(struct sk_buff *skb, struct net_device *dev)
        br->statistics.tx_packets++;
        br->statistics.tx_bytes += skb->len;
 
-       dest = skb->data;
+       dest = skb->mac.raw = skb->data;
+       skb_pull(skb, ETH_HLEN);
 
        if (dest[0] & 1) {
                br_flood_deliver(br, skb, 0);
index a3de3ed57ca539069ec0f0779857276841e261fa..405c44c9072403c112a42198528a71bb2827b30f 100644 (file)
@@ -5,7 +5,7 @@
  *     Authors:
  *     Lennert Buytenhek               <buytenh@gnu.org>
  *
- *     $Id: br_forward.c,v 1.3 2001/06/01 09:28:28 davem Exp $
+ *     $Id: br_forward.c,v 1.4 2001/08/14 22:05:57 davem Exp $
  *
  *     This program is free software; you can redistribute it and/or
  *     modify it under the terms of the GNU General Public License
@@ -30,10 +30,18 @@ static inline int should_deliver(struct net_bridge_port *p, struct sk_buff *skb)
        return 1;
 }
 
+static int __dev_queue_push_xmit(struct sk_buff *skb)
+{
+       skb_push(skb, ETH_HLEN);
+       dev_queue_xmit(skb);
+
+       return 0;
+}
+
 static int __br_forward_finish(struct sk_buff *skb)
 {
        NF_HOOK(PF_BRIDGE, NF_BR_POST_ROUTING, skb, NULL, skb->dev,
-                       dev_queue_xmit);
+                       __dev_queue_push_xmit);
 
        return 0;
 }
index d76a6ba8b026ff75afaca6573e7d8f50d5a97eff..dc1e1561a05140fc99b93339102eb495ea25f66f 100644 (file)
@@ -5,7 +5,7 @@
  *     Authors:
  *     Lennert Buytenhek               <buytenh@gnu.org>
  *
- *     $Id: br_input.c,v 1.8 2001/06/01 09:28:28 davem Exp $
+ *     $Id: br_input.c,v 1.9 2001/08/14 22:05:57 davem Exp $
  *
  *     This program is free software; you can redistribute it and/or
  *     modify it under the terms of the GNU General Public License
@@ -39,7 +39,7 @@ static void br_pass_frame_up(struct net_bridge *br, struct sk_buff *skb)
        indev = skb->dev;
        skb->dev = &br->dev;
        skb->pkt_type = PACKET_HOST;
-       skb_pull(skb, skb->mac.raw - skb->data);
+       skb_push(skb, ETH_HLEN);
        skb->protocol = eth_type_trans(skb, &br->dev);
 
        NF_HOOK(PF_BRIDGE, NF_BR_LOCAL_IN, skb, indev, NULL,
@@ -64,8 +64,6 @@ static void __br_handle_frame(struct sk_buff *skb)
            p->state == BR_STATE_DISABLED)
                goto freeandout;
 
-       skb_push(skb, skb->data - skb->mac.raw);
-
        if (br->dev.flags & IFF_PROMISC) {
                struct sk_buff *skb2;
 
index d12468d7c4f60e0df49b1a91b912e6bd2e1508a7..50f4395724df740b61a655518db6e1ad58592229 100644 (file)
@@ -87,7 +87,7 @@ int memcpy_toiovec(struct iovec *iov, unsigned char *kdata, int len)
        {
                if(iov->iov_len)
                {
-                       int copy = min(iov->iov_len, len);
+                       int copy = min(unsigned int, iov->iov_len, len);
                        if (copy_to_user(iov->iov_base, kdata, copy))
                                goto out;
                        kdata+=copy;
@@ -114,7 +114,7 @@ void memcpy_tokerneliovec(struct iovec *iov, unsigned char *kdata, int len)
        {
                if(iov->iov_len)
                {
-                       int copy = min(iov->iov_len, len);
+                       int copy = min(unsigned int, iov->iov_len, len);
                        memcpy(iov->iov_base, kdata, copy);
                        kdata+=copy;
                        len-=copy;
@@ -140,7 +140,7 @@ int memcpy_fromiovec(unsigned char *kdata, struct iovec *iov, int len)
        {
                if(iov->iov_len)
                {
-                       int copy = min(len, iov->iov_len);
+                       int copy = min(unsigned int, len, iov->iov_len);
                        if (copy_from_user(kdata, iov->iov_base, copy))
                                goto out;
                        len-=copy;
@@ -175,7 +175,7 @@ int memcpy_fromiovecend(unsigned char *kdata, struct iovec *iov, int offset,
        while (len > 0)
        {
                u8 *base = iov->iov_base + offset;
-               int copy = min(len, iov->iov_len - offset);
+               int copy = min(unsigned int, len, iov->iov_len - offset);
 
                offset = 0;
                if (copy_from_user(kdata, base, copy))
@@ -214,7 +214,7 @@ int csum_partial_copy_fromiovecend(unsigned char *kdata, struct iovec *iov,
        while (len > 0)
        {
                u8 *base = iov->iov_base + offset;
-               unsigned int copy = min(len, iov->iov_len - offset);
+               int copy = min(unsigned int, len, iov->iov_len - offset);
 
                offset = 0;
                /* There is a remnant from previous iov. */
index 43db547adc96a84af60f44d3a3e43031250c03e3..51b99b08826f0f9c24e7cd4f559c0d86faa146c0 100644 (file)
@@ -5,7 +5,7 @@
  *
  *             The IP to API glue.
  *             
- * Version:    $Id: ip_sockglue.c,v 1.56 2001/02/18 09:07:58 davem Exp $
+ * Version:    $Id: ip_sockglue.c,v 1.59 2001/08/13 18:56:12 davem Exp $
  *
  * Authors:    see ip.c
  *
@@ -43,8 +43,6 @@
 #include <linux/errqueue.h>
 #include <asm/uaccess.h>
 
-#define MAX(a,b) ((a)>(b)?(a):(b))
-
 #define IP_CMSG_PKTINFO                1
 #define IP_CMSG_TTL            2
 #define IP_CMSG_TOS            4
@@ -685,7 +683,7 @@ int ip_getsockopt(struct sock *sk, int level, int optname, char *optval, int *op
 
                                ip_options_undo(opt);
 
-                               len=min(len, opt->optlen);
+                               len = min(unsigned int, len, opt->optlen);
                                if(put_user(len, optlen))
                                        return -EFAULT;
                                if(copy_to_user(optval, opt->__data, len))
@@ -746,7 +744,7 @@ int ip_getsockopt(struct sock *sk, int level, int optname, char *optval, int *op
                case IP_MULTICAST_IF:
                {
                        struct in_addr addr;
-                       len = min(len,sizeof(struct in_addr));
+                       len = min(unsigned int, len, sizeof(struct in_addr));
                        addr.s_addr = sk->protinfo.af_inet.mc_addr;
                        release_sock(sk);
 
@@ -810,7 +808,7 @@ int ip_getsockopt(struct sock *sk, int level, int optname, char *optval, int *op
                if(copy_to_user(optval,&ucval,1))
                        return -EFAULT;
        } else {
-               len=min(sizeof(int),len);
+               len = min(unsigned int, sizeof(int), len);
                if(put_user(len, optlen))
                        return -EFAULT;
                if(copy_to_user(optval,&val,len))
index 6a696b74cf24fe2988ea90553d0feea03b67c4c6..bc736375167e177dbd047b08237db630d3b434f2 100644 (file)
@@ -9,7 +9,7 @@
  *     as published by the Free Software Foundation; either version
  *     2 of the License, or (at your option) any later version.
  *
- *     Version: $Id: ipmr.c,v 1.60 2001/06/29 21:33:22 davem Exp $
+ *     Version: $Id: ipmr.c,v 1.63 2001/08/13 18:56:12 davem Exp $
  *
  *     Fixes:
  *     Michael Chastain        :       Incorrect size of copying.
@@ -976,11 +976,11 @@ int ip_mroute_getsockopt(struct sock *sk,int optname,char *optval,int *optlen)
           optname!=MRT_ASSERT)
                return -ENOPROTOOPT;
 
-       if(get_user(olr, optlen))
+       if (get_user(olr, optlen))
                return -EFAULT;
 
-       olr=min(olr,sizeof(int));
-       if(olr<0)
+       olr = min(unsigned int, olr, sizeof(int));
+       if (olr < 0)
                return -EINVAL;
                
        if(put_user(olr,optlen))
index 9c3434aa50d3c516f85176af417cc251bd4d0cfc..186e63ee3cf0ccbcaabff9d59fb0f67797bb0a48 100644 (file)
@@ -534,7 +534,7 @@ ip_fw_domatch(struct ip_fwkernel *f,
        }
        if (f->ipfw.fw_flg & IP_FW_F_NETLINK) {
 #if defined(CONFIG_NETLINK_DEV) || defined(CONFIG_NETLINK_DEV_MODULE)
-               size_t len = min(f->ipfw.fw_outputsize, ntohs(ip->tot_len))
+               size_t len = min(unsigned int, f->ipfw.fw_outputsize, ntohs(ip->tot_len))
                        + sizeof(__u32) + sizeof(skb->nfmark) + IFNAMSIZ;
                struct sk_buff *outskb=alloc_skb(len, GFP_ATOMIC);
 
index b1ec4cbfda11474411677edd1ae56fb8d0778546..d59d540533b277dfd3416d51e6242bff2aff82cf 100644 (file)
@@ -20,7 +20,7 @@
  *     license in recognition of the original copyright.
  *                             -- Alan Cox.
  *
- *     $Id: ipfwadm_core.c,v 1.5 2001/06/01 14:56:53 davem Exp $
+ *     $Id: ipfwadm_core.c,v 1.8 2001/08/13 18:56:12 davem Exp $
  *
  *     Ported from BSD to Linux,
  *             Alan Cox 22/Nov/1994.
@@ -648,7 +648,9 @@ int ip_fw_chk(struct iphdr *ip, struct net_device *rif, __u16 *redirport,
                        struct sk_buff *skb=alloc_skb(128, GFP_ATOMIC);
                        if(skb)
                        {
-                               int len=min(128,ntohs(ip->tot_len));
+                               int len = min(unsigned int,
+                                             128, ntohs(ip->tot_len));
+
                                skb_put(skb,len);
                                memcpy(skb->data,ip,len);
                                if(netlink_post(NETLINK_FIREWALL, skb))
index d5bed1ea9c43f1835ea5d55e2bcdeac44b0d8b74..e5432e639c09f7938ffdc37355935b0d2d8a3203 100644 (file)
@@ -5,7 +5,7 @@
  *
  *             ROUTE - implementation of the IP router.
  *
- * Version:    $Id: route.c,v 1.95 2001/07/10 22:32:51 davem Exp $
+ * Version:    $Id: route.c,v 1.98 2001/08/13 18:56:12 davem Exp $
  *
  * Authors:    Ross Biro, <bir7@leland.Stanford.Edu>
  *             Fred N. van Kempen, <waltje@uWalt.NL.Mugnet.ORG>
@@ -515,14 +515,14 @@ static int rt_garbage_collect(void)
                        equilibrium = ipv4_dst_ops.gc_thresh;
                goal = atomic_read(&ipv4_dst_ops.entries) - equilibrium;
                if (goal > 0) {
-                       equilibrium += min(goal / 2, rt_hash_mask + 1);
+                       equilibrium += min(unsigned int, goal / 2, rt_hash_mask + 1);
                        goal = atomic_read(&ipv4_dst_ops.entries) - equilibrium;
                }
        } else {
                /* We are in dangerous area. Try to reduce cache really
                 * aggressively.
                 */
-               goal = max(goal / 2, rt_hash_mask + 1);
+               goal = max(unsigned int, goal / 2, rt_hash_mask + 1);
                equilibrium = atomic_read(&ipv4_dst_ops.entries) - goal;
        }
 
@@ -1207,8 +1207,8 @@ static void rt_set_nexthop(struct rtable *rt, struct fib_result *res, u32 itag)
        if (rt->u.dst.pmtu > IP_MAX_MTU)
                rt->u.dst.pmtu = IP_MAX_MTU;
        if (rt->u.dst.advmss == 0)
-               rt->u.dst.advmss = max(rt->u.dst.dev->mtu - 40,
-                                       ip_rt_min_advmss);
+               rt->u.dst.advmss = max(unsigned int, rt->u.dst.dev->mtu - 40,
+                                      ip_rt_min_advmss);
        if (rt->u.dst.advmss > 65535 - 40)
                rt->u.dst.advmss = 65535 - 40;
 
index f8eff546c7ff54256fa9b4fe08a715e9df08991e..eb0f36fe9ac84f09fad67054bdbc6b9774dd167e 100644 (file)
@@ -5,7 +5,7 @@
  *
  *             Implementation of the Transmission Control Protocol(TCP).
  *
- * Version:    $Id: tcp.c,v 1.205 2001/05/05 22:25:30 davem Exp $
+ * Version:    $Id: tcp.c,v 1.208 2001/08/13 18:56:12 davem Exp $
  *
  * Authors:    Ross Biro, <bir7@leland.Stanford.Edu>
  *             Fred N. van Kempen, <waltje@uWalt.NL.Mugnet.ORG>
@@ -852,7 +852,7 @@ ssize_t do_tcp_sendpages(struct sock *sk, struct page **pages, int poffset, size
 
                page = pages[poffset/PAGE_SIZE];
                offset = poffset % PAGE_SIZE;
-               size = min(psize, PAGE_SIZE-offset);
+               size = min(unsigned int, psize, PAGE_SIZE-offset);
 
                if (tp->send_head==NULL || (copy = mss_now - skb->len) <= 0) {
 new_segment:
@@ -2326,7 +2326,7 @@ int tcp_getsockopt(struct sock *sk, int level, int optname, char *optval,
        if(get_user(len,optlen))
                return -EFAULT;
 
-       len = min(len, sizeof(int));
+       len = min(unsigned int, len, sizeof(int));
        
        if(len < 0)
                return -EINVAL;
@@ -2421,7 +2421,7 @@ int tcp_getsockopt(struct sock *sk, int level, int optname, char *optval,
                info.tcpi_advmss = tp->advmss;
                info.tcpi_reordering = tp->reordering;
 
-               len = min(len, sizeof(info));
+               len = min(unsigned int, len, sizeof(info));
                if(put_user(len, optlen))
                        return -EFAULT;
                if(copy_to_user(optval, &info,len))
index 0c7e25da7c411bcc17303503a794dda9953beba7..74563cde650ac05cdfc2dc3dd1209e1ece9aa2c6 100644 (file)
@@ -5,7 +5,7 @@
  *
  *             Implementation of the Transmission Control Protocol(TCP).
  *
- * Version:    $Id: tcp_input.c,v 1.232 2001/05/24 22:32:49 davem Exp $
+ * Version:    $Id: tcp_input.c,v 1.235 2001/08/13 18:56:12 davem Exp $
  *
  * Authors:    Ross Biro, <bir7@leland.Stanford.Edu>
  *             Fred N. van Kempen, <waltje@uWalt.NL.Mugnet.ORG>
@@ -168,7 +168,7 @@ static void tcp_incr_quickack(struct tcp_opt *tp)
        if (quickacks==0)
                quickacks=2;
        if (quickacks > tp->ack.quick)
-               tp->ack.quick = min(quickacks, TCP_MAX_QUICKACKS);
+               tp->ack.quick = min(unsigned int, quickacks, TCP_MAX_QUICKACKS);
 }
 
 void tcp_enter_quickack_mode(struct tcp_opt *tp)
@@ -198,7 +198,7 @@ static void tcp_fixup_sndbuf(struct sock *sk)
        int sndmem = tp->mss_clamp+MAX_TCP_HEADER+16+sizeof(struct sk_buff);
 
        if (sk->sndbuf < 3*sndmem)
-               sk->sndbuf = min(3*sndmem, sysctl_tcp_wmem[2]);
+               sk->sndbuf = min(int, 3*sndmem, sysctl_tcp_wmem[2]);
 }
 
 /* 2. Tuning advertised window (window_clamp, rcv_ssthresh)
@@ -262,7 +262,7 @@ tcp_grow_window(struct sock *sk, struct tcp_opt *tp, struct sk_buff *skb)
                        incr = __tcp_grow_window(sk, tp, skb);
 
                if (incr) {
-                       tp->rcv_ssthresh = min(tp->rcv_ssthresh + incr, tp->window_clamp);
+                       tp->rcv_ssthresh = min(u32, tp->rcv_ssthresh + incr, tp->window_clamp);
                        tp->ack.quick |= 1;
                }
        }
@@ -282,7 +282,7 @@ static void tcp_fixup_rcvbuf(struct sock *sk)
        while (tcp_win_from_space(rcvmem) < tp->advmss)
                rcvmem += 128;
        if (sk->rcvbuf < 4*rcvmem)
-               sk->rcvbuf = min(4*rcvmem, sysctl_tcp_rmem[2]);
+               sk->rcvbuf = min(int, 4*rcvmem, sysctl_tcp_rmem[2]);
 }
 
 /* 4. Try to fixup all. It is made iimediately after connection enters
@@ -304,16 +304,16 @@ static void tcp_init_buffer_space(struct sock *sk)
                tp->window_clamp = maxwin;
 
                if (sysctl_tcp_app_win && maxwin>4*tp->advmss)
-                       tp->window_clamp = max(maxwin-(maxwin>>sysctl_tcp_app_win), 4*tp->advmss);
+                       tp->window_clamp = max(u32, maxwin-(maxwin>>sysctl_tcp_app_win), 4*tp->advmss);
        }
 
        /* Force reservation of one segment. */
        if (sysctl_tcp_app_win &&
            tp->window_clamp > 2*tp->advmss &&
            tp->window_clamp + tp->advmss > maxwin)
-               tp->window_clamp = max(2*tp->advmss, maxwin-tp->advmss);
+               tp->window_clamp = max(u32, 2*tp->advmss, maxwin-tp->advmss);
 
-       tp->rcv_ssthresh = min(tp->rcv_ssthresh, tp->window_clamp);
+       tp->rcv_ssthresh = min(u32, tp->rcv_ssthresh, tp->window_clamp);
        tp->snd_cwnd_stamp = tcp_time_stamp;
 }
 
@@ -338,7 +338,7 @@ static void tcp_clamp_window(struct sock *sk, struct tcp_opt *tp)
                    !(sk->userlocks&SOCK_RCVBUF_LOCK) &&
                    !tcp_memory_pressure &&
                    atomic_read(&tcp_memory_allocated) < sysctl_tcp_mem[0])
-                       sk->rcvbuf = min(atomic_read(&sk->rmem_alloc), sysctl_tcp_rmem[2]);
+                       sk->rcvbuf = min(int, atomic_read(&sk->rmem_alloc), sysctl_tcp_rmem[2]);
        }
        if (atomic_read(&sk->rmem_alloc) > sk->rcvbuf) {
                app_win += ofo_win;
@@ -346,11 +346,11 @@ static void tcp_clamp_window(struct sock *sk, struct tcp_opt *tp)
                        app_win >>= 1;
                if (app_win > tp->ack.rcv_mss)
                        app_win -= tp->ack.rcv_mss;
-               app_win = max(app_win, 2*tp->advmss);
+               app_win = max(unsigned int, app_win, 2*tp->advmss);
 
                if (!ofo_win)
-                       tp->window_clamp = min(tp->window_clamp, app_win);
-               tp->rcv_ssthresh = min(tp->window_clamp, 2*tp->advmss);
+                       tp->window_clamp = min(u32, tp->window_clamp, app_win);
+               tp->rcv_ssthresh = min(u32, tp->window_clamp, 2*tp->advmss);
        }
 }
 
@@ -472,7 +472,7 @@ static __inline__ void tcp_rtt_estimator(struct tcp_opt *tp, __u32 mrtt)
                /* no previous measure. */
                tp->srtt = m<<3;        /* take the measured time to be rtt */
                tp->mdev = m<<2;        /* make sure rto = 3*rtt */
-               tp->mdev_max = tp->rttvar = max(tp->mdev, TCP_RTO_MIN);
+               tp->mdev_max = tp->rttvar = max(u32, tp->mdev, TCP_RTO_MIN);
                tp->rtt_seq = tp->snd_nxt;
        }
 }
@@ -575,7 +575,7 @@ void tcp_update_metrics(struct sock *sk)
                           tp->ca_state == TCP_CA_Open) {
                        /* Cong. avoidance phase, cwnd is reliable. */
                        if (!(dst->mxlock&(1<<RTAX_SSTHRESH)))
-                               dst->ssthresh = max(tp->snd_cwnd>>1, tp->snd_ssthresh);
+                               dst->ssthresh = max(u32, tp->snd_cwnd>>1, tp->snd_ssthresh);
                        if (!(dst->mxlock&(1<<RTAX_CWND)))
                                dst->cwnd = (dst->cwnd + tp->snd_cwnd)>>1;
                } else {
@@ -617,7 +617,7 @@ __u32 tcp_init_cwnd(struct tcp_opt *tp)
        else if (cwnd > tp->snd_ssthresh)
                cwnd = tp->snd_ssthresh;
 
-       return min(cwnd, tp->snd_cwnd_clamp);
+       return min(u32, cwnd, tp->snd_cwnd_clamp);
 }
 
 /* Initialize metrics on socket. */
@@ -668,7 +668,7 @@ static void tcp_init_metrics(struct sock *sk)
                tp->srtt = dst->rtt;
        if (dst->rttvar > tp->mdev) {
                tp->mdev = dst->rttvar;
-               tp->mdev_max = tp->rttvar = max(tp->mdev, TCP_RTO_MIN);
+               tp->mdev_max = tp->rttvar = max(u32, tp->mdev, TCP_RTO_MIN);
        }
        tcp_set_rto(tp);
        tcp_bound_rto(tp);
@@ -693,7 +693,7 @@ reset:
 static void tcp_update_reordering(struct tcp_opt *tp, int metric, int ts)
 {
        if (metric > tp->reordering) {
-               tp->reordering = min(TCP_MAX_REORDERING, metric);
+               tp->reordering = min(unsigned int, TCP_MAX_REORDERING, metric);
 
                /* This exciting event is worth to be remembered. 8) */
                if (ts)
@@ -848,12 +848,12 @@ tcp_sacktag_write_queue(struct sock *sk, struct sk_buff *ack_skb, u32 prior_snd_
                                if (sacked&TCPCB_RETRANS) {
                                        if ((dup_sack && in_sack) &&
                                            (sacked&TCPCB_SACKED_ACKED))
-                                               reord = min(fack_count, reord);
+                                               reord = min(int, fack_count, reord);
                                } else {
                                        /* If it was in a hole, we detected reordering. */
                                        if (fack_count < prior_fackets &&
                                            !(sacked&TCPCB_SACKED_ACKED))
-                                               reord = min(fack_count, reord);
+                                               reord = min(int, fack_count, reord);
                                }
 
                                /* Nothing to do; acked frame is about to be dropped. */
@@ -885,7 +885,7 @@ tcp_sacktag_write_queue(struct sock *sk, struct sk_buff *ack_skb, u32 prior_snd_
                                         */
                                        if (!(sacked & TCPCB_RETRANS) &&
                                            fack_count < prior_fackets)
-                                               reord = min(fack_count, reord);
+                                               reord = min(int, fack_count, reord);
 
                                        if (sacked & TCPCB_LOST) {
                                                TCP_SKB_CB(skb)->sacked &= ~TCPCB_LOST;
@@ -901,7 +901,7 @@ tcp_sacktag_write_queue(struct sock *sk, struct sk_buff *ack_skb, u32 prior_snd_
                                        tp->fackets_out = fack_count;
                        } else {
                                if (dup_sack && (sacked&TCPCB_RETRANS))
-                                       reord = min(fack_count, reord);
+                                       reord = min(int, fack_count, reord);
                        }
 
                        /* D-SACK. We can detect redundant retransmission
@@ -1019,7 +1019,7 @@ void tcp_enter_loss(struct sock *sk, int how)
        }
        tcp_sync_left_out(tp);
 
-       tp->reordering = min(tp->reordering, sysctl_tcp_reordering);
+       tp->reordering = min(unsigned int, tp->reordering, sysctl_tcp_reordering);
        tp->ca_state = TCP_CA_Loss;
        tp->high_seq = tp->snd_nxt;
        TCP_ECN_queue_cwr(tp);
@@ -1177,7 +1177,7 @@ tcp_time_to_recover(struct sock *sk, struct tcp_opt *tp)
         * recovery more?
         */
        if (tp->packets_out <= tp->reordering &&
-           tp->sacked_out >= max(tp->packets_out/2, sysctl_tcp_reordering) &&
+           tp->sacked_out >= max(u32, tp->packets_out/2, sysctl_tcp_reordering) &&
            !tcp_may_send_now(sk, tp)) {
                /* We have nothing to send. This connection is limited
                 * either by receiver window or by application.
@@ -1194,7 +1194,9 @@ tcp_time_to_recover(struct sock *sk, struct tcp_opt *tp)
  */
 static void tcp_check_reno_reordering(struct tcp_opt *tp, int addend)
 {
-       int holes = min(max(tp->lost_out, 1), tp->packets_out);
+       u32 holes = min(unsigned int,
+                       max(unsigned int, tp->lost_out, 1),
+                       tp->packets_out);
 
        if (tp->sacked_out + holes > tp->packets_out) {
                tp->sacked_out = tp->packets_out - holes;
@@ -1289,7 +1291,7 @@ static void tcp_update_scoreboard(struct sock *sk, struct tcp_opt *tp)
  */
 static __inline__ void tcp_moderate_cwnd(struct tcp_opt *tp)
 {
-       tp->snd_cwnd = min(tp->snd_cwnd,
+       tp->snd_cwnd = min(u32, tp->snd_cwnd,
                           tcp_packets_in_flight(tp)+tcp_max_burst(tp));
        tp->snd_cwnd_stamp = tcp_time_stamp;
 }
@@ -1306,7 +1308,7 @@ static void tcp_cwnd_down(struct tcp_opt *tp)
        if (decr && tp->snd_cwnd > tp->snd_ssthresh/2)
                tp->snd_cwnd -= decr;
 
-       tp->snd_cwnd = min(tp->snd_cwnd, tcp_packets_in_flight(tp)+1);
+       tp->snd_cwnd = min(u32, tp->snd_cwnd, tcp_packets_in_flight(tp)+1);
        tp->snd_cwnd_stamp = tcp_time_stamp;
 }
 
@@ -1338,13 +1340,15 @@ static void DBGUNDO(struct sock *sk, struct tcp_opt *tp, const char *msg)
 static void tcp_undo_cwr(struct tcp_opt *tp, int undo)
 {
        if (tp->prior_ssthresh) {
-               tp->snd_cwnd = max(tp->snd_cwnd, tp->snd_ssthresh<<1);
+               tp->snd_cwnd = max(unsigned int,
+                                  tp->snd_cwnd, tp->snd_ssthresh<<1);
+
                if (undo && tp->prior_ssthresh > tp->snd_ssthresh) {
                        tp->snd_ssthresh = tp->prior_ssthresh;
                        TCP_ECN_withdraw_cwr(tp);
                }
        } else {
-               tp->snd_cwnd = max(tp->snd_cwnd, tp->snd_ssthresh);
+               tp->snd_cwnd = max(unsigned int, tp->snd_cwnd, tp->snd_ssthresh);
        }
        tcp_moderate_cwnd(tp);
        tp->snd_cwnd_stamp = tcp_time_stamp;
@@ -1446,7 +1450,7 @@ static int tcp_try_undo_loss(struct sock *sk, struct tcp_opt *tp)
 
 static __inline__ void tcp_complete_cwr(struct tcp_opt *tp)
 {
-       tp->snd_cwnd = min(tp->snd_cwnd, tp->snd_ssthresh);
+       tp->snd_cwnd = min(u32, tp->snd_cwnd, tp->snd_ssthresh);
        tp->snd_cwnd_stamp = tcp_time_stamp;
 }
 
@@ -1832,7 +1836,7 @@ static void tcp_ack_probe(struct sock *sk)
                 */
        } else {
                tcp_reset_xmit_timer(sk, TCP_TIME_PROBE0,
-                                    min(tp->rto << tp->backoff, TCP_RTO_MAX));
+                                    min(u32, tp->rto << tp->backoff, TCP_RTO_MAX));
        }
 }
 
@@ -2319,7 +2323,7 @@ static __inline__ void tcp_dsack_set(struct tcp_opt *tp, u32 seq, u32 end_seq)
                tp->dsack = 1;
                tp->duplicate_sack[0].start_seq = seq;
                tp->duplicate_sack[0].end_seq = end_seq;
-               tp->eff_sacks = min(tp->num_sacks+1, 4-tp->tstamp_ok);
+               tp->eff_sacks = min(unsigned int, tp->num_sacks+1, 4-tp->tstamp_ok);
        }
 }
 
@@ -2372,7 +2376,7 @@ static void tcp_sack_maybe_coalesce(struct tcp_opt *tp)
                         * Decrease num_sacks.
                         */
                        tp->num_sacks--;
-                       tp->eff_sacks = min(tp->num_sacks+tp->dsack, 4-tp->tstamp_ok);
+                       tp->eff_sacks = min(unsigned int, tp->num_sacks+tp->dsack, 4-tp->tstamp_ok);
                        for(i=this_sack; i < tp->num_sacks; i++)
                                sp[i] = sp[i+1];
                        continue;
@@ -2434,7 +2438,7 @@ new_sack:
        sp->start_seq = seq;
        sp->end_seq = end_seq;
        tp->num_sacks++;
-       tp->eff_sacks = min(tp->num_sacks+tp->dsack, 4-tp->tstamp_ok);
+       tp->eff_sacks = min(unsigned int, tp->num_sacks+tp->dsack, 4-tp->tstamp_ok);
 }
 
 /* RCV.NXT advances, some SACKs should be eaten. */
@@ -2471,7 +2475,7 @@ static void tcp_sack_remove(struct tcp_opt *tp)
        }
        if (num_sacks != tp->num_sacks) {
                tp->num_sacks = num_sacks;
-               tp->eff_sacks = min(tp->num_sacks+tp->dsack, 4-tp->tstamp_ok);
+               tp->eff_sacks = min(unsigned int, tp->num_sacks+tp->dsack, 4-tp->tstamp_ok);
        }
 }
 
@@ -2537,7 +2541,7 @@ static void tcp_data_queue(struct sock *sk, struct sk_buff *skb)
 
        if (tp->dsack) {
                tp->dsack = 0;
-               tp->eff_sacks = min(tp->num_sacks, 4-tp->tstamp_ok);
+               tp->eff_sacks = min(unsigned int, tp->num_sacks, 4-tp->tstamp_ok);
        }
 
        /*  Queue data for delivery to the user.
@@ -2554,7 +2558,7 @@ static void tcp_data_queue(struct sock *sk, struct sk_buff *skb)
                    tp->ucopy.len &&
                    sk->lock.users &&
                    !tp->urg_data) {
-                       int chunk = min(skb->len, tp->ucopy.len);
+                       int chunk = min(unsigned int, skb->len, tp->ucopy.len);
 
                        __set_current_state(TASK_RUNNING);
 
@@ -2803,7 +2807,7 @@ tcp_collapse(struct sock *sk, struct sk_buff *head,
 
                        if (offset < 0) BUG();
                        if (size > 0) {
-                               size = min(copy, size);
+                               size = min(int, copy, size);
                                if (skb_copy_bits(skb, offset, skb_put(nskb, size), size))
                                        BUG();
                                TCP_SKB_CB(nskb)->end_seq += size;
@@ -2882,7 +2886,7 @@ static int tcp_prune_queue(struct sock *sk)
        if (atomic_read(&sk->rmem_alloc) >= sk->rcvbuf)
                tcp_clamp_window(sk, tp);
        else if (tcp_memory_pressure)
-               tp->rcv_ssthresh = min(tp->rcv_ssthresh, 4*tp->advmss);
+               tp->rcv_ssthresh = min(u32, tp->rcv_ssthresh, 4*tp->advmss);
 
        tcp_collapse_ofo_queue(sk);
        tcp_collapse(sk, sk->receive_queue.next,
@@ -2937,7 +2941,7 @@ void tcp_cwnd_application_limited(struct sock *sk)
        if (tp->ca_state == TCP_CA_Open &&
            sk->socket && !test_bit(SOCK_NOSPACE, &sk->socket->flags)) {
                /* Limited by application or receiver window. */
-               u32 win_used = max(tp->snd_cwnd_used, 2);
+               u32 win_used = max(u32, tp->snd_cwnd_used, 2);
                if (win_used < tp->snd_cwnd) {
                        tp->snd_ssthresh = tcp_current_ssthresh(tp);
                        tp->snd_cwnd = (tp->snd_cwnd+win_used)>>1;
@@ -2963,10 +2967,10 @@ static void tcp_new_space(struct sock *sk)
                int sndmem, demanded;
 
                sndmem = tp->mss_clamp+MAX_TCP_HEADER+16+sizeof(struct sk_buff);
-               demanded = max(tp->snd_cwnd, tp->reordering+1);
+               demanded = max(unsigned int, tp->snd_cwnd, tp->reordering+1);
                sndmem *= 2*demanded;
                if (sndmem > sk->sndbuf)
-                       sk->sndbuf = min(sndmem, sysctl_tcp_wmem[2]);
+                       sk->sndbuf = min(int, sndmem, sysctl_tcp_wmem[2]);
                tp->snd_cwnd_stamp = tcp_time_stamp;
        }
 
@@ -3516,7 +3520,7 @@ static int tcp_rcv_synsent_state_process(struct sock *sk, struct sk_buff *skb,
 
                if (tp->wscale_ok == 0) {
                        tp->snd_wscale = tp->rcv_wscale = 0;
-                       tp->window_clamp = min(tp->window_clamp,65535);
+                       tp->window_clamp = min(u32, tp->window_clamp, 65535);
                }
 
                if (tp->saw_tstamp) {
index 97fb6c8ca97bf391bfcbb4ca92dadcc0523e74b0..701834143a98885903ff20f842af44aec4a34cf9 100644 (file)
@@ -5,7 +5,7 @@
  *
  *             Implementation of the Transmission Control Protocol(TCP).
  *
- * Version:    $Id: tcp_minisocks.c,v 1.11 2001/08/03 14:27:25 davem Exp $
+ * Version:    $Id: tcp_minisocks.c,v 1.12 2001/08/13 18:56:13 davem Exp $
  *
  * Authors:    Ross Biro, <bir7@leland.Stanford.Edu>
  *             Fred N. van Kempen, <waltje@uWalt.NL.Mugnet.ORG>
@@ -766,7 +766,7 @@ struct sock *tcp_create_openreq_child(struct sock *sk, struct open_request *req,
                        newtp->rcv_wscale = req->rcv_wscale;
                } else {
                        newtp->snd_wscale = newtp->rcv_wscale = 0;
-                       newtp->window_clamp = min(newtp->window_clamp,65535);
+                       newtp->window_clamp = min(u32, newtp->window_clamp, 65535);
                }
                newtp->snd_wnd = ntohs(skb->h.th->window) << newtp->snd_wscale;
                newtp->max_window = newtp->snd_wnd;
index 91e4a7b848b2718ac17f2823471ae4218c0125e9..f4ec7c94a4005557d51607828720040af7b80a15 100644 (file)
@@ -5,7 +5,7 @@
  *
  *             Implementation of the Transmission Control Protocol(TCP).
  *
- * Version:    $Id: tcp_output.c,v 1.137 2001/06/29 21:11:28 davem Exp $
+ * Version:    $Id: tcp_output.c,v 1.140 2001/08/13 18:56:12 davem Exp $
  *
  * Authors:    Ross Biro, <bir7@leland.Stanford.Edu>
  *             Fred N. van Kempen, <waltje@uWalt.NL.Mugnet.ORG>
@@ -105,11 +105,11 @@ static void tcp_cwnd_restart(struct tcp_opt *tp)
        u32 cwnd = tp->snd_cwnd;
 
        tp->snd_ssthresh = tcp_current_ssthresh(tp);
-       restart_cwnd = min(restart_cwnd, cwnd);
+       restart_cwnd = min(u32, restart_cwnd, cwnd);
 
        while ((delta -= tp->rto) > 0 && cwnd > restart_cwnd)
                cwnd >>= 1;
-       tp->snd_cwnd = max(cwnd, restart_cwnd);
+       tp->snd_cwnd = max(u32, cwnd, restart_cwnd);
        tp->snd_cwnd_stamp = tcp_time_stamp;
        tp->snd_cwnd_used = 0;
 }
@@ -526,7 +526,7 @@ int tcp_sync_mss(struct sock *sk, u32 pmtu)
 
        /* Bound mss with half of window */
        if (tp->max_window && mss_now > (tp->max_window>>1))
-               mss_now = max((tp->max_window>>1), 68 - tp->tcp_header_len);
+               mss_now = max(u32, (tp->max_window>>1), 68 - tp->tcp_header_len);
 
        /* And store cached results */
        tp->pmtu_cookie = pmtu;
@@ -651,7 +651,7 @@ u32 __tcp_select_window(struct sock *sk)
         */
        int mss = tp->ack.rcv_mss;
        int free_space = tcp_space(sk);
-       int full_space = min(tp->window_clamp, tcp_full_space(sk));
+       int full_space = min(unsigned int, tp->window_clamp, tcp_full_space(sk));
        int window;
 
        if (mss > full_space)
@@ -661,7 +661,7 @@ u32 __tcp_select_window(struct sock *sk)
                tp->ack.quick = 0;
 
                if (tcp_memory_pressure)
-                       tp->rcv_ssthresh = min(tp->rcv_ssthresh, 4*tp->advmss);
+                       tp->rcv_ssthresh = min(u32, tp->rcv_ssthresh, 4*tp->advmss);
 
                if (free_space < mss)
                        return 0;
@@ -817,7 +817,7 @@ int tcp_retransmit_skb(struct sock *sk, struct sk_buff *skb)
        /* Do not sent more than we queued. 1/4 is reserved for possible
         * copying overhead: frgagmentation, tunneling, mangling etc.
         */
-       if (atomic_read(&sk->wmem_alloc) > min(sk->wmem_queued+(sk->wmem_queued>>2),sk->sndbuf))
+       if (atomic_read(&sk->wmem_alloc) > min(int, sk->wmem_queued+(sk->wmem_queued>>2),sk->sndbuf))
                return -EAGAIN;
 
        /* If receiver has shrunk his window, and skb is out of
@@ -1264,13 +1264,13 @@ void tcp_send_delayed_ack(struct sock *sk)
                 * directly.
                 */
                if (tp->srtt) {
-                       int rtt = max(tp->srtt>>3, TCP_DELACK_MIN);
+                       int rtt = max(unsigned int, tp->srtt>>3, TCP_DELACK_MIN);
 
                        if (rtt < max_ato)
                                max_ato = rtt;
                }
 
-               ato = min(ato, max_ato);
+               ato = min(int, ato, max_ato);
        }
 
        /* Stay within the limit we were given */
@@ -1386,7 +1386,7 @@ int tcp_write_wakeup(struct sock *sk)
                         */
                        if (seg_size < TCP_SKB_CB(skb)->end_seq - TCP_SKB_CB(skb)->seq ||
                            skb->len > mss) {
-                               seg_size = min(seg_size, mss);
+                               seg_size = min(int, seg_size, mss);
                                TCP_SKB_CB(skb)->flags |= TCPCB_FLAG_PSH;
                                if (tcp_fragment(sk, skb, seg_size))
                                        return -1;
@@ -1429,7 +1429,7 @@ void tcp_send_probe0(struct sock *sk)
                tp->backoff++;
                tp->probes_out++;
                tcp_reset_xmit_timer (sk, TCP_TIME_PROBE0, 
-                                     min(tp->rto << tp->backoff, TCP_RTO_MAX));
+                                     min(u32, tp->rto << tp->backoff, TCP_RTO_MAX));
        } else {
                /* If packet was not sent due to local congestion,
                 * do not backoff and do not remember probes_out.
@@ -1440,6 +1440,6 @@ void tcp_send_probe0(struct sock *sk)
                if (!tp->probes_out)
                        tp->probes_out=1;
                tcp_reset_xmit_timer (sk, TCP_TIME_PROBE0, 
-                                     min(tp->rto << tp->backoff, TCP_RESOURCE_PROBE_INTERVAL));
+                                     min(unsigned int, tp->rto << tp->backoff, TCP_RESOURCE_PROBE_INTERVAL));
        }
 }
index 1ee26fde4cb1f264eb943bd1f2bf5da0386a4bb7..421bfef2e4273d720a793313c805a4a94f881522 100644 (file)
@@ -5,7 +5,7 @@
  *
  *             Implementation of the Transmission Control Protocol(TCP).
  *
- * Version:    $Id: tcp_timer.c,v 1.83 2001/03/07 22:00:57 davem Exp $
+ * Version:    $Id: tcp_timer.c,v 1.85 2001/08/13 18:56:12 davem Exp $
  *
  * Authors:    Ross Biro, <bir7@leland.Stanford.Edu>
  *             Fred N. van Kempen, <waltje@uWalt.NL.Mugnet.ORG>
@@ -248,7 +248,7 @@ static void tcp_delack_timer(unsigned long data)
        if (tcp_ack_scheduled(tp)) {
                if (!tp->ack.pingpong) {
                        /* Delayed ACK missed: inflate ATO. */
-                       tp->ack.ato = min(tp->ack.ato<<1, tp->rto);
+                       tp->ack.ato = min(u32, tp->ack.ato << 1, tp->rto);
                } else {
                        /* Delayed ACK missed: leave pingpong mode and
                         * deflate ATO.
@@ -381,7 +381,7 @@ static void tcp_retransmit_timer(struct sock *sk)
                if (!tp->retransmits)
                        tp->retransmits=1;
                tcp_reset_xmit_timer(sk, TCP_TIME_RETRANS,
-                                    min(tp->rto, TCP_RESOURCE_PROBE_INTERVAL));
+                                    min(u32, tp->rto, TCP_RESOURCE_PROBE_INTERVAL));
                goto out;
        }
 
@@ -404,7 +404,7 @@ static void tcp_retransmit_timer(struct sock *sk)
        tp->retransmits++;
 
 out_reset_timer:
-       tp->rto = min(tp->rto << 1, TCP_RTO_MAX);
+       tp->rto = min(u32, tp->rto << 1, TCP_RTO_MAX);
        tcp_reset_xmit_timer(sk, TCP_TIME_RETRANS, tp->rto);
        if (tp->retransmits > sysctl_tcp_retries1)
                __sk_dst_reset(sk);
@@ -517,7 +517,8 @@ static void tcp_synack_timer(struct sock *sk)
 
                                        if (req->retrans++ == 0)
                                                lopt->qlen_young--;
-                                       timeo = min((TCP_TIMEOUT_INIT << req->retrans),
+                                       timeo = min(unsigned long,
+                                                   (TCP_TIMEOUT_INIT << req->retrans),
                                                    TCP_RTO_MAX);
                                        req->expires = now + timeo;
                                        reqp = &req->dl_next;
index fc1c9f392909a8f1f53d35a3c4f4f35e3562944e..fbc0e6bd77eda79d9e2723756b946d230ff6309d 100644 (file)
@@ -5,7 +5,7 @@
  *     Authors:
  *     Pedro Roque             <roque@di.fc.ul.pt>
  *
- *     $Id: icmp.c,v 1.32 2001/06/10 09:20:07 davem Exp $
+ *     $Id: icmp.c,v 1.35 2001/08/13 18:56:13 davem Exp $
  *
  *     Based on net/ipv4/icmp.c
  *
@@ -365,7 +365,7 @@ void icmpv6_send(struct sk_buff *skb, int type, int code, __u32 info,
        msg.daddr = &hdr->saddr;
 
        len = skb->len - msg.offset + sizeof(struct icmp6hdr);
-       len = min(len, IPV6_MIN_MTU - sizeof(struct ipv6hdr));
+       len = min(unsigned int, len, IPV6_MIN_MTU - sizeof(struct ipv6hdr));
 
        if (len < 0) {
                printk(KERN_DEBUG "icmp: len problem\n");
index 2332f754928abebaff455d0283834467c2a99702..81b5341eeb81fdbf927656cef96148596f4a2068 100644 (file)
@@ -7,7 +7,7 @@
  *
  *     Based on linux/net/ipv4/ip_sockglue.c
  *
- *     $Id: ipv6_sockglue.c,v 1.36 2001/02/26 05:59:07 davem Exp $
+ *     $Id: ipv6_sockglue.c,v 1.39 2001/08/13 18:56:13 davem Exp $
  *
  *     This program is free software; you can redistribute it and/or
  *      modify it under the terms of the GNU General Public License
@@ -535,7 +535,7 @@ int ipv6_getsockopt(struct sock *sk, int level, int optname, char *optval,
                return -EINVAL;
 #endif
        }
-       len=min(sizeof(int),len);
+       len = min(unsigned int, sizeof(int), len);
        if(put_user(len, optlen))
                return -EFAULT;
        if(copy_to_user(optval,&val,len))
index d9970663ae42fb133df3df3f0bd74902dbd44e88..3d243fabd47aef9defb26eeb7a0206f276c5b295 100644 (file)
@@ -5,7 +5,7 @@
  *     Authors:
  *     Pedro Roque             <roque@di.fc.ul.pt>     
  *
- *     $Id: mcast.c,v 1.37 2001/04/25 20:46:34 davem Exp $
+ *     $Id: mcast.c,v 1.38 2001/08/15 07:36:31 davem Exp $
  *
  *     Based on linux/ipv4/igmp.c and linux/ipv4/ip_sockglue.c 
  *
@@ -90,7 +90,6 @@ int ipv6_sock_mc_join(struct sock *sk, int ifindex, struct in6_addr *addr)
 
        mc_lst->next = NULL;
        memcpy(&mc_lst->addr, addr, sizeof(struct in6_addr));
-       mc_lst->ifindex = ifindex;
 
        if (ifindex == 0) {
                struct rt6_info *rt;
@@ -108,6 +107,8 @@ int ipv6_sock_mc_join(struct sock *sk, int ifindex, struct in6_addr *addr)
                return -ENODEV;
        }
 
+       mc_lst->ifindex = dev->ifindex;
+
        /*
         *      now add/increase the group membership on the device
         */
index e4257e9f3b155a8c371b3d12aacc0b84099ffe8c..2812b12b206651c55cc88d6dc70ee574ceac66c6 100644 (file)
@@ -846,7 +846,8 @@ void ndisc_send_redirect(struct sk_buff *skb, struct neighbour *neigh,
                }
        }
 
-       rd_len = min(IPV6_MIN_MTU-sizeof(struct ipv6hdr)-len, skb->len + 8);
+       rd_len = min(unsigned int,
+                    IPV6_MIN_MTU-sizeof(struct ipv6hdr)-len, skb->len + 8);
        rd_len &= ~0x7;
        len += rd_len;
 
index bee18b4e13fc8c253beaa9eab2105bcf09837fc6..cb144410d15edc1df55303545095b12ccf0cdad1 100644 (file)
@@ -7,7 +7,7 @@
  *
  *     Adapted from linux/net/ipv4/raw.c
  *
- *     $Id: raw.c,v 1.46 2001/06/05 11:36:55 davem Exp $
+ *     $Id: raw.c,v 1.49 2001/08/13 18:56:13 davem Exp $
  *
  *     Fixes:
  *     Hideaki YOSHIFUJI       :       sin6_scope_id support
@@ -699,7 +699,7 @@ static int rawv6_getsockopt(struct sock *sk, int level, int optname,
                return -ENOPROTOOPT;
        }
 
-       len=min(sizeof(int),len);
+       len = min(unsigned int, sizeof(int), len);
 
        if (put_user(len, optlen))
                return -EFAULT;
index f6e0e4787bb700ce6bb1663d8e0eea8b205c1261..2448e18f909845eb159590ffbc480cf0d24c9251 100644 (file)
@@ -5,7 +5,7 @@
  *     Authors:
  *     Pedro Roque             <roque@di.fc.ul.pt>     
  *
- *     $Id: route.c,v 1.51 2001/05/03 07:02:47 davem Exp $
+ *     $Id: route.c,v 1.54 2001/08/13 18:56:13 davem Exp $
  *
  *     This program is free software; you can redistribute it and/or
  *      modify it under the terms of the GNU General Public License
@@ -785,7 +785,7 @@ int ip6_route_add(struct in6_rtmsg *rtmsg)
 
 install_route:
        rt->u.dst.pmtu = ipv6_get_mtu(dev);
-       rt->u.dst.advmss = max(rt->u.dst.pmtu - 60, ip6_rt_min_advmss);
+       rt->u.dst.advmss = max(unsigned int, rt->u.dst.pmtu - 60, ip6_rt_min_advmss);
        /* Maximal non-jumbo IPv6 payload is 65535 and corresponding
           MSS is 65535 - tcp_header_size. 65535 is also valid and
           means: "any MSS, rely only on pmtu discovery"
@@ -944,7 +944,7 @@ source_ok:
        nrt->rt6i_nexthop = neigh_clone(neigh);
        /* Reset pmtu, it may be better */
        nrt->u.dst.pmtu = ipv6_get_mtu(neigh->dev);
-       nrt->u.dst.advmss = max(nrt->u.dst.pmtu - 60, ip6_rt_min_advmss);
+       nrt->u.dst.advmss = max(unsigned int, nrt->u.dst.pmtu - 60, ip6_rt_min_advmss);
        if (rt->u.dst.advmss > 65535-20)
                rt->u.dst.advmss = 65535;
        nrt->rt6i_hoplimit = ipv6_get_hoplimit(neigh->dev);
@@ -1199,7 +1199,7 @@ int ip6_rt_addr_add(struct in6_addr *addr, struct net_device *dev)
        rt->u.dst.output = ip6_output;
        rt->rt6i_dev = dev_get_by_name("lo");
        rt->u.dst.pmtu = ipv6_get_mtu(rt->rt6i_dev);
-       rt->u.dst.advmss = max(rt->u.dst.pmtu - 60, ip6_rt_min_advmss);
+       rt->u.dst.advmss = max(unsigned int, rt->u.dst.pmtu - 60, ip6_rt_min_advmss);
        if (rt->u.dst.advmss > 65535-20)
                rt->u.dst.advmss = 65535;
        rt->rt6i_hoplimit = ipv6_get_hoplimit(rt->rt6i_dev);
@@ -1390,7 +1390,7 @@ static int rt6_mtu_change_route(struct rt6_info *rt, void *p_arg)
            rt->u.dst.pmtu > arg->mtu &&
            !(rt->u.dst.mxlock&(1<<RTAX_MTU)))
                rt->u.dst.pmtu = arg->mtu;
-       rt->u.dst.advmss = max(arg->mtu - 60, ip6_rt_min_advmss);
+       rt->u.dst.advmss = max(unsigned int, arg->mtu - 60, ip6_rt_min_advmss);
        if (rt->u.dst.advmss > 65535-20)
                rt->u.dst.advmss = 65535;
        return 0;
index 669cdbb06c3fc16d528331467c90862761b16271..36df373aa1bb41cfd6a5deff102e0de64fa8bfd8 100644 (file)
@@ -1890,7 +1890,7 @@ static int ipx_getsockopt(struct socket *sock, int level, int optname,
        if (get_user(len, optlen))
                goto out;
 
-       len = min(len, sizeof(int));
+       len = min(unsigned int, len, sizeof(int));
        ret = -EINVAL;
        if(len < 0)
                goto out;
index 49d2110d8f854d0afd341c0b37c24329e855ee09..e42a9abf228ba3ee196880c47b906c45a7486365 100644 (file)
@@ -1400,7 +1400,7 @@ static int irda_recvmsg_stream(struct socket *sock, struct msghdr *msg,
                        continue;
                }
 
-               chunk = min(skb->len, size);
+               chunk = min(unsigned int, skb->len, size);
                if (memcpy_toiovec(msg->msg_iov, skb->data, chunk)) {
                        skb_queue_head(&sk->receive_queue, skb);
                        if (copied == 0)
index 5726dca3297ed32f48e5ab04e12c377d68843d8e..b0f58dca0006df837ea66337c6ed5287e7f03cf8 100644 (file)
@@ -105,8 +105,8 @@ int DataSending(const int CPUNR)
                
                Space = sock_wspace(CurrentRequest->sock->sk);
                
-               ReadSize = min(4*4096,CurrentRequest->FileLength - CurrentRequest->BytesSent);
-               ReadSize = min(ReadSize , Space );
+               ReadSize = min(int, 4 * 4096, CurrentRequest->FileLength - CurrentRequest->BytesSent);
+               ReadSize = min(int, ReadSize, Space);
 
                if (ReadSize>0)
                {                       
index 78e891d8e7f2a97717341471adc9e983cea563e9..c47830886897758740cb2421c525989782624c94 100644 (file)
 
 #define CONFIG_KHTTPD_NUMCPU 16    /* Maximum number of threads */
 
-/* the TCP/IP stack defines a __BROKEN__ set of min/max functions !! */
-/* So we better define our own.                                      */
-
-/* Broken means: working on unsigned data only, which is not acceptable
-                for kHTTPd and probably a lot of other functions. */
-
-#undef min
-#undef max
-#define min(a,b)  ( (a) < (b) ? (a) : (b) )
-#define max(a,b)  ( (a) > (b) ? (a) : (b) )
-
 #ifdef OOPSTRACE
 #define EnterFunction(x)   printk("Enter: %s, %s line %i\n",x,__FILE__,__LINE__)
 #define LeaveFunction(x)   printk("Leave: %s, %s line %i\n",x,__FILE__,__LINE__)
index a9f2491781e99e2f9accc2441dda1835a9f7f478..6070ef56340607577fe246c811d998847b7bddb2 100644 (file)
@@ -326,9 +326,9 @@ void ParseHeader(char *Buffer,const int length, struct http_request *Head)
                        
                        strncpy(Head->FileName,sysctl_khttpd_docroot,sizeof(Head->FileName));
                        PrefixLen = strlen(sysctl_khttpd_docroot);
-                       Head->FileNameLength = min(255,tmp-Buffer+PrefixLen);           
+                       Head->FileNameLength = min(unsigned int, 255, tmp - Buffer + PrefixLen);                
                        
-                       strncat(Head->FileName,Buffer,min(255-PrefixLen,tmp-Buffer));
+                       strncat(Head->FileName,Buffer,min(unsigned int, 255 - PrefixLen, tmp - Buffer));
                                        
                        Buffer=EOL+1;   
 #ifdef BENCHMARK
@@ -341,7 +341,7 @@ void ParseHeader(char *Buffer,const int length, struct http_request *Head)
                {
                        Buffer+=19;
                        
-                       strncpy(Head->IMS,Buffer,min(127,EOL-Buffer-1));
+                       strncpy(Head->IMS,Buffer,min(unsigned int, 127,EOL-Buffer-1));
                                        
                        Buffer=EOL+1;   
                        continue;
@@ -351,7 +351,7 @@ void ParseHeader(char *Buffer,const int length, struct http_request *Head)
                {
                        Buffer+=12;
                        
-                       strncpy(Head->Agent,Buffer,min(127,EOL-Buffer-1));
+                       strncpy(Head->Agent,Buffer,min(unsigned int, 127,EOL-Buffer-1));
                                        
                        Buffer=EOL+1;   
                        continue;
@@ -362,7 +362,7 @@ void ParseHeader(char *Buffer,const int length, struct http_request *Head)
                {
                        Buffer+=6;
                        
-                       strncpy(Head->Host,Buffer,min(127,EOL-Buffer-1));
+                       strncpy(Head->Host,Buffer,min(unsigned int, 127,EOL-Buffer-1));
                                        
                        Buffer=EOL+1;   
                        continue;
index 2c24f3744c83c476580687316c03d487a0b6eecd..1d49822b7400f2ce7e3329086b4b8ba205166ab6 100644 (file)
@@ -244,7 +244,7 @@ static int DecodeHeader(const int CPUNR, struct http_request *Request)
                Request->Time       = Request->filp->f_dentry->d_inode->i_mtime;
                Request->IMS_Time   = mimeTime_to_UnixTime(Request->IMS);
                sprintf(Request->LengthS,"%i",Request->FileLength);
-               time_Unix2RFC(min(Request->Time,CurrentTime_i),Request->TimeS);
+               time_Unix2RFC(min(unsigned int, Request->Time,CurrentTime_i),Request->TimeS);
                /* The min() is required by rfc1945, section 10.10:
                   It is not allowed to send a filetime in the future */
 
index c6df629dc6e7ca879e7d455306f5159b92806729..2b94267d85ddfe64e16f88e93878fdfac59efb02 100644 (file)
@@ -435,7 +435,7 @@ static int nr_getsockopt(struct socket *sock, int level, int optname,
                        return -ENOPROTOOPT;
        }
 
-       len = min(len, sizeof(int));
+       len = min(unsigned int, len, sizeof(int));
 
        if (put_user(len, optlen))
                return -EFAULT;
index b9220b31a3edaa221b59b902a5e361ee8361447c..dd554124a876501cb1e633cdc83e8ae00e41452e 100644 (file)
@@ -508,7 +508,7 @@ static int rose_getsockopt(struct socket *sock, int level, int optname,
                        return -ENOPROTOOPT;
        }
 
-       len = min(len, sizeof(int));
+       len = min(unsigned int, len, sizeof(int));
 
        if (put_user(len, optlen))
                return -EFAULT;
index 7b5248e74de763e982ebcd8f856d451ab54ebe02..7c8aea21c5c943c42e4c638a616a95eceabe142e 100644 (file)
@@ -227,7 +227,7 @@ tbf_dequeue(struct Qdisc* sch)
                }
 
                if (!netif_queue_stopped(sch->dev)) {
-                       long delay = PSCHED_US2JIFFIE(max(-toks, -ptoks));
+                       long delay = PSCHED_US2JIFFIE(max(long, -toks, -ptoks));
 
                        if (delay == 0)
                                delay = 1;
index 9cda62023cf0f89960da6de29f5d33c00c4509f0..6f079e3bd2d80c3fbefad822e581690d297be816 100644 (file)
@@ -81,42 +81,61 @@ rpcauth_init_credcache(struct rpc_auth *auth)
        auth->au_nextgc = jiffies + (auth->au_expire >> 1);
 }
 
+/*
+ * Destroy an unreferenced credential
+ */
 static inline void
-rpcauth_crdestroy(struct rpc_auth *auth, struct rpc_cred *cred)
+rpcauth_crdestroy(struct rpc_cred *cred)
 {
 #ifdef RPC_DEBUG
        if (cred->cr_magic != RPCAUTH_CRED_MAGIC)
                BUG();
        cred->cr_magic = 0;
+       if (atomic_read(&cred->cr_count) || cred->cr_auth)
+               BUG();
 #endif
-       if (auth->au_ops->crdestroy)
-               auth->au_ops->crdestroy(cred);
-       else
-               rpc_free(cred);
+       cred->cr_ops->crdestroy(cred);
+}
+
+/*
+ * Destroy a list of credentials
+ */
+static inline
+void rpcauth_destroy_credlist(struct rpc_cred *head)
+{
+       struct rpc_cred *cred;
+
+       while ((cred = head) != NULL) {
+               head = cred->cr_next;
+               rpcauth_crdestroy(cred);
+       }
 }
 
 /*
- * Clear the RPC credential cache
+ * Clear the RPC credential cache, and delete those credentials
+ * that are not referenced.
  */
 void
 rpcauth_free_credcache(struct rpc_auth *auth)
 {
-       struct rpc_cred **q, *cred;
-       void            (*destroy)(struct rpc_cred *);
+       struct rpc_cred **q, *cred, *free = NULL;
        int             i;
 
-       if (!(destroy = auth->au_ops->crdestroy))
-               destroy = (void (*)(struct rpc_cred *)) rpc_free;
-
        spin_lock(&rpc_credcache_lock);
        for (i = 0; i < RPC_CREDCACHE_NR; i++) {
                q = &auth->au_credcache[i];
                while ((cred = *q) != NULL) {
                        *q = cred->cr_next;
-                       destroy(cred);
+                       cred->cr_auth = NULL;
+                       if (atomic_read(&cred->cr_count) == 0) {
+                               cred->cr_next = free;
+                               free = cred;
+                       } else
+                               cred->cr_next = NULL;
                }
        }
        spin_unlock(&rpc_credcache_lock);
+       rpcauth_destroy_credlist(free);
 }
 
 /*
@@ -133,9 +152,10 @@ rpcauth_gc_credcache(struct rpc_auth *auth)
        for (i = 0; i < RPC_CREDCACHE_NR; i++) {
                q = &auth->au_credcache[i];
                while ((cred = *q) != NULL) {
-                       if (!cred->cr_count &&
+                       if (!atomic_read(&cred->cr_count) &&
                            time_before(cred->cr_expire, jiffies)) {
                                *q = cred->cr_next;
+                               cred->cr_auth = NULL;
                                cred->cr_next = free;
                                free = cred;
                                continue;
@@ -144,10 +164,7 @@ rpcauth_gc_credcache(struct rpc_auth *auth)
                }
        }
        spin_unlock(&rpc_credcache_lock);
-       while ((cred = free) != NULL) {
-               free = cred->cr_next;
-               rpcauth_crdestroy(auth, cred);
-       }
+       rpcauth_destroy_credlist(free);
        auth->au_nextgc = jiffies + auth->au_expire;
 }
 
@@ -163,8 +180,8 @@ rpcauth_insert_credcache(struct rpc_auth *auth, struct rpc_cred *cred)
        spin_lock(&rpc_credcache_lock);
        cred->cr_next = auth->au_credcache[nr];
        auth->au_credcache[nr] = cred;
-       cred->cr_count++;
-       cred->cr_expire = jiffies + auth->au_expire;
+       cred->cr_auth = auth;
+       get_rpccred(cred);
        spin_unlock(&rpc_credcache_lock);
 }
 
@@ -187,7 +204,7 @@ rpcauth_lookup_credcache(struct rpc_auth *auth, int taskflags)
        q = &auth->au_credcache[nr];
        while ((cred = *q) != NULL) {
                if (!(cred->cr_flags & RPCAUTH_CRED_DEAD) &&
-                   auth->au_ops->crmatch(cred, taskflags)) {
+                   cred->cr_ops->crmatch(cred, taskflags)) {
                        *q = cred->cr_next;
                        break;
                }
@@ -213,23 +230,23 @@ rpcauth_lookup_credcache(struct rpc_auth *auth, int taskflags)
  * Remove cred handle from cache
  */
 static void
-rpcauth_remove_credcache(struct rpc_auth *auth, struct rpc_cred *cred)
+rpcauth_remove_credcache(struct rpc_cred *cred)
 {
+       struct rpc_auth *auth = cred->cr_auth;
        struct rpc_cred **q, *cr;
        int             nr;
 
        nr = (cred->cr_uid & RPC_CREDCACHE_MASK);
-       spin_lock(&rpc_credcache_lock);
        q = &auth->au_credcache[nr];
        while ((cr = *q) != NULL) {
                if (cred == cr) {
                        *q = cred->cr_next;
                        cred->cr_next = NULL;
+                       cred->cr_auth = NULL;
                        break;
                }
                q = &cred->cr_next;
        }
-       spin_unlock(&rpc_credcache_lock);
 }
 
 struct rpc_cred *
@@ -258,7 +275,7 @@ rpcauth_matchcred(struct rpc_auth *auth, struct rpc_cred *cred, int taskflags)
 {
        dprintk("RPC:     matching %s cred %d\n",
                auth->au_ops->au_name, taskflags);
-       return auth->au_ops->crmatch(cred, taskflags);
+       return cred->cr_ops->crmatch(cred, taskflags);
 }
 
 void
@@ -266,26 +283,25 @@ rpcauth_holdcred(struct rpc_task *task)
 {
        dprintk("RPC: %4d holding %s cred %p\n",
                task->tk_pid, task->tk_auth->au_ops->au_name, task->tk_msg.rpc_cred);
-       if (task->tk_msg.rpc_cred) {
-               spin_lock(&rpc_credcache_lock);
-               task->tk_msg.rpc_cred->cr_count++;
-               task->tk_msg.rpc_cred->cr_expire = jiffies + task->tk_auth->au_expire;
-               spin_unlock(&rpc_credcache_lock);
-       }
+       if (task->tk_msg.rpc_cred)
+               get_rpccred(task->tk_msg.rpc_cred);
 }
 
 void
-rpcauth_releasecred(struct rpc_auth *auth, struct rpc_cred *cred)
+put_rpccred(struct rpc_cred *cred)
 {
-       spin_lock(&rpc_credcache_lock);
-       if (cred != NULL && cred->cr_count > 0) {
-               if (!--cred->cr_count && (cred->cr_flags & RPCAUTH_CRED_DEAD)) {
-                       spin_unlock(&rpc_credcache_lock);
-                       rpcauth_remove_credcache(auth, cred);
-                       rpcauth_crdestroy(auth, cred);
-                       return;
-               }
+       if (!atomic_dec_and_lock(&cred->cr_count, &rpc_credcache_lock))
+               return;
+
+       if (cred->cr_auth && cred->cr_flags & RPCAUTH_CRED_DEAD)
+               rpcauth_remove_credcache(cred);
+
+       if (!cred->cr_auth) {
+               spin_unlock(&rpc_credcache_lock);
+               rpcauth_crdestroy(cred);
+               return;
        }
+       cred->cr_expire = jiffies + cred->cr_auth->au_expire;
        spin_unlock(&rpc_credcache_lock);
 }
 
@@ -298,7 +314,7 @@ rpcauth_unbindcred(struct rpc_task *task)
        dprintk("RPC: %4d releasing %s cred %p\n",
                task->tk_pid, auth->au_ops->au_name, cred);
 
-       rpcauth_releasecred(auth, cred);
+       put_rpccred(cred);
        task->tk_msg.rpc_cred = NULL;
 }
 
@@ -306,10 +322,11 @@ u32 *
 rpcauth_marshcred(struct rpc_task *task, u32 *p)
 {
        struct rpc_auth *auth = task->tk_auth;
+       struct rpc_cred *cred = task->tk_msg.rpc_cred;
 
        dprintk("RPC: %4d marshaling %s cred %p\n",
-               task->tk_pid, auth->au_ops->au_name, task->tk_msg.rpc_cred);
-       return auth->au_ops->crmarshal(task, p,
+               task->tk_pid, auth->au_ops->au_name, cred);
+       return cred->cr_ops->crmarshal(task, p,
                                task->tk_flags & RPC_CALL_REALUID);
 }
 
@@ -317,20 +334,22 @@ u32 *
 rpcauth_checkverf(struct rpc_task *task, u32 *p)
 {
        struct rpc_auth *auth = task->tk_auth;
+       struct rpc_cred *cred = task->tk_msg.rpc_cred;
 
        dprintk("RPC: %4d validating %s cred %p\n",
-               task->tk_pid, auth->au_ops->au_name, task->tk_msg.rpc_cred);
-       return auth->au_ops->crvalidate(task, p);
+               task->tk_pid, auth->au_ops->au_name, cred);
+       return cred->cr_ops->crvalidate(task, p);
 }
 
 int
 rpcauth_refreshcred(struct rpc_task *task)
 {
        struct rpc_auth *auth = task->tk_auth;
+       struct rpc_cred *cred = task->tk_msg.rpc_cred;
 
        dprintk("RPC: %4d refreshing %s cred %p\n",
-               task->tk_pid, auth->au_ops->au_name, task->tk_msg.rpc_cred);
-       task->tk_status = auth->au_ops->crrefresh(task);
+               task->tk_pid, auth->au_ops->au_name, cred);
+       task->tk_status = cred->cr_ops->crrefresh(task);
        return task->tk_status;
 }
 
index 0e9fddb2807b5fe473e4e997d28eabeed5c4c620..17e8370a0f150e391134cd054419a1d8d3cac082 100644 (file)
@@ -17,6 +17,8 @@
 # define RPCDBG_FACILITY       RPCDBG_AUTH
 #endif
 
+static struct rpc_credops      null_credops;
+
 static struct rpc_auth *
 nul_create(struct rpc_clnt *clnt)
 {
@@ -52,9 +54,10 @@ nul_create_cred(int flags)
 
        if (!(cred = (struct rpc_cred *) rpc_allocate(flags, sizeof(*cred))))
                return NULL;
-       cred->cr_count = 0;
+       atomic_set(&cred->cr_count, 0);
        cred->cr_flags = RPCAUTH_CRED_UPTODATE;
        cred->cr_uid = current->uid;
+       cred->cr_ops = &null_credops;
 
        return cred;
 }
@@ -124,7 +127,11 @@ struct rpc_authops authnull_ops = {
 #endif
        nul_create,
        nul_destroy,
-       nul_create_cred,
+       nul_create_cred
+};
+
+static
+struct rpc_credops     null_credops = {
        nul_destroy_cred,
        nul_match,
        nul_marshal,
index dae3067b55f202a7e513049edfc4e6df8edb1cb3..cb0804f2ef19a33806862fbb51d6f4cc2a70792c 100644 (file)
@@ -33,6 +33,8 @@ struct unx_cred {
 # define RPCDBG_FACILITY       RPCDBG_AUTH
 #endif
 
+static struct rpc_credops      unix_credops;
+
 static struct rpc_auth *
 unx_create(struct rpc_clnt *clnt)
 {
@@ -71,7 +73,7 @@ unx_create_cred(int flags)
        if (!(cred = (struct unx_cred *) rpc_allocate(flags, sizeof(*cred))))
                return NULL;
 
-       cred->uc_count = 0;
+       atomic_set(&cred->uc_count, 0);
        cred->uc_flags = RPCAUTH_CRED_UPTODATE;
        if (flags & RPC_TASK_ROOTCREDS) {
                cred->uc_uid = cred->uc_fsuid = 0;
@@ -91,6 +93,7 @@ unx_create_cred(int flags)
                if (i < NFS_NGROUPS)
                  cred->uc_gids[i] = NOGROUP;
        }
+       cred->uc_base.cr_ops = &unix_credops;
 
        return (struct rpc_cred *) cred;
 }
@@ -106,7 +109,7 @@ authunix_fake_cred(struct rpc_task *task, uid_t uid, gid_t gid)
        if (!(cred = (struct unx_cred *) rpc_malloc(task, sizeof(*cred))))
                return NULL;
 
-       cred->uc_count = 1;
+       atomic_set(&cred->uc_count, 1);
        cred->uc_flags = RPCAUTH_CRED_DEAD|RPCAUTH_CRED_UPTODATE;
        cred->uc_uid   = uid;
        cred->uc_gid   = gid;
@@ -236,7 +239,11 @@ struct rpc_authops authunix_ops = {
 #endif
        unx_create,
        unx_destroy,
-       unx_create_cred,
+       unx_create_cred
+};
+
+static
+struct rpc_credops     unix_credops = {
        unx_destroy_cred,
        unx_match,
        unx_marshal,
index 1c5fd37406c49f9fea4a78a917eeb948e5673b66..369358b73e20a1b8a033330da8da0cde328bf519 100644 (file)
@@ -65,7 +65,7 @@ EXPORT_SYMBOL(rpcauth_insert_credcache);
 EXPORT_SYMBOL(rpcauth_lookupcred);
 EXPORT_SYMBOL(rpcauth_bindcred);
 EXPORT_SYMBOL(rpcauth_matchcred);
-EXPORT_SYMBOL(rpcauth_releasecred);
+EXPORT_SYMBOL(put_rpccred);
 
 /* RPC server stuff */
 EXPORT_SYMBOL(svc_create);
index 67f430b9dcc392c2412b09dd983e0718b3c661e1..39e9afa70a6099086ff694148fe9e5a4a2cc9cc7 100644 (file)
@@ -84,11 +84,6 @@ spinlock_t xprt_lock = SPIN_LOCK_UNLOCKED;
 # define RPCDBG_FACILITY       RPCDBG_XPRT
 #endif
 
-#ifndef MAX
-# define MAX(a, b)     ((a) > (b)? (a) : (b))
-# define MIN(a, b)     ((a) < (b)? (a) : (b))
-#endif
-
 /*
  * Local functions
  */
@@ -749,7 +744,7 @@ tcp_read_xid(struct rpc_xprt *xprt, int avail)
 
        if (xprt->tcp_copied >= sizeof(xprt->tcp_xid) || !avail)
                goto done;
-       want = MIN(sizeof(xprt->tcp_xid) - xprt->tcp_copied, avail);
+       want = min(unsigned int, sizeof(xprt->tcp_xid) - xprt->tcp_copied, avail);
        do {
                dprintk("RPC:      reading xid (%d bytes)\n", want);
                riov.iov_base = ((u8*) &xprt->tcp_xid) + xprt->tcp_copied;
@@ -776,7 +771,7 @@ tcp_read_request(struct rpc_xprt *xprt, struct rpc_rqst *req, int avail)
 
        if (req->rq_rlen <= xprt->tcp_copied || !avail)
                goto done;
-       want = MIN(req->rq_rlen - xprt->tcp_copied, avail);
+       want = min(unsigned int, req->rq_rlen - xprt->tcp_copied, avail);
        do {
                dprintk("RPC: %4d TCP receiving %d bytes\n",
                        req->rq_task->tk_pid, want);
@@ -810,7 +805,7 @@ tcp_read_discard(struct rpc_xprt *xprt, int avail)
        int             want, result = 0;
 
        while (avail) {
-               want = MIN(avail, sizeof(dummy));
+               want = min(unsigned int, avail, sizeof(dummy));
                riov.iov_base = dummy;
                riov.iov_len  = want;
                dprintk("RPC:      TCP skipping %d bytes\n", want);
@@ -1072,7 +1067,7 @@ udp_write_space(struct sock *sk)
 
 
        /* Wait until we have enough socket memory */
-       if (sock_wspace(sk) < min(sk->sndbuf,XPRT_MIN_WRITE_SPACE))
+       if (sock_wspace(sk) < min(int, sk->sndbuf,XPRT_MIN_WRITE_SPACE))
                return;
 
        if (!xprt_test_and_set_wspace(xprt)) {
index 1147480aa3a5b28c399b7ffd4c43d2d38bfd6bd3..728548457cd1ea642faa6fc87a48b21201ae2cee 100644 (file)
@@ -8,7 +8,7 @@
  *             as published by the Free Software Foundation; either version
  *             2 of the License, or (at your option) any later version.
  *
- * Version:    $Id: af_unix.c,v 1.118 2001/07/18 07:52:37 davem Exp $
+ * Version:    $Id: af_unix.c,v 1.121 2001/08/13 18:56:13 davem Exp $
  *
  * Fixes:
  *             Linus Torvalds  :       Assorted bug cures.
 
 #include <asm/checksum.h>
 
-#define min(a,b)       (((a)<(b))?(a):(b))
-
 int sysctl_unix_max_dgram_qlen = 10;
 
 unix_socket *unix_socket_table[UNIX_HASH_SIZE+1];
@@ -1338,7 +1336,7 @@ static int unix_stream_sendmsg(struct socket *sock, struct msghdr *msg, int len,
                 *      fallback size buffer which is under a page and will
                 *      succeed. [Alan]
                 */
-               size = min(size, skb_tailroom(skb));
+               size = min(int, size, skb_tailroom(skb));
 
                memcpy(UNIXCREDS(skb), &scm->creds, sizeof(struct ucred));
                if (scm->fp)
@@ -1570,7 +1568,7 @@ static int unix_stream_recvmsg(struct socket *sock, struct msghdr *msg, int size
                        sunaddr = NULL;
                }
 
-               chunk = min(skb->len, size);
+               chunk = min(unsigned int, skb->len, size);
                if (memcpy_toiovec(msg->msg_iov, skb->data, chunk)) {
                        skb_queue_head(&sk->receive_queue, skb);
                        if (copied == 0)
index 74fb480baddfa2c2f44a52f8c8c41f1af60efbbd..b58338f52f06fb8c53bf8f2c8bf3f3d1e03bf688 100644 (file)
@@ -138,17 +138,6 @@ static void dbg_kfree(void * v, int line) {
 *****************************************************************************/
 
 
-/*
- *     Defines and Macros 
- */
-
-#ifndef        min
-#define min(a,b) (((a)<(b))?(a):(b))
-#endif
-#ifndef        max
-#define max(a,b) (((a)>(b))?(a):(b))
-#endif
-
 /*
  *     Function Prototypes 
  */
index 9dd10ce27fef153b1990ac394eab347636748a58..92156ea3086a4c1916e96371c94f13667ef7959e 100644 (file)
 
 /****** Defines and Macros **************************************************/
 
-#ifndef        min
-#define min(a,b) (((a)<(b))?(a):(b))
-#endif
-#ifndef        max
-#define max(a,b) (((a)>(b))?(a):(b))
-#endif
-
 #define        PROC_BUFSZ      4000    /* buffer size for printing proc info */
 
 #define PROT_DECODE(prot) ((prot == WANCONFIG_FR) ? " FR" :\
@@ -266,7 +259,7 @@ typedef struct wan_stat_entry
                pos = dent->get_info(page, dent->data, 0, 0);
                offs = file->f_pos;
                if (offs < pos) {
-                       len = min(pos - offs, count);
+                       len = min(unsigned int, pos - offs, count);
                        if (copy_to_user(buf, (page + offs), len)) {
                                kfree(page);
                                return -EFAULT;
@@ -812,7 +805,7 @@ typedef struct wan_stat_entry
                pos = dent->get_info(page, dent->data, 0, 0, 0);
                offs = file->f_pos;
                if (offs < pos) {
-                       len = min(pos - offs, count);
+                       len = min(unsigned int, pos - offs, count);
                        if (copy_to_user(buf, (page + offs), len)) {
                                kfree(page);
                                return -EFAULT;
@@ -848,7 +841,7 @@ typedef struct wan_stat_entry
                pos = dent->get_info(page, dent->data, 0, 0, 0);
                offs = file->f_pos;
                if (offs < pos) {
-                       len = min(pos - offs, count);
+                       len = min(unsigned int, pos - offs, count);
                        memcpy_tofs((void*)buf, (void*)(page + offs), len);
                        file->f_pos += len;
                }
index a4c425392dd20c96a6d46a938c9ed04e2d0f2c2e..95f1037061ec9a3bd3e9cbf0e299f3986937ed15 100644 (file)
@@ -407,7 +407,7 @@ static int x25_getsockopt(struct socket *sock, int level, int optname,
                        return -ENOPROTOOPT;
        }
 
-       len = min(len, sizeof(int));
+       len = min(unsigned int, len, sizeof(int));
 
        if (len < 0)
                return -EINVAL;