2002-06-09 05:43:56

by Linus Torvalds

[permalink] [raw]
Subject: Linux 2.5.21


The bulk of the changes are the s390 merge bits, but there are small
details like fixing some races in the new unplugging code etc, more
driverfs, USB, framebuffer updates etc.

The most noticeable changes (and that people will probably find some
nagging missing things with) are the header file cleanups - expect some
missing headers here and there - and the kernel build changes. Different
dependency stuff etc.

Linus

-----

Summary of changes from v2.5.20 to v2.5.21
============================================

<[email protected]>:
o ipchains_core netlink fix
o ipchains_core GFP_KERNEL fix

<[email protected]>:
o USB SA-1111 patch against usb-2.5 bitkeeper

<[email protected]>:
o fix NULL dereferencing in dcache.c

<[email protected]>:
o must be __KERNEL__ for byteorder/generic.h

<[email protected]>:
o USB pwc webcam patch

<[email protected]>:
o Missing include in mm/bootmem.c

<[email protected]>:
o fix for /proc operation

<[email protected]>:
o 2.5.20 ov511.c compile fixes

<[email protected]>:
o s/390 patches for 2.5.20 (1..4)

<[email protected]>:
o fs/locks.c: Only yield once for flocks
o fs/locks.c: remove MSNFS define
o fs/locks.c: more cleanup

<[email protected]>:
o correct zone_table comment
o duplicate decl in sched_init()
o make memclass() an inline
o remove antiquated comment
o remove macros from page_alloc.c
o static list init page_alloc.c

<[email protected]>:
o bluesmoke merge

Adrian Bunk <[email protected]>:
o UHCI bix for build error under unstable debian

Alexey Kuznetsov <[email protected]>:
o net/sched fixes
o ipv6 raw fixes

Anton Altaparmakov <[email protected]>:
o NTFS: Remove unused source file
o NTFS: The beginning of 2.0.8. - Major updates for handling of case
sensitivity
o NTFS: Fix really dumb logic bug in boot sector recovery
o NTFS: Fix potential 1 byte overflow in
fs/ntfs/unistr.c::ntfs_ucstonls()
o NTFS: 2.0.8 release. Major updates for dcache aliasing issues wrt
short/long file names

Anton Blanchard <[email protected]>:
o Fix for recent swap changes on 64 bit archs

Arnaldo Carvalho de Melo <[email protected]>:
o net/ipv4/af_inet.c
o net/ipv4/devinet.c
o net/ipv4/icmp.c
o net/core/dev.c
o net/ipv4/tcp_ipv4.c
o arch/* drivers/cdrom/* drivers/char/*

Brad Hards <[email protected]>:
o "General options" - begone

Brian Gerst <[email protected]>:
o fs/inode.c list_del_init
o missing GET_CPU_IDX in i386 entry.S

Christoph Hellwig <[email protected]>:
o kbuild: remove CLEAN_DIRS from Makfile
o kbuild: small toplevel makefile tidyup

Dave Jones <[email protected]>:
o large x86 setup cleanup

Dave Kleikamp <[email protected]>:
o JFS: Fix structure alignment problem on 64-bit machines
o JFS: Add hch's copyright
o JFS: remove obsolete declaration

David Brownell <[email protected]>:
o ohci-hcd, fix urb unlink races
o synchronous control/bulk messaging
o uhci-hcd misc
o relocate error checks

David S. Miller <[email protected]>:
o net/core/dev.c: Do not cast pointers to int, use long
o sk->num no longer exists in 2.5, use inet_sk(sk)->num
o net/core/dev.c: Make handle_diverter return 0
o Bonding driver: Merge 2.4.x driver updates into 2.5
o asm-generic.h: Add forward siginfo decl for the sake of
HAVE_ARCH_SIGINFO_T platforms.
o init/main.c: Revert recent GCC requirement change
o Fix generic device layer init sequence
o SunRPC: Fix size_t vs. unsigned int arg descrepancy
o register_netdevice: Fix return value handling on success
o sparc64/kernel/Makefile: Remove bogus binfmt_elf32.o dependency
target
o Sparc64: Propagate exec MM handling changes to sparc32 emulation
layer
o Sparc64: Propagate forget_pte changes to sparc64 ioremap
o Sparc: Adjust to new {clear,copy}_user_page calling convention
o IDE: Print I/O ports more portably
o IDE: Add missing printf format specifier when printing Sparc IRQ.
o IDE: Print 64-bit types more portably

David Woodhouse <[email protected]>:
o Shared zlib include fix for 2.5 and 2.4-ac

Ghozlane Toumi <[email protected]>:
o update to pci_quirks.c

Greg Kroah-Hartman <[email protected]>:
o USB: emi26.c small fix to enable the driver to build properly
o USB: formatting cleanups for some USB drivers from the 2.5.20-dj3
tree
o Added usb-midi driver from NAGANO Daisuke with some porting from me
o USB: split some pci specific pieces out of hcd.c into a separate
file
o USB: usb-midi driver: fixed memory flag, as pointed out by Oliver
Neukum
o USB: hcd cleanups and documentation
o IBM PCI Hotplug driver: polling thread locking cleanup
o PCI Hotplug core: added #include <linux/namei.h> to fix compile
time warning
o IBM PCI Hotplug driver: added __init and __exit to functions that
needed it

James Simmons <[email protected]>:
o Reversed a mistake in cyber200fb.c Finshed porting the 3Dfx driver
over to the new api
o Ported over NeoMagic over to new api
o Fixed a nasty bug in the 3Dfx driver and added the ahrdware
routines for the NeoMagic chipset
o Bug fixes for NeoMagic and 3Dfx driver
o More bug fixes. When will it end?
o Ported over the apollo framebuffer device. Updated the Permedia 2
fbdev driver to the latest code. Small bug fix for the NeoMagic
driver.
o Ported the Maxine framebuffer driver to the new api
o A few small fixes from porting it over to the new api. ALso a few
more drivers from the MIPS platform ported over
o Ported over the TX3912 framebuffer to the new api. Fixed a NODEV
error for the Permedia framebuffer driver and patched fbcmap.c to
prevent another Oops
o Bug fixes for the fbdev layer

Jens Axboe <[email protected]>:
o unplugging fix

Kai Germaschewski <[email protected]>:
o kbuild: Split Makefile into needs / needs not .config
o kbuild: Fix make -s (silent) and add a quiet mode
o kbuild: Fix 'make some/dir/foo.lst'
o kbuild: Fix calling of scripts
o kbuild: Make dependencies at compile time
o kbuild: Use deep directory structure for include/linux/modules
o kbuild: Clean up descending into subdirs
o kbuild: Really stick with verbose output by default
o kbuild: modversions improvements
o kbuild: Build modules by default
o kbuild: Use a standard "update-if-changed"
o kbuild: -DMODULE for assembler source
o kbuild: Additional config targets for testing
o kbuild: Remove 2048 symbol limit from make xconfig
o kbuild
o kbuild: Fix tolower() usage in scripts/fixdep.c
o kbuild: Use -nostdinc with kernel sources
o kbuild: Enforce UTS limit, use LANG=C for date/time
o kbuild: Add rules for compiling programs on the host
o kbuild: Fix extracting of CONFIG_ references
o kbuild: dependency generation fixes
o ISDN: Add missing #include <linux/init.h>
o ISDN: Fix a typo in drivers/isdn/hisax/elsa.c
o ISDN/CAPI: Remove some left-over from the capi_driver removal
o ISDN: Add PPP statistics in bytes
o ISDN: Export all hisax symbols from drivers/isdn/hisax/config.o
o ISDN: hisax/hfc_pci.c: sync with 2.4
o ISDN: Add support for USR PCI TA
o ISDN: Cisco HDLC update
o ISDN: Add support for Eicon Diva 2.02
o ISDN: Add DoV (Data over Voice) support
o ISDN: Add support for Formula-n enter:now, a.k.a. Gerdes Power ISDN
o ISDN: Add in-kernel ISAPnP support to HiSax driven cards
o ISDN: MPPP crash fix
o ISDN: LED support for netjet driver
o ISDN/CAPI: Don't use special slab caches for CAPI objects

Linus Torvalds <[email protected]>:
o Split up "iput()" and make it more readable
o Fix extra parenthesis in the constant-address rwlock case
o ACPI sleep depends on software suspend (at least for now)
o Fall-out from header file cleanups
o "make clean": get rid of temporary directories too
o Kernel version 2.5.21
o Clean up and fix Makefile from x86 CPU split
o Fix x86 CPU merge dangling ends
o Fix sound compile error exposed by header file cleanups

Martin Dalecki <[email protected]>:
o 2.5.20 airo wireless - "I can't get no, compilation..."
o 2.5.20 IDE 83..85

Nicolas Pitre <[email protected]>:
o [ARM PATCH] 1166/1: further cleanup of SA1110 suspend/resume code
(2.5) Same thing as patch #1165/1 but for 2.5.x

Patrick Mochel <[email protected]>:
o device model udpate
o Do manual traversing of drivers' devices list when unbinding the
driver
o PCI driver mgmt
o Change unused_initcall to postcore_initcall for things that must be
initialized early, but not too early (after the core is done)
o s/subsys_initcall/postcore_initcall/ for sys_bys and pci, so they
get initialized early enough for arch and subsys initcalls to use
them
o device model update s/{driver,device}_bind/{driver,device}_attach/
and s/{driver,device}_unbind/{driver,device}_detach/ call bus's
match callback instead of bind callback
o Attempt to better locking in device model core
o Don't reference driver after you set pointer to NULL in
device_detach
o device detach locking, one more time: get driver and reset it in
struct device before calling remove()

Pavel Machek <[email protected]>:
o Re: Fix suspend-to-RAM in 2.5.20

Pavel Machek <[email protected]>:
o Fix suspend-to-RAM in 2.5.20
o Cleanup swsusp in 2.5.20
o 2.5.20 swsusp: stop abusing headers with non-inlined functions

Peter Chubb <[email protected]>:
o bogus casts in ide-cd.c

Petr Vandrovec <[email protected]>:
o matroxfb dies when you try to use secondary head in 2.5.x

Randy Hron <[email protected]>:
o remove space in cache names

Rob Radez <[email protected]>:
o Sparc32 code cleanups from 2.4.x

Robert Love <[email protected]>:
o remove wq_lock_t cruft
o capability.c cleanup
o trivial misc. scheduler cleanups
o maintainers update
o make smp.c preempt-safe
o sys_sysinfo cleanup
o remove suser()
o remove fsuser()
o capability.c thinko
o set_cpus_allowed fix

Russell King <[email protected]>:
o fix 2.5.20 ramdisk
o Allow mpage.c to build

Russell King <[email protected]>:
o [ARM] Makefile and page.h ARM updates for 2.5.20
o [ARM] Clean up map_desc structure
o [ARM] Cast thread_saved_{pc,fp} to unsigned long

Rusty Russell <[email protected]>:
o Spelling
o TAGS creation should go into arch dirs
o Futex update I: Trivial comment removal
o Futex II: Copy-from-user can fail
o Futex update III: don't use put_page
o Futex update IV: use a waitqueue

Simon Evans <[email protected]>:
o fix urb->next removal in konicawc driver
o fix urb->next removal in usbvideo

Stephen Rothwell <[email protected]>:
o fs/locks.c use list_del_init
o fcntl_[sg]etlk() only need the file *
o fs/locks.c: add and use IS_{POSIX, FLOCK, LEASE} macros

Tom Rini <[email protected]>:
o Cleanup i386 <linux/init.h> abuses
o Have core/drivers.c include <linux/gfp.h>
o Move vmalloc wrappers out of include/linux/vmalloc.h
o Remove <linux/mm.h> from <linux/vmalloc.h>
o More work on removing <linux/mm.h> from <linux/vmalloc.h>

Trond Myklebust <[email protected]>:
o Fix Oops due to use of incorrect km_type in RPC socket code
o Reduce number of LOOKUP calls in nfs_lookup_revalidate()
o Catch a few more cases where we need to renew inode->d_time



2002-06-09 07:12:47

by Miles Lane

[permalink] [raw]
Subject: 2.5.21 -- suspend.h:58: parse error before "__nosavedata"

gcc -Wp,-MD,.suspend.o.d -D__KERNEL__ -I/usr/src/linux/include -Wall -Wstrict-prototypes -Wno-trigraphs -O2 -fomit-frame-pointer -fno-strict-aliasing -fno-common -pipe -mpreferred-stack-boundary=2 -march=athlon -nostdinc -iwithprefix include -DKBUILD_BASENAME=suspend -DEXPORT_SYMTAB -c -o suspend.o suspend.c
In file included from suspend.c:40:
/usr/src/linux/include/linux/suspend.h:58: parse error before "__nosavedata"
/usr/src/linux/include/linux/suspend.h:58: warning: type defaults to `int' in declaration of `__nosavedata'
/usr/src/linux/include/linux/suspend.h:58: warning: data definition has no type or storage class
/usr/src/linux/include/linux/suspend.h:59: parse error before "__nosavedata"
/usr/src/linux/include/linux/suspend.h:59: warning: type defaults to `int' in declaration of `__nosavedata'
/usr/src/linux/include/linux/suspend.h:59: warning: data definition has no type or storage class
suspend.c:306:2: warning: #warning This might be broken. We need to somehow wait for data to reach the disk
suspend.c: In function `count_and_copy_data_pages':
suspend.c:533: warning: passing arg 1 of `mmx_copy_page' makes pointer from integer without a cast
suspend.c:533: warning: passing arg 2 of `mmx_copy_page' makes pointer from integer without a cast
suspend.c: In function `resume_try_to_read':
suspend.c:1054: warning: unused variable `blksize'
make[1]: *** [suspend.o] Error 1
make[1]: Leaving directory `/usr/src/linux/kernel'

Gnu C 3.0.4
Gnu make 3.79.1
binutils 2.11.90.0.8
util-linux 2.11f
mount 2.11g
modutils 2.4.14
e2fsprogs 1.26
reiserfsprogs 3.x.0j
pcmcia-cs 3.1.22
PPP 2.4.1
isdn4k-utils 3.1pre1
Linux C Library 2.2.4
Dynamic linker (ldd) 2.2.4
Procps 2.0.7
Net-tools 1.60
Console-tools 0.3.3
Sh-utils 2.0.11
Modules Loaded sr_mod emu10k1 soundcore binfmt_misc ds yenta_socket pcmcia_core autofs 3c59x appletalk ipx ipchains ide-scsi ide-cd cdrom reiserfs nls_iso8859-1 nls_cp437 vfat fat mousedev hid input usb-ohci usbcore ext3 jbd raid0 aic7xxx sd_mod scsi_mod


2002-06-09 08:35:34

by Skip Ford

[permalink] [raw]
Subject: Re: 2.5.21 -- suspend.h:58: parse error before "__nosavedata"

Miles Lane wrote:
> gcc -Wp,-MD,.suspend.o.d -D__KERNEL__ -I/usr/src/linux/include -Wall -Wstrict-prototypes -Wno-trigraphs -O2 -fomit-frame-pointer -fno-strict-aliasing -fno-common -pipe -mpreferred-stack-boundary=2 -march=athlon -nostdinc -iwithprefix include -DKBUILD_BASENAME=suspend -DEXPORT_SYMTAB -c -o suspend.o suspend.c
> In file included from suspend.c:40:
> /usr/src/linux/include/linux/suspend.h:58: parse error before "__nosavedata"
> /usr/src/linux/include/linux/suspend.h:58: warning: type defaults to `int' in declaration of `__nosavedata'
> /usr/src/linux/include/linux/suspend.h:58: warning: data definition has no type or storage class
> /usr/src/linux/include/linux/suspend.h:59: parse error before "__nosavedata"
> /usr/src/linux/include/linux/suspend.h:59: warning: type defaults to `int' in declaration of `__nosavedata'
> /usr/src/linux/include/linux/suspend.h:59: warning: data definition has no type or storage class

Looks like suspend.h needs init.h

--- linux/include/linux/suspend.h~ Sun Jun 9 04:31:05 2002
+++ linux/include/linux/suspend.h Sun Jun 9 04:31:22 2002
@@ -7,6 +7,7 @@
#include <linux/swap.h>
#include <linux/notifier.h>
#include <linux/config.h>
+#include <linux/init.h>

extern unsigned char software_suspend_enabled;

--
Skip

2002-06-09 14:38:03

by Martin Dalecki

[permalink] [raw]
Subject: [PATCH] 2.5.20 locks.h

diff -urN linux-2.5.20/arch/alpha/kernel/smc37c669.c linux/arch/alpha/kernel/smc37c669.c
--- linux-2.5.20/arch/alpha/kernel/smc37c669.c 2002-06-03 03:44:51.000000000 +0200
+++ linux/arch/alpha/kernel/smc37c669.c 2002-06-09 04:58:37.000000000 +0200
@@ -7,6 +7,7 @@
#include <linux/mm.h>
#include <linux/init.h>
#include <linux/delay.h>
+#include <linux/spinlock.h>

#include <asm/hwrpb.h>
#include <asm/io.h>
@@ -1103,66 +1104,7 @@
unsigned int drq
);

-#if 0
-/*
-** External Data Declarations
-*/
-
-extern struct LOCK spl_atomic;
-
-/*
-** External Function Prototype Declarations
-*/
-
-/* From kernel_alpha.mar */
-extern spinlock(
- struct LOCK *spl
-);
-
-extern spinunlock(
- struct LOCK *spl
-);
-
-/* From filesys.c */
-int allocinode(
- char *name,
- int can_create,
- struct INODE **ipp
-);
-
-extern int null_procedure( void );
-
-int smcc669_init( void );
-int smcc669_open( struct FILE *fp, char *info, char *next, char *mode );
-int smcc669_read( struct FILE *fp, int size, int number, unsigned char *buf );
-int smcc669_write( struct FILE *fp, int size, int number, unsigned char *buf );
-int smcc669_close( struct FILE *fp );
-
-struct DDB smc_ddb = {
- "smc", /* how this routine wants to be called */
- smcc669_read, /* read routine */
- smcc669_write, /* write routine */
- smcc669_open, /* open routine */
- smcc669_close, /* close routine */
- null_procedure, /* name expansion routine */
- null_procedure, /* delete routine */
- null_procedure, /* create routine */
- null_procedure, /* setmode */
- null_procedure, /* validation routine */
- 0, /* class specific use */
- 1, /* allows information */
- 0, /* must be stacked */
- 0, /* is a flash update driver */
- 0, /* is a block device */
- 0, /* not seekable */
- 0, /* is an Ethernet device */
- 0, /* is a filesystem driver */
-};
-#endif
-
-#define spinlock(x)
-#define spinunlock(x)
-
+static spinlock_t smc_lock __cacheline_aligned = SPIN_LOCK_UNLOCKED;

/*
**++
@@ -2042,10 +1984,10 @@
** mode. Therefore, a spinlock is placed around the two writes to
** guarantee that they complete uninterrupted.
*/
- spinlock( &spl_atomic );
+ spin_lock(&smc_lock);
wb( &SMC37c669->index_port, SMC37c669_CONFIG_ON_KEY );
wb( &SMC37c669->index_port, SMC37c669_CONFIG_ON_KEY );
- spinunlock( &spl_atomic );
+ spin_unlock(&smc_lock);
}
else {
wb( &SMC37c669->index_port, SMC37c669_CONFIG_OFF_KEY );
diff -urN linux-2.5.20/arch/ppc/kernel/ppc_ksyms.c linux/arch/ppc/kernel/ppc_ksyms.c
--- linux-2.5.20/arch/ppc/kernel/ppc_ksyms.c 2002-06-03 03:44:53.000000000 +0200
+++ linux/arch/ppc/kernel/ppc_ksyms.c 2002-06-09 04:58:37.000000000 +0200
@@ -217,7 +217,7 @@
EXPORT_SYMBOL(__global_sti);
EXPORT_SYMBOL(__global_save_flags);
EXPORT_SYMBOL(__global_restore_flags);
-#ifdef SPINLOCK_DEBUG
+#ifdef CONFIG_DEBUG_SPINLOCK
EXPORT_SYMBOL(_raw_spin_lock);
EXPORT_SYMBOL(_raw_spin_unlock);
EXPORT_SYMBOL(_raw_spin_trylock);
diff -urN linux-2.5.20/arch/ppc/lib/locks.c linux/arch/ppc/lib/locks.c
--- linux-2.5.20/arch/ppc/lib/locks.c 2002-06-03 03:44:44.000000000 +0200
+++ linux/arch/ppc/lib/locks.c 2002-06-09 04:58:37.000000000 +0200
@@ -16,7 +16,7 @@
#include <asm/system.h>
#include <asm/io.h>

-#ifdef SPINLOCK_DEBUG
+#ifdef CONFIG_DEBUG_SPINLOCK

#undef INIT_STUCK
#define INIT_STUCK 200000000 /*0xffffffff*/
diff -urN linux-2.5.20/drivers/scsi/tmscsim.c linux/drivers/scsi/tmscsim.c
--- linux-2.5.20/drivers/scsi/tmscsim.c 2002-06-03 03:44:50.000000000 +0200
+++ linux/drivers/scsi/tmscsim.c 2002-06-09 04:58:38.000000000 +0200
@@ -254,8 +254,6 @@
* undef : traditional save_flags; cli; restore_flags;
*/

-//#define DEBUG_SPINLOCKS 2 /* Set to 0, 1 or 2 in include/linux/spinlock.h */
-
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,1,30)
# include <linux/init.h>
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,3,30)
@@ -293,7 +291,7 @@

# if USE_SPINLOCKS == 3 /* both */

-# if defined (CONFIG_SMP) || DEBUG_SPINLOCKS > 0
+# if defined (CONFIG_SMP)
# define DC390_LOCKA_INIT { spinlock_t __unlocked = SPIN_LOCK_UNLOCKED; pACB->lock = __unlocked; };
# else
# define DC390_LOCKA_INIT
@@ -322,7 +320,7 @@

# if USE_SPINLOCKS == 2 /* adapter specific locks */

-# if defined (CONFIG_SMP) || DEBUG_SPINLOCKS > 0
+# if defined (CONFIG_SMP)
# define DC390_LOCKA_INIT { spinlock_t __unlocked = SPIN_LOCK_UNLOCKED; pACB->lock = __unlocked; };
# else
# define DC390_LOCKA_INIT
diff -urN linux-2.5.20/include/asm-cris/locks.h linux/include/asm-cris/locks.h
--- linux-2.5.20/include/asm-cris/locks.h 2002-06-03 03:44:48.000000000 +0200
+++ linux/include/asm-cris/locks.h 1970-01-01 01:00:00.000000000 +0100
@@ -1,133 +0,0 @@
-/*
- * SMP locks primitives for building ix86 locks
- * (not yet used).
- *
- * Alan Cox, [email protected], 1995
- */
-
-/*
- * This would be much easier but far less clear and easy
- * to borrow for other processors if it was just assembler.
- */
-
-extern __inline__ void prim_spin_lock(struct spinlock *sp)
-{
- int processor=smp_processor_id();
-
- /*
- * Grab the lock bit
- */
-
- while(lock_set_bit(0,&sp->lock))
- {
- /*
- * Failed, but that's cos we own it!
- */
-
- if(sp->cpu==processor)
- {
- sp->users++;
- return 0;
- }
- /*
- * Spin in the cache S state if possible
- */
- while(sp->lock)
- {
- /*
- * Wait for any invalidates to go off
- */
-
- if(smp_invalidate_needed&(1<<processor))
- while(lock_clear_bit(processor,&smp_invalidate_needed))
- local_flush_tlb();
- sp->spins++;
- }
- /*
- * Someone wrote the line, we go 'I' and get
- * the cache entry. Now try to regrab
- */
- }
- sp->users++;sp->cpu=processor;
- return 1;
-}
-
-/*
- * Release a spin lock
- */
-
-extern __inline__ int prim_spin_unlock(struct spinlock *sp)
-{
- /* This is safe. The decrement is still guarded by the lock. A multilock would
- not be safe this way */
- if(!--sp->users)
- {
- lock_clear_bit(0,&sp->lock);sp->cpu= NO_PROC_ID;
- return 1;
- }
- return 0;
-}
-
-
-/*
- * Non blocking lock grab
- */
-
-extern __inline__ int prim_spin_lock_nb(struct spinlock *sp)
-{
- if(lock_set_bit(0,&sp->lock))
- return 0; /* Locked already */
- sp->users++;
- return 1; /* We got the lock */
-}
-
-
-/*
- * These wrap the locking primitives up for usage
- */
-
-extern __inline__ void spinlock(struct spinlock *sp)
-{
- if(sp->priority<current->lock_order)
- panic("lock order violation: %s (%d)\n", sp->name, current->lock_order);
- if(prim_spin_lock(sp))
- {
- /*
- * We got a new lock. Update the priority chain
- */
- sp->oldpri=current->lock_order;
- current->lock_order=sp->priority;
- }
-}
-
-extern __inline__ void spinunlock(struct spinlock *sp)
-{
- if(current->lock_order!=sp->priority)
- panic("lock release order violation %s (%d)\n", sp->name, current->lock_order);
- if(prim_spin_unlock(sp))
- {
- /*
- * Update the debugging lock priority chain. We dumped
- * our last right to the lock.
- */
- current->lock_order=sp->oldpri;
- }
-}
-
-extern __inline__ void spintestlock(struct spinlock *sp)
-{
- /*
- * We do no sanity checks, it's legal to optimistically
- * get a lower lock.
- */
- prim_spin_lock_nb(sp);
-}
-
-extern __inline__ void spintestunlock(struct spinlock *sp)
-{
- /*
- * A testlock doesn't update the lock chain so we
- * must not update it on free
- */
- prim_spin_unlock(sp);
-}
diff -urN linux-2.5.20/include/asm-i386/locks.h linux/include/asm-i386/locks.h
--- linux-2.5.20/include/asm-i386/locks.h 2002-06-03 03:44:51.000000000 +0200
+++ linux/include/asm-i386/locks.h 1970-01-01 01:00:00.000000000 +0100
@@ -1,135 +0,0 @@
-/*
- * SMP locks primitives for building ix86 locks
- * (not yet used).
- *
- * Alan Cox, [email protected], 1995
- */
-
-/*
- * This would be much easier but far less clear and easy
- * to borrow for other processors if it was just assembler.
- */
-
-static __inline__ void prim_spin_lock(struct spinlock *sp)
-{
- int processor=smp_processor_id();
-
- /*
- * Grab the lock bit
- */
-
- while(lock_set_bit(0,&sp->lock))
- {
- /*
- * Failed, but that's cos we own it!
- */
-
- if(sp->cpu==processor)
- {
- sp->users++;
- return 0;
- }
- /*
- * Spin in the cache S state if possible
- */
- while(sp->lock)
- {
- /*
- * Wait for any invalidates to go off
- */
-
- if(smp_invalidate_needed&(1<<processor))
- while(lock_clear_bit(processor,&smp_invalidate_needed))
- local_flush_tlb();
- sp->spins++;
- }
- /*
- * Someone wrote the line, we go 'I' and get
- * the cache entry. Now try to regrab
- */
- }
- sp->users++;sp->cpu=processor;
- return 1;
-}
-
-/*
- * Release a spin lock
- */
-
-static __inline__ int prim_spin_unlock(struct spinlock *sp)
-{
- /* This is safe. The decrement is still guarded by the lock. A multilock would
- not be safe this way */
- if(!--sp->users)
- {
- sp->cpu= NO_PROC_ID;lock_clear_bit(0,&sp->lock);
- return 1;
- }
- return 0;
-}
-
-
-/*
- * Non blocking lock grab
- */
-
-static __inline__ int prim_spin_lock_nb(struct spinlock *sp)
-{
- if(lock_set_bit(0,&sp->lock))
- return 0; /* Locked already */
- sp->users++;
- return 1; /* We got the lock */
-}
-
-
-/*
- * These wrap the locking primitives up for usage
- */
-
-static __inline__ void spinlock(struct spinlock *sp)
-{
- if(sp->priority<current->lock_order)
- panic("lock order violation: %s (%d)\n", sp->name, current->lock_order);
- if(prim_spin_lock(sp))
- {
- /*
- * We got a new lock. Update the priority chain
- */
- sp->oldpri=current->lock_order;
- current->lock_order=sp->priority;
- }
-}
-
-static __inline__ void spinunlock(struct spinlock *sp)
-{
- int pri;
- if(current->lock_order!=sp->priority)
- panic("lock release order violation %s (%d)\n", sp->name, current->lock_order);
- pri=sp->oldpri;
- if(prim_spin_unlock(sp))
- {
- /*
- * Update the debugging lock priority chain. We dumped
- * our last right to the lock.
- */
- current->lock_order=sp->pri;
- }
-}
-
-static __inline__ void spintestlock(struct spinlock *sp)
-{
- /*
- * We do no sanity checks, it's legal to optimistically
- * get a lower lock.
- */
- prim_spin_lock_nb(sp);
-}
-
-static __inline__ void spintestunlock(struct spinlock *sp)
-{
- /*
- * A testlock doesn't update the lock chain so we
- * must not update it on free
- */
- prim_spin_unlock(sp);
-}
diff -urN linux-2.5.20/include/asm-i386/spinlock.h linux/include/asm-i386/spinlock.h
--- linux-2.5.20/include/asm-i386/spinlock.h 2002-06-03 03:44:44.000000000 +0200
+++ linux/include/asm-i386/spinlock.h 2002-06-09 04:58:38.000000000 +0200
@@ -9,30 +9,20 @@
extern int printk(const char * fmt, ...)
__attribute__ ((format (printf, 1, 2)));

-/* It seems that people are forgetting to
- * initialize their spinlocks properly, tsk tsk.
- * Remember to turn this off in 2.4. -ben
- */
-#if defined(CONFIG_DEBUG_SPINLOCK)
-#define SPINLOCK_DEBUG 1
-#else
-#define SPINLOCK_DEBUG 0
-#endif
-
/*
* Your basic SMP spinlocks, allowing only a single CPU anywhere
*/

typedef struct {
volatile unsigned int lock;
-#if SPINLOCK_DEBUG
+#ifdef CONFIG_DEBUG_SPINLOCK
unsigned magic;
#endif
} spinlock_t;

#define SPINLOCK_MAGIC 0xdead4ead

-#if SPINLOCK_DEBUG
+#ifdef CONFIG_DEBUG_SPINLOCK
#define SPINLOCK_MAGIC_INIT , SPINLOCK_MAGIC
#else
#define SPINLOCK_MAGIC_INIT /* */
@@ -79,7 +69,7 @@

static inline void _raw_spin_unlock(spinlock_t *lock)
{
-#if SPINLOCK_DEBUG
+#ifdef CONFIG_DEBUG_SPINLOCK
if (lock->magic != SPINLOCK_MAGIC)
BUG();
if (!spin_is_locked(lock))
@@ -100,7 +90,7 @@
static inline void _raw_spin_unlock(spinlock_t *lock)
{
char oldval = 1;
-#if SPINLOCK_DEBUG
+#ifdef CONFIG_DEBUG_SPINLOCK
if (lock->magic != SPINLOCK_MAGIC)
BUG();
if (!spin_is_locked(lock))
@@ -125,7 +115,7 @@

static inline void _raw_spin_lock(spinlock_t *lock)
{
-#if SPINLOCK_DEBUG
+#ifdef CONFIG_DEBUG_SPINLOCK
__label__ here;
here:
if (lock->magic != SPINLOCK_MAGIC) {
@@ -151,14 +141,14 @@
*/
typedef struct {
volatile unsigned int lock;
-#if SPINLOCK_DEBUG
+#ifdef CONFIG_DEBUG_SPINLOCK
unsigned magic;
#endif
} rwlock_t;

#define RWLOCK_MAGIC 0xdeaf1eed

-#if SPINLOCK_DEBUG
+#ifdef CONFIG_DEBUG_SPINLOCK
#define RWLOCK_MAGIC_INIT , RWLOCK_MAGIC
#else
#define RWLOCK_MAGIC_INIT /* */
@@ -181,7 +171,7 @@

static inline void _raw_read_lock(rwlock_t *rw)
{
-#if SPINLOCK_DEBUG
+#ifdef CONFIG_DEBUG_SPINLOCK
if (rw->magic != RWLOCK_MAGIC)
BUG();
#endif
@@ -190,7 +180,7 @@

static inline void _raw_write_lock(rwlock_t *rw)
{
-#if SPINLOCK_DEBUG
+#ifdef CONFIG_DEBUG_SPINLOCK
if (rw->magic != RWLOCK_MAGIC)
BUG();
#endif
diff -urN linux-2.5.20/include/asm-ppc/spinlock.h linux/include/asm-ppc/spinlock.h
--- linux-2.5.20/include/asm-ppc/spinlock.h 2002-06-03 03:44:47.000000000 +0200
+++ linux/include/asm-ppc/spinlock.h 2002-06-09 04:58:38.000000000 +0200
@@ -7,22 +7,20 @@
#include <asm/system.h>
#include <asm/processor.h>

-#undef SPINLOCK_DEBUG
-
/*
* Simple spin lock operations.
*/

typedef struct {
volatile unsigned long lock;
-#ifdef SPINLOCK_DEBUG
+#ifdef CONFIG_DEBUG_SPINLOCK
volatile unsigned long owner_pc;
volatile unsigned long owner_cpu;
#endif
} spinlock_t;

#ifdef __KERNEL__
-#if SPINLOCK_DEBUG
+#if CONFIG_DEBUG_SPINLOCK
#define SPINLOCK_DEBUG_INIT , 0, 0
#else
#define SPINLOCK_DEBUG_INIT /* */
@@ -34,7 +32,7 @@
#define spin_is_locked(x) ((x)->lock != 0)
#define spin_unlock_wait(x) do { barrier(); } while(spin_is_locked(x))

-#ifndef SPINLOCK_DEBUG
+#ifndef CONFIG_DEBUG_SPINLOCK

static inline void _raw_spin_lock(spinlock_t *lock)
{
@@ -88,12 +86,12 @@
*/
typedef struct {
volatile unsigned long lock;
-#ifdef SPINLOCK_DEBUG
+#ifdef CONFIG_DEBUG_SPINLOCK
volatile unsigned long owner_pc;
#endif
} rwlock_t;

-#if SPINLOCK_DEBUG
+#if CONFIG_DEBUG_SPINLOCK
#define RWLOCK_DEBUG_INIT , 0
#else
#define RWLOCK_DEBUG_INIT /* */
@@ -102,7 +100,7 @@
#define RW_LOCK_UNLOCKED (rwlock_t) { 0 RWLOCK_DEBUG_INIT }
#define rwlock_init(lp) do { *(lp) = RW_LOCK_UNLOCKED; } while(0)

-#ifndef SPINLOCK_DEBUG
+#ifndef CONFIG_DEBUG_SPINLOCK

static __inline__ void _raw_read_lock(rwlock_t *rw)
{
diff -urN linux-2.5.20/include/asm-x86_64/locks.h linux/include/asm-x86_64/locks.h
--- linux-2.5.20/include/asm-x86_64/locks.h 2002-06-03 03:44:40.000000000 +0200
+++ linux/include/asm-x86_64/locks.h 1970-01-01 01:00:00.000000000 +0100
@@ -1,135 +0,0 @@
-/*
- * SMP locks primitives for building ix86 locks
- * (not yet used).
- *
- * Alan Cox, [email protected], 1995
- */
-
-/*
- * This would be much easier but far less clear and easy
- * to borrow for other processors if it was just assembler.
- */
-
-extern __inline__ void prim_spin_lock(struct spinlock *sp)
-{
- int processor=smp_processor_id();
-
- /*
- * Grab the lock bit
- */
-
- while(lock_set_bit(0,&sp->lock))
- {
- /*
- * Failed, but that's cos we own it!
- */
-
- if(sp->cpu==processor)
- {
- sp->users++;
- return 0;
- }
- /*
- * Spin in the cache S state if possible
- */
- while(sp->lock)
- {
- /*
- * Wait for any invalidates to go off
- */
-
- if(smp_invalidate_needed&(1<<processor))
- while(lock_clear_bit(processor,&smp_invalidate_needed))
- local_flush_tlb();
- sp->spins++;
- }
- /*
- * Someone wrote the line, we go 'I' and get
- * the cache entry. Now try to regrab
- */
- }
- sp->users++;sp->cpu=processor;
- return 1;
-}
-
-/*
- * Release a spin lock
- */
-
-extern __inline__ int prim_spin_unlock(struct spinlock *sp)
-{
- /* This is safe. The decrement is still guarded by the lock. A multilock would
- not be safe this way */
- if(!--sp->users)
- {
- sp->cpu= NO_PROC_ID;lock_clear_bit(0,&sp->lock);
- return 1;
- }
- return 0;
-}
-
-
-/*
- * Non blocking lock grab
- */
-
-extern __inline__ int prim_spin_lock_nb(struct spinlock *sp)
-{
- if(lock_set_bit(0,&sp->lock))
- return 0; /* Locked already */
- sp->users++;
- return 1; /* We got the lock */
-}
-
-
-/*
- * These wrap the locking primitives up for usage
- */
-
-extern __inline__ void spinlock(struct spinlock *sp)
-{
- if(sp->priority<current->lock_order)
- panic("lock order violation: %s (%d)\n", sp->name, current->lock_order);
- if(prim_spin_lock(sp))
- {
- /*
- * We got a new lock. Update the priority chain
- */
- sp->oldpri=current->lock_order;
- current->lock_order=sp->priority;
- }
-}
-
-extern __inline__ void spinunlock(struct spinlock *sp)
-{
- int pri;
- if(current->lock_order!=sp->priority)
- panic("lock release order violation %s (%d)\n", sp->name, current->lock_order);
- pri=sp->oldpri;
- if(prim_spin_unlock(sp))
- {
- /*
- * Update the debugging lock priority chain. We dumped
- * our last right to the lock.
- */
- current->lock_order=sp->pri;
- }
-}
-
-extern __inline__ void spintestlock(struct spinlock *sp)
-{
- /*
- * We do no sanity checks, it's legal to optimistically
- * get a lower lock.
- */
- prim_spin_lock_nb(sp);
-}
-
-extern __inline__ void spintestunlock(struct spinlock *sp)
-{
- /*
- * A testlock doesn't update the lock chain so we
- * must not update it on free
- */
- prim_spin_unlock(sp);
-}
diff -urN linux-2.5.20/include/asm-x86_64/spinlock.h linux/include/asm-x86_64/spinlock.h
--- linux-2.5.20/include/asm-x86_64/spinlock.h 2002-06-03 03:44:53.000000000 +0200
+++ linux/include/asm-x86_64/spinlock.h 2002-06-09 04:58:38.000000000 +0200
@@ -9,30 +9,20 @@
extern int printk(const char * fmt, ...)
__attribute__ ((format (printf, 1, 2)));

-/* It seems that people are forgetting to
- * initialize their spinlocks properly, tsk tsk.
- * Remember to turn this off in 2.4. -ben
- */
-#if defined(CONFIG_DEBUG_SPINLOCK)
-#define SPINLOCK_DEBUG 1
-#else
-#define SPINLOCK_DEBUG 0
-#endif
-
/*
* Your basic SMP spinlocks, allowing only a single CPU anywhere
*/

typedef struct {
volatile unsigned int lock;
-#if SPINLOCK_DEBUG
+#ifdef CONFIG_DEBUG_SPINLOCK
unsigned magic;
#endif
} spinlock_t;

#define SPINLOCK_MAGIC 0xdead4ead

-#if SPINLOCK_DEBUG
+#ifdef CONFIG_DEBUG_SPINLOCK
#define SPINLOCK_MAGIC_INIT , SPINLOCK_MAGIC
#else
#define SPINLOCK_MAGIC_INIT /* */
@@ -82,7 +72,7 @@

static inline void _raw_spin_lock(spinlock_t *lock)
{
-#if SPINLOCK_DEBUG
+#ifdef CONFIG_DEBUG_SPINLOCK
__label__ here;
here:
if (lock->magic != SPINLOCK_MAGIC) {
@@ -97,7 +87,7 @@

static inline void _raw_spin_unlock(spinlock_t *lock)
{
-#if SPINLOCK_DEBUG
+#ifdef CONFIG_DEBUG_SPINLOCK
if (lock->magic != SPINLOCK_MAGIC)
BUG();
if (!spin_is_locked(lock))
@@ -120,14 +110,14 @@
*/
typedef struct {
volatile unsigned int lock;
-#if SPINLOCK_DEBUG
+#ifdef CONFIG_DEBUG_SPINLOCK
unsigned magic;
#endif
} rwlock_t;

#define RWLOCK_MAGIC 0xdeaf1eed

-#if SPINLOCK_DEBUG
+#ifdef CONFIG_DEBUG_SPINLOCK
#define RWLOCK_MAGIC_INIT , RWLOCK_MAGIC
#else
#define RWLOCK_MAGIC_INIT /* */
@@ -150,7 +140,7 @@

extern inline void _raw_read_lock(rwlock_t *rw)
{
-#if SPINLOCK_DEBUG
+#ifdef CONFIG_DEBUG_SPINLOCK
if (rw->magic != RWLOCK_MAGIC)
BUG();
#endif
@@ -159,7 +149,7 @@

static inline void _raw_write_lock(rwlock_t *rw)
{
-#if SPINLOCK_DEBUG
+#ifdef CONFIG_DEBUG_SPINLOCK
if (rw->magic != RWLOCK_MAGIC)
BUG();
#endif
diff -urN linux-2.5.20/include/linux/spinlock.h linux/include/linux/spinlock.h
--- linux-2.5.20/include/linux/spinlock.h 2002-06-03 03:44:49.000000000 +0200
+++ linux/include/linux/spinlock.h 2002-06-09 04:58:38.000000000 +0200
@@ -62,13 +62,9 @@
#elif !defined(spin_lock_init) /* !SMP and spin_lock_init not previously
defined (e.g. by including asm/spinlock.h */

-#define DEBUG_SPINLOCKS 0 /* 0 == no debugging, 1 == maintain lock state, 2 == full debug */
-
-#if (DEBUG_SPINLOCKS < 1)
-
#ifndef CONFIG_PREEMPT
-#define atomic_dec_and_lock(atomic,lock) atomic_dec_and_test(atomic)
-#define ATOMIC_DEC_AND_LOCK
+# define atomic_dec_and_lock(atomic,lock) atomic_dec_and_test(atomic)
+# define ATOMIC_DEC_AND_LOCK
#endif

/*
@@ -78,10 +74,10 @@
*/
#if (__GNUC__ > 2)
typedef struct { } spinlock_t;
- #define SPIN_LOCK_UNLOCKED (spinlock_t) { }
+# define SPIN_LOCK_UNLOCKED (spinlock_t) { }
#else
typedef struct { int gcc_is_buggy; } spinlock_t;
- #define SPIN_LOCK_UNLOCKED (spinlock_t) { 0 }
+# define SPIN_LOCK_UNLOCKED (spinlock_t) { 0 }
#endif

#define spin_lock_init(lock) do { (void)(lock); } while(0)
@@ -91,42 +87,6 @@
#define spin_unlock_wait(lock) do { (void)(lock); } while(0)
#define _raw_spin_unlock(lock) do { (void)(lock); } while(0)

-#elif (DEBUG_SPINLOCKS < 2)
-
-typedef struct {
- volatile unsigned long lock;
-} spinlock_t;
-#define SPIN_LOCK_UNLOCKED (spinlock_t) { 0 }
-
-#define spin_lock_init(x) do { (x)->lock = 0; } while (0)
-#define spin_is_locked(lock) (test_bit(0,(lock)))
-#define spin_trylock(lock) (!test_and_set_bit(0,(lock)))
-
-#define spin_lock(x) do { (x)->lock = 1; } while (0)
-#define spin_unlock_wait(x) do { } while (0)
-#define spin_unlock(x) do { (x)->lock = 0; } while (0)
-
-#else /* (DEBUG_SPINLOCKS >= 2) */
-
-typedef struct {
- volatile unsigned long lock;
- volatile unsigned int babble;
- const char *module;
-} spinlock_t;
-#define SPIN_LOCK_UNLOCKED (spinlock_t) { 0, 25, __BASE_FILE__ }
-
-#include <linux/kernel.h>
-
-#define spin_lock_init(x) do { (x)->lock = 0; } while (0)
-#define spin_is_locked(lock) (test_bit(0,(lock)))
-#define spin_trylock(lock) (!test_and_set_bit(0,(lock)))
-
-#define spin_lock(x) do {unsigned long __spinflags; save_flags(__spinflags); cli(); if ((x)->lock&&(x)->babble) {printk("%s:%d: spin_lock(%s:%p) already locked\n", __BASE_FILE__,__LINE__, (x)->module, (x));(x)->babble--;} (x)->lock = 1; restore_flags(__spinflags);} while (0)
-#define spin_unlock_wait(x) do {unsigned long __spinflags; save_flags(__spinflags); cli(); if ((x)->lock&&(x)->babble) {printk("%s:%d: spin_unlock_wait(%s:%p) deadlock\n", __BASE_FILE__,__LINE__, (x)->module, (x));(x)->babble--;} restore_flags(__spinflags);} while (0)
-#define spin_unlock(x) do {unsigned long __spinflags; save_flags(__spinflags); cli(); if (!(x)->lock&&(x)->babble) {printk("%s:%d: spin_unlock(%s:%p) not locked\n", __BASE_FILE__,__LINE__, (x)->module, (x));(x)->babble--;} (x)->lock = 0; restore_flags(__spinflags);} while (0)
-
-#endif /* DEBUG_SPINLOCKS */
-
/*
* Read-write spinlocks, allowing multiple readers
* but only one writer.


Attachments:
locks-2.5.20.diff (21.94 kB)

2002-06-09 14:35:50

by Martin Dalecki

[permalink] [raw]
Subject: [PATCH] 2.5.20 IDE 86

Most importantly this makes ide-scsi work again, which I broke
IDE 85. And we are starting to be serious about locking issues.
However the locking issues will take some patches until they stabilize.

Wed Jun 5 22:08:15 CEST 2002 ide-clean-86

- Add spin locks in ata_special_intr.

- Add Server Works CSB6 handling by Matt Domsch.

- Atari updates by Geert Uytterhoeven:
* irq_lock is used in more than one file, so make it global and rename it
to ide_irq_lock
* `hwgroup' is dead, use `channel' instead
* ide_irq_lock depends on ATA_ARCH_LOCK, not on m68k or APUS

- Small janitorial tidbits by Angus Sawyer.

- PIIX driver updates by Vojtech Pavlik:

* Removes the CONFIG_BLK_DEV_PIIX_TRY133 option. I've got an official
statement from Intel saying that the controller definitely isn't intended
to operate at this speed and doing so may cause severe trouble.

* Fixes a bug in ata-timing.c, where EIDE timing data was discarded by
accident.

* Fixed a couple bugs in the Artop driver (UDMA clocks, active/recovery
timing), 8-bit timing merging.

* Removes an unused variable from piix.c

- Move locking out from ide_set_handler(). There are places where it incurred
too frequent lock grab and release or where we did miss to lock against
concurrent hardware access.

Generally the locking appears to be too fine grained and inconsistent at many
places. This is the first cut. We will deal with it step by step.

- Make sure message string is initialized even if FANCY_STATUS_DUMPS is
disabled.

- Don't lock directly inside udma_init and implementations of this method.

- Guard against REQ_SPECIAL issued by the SCSI layer on us. Use REQ_PC in
ide-scsi.c instead.


Attachments:
ide-clean-86.diff.gz (14.13 kB)

2002-06-10 12:18:24

by Martin Dalecki

[permalink] [raw]
Subject: [PATCH] 2.5.21 "I can't get no compilation"

diff -urN linux-2.5.21/drivers/media/video/tda9875.c linux/drivers/media/video/tda9875.c
--- linux-2.5.21/drivers/media/video/tda9875.c 2002-06-09 07:29:29.000000000 +0200
+++ linux/drivers/media/video/tda9875.c 2002-06-09 19:24:06.000000000 +0200
@@ -28,6 +28,7 @@
#include <linux/videodev.h>
#include <linux/i2c.h>
#include <linux/i2c-algo-bit.h>
+#include <linux/init.h>

#include "bttv.h"
#include "audiochip.h"
diff -urN linux-2.5.21/drivers/pnp/pnpbios_proc.c linux/drivers/pnp/pnpbios_proc.c
--- linux-2.5.21/drivers/pnp/pnpbios_proc.c 2002-06-09 07:31:26.000000000 +0200
+++ linux/drivers/pnp/pnpbios_proc.c 2002-06-09 17:57:42.000000000 +0200
@@ -28,6 +28,7 @@
#include <linux/types.h>
#include <linux/proc_fs.h>
#include <linux/pnpbios.h>
+#include <linux/init.h>

static struct proc_dir_entry *proc_pnp = NULL;
static struct proc_dir_entry *proc_pnp_boot = NULL;
diff -urN linux-2.5.21/include/linux/vmalloc.h linux/include/linux/vmalloc.h
--- linux-2.5.21/include/linux/vmalloc.h 2002-06-09 07:31:29.000000000 +0200
+++ linux/include/linux/vmalloc.h 2002-06-09 18:44:41.000000000 +0200
@@ -28,7 +28,6 @@
*/

extern void * vmalloc(unsigned long size);
-extern void * vmalloc_dma(unsigned long size);
extern void * vmalloc_32(unsigned long size);

/*
diff -urN linux-2.5.21/kernel/ksyms.c linux/kernel/ksyms.c
--- linux-2.5.21/kernel/ksyms.c 2002-06-09 07:26:33.000000000 +0200
+++ linux/kernel/ksyms.c 2002-06-09 18:43:30.000000000 +0200
@@ -108,6 +108,8 @@
EXPORT_SYMBOL(kfree);
EXPORT_SYMBOL(vfree);
EXPORT_SYMBOL(__vmalloc);
+EXPORT_SYMBOL(vmalloc);
+EXPORT_SYMBOL(vmalloc_32);
EXPORT_SYMBOL(vmalloc_to_page);
EXPORT_SYMBOL(mem_map);
EXPORT_SYMBOL(remap_page_range);


Attachments:
compile-2.5.21-1.diff (1.67 kB)

2002-06-10 12:20:30

by Martin Dalecki

[permalink] [raw]
Subject: [PATCH] 2.5.21 kill warnings 1/19

diff -urN linux-2.5.21/arch/i386/kernel/apm.c linux/arch/i386/kernel/apm.c
--- linux-2.5.21/arch/i386/kernel/apm.c 2002-06-09 07:26:54.000000000 +0200
+++ linux/arch/i386/kernel/apm.c 2002-06-09 20:41:41.000000000 +0200
@@ -848,6 +848,7 @@
case 1: apm_idle_done = 1;
break;
default: /* BIOS refused */
+ ;
}
}
if (original_pm_idle)
diff -urN linux-2.5.21/arch/i386/kernel/smpboot.c linux/arch/i386/kernel/smpboot.c
--- linux-2.5.21/arch/i386/kernel/smpboot.c 2002-06-09 07:29:52.000000000 +0200
+++ linux/arch/i386/kernel/smpboot.c 2002-06-09 20:42:46.000000000 +0200
@@ -189,10 +189,10 @@
/* If we get here, it's not a certified SMP capable AMD system. */
printk (KERN_INFO "WARNING: This combination of AMD processors is not suitable for SMP.\n");
tainted |= TAINT_UNSAFE_SMP;
-
}
-valid_k7:

+valid_k7:
+ ;
}

/*


Attachments:
warn-2.5.21-1.diff (859.00 B)

2002-06-10 12:21:56

by Martin Dalecki

[permalink] [raw]
Subject: [PATCH] 2.5.21 kill warnings 2/19

diff -urN linux-2.5.21/drivers/block/paride/pcd.c linux/drivers/block/paride/pcd.c
--- linux-2.5.21/drivers/block/paride/pcd.c 2002-06-09 07:29:30.000000000 +0200
+++ linux/drivers/block/paride/pcd.c 2002-06-09 19:14:13.000000000 +0200
@@ -329,8 +329,8 @@
}

int pcd_init (void) /* preliminary initialisation */
-
-{ int i, unit;
+{
+ int unit;

if (disable) return -1;

diff -urN linux-2.5.21/drivers/block/paride/pd.c linux/drivers/block/paride/pd.c
--- linux-2.5.21/drivers/block/paride/pd.c 2002-06-09 07:31:18.000000000 +0200
+++ linux/drivers/block/paride/pd.c 2002-06-09 19:13:49.000000000 +0200
@@ -381,9 +381,8 @@
}

int pd_init (void)
-
-{ int i;
- request_queue_t * q;
+{
+ request_queue_t * q;

if (disable) return -1;
if (devfs_register_blkdev(MAJOR_NR,name,&pd_fops)) {


Attachments:
warn-2.5.21-2.diff (820.00 B)

2002-06-10 12:23:27

by Martin Dalecki

[permalink] [raw]
Subject: [PATCH] 2.5.21 kill warnings 3/19

diff -urN linux-2.5.21/drivers/cdrom/optcd.c linux/drivers/cdrom/optcd.c
--- linux-2.5.21/drivers/cdrom/optcd.c 2002-06-09 07:28:11.000000000 +0200
+++ linux/drivers/cdrom/optcd.c 2002-06-09 19:15:18.000000000 +0200
@@ -1507,7 +1507,6 @@

static int cdromreadtochdr(unsigned long arg)
{
- int status;
struct cdrom_tochdr tochdr;

tochdr.cdth_trk0 = disk_info.first;
@@ -1519,7 +1518,6 @@

static int cdromreadtocentry(unsigned long arg)
{
- int status;
struct cdrom_tocentry entry;
struct cdrom_subchnl *tocptr;

@@ -1646,7 +1644,6 @@
#ifdef MULTISESSION
static int cdrommultisession(unsigned long arg)
{
- int status;
struct cdrom_multisession ms;

if (copy_from_user(&ms, (void*) arg, sizeof ms))
diff -urN linux-2.5.21/drivers/cdrom/sonycd535.c linux/drivers/cdrom/sonycd535.c
--- linux-2.5.21/drivers/cdrom/sonycd535.c 2002-06-09 07:28:49.000000000 +0200
+++ linux/drivers/cdrom/sonycd535.c 2002-06-09 19:00:00.000000000 +0200
@@ -1012,7 +1012,6 @@
sony_get_subchnl_info(long arg)
{
struct cdrom_subchnl schi;
- int err;

/* Get attention stuff */
if (check_drive_status() != 0)


Attachments:
warn-2.5.21-3.diff (1.09 kB)

2002-06-10 12:25:43

by Martin Dalecki

[permalink] [raw]
Subject: [PATCH] 2.5.21 kill warnings 4/19

diff -urN linux-2.5.21/drivers/hotplug/pci_hotplug_core.c linux/drivers/hotplug/pci_hotplug_core.c
--- linux-2.5.21/drivers/hotplug/pci_hotplug_core.c 2002-06-09 07:28:23.000000000 +0200
+++ linux/drivers/hotplug/pci_hotplug_core.c 2002-06-09 20:48:07.000000000 +0200
@@ -48,7 +48,7 @@
#define MY_NAME THIS_MODULE->name
#endif

-#define dbg(fmt, arg...) do { if (debug) printk(KERN_DEBUG "%s: "__FUNCTION__": " fmt , MY_NAME , ## arg); } while (0)
+#define dbg(fmt, arg...) do { if (debug) printk(KERN_DEBUG "%s: %s: " fmt, MY_NAME, __FUNCTION__, ## arg); } while (0)
#define err(format, arg...) printk(KERN_ERR "%s: " format , MY_NAME , ## arg)
#define info(format, arg...) printk(KERN_INFO "%s: " format , MY_NAME , ## arg)
#define warn(format, arg...) printk(KERN_WARNING "%s: " format , MY_NAME , ## arg)
diff -urN linux-2.5.21/drivers/hotplug/pci_hotplug_util.c linux/drivers/hotplug/pci_hotplug_util.c
--- linux-2.5.21/drivers/hotplug/pci_hotplug_util.c 2002-06-09 07:30:52.000000000 +0200
+++ linux/drivers/hotplug/pci_hotplug_util.c 2002-06-09 19:20:08.000000000 +0200
@@ -41,7 +41,7 @@
#define MY_NAME THIS_MODULE->name
#endif

-#define dbg(fmt, arg...) do { if (debug) printk(KERN_DEBUG "%s: "__FUNCTION__": " fmt , MY_NAME , ## arg); } while (0)
+#define dbg(fmt, arg...) do { if (debug) printk(KERN_DEBUG "%s: %s: " fmt, MY_NAME, __FUNCTION__, ## arg); } while (0)
#define err(format, arg...) printk(KERN_ERR "%s: " format , MY_NAME , ## arg)
#define info(format, arg...) printk(KERN_INFO "%s: " format , MY_NAME , ## arg)
#define warn(format, arg...) printk(KERN_WARNING "%s: " format , MY_NAME , ## arg)
diff -urN linux-2.5.21/drivers/i2c/i2c-core.c linux/drivers/i2c/i2c-core.c
--- linux-2.5.21/drivers/i2c/i2c-core.c 2002-06-09 07:27:35.000000000 +0200
+++ linux/drivers/i2c/i2c-core.c 2002-06-09 19:21:30.000000000 +0200
@@ -381,10 +381,10 @@
printk("i2c-core.o: while "
"unregistering driver "
"`%s', the client at "
- "address %02x of
- adapter `%s' could not
- be detached; driver
- not unloaded!",
+ "address %02x of "
+ "adapter `%s' could not "
+ "be detached; driver "
+ "not unloaded!",
driver->name,
client->addr,
adap->name);


Attachments:
warn-2.5.21-4.diff (2.29 kB)

2002-06-10 12:28:49

by Anton Altaparmakov

[permalink] [raw]
Subject: Re: [PATCH] 2.5.21 "I can't get no compilation"

At 12:19 10/06/02, Martin Dalecki wrote:
>The subject says it all...
>
>Contrary to other proposed patches I realized that there is
>no such thing as vmalloc_dma.

Perhaps you ought to look in mm/vmalloc.c which contains:

void * vmalloc_dma (unsigned long size)
{
return __vmalloc(size, GFP_KERNEL|GFP_DMA, PAGE_KERNEL);
}

Or are you going to tell me that is a figment of my imagination?

Best regards,

Anton


--
"I've not lost my mind. It's backed up on tape somewhere." - Unknown
--
Anton Altaparmakov <aia21 at cantab.net> (replace at with @)
Linux NTFS Maintainer / IRC: #ntfs on irc.openprojects.net
WWW: http://linux-ntfs.sf.net/ & http://www-stu.christs.cam.ac.uk/~aia21/

2002-06-10 12:27:13

by Martin Dalecki

[permalink] [raw]
Subject: [PATCH] 2.5.21 kill warnings 5/19

diff -urN linux-2.5.21/drivers/usb/media/stv680.c linux/drivers/usb/media/stv680.c
--- linux-2.5.21/drivers/usb/media/stv680.c 2002-06-09 07:27:26.000000000 +0200
+++ linux/drivers/usb/media/stv680.c 2002-06-09 19:30:32.000000000 +0200
@@ -86,7 +86,7 @@
#define PDEBUG(level, fmt, args...) \
do { \
if (debug >= level) \
- info("[" __PRETTY_FUNCTION__ ":%d] " fmt, __LINE__ , ## args); \
+ info("[%s:%d] " fmt, __FUNCTION__, __LINE__ , ## args); \
} while (0)


diff -urN linux-2.5.21/drivers/usb/net/cdc-ether.c linux/drivers/usb/net/cdc-ether.c
--- linux-2.5.21/drivers/usb/net/cdc-ether.c 2002-06-09 07:26:52.000000000 +0200
+++ linux/drivers/usb/net/cdc-ether.c 2002-06-09 19:35:57.000000000 +0200
@@ -129,13 +129,13 @@
usb_rcvbulkpipe(ether_dev->usb, ether_dev->data_ep_in),
ether_dev->rx_buff, ether_dev->wMaxSegmentSize,
read_bulk_callback, ether_dev );
-
- // Give this to the USB subsystem so it can tell us
+
+ // Give this to the USB subsystem so it can tell us
// when more data arrives.
if ( (res = usb_submit_urb(ether_dev->rx_urb, GFP_KERNEL)) ) {
- warn( __FUNCTION__ " failed submint rx_urb %d", res);
+ warn("%s failed submint rx_urb %d", __FUNCTION__, res);
}
-
+
// We are no longer busy, show us the frames!!!
ether_dev->flags &= ~CDC_ETHER_RX_BUSY;
}
@@ -339,7 +339,7 @@

// Turn on the USB and let the packets flow!!!
if ( (res = enable_net_traffic( ether_dev )) ) {
- err( __FUNCTION__ "can't enable_net_traffic() - %d", res );
+ err("%s can't enable_net_traffic() - %d", __FUNCTION__, res );
return -EIO;
}

@@ -353,7 +353,7 @@
if ( (res = usb_submit_urb(ether_dev->rx_urb, GFP_KERNEL)) )
{
// Hmm... Okay...
- warn( __FUNCTION__ " failed rx_urb %d", res );
+ warn("%s failed rx_urb %d", __FUNCTION__, res );
}

// Tell the kernel we are ready to start receiving from it
@@ -411,6 +411,7 @@
}
}

+#if 0
static void CDC_SetEthernetPacketFilter (ether_dev_t *ether_dev)
{
usb_control_msg(ether_dev->usb,
@@ -422,15 +423,15 @@
NULL,
0, /* size */
HZ); /* timeout */
-}
-
+}
+#endif

static void CDCEther_set_multicast( struct net_device *net )
{
ether_dev_t *ether_dev = net->priv;
int i;
__u8 *buff;
-
+

// Tell the kernel to stop sending us frames while we get this
// all set up.
diff -urN linux-2.5.21/drivers/usb/net/cdc-ether.h linux/drivers/usb/net/cdc-ether.h
--- linux-2.5.21/drivers/usb/net/cdc-ether.h 2002-06-09 07:27:42.000000000 +0200
+++ linux/drivers/usb/net/cdc-ether.h 2002-06-09 19:34:50.000000000 +0200
@@ -43,7 +43,7 @@
#define CDC_ETHER_REQ_GET_REGS 0xf0
#define CDC_ETHER_REQ_SET_REGS 0xf1
#define CDC_ETHER_REQ_SET_REG PIPERIDER_REQ_SET_REGS
-#define ALIGN(x) x __attribute__((aligned(L1_CACHE_BYTES)))
+#define L1_ALIGN(x) x __attribute__((aligned(L1_CACHE_BYTES)))

#define MODE_FLAG_PROMISCUOUS (1<<0)
#define MODE_FLAG_ALL_MULTICAST (1<<1)
@@ -84,9 +84,9 @@
__u8 bNumberPowerFilters;
int intr_interval;
struct urb *rx_urb, *tx_urb, *intr_urb;
- unsigned char ALIGN(rx_buff[CDC_ETHER_MAX_MTU]);
- unsigned char ALIGN(tx_buff[CDC_ETHER_MAX_MTU]);
- unsigned char ALIGN(intr_buff[8]);
+ unsigned char L1_ALIGN(rx_buff[CDC_ETHER_MAX_MTU]);
+ unsigned char L1_ALIGN(tx_buff[CDC_ETHER_MAX_MTU]);
+ unsigned char L1_ALIGN(intr_buff[8]);
} ether_dev_t;

#define REQ_HDR_FUNC_DESCR 0x0001


Attachments:
warn-2.5.21-5.diff (3.29 kB)

2002-06-10 12:34:24

by Martin Dalecki

[permalink] [raw]
Subject: [PATCH] 2.5.21 kill warnings 6/19

diff -urN linux-2.5.21/drivers/video/cfbimgblt.c linux/drivers/video/cfbimgblt.c
--- linux-2.5.21/drivers/video/cfbimgblt.c 2002-06-09 07:26:29.000000000 +0200
+++ linux/drivers/video/cfbimgblt.c 2002-06-09 19:39:17.000000000 +0200
@@ -43,12 +43,14 @@

void cfb_imageblit(struct fb_info *p, struct fb_image *image)
{
- int pad, ppw, shift, shift_right, shift_left, x2, y2, n, i, j, k, l = 7;
+ int pad, ppw;
+ int x2, y2, n, i, j, k, l = 7;
unsigned long tmp = ~0 << (BITS_PER_LONG - p->var.bits_per_pixel);
unsigned long fgx, bgx, fgcolor, bgcolor, eorx;
- unsigned long end_index, end_mask;
+ unsigned long end_mask;
unsigned long *dst = NULL;
- u8 *dst1, *src;
+ u8 *dst1;
+ u8 *src;

/*
* We could use hardware clipping but on many cards you get around hardware
@@ -97,8 +99,8 @@
for (j = image->width/ppw; j > 0; j--) {
end_mask = 0;

- for (k = ppw; k > 0; k--) {
- if (test_bit(l, src))
+ for (k = ppw; k > 0; k--) {
+ if (test_bit(l, (unsigned long *) src))
end_mask |= (tmp >> (p->var.bits_per_pixel*(k-1)));
l--;
if (l < 0) { l = 7; src++; }
@@ -110,7 +112,7 @@
if (n) {
end_mask = 0;
for (j = n; j > 0; j--) {
- if (test_bit(l, src))
+ if (test_bit(l, (unsigned long *) src))
end_mask |= (tmp >> (p->var.bits_per_pixel*(j-1)));
l--;
if (l < 0) { l = 7; src++; }
diff -urN linux-2.5.21/fs/smbfs/smb_debug.h linux/fs/smbfs/smb_debug.h
--- linux-2.5.21/fs/smbfs/smb_debug.h 2002-06-09 07:27:26.000000000 +0200
+++ linux/fs/smbfs/smb_debug.h 2002-06-09 19:12:14.000000000 +0200
@@ -7,20 +7,20 @@
(dentry)->d_parent->d_name.name,(dentry)->d_name.name

/*
- * safety checks that should never happen ???
+ * safety checks that should never happen ???
* these are normally enabled.
*/
#ifdef SMBFS_PARANOIA
-#define PARANOIA(x...) printk(KERN_NOTICE __FUNCTION__ ": " x)
+# define PARANOIA(f, a...) printk(KERN_NOTICE "%s: " f, __FUNCTION__, ## a)
#else
-#define PARANOIA(x...) do { ; } while(0)
+# define PARANOIA(f, a...) do { ; } while(0)
#endif

/* lots of debug messages */
#ifdef SMBFS_DEBUG_VERBOSE
-#define VERBOSE(x...) printk(KERN_DEBUG __FUNCTION__ ": " x)
+# define VERBOSE(f, a...) printk(KERN_DEBUG "%s: " f, __FUNCTION__, ## a)
#else
-#define VERBOSE(x...) do { ; } while(0)
+# define VERBOSE(f, a...) do { ; } while(0)
#endif

/*


Attachments:
warn-2.5.21-6.diff (2.32 kB)

2002-06-10 12:36:19

by Martin Dalecki

[permalink] [raw]
Subject: [PATCH] 2.5.21 kill warnings 7/19

diff -urN linux-2.5.21/net/irda/af_irda.c linux/net/irda/af_irda.c
--- linux-2.5.21/net/irda/af_irda.c 2002-06-09 07:28:46.000000000 +0200
+++ linux/net/irda/af_irda.c 2002-06-09 20:46:21.000000000 +0200
@@ -1,5 +1,5 @@
/*********************************************************************
- *
+ *
* Filename: af_irda.c
* Version: 0.9
* Description: IrDA sockets implementation
@@ -9,37 +9,37 @@
* Modified at: Sat Dec 25 21:10:23 1999
* Modified by: Dag Brattli <[email protected]>
* Sources: af_netroom.c, af_ax25.c, af_rose.c, af_x25.c etc.
- *
+ *
* Copyright (c) 1999 Dag Brattli <[email protected]>
* Copyright (c) 1999-2001 Jean Tourrilhes <[email protected]>
* All Rights Reserved.
*
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
* the License, or (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
* MA 02111-1307 USA
*
* Linux-IrDA now supports four different types of IrDA sockets:
*
* o SOCK_STREAM: TinyTP connections with SAR disabled. The
* max SDU size is 0 for conn. of this type
- * o SOCK_SEQPACKET: TinyTP connections with SAR enabled. TTP may
+ * o SOCK_SEQPACKET: TinyTP connections with SAR enabled. TTP may
* fragment the messages, but will preserve
* the message boundaries
- * o SOCK_DGRAM: IRDAPROTO_UNITDATA: TinyTP connections with Unitdata
+ * o SOCK_DGRAM: IRDAPROTO_UNITDATA: TinyTP connections with Unitdata
* (unreliable) transfers
* IRDAPROTO_ULTRA: Connectionless and unreliable data
- *
+ *
********************************************************************/

#include <linux/config.h>
@@ -67,7 +67,7 @@

extern int irda_init(void);
extern void irda_cleanup(void);
-extern int irlap_driver_rcv(struct sk_buff *, struct net_device *,
+extern int irlap_driver_rcv(struct sk_buff *, struct net_device *,
struct packet_type *);

static int irda_create(struct socket *sock, int protocol);
@@ -125,7 +125,7 @@
* Connection has been closed. Check reason to find out why
*
*/
-static void irda_disconnect_indication(void *instance, void *sap,
+static void irda_disconnect_indication(void *instance, void *sap,
LM_REASON reason, struct sk_buff *skb)
{
struct irda_sock *self;
@@ -185,9 +185,9 @@
* Connections has been confirmed by the remote device
*
*/
-static void irda_connect_confirm(void *instance, void *sap,
+static void irda_connect_confirm(void *instance, void *sap,
struct qos_info *qos,
- __u32 max_sdu_size, __u8 max_header_size,
+ __u32 max_sdu_size, __u8 max_header_size,
struct sk_buff *skb)
{
struct irda_sock *self;
@@ -211,14 +211,14 @@
switch (sk->type) {
case SOCK_STREAM:
if (max_sdu_size != 0) {
- ERROR(__FUNCTION__ "(), max_sdu_size must be 0\n");
+ ERROR("%s: max_sdu_size must be 0\n", __FUNCTION__);
return;
}
self->max_data_size = irttp_get_max_seg_size(self->tsap);
break;
case SOCK_SEQPACKET:
if (max_sdu_size == 0) {
- ERROR(__FUNCTION__ "(), max_sdu_size cannot be 0\n");
+ ERROR("%s: max_sdu_size cannot be 0\n", __FUNCTION__);
return;
}
self->max_data_size = max_sdu_size;
@@ -227,7 +227,7 @@
self->max_data_size = irttp_get_max_seg_size(self->tsap);
};

- IRDA_DEBUG(2, __FUNCTION__ "(), max_data_size=%d\n",
+ IRDA_DEBUG(2, __FUNCTION__ "(), max_data_size=%d\n",
self->max_data_size);

memcpy(&self->qos_tx, qos, sizeof(struct qos_info));
@@ -245,14 +245,14 @@
* Incoming connection
*
*/
-static void irda_connect_indication(void *instance, void *sap,
+static void irda_connect_indication(void *instance, void *sap,
struct qos_info *qos, __u32 max_sdu_size,
__u8 max_header_size, struct sk_buff *skb)
{
struct irda_sock *self;
struct sock *sk;

- self = (struct irda_sock *) instance;
+ self = (struct irda_sock *) instance;

IRDA_DEBUG(2, __FUNCTION__ "(%p)\n", self);

@@ -264,20 +264,20 @@
self->max_header_size = max_header_size;

/* IrTTP max SDU size in transmit direction */
- self->max_sdu_size_tx = max_sdu_size;
+ self->max_sdu_size_tx = max_sdu_size;

/* Find out what the largest chunk of data that we can transmit is */
switch (sk->type) {
case SOCK_STREAM:
if (max_sdu_size != 0) {
- ERROR(__FUNCTION__ "(), max_sdu_size must be 0\n");
+ ERROR("%s: max_sdu_size must be 0\n", __FUNCTION__);
return;
}
self->max_data_size = irttp_get_max_seg_size(self->tsap);
break;
case SOCK_SEQPACKET:
if (max_sdu_size == 0) {
- ERROR(__FUNCTION__ "(), max_sdu_size cannot be 0\n");
+ ERROR("%s: max_sdu_size cannot be 0\n", __FUNCTION__);
return;
}
self->max_data_size = max_sdu_size;
@@ -286,11 +286,11 @@
self->max_data_size = irttp_get_max_seg_size(self->tsap);
};

- IRDA_DEBUG(2, __FUNCTION__ "(), max_data_size=%d\n",
+ IRDA_DEBUG(2, __FUNCTION__ "(), max_data_size=%d\n",
self->max_data_size);

memcpy(&self->qos_tx, qos, sizeof(struct qos_info));
-
+
skb_queue_tail(&sk->receive_queue, skb);
sk->state_change(sk);
}
@@ -327,19 +327,19 @@
* Used by TinyTP to tell us if it can accept more data or not
*
*/
-static void irda_flow_indication(void *instance, void *sap, LOCAL_FLOW flow)
+static void irda_flow_indication(void *instance, void *sap, LOCAL_FLOW flow)
{
struct irda_sock *self;
struct sock *sk;

IRDA_DEBUG(2, __FUNCTION__ "()\n");
-
+
self = (struct irda_sock *) instance;
ASSERT(self != NULL, return;);

sk = self->sk;
ASSERT(sk != NULL, return;);
-
+
switch (flow) {
case FLOW_STOP:
IRDA_DEBUG(1, __FUNCTION__ "(), IrTTP wants us to slow down\n");
@@ -347,7 +347,7 @@
break;
case FLOW_START:
self->tx_flow = flow;
- IRDA_DEBUG(1, __FUNCTION__
+ IRDA_DEBUG(1, __FUNCTION__
"(), IrTTP wants us to start again\n");
wake_up_interruptible(sk->sleep);
break;
@@ -367,14 +367,14 @@
* Note : duplicate from above, but we need our own version that
* doesn't touch the dtsap_sel and save the full value structure...
*/
-static void irda_getvalue_confirm(int result, __u16 obj_id,
+static void irda_getvalue_confirm(int result, __u16 obj_id,
struct ias_value *value, void *priv)
{
struct irda_sock *self;
-
+
self = (struct irda_sock *) priv;
if (!self) {
- WARNING(__FUNCTION__ "(), lost myself!\n");
+ WARNING("%s: lost myself!\n", __FUNCTION__);
return;
}

@@ -419,12 +419,12 @@
void *priv)
{
struct irda_sock *self;
-
+
IRDA_DEBUG(2, __FUNCTION__ "()\n");

self = (struct irda_sock *) priv;
if (!self) {
- WARNING(__FUNCTION__ "(), lost myself!\n");
+ WARNING("%s: lost myself!\n", __FUNCTION__);
return;
}

@@ -456,7 +456,7 @@
static void irda_discovery_timeout(u_long priv)
{
struct irda_sock *self;
-
+
IRDA_DEBUG(2, __FUNCTION__ "()\n");

self = (struct irda_sock *) priv;
@@ -482,10 +482,10 @@
notify_t notify;

if (self->tsap) {
- WARNING(__FUNCTION__ "(), busy!\n");
+ WARNING("%s: busy!\n", __FUNCTION__);
return -EBUSY;
}
-
+
/* Initialize callbacks to be used by the IrDA stack */
irda_notify_init(&notify);
notify.connect_confirm = irda_connect_confirm;
@@ -498,7 +498,7 @@
strncpy(notify.name, name, NOTIFY_MAX_NAME);

self->tsap = irttp_open_tsap(tsap_sel, DEFAULT_INITIAL_CREDIT,
- &notify);
+ &notify);
if (self->tsap == NULL) {
IRDA_DEBUG( 0, __FUNCTION__ "(), Unable to allocate TSAP!\n");
return -ENOMEM;
@@ -524,14 +524,14 @@
WARNING(__FUNCTION__ "(), busy!\n");
return -EBUSY;
}
-
+
/* Initialize callbacks to be used by the IrDA stack */
irda_notify_init(&notify);
notify.udata_indication = irda_data_indication;
notify.instance = self;
strncpy(notify.name, "Ultra", NOTIFY_MAX_NAME);

- self->lsap = irlmp_open_lsap(LSAP_CONNLESS, &notify, pid);
+ self->lsap = irlmp_open_lsap(LSAP_CONNLESS, &notify, pid);
if (self->lsap == NULL) {
IRDA_DEBUG( 0, __FUNCTION__ "(), Unable to allocate LSAP!\n");
return -ENOMEM;
@@ -559,7 +559,7 @@
ASSERT(self != NULL, return -1;);

if (self->iriap) {
- WARNING(__FUNCTION__ "(), busy with a previous query\n");
+ WARNING("%s: busy with a previous query\n", __FUNCTION__);
return -EBUSY;
}

@@ -596,10 +596,10 @@
case IAS_INTEGER:
IRDA_DEBUG(4, __FUNCTION__ "() int=%d\n",
self->ias_result->t.integer);
-
+
if (self->ias_result->t.integer != -1)
self->dtsap_sel = self->ias_result->t.integer;
- else
+ else
self->dtsap_sel = 0;
break;
default:
@@ -655,7 +655,7 @@
if (discoveries == NULL)
return -ENETUNREACH; /* No nodes discovered */

- /*
+ /*
* Now, check all discovered devices (if any), and connect
* client only about the services that the client is
* interested in...
@@ -714,7 +714,7 @@
self->saddr = 0x0;
self->dtsap_sel = dtsap_sel;

- IRDA_DEBUG(1, __FUNCTION__
+ IRDA_DEBUG(1, __FUNCTION__
"(), discovered requested service ''%s'' at address %08x\n",
name, self->daddr);

@@ -737,7 +737,7 @@
if (peer) {
if (sk->state != TCP_ESTABLISHED)
return -ENOTCONN;
-
+
saddr.sir_family = AF_IRDA;
saddr.sir_lsap_sel = self->dtsap_sel;
saddr.sir_addr = self->daddr;
@@ -746,7 +746,7 @@
saddr.sir_lsap_sel = self->stsap_sel;
saddr.sir_addr = self->saddr;
}
-
+
IRDA_DEBUG(1, __FUNCTION__ "(), tsap_sel = %#x\n", saddr.sir_lsap_sel);
IRDA_DEBUG(1, __FUNCTION__ "(), addr = %08x\n", saddr.sir_addr);

@@ -776,10 +776,10 @@
if (sk->state != TCP_LISTEN) {
sk->max_ack_backlog = backlog;
sk->state = TCP_LISTEN;
-
+
return 0;
}
-
+
return -EOPNOTSUPP;
}

@@ -808,14 +808,14 @@
if ((sk->type == SOCK_DGRAM) && (sk->protocol == IRDAPROTO_ULTRA)) {
self->pid = addr->sir_lsap_sel;
if (self->pid & 0x80) {
- IRDA_DEBUG(0, __FUNCTION__
+ IRDA_DEBUG(0, __FUNCTION__
"(), extension in PID not supp!\n");
return -EOPNOTSUPP;
}
err = irda_open_lsap(self, self->pid);
if (err < 0)
return err;
-
+
self->max_data_size = ULTRA_MAX_DATA - LMP_PID_HEADER;
self->max_header_size = IRDA_MAX_HEADER + LMP_PID_HEADER;

@@ -830,13 +830,13 @@
err = irda_open_tsap(self, addr->sir_lsap_sel, addr->sir_name);
if (err < 0)
return err;
-
+
/* Register with LM-IAS */
self->ias_obj = irias_new_object(addr->sir_name, jiffies);
- irias_add_integer_attrib(self->ias_obj, "IrDA:TinyTP:LsapSel",
+ irias_add_integer_attrib(self->ias_obj, "IrDA:TinyTP:LsapSel",
self->stsap_sel, IAS_KERNEL_ATTR);
irias_insert_object(self->ias_obj);
-
+
return 0;
}

@@ -872,7 +872,7 @@
(sk->type != SOCK_DGRAM))
return -EOPNOTSUPP;

- if (sk->state != TCP_LISTEN)
+ if (sk->state != TCP_LISTEN)
return -EINVAL;

/*
@@ -921,7 +921,7 @@
return -ERESTARTSYS;
}

- newsk = newsock->sk;
+ newsk = newsock->sk;
newsk->state = TCP_ESTABLISHED;

new = irda_sk(newsk);
@@ -933,7 +933,7 @@
IRDA_DEBUG(0, __FUNCTION__ "(), dup failed!\n");
return -1;
}
-
+
new->stsap_sel = new->tsap->stsap_sel;
new->dtsap_sel = new->tsap->dtsap_sel;
new->saddr = irttp_get_saddr(new->tsap);
@@ -988,7 +988,7 @@
struct sockaddr_irda *addr = (struct sockaddr_irda *) uaddr;
struct irda_sock *self = irda_sk(sk);
int err;
-
+
IRDA_DEBUG(2, __FUNCTION__ "(%p)\n", self);

/* Don't allow connect for Ultra sockets */
@@ -999,16 +999,16 @@
sock->state = SS_CONNECTED;
return 0; /* Connect completed during a ERESTARTSYS event */
}
-
+
if (sk->state == TCP_CLOSE && sock->state == SS_CONNECTING) {
sock->state = SS_UNCONNECTED;
return -ECONNREFUSED;
}
-
+
if (sk->state == TCP_ESTABLISHED)
return -EISCONN; /* No reconnect on a seqpacket socket */
-
- sk->state = TCP_CLOSE;
+
+ sk->state = TCP_CLOSE;
sock->state = SS_UNCONNECTED;

if (addr_len != sizeof(struct sockaddr_irda))
@@ -1019,7 +1019,7 @@
/* Try to find one suitable */
err = irda_discover_daddr_and_lsap_sel(self, addr->sir_name);
if (err) {
- IRDA_DEBUG(0, __FUNCTION__
+ IRDA_DEBUG(0, __FUNCTION__
"(), auto-connect failed!\n");
return err;
}
@@ -1027,7 +1027,7 @@
/* Use the one provided by the user */
self->daddr = addr->sir_addr;
IRDA_DEBUG(1, __FUNCTION__ "(), daddr = %08x\n", self->daddr);
-
+
/* Query remote LM-IAS */
err = irda_find_lsap_sel(self, addr->sir_name);
if (err) {
@@ -1039,14 +1039,14 @@
/* Check if we have opened a local TSAP */
if (!self->tsap)
irda_open_tsap(self, LSAP_ANY, addr->sir_name);
-
+
/* Move to connecting socket, start sending Connect Requests */
sock->state = SS_CONNECTING;
sk->state = TCP_SYN_SENT;

/* Connect to remote device */
- err = irttp_connect_request(self->tsap, self->dtsap_sel,
- self->saddr, self->daddr, NULL,
+ err = irttp_connect_request(self->tsap, self->dtsap_sel,
+ self->saddr, self->daddr, NULL,
self->max_sdu_size_rx, NULL);
if (err) {
IRDA_DEBUG(0, __FUNCTION__ "(), connect failed!\n");
@@ -1064,9 +1064,9 @@
sock->state = SS_UNCONNECTED;
return sock_error(sk); /* Always set at this point */
}
-
+
sock->state = SS_CONNECTED;
-
+
/* At this point, IrLMP has assigned our source address */
self->saddr = irttp_get_saddr(self->tsap);

@@ -1085,7 +1085,7 @@
struct irda_sock *self;

IRDA_DEBUG(2, __FUNCTION__ "()\n");
-
+
/* Check for valid socket type */
switch (sock->type) {
case SOCK_STREAM: /* For TTP connections with SAR disabled */
@@ -1112,7 +1112,7 @@

init_waitqueue_head(&self->query_wait);

- /* Initialise networking socket struct */
+ /* Initialise networking socket struct */
sock_init_data(sock, sk); /* Note : set sk->refcnt to 1 */
sk->family = PF_IRDA;
sk->protocol = protocol;
@@ -1141,13 +1141,13 @@
self->max_sdu_size_rx = TTP_SAR_UNBOUND;
break;
default:
- ERROR(__FUNCTION__ "(), protocol not supported!\n");
+ ERROR("%s: protocol not supported!\n", __FUNCTION__);
return -ESOCKTNOSUPPORT;
}
break;
default:
return -ESOCKTNOSUPPORT;
- }
+ }

/* Register as a client with IrLMP */
self->ckey = irlmp_register_client(0, NULL, NULL, NULL);
@@ -1202,25 +1202,22 @@
#endif /* CONFIG_IRDA_ULTRA */
kfree(self);
MOD_DEC_USE_COUNT;
-
+
return;
}

/*
* Function irda_release (sock)
- *
- *
- *
*/
static int irda_release(struct socket *sock)
{
struct sock *sk = sock->sk;
-
+
IRDA_DEBUG(2, __FUNCTION__ "()\n");

- if (sk == NULL)
+ if (sk == NULL)
return 0;
-
+
sk->state = TCP_CLOSE;
sk->shutdown |= SEND_SHUTDOWN;
sk->state_change(sk);
@@ -1231,7 +1228,7 @@
irda_sk(sk) = NULL;

sock_orphan(sk);
- sock->sk = NULL;
+ sock->sk = NULL;

/* Purge queues (see sock_init_data()) */
skb_queue_purge(&sk->receive_queue);
@@ -1248,7 +1245,7 @@
* 1) This may include IAS request, both in connect and getsockopt.
* Unfortunately, the situation is a bit more messy than it looks,
* because we close iriap and kfree(self) above.
- *
+ *
* 2) This may include selective discovery in getsockopt.
* Same stuff as above, irlmp registration and self are gone.
*
@@ -1273,10 +1270,10 @@
* Function irda_sendmsg (sock, msg, len, scm)
*
* Send message down to TinyTP. This function is used for both STREAM and
- * SEQPACK services. This is possible since it forces the client to
+ * SEQPACK services. This is possible since it forces the client to
* fragment the message if necessary
*/
-static int irda_sendmsg(struct socket *sock, struct msghdr *msg, int len,
+static int irda_sendmsg(struct socket *sock, struct msghdr *msg, int len,
struct scm_cookie *scm)
{
struct sock *sk = sock->sk;
@@ -1314,24 +1311,24 @@

/* Check that we don't send out to big frames */
if (len > self->max_data_size) {
- IRDA_DEBUG(2, __FUNCTION__
- "(), Chopping frame from %d to %d bytes!\n", len,
+ IRDA_DEBUG(2, __FUNCTION__
+ "(), Chopping frame from %d to %d bytes!\n", len,
self->max_data_size);
len = self->max_data_size;
}

- skb = sock_alloc_send_skb(sk, len + self->max_header_size,
+ skb = sock_alloc_send_skb(sk, len + self->max_header_size,
msg->msg_flags & MSG_DONTWAIT, &err);
if (!skb)
return -ENOBUFS;

skb_reserve(skb, self->max_header_size);
-
+
asmptr = skb->h.raw = skb_put(skb, len);
memcpy_fromiovec(asmptr, msg->msg_iov, len);

- /*
- * Just send the message to TinyTP, and let it deal with possible
+ /*
+ * Just send the message to TinyTP, and let it deal with possible
* errors. No need to duplicate all that here
*/
err = irttp_data_request(self->tsap, skb);
@@ -1349,7 +1346,7 @@
* Try to receive message and copy it to user. The frame is discarded
* after being read, regardless of how much the user actually read
*/
-static int irda_recvmsg_dgram(struct socket *sock, struct msghdr *msg,
+static int irda_recvmsg_dgram(struct socket *sock, struct msghdr *msg,
int size, int flags, struct scm_cookie *scm)
{
struct sock *sk = sock->sk;
@@ -1361,16 +1358,16 @@

ASSERT(self != NULL, return -1;);

- skb = skb_recv_datagram(sk, flags & ~MSG_DONTWAIT,
+ skb = skb_recv_datagram(sk, flags & ~MSG_DONTWAIT,
flags & MSG_DONTWAIT, &err);
if (!skb)
return err;

skb->h.raw = skb->data;
copied = skb->len;
-
+
if (copied > size) {
- IRDA_DEBUG(2, __FUNCTION__
+ IRDA_DEBUG(2, __FUNCTION__
"(), Received truncated frame (%d < %d)!\n",
copied, size);
copied = size;
@@ -1423,11 +1420,8 @@

/*
* Function irda_recvmsg_stream (sock, msg, size, flags, scm)
- *
- *
- *
*/
-static int irda_recvmsg_stream(struct socket *sock, struct msghdr *msg,
+static int irda_recvmsg_stream(struct socket *sock, struct msghdr *msg,
int size, int flags, struct scm_cookie *scm)
{
struct sock *sk = sock->sk;
@@ -1440,7 +1434,7 @@

ASSERT(self != NULL, return -1;);

- if (sock->flags & __SO_ACCEPTCON)
+ if (sock->flags & __SO_ACCEPTCON)
return(-EINVAL);

if (flags & MSG_OOB)
@@ -1448,7 +1442,7 @@

if (flags & MSG_WAITALL)
target = size;
-
+
msg->msg_namelen = 0;

do {
@@ -1459,11 +1453,11 @@
if (skb==NULL) {
if (copied >= target)
break;
-
+
/*
* POSIX 1003.1g mandates this order.
*/
-
+
if (sk->err) {
return sock_error(sk);
}
@@ -1500,7 +1494,7 @@
break;
}

- kfree_skb(skb);
+ kfree_skb(skb);
} else {
IRDA_DEBUG(0, __FUNCTION__ "() questionable!?\n");

@@ -1542,9 +1536,9 @@
struct sk_buff *skb;
unsigned char *asmptr;
int err;
-
+
IRDA_DEBUG(4, __FUNCTION__ "(), len=%d\n", len);
-
+
if (msg->msg_flags & ~MSG_DONTWAIT)
return -EINVAL;

@@ -1559,30 +1553,30 @@
self = irda_sk(sk);
ASSERT(self != NULL, return -1;);

- /*
- * Check that we don't send out to big frames. This is an unreliable
- * service, so we have no fragmentation and no coalescence
+ /*
+ * Check that we don't send out to big frames. This is an unreliable
+ * service, so we have no fragmentation and no coalescence
*/
if (len > self->max_data_size) {
IRDA_DEBUG(0, __FUNCTION__ "(), Warning to much data! "
- "Chopping frame from %d to %d bytes!\n", len,
+ "Chopping frame from %d to %d bytes!\n", len,
self->max_data_size);
len = self->max_data_size;
}

- skb = sock_alloc_send_skb(sk, len + self->max_header_size,
+ skb = sock_alloc_send_skb(sk, len + self->max_header_size,
msg->msg_flags & MSG_DONTWAIT, &err);
if (!skb)
return -ENOBUFS;

skb_reserve(skb, self->max_header_size);
-
+
IRDA_DEBUG(4, __FUNCTION__ "(), appending user data\n");
asmptr = skb->h.raw = skb_put(skb, len);
memcpy_fromiovec(asmptr, msg->msg_iov, len);

- /*
- * Just send the message to TinyTP, and let it deal with possible
+ /*
+ * Just send the message to TinyTP, and let it deal with possible
* errors. No need to duplicate all that here
*/
err = irttp_udata_request(self->tsap, skb);
@@ -1608,9 +1602,9 @@
struct sk_buff *skb;
unsigned char *asmptr;
int err;
-
+
IRDA_DEBUG(4, __FUNCTION__ "(), len=%d\n", len);
-
+
if (msg->msg_flags & ~MSG_DONTWAIT)
return -EINVAL;

@@ -1622,24 +1616,24 @@
self = irda_sk(sk);
ASSERT(self != NULL, return -1;);

- /*
- * Check that we don't send out to big frames. This is an unreliable
- * service, so we have no fragmentation and no coalescence
+ /*
+ * Check that we don't send out to big frames. This is an unreliable
+ * service, so we have no fragmentation and no coalescence
*/
if (len > self->max_data_size) {
IRDA_DEBUG(0, __FUNCTION__ "(), Warning to much data! "
- "Chopping frame from %d to %d bytes!\n", len,
+ "Chopping frame from %d to %d bytes!\n", len,
self->max_data_size);
len = self->max_data_size;
}

- skb = sock_alloc_send_skb(sk, len + self->max_header_size,
+ skb = sock_alloc_send_skb(sk, len + self->max_header_size,
msg->msg_flags & MSG_DONTWAIT, &err);
if (!skb)
return -ENOBUFS;

skb_reserve(skb, self->max_header_size);
-
+
IRDA_DEBUG(4, __FUNCTION__ "(), appending user data\n");
asmptr = skb->h.raw = skb_put(skb, len);
memcpy_fromiovec(asmptr, msg->msg_iov, len);
@@ -1655,9 +1649,6 @@

/*
* Function irda_shutdown (sk, how)
- *
- *
- *
*/
static int irda_shutdown(struct socket *sock, int how)
{
@@ -1693,11 +1684,8 @@

/*
* Function irda_poll (file, sock, wait)
- *
- *
- *
*/
-static unsigned int irda_poll(struct file * file, struct socket *sock,
+static unsigned int irda_poll(struct file * file, struct socket *sock,
poll_table *wait)
{
struct sock *sk = sock->sk;
@@ -1732,7 +1720,7 @@
}

if (sk->state == TCP_ESTABLISHED) {
- if ((self->tx_flow == FLOW_START) &&
+ if ((self->tx_flow == FLOW_START) &&
sock_writeable(sk))
{
mask |= POLLOUT | POLLWRNORM | POLLWRBAND;
@@ -1740,9 +1728,9 @@
}
break;
case SOCK_SEQPACKET:
- if ((self->tx_flow == FLOW_START) &&
+ if ((self->tx_flow == FLOW_START) &&
sock_writeable(sk))
- {
+ {
mask |= POLLOUT | POLLWRNORM | POLLWRBAND;
}
break;
@@ -1752,22 +1740,19 @@
break;
default:
break;
- }
+ }
return mask;
}

/*
* Function irda_ioctl (sock, cmd, arg)
- *
- *
- *
*/
static int irda_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg)
{
struct sock *sk = sock->sk;

IRDA_DEBUG(4, __FUNCTION__ "(), cmd=%#x\n", cmd);
-
+
switch (cmd) {
case TIOCOUTQ: {
long amount;
@@ -1778,7 +1763,7 @@
return -EFAULT;
return 0;
}
-
+
case TIOCINQ: {
struct sk_buff *skb;
long amount = 0L;
@@ -1789,18 +1774,18 @@
return -EFAULT;
return 0;
}
-
+
case SIOCGSTAMP:
if (sk != NULL) {
if (sk->stamp.tv_sec == 0)
return -ENOENT;
- if (copy_to_user((void *)arg, &sk->stamp,
+ if (copy_to_user((void *)arg, &sk->stamp,
sizeof(struct timeval)))
return -EFAULT;
return 0;
}
return -EINVAL;
-
+
case SIOCGIFADDR:
case SIOCSIFADDR:
case SIOCGIFDSTADDR:
@@ -1811,7 +1796,7 @@
case SIOCSIFNETMASK:
case SIOCGIFMETRIC:
case SIOCSIFMETRIC:
- return -EINVAL;
+ return -EINVAL;
default:
IRDA_DEBUG(1, __FUNCTION__ "(), doing device ioctl!\n");
return dev_ioctl(cmd, (void *) arg);
@@ -1827,23 +1812,23 @@
* Set some options for the socket
*
*/
-static int irda_setsockopt(struct socket *sock, int level, int optname,
+static int irda_setsockopt(struct socket *sock, int level, int optname,
char *optval, int optlen)
{
- struct sock *sk = sock->sk;
+ struct sock *sk = sock->sk;
struct irda_sock *self = irda_sk(sk);
struct irda_ias_set *ias_opt;
struct ias_object *ias_obj;
struct ias_attrib * ias_attr; /* Attribute in IAS object */
int opt;
-
+
ASSERT(self != NULL, return -1;);

IRDA_DEBUG(2, __FUNCTION__ "(%p)\n", self);

if (level != SOL_IRLMP)
return -ENOPROTOOPT;
-
+
switch (optname) {
case IRLMP_IAS_SET:
/* The user want to add an attribute to an existing IAS object
@@ -1855,7 +1840,7 @@

if (optlen != sizeof(struct irda_ias_set))
return -EINVAL;
-
+
ias_opt = kmalloc(sizeof(struct irda_ias_set), GFP_ATOMIC);
if (ias_opt == NULL)
return -ENOMEM;
@@ -1863,7 +1848,7 @@
/* Copy query to the driver. */
if (copy_from_user(ias_opt, (char *)optval, optlen)) {
kfree(ias_opt);
- return -EFAULT;
+ return -EFAULT;
}

/* Find the object we target.
@@ -1907,7 +1892,7 @@
/* Add an integer attribute */
irias_add_integer_attrib(
ias_obj,
- ias_opt->irda_attrib_name,
+ ias_opt->irda_attrib_name,
ias_opt->attribute.irda_attrib_int,
IAS_USER_ATTR);
break;
@@ -1921,7 +1906,7 @@
/* Add an octet sequence attribute */
irias_add_octseq_attrib(
ias_obj,
- ias_opt->irda_attrib_name,
+ ias_opt->irda_attrib_name,
ias_opt->attribute.irda_attrib_octet_seq.octet_seq,
ias_opt->attribute.irda_attrib_octet_seq.len,
IAS_USER_ATTR);
@@ -1939,7 +1924,7 @@
/* Add a string attribute */
irias_add_string_attrib(
ias_obj,
- ias_opt->irda_attrib_name,
+ ias_opt->irda_attrib_name,
ias_opt->attribute.irda_attrib_string.string,
IAS_USER_ATTR);
break;
@@ -1958,15 +1943,15 @@

if (optlen != sizeof(struct irda_ias_set))
return -EINVAL;
-
+
ias_opt = kmalloc(sizeof(struct irda_ias_set), GFP_ATOMIC);
if (ias_opt == NULL)
return -ENOMEM;
-
+
/* Copy query to the driver. */
if (copy_from_user(ias_opt, (char *)optval, optlen)) {
kfree(ias_opt);
- return -EFAULT;
+ return -EFAULT;
}

/* Find the object we target.
@@ -1993,7 +1978,7 @@

/* Find the attribute (in the object) we target */
ias_attr = irias_find_attrib(ias_obj,
- ias_opt->irda_attrib_name);
+ ias_opt->irda_attrib_name);
if(ias_attr == (struct ias_attrib *) NULL) {
kfree(ias_opt);
return -EINVAL;
@@ -2001,7 +1986,7 @@

/* Check is the user space own the object */
if(ias_attr->value->owner != IAS_USER_ATTR) {
- IRDA_DEBUG(1, __FUNCTION__
+ IRDA_DEBUG(1, __FUNCTION__
"(), attempting to delete a kernel attribute\n");
kfree(ias_opt);
return -EPERM;
@@ -2014,26 +1999,25 @@
case IRLMP_MAX_SDU_SIZE:
if (optlen < sizeof(int))
return -EINVAL;
-
+
if (get_user(opt, (int *)optval))
return -EFAULT;
-
+
/* Only possible for a seqpacket service (TTP with SAR) */
if (sk->type != SOCK_SEQPACKET) {
- IRDA_DEBUG(2, __FUNCTION__
+ IRDA_DEBUG(2, __FUNCTION__
"(), setting max_sdu_size = %d\n", opt);
self->max_sdu_size_rx = opt;
} else {
- WARNING(__FUNCTION__
- "(), not allowed to set MAXSDUSIZE for this "
- "socket type!\n");
+ WARNING("%s: not allowed to set MAXSDUSIZE for this socket type!\n",
+ __FUNCTION__);
return -ENOPROTOOPT;
}
break;
case IRLMP_HINTS_SET:
if (optlen < sizeof(int))
return -EINVAL;
-
+
if (get_user(opt, (int *)optval))
return -EFAULT;

@@ -2051,7 +2035,7 @@
*/
if (optlen < sizeof(int))
return -EINVAL;
-
+
if (get_user(opt, (int *)optval))
return -EFAULT;

@@ -2112,20 +2096,17 @@
default :
return -EINVAL;
}
-
+
/* Copy type over */
ias_opt->irda_attrib_type = ias_value->type;
-
+
return 0;
}

/*
* Function irda_getsockopt (sock, level, optname, optval, optlen)
- *
- *
- *
*/
-static int irda_getsockopt(struct socket *sock, int level, int optname,
+static int irda_getsockopt(struct socket *sock, int level, int optname,
char *optval, int *optlen)
{
struct sock *sk = sock->sk;
@@ -2151,7 +2132,7 @@

if(len < 0)
return -EINVAL;
-
+
switch (optname) {
case IRLMP_ENUMDEVICES:
/* Ask lmp for the current discovery log */
@@ -2163,13 +2144,13 @@
err = 0;

/* Write total list length back to client */
- if (copy_to_user(optval, &list,
+ if (copy_to_user(optval, &list,
sizeof(struct irda_device_list) -
sizeof(struct irda_device_info)))
err = -EFAULT;

/* Offset to first device entry */
- offset = sizeof(struct irda_device_list) -
+ offset = sizeof(struct irda_device_list) -
sizeof(struct irda_device_info);

/* Copy the list itself - watch for overflow */
@@ -2198,7 +2179,7 @@
len = sizeof(int);
if (put_user(len, optlen))
return -EFAULT;
-
+
if (copy_to_user(optval, &val, len))
return -EFAULT;
break;
@@ -2218,7 +2199,7 @@
/* Copy query to the driver. */
if (copy_from_user((char *) ias_opt, (char *)optval, len)) {
kfree(ias_opt);
- return -EFAULT;
+ return -EFAULT;
}

/* Find the object we target.
@@ -2236,7 +2217,7 @@

/* Find the attribute (in the object) we target */
ias_attr = irias_find_attrib(ias_obj,
- ias_opt->irda_attrib_name);
+ ias_opt->irda_attrib_name);
if(ias_attr == (struct ias_attrib *) NULL) {
kfree(ias_opt);
return -EINVAL;
@@ -2253,7 +2234,7 @@
if (copy_to_user((char *)optval, (char *) ias_opt,
sizeof(struct irda_ias_set))) {
kfree(ias_opt);
- return -EFAULT;
+ return -EFAULT;
}
/* Note : don't need to put optlen, we checked it */
kfree(ias_opt);
@@ -2274,7 +2255,7 @@
/* Copy query to the driver. */
if (copy_from_user((char *) ias_opt, (char *)optval, len)) {
kfree(ias_opt);
- return -EFAULT;
+ return -EFAULT;
}

/* At this point, there are two cases...
@@ -2301,8 +2282,8 @@

/* Check that we can proceed with IAP */
if (self->iriap) {
- WARNING(__FUNCTION__
- "(), busy with a previous query\n");
+ WARNING("%s: busy with a previous query\n",
+ __FUNCTION__);
kfree(ias_opt);
return -EBUSY;
}
@@ -2359,7 +2340,7 @@
if (copy_to_user((char *)optval, (char *) ias_opt,
sizeof(struct irda_ias_set))) {
kfree(ias_opt);
- return -EFAULT;
+ return -EFAULT;
}
/* Note : don't need to put optlen, we checked it */
kfree(ias_opt);
@@ -2398,7 +2379,7 @@
if (!self->cachediscovery) {
int ret = 0;

- IRDA_DEBUG(1, __FUNCTION__
+ IRDA_DEBUG(1, __FUNCTION__
"(), nothing discovered yet, going to sleep...\n");

/* Set watchdog timer to expire in <val> ms. */
@@ -2417,14 +2398,14 @@
if(timer_pending(&(self->watchdog)))
del_timer(&(self->watchdog));

- IRDA_DEBUG(1, __FUNCTION__
+ IRDA_DEBUG(1, __FUNCTION__
"(), ...waking up !\n");

if (ret != 0)
return ret;
}
else
- IRDA_DEBUG(1, __FUNCTION__
+ IRDA_DEBUG(1, __FUNCTION__
"(), found immediately !\n");

/* Tell IrLMP that we have been notified */
@@ -2445,7 +2426,7 @@
default:
return -ENOPROTOOPT;
}
-
+
return 0;
}

@@ -2456,7 +2437,7 @@

static struct proto_ops SOCKOPS_WRAPPED(irda_stream_ops) = {
family: PF_IRDA,
-
+
release: irda_release,
bind: irda_bind,
connect: irda_connect,
@@ -2477,7 +2458,7 @@

static struct proto_ops SOCKOPS_WRAPPED(irda_seqpacket_ops) = {
family: PF_IRDA,
-
+
release: irda_release,
bind: irda_bind,
connect: irda_connect,
@@ -2498,7 +2479,7 @@

static struct proto_ops SOCKOPS_WRAPPED(irda_dgram_ops) = {
family: PF_IRDA,
-
+
release: irda_release,
bind: irda_bind,
connect: irda_connect,
@@ -2520,7 +2501,7 @@
#ifdef CONFIG_IRDA_ULTRA
static struct proto_ops SOCKOPS_WRAPPED(irda_ultra_ops) = {
family: PF_IRDA,
-
+
release: irda_release,
bind: irda_bind,
connect: sock_no_connect,
@@ -2558,11 +2539,11 @@
void *ptr)
{
struct net_device *dev = (struct net_device *) ptr;
-
+
/* Reject non IrDA devices */
- if (dev->type != ARPHRD_IRDA)
+ if (dev->type != ARPHRD_IRDA)
return NOTIFY_DONE;
-
+
switch (event) {
case NETDEV_UP:
IRDA_DEBUG(3, __FUNCTION__ "(), NETDEV_UP\n");
@@ -2581,7 +2562,7 @@
return NOTIFY_DONE;
}

-static struct packet_type irda_packet_type =
+static struct packet_type irda_packet_type =
{
0, /* MUTTER ntohs(ETH_P_IRDA),*/
NULL,
@@ -2630,7 +2611,7 @@
register_netdevice_notifier(&irda_dev_notifier);

irda_init();
- irda_device_init();
+ irda_device_init();
return 0;
}

@@ -2649,16 +2630,16 @@
dev_remove_pack(&irda_packet_type);

unregister_netdevice_notifier(&irda_dev_notifier);
-
+
sock_unregister(PF_IRDA);
irda_cleanup();
-
+
return;
}
module_exit(irda_proto_cleanup);
-
+
MODULE_AUTHOR("Dag Brattli <[email protected]>");
-MODULE_DESCRIPTION("The Linux IrDA Protocol Subsystem");
+MODULE_DESCRIPTION("The Linux IrDA Protocol Subsystem");
MODULE_LICENSE("GPL");
#ifdef CONFIG_IRDA_DEBUG
MODULE_PARM(irda_debug, "1l");


Attachments:
warn-2.5.21-7.diff (33.04 kB)

2002-06-10 12:37:28

by Martin Dalecki

[permalink] [raw]
Subject: [PATCH] 2.5.21 kill warnings 8/19

diff -urN linux-2.5.21/net/irda/irda_device.c linux/net/irda/irda_device.c
--- linux-2.5.21/net/irda/irda_device.c 2002-06-09 07:29:50.000000000 +0200
+++ linux/net/irda/irda_device.c 2002-06-09 20:11:02.000000000 +0200
@@ -1,5 +1,5 @@
/*********************************************************************
- *
+ *
* Filename: irda_device.c
* Version: 0.9
* Description: Utility functions used by the device drivers
@@ -8,25 +8,25 @@
* Created at: Sat Oct 9 09:22:27 1999
* Modified at: Sun Jan 23 17:41:24 2000
* Modified by: Dag Brattli <[email protected]>
- *
+ *
* Copyright (c) 1999-2000 Dag Brattli, All Rights Reserved.
* Copyright (c) 2000-2001 Jean Tourrilhes <[email protected]>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
* the License, or (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
* MA 02111-1307 USA
- *
+ *
********************************************************************/

#include <linux/config.h>
@@ -83,7 +83,7 @@
#ifdef CONFIG_IRDA_DEBUG
static const char *task_state[] = {
"IRDA_TASK_INIT",
- "IRDA_TASK_DONE",
+ "IRDA_TASK_DONE",
"IRDA_TASK_WAIT",
"IRDA_TASK_WAIT1",
"IRDA_TASK_WAIT2",
@@ -97,7 +97,7 @@
static void irda_task_timer_expired(void *data);

#ifdef CONFIG_PROC_FS
-int irda_device_proc_read(char *buf, char **start, off_t offset, int len,
+int irda_device_proc_read(char *buf, char **start, off_t offset, int len,
int unused);

#endif /* CONFIG_PROC_FS */
@@ -106,21 +106,19 @@
{
dongles = hashbin_new(HB_GLOBAL);
if (dongles == NULL) {
- printk(KERN_WARNING
- "IrDA: Can't allocate dongles hashbin!\n");
+ printk(KERN_WARNING "IrDA: Can't allocate dongles hashbin!\n");
return -ENOMEM;
}

tasks = hashbin_new(HB_GLOBAL);
if (tasks == NULL) {
- printk(KERN_WARNING
- "IrDA: Can't allocate tasks hashbin!\n");
+ printk(KERN_WARNING "IrDA: Can't allocate tasks hashbin!\n");
return -ENOMEM;
}

- /*
+ /*
* Call the init function of the device drivers that has not been
- * compiled as a module
+ * compiled as a module
*/
#ifdef CONFIG_IRTTY_SIR
irtty_init();
@@ -156,10 +154,10 @@
litelink_init();
#endif
#ifdef CONFIG_OLD_BELKIN
- old_belkin_init();
+ old_belkin_init();
#endif
#ifdef CONFIG_EP7211_IR
- ep7211_ir_init();
+ ep7211_ir_init();
#endif
return 0;
}
@@ -178,7 +176,7 @@
* Called when we have detected that another station is transmiting
* in contention mode.
*/
-void irda_device_set_media_busy(struct net_device *dev, int status)
+void irda_device_set_media_busy(struct net_device *dev, int status)
{
struct irlap_cb *self;

@@ -203,15 +201,15 @@
}

int irda_device_set_dtr_rts(struct net_device *dev, int dtr, int rts)
-{
+{
struct if_irda_req req;
int ret;

IRDA_DEBUG(2, __FUNCTION__ "()\n");

if (!dev->do_ioctl) {
- ERROR(__FUNCTION__ "(), do_ioctl not impl. by "
- "device driver\n");
+ ERROR("%s: do_ioctl not impl. by device driver\n",
+ __FUNCTION__);
return -1;
}

@@ -224,15 +222,15 @@
}

int irda_device_change_speed(struct net_device *dev, __u32 speed)
-{
+{
struct if_irda_req req;
int ret;

IRDA_DEBUG(2, __FUNCTION__ "()\n");

if (!dev->do_ioctl) {
- ERROR(__FUNCTION__ "(), do_ioctl not impl. by "
- "device driver\n");
+ ERROR("%s: do_ioctl not impl. by device driver\n",
+ __FUNCTION__);
return -1;
}

@@ -257,8 +255,8 @@
IRDA_DEBUG(2, __FUNCTION__ "()\n");

if (!dev->do_ioctl) {
- ERROR(__FUNCTION__ "(), do_ioctl not impl. by "
- "device driver\n");
+ ERROR("%s: do_ioctl not impl. by device driver\n",
+ __FUNCTION__);
return -1;
}

@@ -279,7 +277,7 @@
static void __irda_task_delete(struct irda_task *task)
{
del_timer(&task->timer);
-
+
kfree(task);
}

@@ -314,14 +312,14 @@
do {
timeout = task->function(task);
if (count++ > 100) {
- ERROR(__FUNCTION__ "(), error in task handler!\n");
+ ERROR("%s: error in task handler!\n", __FUNCTION__);
irda_task_delete(task);
return TRUE;
- }
+ }
} while ((timeout == 0) && (task->state != IRDA_TASK_DONE));

if (timeout < 0) {
- ERROR(__FUNCTION__ "(), Error executing task!\n");
+ ERROR("%s: Error executing task!\n", __FUNCTION__);
irda_task_delete(task);
return TRUE;
}
@@ -346,14 +344,14 @@
/* Kick parent task */
irda_task_kick(task->parent);
}
- }
+ }
irda_task_delete(task);
} else if (timeout > 0) {
- irda_start_timer(&task->timer, timeout, (void *) task,
+ irda_start_timer(&task->timer, timeout, (void *) task,
irda_task_timer_expired);
finished = FALSE;
} else {
- IRDA_DEBUG(0, __FUNCTION__
+ IRDA_DEBUG(0, __FUNCTION__
"(), not finished, and no timeout!\n");
finished = FALSE;
}
@@ -367,7 +365,7 @@
* This function registers and tries to execute tasks that may take some
* time to complete. We do it this hairy way since we may have been
* called from interrupt context, so it's not possible to use
- * schedule_timeout()
+ * schedule_timeout()
* Two important notes :
* o Make sure you irda_task_delete(task); in case you delete the
* calling instance.
@@ -375,9 +373,9 @@
* want to lock within the task handler.
* Jean II
*/
-struct irda_task *irda_task_execute(void *instance,
- IRDA_TASK_CALLBACK function,
- IRDA_TASK_CALLBACK finished,
+struct irda_task *irda_task_execute(void *instance,
+ IRDA_TASK_CALLBACK function,
+ IRDA_TASK_CALLBACK finished,
struct irda_task *parent, void *param)
{
struct irda_task *task;
@@ -394,7 +392,7 @@
task->function = function;
task->finished = finished;
task->parent = parent;
- task->param = param;
+ task->param = param;
task->magic = IRDA_TASK_MAGIC;

init_timer(&task->timer);
@@ -433,7 +431,7 @@
* This function should be used by low level device drivers in a similar way
* as ether_setup() is used by normal network device drivers
*/
-int irda_device_setup(struct net_device *dev)
+int irda_device_setup(struct net_device *dev)
{
ASSERT(dev != NULL, return -1;);

@@ -445,7 +443,7 @@

dev->type = ARPHRD_IRDA;
dev->tx_queue_len = 8; /* Window size + 1 s-frame */
-
+
memset(dev->broadcast, 0xff, 4);

dev->mtu = 2048;
@@ -491,7 +489,7 @@
sprintf(modname, "irda-dongle-%d", type);
request_module(modname);
}
-#endif /* CONFIG_KMOD */
+#endif

if (!(reg = hashbin_find(dongles, type, NULL))) {
ERROR("IrDA: Unable to find requested dongle\n");
@@ -514,9 +512,6 @@

/*
* Function irda_device_dongle_cleanup (dongle)
- *
- *
- *
*/
int irda_device_dongle_cleanup(dongle_t *dongle)
{
@@ -531,21 +526,18 @@

/*
* Function irda_device_register_dongle (dongle)
- *
- *
- *
*/
int irda_device_register_dongle(struct dongle_reg *new)
{
/* Check if this dongle has been registred before */
if (hashbin_find(dongles, new->type, NULL)) {
- MESSAGE(__FUNCTION__ "(), Dongle already registered\n");
+ MESSAGE("%s: Dongle already registered\n", __FUNCTION__);
return 0;
}
-
+
/* Insert IrDA dongle into hashbin */
hashbin_insert(dongles, (irda_queue_t *) new, new->type, NULL);
-
+
return 0;
}

@@ -561,7 +553,7 @@

node = hashbin_remove(dongles, dongle->type, NULL);
if (!node) {
- ERROR(__FUNCTION__ "(), dongle not found!\n");
+ ERROR("%s: dongle not found!\n", __FUNCTION__);
return;
}
}
@@ -574,22 +566,22 @@
* driver to find out which modes it support.
*/
int irda_device_set_mode(struct net_device* dev, int mode)
-{
+{
struct if_irda_req req;
int ret;

IRDA_DEBUG(0, __FUNCTION__ "()\n");

if (!dev->do_ioctl) {
- ERROR(__FUNCTION__ "(), set_raw_mode not impl. by "
- "device driver\n");
+ ERROR("%s: set_raw_mode not impl. by device driver\n",
+ __FUNCTION__);
return -1;
}
-
+
req.ifr_mode = mode;

ret = dev->do_ioctl(dev, (struct ifreq *) &req, SIOCSMODE);
-
+
return ret;
}

@@ -602,9 +594,9 @@
void setup_dma(int channel, char *buffer, int count, int mode)
{
unsigned long flags;
-
+
flags = claim_dma_lock();
-
+
disable_dma(channel);
clear_dma_ff(channel);
set_dma_mode(channel, mode);


Attachments:
warn-2.5.21-8.diff (9.12 kB)

2002-06-10 12:39:37

by Martin Dalecki

[permalink] [raw]
Subject: [PATCH] 2.5.21 kill warnings 9/19

diff -urN linux-2.5.21/net/irda/iriap.c linux/net/irda/iriap.c
--- linux-2.5.21/net/irda/iriap.c 2002-06-09 07:28:38.000000000 +0200
+++ linux/net/irda/iriap.c 2002-06-09 21:52:11.000000000 +0200
@@ -1,5 +1,5 @@
/*********************************************************************
- *
+ *
* Filename: iriap.c
* Version: 0.8
* Description: Information Access Protocol (IAP)
@@ -8,18 +8,18 @@
* Created at: Thu Aug 21 00:02:07 1997
* Modified at: Sat Dec 25 16:42:42 1999
* Modified by: Dag Brattli <[email protected]>
- *
- * Copyright (c) 1998-1999 Dag Brattli <[email protected]>,
+ *
+ * Copyright (c) 1998-1999 Dag Brattli <[email protected]>,
* All Rights Reserved.
* Copyright (c) 2000-2001 Jean Tourrilhes <[email protected]>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
* the License, or (at your option) any later version.
*
* Neither Dag Brattli nor University of Troms? admit liability nor
- * provide warranty for any of this software. This material is
+ * provide warranty for any of this software. This material is
* provided "AS-IS" and at no charge.
*
********************************************************************/
@@ -59,30 +59,30 @@
#endif /* CONFIG_IRDA_DEBUG */

static hashbin_t *iriap = NULL;
-static __u32 service_handle;
+static __u32 service_handle;

extern char *lmp_reasons[];

static void __iriap_close(struct iriap_cb *self);
static int iriap_register_lsap(struct iriap_cb *self, __u8 slsap_sel, int mode);
-static void iriap_disconnect_indication(void *instance, void *sap,
+static void iriap_disconnect_indication(void *instance, void *sap,
LM_REASON reason, struct sk_buff *skb);
-static void iriap_connect_indication(void *instance, void *sap,
+static void iriap_connect_indication(void *instance, void *sap,
struct qos_info *qos, __u32 max_sdu_size,
- __u8 max_header_size,
+ __u8 max_header_size,
struct sk_buff *skb);
-static void iriap_connect_confirm(void *instance, void *sap,
- struct qos_info *qos,
+static void iriap_connect_confirm(void *instance, void *sap,
+ struct qos_info *qos,
__u32 max_sdu_size, __u8 max_header_size,
struct sk_buff *skb);
-static int iriap_data_indication(void *instance, void *sap,
+static int iriap_data_indication(void *instance, void *sap,
struct sk_buff *skb);

/*
* Function iriap_init (void)
*
* Initializes the IrIAP layer, called by the module initialization code
- * in irmod.c
+ * in irmod.c
*/
int __init iriap_init(void)
{
@@ -98,12 +98,12 @@

objects = hashbin_new(HB_LOCAL);
if (!objects) {
- WARNING(__FUNCTION__ "(), Can't allocate objects hashbin!\n");
+ WARNING("%s: Can't allocate objects hashbin!\n", __FUNCTION__);
return -ENOMEM;
}

- /*
- * Register some default services for IrLMP
+ /*
+ * Register some default services for IrLMP
*/
hints = irlmp_service_to_hint(S_COMPUTER);
service_handle = irlmp_register_service(hints);
@@ -122,9 +122,9 @@
IAS_KERNEL_ATTR);
irias_insert_object(obj);

- /*
- * Register server support with IrLMP so we can accept incoming
- * connections
+ /*
+ * Register server support with IrLMP so we can accept incoming
+ * connections
*/
server = iriap_open(LSAP_IAS, IAS_SERVER, NULL, NULL);
if (!server) {
@@ -139,15 +139,15 @@
/*
* Function iriap_cleanup (void)
*
- * Initializes the IrIAP layer, called by the module cleanup code in
+ * Initializes the IrIAP layer, called by the module cleanup code in
* irmod.c
*/
void iriap_cleanup(void)
{
irlmp_unregister_service(service_handle);
-
+
hashbin_delete(iriap, (FREE_FUNC) __iriap_close);
- hashbin_delete(objects, (FREE_FUNC) __irias_delete_object);
+ hashbin_delete(objects, (FREE_FUNC) __irias_delete_object);
}

/*
@@ -155,7 +155,7 @@
*
* Opens an instance of the IrIAP layer, and registers with IrLMP
*/
-struct iriap_cb *iriap_open(__u8 slsap_sel, int mode, void *priv,
+struct iriap_cb *iriap_open(__u8 slsap_sel, int mode, void *priv,
CONFIRM_CALLBACK callback)
{
struct iriap_cb *self;
@@ -164,7 +164,7 @@

self = kmalloc(sizeof(struct iriap_cb), GFP_ATOMIC);
if (!self) {
- WARNING(__FUNCTION__ "(), Unable to kmalloc!\n");
+ WARNING("%s: Unable to kmalloc!\n", __FUNCTION__);
return NULL;
}

@@ -172,7 +172,7 @@
* Initialize instance
*/
memset(self, 0, sizeof(struct iriap_cb));
-
+
self->magic = IAS_MAGIC;
self->mode = mode;
if (mode == IAS_CLIENT)
@@ -184,13 +184,13 @@
init_timer(&self->watchdog_timer);

hashbin_insert(iriap, (irda_queue_t *) self, (int) self, NULL);
-
+
/* Initialize state machines */
iriap_next_client_state(self, S_DISCONNECT);
iriap_next_call_state(self, S_MAKE_CALL);
iriap_next_server_state(self, R_DISCONNECT);
iriap_next_r_connect_state(self, R_WAITING);
-
+
return self;
}

@@ -261,7 +261,7 @@

self->lsap = irlmp_open_lsap(slsap_sel, &notify, 0);
if (self->lsap == NULL) {
- ERROR(__FUNCTION__ "(), Unable to allocated LSAP!\n");
+ ERROR("%s: Unable to allocated LSAP!\n", __FUNCTION__);
return -1;
}
self->slsap_sel = self->lsap->slsap_sel;
@@ -275,8 +275,8 @@
* Got disconnect, so clean up everything assosiated with this connection
*
*/
-static void iriap_disconnect_indication(void *instance, void *sap,
- LM_REASON reason,
+static void iriap_disconnect_indication(void *instance, void *sap,
+ LM_REASON reason,
struct sk_buff *userdata)
{
struct iriap_cb *self;
@@ -296,18 +296,18 @@
IRDA_DEBUG(4, __FUNCTION__ "(), disconnect as client\n");


- iriap_do_client_event(self, IAP_LM_DISCONNECT_INDICATION,
+ iriap_do_client_event(self, IAP_LM_DISCONNECT_INDICATION,
NULL);
- /*
- * Inform service user that the request failed by sending
+ /*
+ * Inform service user that the request failed by sending
* it a NULL value. Warning, the client might close us, so
* remember no to use self anymore after calling confirm
*/
if (self->confirm)
- self->confirm(IAS_DISCONNECT, 0, NULL, self->priv);
+ self->confirm(IAS_DISCONNECT, 0, NULL, self->priv);
} else {
IRDA_DEBUG(4, __FUNCTION__ "(), disconnect as server\n");
- iriap_do_server_event(self, IAP_LM_DISCONNECT_INDICATION,
+ iriap_do_server_event(self, IAP_LM_DISCONNECT_INDICATION,
NULL);
iriap_close(self);
}
@@ -318,9 +318,6 @@

/*
* Function iriap_disconnect_request (handle)
- *
- *
- *
*/
void iriap_disconnect_request(struct iriap_cb *self)
{
@@ -338,35 +335,35 @@
return;
}

- /*
- * Reserve space for MUX control and LAP header
+ /*
+ * Reserve space for MUX control and LAP header
*/
- skb_reserve(skb, LMP_MAX_HEADER);
+ skb_reserve(skb, LMP_MAX_HEADER);

irlmp_disconnect_request(self->lsap, skb);
}

-void iriap_getinfobasedetails_request(void)
+void iriap_getinfobasedetails_request(void)
{
IRDA_DEBUG(0, __FUNCTION__ "(), Not implemented!\n");
}

-void iriap_getinfobasedetails_confirm(void)
+void iriap_getinfobasedetails_confirm(void)
{
IRDA_DEBUG(0, __FUNCTION__ "(), Not implemented!\n");
}

-void iriap_getobjects_request(void)
+void iriap_getobjects_request(void)
{
IRDA_DEBUG(0, __FUNCTION__ "(), Not implemented!\n");
}

-void iriap_getobjects_confirm(void)
+void iriap_getobjects_confirm(void)
{
IRDA_DEBUG(0, __FUNCTION__ "(), Not implemented!\n");
}

-void iriap_getvalue(void)
+void iriap_getvalue(void)
{
IRDA_DEBUG(0, __FUNCTION__ "(), Not implemented!\n");
}
@@ -378,7 +375,7 @@
* name
*/
int iriap_getvaluebyclass_request(struct iriap_cb *self,
- __u32 saddr, __u32 daddr,
+ __u32 saddr, __u32 daddr,
char *name, char *attr)
{
struct sk_buff *skb;
@@ -391,18 +388,18 @@
/* Client must supply the destination device address */
if (!daddr)
return -1;
-
+
self->daddr = daddr;
self->saddr = saddr;

- /*
+ /*
* Save operation, so we know what the later indication is about
*/
- self->operation = GET_VALUE_BY_CLASS;
+ self->operation = GET_VALUE_BY_CLASS;

/* Give ourselves 10 secs to finish this operation */
iriap_start_watchdog_timer(self, 10*HZ);
-
+
name_len = strlen(name); /* Up to IAS_MAX_CLASSNAME = 60 */
attr_len = strlen(attr); /* Up to IAS_MAX_ATTRIBNAME = 60 */

@@ -412,7 +409,7 @@
return -ENOMEM;

/* Reserve space for MUX and LAP header */
- skb_reserve(skb, self->max_header_size);
+ skb_reserve(skb, self->max_header_size);
skb_put(skb, 3+name_len+attr_len);
frame = skb->data;

@@ -435,7 +432,7 @@
* to service user.
*
*/
-void iriap_getvaluebyclass_confirm(struct iriap_cb *self, struct sk_buff *skb)
+void iriap_getvaluebyclass_confirm(struct iriap_cb *self, struct sk_buff *skb)
{
struct ias_value *value;
int charset;
@@ -473,7 +470,7 @@
value = irias_new_integer_value(tmp_cpu32);

/* Legal values restricted to 0x01-0x6f, page 15 irttp */
- IRDA_DEBUG(4, __FUNCTION__ "(), lsap=%d\n", value->t.integer);
+ IRDA_DEBUG(4, __FUNCTION__ "(), lsap=%d\n", value->t.integer);
break;
case IAS_STRING:
charset = fp[n++];
@@ -481,16 +478,16 @@
switch (charset) {
case CS_ASCII:
break;
-/* case CS_ISO_8859_1: */
-/* case CS_ISO_8859_2: */
-/* case CS_ISO_8859_3: */
-/* case CS_ISO_8859_4: */
-/* case CS_ISO_8859_5: */
-/* case CS_ISO_8859_6: */
-/* case CS_ISO_8859_7: */
-/* case CS_ISO_8859_8: */
-/* case CS_ISO_8859_9: */
-/* case CS_UNICODE: */
+/* case CS_ISO_8859_1: */
+/* case CS_ISO_8859_2: */
+/* case CS_ISO_8859_3: */
+/* case CS_ISO_8859_4: */
+/* case CS_ISO_8859_5: */
+/* case CS_ISO_8859_6: */
+/* case CS_ISO_8859_7: */
+/* case CS_ISO_8859_8: */
+/* case CS_ISO_8859_9: */
+/* case CS_UNICODE: */
default:
IRDA_DEBUG(0, __FUNCTION__
"(), charset %s, not supported\n",
@@ -504,7 +501,7 @@
}
value_len = fp[n++];
IRDA_DEBUG(4, __FUNCTION__ "(), strlen=%d\n", value_len);
-
+
/* Make sure the string is null-terminated */
fp[n+value_len] = 0x00;
IRDA_DEBUG(4, "Got string %s\n", fp+n);
@@ -515,7 +512,7 @@
case IAS_OCT_SEQ:
value_len = be16_to_cpu(get_unaligned((__u16 *)(fp+n)));
n += 2;
-
+
/* Will truncate to IAS_MAX_OCTET_STRING bytes */
value = irias_new_octseq_value(fp+n, value_len);
break;
@@ -523,12 +520,12 @@
value = irias_new_missing_value();
break;
}
-
+
/* Finished, close connection! */
iriap_disconnect_request(self);

/* Warning, the client might close us, so remember no to use self
- * anymore after calling confirm
+ * anymore after calling confirm
*/
if (self->confirm)
self->confirm(IAS_SUCCESS, obj_id, value, self->priv);
@@ -543,9 +540,9 @@
* Function iriap_getvaluebyclass_response ()
*
* Send answer back to remote LM-IAS
- *
+ *
*/
-void iriap_getvaluebyclass_response(struct iriap_cb *self, __u16 obj_id,
+void iriap_getvaluebyclass_response(struct iriap_cb *self, __u16 obj_id,
__u8 ret_code, struct ias_value *value)
{
struct sk_buff *skb;
@@ -563,8 +560,8 @@
/* Initialize variables */
n = 0;

- /*
- * We must adjust the size of the response after the length of the
+ /*
+ * We must adjust the size of the response after the length of the
* value. We add 32 bytes because of the 6 bytes for the frame and
* max 5 bytes for the value coding.
*/
@@ -573,9 +570,9 @@
return;

/* Reserve space for MUX and LAP header */
- skb_reserve(skb, self->max_header_size);
+ skb_reserve(skb, self->max_header_size);
skb_put(skb, 6);
-
+
fp = skb->data;

/* Build frame */
@@ -584,7 +581,7 @@

/* Insert list length (MSB first) */
tmp_be16 = __constant_htons(0x0001);
- memcpy(fp+n, &tmp_be16, 2); n += 2;
+ memcpy(fp+n, &tmp_be16, 2); n += 2;

/* Insert object identifier ( MSB first) */
tmp_be16 = cpu_to_be16(obj_id);
@@ -601,7 +598,7 @@
case IAS_INTEGER:
skb_put(skb, 5);
fp[n++] = value->type;
-
+
tmp_be32 = cpu_to_be32(value->t.integer);
memcpy(fp+n, &tmp_be32, 4); n += 4;
break;
@@ -631,10 +628,10 @@
* getvaluebyclass is requested from peer LM-IAS
*
*/
-void iriap_getvaluebyclass_indication(struct iriap_cb *self,
+void iriap_getvaluebyclass_indication(struct iriap_cb *self,
struct sk_buff *skb)
{
- struct ias_object *obj;
+ struct ias_object *obj;
struct ias_attrib *attrib;
int name_len;
int attr_len;
@@ -656,7 +653,7 @@
memcpy(name, fp+n, name_len); n+=name_len;
name[name_len] = '\0';

- attr_len = fp[n++];
+ attr_len = fp[n++];
memcpy(attr, fp+n, attr_len); n+=attr_len;
attr[attr_len] = '\0';

@@ -665,7 +662,7 @@

IRDA_DEBUG(4, "LM-IAS: Looking up %s: %s\n", name, attr);
obj = irias_find_object(name);
-
+
if (obj == NULL) {
IRDA_DEBUG(2, "LM-IAS: Object %s not found\n", name);
iriap_getvaluebyclass_response(self, 0x1235, IAS_CLASS_UNKNOWN,
@@ -673,7 +670,7 @@
return;
}
IRDA_DEBUG(4, "LM-IAS: found %s, id=%d\n", obj->name, obj->id);
-
+
attrib = irias_find_attrib(obj, attr);
if (attrib == NULL) {
IRDA_DEBUG(2, "LM-IAS: Attribute %s not found\n", attr);
@@ -681,11 +678,11 @@
IAS_ATTRIB_UNKNOWN, &missing);
return;
}
-
+
/* We have a match; send the value. */
- iriap_getvaluebyclass_response(self, obj->id, IAS_SUCCESS,
+ iriap_getvaluebyclass_response(self, obj->id, IAS_SUCCESS,
attrib->value);
-
+
return;
}

@@ -695,7 +692,7 @@
* Currently not used
*
*/
-void iriap_send_ack(struct iriap_cb *self)
+void iriap_send_ack(struct iriap_cb *self)
{
struct sk_buff *skb;
__u8 *frame;
@@ -710,7 +707,7 @@
return;

/* Reserve space for MUX and LAP header */
- skb_reserve(skb, self->max_header_size);
+ skb_reserve(skb, self->max_header_size);
skb_put(skb, 1);
frame = skb->data;

@@ -727,8 +724,8 @@
ASSERT(self != NULL, return;);
ASSERT(self->magic == IAS_MAGIC, return;);

- ret = irlmp_connect_request(self->lsap, LSAP_IAS,
- self->saddr, self->daddr,
+ ret = irlmp_connect_request(self->lsap, LSAP_IAS,
+ self->saddr, self->daddr,
NULL, NULL);
if (ret < 0) {
IRDA_DEBUG(0, __FUNCTION__ "(), connect failed!\n");
@@ -742,22 +739,22 @@
* LSAP connection confirmed!
*
*/
-static void iriap_connect_confirm(void *instance, void *sap,
- struct qos_info *qos, __u32 max_seg_size,
- __u8 max_header_size,
+static void iriap_connect_confirm(void *instance, void *sap,
+ struct qos_info *qos, __u32 max_seg_size,
+ __u8 max_header_size,
struct sk_buff *userdata)
{
struct iriap_cb *self;
-
+
self = (struct iriap_cb *) instance;

ASSERT(self != NULL, return;);
ASSERT(self->magic == IAS_MAGIC, return;);
ASSERT(userdata != NULL, return;);
-
+
self->max_data_size = max_seg_size;
self->max_header_size = max_header_size;
-
+
del_timer(&self->watchdog_timer);

iriap_do_client_event(self, IAP_LM_CONNECT_CONFIRM, userdata);
@@ -769,9 +766,9 @@
* Remote LM-IAS is requesting connection
*
*/
-static void iriap_connect_indication(void *instance, void *sap,
+static void iriap_connect_indication(void *instance, void *sap,
struct qos_info *qos, __u32 max_seg_size,
- __u8 max_header_size,
+ __u8 max_header_size,
struct sk_buff *userdata)
{
struct iriap_cb *self, *new;
@@ -782,46 +779,46 @@

ASSERT(self != NULL, return;);
ASSERT(self->magic == IAS_MAGIC, return;);
-
+
/* Start new server */
- new = iriap_open(LSAP_IAS, IAS_SERVER, NULL, NULL);
+ new = iriap_open(LSAP_IAS, IAS_SERVER, NULL, NULL);
if (!new) {
IRDA_DEBUG(0, __FUNCTION__ "(), open failed\n");
dev_kfree_skb(userdata);
return;
}
-
+
/* Now attach up the new "socket" */
new->lsap = irlmp_dup(self->lsap, new);
if (!new->lsap) {
IRDA_DEBUG(0, __FUNCTION__ "(), dup failed!\n");
return;
}
-
+
new->max_data_size = max_seg_size;
new->max_header_size = max_header_size;

/* Clean up the original one to keep it in listen state */
irlmp_listen(self->lsap);
-
+
iriap_do_server_event(new, IAP_LM_CONNECT_INDICATION, userdata);
}
-
+
/*
* Function iriap_data_indication (handle, skb)
*
* Receives data from connection identified by handle from IrLMP
*
*/
-static int iriap_data_indication(void *instance, void *sap,
- struct sk_buff *skb)
+static int iriap_data_indication(void *instance, void *sap,
+ struct sk_buff *skb)
{
struct iriap_cb *self;
__u8 *frame;
__u8 opcode;
-
- IRDA_DEBUG(3, __FUNCTION__ "()\n");
-
+
+ IRDA_DEBUG(3, __FUNCTION__ "()\n");
+
self = (struct iriap_cb *) instance;

ASSERT(self != NULL, return 0;);
@@ -830,7 +827,7 @@
ASSERT(skb != NULL, return 0;);

frame = skb->data;
-
+
if (self->mode == IAS_SERVER) {
/* Call server */
IRDA_DEBUG(4, __FUNCTION__ "(), Calling server!\n");
@@ -840,17 +837,17 @@
}
opcode = frame[0];
if (~opcode & IAP_LST) {
- WARNING(__FUNCTION__ "(), IrIAS multiframe commands or "
- "results is not implemented yet!\n");
+ WARNING("%s:, IrIAS multiframe commands or "
+ "results is not implemented yet!\n", __FUNCTION__);
dev_kfree_skb(skb);
return 0;
}
-
+
/* Check for ack frames since they don't contain any data */
if (opcode & IAP_ACK) {
IRDA_DEBUG(0, __FUNCTION__ "() Got ack frame!\n");
dev_kfree_skb(skb);
- return 0;
+ return 0;
}

opcode &= ~IAP_LST; /* Mask away LST bit */
@@ -862,7 +859,7 @@
break;
case GET_VALUE_BY_CLASS:
iriap_do_call_event(self, IAP_RECV_F_LST, NULL);
-
+
switch (frame[1]) {
case IAS_SUCCESS:
iriap_getvaluebyclass_confirm(self, skb);
@@ -872,9 +869,9 @@
/* Finished, close connection! */
iriap_disconnect_request(self);

- /*
+ /*
* Warning, the client might close us, so remember
- * no to use self anymore after calling confirm
+ * no to use self anymore after calling confirm
*/
if (self->confirm)
self->confirm(IAS_CLASS_UNKNOWN, 0, NULL,
@@ -883,22 +880,22 @@
break;
case IAS_ATTRIB_UNKNOWN:
IRDA_DEBUG(1, __FUNCTION__ "(), No such attribute!\n");
- /* Finished, close connection! */
+ /* Finished, close connection! */
iriap_disconnect_request(self);

- /*
+ /*
* Warning, the client might close us, so remember
- * no to use self anymore after calling confirm
+ * no to use self anymore after calling confirm
*/
if (self->confirm)
- self->confirm(IAS_ATTRIB_UNKNOWN, 0, NULL,
+ self->confirm(IAS_ATTRIB_UNKNOWN, 0, NULL,
self->priv);
dev_kfree_skb(skb);
break;
- }
+ }
break;
default:
- IRDA_DEBUG(0, __FUNCTION__ "(), Unknown op-code: %02x\n",
+ IRDA_DEBUG(0, __FUNCTION__ "(), Unknown op-code: %02x\n",
opcode);
dev_kfree_skb(skb);
break;
@@ -927,16 +924,16 @@

opcode = fp[0];
if (~opcode & 0x80) {
- WARNING(__FUNCTION__ "(), IrIAS multiframe commands or results"
- "is not implemented yet!\n");
+ WARNING("%s: IrIAS multiframe commands or results"
+ "is not implemented yet!\n", __FUNCTION__);
return;
}
opcode &= 0x7f; /* Mask away LST bit */
-
+
switch (opcode) {
case GET_INFO_BASE:
- WARNING(__FUNCTION__
- "(), GetInfoBaseDetails not implemented yet!\n");
+ WARNING("%s: GetInfoBaseDetails not implemented yet!\n",
+ __FUNCTION__);
break;
case GET_VALUE_BY_CLASS:
iriap_getvaluebyclass_indication(self, skb);
@@ -953,7 +950,7 @@
void iriap_watchdog_timer_expired(void *data)
{
struct iriap_cb *self = (struct iriap_cb *) data;
-
+
ASSERT(self != NULL, return;);
ASSERT(self->magic == IAS_MAGIC, return;);

@@ -994,23 +991,23 @@
len += sprintf(buf+len, "\n");

/* List all attributes for this object */
- attrib = (struct ias_attrib *)
+ attrib = (struct ias_attrib *)
hashbin_get_first(obj->attribs);
while (attrib != NULL) {
ASSERT(attrib->magic == IAS_ATTRIB_MAGIC, return 0;);

len += sprintf(buf+len, " - Attribute name: \"%s\", ",
attrib->name);
- len += sprintf(buf+len, "value[%s]: ",
+ len += sprintf(buf+len, "value[%s]: ",
ias_value_types[attrib->value->type]);
-
+
switch (attrib->value->type) {
case IAS_INTEGER:
- len += sprintf(buf+len, "%d\n",
+ len += sprintf(buf+len, "%d\n",
attrib->value->t.integer);
break;
case IAS_STRING:
- len += sprintf(buf+len, "\"%s\"\n",
+ len += sprintf(buf+len, "\"%s\"\n",
attrib->value->t.string);
break;
case IAS_OCT_SEQ:
@@ -1020,17 +1017,17 @@
len += sprintf(buf+len, "missing\n");
break;
default:
- IRDA_DEBUG(0, __FUNCTION__
+ IRDA_DEBUG(0, __FUNCTION__
"(), Unknown value type!\n");
return -1;
}
len += sprintf(buf+len, "\n");
-
- attrib = (struct ias_attrib *)
+
+ attrib = (struct ias_attrib *)
hashbin_get_next(obj->attribs);
}
obj = (struct ias_object *) hashbin_get_next(objects);
- }
+ }
restore_flags(flags);

return len;


Attachments:
warn-2.5.21-9.diff (20.92 kB)

2002-06-10 12:43:41

by Martin Dalecki

[permalink] [raw]
Subject: [PATCH] 2.5.21 kill warnings 12/19

diff -urN linux-2.5.21/net/irda/irlap.c linux/net/irda/irlap.c
--- linux-2.5.21/net/irda/irlap.c 2002-06-09 07:29:10.000000000 +0200
+++ linux/net/irda/irlap.c 2002-06-09 21:32:20.000000000 +0200
@@ -1,5 +1,5 @@
/*********************************************************************
- *
+ *
* Filename: irlap.c
* Version: 1.0
* Description: IrLAP implementation for Linux
@@ -8,25 +8,25 @@
* Created at: Mon Aug 4 20:40:53 1997
* Modified at: Tue Dec 14 09:26:44 1999
* Modified by: Dag Brattli <[email protected]>
- *
+ *
* Copyright (c) 1998-1999 Dag Brattli, All Rights Reserved.
* Copyright (c) 2000-2001 Jean Tourrilhes <[email protected]>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
* the License, or (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
* MA 02111-1307 USA
- *
+ *
********************************************************************/

#include <linux/config.h>
@@ -82,7 +82,7 @@
/* Allocate master array */
irlap = hashbin_new(HB_LOCAL);
if (irlap == NULL) {
- ERROR(__FUNCTION__ "(), can't allocate irlap hashbin!\n");
+ ERROR("%s: can't allocate irlap hashbin!\n", __FUNCTION__);
return -ENOMEM;
}

@@ -108,12 +108,12 @@
struct irlap_cb *self;

IRDA_DEBUG(4, __FUNCTION__ "()\n");
-
+
/* Initialize the irlap structure. */
self = kmalloc(sizeof(struct irlap_cb), GFP_KERNEL);
if (self == NULL)
return NULL;
-
+
memset(self, 0, sizeof(struct irlap_cb));
self->magic = LAP_MAGIC;

@@ -145,22 +145,22 @@
init_timer(&self->slot_timer);
init_timer(&self->query_timer);
init_timer(&self->discovery_timer);
- init_timer(&self->final_timer);
+ init_timer(&self->final_timer);
init_timer(&self->poll_timer);
init_timer(&self->wd_timer);
init_timer(&self->backoff_timer);
- init_timer(&self->media_busy_timer);
+ init_timer(&self->media_busy_timer);

irlap_apply_default_connection_parameters(self);

self->N3 = 3; /* # connections attemts to try before giving up */
-
+
self->state = LAP_NDM;

hashbin_insert(irlap, (irda_queue_t *) self, self->saddr, NULL);

irlmp_register_link(self, self->saddr, &self->notify);
-
+
return self;
}

@@ -179,16 +179,16 @@
del_timer(&self->slot_timer);
del_timer(&self->query_timer);
del_timer(&self->discovery_timer);
- del_timer(&self->final_timer);
+ del_timer(&self->final_timer);
del_timer(&self->poll_timer);
del_timer(&self->wd_timer);
del_timer(&self->backoff_timer);
del_timer(&self->media_busy_timer);

irlap_flush_all_queues(self);
-
+
self->magic = 0;
-
+
kfree(self);
}

@@ -198,12 +198,12 @@
* Remove IrLAP instance
*
*/
-void irlap_close(struct irlap_cb *self)
+void irlap_close(struct irlap_cb *self)
{
struct irlap_cb *lap;

IRDA_DEBUG(4, __FUNCTION__ "()\n");
-
+
ASSERT(self != NULL, return;);
ASSERT(self->magic == LAP_MAGIC, return;);

@@ -227,7 +227,7 @@
* Another device is attempting to make a connection
*
*/
-void irlap_connect_indication(struct irlap_cb *self, struct sk_buff *skb)
+void irlap_connect_indication(struct irlap_cb *self, struct sk_buff *skb)
{
IRDA_DEBUG(4, __FUNCTION__ "()\n");

@@ -237,7 +237,7 @@
irlap_init_qos_capabilities(self, NULL); /* No user QoS! */

skb_get(skb); /*LEVEL4*/
- irlmp_link_connect_indication(self->notify.instance, self->saddr,
+ irlmp_link_connect_indication(self->notify.instance, self->saddr,
self->daddr, &self->qos_tx, skb);
}

@@ -247,10 +247,10 @@
* Service user has accepted incoming connection
*
*/
-void irlap_connect_response(struct irlap_cb *self, struct sk_buff *skb)
+void irlap_connect_response(struct irlap_cb *self, struct sk_buff *skb)
{
IRDA_DEBUG(4, __FUNCTION__ "()\n");
-
+
irlap_do_event(self, CONNECT_RESPONSE, skb, NULL);
kfree_skb(skb);
}
@@ -258,26 +258,26 @@
/*
* Function irlap_connect_request (self, daddr, qos_user, sniff)
*
- * Request connection with another device, sniffing is not implemented
+ * Request connection with another device, sniffing is not implemented
* yet.
*
*/
-void irlap_connect_request(struct irlap_cb *self, __u32 daddr,
- struct qos_info *qos_user, int sniff)
+void irlap_connect_request(struct irlap_cb *self, __u32 daddr,
+ struct qos_info *qos_user, int sniff)
{
IRDA_DEBUG(3, __FUNCTION__ "(), daddr=0x%08x\n", daddr);

ASSERT(self != NULL, return;);
ASSERT(self->magic == LAP_MAGIC, return;);

- self->daddr = daddr;
-
+ self->daddr = daddr;
+
/*
- * If the service user specifies QoS values for this connection,
+ * If the service user specifies QoS values for this connection,
* then use them
*/
irlap_init_qos_capabilities(self, qos_user);
-
+
if ((self->state == LAP_NDM) && !self->media_busy)
irlap_do_event(self, CONNECT_REQUEST, NULL, NULL);
else
@@ -304,12 +304,12 @@
/*
* Function irlap_data_indication (self, skb)
*
- * Received data frames from IR-port, so we just pass them up to
+ * Received data frames from IR-port, so we just pass them up to
* IrLMP for further processing
*
*/
void irlap_data_indication(struct irlap_cb *self, struct sk_buff *skb,
- int unreliable)
+ int unreliable)
{
/* Hide LAP header from IrLMP layer */
skb_pull(skb, LAP_ADDR_HEADER+LAP_CTRL_HEADER);
@@ -325,7 +325,7 @@
* Queue data for transmission, must wait until XMIT state
*
*/
-void irlap_data_request(struct irlap_cb *self, struct sk_buff *skb,
+void irlap_data_request(struct irlap_cb *self, struct sk_buff *skb,
int unreliable)
{
ASSERT(self != NULL, return;);
@@ -333,12 +333,12 @@

IRDA_DEBUG(3, __FUNCTION__ "()\n");

- ASSERT(skb_headroom(skb) >= (LAP_ADDR_HEADER+LAP_CTRL_HEADER),
+ ASSERT(skb_headroom(skb) >= (LAP_ADDR_HEADER+LAP_CTRL_HEADER),
return;);
skb_push(skb, LAP_ADDR_HEADER+LAP_CTRL_HEADER);

- /*
- * Must set frame format now so that the rest of the code knows
+ /*
+ * Must set frame format now so that the rest of the code knows
* if its dealing with an I or an UI frame
*/
if (unreliable)
@@ -349,11 +349,11 @@
/* Add at the end of the queue (keep ordering) - Jean II */
skb_queue_tail(&self->txq, skb);

- /*
- * Send event if this frame only if we are in the right state
+ /*
+ * Send event if this frame only if we are in the right state
* FIXME: udata should be sent first! (skb_queue_head?)
*/
- if ((self->state == LAP_XMIT_P) || (self->state == LAP_XMIT_S)) {
+ if ((self->state == LAP_XMIT_P) || (self->state == LAP_XMIT_S)) {
/* If we are not already processing the Tx queue, trigger
* transmission immediately - Jean II */
if((skb_queue_len(&self->txq) <= 1) && (!self->local_busy))
@@ -377,7 +377,7 @@

IRDA_DEBUG(3, __FUNCTION__ "()\n");

- ASSERT(skb_headroom(skb) >= (LAP_ADDR_HEADER+LAP_CTRL_HEADER),
+ ASSERT(skb_headroom(skb) >= (LAP_ADDR_HEADER+LAP_CTRL_HEADER),
return;);
skb_push(skb, LAP_ADDR_HEADER+LAP_CTRL_HEADER);

@@ -399,7 +399,7 @@
#ifdef CONFIG_IRDA_ULTRA
void irlap_unitdata_indication(struct irlap_cb *self, struct sk_buff *skb)
{
- IRDA_DEBUG(1, __FUNCTION__ "()\n");
+ IRDA_DEBUG(1, __FUNCTION__ "()\n");

ASSERT(self != NULL, return;);
ASSERT(self->magic == LAP_MAGIC, return;);
@@ -418,17 +418,17 @@
*
* Request to disconnect connection by service user
*/
-void irlap_disconnect_request(struct irlap_cb *self)
+void irlap_disconnect_request(struct irlap_cb *self)
{
IRDA_DEBUG(3, __FUNCTION__ "()\n");

ASSERT(self != NULL, return;);
ASSERT(self->magic == LAP_MAGIC, return;);
-
+
/* Don't disconnect until all data frames are successfully sent */
if (skb_queue_len(&self->txq) > 0) {
self->disconnect_pending = TRUE;
-
+
return;
}

@@ -436,9 +436,9 @@
switch (self->state) {
case LAP_XMIT_P: /* FALLTROUGH */
case LAP_XMIT_S: /* FALLTROUGH */
- case LAP_CONN: /* FALLTROUGH */
- case LAP_RESET_WAIT: /* FALLTROUGH */
- case LAP_RESET_CHECK:
+ case LAP_CONN: /* FALLTROUGH */
+ case LAP_RESET_WAIT: /* FALLTROUGH */
+ case LAP_RESET_CHECK:
irlap_do_event(self, DISCONNECT_REQUEST, NULL, NULL);
break;
default:
@@ -454,30 +454,30 @@
* Disconnect request from other device
*
*/
-void irlap_disconnect_indication(struct irlap_cb *self, LAP_REASON reason)
+void irlap_disconnect_indication(struct irlap_cb *self, LAP_REASON reason)
{
- IRDA_DEBUG(1, __FUNCTION__ "(), reason=%s\n", lap_reasons[reason]);
+ IRDA_DEBUG(1, __FUNCTION__ "(), reason=%s\n", lap_reasons[reason]);

ASSERT(self != NULL, return;);
ASSERT(self->magic == LAP_MAGIC, return;);

/* Flush queues */
irlap_flush_all_queues(self);
-
+
switch (reason) {
case LAP_RESET_INDICATION:
IRDA_DEBUG(1, __FUNCTION__ "(), Sending reset request!\n");
irlap_do_event(self, RESET_REQUEST, NULL, NULL);
break;
- case LAP_NO_RESPONSE: /* FALLTROUGH */
+ case LAP_NO_RESPONSE: /* FALLTROUGH */
case LAP_DISC_INDICATION: /* FALLTROUGH */
case LAP_FOUND_NONE: /* FALLTROUGH */
case LAP_MEDIA_BUSY:
- irlmp_link_disconnect_indication(self->notify.instance, self,
+ irlmp_link_disconnect_indication(self->notify.instance, self,
reason, NULL);
break;
default:
- ERROR(__FUNCTION__ "(), Unknown reason %d\n", reason);
+ ERROR("%s: Unknown reason %d\n", __FUNCTION__, reason);
}
}

@@ -487,23 +487,23 @@
* Start one single discovery operation.
*
*/
-void irlap_discovery_request(struct irlap_cb *self, discovery_t *discovery)
+void irlap_discovery_request(struct irlap_cb *self, discovery_t *discovery)
{
struct irlap_info info;
-
+
ASSERT(self != NULL, return;);
ASSERT(self->magic == LAP_MAGIC, return;);
ASSERT(discovery != NULL, return;);
-
+
IRDA_DEBUG(4, __FUNCTION__ "(), nslots = %d\n", discovery->nslots);

ASSERT((discovery->nslots == 1) || (discovery->nslots == 6) ||
- (discovery->nslots == 8) || (discovery->nslots == 16),
+ (discovery->nslots == 8) || (discovery->nslots == 16),
return;);
-
- /* Discovery is only possible in NDM mode */
+
+ /* Discovery is only possible in NDM mode */
if (self->state != LAP_NDM) {
- IRDA_DEBUG(4, __FUNCTION__
+ IRDA_DEBUG(4, __FUNCTION__
"(), discovery only possible in NDM mode\n");
irlap_discovery_confirm(self, NULL);
/* Note : in theory, if we are not in NDM, we could postpone
@@ -521,18 +521,18 @@
hashbin_delete(self->discovery_log, (FREE_FUNC) kfree);
self->discovery_log = NULL;
}
-
+
self->discovery_log= hashbin_new(HB_LOCAL);
-
+
info.S = discovery->nslots; /* Number of slots */
info.s = 0; /* Current slot */
-
+
self->discovery_cmd = discovery;
info.discovery = discovery;
-
+
/* sysctl_slot_timeout bounds are checked in irsysctl.c - Jean II */
self->slot_timeout = sysctl_slot_timeout * HZ / 1000;
-
+
irlap_do_event(self, DISCOVERY_REQUEST, NULL, &info);
}

@@ -542,15 +542,15 @@
* A device has been discovered in front of this station, we
* report directly to LMP.
*/
-void irlap_discovery_confirm(struct irlap_cb *self, hashbin_t *discovery_log)
+void irlap_discovery_confirm(struct irlap_cb *self, hashbin_t *discovery_log)
{
ASSERT(self != NULL, return;);
ASSERT(self->magic == LAP_MAGIC, return;);
-
+
ASSERT(self->notify.instance != NULL, return;);
-
- /*
- * Check for successful discovery, since we are then allowed to clear
+
+ /*
+ * Check for successful discovery, since we are then allowed to clear
* the media busy condition (IrLAP 6.13.4 - p.94). This should allow
* us to make connection attempts much faster and easier (i.e. no
* collisions).
@@ -562,7 +562,7 @@
*/
if (discovery_log)
irda_device_set_media_busy(self->netdev, FALSE);
-
+
/* Inform IrLMP */
irlmp_link_discovery_confirm(self->notify.instance, discovery_log);
}
@@ -573,7 +573,7 @@
* Somebody is trying to discover us!
*
*/
-void irlap_discovery_indication(struct irlap_cb *self, discovery_t *discovery)
+void irlap_discovery_indication(struct irlap_cb *self, discovery_t *discovery)
{
IRDA_DEBUG(4, __FUNCTION__ "()\n");

@@ -599,11 +599,8 @@

/*
* Function irlap_status_indication (quality_of_link)
- *
- *
- *
*/
-void irlap_status_indication(struct irlap_cb *self, int quality_of_link)
+void irlap_status_indication(struct irlap_cb *self, int quality_of_link)
{
switch (quality_of_link) {
case STATUS_NO_ACTIVITY:
@@ -621,9 +618,6 @@

/*
* Function irlap_reset_indication (void)
- *
- *
- *
*/
void irlap_reset_indication(struct irlap_cb *self)
{
@@ -631,7 +625,7 @@

ASSERT(self != NULL, return;);
ASSERT(self->magic == LAP_MAGIC, return;);
-
+
if (self->state == LAP_RESET_WAIT)
irlap_do_event(self, RESET_REQUEST, NULL, NULL);
else
@@ -640,13 +634,10 @@

/*
* Function irlap_reset_confirm (void)
- *
- *
- *
*/
void irlap_reset_confirm(void)
{
- IRDA_DEBUG(1, __FUNCTION__ "()\n");
+ IRDA_DEBUG(1, __FUNCTION__ "()\n");
}

/*
@@ -656,11 +647,11 @@
* S = Number of slots (0 -> S-1)
* s = Current slot
*/
-int irlap_generate_rand_time_slot(int S, int s)
+int irlap_generate_rand_time_slot(int S, int s)
{
static int rand;
int slot;
-
+
ASSERT((S - s) > 0, return 0;);

rand += jiffies;
@@ -668,20 +659,20 @@
rand ^= (rand >> 20);

slot = s + rand % (S-s);
-
+
ASSERT((slot >= s) || (slot < S), return 0;);
-
+
return slot;
}

/*
* Function irlap_update_nr_received (nr)
*
- * Remove all acknowledged frames in current window queue. This code is
+ * Remove all acknowledged frames in current window queue. This code is
* not intuitive and you should not try to change it. If you think it
* contains bugs, please mail a patch to the author instead.
*/
-void irlap_update_nr_received(struct irlap_cb *self, int nr)
+void irlap_update_nr_received(struct irlap_cb *self, int nr)
{
struct sk_buff *skb = NULL;
int count = 0;
@@ -690,7 +681,7 @@
* Remove all the ack-ed frames from the window queue.
*/

- /*
+ /*
* Optimize for the common case. It is most likely that the receiver
* will acknowledge all the frames we have sent! So in that case we
* delete all frames stored in window.
@@ -703,17 +694,17 @@
self->va = nr - 1;
} else {
/* Remove all acknowledged frames in current window */
- while ((skb_peek(&self->wx_list) != NULL) &&
- (((self->va+1) % 8) != nr))
+ while ((skb_peek(&self->wx_list) != NULL) &&
+ (((self->va+1) % 8) != nr))
{
skb = skb_dequeue(&self->wx_list);
dev_kfree_skb(skb);
-
+
self->va = (self->va + 1) % 8;
count++;
}
}
-
+
/* Advance window */
self->window = self->window_size - skb_queue_len(&self->wx_list);
}
@@ -723,7 +714,7 @@
*
* Validate the next to send (ns) field from received frame.
*/
-int irlap_validate_ns_received(struct irlap_cb *self, int ns)
+int irlap_validate_ns_received(struct irlap_cb *self, int ns)
{
/* ns as expected? */
if (ns == self->vr)
@@ -733,7 +724,7 @@
* IrLAP, Recv ... with-invalid-Ns. p. 84
*/
return NS_UNEXPECTED;
-
+
/* return NR_INVALID; */
}
/*
@@ -742,7 +733,7 @@
* Validate the next to receive (nr) field from received frame.
*
*/
-int irlap_validate_nr_received(struct irlap_cb *self, int nr)
+int irlap_validate_nr_received(struct irlap_cb *self, int nr)
{
/* nr as expected? */
if (nr == self->vs) {
@@ -751,17 +742,17 @@
}

/*
- * unexpected nr? (but within current window), first we check if the
+ * unexpected nr? (but within current window), first we check if the
* ns numbers of the frames in the current window wrap.
*/
if (self->va < self->vs) {
if ((nr >= self->va) && (nr <= self->vs))
return NR_UNEXPECTED;
} else {
- if ((nr >= self->va) || (nr <= self->vs))
+ if ((nr >= self->va) || (nr <= self->vs))
return NR_UNEXPECTED;
}
-
+
/* Invalid nr! */
return NR_INVALID;
}
@@ -772,10 +763,10 @@
* Initialize the connection state parameters
*
*/
-void irlap_initiate_connection_state(struct irlap_cb *self)
+void irlap_initiate_connection_state(struct irlap_cb *self)
{
IRDA_DEBUG(4, __FUNCTION__ "()\n");
-
+
ASSERT(self != NULL, return;);
ASSERT(self->magic == LAP_MAGIC, return;);

@@ -799,11 +790,11 @@
* frame in order to delay for the specified amount of time. This is
* done to avoid using timers, and the forbidden udelay!
*/
-void irlap_wait_min_turn_around(struct irlap_cb *self, struct qos_info *qos)
+void irlap_wait_min_turn_around(struct irlap_cb *self, struct qos_info *qos)
{
__u32 min_turn_time;
__u32 speed;
-
+
/* Get QoS values. */
speed = qos->baud_rate.value;
min_turn_time = qos->min_turn_time.value;
@@ -813,10 +804,10 @@
self->mtt_required = min_turn_time;
return;
}
-
- /*
+
+ /*
* Send additional BOF's for the next frame for the requested
- * min turn time, so now we must calculate how many chars (XBOF's) we
+ * min turn time, so now we must calculate how many chars (XBOF's) we
* must send for the requested time period (min turn time)
*/
self->xbofs_delay = irlap_min_turn_time_in_bytes(speed, min_turn_time);
@@ -828,7 +819,7 @@
* Flush all queues
*
*/
-void irlap_flush_all_queues(struct irlap_cb *self)
+void irlap_flush_all_queues(struct irlap_cb *self)
{
struct sk_buff* skb;

@@ -838,7 +829,7 @@
/* Free transmission queue */
while ((skb = skb_dequeue(&self->txq)) != NULL)
dev_kfree_skb(skb);
-
+
while ((skb = skb_dequeue(&self->txq_ultra)) != NULL)
dev_kfree_skb(skb);

@@ -894,7 +885,7 @@
irda_qos_compute_intersection(&self->qos_rx, self->qos_dev);

/*
- * Check for user supplied QoS parameters. The service user is only
+ * Check for user supplied QoS parameters. The service user is only
* allowed to supply these values. We check each parameter since the
* user may not have set all of them.
*/
@@ -926,7 +917,6 @@
* Function irlap_apply_default_connection_parameters (void, now)
*
* Use the default connection and transmission parameters
- *
*/
void irlap_apply_default_connection_parameters(struct irlap_cb *self)
{
@@ -945,9 +935,9 @@
/* Set mbusy when going to NDM state */
irda_device_set_media_busy(self->netdev, TRUE);

- /*
+ /*
* Generate random connection address for this session, which must
- * be 7 bits wide and different from 0x00 and 0xfe
+ * be 7 bits wide and different from 0x00 and 0xfe
*/
while ((self->caddr == 0x00) || (self->caddr == 0xfe)) {
get_random_bytes(&self->caddr, sizeof(self->caddr));
@@ -991,10 +981,10 @@
* frame is sent.
* If 'now' is true, the speed and xbofs is changed immediately
*/
-void irlap_apply_connection_parameters(struct irlap_cb *self, int now)
+void irlap_apply_connection_parameters(struct irlap_cb *self, int now)
{
IRDA_DEBUG(4, __FUNCTION__ "()\n");
-
+
ASSERT(self != NULL, return;);
ASSERT(self->magic == LAP_MAGIC, return;);

@@ -1014,15 +1004,15 @@
* Calculate how many bytes it is possible to transmit before the
* link must be turned around
*/
- self->line_capacity =
+ self->line_capacity =
irlap_max_line_capacity(self->qos_tx.baud_rate.value,
self->qos_tx.max_turn_time.value);
self->bytes_left = self->line_capacity;
#endif /* CONFIG_IRDA_DYNAMIC_WINDOW */

-
- /*
- * Initialize timeout values, some of the rules are listed on
+
+ /*
+ * Initialize timeout values, some of the rules are listed on
* page 92 in IrLAP.
*/
ASSERT(self->qos_tx.max_turn_time.value != 0, return;);
@@ -1056,27 +1046,27 @@
*/

/*
- * Set N1 to 0 if Link Disconnect/Threshold Time = 3 and set it to
+ * Set N1 to 0 if Link Disconnect/Threshold Time = 3 and set it to
* 3 seconds otherwise. See page 71 in IrLAP for more details.
* Actually, it's not always 3 seconds, as we allow to set
* it via sysctl... Max maxtt is 500ms, and N1 need to be multiple
* of 2, so 1 second is minimum we can allow. - Jean II
*/
if (self->qos_tx.link_disc_time.value == sysctl_warn_noreply_time)
- /*
+ /*
* If we set N1 to 0, it will trigger immediately, which is
* not what we want. What we really want is to disable it,
- * Jean II
+ * Jean II
*/
self->N1 = -2; /* Disable - Need to be multiple of 2*/
else
self->N1 = sysctl_warn_noreply_time * 1000 /
self->qos_rx.max_turn_time.value;
-
+
IRDA_DEBUG(4, "Setting N1 = %d\n", self->N1);
-
+
/* Set N2 to match our own disconnect time */
- self->N2 = self->qos_tx.link_disc_time.value * 1000 /
+ self->N2 = self->qos_tx.link_disc_time.value * 1000 /
self->qos_rx.max_turn_time.value;
IRDA_DEBUG(4, "Setting N2 = %d\n", self->N2);
}
@@ -1093,7 +1083,7 @@
struct irlap_cb *self;
unsigned long flags;
int i = 0;
-
+
save_flags(flags);
cli();

@@ -1105,9 +1095,9 @@
ASSERT(self->magic == LAP_MAGIC, return -EBADR;);

len += sprintf(buf+len, "irlap%d ", i++);
- len += sprintf(buf+len, "state: %s\n",
+ len += sprintf(buf+len, "state: %s\n",
irlap_state[self->state]);
-
+
len += sprintf(buf+len, " device name: %s, ",
(self->netdev) ? self->netdev->name : "bug");
len += sprintf(buf+len, "hardware name: %s\n", self->hw_name);
@@ -1115,34 +1105,34 @@
len += sprintf(buf+len, " caddr: %#02x, ", self->caddr);
len += sprintf(buf+len, "saddr: %#08x, ", self->saddr);
len += sprintf(buf+len, "daddr: %#08x\n", self->daddr);
-
- len += sprintf(buf+len, " win size: %d, ",
+
+ len += sprintf(buf+len, " win size: %d, ",
self->window_size);
len += sprintf(buf+len, "win: %d, ", self->window);
#if CONFIG_IRDA_DYNAMIC_WINDOW
- len += sprintf(buf+len, "line capacity: %d, ",
+ len += sprintf(buf+len, "line capacity: %d, ",
self->line_capacity);
len += sprintf(buf+len, "bytes left: %d\n", self->bytes_left);
#endif /* CONFIG_IRDA_DYNAMIC_WINDOW */
- len += sprintf(buf+len, " tx queue len: %d ",
+ len += sprintf(buf+len, " tx queue len: %d ",
skb_queue_len(&self->txq));
- len += sprintf(buf+len, "win queue len: %d ",
+ len += sprintf(buf+len, "win queue len: %d ",
skb_queue_len(&self->wx_list));
len += sprintf(buf+len, "rbusy: %s", self->remote_busy ?
"TRUE" : "FALSE");
len += sprintf(buf+len, " mbusy: %s\n", self->media_busy ?
"TRUE" : "FALSE");
-
+
len += sprintf(buf+len, " retrans: %d ", self->retry_count);
len += sprintf(buf+len, "vs: %d ", self->vs);
len += sprintf(buf+len, "vr: %d ", self->vr);
len += sprintf(buf+len, "va: %d\n", self->va);
-
+
len += sprintf(buf+len, " qos\tbps\tmaxtt\tdsize\twinsize\taddbofs\tmintt\tldisc\tcomp\n");
-
- len += sprintf(buf+len, " tx\t%d\t",
+
+ len += sprintf(buf+len, " tx\t%d\t",
self->qos_tx.baud_rate.value);
- len += sprintf(buf+len, "%d\t",
+ len += sprintf(buf+len, "%d\t",
self->qos_tx.max_turn_time.value);
len += sprintf(buf+len, "%d\t",
self->qos_tx.data_size.value);
@@ -1150,15 +1140,15 @@
self->qos_tx.window_size.value);
len += sprintf(buf+len, "%d\t",
self->qos_tx.additional_bofs.value);
- len += sprintf(buf+len, "%d\t",
+ len += sprintf(buf+len, "%d\t",
self->qos_tx.min_turn_time.value);
- len += sprintf(buf+len, "%d\t",
+ len += sprintf(buf+len, "%d\t",
self->qos_tx.link_disc_time.value);
len += sprintf(buf+len, "\n");

- len += sprintf(buf+len, " rx\t%d\t",
+ len += sprintf(buf+len, " rx\t%d\t",
self->qos_rx.baud_rate.value);
- len += sprintf(buf+len, "%d\t",
+ len += sprintf(buf+len, "%d\t",
self->qos_rx.max_turn_time.value);
len += sprintf(buf+len, "%d\t",
self->qos_rx.data_size.value);
@@ -1166,12 +1156,12 @@
self->qos_rx.window_size.value);
len += sprintf(buf+len, "%d\t",
self->qos_rx.additional_bofs.value);
- len += sprintf(buf+len, "%d\t",
+ len += sprintf(buf+len, "%d\t",
self->qos_rx.min_turn_time.value);
- len += sprintf(buf+len, "%d\t",
+ len += sprintf(buf+len, "%d\t",
self->qos_rx.link_disc_time.value);
len += sprintf(buf+len, "\n");
-
+
self = (struct irlap_cb *) hashbin_get_next(irlap);
}
restore_flags(flags);
@@ -1180,4 +1170,3 @@
}

#endif /* CONFIG_PROC_FS */
-


Attachments:
warn-2.5.21-12.diff (24.89 kB)

2002-06-10 12:47:16

by Martin Dalecki

[permalink] [raw]
Subject: [PATCH] 2.5.21 kill warnings 15/19

diff -urN linux-2.5.21/net/irda/irlmp.c linux/net/irda/irlmp.c
--- linux-2.5.21/net/irda/irlmp.c 2002-06-09 07:31:21.000000000 +0200
+++ linux/net/irda/irlmp.c 2002-06-09 21:46:26.000000000 +0200
@@ -1,25 +1,25 @@
/*********************************************************************
- *
+ *
* Filename: irlmp.c
* Version: 1.0
- * Description: IrDA Link Management Protocol (LMP) layer
+ * Description: IrDA Link Management Protocol (LMP) layer
* Status: Stable.
* Author: Dag Brattli <[email protected]>
* Created at: Sun Aug 17 20:54:32 1997
* Modified at: Wed Jan 5 11:26:03 2000
* Modified by: Dag Brattli <[email protected]>
- *
- * Copyright (c) 1998-2000 Dag Brattli <[email protected]>,
+ *
+ * Copyright (c) 1998-2000 Dag Brattli <[email protected]>,
* All Rights Reserved.
* Copyright (c) 2000-2001 Jean Tourrilhes <[email protected]>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
* the License, or (at your option) any later version.
*
* Neither Dag Brattli nor University of Troms? admit liability nor
- * provide warranty for any of this software. This material is
+ * provide warranty for any of this software. This material is
* provided "AS-IS" and at no charge.
*
********************************************************************/
@@ -82,7 +82,7 @@
if (irlmp == NULL)
return -ENOMEM;
memset(irlmp, 0, sizeof(struct irlmp_cb));
-
+
irlmp->magic = LMP_MAGIC;
spin_lock_init(&irlmp->log_lock);

@@ -91,13 +91,13 @@
irlmp->links = hashbin_new(HB_GLOBAL);
irlmp->unconnected_lsaps = hashbin_new(HB_GLOBAL);
irlmp->cachelog = hashbin_new(HB_GLOBAL);
-
+
irlmp->free_lsap_sel = 0x10; /* Reserved 0x00-0x0f */
strcpy(sysctl_devname, "Linux");
-
+
/* Do discovery every 3 seconds */
init_timer(&irlmp->discovery_timer);
- irlmp_start_discovery_timer(irlmp, sysctl_discovery_timeout*HZ);
+ irlmp_start_discovery_timer(irlmp, sysctl_discovery_timeout*HZ);

return 0;
}
@@ -108,20 +108,20 @@
* Remove IrLMP layer
*
*/
-void irlmp_cleanup(void)
+void irlmp_cleanup(void)
{
/* Check for main structure */
ASSERT(irlmp != NULL, return;);
ASSERT(irlmp->magic == LMP_MAGIC, return;);

del_timer(&irlmp->discovery_timer);
-
+
hashbin_delete(irlmp->links, (FREE_FUNC) kfree);
hashbin_delete(irlmp->unconnected_lsaps, (FREE_FUNC) kfree);
hashbin_delete(irlmp->clients, (FREE_FUNC) kfree);
hashbin_delete(irlmp->services, (FREE_FUNC) kfree);
hashbin_delete(irlmp->cachelog, (FREE_FUNC) kfree);
-
+
/* De-allocate main structure */
kfree(irlmp);
irlmp = NULL;
@@ -152,11 +152,11 @@
/* Allocate new instance of a LSAP connection */
self = kmalloc(sizeof(struct lsap_cb), GFP_ATOMIC);
if (self == NULL) {
- ERROR(__FUNCTION__ "(), can't allocate memory");
+ ERROR("%s: can't allocate memory", __FUNCTION__);
return NULL;
}
memset(self, 0, sizeof(struct lsap_cb));
-
+
self->magic = LMP_LSAP_MAGIC;
self->slsap_sel = slsap_sel;

@@ -176,11 +176,11 @@
self->notify = *notify;

self->lsap_state = LSAP_DISCONNECTED;
-
+
/* Insert into queue of unconnected LSAPs */
hashbin_insert(irlmp->unconnected_lsaps, (irda_queue_t *) self, (int) self,
NULL);
-
+
return self;
}

@@ -247,11 +247,11 @@
self->lap = NULL;
/* Check if we found the LSAP! If not then try the unconnected lsaps */
if (!lsap) {
- lsap = hashbin_remove(irlmp->unconnected_lsaps, (int) self,
+ lsap = hashbin_remove(irlmp->unconnected_lsaps, (int) self,
NULL);
}
if (!lsap) {
- IRDA_DEBUG(0, __FUNCTION__
+ IRDA_DEBUG(0, __FUNCTION__
"(), Looks like somebody has removed me already!\n");
return;
}
@@ -278,11 +278,11 @@
*/
lap = kmalloc(sizeof(struct lap_cb), GFP_KERNEL);
if (lap == NULL) {
- ERROR(__FUNCTION__ "(), unable to kmalloc\n");
+ ERROR("%s: unable to kmalloc\n", __FUNCTION__);
return;
}
memset(lap, 0, sizeof(struct lap_cb));
-
+
lap->irlap = irlap;
lap->magic = LMP_LAP_MAGIC;
lap->saddr = saddr;
@@ -293,7 +293,7 @@
#endif

lap->lap_state = LAP_STANDBY;
-
+
init_timer(&lap->idle_timer);

/*
@@ -301,9 +301,9 @@
*/
hashbin_insert(irlmp->links, (irda_queue_t *) lap, lap->saddr, NULL);

- /*
+ /*
* We set only this variable so IrLAP can tell us on which link the
- * different events happened on
+ * different events happened on
*/
irda_notify_init(notify);
notify->instance = lap;
@@ -328,7 +328,7 @@
/* Remove all discoveries discovered at this link */
irlmp_expire_discoveries(irlmp->cachelog, link->saddr, TRUE);

- del_timer(&link->idle_timer);
+ del_timer(&link->idle_timer);

link->magic = 0;
kfree(link);
@@ -338,12 +338,12 @@
/*
* Function irlmp_connect_request (handle, dlsap, userdata)
*
- * Connect with a peer LSAP
+ * Connect with a peer LSAP
*
*/
-int irlmp_connect_request(struct lsap_cb *self, __u8 dlsap_sel,
- __u32 saddr, __u32 daddr,
- struct qos_info *qos, struct sk_buff *userdata)
+int irlmp_connect_request(struct lsap_cb *self, __u8 dlsap_sel,
+ __u32 saddr, __u32 daddr,
+ struct qos_info *qos, struct sk_buff *userdata)
{
struct sk_buff *skb = NULL;
struct lap_cb *lap;
@@ -352,18 +352,18 @@

ASSERT(self != NULL, return -EBADR;);
ASSERT(self->magic == LMP_LSAP_MAGIC, return -EBADR;);
-
- IRDA_DEBUG(2, __FUNCTION__
- "(), slsap_sel=%02x, dlsap_sel=%02x, saddr=%08x, daddr=%08x\n",
+
+ IRDA_DEBUG(2, __FUNCTION__
+ "(), slsap_sel=%02x, dlsap_sel=%02x, saddr=%08x, daddr=%08x\n",
self->slsap_sel, dlsap_sel, saddr, daddr);
-
+
if (test_bit(0, &self->connected))
return -EISCONN;
-
+
/* Client must supply destination device address */
if (!daddr)
return -EINVAL;
-
+
/* Any userdata? */
if (userdata == NULL) {
skb = dev_alloc_skb(64);
@@ -373,27 +373,27 @@
skb_reserve(skb, LMP_MAX_HEADER);
} else
skb = userdata;
-
+
/* Make room for MUX control header (3 bytes) */
ASSERT(skb_headroom(skb) >= LMP_CONTROL_HEADER, return -1;);
skb_push(skb, LMP_CONTROL_HEADER);

self->dlsap_sel = dlsap_sel;
-
- /*
+
+ /*
* Find the link to where we should try to connect since there may
* be more than one IrDA port on this machine. If the client has
* passed us the saddr (and already knows which link to use), then
* we use that to find the link, if not then we have to look in the
* discovery log and check if any of the links has discovered a
- * device with the given daddr
+ * device with the given daddr
*/
if ((!saddr) || (saddr == DEV_ADDR_ANY)) {
if (daddr != DEV_ADDR_ANY)
discovery = hashbin_find(irlmp->cachelog, daddr, NULL);
else {
IRDA_DEBUG(2, __FUNCTION__ "(), no daddr\n");
- discovery = (discovery_t *)
+ discovery = (discovery_t *)
hashbin_get_first(irlmp->cachelog);
}

@@ -402,7 +402,7 @@
daddr = discovery->daddr;
}
}
- lap = hashbin_find(irlmp->links, saddr, NULL);
+ lap = hashbin_find(irlmp->links, saddr, NULL);
if (lap == NULL) {
IRDA_DEBUG(1, __FUNCTION__ "(), Unable to find a usable link!\n");
return -EHOSTUNREACH;
@@ -433,9 +433,9 @@

self->lap = lap;

- /*
- * Remove LSAP from list of unconnected LSAPs and insert it into the
- * list of connected LSAPs for the particular link
+ /*
+ * Remove LSAP from list of unconnected LSAPs and insert it into the
+ * list of connected LSAPs for the particular link
*/
lsap = hashbin_remove(irlmp->unconnected_lsaps, (int) self, NULL);

@@ -447,13 +447,13 @@
hashbin_insert(self->lap->lsaps, (irda_queue_t *) self, (int) self, NULL);

set_bit(0, &self->connected); /* TRUE */
-
+
/*
* User supplied qos specifications?
*/
if (qos)
self->qos = *qos;
-
+
irlmp_do_lsap_event(self, LM_CONNECT_REQUEST, skb);

return 0;
@@ -465,18 +465,18 @@
* Incoming connection
*
*/
-void irlmp_connect_indication(struct lsap_cb *self, struct sk_buff *skb)
+void irlmp_connect_indication(struct lsap_cb *self, struct sk_buff *skb)
{
int max_seg_size;
int lap_header_size;
int max_header_size;
-
+
ASSERT(self != NULL, return;);
ASSERT(self->magic == LMP_LSAP_MAGIC, return;);
ASSERT(skb != NULL, return;);
ASSERT(self->lap != NULL, return;);

- IRDA_DEBUG(2, __FUNCTION__ "(), slsap_sel=%02x, dlsap_sel=%02x\n",
+ IRDA_DEBUG(2, __FUNCTION__ "(), slsap_sel=%02x, dlsap_sel=%02x\n",
self->slsap_sel, self->dlsap_sel);

/* Note : self->lap is set in irlmp_link_data_indication(),
@@ -492,10 +492,10 @@

/* Hide LMP_CONTROL_HEADER header from layer above */
skb_pull(skb, LMP_CONTROL_HEADER);
-
+
if (self->notify.connect_indication)
- self->notify.connect_indication(self->notify.instance, self,
- &self->qos, max_seg_size,
+ self->notify.connect_indication(self->notify.instance, self,
+ &self->qos, max_seg_size,
max_header_size, skb);
else
dev_kfree_skb(skb);
@@ -507,7 +507,7 @@
* Service user is accepting connection
*
*/
-int irlmp_connect_response(struct lsap_cb *self, struct sk_buff *userdata)
+int irlmp_connect_response(struct lsap_cb *self, struct sk_buff *userdata)
{
ASSERT(self != NULL, return -1;);
ASSERT(self->magic == LMP_LSAP_MAGIC, return -1;);
@@ -515,13 +515,13 @@

set_bit(0, &self->connected); /* TRUE */

- IRDA_DEBUG(2, __FUNCTION__ "(), slsap_sel=%02x, dlsap_sel=%02x\n",
+ IRDA_DEBUG(2, __FUNCTION__ "(), slsap_sel=%02x, dlsap_sel=%02x\n",
self->slsap_sel, self->dlsap_sel);

/* Make room for MUX control header (3 bytes) */
ASSERT(skb_headroom(userdata) >= LMP_CONTROL_HEADER, return -1;);
skb_push(userdata, LMP_CONTROL_HEADER);
-
+
irlmp_do_lsap_event(self, LM_CONNECT_RESPONSE, userdata);

return 0;
@@ -532,26 +532,26 @@
*
* LSAP connection confirmed peer device!
*/
-void irlmp_connect_confirm(struct lsap_cb *self, struct sk_buff *skb)
+void irlmp_connect_confirm(struct lsap_cb *self, struct sk_buff *skb)
{
int max_header_size;
int lap_header_size;
int max_seg_size;

IRDA_DEBUG(3, __FUNCTION__ "()\n");
-
+
ASSERT(skb != NULL, return;);
ASSERT(self != NULL, return;);
- ASSERT(self->magic == LMP_LSAP_MAGIC, return;);
+ ASSERT(self->magic == LMP_LSAP_MAGIC, return;);
ASSERT(self->lap != NULL, return;);

self->qos = *self->lap->qos;

max_seg_size = self->lap->qos->data_size.value-LMP_HEADER;
- lap_header_size = IRLAP_GET_HEADER_SIZE(self->lap->irlap);
+ lap_header_size = IRLAP_GET_HEADER_SIZE(self->lap->irlap);
max_header_size = LMP_HEADER + lap_header_size;

- IRDA_DEBUG(2, __FUNCTION__ "(), max_header_size=%d\n",
+ IRDA_DEBUG(2, __FUNCTION__ "(), max_header_size=%d\n",
max_header_size);

/* Hide LMP_CONTROL_HEADER header from layer above */
@@ -572,7 +572,7 @@
* new LSAP so it can keep listening on the old one.
*
*/
-struct lsap_cb *irlmp_dup(struct lsap_cb *orig, void *instance)
+struct lsap_cb *irlmp_dup(struct lsap_cb *orig, void *instance)
{
struct lsap_cb *new;

@@ -595,8 +595,8 @@
/* new->slsap_sel = orig->slsap_sel; => done in the memcpy() */

init_timer(&new->watchdog_timer);
-
- hashbin_insert(irlmp->unconnected_lsaps, (irda_queue_t *) new, (int) new,
+
+ hashbin_insert(irlmp->unconnected_lsaps, (irda_queue_t *) new, (int) new,
NULL);

/* Make sure that we invalidate the cache */
@@ -610,10 +610,10 @@
/*
* Function irlmp_disconnect_request (handle, userdata)
*
- * The service user is requesting disconnection, this will not remove the
+ * The service user is requesting disconnection, this will not remove the
* LSAP, but only mark it as disconnected
*/
-int irlmp_disconnect_request(struct lsap_cb *self, struct sk_buff *userdata)
+int irlmp_disconnect_request(struct lsap_cb *self, struct sk_buff *userdata)
{
struct lsap_cb *lsap;

@@ -633,13 +633,13 @@

skb_push(userdata, LMP_CONTROL_HEADER);

- /*
+ /*
* Do the event before the other stuff since we must know
* which lap layer that the frame should be transmitted on
*/
irlmp_do_lsap_event(self, LM_DISCONNECT_REQUEST, userdata);

- /*
+ /*
* Remove LSAP from list of connected LSAPs for the particular link
* and insert it into the list of unconnected LSAPs
*/
@@ -653,13 +653,13 @@
ASSERT(lsap->magic == LMP_LSAP_MAGIC, return -1;);
ASSERT(lsap == self, return -1;);

- hashbin_insert(irlmp->unconnected_lsaps, (irda_queue_t *) self, (int) self,
+ hashbin_insert(irlmp->unconnected_lsaps, (irda_queue_t *) self, (int) self,
NULL);
-
+
/* Reset some values */
self->dlsap_sel = LSAP_ANY;
self->lap = NULL;
-
+
return 0;
}

@@ -668,8 +668,8 @@
*
* LSAP is being closed!
*/
-void irlmp_disconnect_indication(struct lsap_cb *self, LM_REASON reason,
- struct sk_buff *userdata)
+void irlmp_disconnect_indication(struct lsap_cb *self, LM_REASON reason,
+ struct sk_buff *userdata)
{
struct lsap_cb *lsap;

@@ -677,7 +677,7 @@
ASSERT(self != NULL, return;);
ASSERT(self->magic == LMP_LSAP_MAGIC, return;);

- IRDA_DEBUG(3, __FUNCTION__ "(), slsap_sel=%02x, dlsap_sel=%02x\n",
+ IRDA_DEBUG(3, __FUNCTION__ "(), slsap_sel=%02x, dlsap_sel=%02x\n",
self->slsap_sel, self->dlsap_sel);

/* Already disconnected ?
@@ -691,12 +691,12 @@
return;
}

- /*
- * Remove association between this LSAP and the link it used
+ /*
+ * Remove association between this LSAP and the link it used
*/
ASSERT(self->lap != NULL, return;);
ASSERT(self->lap->lsaps != NULL, return;);
-
+
lsap = hashbin_remove(self->lap->lsaps, (int) self, NULL);
#ifdef CONFIG_IRDA_CACHE_LAST_LSAP
self->lap->cache.valid = FALSE;
@@ -704,17 +704,17 @@

ASSERT(lsap != NULL, return;);
ASSERT(lsap == self, return;);
- hashbin_insert(irlmp->unconnected_lsaps, (irda_queue_t *) lsap, (int) lsap,
+ hashbin_insert(irlmp->unconnected_lsaps, (irda_queue_t *) lsap, (int) lsap,
NULL);

self->dlsap_sel = LSAP_ANY;
self->lap = NULL;
-
+
/*
* Inform service user
*/
if (self->notify.disconnect_indication)
- self->notify.disconnect_indication(self->notify.instance,
+ self->notify.disconnect_indication(self->notify.instance,
self, reason, userdata);
else {
IRDA_DEBUG(0, __FUNCTION__ "(), no handler\n");
@@ -747,7 +747,7 @@
lap = (struct lap_cb *) hashbin_get_first(irlmp->links);
while (lap != NULL) {
ASSERT(lap->magic == LMP_LAP_MAGIC, return;);
-
+
if (lap->lap_state == LAP_STANDBY) {
/* Expire discoveries discovered on this link */
irlmp_expire_discoveries(irlmp->cachelog, lap->saddr,
@@ -770,35 +770,35 @@

/* Make sure the value is sane */
if ((nslots != 1) && (nslots != 6) && (nslots != 8) && (nslots != 16)){
- WARNING(__FUNCTION__
- "(), invalid value for number of slots!\n");
+ WARNING("%s: invalid value for number of slots!\n",
+ __FUNCTION__);
nslots = sysctl_discovery_slots = 8;
}

/* Construct new discovery info to be used by IrLAP, */
irlmp->discovery_cmd.hints.word = irlmp->hints.word;
-
- /*
- * Set character set for device name (we use ASCII), and
- * copy device name. Remember to make room for a \0 at the
+
+ /*
+ * Set character set for device name (we use ASCII), and
+ * copy device name. Remember to make room for a \0 at the
* end
*/
irlmp->discovery_cmd.charset = CS_ASCII;
- strncpy(irlmp->discovery_cmd.nickname, sysctl_devname,
+ strncpy(irlmp->discovery_cmd.nickname, sysctl_devname,
NICKNAME_MAX_LEN);
irlmp->discovery_cmd.name_len = strlen(irlmp->discovery_cmd.nickname);
irlmp->discovery_cmd.nslots = nslots;
-
+
/*
* Try to send discovery packets on all links
*/
lap = (struct lap_cb *) hashbin_get_first(irlmp->links);
while (lap != NULL) {
ASSERT(lap->magic == LMP_LAP_MAGIC, return;);
-
+
if (lap->lap_state == LAP_STANDBY) {
/* Try to discover */
- irlmp_do_lap_event(lap, LM_LAP_DISCOVERY_REQUEST,
+ irlmp_do_lap_event(lap, LM_LAP_DISCOVERY_REQUEST,
NULL);
}
lap = (struct lap_cb *) hashbin_get_next(irlmp->links);
@@ -816,9 +816,9 @@
/* Return current cached discovery log */
irlmp_discovery_confirm(irlmp->cachelog, DISCOVERY_LOG);

- /*
+ /*
* Start a single discovery operation if discovery is not already
- * running
+ * running
*/
if (!sysctl_discovery) {
/* Check if user wants to override the default */
@@ -864,9 +864,6 @@
#if 0
/*
* Function irlmp_check_services (discovery)
- *
- *
- *
*/
void irlmp_check_services(discovery_t *discovery)
{
@@ -896,7 +893,7 @@
/* Don't notify about the ANY service */
if (service == S_ANY)
continue;
- /*
+ /*
* Found no clients for dealing with this service,
*/
}
@@ -923,20 +920,20 @@
discovery_t *discovery;

IRDA_DEBUG(3, __FUNCTION__ "()\n");
-
+
/* Check if client wants or not partial/selective log (optimisation) */
if (!client->disco_callback)
return;

- /*
- * Now, check all discovered devices (if any), and notify client
- * only about the services that the client is interested in
+ /*
+ * Now, check all discovered devices (if any), and notify client
+ * only about the services that the client is interested in
*/
discovery = (discovery_t *) hashbin_get_first(log);
while (discovery != NULL) {
- IRDA_DEBUG(3, "discovery->daddr = 0x%08x\n", discovery->daddr);
-
- /*
+ IRDA_DEBUG(3, "discovery->daddr = 0x%08x\n", discovery->daddr);
+
+ /*
* Any common hint bits? Remember to mask away the extension
* bits ;-)
*/
@@ -952,24 +949,24 @@
*
* Some device(s) answered to our discovery request! Check to see which
* device it is, and give indication to the client(s)
- *
+ *
*/
-void irlmp_discovery_confirm(hashbin_t *log, DISCOVERY_MODE mode)
+void irlmp_discovery_confirm(hashbin_t *log, DISCOVERY_MODE mode)
{
irlmp_client_t *client;
-
+
IRDA_DEBUG(3, __FUNCTION__ "()\n");
-
+
ASSERT(log != NULL, return;);
-
+
if (!(HASHBIN_GET_SIZE(log)))
return;
-
+
client = (irlmp_client_t *) hashbin_get_first(irlmp->clients);
while (client != NULL) {
/* Check if we should notify client */
irlmp_notify_client(client, log, mode);
-
+
client = (irlmp_client_t *) hashbin_get_next(irlmp->clients);
}
}
@@ -980,19 +977,19 @@
* This device is no longer been discovered, and therefore it is beeing
* purged from the discovery log. Inform all clients who have
* registered for this event...
- *
+ *
* Note : called exclusively from discovery.c
* Note : as we are currently processing the log, the clients callback
* should *NOT* attempt to touch the log now.
*/
-void irlmp_discovery_expiry(discovery_t *expiry)
+void irlmp_discovery_expiry(discovery_t *expiry)
{
irlmp_client_t *client;
-
+
IRDA_DEBUG(3, __FUNCTION__ "()\n");

ASSERT(expiry != NULL, return;);
-
+
client = (irlmp_client_t *) hashbin_get_first(irlmp->clients);
while (client != NULL) {
/* Check if we should notify client */
@@ -1020,14 +1017,14 @@

irlmp->discovery_rsp.hints.word = irlmp->hints.word;

- /*
- * Set character set for device name (we use ASCII), and
- * copy device name. Remember to make room for a \0 at the
+ /*
+ * Set character set for device name (we use ASCII), and
+ * copy device name. Remember to make room for a \0 at the
* end
*/
irlmp->discovery_rsp.charset = CS_ASCII;

- strncpy(irlmp->discovery_rsp.nickname, sysctl_devname,
+ strncpy(irlmp->discovery_rsp.nickname, sysctl_devname,
NICKNAME_MAX_LEN);
irlmp->discovery_rsp.name_len = strlen(irlmp->discovery_rsp.nickname);

@@ -1040,15 +1037,15 @@
* Send some data to peer device
*
*/
-int irlmp_data_request(struct lsap_cb *self, struct sk_buff *skb)
+int irlmp_data_request(struct lsap_cb *self, struct sk_buff *skb)
{
ASSERT(self != NULL, return -1;);
ASSERT(self->magic == LMP_LSAP_MAGIC, return -1;);
-
+
/* Make room for MUX header */
ASSERT(skb_headroom(skb) >= LMP_HEADER, return -1;);
skb_push(skb, LMP_HEADER);
-
+
return irlmp_do_lsap_event(self, LM_DATA_REQUEST, skb);
}

@@ -1058,7 +1055,7 @@
* Got data from LAP layer so pass it up to upper layer
*
*/
-void irlmp_data_indication(struct lsap_cb *self, struct sk_buff *skb)
+void irlmp_data_indication(struct lsap_cb *self, struct sk_buff *skb)
{
/* Hide LMP header from layer above */
skb_pull(skb, LMP_HEADER);
@@ -1071,16 +1068,13 @@

/*
* Function irlmp_udata_request (self, skb)
- *
- *
- *
*/
-int irlmp_udata_request(struct lsap_cb *self, struct sk_buff *skb)
+int irlmp_udata_request(struct lsap_cb *self, struct sk_buff *skb)
{
- IRDA_DEBUG(4, __FUNCTION__ "()\n");
+ IRDA_DEBUG(4, __FUNCTION__ "()\n");

ASSERT(skb != NULL, return -1;);
-
+
/* Make room for MUX header */
ASSERT(skb_headroom(skb) >= LMP_HEADER, return -1;);
skb_push(skb, LMP_HEADER);
@@ -1094,9 +1088,9 @@
* Send unreliable data (but still within the connection)
*
*/
-void irlmp_udata_indication(struct lsap_cb *self, struct sk_buff *skb)
+void irlmp_udata_indication(struct lsap_cb *self, struct sk_buff *skb)
{
- IRDA_DEBUG(4, __FUNCTION__ "()\n");
+ IRDA_DEBUG(4, __FUNCTION__ "()\n");

ASSERT(self != NULL, return;);
ASSERT(self->magic == LMP_LSAP_MAGIC, return;);
@@ -1106,7 +1100,7 @@
skb_pull(skb, LMP_HEADER);

if (self->notify.udata_indication)
- self->notify.udata_indication(self->notify.instance, self,
+ self->notify.udata_indication(self->notify.instance, self,
skb);
else
dev_kfree_skb(skb);
@@ -1114,23 +1108,20 @@

/*
* Function irlmp_connless_data_request (self, skb)
- *
- *
- *
*/
#ifdef CONFIG_IRDA_ULTRA
-int irlmp_connless_data_request(struct lsap_cb *self, struct sk_buff *skb)
+int irlmp_connless_data_request(struct lsap_cb *self, struct sk_buff *skb)
{
struct sk_buff *clone_skb;
struct lap_cb *lap;

- IRDA_DEBUG(4, __FUNCTION__ "()\n");
+ IRDA_DEBUG(4, __FUNCTION__ "()\n");

ASSERT(skb != NULL, return -1;);
-
+
/* Make room for MUX and PID header */
ASSERT(skb_headroom(skb) >= LMP_HEADER+LMP_PID_HEADER, return -1;);
-
+
/* Insert protocol identifier */
skb_push(skb, LMP_PID_HEADER);
skb->data[0] = self->pid;
@@ -1149,7 +1140,7 @@
return -ENOMEM;

irlap_unitdata_request(lap->irlap, clone_skb);
-
+
lap = (struct lap_cb *) hashbin_get_next(irlmp->links);
}
dev_kfree_skb(skb);
@@ -1165,9 +1156,9 @@
*
*/
#ifdef CONFIG_IRDA_ULTRA
-void irlmp_connless_data_indication(struct lsap_cb *self, struct sk_buff *skb)
+void irlmp_connless_data_indication(struct lsap_cb *self, struct sk_buff *skb)
{
- IRDA_DEBUG(4, __FUNCTION__ "()\n");
+ IRDA_DEBUG(4, __FUNCTION__ "()\n");

ASSERT(self != NULL, return;);
ASSERT(self->magic == LMP_LSAP_MAGIC, return;);
@@ -1184,7 +1175,7 @@
}
#endif /* CONFIG_IRDA_ULTRA */

-void irlmp_status_request(void)
+void irlmp_status_request(void)
{
IRDA_DEBUG(0, __FUNCTION__ "(), Not implemented\n");
}
@@ -1197,7 +1188,7 @@
* Jean II
*/
void irlmp_status_indication(struct lap_cb *self,
- LINK_STATUS link, LOCK_STATUS lock)
+ LINK_STATUS link, LOCK_STATUS lock)
{
struct lsap_cb *next;
struct lsap_cb *curr;
@@ -1213,7 +1204,7 @@
* Inform service user if he has requested it
*/
if (curr->notify.status_indication != NULL)
- curr->notify.status_indication(curr->notify.instance,
+ curr->notify.status_indication(curr->notify.instance,
link, lock);
else
IRDA_DEBUG(2, __FUNCTION__ "(), no handler\n");
@@ -1279,7 +1270,7 @@

/* Inform lsap user that it can send one more packet. */
if (curr->notify.flow_indication != NULL)
- curr->notify.flow_indication(curr->notify.instance,
+ curr->notify.flow_indication(curr->notify.instance,
curr, flow);
else
IRDA_DEBUG(1, __FUNCTION__ "(), no handler\n");
@@ -1297,8 +1288,8 @@
__u8 *service;
int i = 0;

- /*
- * Allocate array to store services in. 16 entries should be safe
+ /*
+ * Allocate array to store services in. 16 entries should be safe
* since we currently only support 2 hint bytes
*/
service = kmalloc(16, GFP_ATOMIC);
@@ -1327,10 +1318,10 @@
if (hint[0] & HINT_FAX)
IRDA_DEBUG(1, "Fax ");
if (hint[0] & HINT_LAN) {
- IRDA_DEBUG(1, "LAN Access ");
+ IRDA_DEBUG(1, "LAN Access ");
service[i++] = S_LAN;
}
- /*
+ /*
* Test if extension byte exists. This byte will usually be
* there, but this is not really required by the standard.
* (IrLMP p. 29)
@@ -1341,7 +1332,7 @@
service[i++] = S_TELEPHONY;
} if (hint[1] & HINT_FILE_SERVER)
IRDA_DEBUG(1, "File Server ");
-
+
if (hint[1] & HINT_COMM) {
IRDA_DEBUG(1, "IrCOMM ");
service[i++] = S_COMM;
@@ -1357,7 +1348,7 @@
service[i++] = S_ANY;

service[i] = S_END;
-
+
return service;
}

@@ -1436,7 +1427,7 @@
irlmp->hints.word |= hints;

/* Make a new registration */
- service = kmalloc(sizeof(irlmp_service_t), GFP_ATOMIC);
+ service = kmalloc(sizeof(irlmp_service_t), GFP_ATOMIC);
if (!service) {
IRDA_DEBUG(1, __FUNCTION__ "(), Unable to kmalloc!\n");
return 0;
@@ -1450,19 +1441,19 @@
/*
* Function irlmp_unregister_service (handle)
*
- * Unregister service with IrLMP.
+ * Unregister service with IrLMP.
*
* Returns: 0 on success, -1 on error
*/
int irlmp_unregister_service(__u32 handle)
{
irlmp_service_t *service;
-
- IRDA_DEBUG(4, __FUNCTION__ "()\n");
+
+ IRDA_DEBUG(4, __FUNCTION__ "()\n");

if (!handle)
return -1;
-
+
service = hashbin_find(irlmp->services, handle, NULL);
if (!service) {
IRDA_DEBUG(1, __FUNCTION__ "(), Unknown service!\n");
@@ -1503,14 +1494,14 @@

IRDA_DEBUG(1, __FUNCTION__ "()\n");
ASSERT(irlmp != NULL, return 0;);
-
+
/* Get a unique handle for this client */
get_random_bytes(&handle, sizeof(handle));
while (hashbin_find(irlmp->clients, handle, NULL) || !handle)
get_random_bytes(&handle, sizeof(handle));

/* Make a new registration */
- client = kmalloc(sizeof(irlmp_client_t), GFP_ATOMIC);
+ client = kmalloc(sizeof(irlmp_client_t), GFP_ATOMIC);
if (!client) {
IRDA_DEBUG( 1, __FUNCTION__ "(), Unable to kmalloc!\n");
return 0;
@@ -1522,7 +1513,7 @@
client->expir_callback = expir_clb;
client->priv = priv;

- hashbin_insert(irlmp->clients, (irda_queue_t *) client, handle, NULL);
+ hashbin_insert(irlmp->clients, (irda_queue_t *) client, handle, NULL);

return handle;
}
@@ -1535,8 +1526,8 @@
*
* Returns: 0 on success, -1 on error
*/
-int irlmp_update_client(__u32 handle, __u16 hint_mask,
- DISCOVERY_CALLBACK1 disco_clb,
+int irlmp_update_client(__u32 handle, __u16 hint_mask,
+ DISCOVERY_CALLBACK1 disco_clb,
DISCOVERY_CALLBACK1 expir_clb, void *priv)
{
irlmp_client_t *client;
@@ -1554,7 +1545,7 @@
client->disco_callback = disco_clb;
client->expir_callback = expir_clb;
client->priv = priv;
-
+
return 0;
}

@@ -1566,13 +1557,13 @@
*/
int irlmp_unregister_client(__u32 handle)
{
- struct irlmp_client *client;
-
- IRDA_DEBUG(4, __FUNCTION__ "()\n");
+ struct irlmp_client *client;
+
+ IRDA_DEBUG(4, __FUNCTION__ "()\n");

if (!handle)
return -1;
-
+
client = hashbin_find(irlmp->clients, handle, NULL);
if (!client) {
IRDA_DEBUG(1, __FUNCTION__ "(), Unknown client!\n");
@@ -1583,7 +1574,7 @@
client = hashbin_remove( irlmp->clients, handle, NULL);
if (client)
kfree(client);
-
+
return 0;
}

@@ -1628,13 +1619,13 @@

if ((self->slsap_sel == slsap_sel)) {
IRDA_DEBUG(4, "Source LSAP selector=%02x in use\n",
- self->slsap_sel);
+ self->slsap_sel);
return TRUE;
}
self = (struct lsap_cb*) hashbin_get_next(lap->lsaps);
}
lap = (struct lap_cb *) hashbin_get_next(irlmp->links);
- }
+ }
return FALSE;
}

@@ -1644,16 +1635,16 @@
* Find a free source LSAP to use. This function is called if the service
* user has requested a source LSAP equal to LM_ANY
*/
-__u8 irlmp_find_free_slsap(void)
+__u8 irlmp_find_free_slsap(void)
{
__u8 lsap_sel;
int wrapped = 0;

ASSERT(irlmp != NULL, return -1;);
ASSERT(irlmp->magic == LMP_MAGIC, return -1;);
-
+
lsap_sel = irlmp->free_lsap_sel++;
-
+
/* Check if the new free lsap is really free */
while (irlmp_slsap_inuse(irlmp->free_lsap_sel)) {
irlmp->free_lsap_sel++;
@@ -1668,7 +1659,7 @@
}
}
IRDA_DEBUG(4, __FUNCTION__ "(), next free lsap_sel=%02x\n", lsap_sel);
-
+
return lsap_sel;
}

@@ -1683,7 +1674,7 @@
{
int reason = LM_LAP_DISCONNECT;

- switch (lap_reason) {
+ switch (lap_reason) {
case LAP_DISC_INDICATION: /* Received a disconnect request from peer */
IRDA_DEBUG( 1, __FUNCTION__ "(), LAP_DISC_INDICATION\n");
reason = LM_USER_REQUEST;
@@ -1703,14 +1694,14 @@
reason = LM_CONNECT_FAILURE;
break;
default:
- IRDA_DEBUG(1, __FUNCTION__
+ IRDA_DEBUG(1, __FUNCTION__
"(), Unknow IrLAP disconnect reason %d!\n", lap_reason);
reason = LM_LAP_DISCONNECT;
break;
}

return reason;
-}
+}

__u32 irlmp_get_saddr(struct lsap_cb *self)
{
@@ -1724,7 +1715,7 @@
{
ASSERT(self != NULL, return 0;);
ASSERT(self->lap != NULL, return 0;);
-
+
return self->lap->daddr;
}

@@ -1742,37 +1733,37 @@
unsigned long flags;

ASSERT(irlmp != NULL, return 0;);
-
+
save_flags( flags);
cli();

len = 0;
-
+
len += sprintf( buf+len, "Unconnected LSAPs:\n");
self = (struct lsap_cb *) hashbin_get_first( irlmp->unconnected_lsaps);
while (self != NULL) {
ASSERT(self->magic == LMP_LSAP_MAGIC, return 0;);
- len += sprintf(buf+len, "lsap state: %s, ",
+ len += sprintf(buf+len, "lsap state: %s, ",
irlsap_state[ self->lsap_state]);
- len += sprintf(buf+len,
+ len += sprintf(buf+len,
"slsap_sel: %#02x, dlsap_sel: %#02x, ",
- self->slsap_sel, self->dlsap_sel);
+ self->slsap_sel, self->dlsap_sel);
len += sprintf(buf+len, "(%s)", self->notify.name);
len += sprintf(buf+len, "\n");

self = (struct lsap_cb *) hashbin_get_next(
irlmp->unconnected_lsaps);
- }
+ }

len += sprintf(buf+len, "\nRegistred Link Layers:\n");

lap = (struct lap_cb *) hashbin_get_first(irlmp->links);
while (lap != NULL) {
- len += sprintf(buf+len, "lap state: %s, ",
+ len += sprintf(buf+len, "lap state: %s, ",
irlmp_state[lap->lap_state]);

len += sprintf(buf+len, "saddr: %#08x, daddr: %#08x, ",
- lap->saddr, lap->daddr);
+ lap->saddr, lap->daddr);
len += sprintf(buf+len, "num lsaps: %d",
HASHBIN_GET_SIZE(lap->lsaps));
len += sprintf(buf+len, "\n");
@@ -1781,27 +1772,24 @@
self = (struct lsap_cb *) hashbin_get_first(lap->lsaps);
while (self != NULL) {
ASSERT(self->magic == LMP_LSAP_MAGIC, return 0;);
- len += sprintf(buf+len, " lsap state: %s, ",
+ len += sprintf(buf+len, " lsap state: %s, ",
irlsap_state[ self->lsap_state]);
- len += sprintf(buf+len,
+ len += sprintf(buf+len,
"slsap_sel: %#02x, dlsap_sel: %#02x, ",
self->slsap_sel, self->dlsap_sel);
len += sprintf(buf+len, "(%s)", self->notify.name);
len += sprintf(buf+len, "\n");
-
- self = (struct lsap_cb *) hashbin_get_next(
+
+ self = (struct lsap_cb *) hashbin_get_next(
lap->lsaps);
- }
+ }
len += sprintf(buf+len, "\n");

lap = (struct lap_cb *) hashbin_get_next(irlmp->links);
- }
+ }
restore_flags(flags);
-
+
return len;
}

#endif /* PROC_FS */
-
-
-


Attachments:
warn-2.5.21-15.diff (31.15 kB)

2002-06-10 12:49:28

by Martin Dalecki

[permalink] [raw]
Subject: [PATCH] 2.5.21 kill warnings 16/19

diff -urN linux-2.5.21/net/irda/irlmp_event.c linux/net/irda/irlmp_event.c
--- linux-2.5.21/net/irda/irlmp_event.c 2002-06-09 07:28:07.000000000 +0200
+++ linux/net/irda/irlmp_event.c 2002-06-09 21:37:58.000000000 +0200
@@ -1,5 +1,5 @@
/*********************************************************************
- *
+ *
* Filename: irlmp_event.c
* Version: 0.8
* Description: An IrDA LMP event driver for Linux
@@ -8,18 +8,18 @@
* Created at: Mon Aug 4 20:40:53 1997
* Modified at: Tue Dec 14 23:04:16 1999
* Modified by: Dag Brattli <[email protected]>
- *
- * Copyright (c) 1998-1999 Dag Brattli <[email protected]>,
+ *
+ * Copyright (c) 1998-1999 Dag Brattli <[email protected]>,
* All Rights Reserved.
* Copyright (c) 2000-2001 Jean Tourrilhes <[email protected]>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
* the License, or (at your option) any later version.
*
* Neither Dag Brattli nor University of Troms? admit liability nor
- * provide warranty for any of this software. This material is
+ * provide warranty for any of this software. This material is
* provided "AS-IS" and at no charge.
*
********************************************************************/
@@ -52,52 +52,52 @@
#ifdef CONFIG_IRDA_DEBUG
static const char *irlmp_event[] = {
"LM_CONNECT_REQUEST",
- "LM_CONNECT_CONFIRM",
+ "LM_CONNECT_CONFIRM",
"LM_CONNECT_RESPONSE",
- "LM_CONNECT_INDICATION",
-
+ "LM_CONNECT_INDICATION",
+
"LM_DISCONNECT_INDICATION",
"LM_DISCONNECT_REQUEST",

- "LM_DATA_REQUEST",
+ "LM_DATA_REQUEST",
"LM_UDATA_REQUEST",
- "LM_DATA_INDICATION",
+ "LM_DATA_INDICATION",
"LM_UDATA_INDICATION",

"LM_WATCHDOG_TIMEOUT",

/* IrLAP events */
"LM_LAP_CONNECT_REQUEST",
- "LM_LAP_CONNECT_INDICATION",
- "LM_LAP_CONNECT_CONFIRM",
- "LM_LAP_DISCONNECT_INDICATION",
+ "LM_LAP_CONNECT_INDICATION",
+ "LM_LAP_CONNECT_CONFIRM",
+ "LM_LAP_DISCONNECT_INDICATION",
"LM_LAP_DISCONNECT_REQUEST",
"LM_LAP_DISCOVERY_REQUEST",
- "LM_LAP_DISCOVERY_CONFIRM",
+ "LM_LAP_DISCOVERY_CONFIRM",
"LM_LAP_IDLE_TIMEOUT",
};
#endif /* CONFIG_IRDA_DEBUG */

/* LAP Connection control proto declarations */
-static void irlmp_state_standby (struct lap_cb *, IRLMP_EVENT,
+static void irlmp_state_standby (struct lap_cb *, IRLMP_EVENT,
struct sk_buff *);
-static void irlmp_state_u_connect(struct lap_cb *, IRLMP_EVENT,
+static void irlmp_state_u_connect(struct lap_cb *, IRLMP_EVENT,
struct sk_buff *);
-static void irlmp_state_active (struct lap_cb *, IRLMP_EVENT,
+static void irlmp_state_active (struct lap_cb *, IRLMP_EVENT,
struct sk_buff *);

/* LSAP Connection control proto declarations */
-static int irlmp_state_disconnected(struct lsap_cb *, IRLMP_EVENT,
+static int irlmp_state_disconnected(struct lsap_cb *, IRLMP_EVENT,
struct sk_buff *);
-static int irlmp_state_connect (struct lsap_cb *, IRLMP_EVENT,
+static int irlmp_state_connect (struct lsap_cb *, IRLMP_EVENT,
struct sk_buff *);
static int irlmp_state_connect_pend(struct lsap_cb *, IRLMP_EVENT,
struct sk_buff *);
-static int irlmp_state_dtr (struct lsap_cb *, IRLMP_EVENT,
+static int irlmp_state_dtr (struct lsap_cb *, IRLMP_EVENT,
struct sk_buff *);
-static int irlmp_state_setup (struct lsap_cb *, IRLMP_EVENT,
+static int irlmp_state_setup (struct lsap_cb *, IRLMP_EVENT,
struct sk_buff *);
-static int irlmp_state_setup_pend (struct lsap_cb *, IRLMP_EVENT,
+static int irlmp_state_setup_pend (struct lsap_cb *, IRLMP_EVENT,
struct sk_buff *);

static void (*lap_state[]) (struct lap_cb *, IRLMP_EVENT, struct sk_buff *) =
@@ -118,7 +118,7 @@
};

static inline void irlmp_next_lap_state(struct lap_cb *self,
- IRLMP_STATE state)
+ IRLMP_STATE state)
{
/*
IRDA_DEBUG(4, __FUNCTION__ "(), LMP LAP = %s\n", irlmp_state[state]);
@@ -127,7 +127,7 @@
}

static inline void irlmp_next_lsap_state(struct lsap_cb *self,
- LSAP_STATE state)
+ LSAP_STATE state)
{
/*
ASSERT(self != NULL, return;);
@@ -137,7 +137,7 @@
}

/* Do connection control events */
-int irlmp_do_lsap_event(struct lsap_cb *self, IRLMP_EVENT event,
+int irlmp_do_lsap_event(struct lsap_cb *self, IRLMP_EVENT event,
struct sk_buff *skb)
{
ASSERT(self != NULL, return -1;);
@@ -155,14 +155,14 @@
* Do IrLAP control events
*
*/
-void irlmp_do_lap_event(struct lap_cb *self, IRLMP_EVENT event,
- struct sk_buff *skb)
+void irlmp_do_lap_event(struct lap_cb *self, IRLMP_EVENT event,
+ struct sk_buff *skb)
{
ASSERT(self != NULL, return;);
ASSERT(self->magic == LMP_LAP_MAGIC, return;);
-
+
IRDA_DEBUG(4, __FUNCTION__ "(), EVENT = %s, STATE = %s\n",
- irlmp_event[event],
+ irlmp_event[event],
irlmp_state[self->lap_state]);

(*lap_state[self->lap_state]) (self, event, skb);
@@ -171,8 +171,8 @@
void irlmp_discovery_timer_expired(void *data)
{
IRDA_DEBUG(4, __FUNCTION__ "()\n");
-
- /* We always cleanup the log (active & passive discovery) */
+
+ /* We always cleanup the log (active & passive discovery) */
irlmp_do_expiry();

/* Active discovery is conditional */
@@ -186,7 +186,7 @@
void irlmp_watchdog_timer_expired(void *data)
{
struct lsap_cb *self = (struct lsap_cb *) data;
-
+
IRDA_DEBUG(2, __FUNCTION__ "()\n");

ASSERT(self != NULL, return;);
@@ -198,7 +198,7 @@
void irlmp_idle_timer_expired(void *data)
{
struct lap_cb *self = (struct lap_cb *) data;
-
+
IRDA_DEBUG(2, __FUNCTION__ "()\n");

ASSERT(self != NULL, return;);
@@ -219,20 +219,20 @@
* STANDBY, The IrLAP connection does not exist.
*
*/
-static void irlmp_state_standby(struct lap_cb *self, IRLMP_EVENT event,
+static void irlmp_state_standby(struct lap_cb *self, IRLMP_EVENT event,
struct sk_buff *skb)
-{
- IRDA_DEBUG(4, __FUNCTION__ "()\n");
+{
+ IRDA_DEBUG(4, __FUNCTION__ "()\n");
ASSERT(self->irlap != NULL, return;);
-
+
switch (event) {
case LM_LAP_DISCOVERY_REQUEST:
/* irlmp_next_station_state( LMP_DISCOVER); */
-
+
irlap_discovery_request(self->irlap, &irlmp->discovery_cmd);
break;
case LM_LAP_CONNECT_INDICATION:
- /* It's important to switch state first, to avoid IrLMP to
+ /* It's important to switch state first, to avoid IrLMP to
* think that the link is free since IrLMP may then start
* discovery before the connection is properly set up. DB.
*/
@@ -250,16 +250,16 @@
irlap_connect_request(self->irlap, self->daddr, NULL, 0);
break;
case LM_LAP_DISCONNECT_INDICATION:
- IRDA_DEBUG(4, __FUNCTION__
+ IRDA_DEBUG(4, __FUNCTION__
"(), Error LM_LAP_DISCONNECT_INDICATION\n");
-
+
irlmp_next_lap_state(self, LAP_STANDBY);
break;
default:
IRDA_DEBUG(0, __FUNCTION__ "(), Unknown event %s\n",
irlmp_event[event]);
if (skb)
- dev_kfree_skb(skb);
+ dev_kfree_skb(skb);
break;
}
}
@@ -271,17 +271,17 @@
* since the IrLAP connection does not exist, we must first start an
* IrLAP connection. We are now waiting response from IrLAP.
* */
-static void irlmp_state_u_connect(struct lap_cb *self, IRLMP_EVENT event,
+static void irlmp_state_u_connect(struct lap_cb *self, IRLMP_EVENT event,
struct sk_buff *skb)
{
struct lsap_cb *lsap;
struct lsap_cb *lsap_current;
-
+
IRDA_DEBUG(2, __FUNCTION__ "(), event=%s\n", irlmp_event[event]);

switch (event) {
case LM_LAP_CONNECT_INDICATION:
- /* It's important to switch state first, to avoid IrLMP to
+ /* It's important to switch state first, to avoid IrLMP to
* think that the link is free since IrLMP may then start
* discovery before the connection is properly set up. DB.
*/
@@ -331,12 +331,12 @@
lsap = (struct lsap_cb *) hashbin_get_first( self->lsaps);
while (lsap != NULL ) {
ASSERT(lsap->magic == LMP_LSAP_MAGIC, return;);
-
+
lsap_current = lsap;

/* Be sure to stay one item ahead */
lsap = (struct lsap_cb *) hashbin_get_next(self->lsaps);
- irlmp_do_lsap_event(lsap_current,
+ irlmp_do_lsap_event(lsap_current,
LM_LAP_DISCONNECT_INDICATION,
NULL);
}
@@ -354,9 +354,9 @@
IRDA_DEBUG(0, __FUNCTION__ "(), Unknown event %s\n",
irlmp_event[event]);
if (skb)
- dev_kfree_skb(skb);
+ dev_kfree_skb(skb);
break;
- }
+ }
}

/*
@@ -365,38 +365,38 @@
* ACTIVE, IrLAP connection is active
*
*/
-static void irlmp_state_active(struct lap_cb *self, IRLMP_EVENT event,
+static void irlmp_state_active(struct lap_cb *self, IRLMP_EVENT event,
struct sk_buff *skb)
{
struct lsap_cb *lsap;
struct lsap_cb *lsap_current;

- IRDA_DEBUG(4, __FUNCTION__ "()\n");
+ IRDA_DEBUG(4, __FUNCTION__ "()\n");

- switch (event) {
+ switch (event) {
case LM_LAP_CONNECT_REQUEST:
IRDA_DEBUG(4, __FUNCTION__ "(), LS_CONNECT_REQUEST\n");

/*
- * LAP connection allready active, just bounce back! Since we
- * don't know which LSAP that tried to do this, we have to
+ * LAP connection allready active, just bounce back! Since we
+ * don't know which LSAP that tried to do this, we have to
* notify all LSAPs using this LAP, but that should be safe to
* do anyway.
*/
lsap = (struct lsap_cb *) hashbin_get_first(self->lsaps);
while (lsap != NULL) {
irlmp_do_lsap_event(lsap, LM_LAP_CONNECT_CONFIRM, NULL);
- lsap = (struct lsap_cb*) hashbin_get_next(self->lsaps);
+ lsap = (struct lsap_cb*) hashbin_get_next(self->lsaps);
}
-
+
/* Needed by connect indication */
lsap = (struct lsap_cb *) hashbin_get_first(irlmp->unconnected_lsaps);
while (lsap != NULL) {
lsap_current = lsap;
-
+
/* Be sure to stay one item ahead */
- lsap = (struct lsap_cb*) hashbin_get_next(irlmp->unconnected_lsaps);
- irlmp_do_lsap_event(lsap_current,
+ lsap = (struct lsap_cb*) hashbin_get_next(irlmp->unconnected_lsaps);
+ irlmp_do_lsap_event(lsap_current,
LM_LAP_CONNECT_CONFIRM, NULL);
}
/* Keep state */
@@ -404,8 +404,8 @@
case LM_LAP_DISCONNECT_REQUEST:
/*
* Need to find out if we should close IrLAP or not. If there
- * is only one LSAP connection left on this link, that LSAP
- * must be the one that tries to close IrLAP. It will be
+ * is only one LSAP connection left on this link, that LSAP
+ * must be the one that tries to close IrLAP. It will be
* removed later and moved to the list of unconnected LSAPs
*/
if (HASHBIN_GET_SIZE(self->lsaps) > 0) {
@@ -434,8 +434,8 @@
}
break;
case LM_LAP_DISCONNECT_INDICATION:
- irlmp_next_lap_state(self, LAP_STANDBY);
-
+ irlmp_next_lap_state(self, LAP_STANDBY);
+
/* In some case, at this point our side has already closed
* all lsaps, and we are waiting for the idle_timer to
* expire. If another device reconnect immediately, the
@@ -444,18 +444,18 @@
* Therefore, we must stop the timer... */
irlmp_stop_idle_timer(self);

- /*
+ /*
* Inform all connected LSAP's using this link
*/
lsap = (struct lsap_cb *) hashbin_get_first(self->lsaps);
while (lsap != NULL ) {
ASSERT(lsap->magic == LMP_LSAP_MAGIC, return;);
-
+
lsap_current = lsap;

/* Be sure to stay one item ahead */
lsap = (struct lsap_cb *) hashbin_get_next(self->lsaps);
- irlmp_do_lsap_event(lsap_current,
+ irlmp_do_lsap_event(lsap_current,
LM_LAP_DISCONNECT_INDICATION,
NULL);
}
@@ -473,9 +473,9 @@
IRDA_DEBUG(0, __FUNCTION__ "(), Unknown event %s\n",
irlmp_event[event]);
if (skb)
- dev_kfree_skb(skb);
+ dev_kfree_skb(skb);
break;
- }
+ }
}

/*********************************************************************
@@ -491,7 +491,7 @@
*
*/
static int irlmp_state_disconnected(struct lsap_cb *self, IRLMP_EVENT event,
- struct sk_buff *skb)
+ struct sk_buff *skb)
{
int ret = 0;

@@ -503,15 +503,15 @@
switch (event) {
#ifdef CONFIG_IRDA_ULTRA
case LM_UDATA_INDICATION:
- irlmp_connless_data_indication(self, skb);
+ irlmp_connless_data_indication(self, skb);
break;
#endif /* CONFIG_IRDA_ULTRA */
case LM_CONNECT_REQUEST:
IRDA_DEBUG(4, __FUNCTION__ "(), LM_CONNECT_REQUEST\n");

if (self->conn_skb) {
- WARNING(__FUNCTION__
- "(), busy with another request!\n");
+ WARNING("%s: busy with another request!\n",
+ __FUNCTION__);
return -EBUSY;
}
self->conn_skb = skb;
@@ -525,8 +525,8 @@
break;
case LM_CONNECT_INDICATION:
if (self->conn_skb) {
- WARNING(__FUNCTION__
- "(), busy with another request!\n");
+ WARNING("%s: busy with another request!\n",
+ __FUNCTION__);
return -EBUSY;
}
self->conn_skb = skb;
@@ -549,10 +549,10 @@
irlmp_start_watchdog_timer(self, 1*HZ);
break;
default:
- IRDA_DEBUG(2, __FUNCTION__ "(), Unknown event %s\n",
+ IRDA_DEBUG(2, __FUNCTION__ "(), Unknown event %s\n",
irlmp_event[event]);
if (skb)
- dev_kfree_skb(skb);
+ dev_kfree_skb(skb);
break;
}
return ret;
@@ -564,34 +564,34 @@
* CONNECT
*
*/
-static int irlmp_state_connect(struct lsap_cb *self, IRLMP_EVENT event,
- struct sk_buff *skb)
+static int irlmp_state_connect(struct lsap_cb *self, IRLMP_EVENT event,
+ struct sk_buff *skb)
{
struct lsap_cb *lsap;
int ret = 0;

IRDA_DEBUG(4, __FUNCTION__ "()\n");
-
+
ASSERT(self != NULL, return -1;);
ASSERT(self->magic == LMP_LSAP_MAGIC, return -1;);

switch (event) {
case LM_CONNECT_RESPONSE:
- /*
+ /*
* Bind this LSAP to the IrLAP link where the connect was
- * received
+ * received
*/
- lsap = hashbin_remove(irlmp->unconnected_lsaps, (int) self,
+ lsap = hashbin_remove(irlmp->unconnected_lsaps, (int) self,
NULL);

- ASSERT(lsap == self, return -1;);
+ ASSERT(lsap == self, return -1;);
ASSERT(self->lap != NULL, return -1;);
ASSERT(self->lap->lsaps != NULL, return -1;);
-
- hashbin_insert(self->lap->lsaps, (irda_queue_t *) self, (int) self,
+
+ hashbin_insert(self->lap->lsaps, (irda_queue_t *) self, (int) self,
NULL);

- irlmp_send_lcf_pdu(self->lap, self->dlsap_sel,
+ irlmp_send_lcf_pdu(self->lap, self->dlsap_sel,
self->slsap_sel, CONNECT_CNF, skb);

del_timer(&self->watchdog_timer);
@@ -611,7 +611,7 @@
IRDA_DEBUG(0, __FUNCTION__ "(), Unknown event %s\n",
irlmp_event[event]);
if (skb)
- dev_kfree_skb(skb);
+ dev_kfree_skb(skb);
break;
}
return ret;
@@ -624,7 +624,7 @@
*
*/
static int irlmp_state_connect_pend(struct lsap_cb *self, IRLMP_EVENT event,
- struct sk_buff *skb)
+ struct sk_buff *skb)
{
int ret = 0;

@@ -665,16 +665,16 @@
/* Go back to disconnected mode, keep the socket waiting */
self->dlsap_sel = LSAP_ANY;
if(self->conn_skb)
- dev_kfree_skb(self->conn_skb);
+ dev_kfree_skb(self->conn_skb);
self->conn_skb = NULL;
irlmp_next_lsap_state(self, LSAP_DISCONNECTED);
break;
default:
- IRDA_DEBUG(0, __FUNCTION__ "Unknown event %s\n",
+ IRDA_DEBUG(0, __FUNCTION__ "Unknown event %s\n",
irlmp_event[event]);
if (skb)
- dev_kfree_skb(skb);
- break;
+ dev_kfree_skb(skb);
+ break;
}
return ret;
}
@@ -685,13 +685,13 @@
* DATA_TRANSFER_READY
*
*/
-static int irlmp_state_dtr(struct lsap_cb *self, IRLMP_EVENT event,
- struct sk_buff *skb)
+static int irlmp_state_dtr(struct lsap_cb *self, IRLMP_EVENT event,
+ struct sk_buff *skb)
{
LM_REASON reason;
int ret = 0;

- IRDA_DEBUG(4, __FUNCTION__ "()\n");
+ IRDA_DEBUG(4, __FUNCTION__ "()\n");

ASSERT(self != NULL, return -1;);
ASSERT(self->magic == LMP_LSAP_MAGIC, return -1;);
@@ -699,19 +699,19 @@

switch (event) {
case LM_DATA_REQUEST: /* Optimize for the common case */
- irlmp_send_data_pdu(self->lap, self->dlsap_sel,
+ irlmp_send_data_pdu(self->lap, self->dlsap_sel,
self->slsap_sel, FALSE, skb);
break;
case LM_DATA_INDICATION: /* Optimize for the common case */
- irlmp_data_indication(self, skb);
+ irlmp_data_indication(self, skb);
break;
case LM_UDATA_REQUEST:
ASSERT(skb != NULL, return -1;);
- irlmp_send_data_pdu(self->lap, self->dlsap_sel,
+ irlmp_send_data_pdu(self->lap, self->dlsap_sel,
self->slsap_sel, TRUE, skb);
break;
case LM_UDATA_INDICATION:
- irlmp_udata_indication(self, skb);
+ irlmp_udata_indication(self, skb);
break;
case LM_CONNECT_REQUEST:
IRDA_DEBUG(0, __FUNCTION__ "(), LM_CONNECT_REQUEST, "
@@ -719,7 +719,7 @@
/* Keep state */
break;
case LM_CONNECT_RESPONSE:
- IRDA_DEBUG(0, __FUNCTION__ "(), LM_CONNECT_RESPONSE, "
+ IRDA_DEBUG(0, __FUNCTION__ "(), LM_CONNECT_RESPONSE, "
"error, LSAP allready connected\n");
/* Keep state */
break;
@@ -727,12 +727,12 @@
irlmp_send_lcf_pdu(self->lap, self->dlsap_sel, self->slsap_sel,
DISCONNECT, skb);
irlmp_next_lsap_state(self, LSAP_DISCONNECTED);
-
+
/* Try to close the LAP connection if its still there */
if (self->lap) {
IRDA_DEBUG(4, __FUNCTION__ "(), trying to close IrLAP\n");
- irlmp_do_lap_event(self->lap,
- LM_LAP_DISCONNECT_REQUEST,
+ irlmp_do_lap_event(self->lap,
+ LM_LAP_DISCONNECT_REQUEST,
NULL);
}
break;
@@ -745,10 +745,10 @@
break;
case LM_DISCONNECT_INDICATION:
irlmp_next_lsap_state(self, LSAP_DISCONNECTED);
-
+
ASSERT(self->lap != NULL, return -1;);
ASSERT(self->lap->magic == LMP_LAP_MAGIC, return -1;);
-
+
ASSERT(skb != NULL, return -1;);
ASSERT(skb->len > 3, return -1;);
reason = skb->data[3];
@@ -760,11 +760,11 @@
irlmp_disconnect_indication(self, reason, skb);
break;
default:
- IRDA_DEBUG(0, __FUNCTION__ "(), Unknown event %s\n",
+ IRDA_DEBUG(0, __FUNCTION__ "(), Unknown event %s\n",
irlmp_event[event]);
if (skb)
- dev_kfree_skb(skb);
- break;
+ dev_kfree_skb(skb);
+ break;
}
return ret;
}
@@ -776,8 +776,8 @@
* An LSAP connection request has been transmitted to the peer
* LSAP-Connection Control FSM and we are awaiting reply.
*/
-static int irlmp_state_setup(struct lsap_cb *self, IRLMP_EVENT event,
- struct sk_buff *skb)
+static int irlmp_state_setup(struct lsap_cb *self, IRLMP_EVENT event,
+ struct sk_buff *skb)
{
LM_REASON reason;
int ret = 0;
@@ -792,15 +792,15 @@
irlmp_next_lsap_state(self, LSAP_DATA_TRANSFER_READY);

del_timer(&self->watchdog_timer);
-
+
irlmp_connect_confirm(self, skb);
break;
case LM_DISCONNECT_INDICATION:
irlmp_next_lsap_state(self, LSAP_DISCONNECTED);
-
+
ASSERT(self->lap != NULL, return -1;);
ASSERT(self->lap->magic == LMP_LAP_MAGIC, return -1;);
-
+
ASSERT(skb != NULL, return -1;);
ASSERT(skb->len > 3, return -1;);
reason = skb->data[3];
@@ -818,26 +818,26 @@

ASSERT(self->lap != NULL, return -1;);
ASSERT(self->lap->magic == LMP_LAP_MAGIC, return -1;);
-
+
reason = irlmp_convert_lap_reason(self->lap->reason);

irlmp_disconnect_indication(self, reason, skb);
break;
case LM_WATCHDOG_TIMEOUT:
IRDA_DEBUG(0, __FUNCTION__ "() WATCHDOG_TIMEOUT!\n");
-
+
ASSERT(self->lap != NULL, return -1;);
irlmp_do_lap_event(self->lap, LM_LAP_DISCONNECT_REQUEST, NULL);
irlmp_next_lsap_state(self, LSAP_DISCONNECTED);
-
+
irlmp_disconnect_indication(self, LM_CONNECT_FAILURE, NULL);
break;
default:
- IRDA_DEBUG(0, __FUNCTION__ "(), Unknown event %s\n",
+ IRDA_DEBUG(0, __FUNCTION__ "(), Unknown event %s\n",
irlmp_event[event]);
if (skb)
- dev_kfree_skb(skb);
- break;
+ dev_kfree_skb(skb);
+ break;
}
return ret;
}
@@ -850,13 +850,13 @@
* LAP FSM to set up the underlying IrLAP connection, and we
* are awaiting confirm.
*/
-static int irlmp_state_setup_pend(struct lsap_cb *self, IRLMP_EVENT event,
- struct sk_buff *skb)
+static int irlmp_state_setup_pend(struct lsap_cb *self, IRLMP_EVENT event,
+ struct sk_buff *skb)
{
LM_REASON reason;
int ret = 0;

- IRDA_DEBUG(4, __FUNCTION__ "()\n");
+ IRDA_DEBUG(4, __FUNCTION__ "()\n");

ASSERT(self != NULL, return -1;);
ASSERT(irlmp != NULL, return -1;);
@@ -868,7 +868,7 @@
skb = self->conn_skb;
self->conn_skb = NULL;

- irlmp_send_lcf_pdu(self->lap, self->dlsap_sel,
+ irlmp_send_lcf_pdu(self->lap, self->dlsap_sel,
self->slsap_sel, CONNECT_CMD, skb);

irlmp_next_lsap_state(self, LSAP_SETUP);
@@ -886,17 +886,17 @@
del_timer( &self->watchdog_timer);

irlmp_next_lsap_state(self, LSAP_DISCONNECTED);
-
+
reason = irlmp_convert_lap_reason(self->lap->reason);
-
+
irlmp_disconnect_indication(self, reason, NULL);
break;
default:
- IRDA_DEBUG(0, __FUNCTION__ "(), Unknown event %s\n",
+ IRDA_DEBUG(0, __FUNCTION__ "(), Unknown event %s\n",
irlmp_event[event]);
if (skb)
- dev_kfree_skb(skb);
- break;
+ dev_kfree_skb(skb);
+ break;
}
return ret;
}


Attachments:
warn-2.5.21-16.diff (20.79 kB)

2002-06-10 12:45:58

by Martin Dalecki

[permalink] [raw]
Subject: [PATCH] 2.5.21 kill warnings 13/19

diff -urN linux-2.5.21/net/irda/irlap_event.c linux/net/irda/irlap_event.c
--- linux-2.5.21/net/irda/irlap_event.c 2002-06-09 07:30:36.000000000 +0200
+++ linux/net/irda/irlap_event.c 2002-06-09 21:25:54.000000000 +0200
@@ -1,5 +1,5 @@
/*********************************************************************
- *
+ *
* Filename: irlap_event.c
* Version: 0.9
* Description: IrLAP state machine implementation
@@ -8,19 +8,19 @@
* Created at: Sat Aug 16 00:59:29 1997
* Modified at: Sat Dec 25 21:07:57 1999
* Modified by: Dag Brattli <[email protected]>
- *
+ *
* Copyright (c) 1998-2000 Dag Brattli <[email protected]>,
* Copyright (c) 1998 Thomas Davis <[email protected]>
* All Rights Reserved.
* Copyright (c) 2000-2001 Jean Tourrilhes <[email protected]>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
* the License, or (at your option) any later version.
*
* Neither Dag Brattli nor University of Troms? admit liability nor
- * provide warranty for any of this software. This material is
+ * provide warranty for any of this software. This material is
* provided "AS-IS" and at no charge.
*
********************************************************************/
@@ -46,35 +46,35 @@
int sysctl_fast_poll_increase = 50;
#endif

-static int irlap_state_ndm (struct irlap_cb *self, IRLAP_EVENT event,
+static int irlap_state_ndm (struct irlap_cb *self, IRLAP_EVENT event,
struct sk_buff *skb, struct irlap_info *info);
-static int irlap_state_query (struct irlap_cb *self, IRLAP_EVENT event,
+static int irlap_state_query (struct irlap_cb *self, IRLAP_EVENT event,
struct sk_buff *skb, struct irlap_info *info);
-static int irlap_state_reply (struct irlap_cb *self, IRLAP_EVENT event,
+static int irlap_state_reply (struct irlap_cb *self, IRLAP_EVENT event,
struct sk_buff *skb, struct irlap_info *info);
-static int irlap_state_conn (struct irlap_cb *self, IRLAP_EVENT event,
+static int irlap_state_conn (struct irlap_cb *self, IRLAP_EVENT event,
struct sk_buff *skb, struct irlap_info *info);
-static int irlap_state_setup (struct irlap_cb *self, IRLAP_EVENT event,
+static int irlap_state_setup (struct irlap_cb *self, IRLAP_EVENT event,
struct sk_buff *skb, struct irlap_info *info);
-static int irlap_state_offline(struct irlap_cb *self, IRLAP_EVENT event,
+static int irlap_state_offline(struct irlap_cb *self, IRLAP_EVENT event,
struct sk_buff *skb, struct irlap_info *info);
-static int irlap_state_xmit_p (struct irlap_cb *self, IRLAP_EVENT event,
+static int irlap_state_xmit_p (struct irlap_cb *self, IRLAP_EVENT event,
struct sk_buff *skb, struct irlap_info *info);
-static int irlap_state_pclose (struct irlap_cb *self, IRLAP_EVENT event,
+static int irlap_state_pclose (struct irlap_cb *self, IRLAP_EVENT event,
struct sk_buff *skb, struct irlap_info *info);
-static int irlap_state_nrm_p (struct irlap_cb *self, IRLAP_EVENT event,
+static int irlap_state_nrm_p (struct irlap_cb *self, IRLAP_EVENT event,
struct sk_buff *skb, struct irlap_info *info);
-static int irlap_state_reset_wait(struct irlap_cb *self, IRLAP_EVENT event,
+static int irlap_state_reset_wait(struct irlap_cb *self, IRLAP_EVENT event,
struct sk_buff *skb, struct irlap_info *info);
-static int irlap_state_reset (struct irlap_cb *self, IRLAP_EVENT event,
+static int irlap_state_reset (struct irlap_cb *self, IRLAP_EVENT event,
struct sk_buff *skb, struct irlap_info *info);
-static int irlap_state_nrm_s (struct irlap_cb *self, IRLAP_EVENT event,
+static int irlap_state_nrm_s (struct irlap_cb *self, IRLAP_EVENT event,
struct sk_buff *skb, struct irlap_info *info);
-static int irlap_state_xmit_s (struct irlap_cb *self, IRLAP_EVENT event,
+static int irlap_state_xmit_s (struct irlap_cb *self, IRLAP_EVENT event,
struct sk_buff *skb, struct irlap_info *info);
-static int irlap_state_sclose (struct irlap_cb *self, IRLAP_EVENT event,
+static int irlap_state_sclose (struct irlap_cb *self, IRLAP_EVENT event,
struct sk_buff *skb, struct irlap_info *info);
-static int irlap_state_reset_check(struct irlap_cb *, IRLAP_EVENT event,
+static int irlap_state_reset_check(struct irlap_cb *, IRLAP_EVENT event,
struct sk_buff *, struct irlap_info *);

#ifdef CONFIG_IRDA_DEBUG
@@ -138,8 +138,8 @@
"LAP_RESET_CHECK",
};

-static int (*state[])(struct irlap_cb *self, IRLAP_EVENT event,
- struct sk_buff *skb, struct irlap_info *info) =
+static int (*state[])(struct irlap_cb *self, IRLAP_EVENT event,
+ struct sk_buff *skb, struct irlap_info *info) =
{
irlap_state_ndm,
irlap_state_query,
@@ -167,10 +167,10 @@
static void irlap_poll_timer_expired(void *data)
{
struct irlap_cb *self = (struct irlap_cb *) data;
-
+
ASSERT(self != NULL, return;);
ASSERT(self->magic == LAP_MAGIC, return;);
-
+
irlap_do_event(self, POLL_TIMER_EXPIRED, NULL, NULL);
}

@@ -186,7 +186,7 @@
ASSERT(self->magic == LAP_MAGIC, return;);

#ifdef CONFIG_IRDA_FAST_RR
- /*
+ /*
* Send out the RR frames faster if our own transmit queue is empty, or
* if the peer is busy. The effect is a much faster conversation
*/
@@ -201,7 +201,7 @@
* FIXME: this should be a more configurable
* function
*/
- self->fast_RR_timeout +=
+ self->fast_RR_timeout +=
(sysctl_fast_poll_increase * HZ/1000);

/* Use this fast(er) timeout instead */
@@ -223,7 +223,7 @@
if (timeout == 0)
irlap_do_event(self, POLL_TIMER_EXPIRED, NULL, NULL);
else
- irda_start_timer(&self->poll_timer, timeout, self,
+ irda_start_timer(&self->poll_timer, timeout, self,
irlap_poll_timer_expired);
}

@@ -231,28 +231,28 @@
* Function irlap_do_event (event, skb, info)
*
* Rushes through the state machine without any delay. If state == XMIT
- * then send queued data frames.
+ * then send queued data frames.
*/
-void irlap_do_event(struct irlap_cb *self, IRLAP_EVENT event,
- struct sk_buff *skb, struct irlap_info *info)
+void irlap_do_event(struct irlap_cb *self, IRLAP_EVENT event,
+ struct sk_buff *skb, struct irlap_info *info)
{
int ret;
-
+
if (!self || self->magic != LAP_MAGIC)
return;

- IRDA_DEBUG(3, __FUNCTION__ "(), event = %s, state = %s\n",
- irlap_event[event], irlap_state[self->state]);
-
+ IRDA_DEBUG(3, __FUNCTION__ "(), event = %s, state = %s\n",
+ irlap_event[event], irlap_state[self->state]);
+
ret = (*state[self->state])(self, event, skb, info);

- /*
+ /*
* Check if there are any pending events that needs to be executed
*/
switch (self->state) {
case LAP_XMIT_P: /* FALLTHROUGH */
case LAP_XMIT_S:
- /*
+ /*
* We just received the pf bit and are at the beginning
* of a new LAP transmit window.
* Check if there are any queued data frames, and do not
@@ -299,15 +299,15 @@
self->local_busy = FALSE;
} else if (self->disconnect_pending) {
self->disconnect_pending = FALSE;
-
+
ret = (*state[self->state])(self, DISCONNECT_REQUEST,
NULL, NULL);
}
break;
/* case LAP_NDM: */
-/* case LAP_CONN: */
-/* case LAP_RESET_WAIT: */
-/* case LAP_RESET_CHECK: */
+/* case LAP_CONN: */
+/* case LAP_RESET_WAIT: */
+/* case LAP_RESET_CHECK: */
default:
break;
}
@@ -319,12 +319,12 @@
* Switches state and provides debug information
*
*/
-static inline void irlap_next_state(struct irlap_cb *self, IRLAP_STATE state)
-{
+static inline void irlap_next_state(struct irlap_cb *self, IRLAP_STATE state)
+{
/*
if (!self || self->magic != LAP_MAGIC)
return;
-
+
IRDA_DEBUG(4, "next LAP state = %s\n", irlap_state[state]);
*/
self->state = state;
@@ -336,8 +336,8 @@
* NDM (Normal Disconnected Mode) state
*
*/
-static int irlap_state_ndm(struct irlap_cb *self, IRLAP_EVENT event,
- struct sk_buff *skb, struct irlap_info *info)
+static int irlap_state_ndm(struct irlap_cb *self, IRLAP_EVENT event,
+ struct sk_buff *skb, struct irlap_info *info)
{
discovery_t *discovery_rsp;
int ret = 0;
@@ -355,14 +355,14 @@
* postpone the event... - Jean II */
IRDA_DEBUG(0, __FUNCTION__
"(), CONNECT_REQUEST: media busy!\n");
-
+
/* Always switch state before calling upper layers */
irlap_next_state(self, LAP_NDM);
-
+
irlap_disconnect_indication(self, LAP_MEDIA_BUSY);
} else {
irlap_send_snrm_frame(self, &self->qos_rx);
-
+
/* Start Final-bit timer */
irlap_start_final_timer(self, self->final_timeout);

@@ -372,10 +372,10 @@
break;
case RECV_SNRM_CMD:
/* Check if the frame contains and I field */
- if (info) {
+ if (info) {
self->daddr = info->daddr;
self->caddr = info->caddr;
-
+
irlap_next_state(self, LAP_CONN);

irlap_connect_indication(self, skb);
@@ -384,21 +384,21 @@
"contain an I field!\n");
}
break;
- case DISCOVERY_REQUEST:
+ case DISCOVERY_REQUEST:
ASSERT(info != NULL, return -1;);

- if (self->media_busy) {
- IRDA_DEBUG(0, __FUNCTION__ "(), media busy!\n");
+ if (self->media_busy) {
+ IRDA_DEBUG(0, __FUNCTION__ "(), media busy!\n");
/* irlap->log.condition = MEDIA_BUSY; */
-
+
/* This will make IrLMP try again */
- irlap_discovery_confirm(self, NULL);
+ irlap_discovery_confirm(self, NULL);
/* Note : the discovery log is not cleaned up here,
* it will be done in irlap_discovery_request()
* Jean II */
return 0;
- }
-
+ }
+
self->S = info->S;
self->s = info->s;
irlap_send_discovery_xid_frame(self, info->S, info->s, TRUE,
@@ -419,17 +419,17 @@
if (self->slot == info->s) {
discovery_rsp = irlmp_get_discovery_response();
discovery_rsp->daddr = info->daddr;
-
- irlap_send_discovery_xid_frame(self, info->S,
- self->slot,
+
+ irlap_send_discovery_xid_frame(self, info->S,
+ self->slot,
FALSE,
discovery_rsp);
self->frame_sent = TRUE;
} else
self->frame_sent = FALSE;
-
- /*
- * Remember to multiply the query timeout value with
+
+ /*
+ * Remember to multiply the query timeout value with
* the number of slots used
*/
irlap_start_query_timer(self, QUERY_TIMEOUT*info->S);
@@ -453,7 +453,7 @@
IRDA_DEBUG(1, __FUNCTION__ "(), Receiving final discovery request, missed the discovery slots :-(\n");

/* Last discovery request -> in the log */
- irlap_discovery_indication(self, info->discovery);
+ irlap_discovery_indication(self, info->discovery);
}
break;
case MEDIA_BUSY_TIMER_EXPIRED:
@@ -472,7 +472,7 @@
/* We don't send the frame, just post an event.
* Also, previously this code was in timer.c...
* Jean II */
- ret = (*state[self->state])(self, SEND_UI_FRAME,
+ ret = (*state[self->state])(self, SEND_UI_FRAME,
NULL, NULL);
}
#endif /* CONFIG_IRDA_ULTRA */
@@ -488,7 +488,7 @@
irlap_disconnect_indication(self, LAP_DISC_INDICATION);
else
ret = (*state[self->state])(self,
- CONNECT_REQUEST,
+ CONNECT_REQUEST,
NULL, NULL);
self->disconnect_pending = FALSE;
}
@@ -506,13 +506,13 @@
break;
#ifdef CONFIG_IRDA_ULTRA
case SEND_UI_FRAME:
- {
+ {
int i;
/* Only allowed to repeat an operation twice */
for (i=0; ((i<2) && (self->media_busy == FALSE)); i++) {
skb = skb_dequeue(&self->txq_ultra);
if (skb)
- irlap_send_ui_frame(self, skb, CBROADCAST,
+ irlap_send_ui_frame(self, skb, CBROADCAST,
CMD_FRAME);
else
break;
@@ -526,7 +526,7 @@
case RECV_UI_FRAME:
/* Only accept broadcast frames in NDM mode */
if (info->caddr != CBROADCAST) {
- IRDA_DEBUG(0, __FUNCTION__
+ IRDA_DEBUG(0, __FUNCTION__
"(), not a broadcast frame!\n");
} else
irlap_unitdata_indication(self, skb);
@@ -536,7 +536,7 @@
/* Remove test frame header */
skb_pull(skb, sizeof(struct test_frame));

- /*
+ /*
* Send response. This skb will not be sent out again, and
* will only be used to send out the same info as the cmd
*/
@@ -546,12 +546,12 @@
IRDA_DEBUG(0, __FUNCTION__ "() not implemented!\n");
break;
default:
- IRDA_DEBUG(2, __FUNCTION__ "(), Unknown event %s\n",
+ IRDA_DEBUG(2, __FUNCTION__ "(), Unknown event %s\n",
irlap_event[event]);
-
+
ret = -1;
break;
- }
+ }
return ret;
}

@@ -561,8 +561,8 @@
* QUERY state
*
*/
-static int irlap_state_query(struct irlap_cb *self, IRLAP_EVENT event,
- struct sk_buff *skb, struct irlap_info *info)
+static int irlap_state_query(struct irlap_cb *self, IRLAP_EVENT event,
+ struct sk_buff *skb, struct irlap_info *info)
{
int ret = 0;

@@ -574,16 +574,16 @@
ASSERT(info != NULL, return -1;);
ASSERT(info->discovery != NULL, return -1;);

- IRDA_DEBUG(4, __FUNCTION__ "(), daddr=%08x\n",
+ IRDA_DEBUG(4, __FUNCTION__ "(), daddr=%08x\n",
info->discovery->daddr);

if (!self->discovery_log) {
- WARNING(__FUNCTION__ "(), discovery log is gone! "
+ WARNING("%s: discovery log is gone! "
"maybe the discovery timeout has been set to "
- "short?\n");
+ "short?\n", __FUNCTION__);
break;
}
- hashbin_insert(self->discovery_log,
+ hashbin_insert(self->discovery_log,
(irda_queue_t *) info->discovery,
info->discovery->daddr, NULL);

@@ -609,17 +609,17 @@

/* Last discovery request ? */
if (info->s == 0xff)
- irlap_discovery_indication(self, info->discovery);
+ irlap_discovery_indication(self, info->discovery);
break;
case SLOT_TIMER_EXPIRED:
/*
* Wait a little longer if we detect an incoming frame. This
- * is not mentioned in the spec, but is a good thing to do,
+ * is not mentioned in the spec, but is a good thing to do,
* since we want to work even with devices that violate the
* timing requirements.
*/
if (irda_device_is_receiving(self->netdev) && !self->add_wait) {
- IRDA_DEBUG(2, __FUNCTION__
+ IRDA_DEBUG(2, __FUNCTION__
"(), device is slow to answer, "
"waiting some more!\n");
irlap_start_slot_timer(self, MSECS_TO_JIFFIES(10));
@@ -629,25 +629,25 @@
self->add_wait = FALSE;

if (self->s < self->S) {
- irlap_send_discovery_xid_frame(self, self->S,
+ irlap_send_discovery_xid_frame(self, self->S,
self->s, TRUE,
self->discovery_cmd);
self->s++;
irlap_start_slot_timer(self, self->slot_timeout);
-
+
/* Keep state */
irlap_next_state(self, LAP_QUERY);
} else {
/* This is the final slot! */
- irlap_send_discovery_xid_frame(self, self->S, 0xff,
+ irlap_send_discovery_xid_frame(self, self->S, 0xff,
TRUE,
self->discovery_cmd);

/* Always switch state before calling upper layers */
irlap_next_state(self, LAP_NDM);
-
+
/*
- * We are now finished with the discovery procedure,
+ * We are now finished with the discovery procedure,
* so now we must return the results
*/
irlap_discovery_confirm(self, self->discovery_log);
@@ -657,7 +657,7 @@
}
break;
default:
- IRDA_DEBUG(2, __FUNCTION__ "(), Unknown event %s\n",
+ IRDA_DEBUG(2, __FUNCTION__ "(), Unknown event %s\n",
irlap_event[event]);

ret = -1;
@@ -671,10 +671,10 @@
*
* REPLY, we have received a XID discovery frame from a device and we
* are waiting for the right time slot to send a response XID frame
- *
+ *
*/
-static int irlap_state_reply(struct irlap_cb *self, IRLAP_EVENT event,
- struct sk_buff *skb, struct irlap_info *info)
+static int irlap_state_reply(struct irlap_cb *self, IRLAP_EVENT event,
+ struct sk_buff *skb, struct irlap_info *info)
{
discovery_t *discovery_rsp;
int ret=0;
@@ -695,13 +695,13 @@
/* Last frame? */
if (info->s == 0xff) {
del_timer(&self->query_timer);
-
+
/* info->log.condition = REMOTE; */

/* Always switch state before calling upper layers */
irlap_next_state(self, LAP_NDM);

- irlap_discovery_indication(self, info->discovery);
+ irlap_discovery_indication(self, info->discovery);
} else if ((info->s >= self->slot) && (!self->frame_sent)) {
discovery_rsp = irlmp_get_discovery_response();
discovery_rsp->daddr = info->daddr;
@@ -709,7 +709,7 @@
irlap_send_discovery_xid_frame(self, info->S,
self->slot, FALSE,
discovery_rsp);
-
+
self->frame_sent = TRUE;
irlap_next_state(self, LAP_REPLY);
}
@@ -728,11 +728,11 @@
* Function irlap_state_conn (event, skb, info)
*
* CONN, we have received a SNRM command and is waiting for the upper
- * layer to accept or refuse connection
+ * layer to accept or refuse connection
*
*/
-static int irlap_state_conn(struct irlap_cb *self, IRLAP_EVENT event,
- struct sk_buff *skb, struct irlap_info *info)
+static int irlap_state_conn(struct irlap_cb *self, IRLAP_EVENT event,
+ struct sk_buff *skb, struct irlap_info *info)
{
int ret = 0;

@@ -751,20 +751,20 @@

irlap_initiate_connection_state(self);

- /*
+ /*
* Applying the parameters now will make sure we change speed
* *after* we have sent the next frame
*/
irlap_apply_connection_parameters(self, FALSE);

- /*
+ /*
* Sending this frame will force a speed change after it has
* been sent (i.e. the frame will be sent at 9600).
*/
irlap_send_ua_response_frame(self, &self->qos_rx);

#if 0
- /*
+ /*
* We are allowed to send two frames, but this may increase
* the connect latency, so lets not do it for now.
*/
@@ -787,20 +787,20 @@
#endif

/*
- * The WD-timer could be set to the duration of the P-timer
- * for this case, but it is recommended to use twice the
- * value (note 3 IrLAP p. 60).
+ * The WD-timer could be set to the duration of the P-timer
+ * for this case, but it is recommended to use twice the
+ * value (note 3 IrLAP p. 60).
*/
irlap_start_wd_timer(self, self->wd_timeout);
irlap_next_state(self, LAP_NRM_S);

break;
case RECV_DISCOVERY_XID_CMD:
- IRDA_DEBUG(3, __FUNCTION__
+ IRDA_DEBUG(3, __FUNCTION__
"(), event RECV_DISCOVER_XID_CMD!\n");
irlap_next_state(self, LAP_NDM);

- break;
+ break;
case DISCONNECT_REQUEST:
IRDA_DEBUG(0, __FUNCTION__ "(), Disconnect request!\n");
irlap_send_dm_frame(self);
@@ -810,11 +810,11 @@
default:
IRDA_DEBUG(1, __FUNCTION__ "(), Unknown event %d, %s\n", event,
irlap_event[event]);
-
+
ret = -1;
break;
}
-
+
return ret;
}

@@ -825,26 +825,26 @@
* a remote peer layer and is awaiting a reply .
*
*/
-static int irlap_state_setup(struct irlap_cb *self, IRLAP_EVENT event,
- struct sk_buff *skb, struct irlap_info *info)
+static int irlap_state_setup(struct irlap_cb *self, IRLAP_EVENT event,
+ struct sk_buff *skb, struct irlap_info *info)
{
int ret = 0;

IRDA_DEBUG(4, __FUNCTION__ "()\n");
-
+
ASSERT(self != NULL, return -1;);
ASSERT(self->magic == LAP_MAGIC, return -1;);

switch (event) {
case FINAL_TIMER_EXPIRED:
if (self->retry_count < self->N3) {
-/*
- * Perform random backoff, Wait a random number of time units, minimum
- * duration half the time taken to transmitt a SNRM frame, maximum duration
- * 1.5 times the time taken to transmit a SNRM frame. So this time should
+/*
+ * Perform random backoff, Wait a random number of time units, minimum
+ * duration half the time taken to transmitt a SNRM frame, maximum duration
+ * 1.5 times the time taken to transmit a SNRM frame. So this time should
* between 15 msecs and 45 msecs.
*/
- irlap_start_backoff_timer(self, MSECS_TO_JIFFIES(20 +
+ irlap_start_backoff_timer(self, MSECS_TO_JIFFIES(20 +
(jiffies % 30)));
} else {
/* Always switch state before calling upper layers */
@@ -877,18 +877,18 @@
skb_pull(skb, sizeof(struct snrm_frame));

irlap_qos_negotiate(self, skb);
-
+
/* Send UA frame and then change link settings */
irlap_apply_connection_parameters(self, FALSE);
irlap_send_ua_response_frame(self, &self->qos_rx);

irlap_next_state(self, LAP_NRM_S);
irlap_connect_confirm(self, skb);
-
- /*
+
+ /*
* The WD-timer could be set to the duration of the
* P-timer for this case, but it is recommended
- * to use twice the value (note 3 IrLAP p. 60).
+ * to use twice the value (note 3 IrLAP p. 60).
*/
irlap_start_wd_timer(self, self->wd_timeout);
} else {
@@ -915,7 +915,7 @@
/* Set the new link setting *now* (before the rr frame) */
irlap_apply_connection_parameters(self, TRUE);
self->retry_count = 0;
-
+
/* Wait for turnaround time to give a chance to the other
* device to be ready to receive us.
* Note : the time to switch speed is typically larger
@@ -933,7 +933,7 @@
irlap_connect_confirm(self, skb);
break;
case RECV_DM_RSP: /* FALLTHROUGH */
- case RECV_DISC_CMD:
+ case RECV_DISC_CMD:
del_timer(&self->final_timer);
irlap_next_state(self, LAP_NDM);

@@ -941,11 +941,11 @@
break;
default:
IRDA_DEBUG(1, __FUNCTION__ "(), Unknown event %d, %s\n", event,
- irlap_event[event]);
+ irlap_event[event]);

ret = -1;
break;
- }
+ }
return ret;
}

@@ -955,8 +955,8 @@
* OFFLINE state, not used for now!
*
*/
-static int irlap_state_offline(struct irlap_cb *self, IRLAP_EVENT event,
- struct sk_buff *skb, struct irlap_info *info)
+static int irlap_state_offline(struct irlap_cb *self, IRLAP_EVENT event,
+ struct sk_buff *skb, struct irlap_info *info)
{
IRDA_DEBUG( 0, __FUNCTION__ "(), Unknown event\n");

@@ -965,31 +965,31 @@

/*
* Function irlap_state_xmit_p (self, event, skb, info)
- *
+ *
* XMIT, Only the primary station has right to transmit, and we
* therefore do not expect to receive any transmissions from other
* stations.
- *
+ *
*/
-static int irlap_state_xmit_p(struct irlap_cb *self, IRLAP_EVENT event,
- struct sk_buff *skb, struct irlap_info *info)
+static int irlap_state_xmit_p(struct irlap_cb *self, IRLAP_EVENT event,
+ struct sk_buff *skb, struct irlap_info *info)
{
int ret = 0;
-
+
switch (event) {
case SEND_I_CMD:
/*
* Only send frame if send-window > 0.
- */
+ */
if ((self->window > 0) && (!self->remote_busy)) {
#ifdef CONFIG_IRDA_DYNAMIC_WINDOW
/*
- * Test if we have transmitted more bytes over the
- * link than its possible to do with the current
+ * Test if we have transmitted more bytes over the
+ * link than its possible to do with the current
* speed and turn-around-time.
*/
if (skb->len > self->bytes_left) {
- IRDA_DEBUG(4, __FUNCTION__
+ IRDA_DEBUG(4, __FUNCTION__
"(), Not allowed to transmit more "
"bytes!\n");
skb_queue_head(&self->txq, skb_get(skb));
@@ -1009,18 +1009,18 @@
* Send data with poll bit cleared only if window > 1
* and there is more frames after this one to be sent
*/
- if ((self->window > 1) &&
- skb_queue_len( &self->txq) > 0)
- {
+ if ((self->window > 1) &&
+ skb_queue_len( &self->txq) > 0)
+ {
irlap_send_data_primary(self, skb);
irlap_next_state(self, LAP_XMIT_P);
} else {
irlap_send_data_primary_poll(self, skb);
irlap_next_state(self, LAP_NRM_P);
-
- /*
+
+ /*
* Make sure state machine does not try to send
- * any more frames
+ * any more frames
*/
ret = -EPROTO;
}
@@ -1029,12 +1029,12 @@
self->fast_RR = FALSE;
#endif /* CONFIG_IRDA_FAST_RR */
} else {
- IRDA_DEBUG(4, __FUNCTION__
+ IRDA_DEBUG(4, __FUNCTION__
"(), Unable to send! remote busy?\n");
skb_queue_head(&self->txq, skb_get(skb));

/*
- * The next ret is important, because it tells
+ * The next ret is important, because it tells
* irlap_next_state _not_ to deliver more frames
*/
ret = -EPROTO;
@@ -1067,7 +1067,7 @@
* when we return... - Jean II */
break;
default:
- IRDA_DEBUG(0, __FUNCTION__ "(), Unknown event %s\n",
+ IRDA_DEBUG(0, __FUNCTION__ "(), Unknown event %s\n",
irlap_event[event]);

ret = -EINVAL;
@@ -1081,15 +1081,15 @@
*
* PCLOSE state
*/
-static int irlap_state_pclose(struct irlap_cb *self, IRLAP_EVENT event,
- struct sk_buff *skb, struct irlap_info *info)
+static int irlap_state_pclose(struct irlap_cb *self, IRLAP_EVENT event,
+ struct sk_buff *skb, struct irlap_info *info)
{
int ret = 0;

IRDA_DEBUG(1, __FUNCTION__ "()\n");
-
+
ASSERT(self != NULL, return -1;);
- ASSERT(self->magic == LAP_MAGIC, return -1;);
+ ASSERT(self->magic == LAP_MAGIC, return -1;);

switch (event) {
case RECV_UA_RSP: /* FALLTHROUGH */
@@ -1101,7 +1101,7 @@

/* Always switch state before calling upper layers */
irlap_next_state(self, LAP_NDM);
-
+
irlap_disconnect_indication(self, LAP_DISC_INDICATION);
break;
case FINAL_TIMER_EXPIRED:
@@ -1124,7 +1124,7 @@
IRDA_DEBUG(1, __FUNCTION__ "(), Unknown event %d\n", event);

ret = -1;
- break;
+ break;
}
return ret;
}
@@ -1138,8 +1138,8 @@
* transmit any frames and is expecting to receive frames only from the
* secondary to which transmission permissions has been given.
*/
-static int irlap_state_nrm_p(struct irlap_cb *self, IRLAP_EVENT event,
- struct sk_buff *skb, struct irlap_info *info)
+static int irlap_state_nrm_p(struct irlap_cb *self, IRLAP_EVENT event,
+ struct sk_buff *skb, struct irlap_info *info)
{
int ret = 0;
int ns_status;
@@ -1149,7 +1149,7 @@
case RECV_I_RSP: /* Optimize for the common case */
/* FIXME: must check for remote_busy below */
#ifdef CONFIG_IRDA_FAST_RR
- /*
+ /*
* Reset the fast_RR so we can use the fast RR code with
* full speed the next time since peer may have more frames
* to transmitt
@@ -1161,19 +1161,19 @@
ns_status = irlap_validate_ns_received(self, info->ns);
nr_status = irlap_validate_nr_received(self, info->nr);

- /*
+ /*
* Check for expected I(nformation) frame
*/
if ((ns_status == NS_EXPECTED) && (nr_status == NR_EXPECTED)) {
/* poll bit cleared? */
if (!info->pf) {
self->vr = (self->vr + 1) % 8;
-
+
/* Update Nr received */
irlap_update_nr_received( self, info->nr);
-
+
self->ack_required = TRUE;
-
+
/* Keep state, do not move this line */
irlap_next_state(self, LAP_NRM_P);

@@ -1182,18 +1182,18 @@
del_timer(&self->final_timer);

self->vr = (self->vr + 1) % 8;
-
+
/* Update Nr received */
irlap_update_nr_received(self, info->nr);
-
- /*
+
+ /*
* Got expected NR, so reset the
* retry_count. This is not done by IrLAP,
- * which is strange!
+ * which is strange!
*/
self->retry_count = 0;
self->ack_required = TRUE;
-
+
irlap_wait_min_turn_around(self, &self->qos_tx);

/* Call higher layer *before* changing state
@@ -1218,16 +1218,16 @@
irlap_start_poll_timer(self, self->poll_timeout);
}
break;
-
+
}
/* Unexpected next to send (Ns) */
if ((ns_status == NS_UNEXPECTED) && (nr_status == NR_EXPECTED))
{
if (!info->pf) {
irlap_update_nr_received(self, info->nr);
-
+
/*
- * Wait until the last frame before doing
+ * Wait until the last frame before doing
* anything
*/

@@ -1236,57 +1236,57 @@
} else {
IRDA_DEBUG(4, __FUNCTION__
"(), missing or duplicate frame!\n");
-
+
/* Update Nr received */
irlap_update_nr_received(self, info->nr);
-
+
irlap_wait_min_turn_around(self, &self->qos_tx);
irlap_send_rr_frame(self, CMD_FRAME);
-
+
self->ack_required = FALSE;
-
+
irlap_start_final_timer(self, self->final_timeout);
irlap_next_state(self, LAP_NRM_P);
}
break;
}
- /*
- * Unexpected next to receive (Nr)
+ /*
+ * Unexpected next to receive (Nr)
*/
if ((ns_status == NS_EXPECTED) && (nr_status == NR_UNEXPECTED))
{
if (info->pf) {
self->vr = (self->vr + 1) % 8;
-
+
/* Update Nr received */
irlap_update_nr_received(self, info->nr);
-
+
/* Resend rejected frames */
irlap_resend_rejected_frames(self, CMD_FRAME);
-
+
self->ack_required = FALSE;
irlap_start_final_timer(self, self->final_timeout);
-
+
/* Keep state, do not move this line */
irlap_next_state(self, LAP_NRM_P);

irlap_data_indication(self, skb, FALSE);
} else {
- /*
+ /*
* Do not resend frames until the last
* frame has arrived from the other
* device. This is not documented in
- * IrLAP!!
+ * IrLAP!!
*/
self->vr = (self->vr + 1) % 8;

/* Update Nr received */
irlap_update_nr_received(self, info->nr);
-
+
self->ack_required = FALSE;

/* Keep state, do not move this line!*/
- irlap_next_state(self, LAP_NRM_P);
+ irlap_next_state(self, LAP_NRM_P);

irlap_data_indication(self, skb, FALSE);
}
@@ -1296,15 +1296,15 @@
* Unexpected next to send (Ns) and next to receive (Nr)
* Not documented by IrLAP!
*/
- if ((ns_status == NS_UNEXPECTED) &&
- (nr_status == NR_UNEXPECTED))
+ if ((ns_status == NS_UNEXPECTED) &&
+ (nr_status == NR_UNEXPECTED))
{
- IRDA_DEBUG(4, __FUNCTION__
+ IRDA_DEBUG(4, __FUNCTION__
"(), unexpected nr and ns!\n");
if (info->pf) {
/* Resend rejected frames */
irlap_resend_rejected_frames(self, CMD_FRAME);
-
+
/* Give peer some time to retransmit! */
irlap_start_final_timer(self, self->final_timeout);

@@ -1313,7 +1313,7 @@
} else {
/* Update Nr received */
/* irlap_update_nr_received( info->nr); */
-
+
self->ack_required = FALSE;
}
break;
@@ -1325,23 +1325,23 @@
if ((nr_status == NR_INVALID) || (ns_status == NS_INVALID)) {
if (info->pf) {
del_timer(&self->final_timer);
-
+
irlap_next_state(self, LAP_RESET_WAIT);
-
+
irlap_disconnect_indication(self, LAP_RESET_INDICATION);
self->xmitflag = TRUE;
} else {
del_timer(&self->final_timer);
-
+
irlap_disconnect_indication(self, LAP_RESET_INDICATION);
-
+
self->xmitflag = FALSE;
}
break;
}
IRDA_DEBUG(1, __FUNCTION__ "(), Not implemented!\n");
- IRDA_DEBUG(1, __FUNCTION__
- "(), event=%s, ns_status=%d, nr_status=%d\n",
+ IRDA_DEBUG(1, __FUNCTION__
+ "(), event=%s, ns_status=%d, nr_status=%d\n",
irlap_event[ event], ns_status, nr_status);
break;
case RECV_UI_FRAME:
@@ -1353,34 +1353,34 @@
del_timer(&self->final_timer);
irlap_data_indication(self, skb, TRUE);
irlap_next_state(self, LAP_XMIT_P);
- printk(__FUNCTION__ "(): RECV_UI_FRAME: next state %s\n", irlap_state[self->state]);
+ printk("%s: RECV_UI_FRAME: next state %s\n", __FUNCTION__, irlap_state[self->state]);
irlap_start_poll_timer(self, self->poll_timeout);
}
break;
case RECV_RR_RSP:
- /*
- * If you get a RR, the remote isn't busy anymore,
- * no matter what the NR
+ /*
+ * If you get a RR, the remote isn't busy anymore,
+ * no matter what the NR
*/
self->remote_busy = FALSE;

- /*
- * Nr as expected?
+ /*
+ * Nr as expected?
*/
ret = irlap_validate_nr_received(self, info->nr);
- if (ret == NR_EXPECTED) {
+ if (ret == NR_EXPECTED) {
/* Stop final timer */
del_timer(&self->final_timer);
-
+
/* Update Nr received */
irlap_update_nr_received(self, info->nr);
-
+
/*
- * Got expected NR, so reset the retry_count. This
- * is not done by the IrLAP standard , which is
+ * Got expected NR, so reset the retry_count. This
+ * is not done by the IrLAP standard , which is
* strange! DB.
*/
- self->retry_count = 0;
+ self->retry_count = 0;
irlap_wait_min_turn_around(self, &self->qos_tx);

irlap_next_state(self, LAP_XMIT_P);
@@ -1388,22 +1388,22 @@
/* Start poll timer */
irlap_start_poll_timer(self, self->poll_timeout);
} else if (ret == NR_UNEXPECTED) {
- ASSERT(info != NULL, return -1;);
- /*
- * Unexpected nr!
+ ASSERT(info != NULL, return -1;);
+ /*
+ * Unexpected nr!
*/
-
+
/* Update Nr received */
irlap_update_nr_received(self, info->nr);

IRDA_DEBUG(4, "RECV_RR_FRAME: Retrans:%d, nr=%d, va=%d, "
"vs=%d, vr=%d\n",
- self->retry_count, info->nr, self->va,
+ self->retry_count, info->nr, self->va,
self->vs, self->vr);
-
+
/* Resend rejected frames */
irlap_resend_rejected_frames(self, CMD_FRAME);
-
+
irlap_next_state(self, LAP_NRM_P);
} else if (ret == NR_INVALID) {
IRDA_DEBUG(1, __FUNCTION__ "(), Received RR with "
@@ -1426,7 +1426,7 @@
/* Update Nr received */
irlap_update_nr_received(self, info->nr);
irlap_next_state(self, LAP_XMIT_P);
-
+
/* Start poll timer */
irlap_start_poll_timer(self, self->poll_timeout);
break;
@@ -1437,7 +1437,7 @@
irlap_reset_indication(self);
break;
case FINAL_TIMER_EXPIRED:
- /*
+ /*
* We are allowed to wait for additional 300 ms if
* final timer expires when we are in the middle
* of receiving a frame (page 45, IrLAP). Check that
@@ -1449,8 +1449,8 @@
irlap_start_final_timer(self, MSECS_TO_JIFFIES(300));

/*
- * Don't allow this to happen one more time in a row,
- * or else we can get a pretty tight loop here if
+ * Don't allow this to happen one more time in a row,
+ * or else we can get a pretty tight loop here if
* if we only receive half a frame. DB.
*/
self->add_wait = TRUE;
@@ -1463,9 +1463,9 @@
/* Retry sending the pf bit to the secondary */
irlap_wait_min_turn_around(self, &self->qos_tx);
irlap_send_rr_frame(self, CMD_FRAME);
-
+
irlap_start_final_timer(self, self->final_timeout);
- self->retry_count++;
+ self->retry_count++;
IRDA_DEBUG(4, "irlap_state_nrm_p: FINAL_TIMER_EXPIRED:"
" retry_count=%d\n", self->retry_count);

@@ -1515,7 +1515,7 @@
irlap_disconnect_request(self);
break;
default:
- IRDA_DEBUG(1, __FUNCTION__ "(), Unknown event %s\n",
+ IRDA_DEBUG(1, __FUNCTION__ "(), Unknown event %s\n",
irlap_event[event]);

ret = -1;
@@ -1531,16 +1531,16 @@
* awaiting reset of disconnect request.
*
*/
-static int irlap_state_reset_wait(struct irlap_cb *self, IRLAP_EVENT event,
+static int irlap_state_reset_wait(struct irlap_cb *self, IRLAP_EVENT event,
struct sk_buff *skb, struct irlap_info *info)
{
int ret = 0;
-
+
IRDA_DEBUG(3, __FUNCTION__ "(), event = %s\n", irlap_event[event]);
-
+
ASSERT(self != NULL, return -1;);
ASSERT(self->magic == LAP_MAGIC, return -1;);
-
+
switch (event) {
case RESET_REQUEST:
if (self->xmitflag) {
@@ -1562,11 +1562,11 @@
irlap_next_state( self, LAP_PCLOSE);
break;
default:
- IRDA_DEBUG(2, __FUNCTION__ "(), Unknown event %s\n",
+ IRDA_DEBUG(2, __FUNCTION__ "(), Unknown event %s\n",
irlap_event[event]);

ret = -1;
- break;
+ break;
}
return ret;
}
@@ -1578,16 +1578,16 @@
* reply.
*
*/
-static int irlap_state_reset(struct irlap_cb *self, IRLAP_EVENT event,
+static int irlap_state_reset(struct irlap_cb *self, IRLAP_EVENT event,
struct sk_buff *skb, struct irlap_info *info)
{
int ret = 0;
-
+
IRDA_DEBUG(3, __FUNCTION__ "(), event = %s\n", irlap_event[event]);
-
+
ASSERT(self != NULL, return -1;);
ASSERT(self->magic == LAP_MAGIC, return -1;);
-
+
switch (event) {
case RECV_DISC_CMD:
del_timer(&self->final_timer);
@@ -1602,12 +1602,12 @@
break;
case RECV_UA_RSP:
del_timer(&self->final_timer);
-
+
/* Initiate connection state */
irlap_initiate_connection_state(self);
-
+
irlap_reset_confirm();
-
+
self->remote_busy = FALSE;

irlap_next_state(self, LAP_XMIT_P);
@@ -1628,16 +1628,16 @@
irlap_next_state(self, LAP_RESET);
} else if (self->retry_count >= self->N3) {
irlap_apply_default_connection_parameters(self);
-
+
/* Always switch state before calling upper layers */
irlap_next_state(self, LAP_NDM);
-
+
irlap_disconnect_indication(self, LAP_NO_RESPONSE);
}
break;
case RECV_SNRM_CMD:
- /*
- * SNRM frame is not allowed to contain an I-field in this
+ /*
+ * SNRM frame is not allowed to contain an I-field in this
* state
*/
if (!info) {
@@ -1649,47 +1649,47 @@
irlap_start_wd_timer(self, self->wd_timeout);
irlap_next_state(self, LAP_NDM);
} else {
- IRDA_DEBUG(0, __FUNCTION__
+ IRDA_DEBUG(0, __FUNCTION__
"(), SNRM frame contained an I field!\n");
}
break;
default:
- IRDA_DEBUG(1, __FUNCTION__ "(), Unknown event %s\n",
- irlap_event[event]);
+ IRDA_DEBUG(1, __FUNCTION__ "(), Unknown event %s\n",
+ irlap_event[event]);

ret = -1;
- break;
+ break;
}
return ret;
}

/*
* Function irlap_state_xmit_s (event, skb, info)
- *
+ *
* XMIT_S, The secondary station has been given the right to transmit,
* and we therefor do not expect to receive any transmissions from other
- * stations.
+ * stations.
*/
-static int irlap_state_xmit_s(struct irlap_cb *self, IRLAP_EVENT event,
- struct sk_buff *skb, struct irlap_info *info)
+static int irlap_state_xmit_s(struct irlap_cb *self, IRLAP_EVENT event,
+ struct sk_buff *skb, struct irlap_info *info)
{
int ret = 0;
-
- IRDA_DEBUG(4, __FUNCTION__ "(), event=%s\n", irlap_event[event]);
+
+ IRDA_DEBUG(4, __FUNCTION__ "(), event=%s\n", irlap_event[event]);

ASSERT(self != NULL, return -ENODEV;);
ASSERT(self->magic == LAP_MAGIC, return -EBADR;);
-
+
switch (event) {
case SEND_I_CMD:
/*
* Send frame only if send window > 1
- */
+ */
if ((self->window > 0) && (!self->remote_busy)) {
#ifdef CONFIG_IRDA_DYNAMIC_WINDOW
/*
- * Test if we have transmitted more bytes over the
- * link than its possible to do with the current
+ * Test if we have transmitted more bytes over the
+ * link than its possible to do with the current
* speed and turn-around-time.
*/
if (skb->len > self->bytes_left) {
@@ -1697,7 +1697,7 @@

/*
* Switch to NRM_S, this is only possible
- * when we are in secondary mode, since we
+ * when we are in secondary mode, since we
* must be sure that we don't miss any RR
* frames
*/
@@ -1715,18 +1715,18 @@
* Send data with final bit cleared only if window > 1
* and there is more frames to be sent
*/
- if ((self->window > 1) &&
- skb_queue_len(&self->txq) > 0)
- {
+ if ((self->window > 1) &&
+ skb_queue_len(&self->txq) > 0)
+ {
irlap_send_data_secondary(self, skb);
irlap_next_state(self, LAP_XMIT_S);
} else {
irlap_send_data_secondary_final(self, skb);
irlap_next_state(self, LAP_NRM_S);

- /*
+ /*
* Make sure state machine does not try to send
- * any more frames
+ * any more frames
*/
ret = -EPROTO;
}
@@ -1747,7 +1747,7 @@
* when we return... - Jean II */
break;
default:
- IRDA_DEBUG(2, __FUNCTION__ "(), Unknown event %s\n",
+ IRDA_DEBUG(2, __FUNCTION__ "(), Unknown event %s\n",
irlap_event[event]);

ret = -EINVAL;
@@ -1759,12 +1759,12 @@
/*
* Function irlap_state_nrm_s (event, skb, info)
*
- * NRM_S (Normal Response Mode as Secondary) state, in this state we are
+ * NRM_S (Normal Response Mode as Secondary) state, in this state we are
* expecting to receive frames from the primary station
*
*/
-static int irlap_state_nrm_s(struct irlap_cb *self, IRLAP_EVENT event,
- struct sk_buff *skb, struct irlap_info *info)
+static int irlap_state_nrm_s(struct irlap_cb *self, IRLAP_EVENT event,
+ struct sk_buff *skb, struct irlap_info *info)
{
int ns_status;
int nr_status;
@@ -1779,28 +1779,28 @@
case RECV_I_CMD: /* Optimize for the common case */
/* FIXME: must check for remote_busy below */
IRDA_DEBUG(4, __FUNCTION__ "(), event=%s nr=%d, vs=%d, ns=%d, "
- "vr=%d, pf=%d\n", irlap_event[event], info->nr,
+ "vr=%d, pf=%d\n", irlap_event[event], info->nr,
self->vs, info->ns, self->vr, info->pf);

self->retry_count = 0;

ns_status = irlap_validate_ns_received(self, info->ns);
nr_status = irlap_validate_nr_received(self, info->nr);
- /*
+ /*
* Check for expected I(nformation) frame
*/
if ((ns_status == NS_EXPECTED) && (nr_status == NR_EXPECTED)) {
- /*
+ /*
* poll bit cleared?
*/
if (!info->pf) {
self->vr = (self->vr + 1) % 8;
-
+
/* Update Nr received */
irlap_update_nr_received(self, info->nr);
-
+
self->ack_required = TRUE;
-
+
/*
* Starting WD-timer here is optional, but
* not recommended. Note 6 IrLAP p. 83
@@ -1815,18 +1815,18 @@
break;
} else {
self->vr = (self->vr + 1) % 8;
-
+
/* Update Nr received */
irlap_update_nr_received(self, info->nr);
-
- /*
+
+ /*
* We should wait before sending RR, and
* also before changing to XMIT_S
- * state. (note 1, IrLAP p. 82)
+ * state. (note 1, IrLAP p. 82)
*/
irlap_wait_min_turn_around(self, &self->qos_tx);

- /*
+ /*
* Give higher layers a chance to
* immediately reply with some data before
* we decide if we should send a RR frame
@@ -1835,17 +1835,17 @@
irlap_data_indication(self, skb, FALSE);

/* Any pending data requests? */
- if ((skb_queue_len(&self->txq) > 0) &&
- (self->window > 0))
+ if ((skb_queue_len(&self->txq) > 0) &&
+ (self->window > 0))
{
self->ack_required = TRUE;
-
+
del_timer(&self->wd_timer);
-
+
irlap_next_state(self, LAP_XMIT_S);
} else {
irlap_send_rr_frame(self, RSP_FRAME);
- irlap_start_wd_timer(self,
+ irlap_start_wd_timer(self,
self->wd_timeout);

/* Keep the state */
@@ -1862,33 +1862,33 @@
/* Unexpected next to send, with final bit cleared */
if (!info->pf) {
irlap_update_nr_received(self, info->nr);
-
+
irlap_start_wd_timer(self, self->wd_timeout);
} else {
/* Update Nr received */
irlap_update_nr_received(self, info->nr);
-
+
irlap_wait_min_turn_around(self, &self->qos_tx);
irlap_send_rr_frame(self, CMD_FRAME);
-
+
irlap_start_wd_timer(self, self->wd_timeout);
}
break;
}

- /*
+ /*
* Unexpected Next to Receive(NR) ?
*/
if ((ns_status == NS_EXPECTED) && (nr_status == NR_UNEXPECTED))
{
if (info->pf) {
IRDA_DEBUG(4, "RECV_I_RSP: frame(s) lost\n");
-
+
self->vr = (self->vr + 1) % 8;
-
+
/* Update Nr received */
irlap_update_nr_received(self, info->nr);
-
+
/* Resend rejected frames */
irlap_resend_rejected_frames(self, RSP_FRAME);

@@ -1905,10 +1905,10 @@
*/
if (!info->pf) {
self->vr = (self->vr + 1) % 8;
-
+
/* Update Nr received */
irlap_update_nr_received(self, info->nr);
-
+
/* Keep state, do not move this line */
irlap_next_state(self, LAP_NRM_S);

@@ -1917,7 +1917,7 @@
}
break;
}
-
+
if (ret == NR_INVALID) {
IRDA_DEBUG(0, "NRM_S, NR_INVALID not implemented!\n");
}
@@ -1926,7 +1926,7 @@
}
break;
case RECV_UI_FRAME:
- /*
+ /*
* poll bit cleared?
*/
if (!info->pf) {
@@ -1936,11 +1936,11 @@
/*
* Any pending data requests?
*/
- if ((skb_queue_len(&self->txq) > 0) &&
- (self->window > 0) && !self->remote_busy)
+ if ((skb_queue_len(&self->txq) > 0) &&
+ (self->window > 0) && !self->remote_busy)
{
irlap_data_indication(self, skb, TRUE);
-
+
del_timer(&self->wd_timer);

irlap_next_state(self, LAP_XMIT_S);
@@ -1951,7 +1951,7 @@

irlap_send_rr_frame(self, RSP_FRAME);
self->ack_required = FALSE;
-
+
irlap_start_wd_timer(self, self->wd_timeout);

/* Keep the state */
@@ -1962,28 +1962,28 @@
case RECV_RR_CMD:
self->retry_count = 0;

- /*
- * Nr as expected?
+ /*
+ * Nr as expected?
*/
nr_status = irlap_validate_nr_received(self, info->nr);
if (nr_status == NR_EXPECTED) {
- if ((skb_queue_len( &self->txq) > 0) &&
+ if ((skb_queue_len( &self->txq) > 0) &&
(self->window > 0)) {
self->remote_busy = FALSE;
-
+
/* Update Nr received */
irlap_update_nr_received(self, info->nr);
del_timer(&self->wd_timer);
-
+
irlap_wait_min_turn_around(self, &self->qos_tx);
irlap_next_state(self, LAP_XMIT_S);
- } else {
+ } else {
self->remote_busy = FALSE;
/* Update Nr received */
irlap_update_nr_received(self, info->nr);
irlap_wait_min_turn_around(self, &self->qos_tx);
irlap_start_wd_timer(self, self->wd_timeout);
-
+
/* Note : if the link is idle (this case),
* we never go in XMIT_S, so we never get a
* chance to process any DISCONNECT_REQUEST.
@@ -1997,7 +1997,7 @@
} else {
/* Just send back pf bit */
irlap_send_rr_frame(self, RSP_FRAME);
-
+
irlap_next_state(self, LAP_NRM_S);
}
}
@@ -2009,11 +2009,11 @@
irlap_start_wd_timer(self, self->wd_timeout);

/* Keep state */
- irlap_next_state(self, LAP_NRM_S);
+ irlap_next_state(self, LAP_NRM_S);
} else {
- IRDA_DEBUG(1, __FUNCTION__
+ IRDA_DEBUG(1, __FUNCTION__
"(), invalid nr not implemented!\n");
- }
+ }
break;
case RECV_SNRM_CMD:
/* SNRM frame is not allowed to contain an I-field */
@@ -2021,12 +2021,12 @@
del_timer(&self->wd_timer);
IRDA_DEBUG(1, __FUNCTION__ "(), received SNRM cmd\n");
irlap_next_state(self, LAP_RESET_CHECK);
-
+
irlap_reset_indication(self);
} else {
- IRDA_DEBUG(0, __FUNCTION__
+ IRDA_DEBUG(0, __FUNCTION__
"(), SNRM frame contained an I-field!\n");
-
+
}
break;
case RECV_REJ_CMD:
@@ -2057,7 +2057,7 @@
* which explain why we use (self->N2 / 2) here !!!
* Jean II
*/
- IRDA_DEBUG(1, __FUNCTION__ "(), retry_count = %d\n",
+ IRDA_DEBUG(1, __FUNCTION__ "(), retry_count = %d\n",
self->retry_count);

if (self->retry_count < (self->N2 / 2)) {
@@ -2070,7 +2070,7 @@
STATUS_NO_ACTIVITY);
} else {
irlap_apply_default_connection_parameters(self);
-
+
/* Always switch state before calling upper layers */
irlap_next_state(self, LAP_NDM);
irlap_disconnect_indication(self, LAP_NO_RESPONSE);
@@ -2110,7 +2110,7 @@
irlap_send_test_frame(self, self->caddr, info->daddr, skb);
break;
default:
- IRDA_DEBUG(1, __FUNCTION__ "(), Unknown event %d, (%s)\n",
+ IRDA_DEBUG(1, __FUNCTION__ "(), Unknown event %d, (%s)\n",
event, irlap_event[event]);

ret = -EINVAL;
@@ -2121,12 +2121,9 @@

/*
* Function irlap_state_sclose (self, event, skb, info)
- *
- *
- *
*/
-static int irlap_state_sclose(struct irlap_cb *self, IRLAP_EVENT event,
- struct sk_buff *skb, struct irlap_info *info)
+static int irlap_state_sclose(struct irlap_cb *self, IRLAP_EVENT event,
+ struct sk_buff *skb, struct irlap_info *info)
{
int ret = 0;

@@ -2134,7 +2131,7 @@

ASSERT(self != NULL, return -ENODEV;);
ASSERT(self->magic == LAP_MAGIC, return -EBADR;);
-
+
switch (event) {
case RECV_DISC_CMD:
/* Always switch state before calling upper layers */
@@ -2156,7 +2153,7 @@

del_timer(&self->wd_timer);
irlap_apply_default_connection_parameters(self);
-
+
irlap_disconnect_indication(self, LAP_DISC_INDICATION);
break;
case WD_TIMER_EXPIRED:
@@ -2164,11 +2161,11 @@
irlap_next_state(self, LAP_NDM);

irlap_apply_default_connection_parameters(self);
-
+
irlap_disconnect_indication(self, LAP_DISC_INDICATION);
break;
default:
- IRDA_DEBUG(1, __FUNCTION__ "(), Unknown event %d, (%s)\n",
+ IRDA_DEBUG(1, __FUNCTION__ "(), Unknown event %d, (%s)\n",
event, irlap_event[event]);

ret = -EINVAL;
@@ -2178,24 +2175,24 @@
return -1;
}

-static int irlap_state_reset_check( struct irlap_cb *self, IRLAP_EVENT event,
- struct sk_buff *skb,
- struct irlap_info *info)
+static int irlap_state_reset_check( struct irlap_cb *self, IRLAP_EVENT event,
+ struct sk_buff *skb,
+ struct irlap_info *info)
{
int ret = 0;

- IRDA_DEBUG(1, __FUNCTION__ "(), event=%s\n", irlap_event[event]);
+ IRDA_DEBUG(1, __FUNCTION__ "(), event=%s\n", irlap_event[event]);

ASSERT(self != NULL, return -ENODEV;);
ASSERT(self->magic == LAP_MAGIC, return -EBADR;);
-
+
switch (event) {
case RESET_RESPONSE:
irlap_send_ua_response_frame(self, &self->qos_rx);
irlap_initiate_connection_state(self);
irlap_start_wd_timer(self, WD_TIMEOUT);
irlap_flush_all_queues(self);
-
+
irlap_next_state(self, LAP_NRM_S);
break;
case DISCONNECT_REQUEST:
@@ -2205,7 +2202,7 @@
irlap_next_state(self, LAP_SCLOSE);
break;
default:
- IRDA_DEBUG(1, __FUNCTION__ "(), Unknown event %d, (%s)\n",
+ IRDA_DEBUG(1, __FUNCTION__ "(), Unknown event %d, (%s)\n",
event, irlap_event[event]);

ret = -EINVAL;


Attachments:
warn-2.5.21-13.diff (48.78 kB)

2002-06-10 12:50:51

by Martin Dalecki

[permalink] [raw]
Subject: [PATCH] 2.5.21 kill warnings 19/19

diff -urN linux-2.5.21/net/irda/wrapper.c linux/net/irda/wrapper.c
--- linux-2.5.21/net/irda/wrapper.c 2002-06-09 07:27:50.000000000 +0200
+++ linux/net/irda/wrapper.c 2002-06-09 20:49:58.000000000 +0200
@@ -1,5 +1,5 @@
/*********************************************************************
- *
+ *
* Filename: wrapper.c
* Version: 1.2
* Description: IrDA SIR async wrapper layer
@@ -10,17 +10,17 @@
* Modified by: Dag Brattli <[email protected]>
* Modified at: Fri May 28 3:11 CST 1999
* Modified by: Horst von Brand <[email protected]>
- *
- * Copyright (c) 1998-2000 Dag Brattli <[email protected]>,
+ *
+ * Copyright (c) 1998-2000 Dag Brattli <[email protected]>,
* All Rights Reserved.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
* the License, or (at your option) any later version.
*
* Neither Dag Brattli nor University of Troms? admit liability nor
- * provide warranty for any of this software. This material is
+ * provide warranty for any of this software. This material is
* provided "AS-IS" and at no charge.
*
********************************************************************/
@@ -39,22 +39,22 @@

static inline int stuff_byte(__u8 byte, __u8 *buf);

-static void state_outside_frame(struct net_device *dev,
- struct net_device_stats *stats,
+static void state_outside_frame(struct net_device *dev,
+ struct net_device_stats *stats,
iobuff_t *rx_buff, __u8 byte);
-static void state_begin_frame(struct net_device *dev,
- struct net_device_stats *stats,
+static void state_begin_frame(struct net_device *dev,
+ struct net_device_stats *stats,
iobuff_t *rx_buff, __u8 byte);
-static void state_link_escape(struct net_device *dev,
- struct net_device_stats *stats,
+static void state_link_escape(struct net_device *dev,
+ struct net_device_stats *stats,
iobuff_t *rx_buff, __u8 byte);
-static void state_inside_frame(struct net_device *dev,
- struct net_device_stats *stats,
+static void state_inside_frame(struct net_device *dev,
+ struct net_device_stats *stats,
iobuff_t *rx_buff, __u8 byte);

-static void (*state[])(struct net_device *dev, struct net_device_stats *stats,
- iobuff_t *rx_buff, __u8 byte) =
-{
+static void (*state[])(struct net_device *dev, struct net_device_stats *stats,
+ iobuff_t *rx_buff, __u8 byte) =
+{
state_outside_frame,
state_begin_frame,
state_link_escape,
@@ -64,14 +64,14 @@
/*
* Function async_wrap (skb, *tx_buff, buffsize)
*
- * Makes a new buffer with wrapping and stuffing, should check that
+ * Makes a new buffer with wrapping and stuffing, should check that
* we don't get tx buffer overflow.
*/
int async_wrap_skb(struct sk_buff *skb, __u8 *tx_buff, int buffsize)
{
struct irda_skb_cb *cb = (struct irda_skb_cb *) skb->cb;
int xbofs;
- int i;
+ int i;
int n;
union {
__u16 value;
@@ -86,11 +86,11 @@
* Send XBOF's for required min. turn time and for the negotiated
* additional XBOFS
*/
-
+
if (cb->magic != LAP_MAGIC) {
- /*
+ /*
* This will happen for all frames sent from user-space.
- * Nothing to worry about, but we set the default number of
+ * Nothing to worry about, but we set the default number of
* BOF's
*/
IRDA_DEBUG(1, __FUNCTION__ "(), wrong magic in skb!\n");
@@ -116,7 +116,7 @@
for (i=0; i < skb->len; i++) {
/*
* Check for the possibility of tx buffer overflow. We use
- * bufsize-5 since the maximum number of bytes that can be
+ * bufsize-5 since the maximum number of bytes that can be
* transmitted after this point is 5.
*/
ASSERT(n < (buffsize-5), return n;);
@@ -124,7 +124,7 @@
n += stuff_byte(skb->data[i], tx_buff+n);
fcs.value = irda_fcs(fcs.value, skb->data[i]);
}
-
+
/* Insert CRC in little endian format (LSB first) */
fcs.value = ~fcs.value;
#ifdef __LITTLE_ENDIAN
@@ -144,9 +144,9 @@
*
* Byte stuff one single byte and put the result in buffer pointed to by
* buf. The buffer must at all times be able to have two bytes inserted.
- *
+ *
*/
-static inline int stuff_byte(__u8 byte, __u8 *buf)
+static inline int stuff_byte(__u8 byte, __u8 *buf)
{
switch (byte) {
case BOF: /* FALLTHROUGH */
@@ -174,7 +174,7 @@
inline void async_bump(struct net_device *dev, struct net_device_stats *stats,
__u8 *buf, int len)
{
- struct sk_buff *skb;
+ struct sk_buff *skb;

skb = dev_alloc_skb(len+1);
if (!skb) {
@@ -184,10 +184,10 @@

/* Align IP header to 20 bytes */
skb_reserve(skb, 1);
-
+
/* Copy data without CRC */
- memcpy(skb_put(skb, len-2), buf, len-2);
-
+ memcpy(skb_put(skb, len-2), buf, len-2);
+
/* Feed it to IrLAP layer */
skb->dev = dev;
skb->mac.raw = skb->data;
@@ -196,7 +196,7 @@
netif_rx(skb);

stats->rx_packets++;
- stats->rx_bytes += len;
+ stats->rx_bytes += len;
}

/*
@@ -205,21 +205,21 @@
* Parse and de-stuff frame received from the IrDA-port
*
*/
-inline void async_unwrap_char(struct net_device *dev,
- struct net_device_stats *stats,
+inline void async_unwrap_char(struct net_device *dev,
+ struct net_device_stats *stats,
iobuff_t *rx_buff, __u8 byte)
{
(*state[rx_buff->state])(dev, stats, rx_buff, byte);
}
-
+
/*
* Function state_outside_frame (dev, rx_buff, byte)
*
* Not receiving any frame (or just bogus data)
*
*/
-static void state_outside_frame(struct net_device *dev,
- struct net_device_stats *stats,
+static void state_outside_frame(struct net_device *dev,
+ struct net_device_stats *stats,
iobuff_t *rx_buff, __u8 byte)
{
switch (byte) {
@@ -245,8 +245,8 @@
* Begin of frame detected
*
*/
-static void state_begin_frame(struct net_device *dev,
- struct net_device_stats *stats,
+static void state_begin_frame(struct net_device *dev,
+ struct net_device_stats *stats,
iobuff_t *rx_buff, __u8 byte)
{
/* Time to initialize receive buffer */
@@ -283,27 +283,27 @@
* Found link escape character
*
*/
-static void state_link_escape(struct net_device *dev,
- struct net_device_stats *stats,
+static void state_link_escape(struct net_device *dev,
+ struct net_device_stats *stats,
iobuff_t *rx_buff, __u8 byte)
{
switch (byte) {
case BOF: /* New frame? */
- IRDA_DEBUG(1, __FUNCTION__
+ IRDA_DEBUG(1, __FUNCTION__
"(), Discarding incomplete frame\n");
rx_buff->state = BEGIN_FRAME;
irda_device_set_media_busy(dev, TRUE);
break;
case CE:
- WARNING(__FUNCTION__ "(), state not defined\n");
+ WARNING("%s: state not defined\n", __FUNCTION__);
break;
case EOF: /* Abort frame */
rx_buff->state = OUTSIDE_FRAME;
break;
default:
- /*
- * Stuffed char, complement bit 5 of byte
- * following CE, IrLAP p.114
+ /*
+ * Stuffed char, complement bit 5 of byte
+ * following CE, IrLAP p.114
*/
byte ^= IRDA_TRANS;
if (rx_buff->len < rx_buff->truesize) {
@@ -324,15 +324,15 @@
* Handle bytes received within a frame
*
*/
-static void state_inside_frame(struct net_device *dev,
+static void state_inside_frame(struct net_device *dev,
struct net_device_stats *stats,
iobuff_t *rx_buff, __u8 byte)
{
- int ret = 0;
+ int ret = 0;

switch (byte) {
case BOF: /* New frame? */
- IRDA_DEBUG(1, __FUNCTION__
+ IRDA_DEBUG(1, __FUNCTION__
"(), Discarding incomplete frame\n");
rx_buff->state = BEGIN_FRAME;
irda_device_set_media_busy(dev, TRUE);
@@ -343,7 +343,7 @@
case EOF: /* End of frame */
rx_buff->state = OUTSIDE_FRAME;
rx_buff->in_frame = FALSE;
-
+
/* Test FCS and signal success if the frame is good */
if (rx_buff->fcs == GOOD_FCS) {
/* Deliver frame */
@@ -352,24 +352,22 @@
break;
} else {
/* Wrong CRC, discard frame! */
- irda_device_set_media_busy(dev, TRUE);
+ irda_device_set_media_busy(dev, TRUE);

IRDA_DEBUG(1, __FUNCTION__ "(), crc error\n");
stats->rx_errors++;
stats->rx_crc_errors++;
- }
+ }
break;
default: /* Must be the next byte of the frame */
if (rx_buff->len < rx_buff->truesize) {
rx_buff->data[rx_buff->len++] = byte;
rx_buff->fcs = irda_fcs(rx_buff->fcs, byte);
} else {
- IRDA_DEBUG(1, __FUNCTION__
+ IRDA_DEBUG(1, __FUNCTION__
"(), Rx buffer overflow, aborting\n");
rx_buff->state = OUTSIDE_FRAME;
}
break;
}
}
-
-


Attachments:
warn-2.5.21-19.diff (8.74 kB)

2002-06-10 12:40:37

by Martin Dalecki

[permalink] [raw]
Subject: [PATCH] 2.5.21 kill warnings 10/19

diff -urN linux-2.5.21/net/irda/iriap_event.c linux/net/irda/iriap_event.c
--- linux-2.5.21/net/irda/iriap_event.c 2002-06-09 07:28:42.000000000 +0200
+++ linux/net/irda/iriap_event.c 2002-06-09 20:55:55.000000000 +0200
@@ -1,5 +1,5 @@
/*********************************************************************
- *
+ *
* Filename: iriap_event.c
* Version: 0.1
* Description: IAP Finite State Machine
@@ -8,17 +8,17 @@
* Created at: Thu Aug 21 00:02:07 1997
* Modified at: Wed Mar 1 11:28:34 2000
* Modified by: Dag Brattli <[email protected]>
- *
- * Copyright (c) 1997, 1999-2000 Dag Brattli <[email protected]>,
+ *
+ * Copyright (c) 1997, 1999-2000 Dag Brattli <[email protected]>,
* All Rights Reserved.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
* the License, or (at your option) any later version.
*
* Neither Dag Brattli nor University of Troms? admit liability nor
- * provide warranty for any of this software. This material is
+ * provide warranty for any of this software. This material is
* provided "AS-IS" and at no charge.
*
********************************************************************/
@@ -28,48 +28,48 @@
#include <net/irda/iriap.h>
#include <net/irda/iriap_event.h>

-static void state_s_disconnect (struct iriap_cb *self, IRIAP_EVENT event,
+static void state_s_disconnect (struct iriap_cb *self, IRIAP_EVENT event,
struct sk_buff *skb);
-static void state_s_connecting (struct iriap_cb *self, IRIAP_EVENT event,
+static void state_s_connecting (struct iriap_cb *self, IRIAP_EVENT event,
struct sk_buff *skb);
-static void state_s_call (struct iriap_cb *self, IRIAP_EVENT event,
+static void state_s_call (struct iriap_cb *self, IRIAP_EVENT event,
struct sk_buff *skb);

-static void state_s_make_call (struct iriap_cb *self, IRIAP_EVENT event,
+static void state_s_make_call (struct iriap_cb *self, IRIAP_EVENT event,
struct sk_buff *skb);
-static void state_s_calling (struct iriap_cb *self, IRIAP_EVENT event,
+static void state_s_calling (struct iriap_cb *self, IRIAP_EVENT event,
struct sk_buff *skb);
-static void state_s_outstanding (struct iriap_cb *self, IRIAP_EVENT event,
+static void state_s_outstanding (struct iriap_cb *self, IRIAP_EVENT event,
struct sk_buff *skb);
-static void state_s_replying (struct iriap_cb *self, IRIAP_EVENT event,
+static void state_s_replying (struct iriap_cb *self, IRIAP_EVENT event,
struct sk_buff *skb);
-static void state_s_wait_for_call(struct iriap_cb *self, IRIAP_EVENT event,
+static void state_s_wait_for_call(struct iriap_cb *self, IRIAP_EVENT event,
struct sk_buff *skb);
-static void state_s_wait_active (struct iriap_cb *self, IRIAP_EVENT event,
+static void state_s_wait_active (struct iriap_cb *self, IRIAP_EVENT event,
struct sk_buff *skb);

-static void state_r_disconnect (struct iriap_cb *self, IRIAP_EVENT event,
+static void state_r_disconnect (struct iriap_cb *self, IRIAP_EVENT event,
struct sk_buff *skb);
-static void state_r_call (struct iriap_cb *self, IRIAP_EVENT event,
+static void state_r_call (struct iriap_cb *self, IRIAP_EVENT event,
struct sk_buff *skb);
-static void state_r_waiting (struct iriap_cb *self, IRIAP_EVENT event,
+static void state_r_waiting (struct iriap_cb *self, IRIAP_EVENT event,
struct sk_buff *skb);
-static void state_r_wait_active (struct iriap_cb *self, IRIAP_EVENT event,
+static void state_r_wait_active (struct iriap_cb *self, IRIAP_EVENT event,
struct sk_buff *skb);
-static void state_r_receiving (struct iriap_cb *self, IRIAP_EVENT event,
+static void state_r_receiving (struct iriap_cb *self, IRIAP_EVENT event,
struct sk_buff *skb);
-static void state_r_execute (struct iriap_cb *self, IRIAP_EVENT event,
+static void state_r_execute (struct iriap_cb *self, IRIAP_EVENT event,
struct sk_buff *skb);
-static void state_r_returning (struct iriap_cb *self, IRIAP_EVENT event,
+static void state_r_returning (struct iriap_cb *self, IRIAP_EVENT event,
struct sk_buff *skb);

-static void (*iriap_state[])(struct iriap_cb *self, IRIAP_EVENT event,
- struct sk_buff *skb) = {
+static void (*iriap_state[])(struct iriap_cb *self, IRIAP_EVENT event,
+ struct sk_buff *skb) = {
/* Client FSM */
state_s_disconnect,
state_s_connecting,
state_s_call,
-
+
/* S-Call FSM */
state_s_make_call,
state_s_calling,
@@ -90,7 +90,7 @@
state_r_returning,
};

-void iriap_next_client_state(struct iriap_cb *self, IRIAP_STATE state)
+void iriap_next_client_state(struct iriap_cb *self, IRIAP_STATE state)
{
ASSERT(self != NULL, return;);
ASSERT(self->magic == IAS_MAGIC, return;);
@@ -98,7 +98,7 @@
self->client_state = state;
}

-void iriap_next_call_state(struct iriap_cb *self, IRIAP_STATE state)
+void iriap_next_call_state(struct iriap_cb *self, IRIAP_STATE state)
{
ASSERT(self != NULL, return;);
ASSERT(self->magic == IAS_MAGIC, return;);
@@ -118,12 +118,12 @@
{
ASSERT(self != NULL, return;);
ASSERT(self->magic == IAS_MAGIC, return;);
-
+
self->r_connect_state = state;
}

-void iriap_do_client_event(struct iriap_cb *self, IRIAP_EVENT event,
- struct sk_buff *skb)
+void iriap_do_client_event(struct iriap_cb *self, IRIAP_EVENT event,
+ struct sk_buff *skb)
{
ASSERT(self != NULL, return;);
ASSERT(self->magic == IAS_MAGIC, return;);
@@ -131,30 +131,30 @@
(*iriap_state[ self->client_state]) (self, event, skb);
}

-void iriap_do_call_event(struct iriap_cb *self, IRIAP_EVENT event,
- struct sk_buff *skb)
+void iriap_do_call_event(struct iriap_cb *self, IRIAP_EVENT event,
+ struct sk_buff *skb)
{
ASSERT(self != NULL, return;);
ASSERT(self->magic == IAS_MAGIC, return;);
-
+
(*iriap_state[ self->call_state]) (self, event, skb);
}

-void iriap_do_server_event(struct iriap_cb *self, IRIAP_EVENT event,
- struct sk_buff *skb)
+void iriap_do_server_event(struct iriap_cb *self, IRIAP_EVENT event,
+ struct sk_buff *skb)
{
ASSERT(self != NULL, return;);
ASSERT(self->magic == IAS_MAGIC, return;);
-
+
(*iriap_state[ self->server_state]) (self, event, skb);
}

-void iriap_do_r_connect_event(struct iriap_cb *self, IRIAP_EVENT event,
- struct sk_buff *skb)
+void iriap_do_r_connect_event(struct iriap_cb *self, IRIAP_EVENT event,
+ struct sk_buff *skb)
{
ASSERT(self != NULL, return;);
ASSERT(self->magic == IAS_MAGIC, return;);
-
+
(*iriap_state[ self->r_connect_state]) (self, event, skb);
}

@@ -165,8 +165,8 @@
* S-Disconnect, The device has no LSAP connection to a particular
* remote device.
*/
-static void state_s_disconnect(struct iriap_cb *self, IRIAP_EVENT event,
- struct sk_buff *skb)
+static void state_s_disconnect(struct iriap_cb *self, IRIAP_EVENT event,
+ struct sk_buff *skb)
{
ASSERT(self != NULL, return;);
ASSERT(self->magic == IAS_MAGIC, return;);
@@ -192,8 +192,8 @@
* S-Connecting
*
*/
-static void state_s_connecting(struct iriap_cb *self, IRIAP_EVENT event,
- struct sk_buff *skb)
+static void state_s_connecting(struct iriap_cb *self, IRIAP_EVENT event,
+ struct sk_buff *skb)
{
ASSERT(self != NULL, return;);
ASSERT(self->magic == IAS_MAGIC, return;);
@@ -223,10 +223,10 @@
*
* S-Call, The device can process calls to a specific remote
* device. Whenever the LSAP connection is disconnected, this state
- * catches that event and clears up
+ * catches that event and clears up
*/
-static void state_s_call(struct iriap_cb *self, IRIAP_EVENT event,
- struct sk_buff *skb)
+static void state_s_call(struct iriap_cb *self, IRIAP_EVENT event,
+ struct sk_buff *skb)
{
ASSERT(self != NULL, return;);

@@ -248,8 +248,8 @@
* S-Make-Call
*
*/
-static void state_s_make_call(struct iriap_cb *self, IRIAP_EVENT event,
- struct sk_buff *skb)
+static void state_s_make_call(struct iriap_cb *self, IRIAP_EVENT event,
+ struct sk_buff *skb)
{
ASSERT(self != NULL, return;);

@@ -257,7 +257,7 @@
case IAP_CALL_REQUEST:
skb = self->skb;
self->skb = NULL;
-
+
irlmp_data_request(self->lsap, skb);
iriap_next_call_state(self, S_OUTSTANDING);
break;
@@ -275,8 +275,8 @@
* S-Calling
*
*/
-static void state_s_calling(struct iriap_cb *self, IRIAP_EVENT event,
- struct sk_buff *skb)
+static void state_s_calling(struct iriap_cb *self, IRIAP_EVENT event,
+ struct sk_buff *skb)
{
IRDA_DEBUG(0, __FUNCTION__ "(), Not implemented\n");
}
@@ -287,8 +287,8 @@
* S-Outstanding, The device is waiting for a response to a command
*
*/
-static void state_s_outstanding(struct iriap_cb *self, IRIAP_EVENT event,
- struct sk_buff *skb)
+static void state_s_outstanding(struct iriap_cb *self, IRIAP_EVENT event,
+ struct sk_buff *skb)
{
ASSERT(self != NULL, return;);

@@ -302,7 +302,7 @@
default:
IRDA_DEBUG(0, __FUNCTION__ "(), Unknown event %d\n", event);
break;
- }
+ }
}

/*
@@ -310,8 +310,8 @@
*
* S-Replying, The device is collecting a multiple part response
*/
-static void state_s_replying(struct iriap_cb *self, IRIAP_EVENT event,
- struct sk_buff *skb)
+static void state_s_replying(struct iriap_cb *self, IRIAP_EVENT event,
+ struct sk_buff *skb)
{
IRDA_DEBUG(0, __FUNCTION__ "(), Not implemented\n");
}
@@ -322,8 +322,8 @@
* S-Wait-for-Call
*
*/
-static void state_s_wait_for_call(struct iriap_cb *self, IRIAP_EVENT event,
- struct sk_buff *skb)
+static void state_s_wait_for_call(struct iriap_cb *self, IRIAP_EVENT event,
+ struct sk_buff *skb)
{
IRDA_DEBUG(0, __FUNCTION__ "(), Not implemented\n");
}
@@ -335,15 +335,15 @@
* S-Wait-Active
*
*/
-static void state_s_wait_active(struct iriap_cb *self, IRIAP_EVENT event,
- struct sk_buff *skb)
+static void state_s_wait_active(struct iriap_cb *self, IRIAP_EVENT event,
+ struct sk_buff *skb)
{
IRDA_DEBUG(0, __FUNCTION__ "(), Not implemented\n");
}

/**************************************************************************
- *
- * Server FSM
+ *
+ * Server FSM
*
**************************************************************************/

@@ -353,27 +353,27 @@
* LM-IAS server is disconnected (not processing any requests!)
*
*/
-static void state_r_disconnect(struct iriap_cb *self, IRIAP_EVENT event,
- struct sk_buff *skb)
+static void state_r_disconnect(struct iriap_cb *self, IRIAP_EVENT event,
+ struct sk_buff *skb)
{
struct sk_buff *tx_skb;
-
+
switch (event) {
case IAP_LM_CONNECT_INDICATION:
tx_skb = dev_alloc_skb(64);
if (tx_skb == NULL) {
- WARNING(__FUNCTION__ "(), unable to malloc!\n");
+ WARNING("%s: unable to malloc!\n", __FUNCTION__);
return;
}

/* Reserve space for MUX_CONTROL and LAP header */
skb_reserve(tx_skb, LMP_MAX_HEADER);
-
+
irlmp_connect_response(self->lsap, tx_skb);
/*LM_Idle_request(idle); */
-
+
iriap_next_server_state(self, R_CALL);
-
+
/*
* Jump to R-Connect FSM, we skip R-Waiting since we do not
* care about LM_Idle_request()!
@@ -382,22 +382,19 @@

if (skb)
dev_kfree_skb(skb);
-
+
break;
default:
IRDA_DEBUG(0, __FUNCTION__ "(), unknown event %d\n", event);
break;
- }
+ }
}

/*
* Function state_r_call (self, event, skb)
- *
- *
- *
*/
-static void state_r_call(struct iriap_cb *self, IRIAP_EVENT event,
- struct sk_buff *skb)
+static void state_r_call(struct iriap_cb *self, IRIAP_EVENT event,
+ struct sk_buff *skb)
{
IRDA_DEBUG(4, __FUNCTION__ "()\n");

@@ -405,7 +402,7 @@
case IAP_LM_DISCONNECT_INDICATION:
/* Abort call */
iriap_next_server_state(self, R_DISCONNECT);
- iriap_next_r_connect_state(self, R_WAITING);
+ iriap_next_r_connect_state(self, R_WAITING);
break;
default:
IRDA_DEBUG(0, __FUNCTION__ "(), unknown event!\n");
@@ -413,24 +410,21 @@
}
}

-/*
- * R-Connect FSM
-*/
+/*
+ * R-Connect FSM
+ */

/*
* Function state_r_waiting (self, event, skb)
- *
- *
- *
*/
-static void state_r_waiting(struct iriap_cb *self, IRIAP_EVENT event,
- struct sk_buff *skb)
+static void state_r_waiting(struct iriap_cb *self, IRIAP_EVENT event,
+ struct sk_buff *skb)
{
IRDA_DEBUG(0, __FUNCTION__ "(), Not implemented\n");
}

-static void state_r_wait_active(struct iriap_cb *self, IRIAP_EVENT event,
- struct sk_buff *skb)
+static void state_r_wait_active(struct iriap_cb *self, IRIAP_EVENT event,
+ struct sk_buff *skb)
{
IRDA_DEBUG(0, __FUNCTION__ "(), Not implemented\n");
}
@@ -441,15 +435,15 @@
* We are receiving a command
*
*/
-static void state_r_receiving(struct iriap_cb *self, IRIAP_EVENT event,
- struct sk_buff *skb)
+static void state_r_receiving(struct iriap_cb *self, IRIAP_EVENT event,
+ struct sk_buff *skb)
{
IRDA_DEBUG(4, __FUNCTION__ "()\n");

switch (event) {
case IAP_RECV_F_LST:
iriap_next_r_connect_state(self, R_EXECUTE);
-
+
iriap_call_indication(self, skb);
break;
default:
@@ -465,26 +459,26 @@
* The server is processing the request
*
*/
-static void state_r_execute(struct iriap_cb *self, IRIAP_EVENT event,
- struct sk_buff *skb)
+static void state_r_execute(struct iriap_cb *self, IRIAP_EVENT event,
+ struct sk_buff *skb)
{
IRDA_DEBUG(4, __FUNCTION__ "()\n");

ASSERT(skb != NULL, return;);
-
+
if (!self || self->magic != IAS_MAGIC) {
IRDA_DEBUG(0, __FUNCTION__ "(), bad pointer self\n");
return;
- }
+ }

switch (event) {
case IAP_CALL_RESPONSE:
- /*
+ /*
* Since we don't implement the Waiting state, we return
* to state Receiving instead, DB.
*/
iriap_next_r_connect_state(self, R_RECEIVING);
-
+
irlmp_data_request(self->lsap, skb);
break;
default:
@@ -493,19 +487,15 @@
}
}

-static void state_r_returning(struct iriap_cb *self, IRIAP_EVENT event,
- struct sk_buff *skb)
+static void state_r_returning(struct iriap_cb *self, IRIAP_EVENT event,
+ struct sk_buff *skb)
{
IRDA_DEBUG(0, __FUNCTION__ "(), event=%d\n", event);

switch (event) {
case IAP_RECV_F_LST:
-
break;
default:
break;
}
}
-
-
-


Attachments:
warn-2.5.21-10.diff (14.47 kB)

2002-06-10 12:52:24

by Martin Dalecki

[permalink] [raw]
Subject: [PATCH] 2.5.21 kill warnings 17/19

diff -urN linux-2.5.21/net/irda/irttp.c linux/net/irda/irttp.c
--- linux-2.5.21/net/irda/irttp.c 2002-06-09 07:26:53.000000000 +0200
+++ linux/net/irda/irttp.c 2002-06-09 21:03:12.000000000 +0200
@@ -89,15 +89,15 @@
return -ENOMEM;
}
memset(irttp, 0, sizeof(struct irttp_cb));
-
+
irttp->magic = TTP_MAGIC;

irttp->tsaps = hashbin_new(HB_LOCAL);
if (!irttp->tsaps) {
- ERROR(__FUNCTION__ "(), can't allocate IrTTP hashbin!\n");
+ ERROR("%s: can't allocate IrTTP hashbin!\n", __FUNCTION__);
return -ENOMEM;
}
-
+
return 0;
}

@@ -108,19 +108,19 @@
*
*/
#ifdef MODULE
-void irttp_cleanup(void)
+void irttp_cleanup(void)
{
/* Check for main structure */
ASSERT(irttp != NULL, return;);
ASSERT(irttp->magic == TTP_MAGIC, return;);
-
+
/*
* Delete hashbin and close all TSAP instances in it
*/
hashbin_delete(irttp->tsaps, (FREE_FUNC) __irttp_close_tsap);

irttp->magic = 0;
-
+
/* De-allocate main structure */
kfree(irttp);

@@ -133,7 +133,7 @@
/*
* Function irttp_start_todo_timer (self, timeout)
*
- * Start todo timer.
+ * Start todo timer.
*
* Made it more effient and unsensitive to race conditions - Jean II
*/
@@ -164,7 +164,7 @@
/* Check that we still exist */
if (!self || self->magic != TTP_TSAP_MAGIC)
return;
-
+
IRDA_DEBUG(4, __FUNCTION__ "(instance=%p)\n", self);

/* Try to make some progress, especially on Tx side - Jean II */
@@ -185,12 +185,12 @@
} else {
/* Try again later */
irttp_start_todo_timer(self, HZ/10);
-
+
/* No reason to try and close now */
return;
}
}
-
+
/* Check if it's closing time */
if (self->close_pend)
/* Finish cleanup */
@@ -205,20 +205,20 @@
void irttp_flush_queues(struct tsap_cb *self)
{
struct sk_buff* skb;
-
+
IRDA_DEBUG(4, __FUNCTION__ "()\n");

ASSERT(self != NULL, return;);
ASSERT(self->magic == TTP_TSAP_MAGIC, return;);
-
+
/* Deallocate frames waiting to be sent */
while ((skb = skb_dequeue(&self->tx_queue)) != NULL)
dev_kfree_skb(skb);
-
+
/* Deallocate received frames */
while ((skb = skb_dequeue(&self->rx_queue)) != NULL)
dev_kfree_skb(skb);
-
+
/* Deallocate received fragments */
while ((skb = skb_dequeue(&self->rx_fragments)) != NULL)
dev_kfree_skb(skb);
@@ -235,19 +235,19 @@
{
struct sk_buff *skb, *frag;
int n = 0; /* Fragment index */
-
- ASSERT(self != NULL, return NULL;);
+
+ ASSERT(self != NULL, return NULL;);
ASSERT(self->magic == TTP_TSAP_MAGIC, return NULL;);

- IRDA_DEBUG(2, __FUNCTION__ "(), self->rx_sdu_size=%d\n",
+ IRDA_DEBUG(2, __FUNCTION__ "(), self->rx_sdu_size=%d\n",
self->rx_sdu_size);

skb = dev_alloc_skb(TTP_HEADER + self->rx_sdu_size);
if (!skb)
return NULL;

- /*
- * Need to reserve space for TTP header in case this skb needs to
+ /*
+ * Need to reserve space for TTP header in case this skb needs to
* be requeued in case delivery failes
*/
skb_reserve(skb, TTP_HEADER);
@@ -259,7 +259,7 @@
while ((frag = skb_dequeue(&self->rx_fragments)) != NULL) {
memcpy(skb->data+n, frag->data, frag->len);
n += frag->len;
-
+
dev_kfree_skb(frag);
}
IRDA_DEBUG(2, __FUNCTION__ "(), frame len=%d\n", n);
@@ -307,13 +307,13 @@
skb_reserve(frag, self->max_header_size);

/* Copy data from the original skb into this fragment. */
- memcpy(skb_put(frag, self->max_seg_size), skb->data,
+ memcpy(skb_put(frag, self->max_seg_size), skb->data,
self->max_seg_size);

/* Insert TTP header, with the more bit set */
frame = skb_push(frag, TTP_HEADER);
frame[0] = TTP_MORE;
-
+
/* Hide the copied data from the original skb */
skb_pull(skb, self->max_seg_size);

@@ -322,7 +322,7 @@
}
/* Queue what is left of the original skb */
IRDA_DEBUG(2, __FUNCTION__ "(), queuing last segment\n");
-
+
frame = skb_push(skb, TTP_HEADER);
frame[0] = 0x00; /* Clear more bit */

@@ -337,7 +337,7 @@
* will be called both when this parameter needs to be inserted into, and
* extracted from the connect frames
*/
-static int irttp_param_max_sdu_size(void *instance, irda_param_t *param,
+static int irttp_param_max_sdu_size(void *instance, irda_param_t *param,
int get)
{
struct tsap_cb *self;
@@ -353,7 +353,7 @@
self->tx_max_sdu_size = param->pv.i;

IRDA_DEBUG(1, __FUNCTION__ "(), MaxSduSize=%d\n", param->pv.i);
-
+
return 0;
}

@@ -366,7 +366,7 @@
*
* Create TSAP connection endpoint,
*/
-struct tsap_cb *irttp_open_tsap(__u8 stsap_sel, int credit, notify_t *notify)
+struct tsap_cb *irttp_open_tsap(__u8 stsap_sel, int credit, notify_t *notify)
{
struct tsap_cb *self;
struct lsap_cb *lsap;
@@ -421,10 +421,10 @@
*/
lsap = irlmp_open_lsap(stsap_sel, &ttp_notify, 0);
if (lsap == NULL) {
- WARNING(__FUNCTION__ "(), unable to allocate LSAP!!\n");
+ WARNING("%s: unable to allocate LSAP!!\n", __FUNCTION__);
return NULL;
}
-
+
/*
* If user specified LSAP_ANY as source TSAP selector, then IrLMP
* will replace it with whatever source selector which is free, so
@@ -443,7 +443,7 @@
else
self->initial_credit = credit;

- return self;
+ return self;
}

/*
@@ -497,7 +497,7 @@
if (self->connected) {
/* Check if disconnect is not pending */
if (!test_bit(0, &self->disconnect_pend)) {
- WARNING(__FUNCTION__ "(), TSAP still connected!\n");
+ WARNING("%s: TSAP still connected!\n", __FUNCTION__);
irttp_disconnect_request(self, NULL, P_NORMAL);
}
self->close_pend = TRUE;
@@ -505,7 +505,7 @@

return 0; /* Will be back! */
}
-
+
tsap = hashbin_remove(irttp->tsaps, (int) self, NULL);

ASSERT(tsap == self, return -1;);
@@ -527,7 +527,7 @@
* Send unreliable data on this TSAP
*
*/
-int irttp_udata_request(struct tsap_cb *self, struct sk_buff *skb)
+int irttp_udata_request(struct tsap_cb *self, struct sk_buff *skb)
{
ASSERT(self != NULL, return -1;);
ASSERT(self->magic == TTP_TSAP_MAGIC, return -1;);
@@ -540,12 +540,12 @@
IRDA_DEBUG(1, __FUNCTION__ "(), No data, or not connected\n");
return -1;
}
-
+
if (skb->len > self->max_seg_size) {
IRDA_DEBUG(1, __FUNCTION__ "(), UData is to large for IrLAP!\n");
return -1;
}
-
+
irlmp_udata_request(self->lsap, skb);
self->stats.tx_packets++;

@@ -555,10 +555,10 @@
/*
* Function irttp_data_request (handle, skb)
*
- * Queue frame for transmission. If SAR is enabled, fragement the frame
+ * Queue frame for transmission. If SAR is enabled, fragement the frame
* and queue the fragments for transmission
*/
-int irttp_data_request(struct tsap_cb *self, struct sk_buff *skb)
+int irttp_data_request(struct tsap_cb *self, struct sk_buff *skb)
{
__u8 *frame;

@@ -571,33 +571,33 @@

/* Check that nothing bad happens */
if ((skb->len == 0) || (!self->connected)) {
- WARNING(__FUNCTION__ "(), No data, or not connected\n");
+ WARNING("%s: No data, or not connected\n", __FUNCTION__);
return -ENOTCONN;
}

- /*
+ /*
* Check if SAR is disabled, and the frame is larger than what fits
* inside an IrLAP frame
*/
if ((self->tx_max_sdu_size == 0) && (skb->len > self->max_seg_size)) {
- ERROR(__FUNCTION__
- "(), SAR disabled, and data is to large for IrLAP!\n");
+ ERROR("%s: SAR disabled, and data is to large for IrLAP!\n",
+ __FUNCTION__);
return -EMSGSIZE;
}

- /*
- * Check if SAR is enabled, and the frame is larger than the
- * TxMaxSduSize
+ /*
+ * Check if SAR is enabled, and the frame is larger than the
+ * TxMaxSduSize
*/
- if ((self->tx_max_sdu_size != 0) &&
- (self->tx_max_sdu_size != TTP_SAR_UNBOUND) &&
+ if ((self->tx_max_sdu_size != 0) &&
+ (self->tx_max_sdu_size != TTP_SAR_UNBOUND) &&
(skb->len > self->tx_max_sdu_size))
{
- ERROR(__FUNCTION__ "(), SAR enabled, "
- "but data is larger than TxMaxSduSize!\n");
+ ERROR("%s: SAR enabled, but data is larger than TxMaxSduSize!\n",
+ __FUNCTION__);
return -EMSGSIZE;
}
- /*
+ /*
* Check if transmit queue is full
*/
if (skb_queue_len(&self->tx_queue) >= TTP_TX_MAX_QUEUE) {
@@ -610,14 +610,14 @@
* to requeue the packet in the client code - Jean II */
return -ENOBUFS;
}
-
+
/* Queue frame, or queue frame segments */
if ((self->tx_max_sdu_size == 0) || (skb->len < self->max_seg_size)) {
/* Queue frame */
ASSERT(skb_headroom(skb) >= TTP_HEADER, return -1;);
frame = skb_push(skb, TTP_HEADER);
frame[0] = 0x00; /* Clear more bit */
-
+
skb_queue_tail(&self->tx_queue, skb);
} else {
/*
@@ -630,11 +630,11 @@
}

/* Check if we can accept more data from client */
- if ((!self->tx_sdu_busy) &&
+ if ((!self->tx_sdu_busy) &&
(skb_queue_len(&self->tx_queue) > TTP_TX_HIGH_THRESHOLD)) {
/* Tx queue filling up, so stop client. */
if (self->notify.flow_indication) {
- self->notify.flow_indication(self->notify.instance,
+ self->notify.flow_indication(self->notify.instance,
self, FLOW_STOP);
}
/* self->tx_sdu_busy is the state of the client.
@@ -646,7 +646,7 @@
* Jean II */
self->tx_sdu_busy = TRUE;
}
-
+
/* Try to make some progress */
irttp_run_tx_queue(self);

@@ -659,7 +659,7 @@
* Transmit packets queued for transmission (if possible)
*
*/
-static void irttp_run_tx_queue(struct tsap_cb *self)
+static void irttp_run_tx_queue(struct tsap_cb *self)
{
struct sk_buff *skb;
unsigned long flags;
@@ -680,7 +680,7 @@
(skb = skb_dequeue(&self->tx_queue)))
{
/*
- * Since we can transmit and receive frames concurrently,
+ * Since we can transmit and receive frames concurrently,
* the code below is a critical region and we must assure that
* nobody messes with the credits while we update them.
*/
@@ -688,7 +688,7 @@

n = self->avail_credit;
self->avail_credit = 0;
-
+
/* Only room for 127 credits in frame */
if (n > 127) {
self->avail_credit = n-127;
@@ -699,19 +699,19 @@

spin_unlock_irqrestore(&self->lock, flags);

- /*
- * More bit must be set by the data_request() or fragment()
+ /*
+ * More bit must be set by the data_request() or fragment()
* functions
*/
skb->data[0] |= (n & 0x7f);
-
+
/* Detach from socket.
* The current skb has a reference to the socket that sent
* it (skb->sk). When we pass it to IrLMP, the skb will be
* stored in in IrLAP (self->wx_list). When we are within
* IrLAP, we loose the notion of socket, so we should not
* have a reference to a socket. So, we drop it here.
- *
+ *
* Why does it matter ?
* When the skb is freed (kfree_skb), if it is associated
* with a socket, it release buffer space on the socket
@@ -740,7 +740,7 @@
* to client. That's ok, this test will be true not too often
* (max once per LAP window) and we are called from places
* where we can spend a bit of time doing stuff. - Jean II */
- if ((self->tx_sdu_busy) &&
+ if ((self->tx_sdu_busy) &&
(skb_queue_len(&self->tx_queue) < TTP_TX_LOW_THRESHOLD) &&
(!self->close_pend))
{
@@ -764,16 +764,16 @@
* Send a dataless flowdata TTP-PDU and give available credit to peer
* TSAP
*/
-static inline void irttp_give_credit(struct tsap_cb *self)
+static inline void irttp_give_credit(struct tsap_cb *self)
{
struct sk_buff *tx_skb = NULL;
unsigned long flags;
int n;

ASSERT(self != NULL, return;);
- ASSERT(self->magic == TTP_TSAP_MAGIC, return;);
+ ASSERT(self->magic == TTP_TSAP_MAGIC, return;);

- IRDA_DEBUG(4, __FUNCTION__ "() send=%d,avail=%d,remote=%d\n",
+ IRDA_DEBUG(4, __FUNCTION__ "() send=%d,avail=%d,remote=%d\n",
self->send_credit, self->avail_credit, self->remote_credit);

/* Give credit to peer */
@@ -785,7 +785,7 @@
skb_reserve(tx_skb, self->max_header_size);

/*
- * Since we can transmit and receive frames concurrently,
+ * Since we can transmit and receive frames concurrently,
* the code below is a critical region and we must assure that
* nobody messes with the credits while we update them.
*/
@@ -793,7 +793,7 @@

n = self->avail_credit;
self->avail_credit = 0;
-
+
/* Only space for 127 credits in frame */
if (n > 127) {
self->avail_credit = n - 127;
@@ -805,7 +805,7 @@

skb_put(tx_skb, 1);
tx_skb->data[0] = (__u8) (n & 0x7f);
-
+
irlmp_data_request(self->lsap, tx_skb);
self->stats.tx_packets++;
}
@@ -816,8 +816,8 @@
* Received some unit-data (unreliable)
*
*/
-static int irttp_udata_indication(void *instance, void *sap,
- struct sk_buff *skb)
+static int irttp_udata_indication(void *instance, void *sap,
+ struct sk_buff *skb)
{
struct tsap_cb *self;

@@ -843,10 +843,10 @@
/*
* Function irttp_data_indication (instance, sap, skb)
*
- * Receive segment from IrLMP.
+ * Receive segment from IrLMP.
*
*/
-static int irttp_data_indication(void *instance, void *sap,
+static int irttp_data_indication(void *instance, void *sap,
struct sk_buff *skb)
{
struct tsap_cb *self;
@@ -860,7 +860,7 @@
self->stats.rx_packets++;

/* Deal with inbound credit
- * Since we can transmit and receive frames concurrently,
+ * Since we can transmit and receive frames concurrently,
* the code below is a critical region and we must assure that
* nobody messes with the credits while we update them.
*/
@@ -870,12 +870,12 @@
self->remote_credit--;
spin_unlock_irqrestore(&self->lock, flags);

- /*
- * Data or dataless packet? Dataless frames contains only the
- * TTP_HEADER.
+ /*
+ * Data or dataless packet? Dataless frames contains only the
+ * TTP_HEADER.
*/
if (skb->len > 1) {
- /*
+ /*
* We don't remove the TTP header, since we must preserve the
* more bit, so the defragment routing knows what to do
*/
@@ -904,7 +904,7 @@
* to miss the next Tx window. The todo timer may take
* a while before it's run... - Jean II */

- /*
+ /*
* If the peer device has given us some credits and we didn't have
* anyone from before, then we need to shedule the tx queue.
* We need to do that because our Tx have stopped (so we may not
@@ -936,15 +936,15 @@
IRDA_DEBUG(4, __FUNCTION__ "()\n");

self = (struct tsap_cb *) instance;
-
+
ASSERT(self != NULL, return;);
ASSERT(self->magic == TTP_TSAP_MAGIC, return;);
-
+
/*
* Inform service user if he has requested it
*/
if (self->notify.status_indication != NULL)
- self->notify.status_indication(self->notify.instance,
+ self->notify.status_indication(self->notify.instance,
link, lock);
else
IRDA_DEBUG(2, __FUNCTION__ "(), no handler\n");
@@ -961,10 +961,10 @@
struct tsap_cb *self;

self = (struct tsap_cb *) instance;
-
+
ASSERT(self != NULL, return;);
ASSERT(self->magic == TTP_TSAP_MAGIC, return;);
-
+
IRDA_DEBUG(4, __FUNCTION__ "(instance=%p)\n", self);

/* We are "polled" directly from LAP, and the LAP want to fill
@@ -998,7 +998,7 @@
* Function irttp_flow_request (self, command)
*
* This funtion could be used by the upper layers to tell IrTTP to stop
- * delivering frames if the receive queues are starting to get full, or
+ * delivering frames if the receive queues are starting to get full, or
* to tell IrTTP to start delivering frames again.
*/
void irttp_flow_request(struct tsap_cb *self, LOCAL_FLOW flow)
@@ -1016,7 +1016,7 @@
case FLOW_START:
IRDA_DEBUG(1, __FUNCTION__ "(), flow start\n");
self->rx_sdu_busy = FALSE;
-
+
/* Client say he can accept more data, try to free our
* queues ASAP - Jean II */
irttp_run_rx_queue(self);
@@ -1026,42 +1026,42 @@
IRDA_DEBUG(1, __FUNCTION__ "(), Unknown flow command!\n");
}
}
-
+
/*
* Function irttp_connect_request (self, dtsap_sel, daddr, qos)
*
* Try to connect to remote destination TSAP selector
*
*/
-int irttp_connect_request(struct tsap_cb *self, __u8 dtsap_sel,
+int irttp_connect_request(struct tsap_cb *self, __u8 dtsap_sel,
__u32 saddr, __u32 daddr,
- struct qos_info *qos, __u32 max_sdu_size,
- struct sk_buff *userdata)
+ struct qos_info *qos, __u32 max_sdu_size,
+ struct sk_buff *userdata)
{
struct sk_buff *skb;
__u8 *frame;
__u8 n;
-
- IRDA_DEBUG(4, __FUNCTION__ "(), max_sdu_size=%d\n", max_sdu_size);
-
+
+ IRDA_DEBUG(4, __FUNCTION__ "(), max_sdu_size=%d\n", max_sdu_size);
+
ASSERT(self != NULL, return -EBADR;);
ASSERT(self->magic == TTP_TSAP_MAGIC, return -EBADR;);

if (self->connected)
return -EISCONN;
-
+
/* Any userdata supplied? */
if (userdata == NULL) {
skb = dev_alloc_skb(64);
- if (!skb)
+ if (!skb)
return -ENOMEM;
-
+
/* Reserve space for MUX_CONTROL and LAP header */
skb_reserve(skb, TTP_MAX_HEADER);
} else {
skb = userdata;
- /*
- * Check that the client has reserved enough space for
+ /*
+ * Check that the client has reserved enough space for
* headers
*/
ASSERT(skb_headroom(userdata) >= TTP_MAX_HEADER, return -1;);
@@ -1079,7 +1079,7 @@

self->remote_credit = 0;
self->send_credit = 0;
-
+
/*
* Give away max 127 credits for now
*/
@@ -1092,41 +1092,41 @@

/* SAR enabled? */
if (max_sdu_size > 0) {
- ASSERT(skb_headroom(skb) >= (TTP_MAX_HEADER + TTP_SAR_HEADER),
+ ASSERT(skb_headroom(skb) >= (TTP_MAX_HEADER + TTP_SAR_HEADER),
return -1;);

/* Insert SAR parameters */
frame = skb_push(skb, TTP_HEADER+TTP_SAR_HEADER);
-
- frame[0] = TTP_PARAMETERS | n;
+
+ frame[0] = TTP_PARAMETERS | n;
frame[1] = 0x04; /* Length */
frame[2] = 0x01; /* MaxSduSize */
frame[3] = 0x02; /* Value length */

- put_unaligned(cpu_to_be16((__u16) max_sdu_size),
+ put_unaligned(cpu_to_be16((__u16) max_sdu_size),
(__u16 *)(frame+4));
} else {
/* Insert plain TTP header */
frame = skb_push(skb, TTP_HEADER);
-
+
/* Insert initial credit in frame */
frame[0] = n & 0x7f;
}

/* Connect with IrLMP. No QoS parameters for now */
- return irlmp_connect_request(self->lsap, dtsap_sel, saddr, daddr, qos,
+ return irlmp_connect_request(self->lsap, dtsap_sel, saddr, daddr, qos,
skb);
}

/*
* Function irttp_connect_confirm (handle, qos, skb)
*
- * Sevice user confirms TSAP connection with peer.
+ * Sevice user confirms TSAP connection with peer.
*
*/
-static void irttp_connect_confirm(void *instance, void *sap,
+static void irttp_connect_confirm(void *instance, void *sap,
struct qos_info *qos, __u32 max_seg_size,
- __u8 max_header_size, struct sk_buff *skb)
+ __u8 max_header_size, struct sk_buff *skb)
{
struct tsap_cb *self;
int parameters;
@@ -1135,7 +1135,7 @@
__u8 n;

IRDA_DEBUG(4, __FUNCTION__ "()\n");
-
+
self = (struct tsap_cb *) instance;

ASSERT(self != NULL, return;);
@@ -1150,21 +1150,21 @@
* negotiated QoS for the link.
*/
if (qos) {
- IRDA_DEBUG(4, "IrTTP, Negotiated BAUD_RATE: %02x\n",
- qos->baud_rate.bits);
- IRDA_DEBUG(4, "IrTTP, Negotiated BAUD_RATE: %d bps.\n",
+ IRDA_DEBUG(4, "IrTTP, Negotiated BAUD_RATE: %02x\n",
+ qos->baud_rate.bits);
+ IRDA_DEBUG(4, "IrTTP, Negotiated BAUD_RATE: %d bps.\n",
qos->baud_rate.value);
}

n = skb->data[0] & 0x7f;
-
+
IRDA_DEBUG(4, __FUNCTION__ "(), Initial send_credit=%d\n", n);
-
+
self->send_credit = n;
self->tx_max_sdu_size = 0;
self->connected = TRUE;

- parameters = skb->data[0] & 0x80;
+ parameters = skb->data[0] & 0x80;

ASSERT(skb->len >= TTP_HEADER, return;);
skb_pull(skb, TTP_HEADER);
@@ -1173,13 +1173,13 @@
plen = skb->data[0];

ret = irda_param_extract_all(self, skb->data+1,
- IRDA_MIN(skb->len-1, plen),
+ IRDA_MIN(skb->len-1, plen),
&param_info);

/* Any errors in the parameter list? */
if (ret < 0) {
- WARNING(__FUNCTION__
- "(), error extracting parameters\n");
+ WARNING("%s: error extracting parameters\n",
+ __FUNCTION__);
dev_kfree_skb(skb);

/* Do not accept this connection attempt */
@@ -1188,8 +1188,8 @@
/* Remove parameters */
skb_pull(skb, IRDA_MIN(skb->len, plen+1));
}
-
- IRDA_DEBUG(4, __FUNCTION__ "() send=%d,avail=%d,remote=%d\n",
+
+ IRDA_DEBUG(4, __FUNCTION__ "() send=%d,avail=%d,remote=%d\n",
self->send_credit, self->avail_credit, self->remote_credit);

IRDA_DEBUG(2, __FUNCTION__ "(), MaxSduSize=%d\n", self->tx_max_sdu_size);
@@ -1208,8 +1208,8 @@
*
*/
void irttp_connect_indication(void *instance, void *sap, struct qos_info *qos,
- __u32 max_seg_size, __u8 max_header_size,
- struct sk_buff *skb)
+ __u32 max_seg_size, __u8 max_header_size,
+ struct sk_buff *skb)
{
struct tsap_cb *self;
struct lsap_cb *lsap;
@@ -1222,7 +1222,7 @@

ASSERT(self != NULL, return;);
ASSERT(self->magic == TTP_TSAP_MAGIC, return;);
- ASSERT(skb != NULL, return;);
+ ASSERT(skb != NULL, return;);

lsap = (struct lsap_cb *) sap;

@@ -1238,7 +1238,7 @@

self->send_credit = n;
self->tx_max_sdu_size = 0;
-
+
parameters = skb->data[0] & 0x80;

ASSERT(skb->len >= TTP_HEADER, return;);
@@ -1246,17 +1246,17 @@

if (parameters) {
plen = skb->data[0];
-
+
ret = irda_param_extract_all(self, skb->data+1,
- IRDA_MIN(skb->len-1, plen),
+ IRDA_MIN(skb->len-1, plen),
&param_info);

/* Any errors in the parameter list? */
if (ret < 0) {
- WARNING(__FUNCTION__
- "(), error extracting parameters\n");
+ WARNING("%s: error extracting parameters\n",
+ __FUNCTION__);
dev_kfree_skb(skb);
-
+
/* Do not accept this connection attempt */
return;
}
@@ -1266,8 +1266,8 @@
}

if (self->notify.connect_indication) {
- self->notify.connect_indication(self->notify.instance, self,
- qos, self->tx_max_sdu_size,
+ self->notify.connect_indication(self->notify.instance, self,
+ qos, self->tx_max_sdu_size,
self->max_header_size, skb);
} else
dev_kfree_skb(skb);
@@ -1278,9 +1278,9 @@
*
* Service user is accepting the connection, just pass it down to
* IrLMP!
- *
+ *
*/
-int irttp_connect_response(struct tsap_cb *self, __u32 max_sdu_size,
+int irttp_connect_response(struct tsap_cb *self, __u32 max_sdu_size,
struct sk_buff *userdata)
{
struct sk_buff *skb;
@@ -1291,9 +1291,9 @@
ASSERT(self != NULL, return -1;);
ASSERT(self->magic == TTP_TSAP_MAGIC, return -1;);

- IRDA_DEBUG(4, __FUNCTION__ "(), Source TSAP selector=%02x\n",
+ IRDA_DEBUG(4, __FUNCTION__ "(), Source TSAP selector=%02x\n",
self->stsap_sel);
-
+
/* Any userdata supplied? */
if (userdata == NULL) {
skb = dev_alloc_skb(64);
@@ -1304,13 +1304,13 @@
skb_reserve(skb, TTP_MAX_HEADER);
} else {
skb = userdata;
- /*
- * Check that the client has reserved enough space for
+ /*
+ * Check that the client has reserved enough space for
* headers
*/
ASSERT(skb_headroom(skb) >= TTP_MAX_HEADER, return -1;);
}
-
+
self->avail_credit = 0;
self->remote_credit = 0;
self->rx_max_sdu_size = max_sdu_size;
@@ -1330,30 +1330,30 @@

/* SAR enabled? */
if (max_sdu_size > 0) {
- ASSERT(skb_headroom(skb) >= (TTP_MAX_HEADER+TTP_SAR_HEADER),
+ ASSERT(skb_headroom(skb) >= (TTP_MAX_HEADER+TTP_SAR_HEADER),
return -1;);
-
+
/* Insert TTP header with SAR parameters */
frame = skb_push(skb, TTP_HEADER+TTP_SAR_HEADER);
-
+
frame[0] = TTP_PARAMETERS | n;
frame[1] = 0x04; /* Length */

/* irda_param_insert(self, IRTTP_MAX_SDU_SIZE, frame+1, */
-/* TTP_SAR_HEADER, &param_info) */
-
+/* TTP_SAR_HEADER, &param_info) */
+
frame[2] = 0x01; /* MaxSduSize */
frame[3] = 0x02; /* Value length */

- put_unaligned(cpu_to_be16((__u16) max_sdu_size),
+ put_unaligned(cpu_to_be16((__u16) max_sdu_size),
(__u16 *)(frame+4));
} else {
/* Insert TTP header */
frame = skb_push(skb, TTP_HEADER);
-
+
frame[0] = n & 0x7f;
}
-
+
ret = irlmp_connect_response(self->lsap, skb);

return ret;
@@ -1365,7 +1365,7 @@
* Duplicate TSAP, can be used by servers to confirm a connection on a
* new TSAP so it can keep listening on the old one.
*/
-struct tsap_cb *irttp_dup(struct tsap_cb *orig, void *instance)
+struct tsap_cb *irttp_dup(struct tsap_cb *orig, void *instance)
{
struct tsap_cb *new;

@@ -1400,11 +1400,11 @@
/*
* Function irttp_disconnect_request (self)
*
- * Close this connection please! If priority is high, the queued data
+ * Close this connection please! If priority is high, the queued data
* segments, if any, will be deallocated first
*
*/
-int irttp_disconnect_request(struct tsap_cb *self, struct sk_buff *userdata,
+int irttp_disconnect_request(struct tsap_cb *self, struct sk_buff *userdata,
int priority)
{
struct sk_buff *skb;
@@ -1441,15 +1441,15 @@
*/
if (skb_queue_len(&self->tx_queue) > 0) {
if (priority == P_HIGH) {
- /*
- * No need to send the queued data, if we are
+ /*
+ * No need to send the queued data, if we are
* disconnecting right now since the data will
* not have any usable connection to be sent on
*/
IRDA_DEBUG(1, __FUNCTION__ "High priority!!()\n" );
irttp_flush_queues(self);
} else if (priority == P_NORMAL) {
- /*
+ /*
* Must delay disconnect until after all data segments
* have been sent and the tx_queue is empty
*/
@@ -1474,12 +1474,12 @@
skb = dev_alloc_skb(64);
if (!skb)
return -ENOMEM;
-
- /*
- * Reserve space for MUX and LAP header
+
+ /*
+ * Reserve space for MUX and LAP header
*/
skb_reserve(skb, TTP_MAX_HEADER);
-
+
userdata = skb;
}
ret = irlmp_disconnect_request(self->lsap, userdata);
@@ -1496,21 +1496,21 @@
* Disconnect indication, TSAP disconnected by peer?
*
*/
-void irttp_disconnect_indication(void *instance, void *sap, LM_REASON reason,
- struct sk_buff *skb)
+void irttp_disconnect_indication(void *instance, void *sap, LM_REASON reason,
+ struct sk_buff *skb)
{
struct tsap_cb *self;

IRDA_DEBUG(4, __FUNCTION__ "()\n");

self = (struct tsap_cb *) instance;
-
+
ASSERT(self != NULL, return;);
ASSERT(self->magic == TTP_TSAP_MAGIC, return;);
-
+
/* Prevent higher layer to send more data */
self->connected = FALSE;
-
+
/* Check if client has already tried to close the TSAP */
if (self->close_pend) {
/* In this case, the higher layer is probably gone. Don't
@@ -1558,18 +1558,18 @@
/* Usually the layer above will notify that it's input queue is
* starting to get filled by using the flow request, but this may
* be difficult, so it can instead just refuse to eat it and just
- * give an error back
+ * give an error back
*/
if (err == -ENOMEM) {
IRDA_DEBUG(0, __FUNCTION__ "() requeueing skb!\n");

/* Make sure we take a break */
self->rx_sdu_busy = TRUE;
-
+
/* Need to push the header in again */
skb_push(skb, TTP_HEADER);
skb->data[0] = 0x00; /* Make sure MORE bit is cleared */
-
+
/* Put skb back on queue */
skb_queue_head(&self->rx_queue, skb);
}
@@ -1581,18 +1581,18 @@
* Check if we have any frames to be transmitted, or if we have any
* available credit to give away.
*/
-void irttp_run_rx_queue(struct tsap_cb *self)
+void irttp_run_rx_queue(struct tsap_cb *self)
{
struct sk_buff *skb;
int more = 0;

- IRDA_DEBUG(2, __FUNCTION__ "() send=%d,avail=%d,remote=%d\n",
+ IRDA_DEBUG(2, __FUNCTION__ "() send=%d,avail=%d,remote=%d\n",
self->send_credit, self->avail_credit, self->remote_credit);

/* Get exclusive access to the rx queue, otherwise don't touch it */
if (irda_lock(&self->rx_queue_lock) == FALSE)
return;
-
+
/*
* Reassemble all frames in receive queue and deliver them
*/
@@ -1606,7 +1606,7 @@
/* Add the length of the remaining data */
self->rx_sdu_size += skb->len;

- /*
+ /*
* If SAR is disabled, or user has requested no reassembly
* of received fragments then we just deliver them
* immediately. This can be requested by clients that
@@ -1621,8 +1621,8 @@

/* Check if this is a fragment, and not the last fragment */
if (more) {
- /*
- * Queue the fragment if we still are within the
+ /*
+ * Queue the fragment if we still are within the
* limits of the maximum size of the rx_sdu
*/
if (self->rx_sdu_size <= self->rx_max_sdu_size) {
@@ -1638,32 +1638,32 @@
* This is the last fragment, so time to reassemble!
*/
if ((self->rx_sdu_size <= self->rx_max_sdu_size) ||
- (self->rx_max_sdu_size == TTP_SAR_UNBOUND))
+ (self->rx_max_sdu_size == TTP_SAR_UNBOUND))
{
- /*
+ /*
* A little optimizing. Only queue the fragment if
* there are other fragments. Since if this is the
* last and only fragment, there is no need to
- * reassemble :-)
+ * reassemble :-)
*/
if (!skb_queue_empty(&self->rx_fragments)) {
- skb_queue_tail(&self->rx_fragments,
+ skb_queue_tail(&self->rx_fragments,
skb);
-
+
skb = irttp_reassemble_skb(self);
}
-
+
/* Now we can deliver the reassembled skb */
irttp_do_data_indication(self, skb);
} else {
IRDA_DEBUG(1, __FUNCTION__ "(), Truncated frame\n");
-
+
/* Free the part of the SDU that is too big */
dev_kfree_skb(skb);

/* Deliver only the valid but truncated part of SDU */
skb = irttp_reassemble_skb(self);
-
+
irttp_do_data_indication(self, skb);
}
self->rx_sdu_size = 0;
@@ -1671,7 +1671,7 @@

/*
* It's not trivial to keep track of how many credits are available
- * by incrementing at each packet, because delivery may fail
+ * by incrementing at each packet, because delivery may fail
* (irttp_do_data_indication() may requeue the frame) and because
* we need to take care of fragmentation.
* We want the other side to send up to initial_credit packets.
@@ -1721,11 +1721,11 @@
struct tsap_cb *self;
unsigned long flags;
int i = 0;
-
+
ASSERT(irttp != NULL, return 0;);
-
+
len = 0;
-
+
save_flags(flags);
cli();

@@ -1735,9 +1735,9 @@
break;

len += sprintf(buf+len, "TSAP %d, ", i++);
- len += sprintf(buf+len, "stsap_sel: %02x, ",
+ len += sprintf(buf+len, "stsap_sel: %02x, ",
self->stsap_sel);
- len += sprintf(buf+len, "dtsap_sel: %02x\n",
+ len += sprintf(buf+len, "dtsap_sel: %02x\n",
self->dtsap_sel);
len += sprintf(buf+len, " connected: %s, ",
self->connected? "TRUE":"FALSE");
@@ -1751,9 +1751,9 @@
self->stats.tx_packets);
len += sprintf(buf+len, "rx packets: %ld, ",
self->stats.rx_packets);
- len += sprintf(buf+len, "tx_queue len: %d ",
+ len += sprintf(buf+len, "tx_queue len: %d ",
skb_queue_len(&self->tx_queue));
- len += sprintf(buf+len, "rx_queue len: %d\n",
+ len += sprintf(buf+len, "rx_queue len: %d\n",
skb_queue_len(&self->rx_queue));
len += sprintf(buf+len, " tx_sdu_busy: %s, ",
self->tx_sdu_busy? "TRUE":"FALSE");
@@ -1766,11 +1766,11 @@
len += sprintf(buf+len, "rx_max_sdu_size: %d\n",
self->rx_max_sdu_size);

- len += sprintf(buf+len, " Used by (%s)\n",
+ len += sprintf(buf+len, " Used by (%s)\n",
self->notify.name);

len += sprintf(buf+len, "\n");
-
+
self = (struct tsap_cb *) hashbin_get_next(irttp->tsaps);
}
restore_flags(flags);


Attachments:
warn-2.5.21-17.diff (30.74 kB)

2002-06-10 12:50:49

by Martin Dalecki

[permalink] [raw]
Subject: [PATCH] 2.5.21 kill warnings 18/19

diff -urN linux-2.5.21/net/irda/parameters.c linux/net/irda/parameters.c
--- linux-2.5.21/net/irda/parameters.c 2002-06-09 07:30:51.000000000 +0200
+++ linux/net/irda/parameters.c 2002-06-09 20:38:32.000000000 +0200
@@ -1,5 +1,5 @@
/*********************************************************************
- *
+ *
* Filename: parameters.c
* Version: 1.0
* Description: A more general way to handle (pi,pl,pv) parameters
@@ -8,24 +8,24 @@
* Created at: Mon Jun 7 10:25:11 1999
* Modified at: Sun Jan 30 14:08:39 2000
* Modified by: Dag Brattli <[email protected]>
- *
+ *
* Copyright (c) 1999-2000 Dag Brattli, All Rights Reserved.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
* the License, or (at your option) any later version.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
* MA 02111-1307 USA
- *
+ *
********************************************************************/

#include <linux/types.h>
@@ -35,18 +35,18 @@
#include <net/irda/irda.h>
#include <net/irda/parameters.h>

-static int irda_extract_integer(void *self, __u8 *buf, int len, __u8 pi,
+static int irda_extract_integer(void *self, __u8 *buf, int len, __u8 pi,
PV_TYPE type, PI_HANDLER func);
-static int irda_extract_string(void *self, __u8 *buf, int len, __u8 pi,
+static int irda_extract_string(void *self, __u8 *buf, int len, __u8 pi,
PV_TYPE type, PI_HANDLER func);
-static int irda_extract_octseq(void *self, __u8 *buf, int len, __u8 pi,
+static int irda_extract_octseq(void *self, __u8 *buf, int len, __u8 pi,
PV_TYPE type, PI_HANDLER func);
-static int irda_extract_no_value(void *self, __u8 *buf, int len, __u8 pi,
+static int irda_extract_no_value(void *self, __u8 *buf, int len, __u8 pi,
PV_TYPE type, PI_HANDLER func);

-static int irda_insert_integer(void *self, __u8 *buf, int len, __u8 pi,
+static int irda_insert_integer(void *self, __u8 *buf, int len, __u8 pi,
PV_TYPE type, PI_HANDLER func);
-static int irda_insert_no_value(void *self, __u8 *buf, int len, __u8 pi,
+static int irda_insert_no_value(void *self, __u8 *buf, int len, __u8 pi,
PV_TYPE type, PI_HANDLER func);

/* Parameter value call table. Must match PV_TYPE */
@@ -72,11 +72,8 @@

/*
* Function irda_insert_no_value (self, buf, len, pi, type, func)
- *
- *
- *
*/
-static int irda_insert_no_value(void *self, __u8 *buf, int len, __u8 pi,
+static int irda_insert_no_value(void *self, __u8 *buf, int len, __u8 pi,
PV_TYPE type, PI_HANDLER func)
{
irda_param_t p;
@@ -93,7 +90,7 @@

if (ret < 0)
return ret;
-
+
return 2; /* Inserted pl+2 bytes */
}

@@ -103,7 +100,7 @@
* Extracts a parameter without a pv field (pl=0)
*
*/
-static int irda_extract_no_value(void *self, __u8 *buf, int len, __u8 pi,
+static int irda_extract_no_value(void *self, __u8 *buf, int len, __u8 pi,
PV_TYPE type, PI_HANDLER func)
{
irda_param_t p;
@@ -117,17 +114,14 @@

if (ret < 0)
return ret;
-
+
return 2; /* Extracted pl+2 bytes */
}

/*
* Function irda_insert_integer (self, buf, len, pi, type, func)
- *
- *
- *
*/
-static int irda_insert_integer(void *self, __u8 *buf, int len, __u8 pi,
+static int irda_insert_integer(void *self, __u8 *buf, int len, __u8 pi,
PV_TYPE type, PI_HANDLER func)
{
irda_param_t p;
@@ -141,10 +135,10 @@
/* Call handler for this parameter */
err = (*func)(self, &p, PV_GET);
if (err < 0)
- return err;
+ return err;

- /*
- * If parameter lenght is still 0, then (1) this is an any length
+ /*
+ * If parameter lenght is still 0, then (1) this is an any length
* integer, and (2) the handler function does not care which length
* we choose to use, so we pick the one the gives the fewest bytes.
*/
@@ -162,7 +156,7 @@
}
/* Check if buffer is long enough for insertion */
if (len < (2+p.pl)) {
- WARNING(__FUNCTION__ "(), buffer to short for insertion!\n");
+ WARNING("%s: buffer to short for insertion!\n", __FUNCTION__);
return -1;
}
IRDA_DEBUG(2, __FUNCTION__ "(), pi=%#x, pl=%d, pi=%d\n", p.pi, p.pl, p.pv.i);
@@ -186,8 +180,8 @@

break;
default:
- WARNING(__FUNCTION__ "() length %d not supported\n", p.pl);
- /* Skip parameter */
+ WARNING("%s: length %d not supported\n", __FUNCTION__, p.pl);
+ /* Skip parameter */
return -1;
}

@@ -197,10 +191,10 @@
/*
* Function irda_extract integer (self, buf, len, pi, type, func)
*
- * Extract a possibly variable length integer from buffer, and call
+ * Extract a possibly variable length integer from buffer, and call
* handler for processing of the parameter
*/
-static int irda_extract_integer(void *self, __u8 *buf, int len, __u8 pi,
+static int irda_extract_integer(void *self, __u8 *buf, int len, __u8 pi,
PV_TYPE type, PI_HANDLER func)
{
irda_param_t p;
@@ -213,20 +207,21 @@

/* Check if buffer is long enough for parsing */
if (len < (2+p.pl)) {
- WARNING(__FUNCTION__ "(), buffer to short for parsing! "
- "Need %d bytes, but len is only %d\n", p.pl, len);
+ WARNING("%s: buffer to short for parsing! "
+ "Need %d bytes, but len is only %d\n",
+ __FUNCTION__, p.pl, len);
return -1;
}

- /*
+ /*
* Check that the integer length is what we expect it to be. If the
* handler want a 16 bits integer then a 32 bits is not good enough
*/
if (((type & PV_MASK) != PV_INTEGER) && ((type & PV_MASK) != p.pl)) {
- ERROR(__FUNCTION__ "(), invalid parameter length! "
+ ERROR("%s: invalid parameter length! "
"Expected %d bytes, but value had %d bytes!\n",
- type & PV_MASK, p.pl);
-
+ __FUNCTION__, type & PV_MASK, p.pl);
+
/* Skip parameter */
return p.pl+2;
}
@@ -251,9 +246,9 @@
le32_to_cpus(&p.pv.i);
break;
default:
- WARNING(__FUNCTION__ "() length %d not supported\n", p.pl);
+ WARNING("%s: length %d not supported\n", __FUNCTION__, p.pl);

- /* Skip parameter */
+ /* Skip parameter */
return p.pl+2;
}

@@ -261,18 +256,15 @@
/* Call handler for this parameter */
err = (*func)(self, &p, PV_PUT);
if (err < 0)
- return err;
+ return err;

return p.pl+2; /* Extracted pl+2 bytes */
}

/*
* Function irda_extract_string (self, buf, len, type, func)
- *
- *
- *
*/
-static int irda_extract_string(void *self, __u8 *buf, int len, __u8 pi,
+static int irda_extract_string(void *self, __u8 *buf, int len, __u8 pi,
PV_TYPE type, PI_HANDLER func)
{
char str[33];
@@ -288,18 +280,19 @@

/* Check if buffer is long enough for parsing */
if (len < (2+p.pl)) {
- WARNING(__FUNCTION__ "(), buffer to short for parsing! "
- "Need %d bytes, but len is only %d\n", p.pl, len);
+ WARNING("%s: buffer to short for parsing! "
+ "Need %d bytes, but len is only %d\n",
+ __FUNCTION__, p.pl, len);
return -1;
}

- /* Should be safe to copy string like this since we have already
+ /* Should be safe to copy string like this since we have already
* checked that the buffer is long enough */
strncpy(str, buf+2, p.pl);

- IRDA_DEBUG(2, __FUNCTION__ "(), str=0x%02x 0x%02x\n", (__u8) str[0],
+ IRDA_DEBUG(2, __FUNCTION__ "(), str=0x%02x 0x%02x\n", (__u8) str[0],
(__u8) str[1]);
-
+
/* Null terminate string */
str[p.pl+1] = '\0';

@@ -308,16 +301,13 @@
/* Call handler for this parameter */
err = (*func)(self, &p, PV_PUT);
if (err < 0)
- return err;
+ return err;

return p.pl+2; /* Extracted pl+2 bytes */
}

/*
* Function irda_extract_octseq (self, buf, len, type, func)
- *
- *
- *
*/
static int irda_extract_octseq(void *self, __u8 *buf, int len, __u8 pi,
PV_TYPE type, PI_HANDLER func)
@@ -329,13 +319,14 @@

/* Check if buffer is long enough for parsing */
if (len < (2+p.pl)) {
- WARNING(__FUNCTION__ "(), buffer to short for parsing! "
- "Need %d bytes, but len is only %d\n", p.pl, len);
+ WARNING("%s: buffer to short for parsing! "
+ "Need %d bytes, but len is only %d\n",
+ __FUNCTION__, p.pl, len);
return -1;
}

IRDA_DEBUG(0, __FUNCTION__ "(), not impl\n");
-
+
return p.pl+2; /* Extracted pl+2 bytes */
}

@@ -353,7 +344,7 @@
va_list args;
char *p;
int n = 0;
-
+
va_start(args, fmt);

for (p = fmt; *p != '\0'; p++) {
@@ -380,7 +371,6 @@
va_end(args);
return -1;
}
-
}
va_end(args);

@@ -389,9 +379,6 @@

/*
* Function irda_param_unpack (skb, fmt, ...)
- *
- *
- *
*/
int irda_param_unpack(__u8 *buf, char *fmt, ...)
{
@@ -427,7 +414,7 @@
va_end(args);
return -1;
}
-
+
}
va_end(args);

@@ -440,7 +427,7 @@
* Insert the specified parameter (pi) into buffer. Returns number of
* bytes inserted
*/
-int irda_param_insert(void *self, __u8 pi, __u8 *buf, int len,
+int irda_param_insert(void *self, __u8 pi, __u8 *buf, int len,
pi_param_info_t *info)
{
pi_minor_info_t *pi_minor_info;
@@ -457,16 +444,16 @@
pi_major = pi >> info->pi_major_offset;

/* Check if the identifier value (pi) is valid */
- if ((pi_major > info->len-1) ||
+ if ((pi_major > info->len-1) ||
(pi_minor > info->tables[pi_major].len-1))
{
- IRDA_DEBUG(0, __FUNCTION__
+ IRDA_DEBUG(0, __FUNCTION__
"(), no handler for parameter=0x%02x\n", pi);
-
+
/* Skip this parameter */
return -1;
}
-
+
/* Lookup the info on how to parse this parameter */
pi_minor_info = &info->tables[pi_major].pi_minor_call_table[pi_minor];

@@ -475,13 +462,13 @@

/* Check if handler has been implemented */
if (!pi_minor_info->func) {
- MESSAGE(__FUNCTION__"(), no handler for pi=%#x\n", pi);
+ MESSAGE("%s: no handler for pi=%#x\n", __FUNCTION__, pi);
/* Skip this parameter */
return -1;
}
-
+
/* Insert parameter value */
- ret = (*pv_insert_table[type & PV_MASK])(self, buf+n, len, pi, type,
+ ret = (*pv_insert_table[type & PV_MASK])(self, buf+n, len, pi, type,
pi_minor_info->func);
return ret;
}
@@ -507,14 +494,14 @@

pi_minor = buf[n] & info->pi_mask;
pi_major = buf[n] >> info->pi_major_offset;
-
+
/* Check if the identifier value (pi) is valid */
- if ((pi_major > info->len-1) ||
+ if ((pi_major > info->len-1) ||
(pi_minor > info->tables[pi_major].len-1))
{
IRDA_DEBUG(0, __FUNCTION__ "(), no handler for parameter=0x%02x\n",
buf[0]);
-
+
/* Skip this parameter */
return 2 + buf[n + 1]; /* Continue */
}
@@ -524,13 +511,13 @@

/* Find expected data type for this parameter identifier (pi)*/
type = pi_minor_info->type;
-
+
IRDA_DEBUG(3, __FUNCTION__ "(), pi=[%d,%d], type=%d\n",
pi_major, pi_minor, type);
-
+
/* Check if handler has been implemented */
if (!pi_minor_info->func) {
- MESSAGE(__FUNCTION__"(), no handler for pi=%#x\n", buf[n]);
+ MESSAGE("%s: no handler for pi=%#x\n", __FUNCTION__, buf[n]);
/* Skip this parameter */
return 2 + buf[n + 1]; /* Continue */
}


Attachments:
warn-2.5.21-18.diff (11.66 kB)

2002-06-10 12:43:40

by Martin Dalecki

[permalink] [raw]
Subject: [PATCH] 2.5.21 kill warnings 11/19

diff -urN linux-2.5.21/net/irda/irias_object.c linux/net/irda/irias_object.c
--- linux-2.5.21/net/irda/irias_object.c 2002-06-09 07:27:15.000000000 +0200
+++ linux/net/irda/irias_object.c 2002-06-09 20:50:51.000000000 +0200
@@ -1,5 +1,5 @@
/*********************************************************************
- *
+ *
* Filename: irias_object.c
* Version: 0.3
* Description: IAS object database and functions
@@ -8,18 +8,18 @@
* Created at: Thu Oct 1 22:50:04 1998
* Modified at: Wed Dec 15 11:23:16 1999
* Modified by: Dag Brattli <[email protected]>
- *
+ *
* Copyright (c) 1998-1999 Dag Brattli, All Rights Reserved.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
* the License, or (at your option) any later version.
- *
+ *
* Neither Dag Brattli nor University of Troms? admit liability nor
- * provide warranty for any of this software. This material is
+ * provide warranty for any of this software. This material is
* provided "AS-IS" and at no charge.
- *
+ *
********************************************************************/

#include <linux/string.h>
@@ -47,7 +47,7 @@
{
char *new_str;
int len;
-
+
/* Check string */
if (str == NULL)
return NULL;
@@ -59,14 +59,14 @@
/* Allocate new string */
new_str = kmalloc(len + 1, GFP_ATOMIC);
if (new_str == NULL) {
- WARNING(__FUNCTION__"(), Unable to kmalloc!\n");
+ WARNING("%s: Unable to kmalloc!\n", __FUNCTION__);
return NULL;
}

/* Copy and truncate */
memcpy(new_str, str, len);
new_str[len] = '\0';
-
+
return new_str;
}

@@ -79,10 +79,10 @@
struct ias_object *irias_new_object( char *name, int id)
{
struct ias_object *obj;
-
+
IRDA_DEBUG( 4, __FUNCTION__ "()\n");

- obj = (struct ias_object *) kmalloc(sizeof(struct ias_object),
+ obj = (struct ias_object *) kmalloc(sizeof(struct ias_object),
GFP_ATOMIC);
if (obj == NULL) {
IRDA_DEBUG(0, __FUNCTION__ "(), Unable to allocate object!\n");
@@ -95,7 +95,7 @@
obj->id = id;

obj->attribs = hashbin_new(HB_LOCAL);
-
+
return obj;
}

@@ -115,7 +115,7 @@

irias_delete_value(attrib->value);
attrib->magic = ~IAS_ATTRIB_MAGIC;
-
+
kfree(attrib);
}

@@ -126,11 +126,11 @@

if (obj->name)
kfree(obj->name);
-
+
hashbin_delete(obj->attribs, (FREE_FUNC) __irias_delete_attrib);
-
+
obj->magic = ~IAS_OBJECT_MAGIC;
-
+
kfree(obj);
}

@@ -141,7 +141,7 @@
* with this object and the object itself
*
*/
-int irias_delete_object(struct ias_object *obj)
+int irias_delete_object(struct ias_object *obj)
{
struct ias_object *node;

@@ -164,7 +164,7 @@
* the object, remove the object as well.
*
*/
-int irias_delete_attrib(struct ias_object *obj, struct ias_attrib *attrib)
+int irias_delete_attrib(struct ias_object *obj, struct ias_attrib *attrib)
{
struct ias_attrib *node;

@@ -198,7 +198,7 @@
{
ASSERT(obj != NULL, return;);
ASSERT(obj->magic == IAS_OBJECT_MAGIC, return;);
-
+
hashbin_insert(objects, (irda_queue_t *) obj, 0, obj->name);
}

@@ -247,7 +247,7 @@
{
ASSERT(obj != NULL, return;);
ASSERT(obj->magic == IAS_OBJECT_MAGIC, return;);
-
+
ASSERT(attrib != NULL, return;);
ASSERT(attrib->magic == IAS_ATTRIB_MAGIC, return;);

@@ -263,8 +263,8 @@
* Change the value of an objects attribute.
*
*/
-int irias_object_change_attribute(char *obj_name, char *attrib_name,
- struct ias_value *new_value)
+int irias_object_change_attribute(char *obj_name, char *attrib_name,
+ struct ias_value *new_value)
{
struct ias_object *obj;
struct ias_attrib *attrib;
@@ -272,7 +272,7 @@
/* Find object */
obj = hashbin_find(objects, 0, obj_name);
if (obj == NULL) {
- WARNING(__FUNCTION__ "(), Unable to find object: %s\n",
+ WARNING("%s: Unable to find object: %s\n", __FUNCTION__,
obj_name);
return -1;
}
@@ -280,20 +280,20 @@
/* Find attribute */
attrib = hashbin_find(obj->attribs, 0, attrib_name);
if (attrib == NULL) {
- WARNING(__FUNCTION__ "(), Unable to find attribute: %s\n",
+ WARNING("%s: Unable to find attribute: %s\n", __FUNCTION__,
attrib_name);
return -1;
}
-
+
if ( attrib->value->type != new_value->type) {
- IRDA_DEBUG( 0, __FUNCTION__
+ IRDA_DEBUG( 0, __FUNCTION__
"(), changing value type not allowed!\n");
return -1;
}

/* Delete old value */
irias_delete_value(attrib->value);
-
+
/* Insert new value */
attrib->value = new_value;

@@ -315,11 +315,11 @@
ASSERT(obj != NULL, return;);
ASSERT(obj->magic == IAS_OBJECT_MAGIC, return;);
ASSERT(name != NULL, return;);
-
- attrib = (struct ias_attrib *) kmalloc(sizeof(struct ias_attrib),
+
+ attrib = (struct ias_attrib *) kmalloc(sizeof(struct ias_attrib),
GFP_ATOMIC);
if (attrib == NULL) {
- WARNING(__FUNCTION__ "(), Unable to allocate attribute!\n");
+ WARNING("%s: Unable to allocate attribute!\n", __FUNCTION__);
return;
}
memset(attrib, 0, sizeof( struct ias_attrib));
@@ -329,7 +329,7 @@

/* Insert value */
attrib->value = irias_new_integer_value(value);
-
+
irias_add_attrib(obj, attrib, owner);
}

@@ -344,27 +344,26 @@
int len, int owner)
{
struct ias_attrib *attrib;
-
+
ASSERT(obj != NULL, return;);
ASSERT(obj->magic == IAS_OBJECT_MAGIC, return;);
-
+
ASSERT(name != NULL, return;);
ASSERT(octets != NULL, return;);
-
- attrib = (struct ias_attrib *) kmalloc(sizeof(struct ias_attrib),
+
+ attrib = (struct ias_attrib *) kmalloc(sizeof(struct ias_attrib),
GFP_ATOMIC);
if (attrib == NULL) {
- WARNING(__FUNCTION__
- "(), Unable to allocate attribute!\n");
+ WARNING("%s: Unable to allocate attribute!\n", __FUNCTION__);
return;
}
memset(attrib, 0, sizeof( struct ias_attrib));
-
+
attrib->magic = IAS_ATTRIB_MAGIC;
attrib->name = strndup(name, IAS_MAX_ATTRIBNAME);
-
+
attrib->value = irias_new_octseq_value( octets, len);
-
+
irias_add_attrib(obj, attrib, owner);
}

@@ -384,11 +383,11 @@

ASSERT(name != NULL, return;);
ASSERT(value != NULL, return;);
-
- attrib = (struct ias_attrib *) kmalloc(sizeof( struct ias_attrib),
+
+ attrib = (struct ias_attrib *) kmalloc(sizeof( struct ias_attrib),
GFP_ATOMIC);
if (attrib == NULL) {
- WARNING(__FUNCTION__ "(), Unable to allocate attribute!\n");
+ WARNING("%s: Unable to allocate attribute!\n", __FUNCTION__);
return;
}
memset(attrib, 0, sizeof( struct ias_attrib));
@@ -413,7 +412,7 @@

value = kmalloc(sizeof(struct ias_value), GFP_ATOMIC);
if (value == NULL) {
- WARNING(__FUNCTION__ "(), Unable to kmalloc!\n");
+ WARNING("%s: Unable to kmalloc!\n", __FUNCTION__);
return NULL;
}
memset(value, 0, sizeof(struct ias_value));
@@ -438,7 +437,7 @@

value = kmalloc(sizeof(struct ias_value), GFP_ATOMIC);
if (value == NULL) {
- WARNING(__FUNCTION__ "(), Unable to kmalloc!\n");
+ WARNING("%s: Unable to kmalloc!\n", __FUNCTION__);
return NULL;
}
memset( value, 0, sizeof( struct ias_value));
@@ -465,7 +464,7 @@

value = kmalloc(sizeof(struct ias_value), GFP_ATOMIC);
if (value == NULL) {
- WARNING(__FUNCTION__ "(), Unable to kmalloc!\n");
+ WARNING("%s: Unable to kmalloc!\n", __FUNCTION__);
return NULL;
}
memset(value, 0, sizeof(struct ias_value));
@@ -478,7 +477,7 @@

value->t.oct_seq = kmalloc(len, GFP_ATOMIC);
if (value->t.oct_seq == NULL){
- WARNING(__FUNCTION__"(), Unable to kmalloc!\n");
+ WARNING("%s: Unable to kmalloc!\n", __FUNCTION__);
kfree(value);
return NULL;
}
@@ -492,7 +491,7 @@

value = kmalloc(sizeof(struct ias_value), GFP_ATOMIC);
if (value == NULL) {
- WARNING(__FUNCTION__ "(), Unable to kmalloc!\n");
+ WARNING("%s: Unable to kmalloc!\n", __FUNCTION__);
return NULL;
}
memset(value, 0, sizeof(struct ias_value));
@@ -536,6 +535,3 @@
}
kfree(value);
}
-
-
-


Attachments:
warn-2.5.21-11.diff (8.08 kB)

2002-06-10 13:01:13

by Martin Dalecki

[permalink] [raw]
Subject: [REVERT] 2.5.21 s390/block/xpram.c

diff -Nru a/drivers/s390/block/xpram.c b/drivers/s390/block/xpram.c
--- a/drivers/s390/block/xpram.c Sat Jun 8 22:31:51 2002
+++ b/drivers/s390/block/xpram.c Sat Jun 8 22:31:51 2002
@@ -158,6 +158,7 @@
/* The following items are obtained through kmalloc() in init_module() */

Xpram_Dev *xpram_devices = NULL;
+int *xpram_hardsects = NULL;
int *xpram_offsets = NULL; /* partition offsets */

#define MIN(x,y) ((x) < (y) ? (x) : (y))
@@ -938,7 +939,6 @@

q = BLK_DEFAULT_QUEUE(major);
blk_init_queue (q, xpram_request);
- blk_queue_hardsect_size(q, xpram_hardsect);

/* we want to have XPRAM_UNUSED blocks security buffer between devices */
mem_usable=xpram_mem_avail-(XPRAM_UNUSED*(xpram_devs-1));
@@ -978,6 +978,16 @@
PRINT_DEBUG(" device(%d) offset = %d kB, size = %d kB\n",i, xpram_offsets[i], xpram_sizes[i]);
#endif

+ xpram_hardsects = kmalloc(xpram_devs * sizeof(int), GFP_KERNEL);
+ if (!xpram_hardsects) {
+ PRINT_ERR("Not enough memory for xpram_hardsects\n");
+ PRINT_ERR("Giving up xpram\n");
+ goto fail_malloc_hardsects;
+ }
+ for (i=0; i < xpram_devs; i++) /* all the same hardsect */
+ xpram_hardsects[i] = xpram_hardsect;
+ hardsect_size[major]=xpram_hardsects;
+
/*
* allocate the devices -- we can't have them static, as the number
* can be specified at load time
@@ -1030,6 +1040,7 @@
goto fail_devfs_register;
}
#endif /* WHY? */
+
}

return 0; /* succeed */
@@ -1042,7 +1053,10 @@
}
kfree(xpram_devices);
kfree (xpram_offsets);
+ fail_malloc_hardsects:
fail_malloc_devices:
+ kfree(xpram_hardsects);
+ hardsect_size[major] = NULL;
fail_malloc:
/* ??? unregister_chrdev(major, "xpram"); */
unregister_blkdev(major, "xpram");
@@ -1072,6 +1086,7 @@
int i;

/* first of all, reset all the data structures */
+ kfree(hardsect_size[major]);
kfree(xpram_offsets);
blk_clear(major);


Attachments:
bumb-2.5.21.diff (1.85 kB)

2002-06-10 12:55:45

by Martin Dalecki

[permalink] [raw]
Subject: Re: [PATCH] 2.5.21 "I can't get no compilation"

Anton Altaparmakov wrote:
> At 12:19 10/06/02, Martin Dalecki wrote:
>
>> The subject says it all...
>>
>> Contrary to other proposed patches I realized that there is
>> no such thing as vmalloc_dma.
>
>
> Perhaps you ought to look in mm/vmalloc.c which contains:
>
> void * vmalloc_dma (unsigned long size)
> {
> return __vmalloc(size, GFP_KERNEL|GFP_DMA, PAGE_KERNEL);
> }
>
> Or are you going to tell me that is a figment of my imagination?
>

Oh I have missed the chunk which delets it there apparently, since
*nobody* is using this. The only place where a special
__vmalloc setup code is used in nfs which GFP_NOFS flag added,
but not the above. so providing vmalloc_nofs would make more
sense then vmalloc_dma.

2002-06-10 12:49:27

by Martin Dalecki

[permalink] [raw]
Subject: [PATCH] 2.5.21 kill warinigs 14/19

diff -urN linux-2.5.21/net/irda/irlap_frame.c linux/net/irda/irlap_frame.c
--- linux-2.5.21/net/irda/irlap_frame.c 2002-06-09 07:28:13.000000000 +0200
+++ linux/net/irda/irlap_frame.c 2002-06-09 21:12:20.000000000 +0200
@@ -1,5 +1,5 @@
/*********************************************************************
- *
+ *
* Filename: irlap_frame.c
* Version: 1.0
* Description: Build and transmit IrLAP frames
@@ -8,18 +8,18 @@
* Created at: Tue Aug 19 10:27:26 1997
* Modified at: Wed Jan 5 08:59:04 2000
* Modified by: Dag Brattli <[email protected]>
- *
- * Copyright (c) 1998-2000 Dag Brattli <[email protected]>,
+ *
+ * Copyright (c) 1998-2000 Dag Brattli <[email protected]>,
* All Rights Reserved.
* Copyright (c) 2000-2001 Jean Tourrilhes <[email protected]>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
* the License, or (at your option) any later version.
*
* Neither Dag Brattli nor University of Troms? admit liability nor
- * provide warranty for any of this software. This material is
+ * provide warranty for any of this software. This material is
* provided "AS-IS" and at no charge.
*
********************************************************************/
@@ -29,10 +29,10 @@
#include <linux/if_ether.h>
#include <linux/netdevice.h>
#include <linux/irda.h>
-
+
#include <net/pkt_sched.h>
#include <net/sock.h>
-
+
#include <asm/byteorder.h>

#include <net/irda/irda.h>
@@ -46,18 +46,18 @@
/*
* Function irlap_insert_info (self, skb)
*
- * Insert minimum turnaround time and speed information into the skb. We
+ * Insert minimum turnaround time and speed information into the skb. We
* need to do this since it's per packet relevant information. Safe to
* have this function inlined since it's only called from one place
*/
-static inline void irlap_insert_info(struct irlap_cb *self,
+static inline void irlap_insert_info(struct irlap_cb *self,
struct sk_buff *skb)
{
struct irda_skb_cb *cb = (struct irda_skb_cb *) skb->cb;

- /*
+ /*
* Insert MTT (min. turn time) and speed into skb, so that the
- * device driver knows which settings to use
+ * device driver knows which settings to use
*/
cb->magic = LAP_MAGIC;
cb->mtt = self->mtt_required;
@@ -65,15 +65,15 @@

/* Reset */
self->mtt_required = 0;
-
- /*
- * Delay equals negotiated BOFs count, plus the number of BOFs to
- * force the negotiated minimum turnaround time
+
+ /*
+ * Delay equals negotiated BOFs count, plus the number of BOFs to
+ * force the negotiated minimum turnaround time
*/
cb->xbofs = self->bofs_count;
cb->next_xbofs = self->next_bofs;
cb->xbofs_delay = self->xbofs_delay;
-
+
/* Reset XBOF's delay (used only for getting min turn time) */
self->xbofs_delay = 0;
/* Put the correct xbofs value for the next packet */
@@ -91,7 +91,7 @@
/* Some common init stuff */
skb->dev = self->netdev;
skb->h.raw = skb->nh.raw = skb->mac.raw = skb->data;
- skb->protocol = htons(ETH_P_IRDA);
+ skb->protocol = htons(ETH_P_IRDA);
skb->priority = TC_PRIO_BESTEFFORT;

irlap_insert_info(self, skb);
@@ -104,7 +104,7 @@
*
* Transmits a connect SNRM command frame
*/
-void irlap_send_snrm_frame(struct irlap_cb *self, struct qos_info *qos)
+void irlap_send_snrm_frame(struct irlap_cb *self, struct qos_info *qos)
{
struct sk_buff *skb;
struct snrm_frame *frame;
@@ -118,7 +118,7 @@
if (!skb)
return;

- frame = (struct snrm_frame *) skb_put(skb, 2);
+ frame = (struct snrm_frame *) skb_put(skb, 2);

/* Insert connection address field */
if (qos)
@@ -127,10 +127,10 @@
frame->caddr = CMD_FRAME | self->caddr;

/* Insert control field */
- frame->control = SNRM_CMD | PF_BIT;
-
+ frame->control = SNRM_CMD | PF_BIT;
+
/*
- * If we are establishing a connection then insert QoS paramerters
+ * If we are establishing a connection then insert QoS paramerters
*/
if (qos) {
skb_put(skb, 9); /* 21 left */
@@ -138,7 +138,7 @@
frame->daddr = cpu_to_le32(self->daddr);

frame->ncaddr = self->caddr;
-
+
ret = irlap_insert_qos_negotiation_params(self, skb);
if (ret < 0) {
dev_kfree_skb(skb);
@@ -154,28 +154,28 @@
* Received SNRM (Set Normal Response Mode) command frame
*
*/
-static void irlap_recv_snrm_cmd(struct irlap_cb *self, struct sk_buff *skb,
- struct irlap_info *info)
+static void irlap_recv_snrm_cmd(struct irlap_cb *self, struct sk_buff *skb,
+ struct irlap_info *info)
{
struct snrm_frame *frame;

frame = (struct snrm_frame *) skb->data;
-
+
if (skb->len >= sizeof(struct snrm_frame)) {
/* Copy the new connection address */
info->caddr = frame->ncaddr;

/* Check if the new connection address is valid */
if ((info->caddr == 0x00) || (info->caddr == 0xfe)) {
- IRDA_DEBUG(3, __FUNCTION__
+ IRDA_DEBUG(3, __FUNCTION__
"(), invalid connection address!\n");
return;
}
-
+
/* Copy peer device address */
info->daddr = le32_to_cpu(frame->saddr);
info->saddr = le32_to_cpu(frame->daddr);
-
+
/* Only accept if addressed directly to us */
if (info->saddr != self->saddr) {
IRDA_DEBUG(2, __FUNCTION__ "(), not addressed to us!\n");
@@ -199,9 +199,9 @@
struct sk_buff *skb;
struct ua_frame *frame;
int ret;
-
+
IRDA_DEBUG(2, __FUNCTION__ "() <%ld>\n", jiffies);
-
+
ASSERT(self != NULL, return;);
ASSERT(self->magic == LAP_MAGIC, return;);

@@ -213,10 +213,10 @@
return;

frame = (struct ua_frame *) skb_put(skb, 10);
-
+
/* Build UA response */
frame->caddr = self->caddr;
- frame->control = UA_RSP | PF_BIT;
+ frame->control = UA_RSP | PF_BIT;

frame->saddr = cpu_to_le32(self->saddr);
frame->daddr = cpu_to_le32(self->daddr);
@@ -244,7 +244,7 @@
{
struct sk_buff *skb = NULL;
__u8 *frame;
-
+
ASSERT(self != NULL, return;);
ASSERT(self->magic == LAP_MAGIC, return;);

@@ -253,7 +253,7 @@
return;

frame = skb_put( skb, 2);
-
+
if (self->state == LAP_NDM)
frame[0] = CBROADCAST;
else
@@ -261,7 +261,7 @@

frame[1] = DM_RSP | PF_BIT;

- irlap_queue_xmit(self, skb);
+ irlap_queue_xmit(self, skb);
}

/*
@@ -270,11 +270,11 @@
* Send disconnect (DISC) frame
*
*/
-void irlap_send_disc_frame(struct irlap_cb *self)
+void irlap_send_disc_frame(struct irlap_cb *self)
{
struct sk_buff *skb = NULL;
__u8 *frame;
-
+
IRDA_DEBUG(3, __FUNCTION__ "()\n");

ASSERT(self != NULL, return;);
@@ -285,7 +285,7 @@
return;

frame = skb_put(skb, 2);
-
+
frame[0] = self->caddr | CMD_FRAME;
frame[1] = DISC_CMD | PF_BIT;

@@ -296,17 +296,17 @@
* Function irlap_send_discovery_xid_frame (S, s, command)
*
* Build and transmit a XID (eXchange station IDentifier) discovery
- * frame.
+ * frame.
*/
-void irlap_send_discovery_xid_frame(struct irlap_cb *self, int S, __u8 s,
- __u8 command, discovery_t *discovery)
+void irlap_send_discovery_xid_frame(struct irlap_cb *self, int S, __u8 s,
+ __u8 command, discovery_t *discovery)
{
struct sk_buff *skb = NULL;
struct xid_frame *frame;
__u32 bcast = BROADCAST;
__u8 *info;

- IRDA_DEBUG(4, __FUNCTION__ "(), s=%d, S=%d, command=%d\n", s, S,
+ IRDA_DEBUG(4, __FUNCTION__ "(), s=%d, S=%d, command=%d\n", s, S,
command);

ASSERT(self != NULL, return;);
@@ -335,7 +335,7 @@
frame->daddr = cpu_to_le32(bcast);
else
frame->daddr = cpu_to_le32(discovery->daddr);
-
+
switch (S) {
case 1:
frame->flags = 0x00;
@@ -354,10 +354,10 @@
break;
}

- frame->slotnr = s;
+ frame->slotnr = s;
frame->version = 0x00;

- /*
+ /*
* Provide info for final slot only in commands, and for all
* responses. Send the second byte of the hint only if the
* EXTENSION bit is set in the first byte.
@@ -366,7 +366,7 @@
int len;

if (discovery->hints.byte[0] & HINT_EXTENSION) {
- info = skb_put(skb, 2);
+ info = skb_put(skb, 2);
info[0] = discovery->hints.byte[0];
info[1] = discovery->hints.byte[1];
} else {
@@ -379,7 +379,7 @@
len = IRDA_MIN(discovery->name_len, skb_tailroom(skb));
info = skb_put(skb, len);
memcpy(info, discovery->nickname, len);
- }
+ }
irlap_queue_xmit(self, skb);
}

@@ -389,9 +389,9 @@
* Received a XID discovery response
*
*/
-static void irlap_recv_discovery_xid_rsp(struct irlap_cb *self,
- struct sk_buff *skb,
- struct irlap_info *info)
+static void irlap_recv_discovery_xid_rsp(struct irlap_cb *self,
+ struct sk_buff *skb,
+ struct irlap_info *info)
{
struct xid_frame *xid;
discovery_t *discovery = NULL;
@@ -410,13 +410,13 @@

/* Make sure frame is addressed to us */
if ((info->saddr != self->saddr) && (info->saddr != BROADCAST)) {
- IRDA_DEBUG(0, __FUNCTION__
+ IRDA_DEBUG(0, __FUNCTION__
"(), frame is not addressed to us!\n");
return;
}

if ((discovery = kmalloc(sizeof(discovery_t), GFP_ATOMIC)) == NULL) {
- WARNING(__FUNCTION__ "(), kmalloc failed!\n");
+ WARNING("%s: kmalloc failed!\n", __FUNCTION__);
return;
}
memset(discovery, 0, sizeof(discovery_t));
@@ -441,11 +441,11 @@
discovery->charset = discovery_info[1];
text = (char *) &discovery_info[2];
}
- /*
- * Terminate info string, should be safe since this is where the
+ /*
+ * Terminate info string, should be safe since this is where the
* FCS bytes resides.
*/
- skb->data[skb->len] = '\0';
+ skb->data[skb->len] = '\0';
strncpy(discovery->nickname, text, NICKNAME_MAX_LEN);
discovery->name_len = strlen(discovery->nickname);

@@ -460,9 +460,9 @@
* Received a XID discovery command
*
*/
-static void irlap_recv_discovery_xid_cmd(struct irlap_cb *self,
- struct sk_buff *skb,
- struct irlap_info *info)
+static void irlap_recv_discovery_xid_cmd(struct irlap_cb *self,
+ struct sk_buff *skb,
+ struct irlap_info *info)
{
struct xid_frame *xid;
discovery_t *discovery = NULL;
@@ -476,7 +476,7 @@

/* Make sure frame is addressed to us */
if ((info->saddr != self->saddr) && (info->saddr != BROADCAST)) {
- IRDA_DEBUG(0, __FUNCTION__
+ IRDA_DEBUG(0, __FUNCTION__
"(), frame is not addressed to us!\n");
return;
}
@@ -500,16 +500,16 @@
return;
}
info->s = xid->slotnr;
-
+
discovery_info = skb_pull(skb, sizeof(struct xid_frame));

- /*
- * Check if last frame
+ /*
+ * Check if last frame
*/
if (info->s == 0xff) {
/* Check if things are sane at this point... */
if((discovery_info == NULL) || (skb->len < 3)) {
- ERROR(__FUNCTION__ "(), discovery frame to short!\n");
+ ERROR("%s: discovery frame to short!\n", __FUNCTION__);
return;
}

@@ -518,10 +518,10 @@
*/
discovery = kmalloc(sizeof(discovery_t), GFP_ATOMIC);
if (!discovery) {
- WARNING(__FUNCTION__ "(), unable to malloc!\n");
+ WARNING("%s: unable to malloc!\n", __FUNCTION__);
return;
}
-
+
discovery->daddr = info->daddr;
discovery->saddr = self->saddr;
discovery->timestamp = jiffies;
@@ -536,11 +536,11 @@
discovery->charset = discovery_info[1];
text = (char *) &discovery_info[2];
}
- /*
- * Terminate string, should be safe since this is where the
+ /*
+ * Terminate string, should be safe since this is where the
* FCS bytes resides.
*/
- skb->data[skb->len] = '\0';
+ skb->data[skb->len] = '\0';
strncpy(discovery->nickname, text, NICKNAME_MAX_LEN);
discovery->name_len = strlen(discovery->nickname);

@@ -557,7 +557,7 @@
* Build and transmit RR (Receive Ready) frame. Notice that it is currently
* only possible to send RR frames with the poll bit set.
*/
-void irlap_send_rr_frame(struct irlap_cb *self, int command)
+void irlap_send_rr_frame(struct irlap_cb *self, int command)
{
struct sk_buff *skb;
__u8 *frame;
@@ -565,9 +565,9 @@
skb = dev_alloc_skb(16);
if (!skb)
return;
-
+
frame = skb_put(skb, 2);
-
+
frame[0] = self->caddr;
frame[0] |= (command) ? CMD_FRAME : 0;

@@ -579,7 +579,7 @@
/*
* Function irlap_send_rd_frame (self)
*
- * Request disconnect. Used by a secondary station to request the
+ * Request disconnect. Used by a secondary station to request the
* disconnection of the link.
*/
void irlap_send_rd_frame(struct irlap_cb *self)
@@ -590,9 +590,9 @@
skb = dev_alloc_skb(16);
if (!skb)
return;
-
+
frame = skb_put(skb, 2);
-
+
frame[0] = self->caddr;
frame[1] = RD_RSP | PF_BIT;

@@ -606,8 +606,8 @@
* making it inline since its called only from one single place
* (irlap_driver_rcv).
*/
-static inline void irlap_recv_rr_frame(struct irlap_cb *self,
- struct sk_buff *skb,
+static inline void irlap_recv_rr_frame(struct irlap_cb *self,
+ struct sk_buff *skb,
struct irlap_info *info, int command)
{
info->nr = skb->data[1] >> 5;
@@ -623,7 +623,7 @@
{
struct sk_buff *skb = NULL;
__u8 *frame;
-
+
ASSERT( self != NULL, return;);
ASSERT( self->magic == LAP_MAGIC, return;);

@@ -632,7 +632,7 @@
return;

frame = skb_put( skb, 2);
-
+
frame[0] = self->caddr;
frame[0] |= (command) ? CMD_FRAME : 0;

@@ -642,7 +642,7 @@

frame[2] = 0;

- IRDA_DEBUG(4, __FUNCTION__ "(), vr=%d, %ld\n",self->vr, jiffies);
+ IRDA_DEBUG(4, __FUNCTION__ "(), vr=%d, %ld\n",self->vr, jiffies);

irlap_queue_xmit(self, skb);
}
@@ -653,8 +653,8 @@
* Received RNR (Receive Not Ready) frame from peer station
*
*/
-static void irlap_recv_rnr_frame(struct irlap_cb *self, struct sk_buff *skb,
- struct irlap_info *info, int command)
+static void irlap_recv_rnr_frame(struct irlap_cb *self, struct sk_buff *skb,
+ struct irlap_info *info, int command)
{
info->nr = skb->data[1] >> 5;

@@ -666,13 +666,13 @@
irlap_do_event(self, RECV_RNR_RSP, skb, info);
}

-static void irlap_recv_rej_frame(struct irlap_cb *self, struct sk_buff *skb,
+static void irlap_recv_rej_frame(struct irlap_cb *self, struct sk_buff *skb,
struct irlap_info *info, int command)
{
IRDA_DEBUG(0, __FUNCTION__ "()\n");

info->nr = skb->data[1] >> 5;
-
+
/* Check if this is a command or a response frame */
if (command)
irlap_do_event(self, RECV_REJ_CMD, skb, info);
@@ -680,13 +680,13 @@
irlap_do_event(self, RECV_REJ_RSP, skb, info);
}

-static void irlap_recv_srej_frame(struct irlap_cb *self, struct sk_buff *skb,
+static void irlap_recv_srej_frame(struct irlap_cb *self, struct sk_buff *skb,
struct irlap_info *info, int command)
{
IRDA_DEBUG(0, __FUNCTION__ "()\n");

info->nr = skb->data[1] >> 5;
-
+
/* Check if this is a command or a response frame */
if (command)
irlap_do_event(self, RECV_SREJ_CMD, skb, info);
@@ -694,7 +694,7 @@
irlap_do_event(self, RECV_SREJ_RSP, skb, info);
}

-static void irlap_recv_disc_frame(struct irlap_cb *self, struct sk_buff *skb,
+static void irlap_recv_disc_frame(struct irlap_cb *self, struct sk_buff *skb,
struct irlap_info *info, int command)
{
IRDA_DEBUG(2, __FUNCTION__ "()\n");
@@ -712,9 +712,9 @@
* Received UA (Unnumbered Acknowledgement) frame
*
*/
-static inline void irlap_recv_ua_frame(struct irlap_cb *self,
- struct sk_buff *skb,
- struct irlap_info *info)
+static inline void irlap_recv_ua_frame(struct irlap_cb *self,
+ struct sk_buff *skb,
+ struct irlap_info *info)
{
irlap_do_event(self, RECV_UA_RSP, skb, info);
}
@@ -731,25 +731,25 @@

if (skb->data[1] == I_FRAME) {

- /*
+ /*
* Insert frame sequence number (Vs) in control field before
* inserting into transmit window queue.
*/
skb->data[1] = I_FRAME | (self->vs << 1);
-
+
/* Copy buffer */
tx_skb = skb_clone(skb, GFP_ATOMIC);
if (tx_skb == NULL) {
return;
}
-
- /*
- * Insert frame in store, in case of retransmissions
+
+ /*
+ * Insert frame in store, in case of retransmissions
*/
skb_queue_tail(&self->wx_list, skb_get(skb));
-
+
self->vs = (self->vs + 1) % 8;
- self->ack_required = FALSE;
+ self->ack_required = FALSE;
self->window -= 1;

irlap_send_i_frame( self, tx_skb, CMD_FRAME);
@@ -764,40 +764,40 @@
*
* Send I(nformation) frame as primary with poll bit set
*/
-void irlap_send_data_primary_poll(struct irlap_cb *self, struct sk_buff *skb)
+void irlap_send_data_primary_poll(struct irlap_cb *self, struct sk_buff *skb)
{
struct sk_buff *tx_skb;

/* Stop P timer */
del_timer(&self->poll_timer);
-
+
/* Is this reliable or unreliable data? */
if (skb->data[1] == I_FRAME) {
-
- /*
+
+ /*
* Insert frame sequence number (Vs) in control field before
* inserting into transmit window queue.
*/
skb->data[1] = I_FRAME | (self->vs << 1);
-
+
/* Copy buffer */
tx_skb = skb_clone(skb, GFP_ATOMIC);
if (tx_skb == NULL) {
return;
}
-
- /*
- * Insert frame in store, in case of retransmissions
+
+ /*
+ * Insert frame in store, in case of retransmissions
*/
skb_queue_tail(&self->wx_list, skb_get(skb));
-
- /*
+
+ /*
* Set poll bit if necessary. We do this to the copied
* skb, since retransmitted need to set or clear the poll
- * bit depending on when they are sent.
+ * bit depending on when they are sent.
*/
tx_skb->data[1] |= PF_BIT;
-
+
self->vs = (self->vs + 1) % 8;
self->ack_required = FALSE;

@@ -830,8 +830,8 @@
* Send I(nformation) frame as secondary with final bit set
*
*/
-void irlap_send_data_secondary_final(struct irlap_cb *self,
- struct sk_buff *skb)
+void irlap_send_data_secondary_final(struct irlap_cb *self,
+ struct sk_buff *skb)
{
struct sk_buff *tx_skb = NULL;

@@ -842,26 +842,26 @@
/* Is this reliable or unreliable data? */
if (skb->data[1] == I_FRAME) {

- /*
+ /*
* Insert frame sequence number (Vs) in control field before
* inserting into transmit window queue.
*/
skb->data[1] = I_FRAME | (self->vs << 1);
-
+
tx_skb = skb_clone(skb, GFP_ATOMIC);
if (tx_skb == NULL) {
return;
- }
+ }

/* Insert frame in store */
skb_queue_tail(&self->wx_list, skb_get(skb));
-
+
tx_skb->data[1] |= PF_BIT;
-
- self->vs = (self->vs + 1) % 8;
+
+ self->vs = (self->vs + 1) % 8;
self->ack_required = FALSE;
-
- irlap_send_i_frame(self, tx_skb, RSP_FRAME);
+
+ irlap_send_i_frame(self, tx_skb, RSP_FRAME);
} else {
if (self->ack_required) {
irlap_send_ui_frame(self, skb_get(skb), self->caddr, RSP_FRAME);
@@ -888,32 +888,32 @@
* Send I(nformation) frame as secondary without final bit set
*
*/
-void irlap_send_data_secondary(struct irlap_cb *self, struct sk_buff *skb)
+void irlap_send_data_secondary(struct irlap_cb *self, struct sk_buff *skb)
{
struct sk_buff *tx_skb = NULL;

/* Is this reliable or unreliable data? */
if (skb->data[1] == I_FRAME) {
-
- /*
+
+ /*
* Insert frame sequence number (Vs) in control field before
* inserting into transmit window queue.
*/
skb->data[1] = I_FRAME | (self->vs << 1);
-
+
tx_skb = skb_clone(skb, GFP_ATOMIC);
if (tx_skb == NULL) {
return;
- }
-
+ }
+
/* Insert frame in store */
skb_queue_tail(&self->wx_list, skb_get(skb));
-
+
self->vs = (self->vs + 1) % 8;
- self->ack_required = FALSE;
+ self->ack_required = FALSE;
self->window -= 1;

- irlap_send_i_frame(self, tx_skb, RSP_FRAME);
+ irlap_send_i_frame(self, tx_skb, RSP_FRAME);
} else {
irlap_send_ui_frame(self, skb_get(skb), self->caddr, RSP_FRAME);
self->window -= 1;
@@ -923,8 +923,8 @@
/*
* Function irlap_resend_rejected_frames (nr)
*
- * Resend frames which has not been acknowledged. Should be safe to
- * traverse the list without locking it since this function will only be
+ * Resend frames which has not been acknowledged. Should be safe to
+ * traverse the list without locking it since this function will only be
* called from interrupt context (BH)
*/
void irlap_resend_rejected_frames(struct irlap_cb *self, int command)
@@ -946,8 +946,8 @@
while (skb != NULL) {
irlap_wait_min_turn_around(self, &self->qos_tx);

- /* We copy the skb to be retransmitted since we will have to
- * modify it. Cloning will confuse packet sniffers
+ /* We copy the skb to be retransmitted since we will have to
+ * modify it. Cloning will confuse packet sniffers
*/
/* tx_skb = skb_clone( skb, GFP_ATOMIC); */
tx_skb = skb_copy(skb, GFP_ATOMIC);
@@ -962,17 +962,17 @@
/* Clear old Nr field + poll bit */
tx_skb->data[1] &= 0x0f;

- /*
+ /*
* Set poll bit on the last frame retransmitted
*/
- if (count-- == 1)
- tx_skb->data[1] |= PF_BIT; /* Set p/f bit */
+ if (count-- == 1)
+ tx_skb->data[1] |= PF_BIT; /* Set p/f bit */
else
tx_skb->data[1] &= ~PF_BIT; /* Clear p/f bit */
-
+
irlap_send_i_frame(self, tx_skb, command);

- /*
+ /*
* If our skb is the last buffer in the list, then
* we are finished, if not, move to the next sk-buffer
*/
@@ -982,23 +982,23 @@
skb = skb->next;
}
#if 0 /* Not yet */
- /*
+ /*
* We can now fill the window with additinal data frames
*/
while (skb_queue_len( &self->txq) > 0) {
-
+
IRDA_DEBUG(0, __FUNCTION__ "(), sending additional frames!\n");
- if ((skb_queue_len( &self->txq) > 0) &&
+ if ((skb_queue_len( &self->txq) > 0) &&
(self->window > 0)) {
- skb = skb_dequeue( &self->txq);
+ skb = skb_dequeue( &self->txq);
ASSERT(skb != NULL, return;);

/*
- * If send window > 1 then send frame with pf
+ * If send window > 1 then send frame with pf
* bit cleared
- */
- if ((self->window > 1) &&
- skb_queue_len(&self->txq) > 0)
+ */
+ if ((self->window > 1) &&
+ skb_queue_len(&self->txq) > 0)
{
irlap_send_data_primary(self, skb);
} else {
@@ -1026,14 +1026,14 @@
if (skb != NULL) {
irlap_wait_min_turn_around(self, &self->qos_tx);

- /* We copy the skb to be retransmitted since we will have to
- * modify it. Cloning will confuse packet sniffers
+ /* We copy the skb to be retransmitted since we will have to
+ * modify it. Cloning will confuse packet sniffers
*/
/* tx_skb = skb_clone( skb, GFP_ATOMIC); */
tx_skb = skb_copy(skb, GFP_ATOMIC);
if (!tx_skb) {
IRDA_DEBUG(0, __FUNCTION__ "(), unable to copy\n");
- return;
+ return;
}
/* Unlink tx_skb from list */
tx_skb->next = tx_skb->prev = NULL;
@@ -1044,7 +1044,7 @@

/* Set poll/final bit */
tx_skb->data[1] |= PF_BIT; /* Set p/f bit */
-
+
irlap_send_i_frame(self, tx_skb, command);
}
}
@@ -1055,15 +1055,15 @@
* Contruct and transmit an Unnumbered Information (UI) frame
*
*/
-void irlap_send_ui_frame(struct irlap_cb *self, struct sk_buff *skb,
+void irlap_send_ui_frame(struct irlap_cb *self, struct sk_buff *skb,
__u8 caddr, int command)
{
IRDA_DEBUG(4, __FUNCTION__ "()\n");
-
+
ASSERT(self != NULL, return;);
ASSERT(self->magic == LAP_MAGIC, return;);
ASSERT(skb != NULL, return;);
-
+
/* Insert connection address */
skb->data[0] = caddr | ((command) ? CMD_FRAME : 0);

@@ -1075,13 +1075,13 @@
*
* Contruct and transmit Information (I) frame
*/
-void irlap_send_i_frame(struct irlap_cb *self, struct sk_buff *skb,
- int command)
+void irlap_send_i_frame(struct irlap_cb *self, struct sk_buff *skb,
+ int command)
{
/* Insert connection address */
skb->data[0] = self->caddr;
skb->data[0] |= (command) ? CMD_FRAME : 0;
-
+
/* Insert next to receive (Vr) */
skb->data[1] |= (self->vr << 5); /* insert nr */

@@ -1094,9 +1094,9 @@
* Receive and parse an I (Information) frame, no harm in making it inline
* since it's called only from one single place (irlap_driver_rcv).
*/
-static inline void irlap_recv_i_frame(struct irlap_cb *self,
- struct sk_buff *skb,
- struct irlap_info *info, int command)
+static inline void irlap_recv_i_frame(struct irlap_cb *self,
+ struct sk_buff *skb,
+ struct irlap_info *info, int command)
{
info->nr = skb->data[1] >> 5; /* Next to receive */
info->pf = skb->data[1] & PF_BIT; /* Final bit */
@@ -1115,7 +1115,7 @@
* Receive and parse an Unnumbered Information (UI) frame
*
*/
-static void irlap_recv_ui_frame(struct irlap_cb *self, struct sk_buff *skb,
+static void irlap_recv_ui_frame(struct irlap_cb *self, struct sk_buff *skb,
struct irlap_info *info)
{
IRDA_DEBUG( 4, __FUNCTION__ "()\n");
@@ -1131,19 +1131,19 @@
* Received Frame Reject response.
*
*/
-static void irlap_recv_frmr_frame(struct irlap_cb *self, struct sk_buff *skb,
- struct irlap_info *info)
+static void irlap_recv_frmr_frame(struct irlap_cb *self, struct sk_buff *skb,
+ struct irlap_info *info)
{
__u8 *frame;
int w, x, y, z;

IRDA_DEBUG(0, __FUNCTION__ "()\n");
-
+
ASSERT(self != NULL, return;);
ASSERT(self->magic == LAP_MAGIC, return;);
ASSERT(skb != NULL, return;);
ASSERT(info != NULL, return;);
-
+
frame = skb->data;

info->nr = frame[2] >> 5; /* Next to receive */
@@ -1154,11 +1154,11 @@
x = frame[3] & 0x02;
y = frame[3] & 0x04;
z = frame[3] & 0x08;
-
+
if (w) {
IRDA_DEBUG(0, "Rejected control field is undefined or not "
"implemented.\n");
- }
+ }
if (x) {
IRDA_DEBUG(0, "Rejected control field was invalid because it "
"contained a non permitted I field.\n");
@@ -1181,7 +1181,7 @@
* Send a test frame response
*
*/
-void irlap_send_test_frame(struct irlap_cb *self, __u8 caddr, __u32 daddr,
+void irlap_send_test_frame(struct irlap_cb *self, __u8 caddr, __u32 daddr,
struct sk_buff *cmd)
{
struct sk_buff *skb;
@@ -1194,7 +1194,7 @@

/* Broadcast frames must include saddr and daddr fields */
if (caddr == CBROADCAST) {
- frame = (struct test_frame *)
+ frame = (struct test_frame *)
skb_put(skb, sizeof(struct test_frame));

/* Insert the swapped addresses */
@@ -1221,29 +1221,29 @@
* Receive a test frame
*
*/
-static void irlap_recv_test_frame(struct irlap_cb *self, struct sk_buff *skb,
+static void irlap_recv_test_frame(struct irlap_cb *self, struct sk_buff *skb,
struct irlap_info *info, int command)
{
struct test_frame *frame;

IRDA_DEBUG(2, __FUNCTION__ "()\n");
-
+
frame = (struct test_frame *) skb->data;
-
+
/* Broadcast frames must carry saddr and daddr fields */
if (info->caddr == CBROADCAST) {
if (skb->len < sizeof(struct test_frame)) {
- IRDA_DEBUG(0, __FUNCTION__
+ IRDA_DEBUG(0, __FUNCTION__
"() test frame to short!\n");
return;
}
-
+
/* Read and swap addresses */
info->daddr = le32_to_cpu(frame->saddr);
info->saddr = le32_to_cpu(frame->daddr);

/* Make sure frame is addressed to us */
- if ((info->saddr != self->saddr) &&
+ if ((info->saddr != self->saddr) &&
(info->saddr != BROADCAST)) {
return;
}
@@ -1258,18 +1258,18 @@
/*
* Function irlap_driver_rcv (skb, netdev, ptype)
*
- * Called when a frame is received. Dispatches the right receive function
+ * Called when a frame is received. Dispatches the right receive function
* for processing of the frame.
*
*/
-int irlap_driver_rcv(struct sk_buff *skb, struct net_device *dev,
+int irlap_driver_rcv(struct sk_buff *skb, struct net_device *dev,
struct packet_type *ptype)
{
struct irlap_info info;
struct irlap_cb *self;
int command;
__u8 control;
-
+
/* FIXME: should we get our own field? */
self = (struct irlap_cb *) dev->atalk_ptr;

@@ -1281,14 +1281,14 @@

/* Check if frame is large enough for parsing */
if (skb->len < 2) {
- ERROR(__FUNCTION__ "(), frame to short!\n");
+ ERROR("%s: frame to short!\n", __FUNCTION__);
dev_kfree_skb(skb);
return -1;
}
-
+
command = skb->data[0] & CMD_FRAME;
info.caddr = skb->data[0] & CBROADCAST;
-
+
info.pf = skb->data[1] & PF_BIT;
info.control = skb->data[1] & ~PF_BIT; /* Mask away poll/final bit */

@@ -1299,7 +1299,7 @@
IRDA_DEBUG(0, __FUNCTION__ "(), wrong connection address!\n");
goto out;
}
- /*
+ /*
* Optimize for the common case and check if the frame is an
* I(nformation) frame. Only I-frames have bit 0 set to 0
*/
@@ -1308,11 +1308,11 @@
goto out;
}
/*
- * We now check is the frame is an S(upervisory) frame. Only
+ * We now check is the frame is an S(upervisory) frame. Only
* S-frames have bit 0 set to 1 and bit 1 set to 0
*/
if (~control & 0x02) {
- /*
+ /*
* Received S(upervisory) frame, check which frame type it is
* only the first nibble is of interest
*/
@@ -1330,15 +1330,14 @@
irlap_recv_srej_frame(self, skb, &info, command);
break;
default:
- WARNING(__FUNCTION__
- "() Unknown S-frame %02x received!\n",
- info.control);
+ WARNING("%s: Unknown S-frame %02x received!\n",
+ __FUNCTION__, info.control);
break;
}
goto out;
}
- /*
- * This must be a C(ontrol) frame
+ /*
+ * This must be a C(ontrol) frame
*/
switch (control) {
case XID_RSP:
@@ -1369,11 +1368,11 @@
irlap_recv_ui_frame(self, skb, &info);
break;
default:
- WARNING(__FUNCTION__ "(), Unknown frame %02x received!\n",
- info.control);
+ WARNING("%s: Unknown frame %02x received!\n",
+ __FUNCTION__, info.control);
break;
}
out:
- dev_kfree_skb(skb);
+ dev_kfree_skb(skb);
return 0;
}


Attachments:
warn-2.5.21-14.diff (29.17 kB)

2002-06-10 13:04:37

by Anton Altaparmakov

[permalink] [raw]
Subject: Re: [PATCH] 2.5.21 "I can't get no compilation"

At 12:54 10/06/02, Martin Dalecki wrote:
>Anton Altaparmakov wrote:
>>At 12:19 10/06/02, Martin Dalecki wrote:
>>
>>>The subject says it all...
>>>
>>>Contrary to other proposed patches I realized that there is
>>>no such thing as vmalloc_dma.
>>
>>Perhaps you ought to look in mm/vmalloc.c which contains:
>>void * vmalloc_dma (unsigned long size)
>>{
>> return __vmalloc(size, GFP_KERNEL|GFP_DMA, PAGE_KERNEL);
>>}
>>Or are you going to tell me that is a figment of my imagination?
>
>Oh I have missed the chunk which delets it there apparently, since
>*nobody* is using this.

It could be used by out of kernel tree code. (Note I don't know any code
that does...)

>The only place where a special
>__vmalloc setup code is used in nfs which GFP_NOFS flag added,
>but not the above. so providing vmalloc_nofs would make more
>sense then vmalloc_dma.

NTFS defines its own vmalloc_nofs (fs/ntfs/malloc.h) so if you intend to
add a generic vmalloc_nofs, please remove the ntfs one (or ntfs will break)...

btw. the ntfs definition is:

static inline void *vmalloc_nofs(unsigned long size)
{
if (likely(size >> PAGE_SHIFT < num_physpages)
return __vmalloc(size, GFP_NOFS | __GFP_HIGHMEM, PAGE_KERNEL);
return NULL;
}

Best regards,

Anton


--
"I've not lost my mind. It's backed up on tape somewhere." - Unknown
--
Anton Altaparmakov <aia21 at cantab.net> (replace at with @)
Linux NTFS Maintainer / IRC: #ntfs on irc.openprojects.net
WWW: http://linux-ntfs.sf.net/ & http://www-stu.christs.cam.ac.uk/~aia21/

2002-06-10 18:47:24

by Max Krasnyansky

[permalink] [raw]
Subject: Re: [PATCH] 2.5.21 kill warnings 4/19

Hi Martin,

How about replacing __FUNCTION__ with __func__ ?
GCC 3.x warns that __FUNCTION__ is obsolete and will be removed.
Here is how I did it in Bluetooth code:
#define BT_DBG(fmt, arg...) printk(KERN_INFO "%s: " fmt "\n" ,
__func__ , ## arg)
no more warnings from gcc.

Max

>Fix improper usage of __FUNCTION__ in usb code.
>Fix unpleasant results from some code formatting
>editor (propably emacs) in i2c, which broke
>an error message altogether.

2002-06-10 18:57:48

by Thomas 'Dent' Mirlacher

[permalink] [raw]
Subject: Re: [PATCH] 2.5.21 kill warnings 4/19

On Mon, 10 Jun 2002, Maksim (Max) Krasnyanskiy wrote:

> Hi Martin,
>
> How about replacing __FUNCTION__ with __func__ ?
> GCC 3.x warns that __FUNCTION__ is obsolete and will be removed.

is __func__ already supported for gcc 2.96?

and what about C99 style named initializers for structs?

struct blah = {
.open = driver_open
};

tm

--
in some way i do, and in some way i don't.

2002-06-10 19:08:14

by Roland Dreier

[permalink] [raw]
Subject: Re: [PATCH] 2.5.21 kill warnings 4/19

>>>>> "Thomas" == Thomas Mirlacher <Thomas> writes:

Thomas> and what about C99 style named initializers for structs?

Thomas> struct blah = { .open = driver_open };

C99 named initializers were already supported at least as early as gcc
2.95.2

Best,
Roland


2002-06-10 19:14:39

by Thomas 'Dent' Mirlacher

[permalink] [raw]
Subject: Re: [PATCH] 2.5.21 kill warnings 4/19

thanks roland ...

On 10 Jun 2002, Roland Dreier wrote:

> >>>>> "Thomas" == Thomas Mirlacher <Thomas> writes:
>
> Thomas> and what about C99 style named initializers for structs?
>
> Thomas> struct blah = { .open = driver_open };
>
> C99 named initializers were already supported at least as early as gcc
> 2.95.2

good. which means we can switch over to those for future patches.

tm

--
in some way i do, and in some way i don't.

2002-06-10 19:21:37

by Tom Rini

[permalink] [raw]
Subject: Re: [PATCH] 2.5.21 kill warnings 4/19

On Mon, Jun 10, 2002 at 08:57:02PM +0200, Thomas 'Dent' Mirlacher wrote:
> On Mon, 10 Jun 2002, Maksim (Max) Krasnyanskiy wrote:
>
> > Hi Martin,
> >
> > How about replacing __FUNCTION__ with __func__ ?
> > GCC 3.x warns that __FUNCTION__ is obsolete and will be removed.
>
> is __func__ already supported for gcc 2.96?

Well it works with 2.95.3, which is the important part...

--
Tom Rini (TR1265)
http://gate.crashing.org/~trini/

2002-06-10 19:32:07

by Andrew Morton

[permalink] [raw]
Subject: Re: [PATCH] 2.5.21 kill warnings 4/19

Tom Rini wrote:
>
> On Mon, Jun 10, 2002 at 08:57:02PM +0200, Thomas 'Dent' Mirlacher wrote:
> > On Mon, 10 Jun 2002, Maksim (Max) Krasnyanskiy wrote:
> >
> > > Hi Martin,
> > >
> > > How about replacing __FUNCTION__ with __func__ ?
> > > GCC 3.x warns that __FUNCTION__ is obsolete and will be removed.
> >
> > is __func__ already supported for gcc 2.96?
>
> Well it works with 2.95.3, which is the important part...

The 2.5 kernel must be buildable on gcc-2.91.66, aka egcs-1.1.2.

The 2.95.x requirement was reverted because sparc (or sparc64?)
needs egcs-1.1.2.

__func__ does *not* work on egcs-1.1.2 and so cannot be used in Linux.

`struct blah = { .open = driver_open };' *does* work in egcs-1.1.2
and is OK to use.

-

2002-06-10 19:44:46

by Tom Rini

[permalink] [raw]
Subject: Re: [PATCH] 2.5.21 kill warnings 4/19

On Mon, Jun 10, 2002 at 12:30:44PM -0700, Andrew Morton wrote:
> Tom Rini wrote:
> >
> > On Mon, Jun 10, 2002 at 08:57:02PM +0200, Thomas 'Dent' Mirlacher wrote:
> > > On Mon, 10 Jun 2002, Maksim (Max) Krasnyanskiy wrote:
> > >
> > > > Hi Martin,
> > > >
> > > > How about replacing __FUNCTION__ with __func__ ?
> > > > GCC 3.x warns that __FUNCTION__ is obsolete and will be removed.
> > >
> > > is __func__ already supported for gcc 2.96?
> >
> > Well it works with 2.95.3, which is the important part...
>
> The 2.5 kernel must be buildable on gcc-2.91.66, aka egcs-1.1.2.
>
> The 2.95.x requirement was reverted because sparc (or sparc64?)
> needs egcs-1.1.2.
>
> __func__ does *not* work on egcs-1.1.2 and so cannot be used in Linux.
>
> `struct blah = { .open = driver_open };' *does* work in egcs-1.1.2
> and is OK to use.

This reminds me of another slightly annoying issue. At least for
toolchains, Documentation/Changes works poorly for !i386. How about we
try and take care of things like this in <linux/compiler.h> ?
Eg:

#if defined(CONFIG_SPARC) || defined(CONFIG_SPARC64)
... egcs 1.1.2 check ...

#define __func__ __FUNCTION__
#endif

#if defined(CONFIG_X86) || ...
... gcc-2.95.3 check ...
#endif

Or not, I'm not really sure..

--
Tom Rini (TR1265)
http://gate.crashing.org/~trini/

2002-06-10 19:46:05

by Thunder from the hill

[permalink] [raw]
Subject: Re: [PATCH] 2.5.21 kill warnings 4/19

Hi,

On Mon, 10 Jun 2002, Andrew Morton wrote:
> __func__ does *not* work on egcs-1.1.2 and so cannot be used in Linux.
>
> `struct blah = { .open = driver_open };' *does* work in egcs-1.1.2
> and is OK to use.

Gee. I guess we need a special host gcc to support our needs - on
sparc(|64). We might have a patch that easily renames it in the sources of
egcs...

Anyway, what is the problem about new gcc on old sparc? It works at least
on my sparc64, I can't complain.

Regards,
Thunder
--
German attitude becoming | Thunder from the hill at ngforever
rightaway popular: |
"Get outa my way, | free inhabitant not directly
for I got a mobile phone!" | belonging anywhere

2002-06-10 19:53:09

by Andrew Morton

[permalink] [raw]
Subject: Re: [PATCH] 2.5.21 kill warnings 4/19

Tom Rini wrote:
>
> ...
> This reminds me of another slightly annoying issue. At least for
> toolchains, Documentation/Changes works poorly for !i386. How about we
> try and take care of things like this in <linux/compiler.h> ?
> Eg:
>
> #if defined(CONFIG_SPARC) || defined(CONFIG_SPARC64)
> ... egcs 1.1.2 check ...
>
> #define __func__ __FUNCTION__
> #endif
>
> #if defined(CONFIG_X86) || ...
> ... gcc-2.95.3 check ...
> #endif
>

That won't work very well - if SPARC wants 2.91.66 then
we need to support that compiler on x86 as well. So that
people won't use later-supported compiler features. And
because many compiler bugs are platform-independent, so
they will be detected (and worked around) on x86.

wrt the __func__ thing: is it possible to do:

#if (compiler version test)
#define __FUNCTION__ __func__
#endif

to kill the 3.x warning?

-

2002-06-10 20:01:55

by Andrew Morton

[permalink] [raw]
Subject: Re: [PATCH] 2.5.21 kill warnings 4/19

Thunder from the hill wrote:
>
> Hi,
>
> On Mon, 10 Jun 2002, Andrew Morton wrote:
> > __func__ does *not* work on egcs-1.1.2 and so cannot be used in Linux.
> >
> > `struct blah = { .open = driver_open };' *does* work in egcs-1.1.2
> > and is OK to use.
>
> Gee. I guess we need a special host gcc to support our needs - on
> sparc(|64). We might have a patch that easily renames it in the sources of
> egcs...

?

> Anyway, what is the problem about new gcc on old sparc? It works at least
> on my sparc64, I can't complain.

I don't know - we need to find a davem to answer that question.

egcs-1.1.2 has a problem with the percpu infrastructure - it
fails to put the right things in the right sections. The
workaround for that is to ensure that the percpu data structures
are always initialised at the definition site:

/* Some compilers disobey section attribute on statics when not
initialized -- RR */
static struct tasklet_head tasklet_vec __per_cpu_data = { NULL };
static struct tasklet_head tasklet_hi_vec __per_cpu_data = { NULL };

Note the (otherwise unneeded) `= { NULL }'. The result of getting
this wrong is a nasty and subtly-dead kernel.

It's not a very happy state of affairs. I'll be using
2.91.66 on x86 from now on, so any problems (in the stuff
which I build and test) will be picked up.

-

2002-06-10 20:03:51

by Thunder from the hill

[permalink] [raw]
Subject: Re: [PATCH] 2.5.21 kill warnings 4/19

Hi,

On Mon, 10 Jun 2002, Andrew Morton wrote:
> wrt the __func__ thing: is it possible to do:
>
> #if (compiler version test)
> #define __FUNCTION__ __func__
> #endif
>
> to kill the 3.x warning?

#include <stdio.h>
#define __FUNCTION__ __func__

int main(int argc, char **argv) {
int i;

for (i = 0; i < argc; i++) {
printf(__FUNCTION__ " encountered argument ");
printf("%s\n", argv[i]);
}

exit(0);
}

Obviously, yes.

Regards,
Thunder
--
German attitude becoming | Thunder from the hill at ngforever
rightaway popular: |
"Get outa my way, | free inhabitant not directly
for I got a mobile phone!" | belonging anywhere

2002-06-10 20:05:58

by Tom Rini

[permalink] [raw]
Subject: Re: [PATCH] 2.5.21 kill warnings 4/19

On Mon, Jun 10, 2002 at 12:51:44PM -0700, Andrew Morton wrote:
> Tom Rini wrote:
> >
> > ...
> > This reminds me of another slightly annoying issue. At least for
> > toolchains, Documentation/Changes works poorly for !i386. How about we
> > try and take care of things like this in <linux/compiler.h> ?
> > Eg:
> >
> > #if defined(CONFIG_SPARC) || defined(CONFIG_SPARC64)
> > ... egcs 1.1.2 check ...
> >
> > #define __func__ __FUNCTION__
> > #endif
> >
> > #if defined(CONFIG_X86) || ...
> > ... gcc-2.95.3 check ...
> > #endif
> >
>
> That won't work very well - if SPARC wants 2.91.66 then
> we need to support that compiler on x86 as well. So that
> people won't use later-supported compiler features. And
> because many compiler bugs are platform-independent, so
> they will be detected (and worked around) on x86.

Well, didn't someone just find a bug where egcs-1.1.2 falls down on x86
in an important area?

> wrt the __func__ thing: is it possible to do:
>
> #if (compiler version test)
> #define __FUNCTION__ __func__
> #endif
>
> to kill the 3.x warning?

Well, the warning (at least from what I've seen) is when you do:
"In " __FUNCTION__ " something bad happened\n", which __func__ just
won't do. Doing:
"In %s something bad happened\n", __FUNCTION__
Is OK[1].

--
Tom Rini (TR1265)
http://gate.crashing.org/~trini/

[1]: gcc version 3.1.1 20020606 (Debian prerelease), just a simple
program with -Wall.

2002-06-10 20:08:31

by Tom Rini

[permalink] [raw]
Subject: Re: [PATCH] 2.5.21 kill warnings 4/19

On Mon, Jun 10, 2002 at 02:03:42PM -0600, Thunder from the hill wrote:
> Hi,
>
> On Mon, 10 Jun 2002, Andrew Morton wrote:
> > wrt the __func__ thing: is it possible to do:
> >
> > #if (compiler version test)
> > #define __FUNCTION__ __func__
> > #endif
> >
> > to kill the 3.x warning?
>
> #include <stdio.h>
> #define __FUNCTION__ __func__
>
> int main(int argc, char **argv) {
> int i;
>
> for (i = 0; i < argc; i++) {
> printf(__FUNCTION__ " encountered argument ");
> printf("%s\n", argv[i]);
> }
>
> exit(0);
> }
>
> Obviously, yes.

Nope.
$ gcc-3.1 -Wall -o foo foo.c
foo.c: In function `main':
foo.c:8: parse error before string constant

And line 8 is:
printf(__FUNCTION__ " encountered argument ");

--
Tom Rini (TR1265)
http://gate.crashing.org/~trini/

2002-06-10 20:10:29

by Thunder from the hill

[permalink] [raw]
Subject: Re: [PATCH] 2.5.21 kill warnings 4/19

Hi,

On Mon, 10 Jun 2002, Thunder from the hill wrote:
> #define __FUNCTION__ __func__

Hmmm... that's just logical. If they just remove the __FUNCTION__
constant, there's nothing to complain about if we redefine it. Even my
chaos brain sees that.

Regards,
Thunder
--
German attitude becoming | Thunder from the hill at ngforever
rightaway popular: |
"Get outa my way, | free inhabitant not directly
for I got a mobile phone!" | belonging anywhere

2002-06-10 20:20:29

by Thomas 'Dent' Mirlacher

[permalink] [raw]
Subject: Re: [PATCH] 2.5.21 kill warnings 4/19

--snip/snip
> > to kill the 3.x warning?
>
> Well, the warning (at least from what I've seen) is when you do:
> "In " __FUNCTION__ " something bad happened\n", which __func__ just
> won't do. Doing:
> "In %s something bad happened\n", __FUNCTION__
> Is OK[1].

from gcc3/Function-Names:
--------------
Note that these semantics are deprecated, and that GCC 3.2 will handle __FUNCTION__ and __PRETTY_FUNCTION__ the same way as __func__.

__func__ is defined by the ISO standard C99:

The identifier __func__ is implicitly declared by the translator
as if, immediately following the opening brace of each function
definition, the declaration

static const char __func__[] = "function-name";

appeared, where function-name is the name of the lexically-enclosing
function. This name is the unadorned name of the function.

By this definition, __func__ is a variable, not a string literal. In particular, __func__ does not catenate with other string literals.
--------------

which means, __FUNCTION__ will still be supported (gcc3.2), you just cannot
catenate it as it was the case before.

so Toms snipplet above should be ok for all versions of gcc which are
recommended today, and will also work with gcc3.2

tm

--
in some way i do, and in some way i don't.

2002-06-10 20:17:26

by Andrew Morton

[permalink] [raw]
Subject: Re: [PATCH] 2.5.21 kill warnings 4/19

Tom Rini wrote:
>
> ...
> Nope.
> $ gcc-3.1 -Wall -o foo foo.c
> foo.c: In function `main':
> foo.c:8: parse error before string constant
>
> And line 8 is:
> printf(__FUNCTION__ " encountered argument ");

That's OK. We need to convert all those to

printf("%s encountered argument ", __FUNCTION__);

anyway. That seems to be happening pretty quickly.

-

2002-06-10 21:04:09

by Max Krasnyansky

[permalink] [raw]
Subject: Re: [PATCH] 2.5.21 kill warnings 4/19


> > > wrt the __func__ thing: is it possible to do:
> > >
> > > #if (compiler version test)
> > > #define __FUNCTION__ __func__
> > > #endif
> > >
> > > to kill the 3.x warning?
> >
> > #include <stdio.h>
> > #define __FUNCTION__ __func__
> >
> > int main(int argc, char **argv) {
> > int i;
> >
> > for (i = 0; i < argc; i++) {
> > printf(__FUNCTION__ " encountered argument ");
> > printf("%s\n", argv[i]);
> > }
> >
> > exit(0);
> > }
> >
> > Obviously, yes.
>
>Nope.
>$ gcc-3.1 -Wall -o foo foo.c
>foo.c: In function `main':
>foo.c:8: parse error before string constant
>
>And line 8 is:
>printf(__FUNCTION__ " encountered argument ");

Well, those will brake. But in general it's possible. And I already do that
in Bluetooth code (it's been converted recently).

So

#if __GNUC__ <= 2 && __GNUC_MINOR__ < 95
#define __func__ __FUNCTION__
#endif

does the trick. All gcc's newer than 2.95 support __func__.

Bluetooth code compiles just fine with everything from:
ultrablue:/#sparc64-linux-gcc --version
egcs-2.92.11
to
champ:/usr/src/linux/include/net/bluetooth#gcc --version
gcc (GCC) 3.1

Max

2002-06-10 20:22:41

by Tom Rini

[permalink] [raw]
Subject: Re: [PATCH] 2.5.21 kill warnings 4/19

On Mon, Jun 10, 2002 at 02:10:23PM -0600, Thunder from the hill wrote:
> Hi,
>
> On Mon, 10 Jun 2002, Thunder from the hill wrote:
> > #define __FUNCTION__ __func__
>
> Hmmm... that's just logical. If they just remove the __FUNCTION__
> constant, there's nothing to complain about if we redefine it. Even my
> chaos brain sees that.

What? __FUNCTION__ and __func__ can't be used interchangably. But for
older compilers which lack __func__, you can do:
#define __func__ __FUNCTION__

And provided that __func__ is only used like this:
printk("Something bad happened in %s\n", __func__);

egcs-1.1.2 will be happy, gcc-2.95.x will be happy and gcc-3.x will be
happy and we won't be doing the now 'bad' thing of:
printk("Something bad happened in " __FUNCTION__ "\n");

(And if gcc-3.x ever drops __FUNCTION__, which I have nfc if they will,
we'll be ok still).

--
Tom Rini (TR1265)
http://gate.crashing.org/~trini/

2002-06-10 21:12:22

by Tom Rini

[permalink] [raw]
Subject: Re: [PATCH] 2.5.21 kill warnings 4/19

On Mon, Jun 10, 2002 at 02:01:24PM -0700, Maksim (Max) Krasnyanskiy wrote:
>
> >> > wrt the __func__ thing: is it possible to do:
> >> >
> >> > #if (compiler version test)
> >> > #define __FUNCTION__ __func__
> >> > #endif
> >> >
> >> > to kill the 3.x warning?
> >>
> >> #include <stdio.h>
> >> #define __FUNCTION__ __func__
> >>
> >> int main(int argc, char **argv) {
> >> int i;
> >>
> >> for (i = 0; i < argc; i++) {
> >> printf(__FUNCTION__ " encountered argument ");
> >> printf("%s\n", argv[i]);
> >> }
> >>
> >> exit(0);
> >> }
> >>
> >> Obviously, yes.
> >
> >Nope.
> >$ gcc-3.1 -Wall -o foo foo.c
> >foo.c: In function `main':
> >foo.c:8: parse error before string constant
> >
> >And line 8 is:
> >printf(__FUNCTION__ " encountered argument ");
>
> Well, those will brake. But in general it's possible. And I already do that
> in Bluetooth code (it's been converted recently).
>
> So
>
> #if __GNUC__ <= 2 && __GNUC_MINOR__ < 95
> #define __func__ __FUNCTION__
> #endif
>
> does the trick. All gcc's newer than 2.95 support __func__.

Right. Maybe it should even go in <linux/compiler.h> if it's not
already there.

--
Tom Rini (TR1265)
http://gate.crashing.org/~trini/

2002-06-10 21:34:35

by Thunder from the hill

[permalink] [raw]
Subject: Re: [PATCH] 2.5.21 kill warnings 4/19

Hi,

On Mon, 10 Jun 2002, Tom Rini wrote:
> Right. Maybe it should even go in <linux/compiler.h> if it's not
> already there.

You want this?

Index: include/linux/compiler.h
===================================================================
RCS file: /var/cvs/thunder-2.5/include/linux/compiler.h,v
retrieving revision 1.1.1.1
diff -u -3 -p -r1.1.1.1 compiler.h
--- include/linux/compiler.h 10 Jun 2002 15:19:48 -0000 1.1.1.1
+++ include/linux/compiler.h 10 Jun 2002 21:33:38 -0000
@@ -8,7 +8,15 @@

#if __GNUC__ == 2 && __GNUC_MINOR__ < 96
#define __builtin_expect(x, expected_value) (x)
-#endif
+#endif /* GCC < 2.96 */
+
+/*
+ * There may or may not be a __func__. For GCC < 2.95, there is none, so
we
+ * define it as __FUNCTION__ there, even though it's NOT equivalent.
+ */
+#if __GNUC__ == 2 && __GNUC_MINOR__ < 95
+#define __func__ __FUNCTION__
+#endif /* GCC < 2.95 */

#define likely(x) __builtin_expect((x),1)
#define unlikely(x) __builtin_expect((x),0)


Regards,
Thunder
--
German attitude becoming | Thunder from the hill at ngforever
rightaway popular: |
"Get outa my way, | free inhabitant not directly
for I got a mobile phone!" | belonging anywhere

2002-06-10 21:52:40

by Neil Booth

[permalink] [raw]
Subject: Re: [PATCH] 2.5.21 kill warnings 4/19

Maksim (Max) Krasnyanskiy wrote:-

> Hi Martin,
>
> How about replacing __FUNCTION__ with __func__ ?
> GCC 3.x warns that __FUNCTION__ is obsolete and will be removed.

No, it doesn't, it warns that string concatenation with __FUNCTION__
is deprecated and will be removed (I wrote the code).

__FUNCTION__ itself will stay forever.

Neil.

2002-06-10 22:25:07

by William Lee Irwin III

[permalink] [raw]
Subject: Re: [PATCH] 2.5.21 kill warnings 5/19

On Mon, Jun 10, 2002 at 01:28:26PM +0200, Martin Dalecki wrote:
> Fix improper __FUNCTION__ usage in st680 driver code,
> cdc-ether.c. Fix namespace clash in cdc-ether.h

Would you mind sending these as original posts and not as replies to
Linus' announcement?


Thanks,
Bill

2002-06-10 22:35:09

by Russell King

[permalink] [raw]
Subject: Re: [PATCH] 2.5.21 kill warnings 5/19

On Mon, Jun 10, 2002 at 03:24:38PM -0700, William Lee Irwin III wrote:
> On Mon, Jun 10, 2002 at 01:28:26PM +0200, Martin Dalecki wrote:
> > Fix improper __FUNCTION__ usage in st680 driver code,
> > cdc-ether.c. Fix namespace clash in cdc-ether.h
>
> Would you mind sending these as original posts and not as replies to
> Linus' announcement?

I'm sure the "reply" button is the only button some mail clients have.
Don't blame the people - blame the mail clients. 8)

--
Russell King ([email protected]) The developer of ARM Linux
http://www.arm.linux.org.uk/personal/aboutme.html

2002-06-10 22:43:43

by Max Krasnyansky

[permalink] [raw]
Subject: Re: [PATCH] 2.5.21 kill warnings 4/19


>__FUNCTION__ itself will stay forever.
Ok. Then it's not an issue. We should just fix macros that do concatenation.

Thanks
Max

2002-06-11 00:41:58

by Greg KH

[permalink] [raw]
Subject: Re: [PATCH] 2.5.21 kill warnings 5/19

On Mon, Jun 10, 2002 at 01:28:26PM +0200, Martin Dalecki wrote:
> Fix improper __FUNCTION__ usage in st680 driver code,
> cdc-ether.c. Fix namespace clash in cdc-ether.h

What namespace clash? It builds just find for me.

And don't try to clean up the __FUNCTION__ mess in the USB drivers right
now, I'll do them all at once when we have to move up to a newer version
of gcc for some other reason.

thanks,

greg k-h

2002-06-11 00:43:45

by Greg KH

[permalink] [raw]
Subject: Re: [PATCH] 2.5.21 kill warnings 4/19

On Mon, Jun 10, 2002 at 01:26:53PM +0200, Martin Dalecki wrote:
> Fix improper usage of __FUNCTION__ in usb code.

It's not improper. Well it wasn't when it was written, but the gcc
authors decided to change their minds... :(

As stated before, I'll clean up all of the USB drivers later all at
once, and the pci hotplug drivers as well. The USB drivers could use
with some good debugging macro cleanup in general...

Martin, any reason you are doing all of this "cleanup" without sending
the patches to the relevant maintainers?

thanks,

greg k-h

2002-06-11 06:10:25

by Martin Dalecki

[permalink] [raw]
Subject: Re: [PATCH] 2.5.21 kill warnings 4/19

Maksim (Max) Krasnyanskiy wrote:
> Hi Martin,
>
> How about replacing __FUNCTION__ with __func__ ?
> GCC 3.x warns that __FUNCTION__ is obsolete and will be removed.
> Here is how I did it in Bluetooth code:
> #define BT_DBG(fmt, arg...) printk(KERN_INFO "%s: " fmt "\n" ,
> __func__ , ## arg)
> no more warnings from gcc.

GCC doesn't warn that __FUNCTION__ is obsolete.
The usage of __FUNCTION__ as string literal is what is offending it.
__func__ is a GNU "extension".

2002-06-11 06:12:52

by Martin Dalecki

[permalink] [raw]
Subject: Re: [PATCH] 2.5.21 kill warnings 4/19

Andrew Morton wrote:
> Tom Rini wrote:
>
>>On Mon, Jun 10, 2002 at 08:57:02PM +0200, Thomas 'Dent' Mirlacher wrote:
>>
>>>On Mon, 10 Jun 2002, Maksim (Max) Krasnyanskiy wrote:
>>>
>>>
>>>>Hi Martin,
>>>>
>>>>How about replacing __FUNCTION__ with __func__ ?
>>>>GCC 3.x warns that __FUNCTION__ is obsolete and will be removed.
>>>
>>>is __func__ already supported for gcc 2.96?
>>
>>Well it works with 2.95.3, which is the important part...
>
>
> The 2.5 kernel must be buildable on gcc-2.91.66, aka egcs-1.1.2.
>
> The 2.95.x requirement was reverted because sparc (or sparc64?)
> needs egcs-1.1.2.
>
> __func__ does *not* work on egcs-1.1.2 and so cannot be used in Linux.
>
> `struct blah = { .open = driver_open };' *does* work in egcs-1.1.2
> and is OK to use.

As far as I know all GCC compilers before 3.1 where utter crap on sparc64!


2002-06-11 06:33:27

by Martin Dalecki

[permalink] [raw]
Subject: Re: [PATCH] 2.5.21 kill warnings 4/19

Greg KH wrote:
> On Mon, Jun 10, 2002 at 01:26:53PM +0200, Martin Dalecki wrote:
>
>>Fix improper usage of __FUNCTION__ in usb code.
>
>
> It's not improper. Well it wasn't when it was written, but the gcc
> authors decided to change their minds... :(
>
> As stated before, I'll clean up all of the USB drivers later all at
> once, and the pci hotplug drivers as well. The USB drivers could use
> with some good debugging macro cleanup in general...
>
> Martin, any reason you are doing all of this "cleanup" without sending
> the patches to the relevant maintainers?

1. I know you read lkml.

2. The patches are trival.

3. Having them helps using GCC 3.1, which turns out to be a big
winner contrary to 3.0.xx.

4. I use GCC 3.1 becouse I hate having different compilers on the system
and becouse I do some C++ too.

5. We have to do it anyway - so what?

6. In esp. ARM seems to be much better off with GCC 3.1 then anything else.

7. Separating __FUNCTION__ out from string const concatenation allows
the compiler to coalesce the storage used for this string in to one constant!

2002-06-11 06:42:39

by Greg KH

[permalink] [raw]
Subject: Re: [PATCH] 2.5.21 kill warnings 4/19

On Tue, Jun 11, 2002 at 08:33:18AM +0200, Martin Dalecki wrote:
> Greg KH wrote:
> >On Mon, Jun 10, 2002 at 01:26:53PM +0200, Martin Dalecki wrote:
> >
> >>Fix improper usage of __FUNCTION__ in usb code.
> >
> >
> >It's not improper. Well it wasn't when it was written, but the gcc
> >authors decided to change their minds... :(
> >
> >As stated before, I'll clean up all of the USB drivers later all at
> >once, and the pci hotplug drivers as well. The USB drivers could use
> >with some good debugging macro cleanup in general...
> >
> >Martin, any reason you are doing all of this "cleanup" without sending
> >the patches to the relevant maintainers?
>
> 1. I know you read lkml.

Yeah, but not all the other maintainers do, it's still good form to at
least CC: them on things like this.

And remember, other maintainers aren't as nice as I am :)

greg k-h

2002-06-11 07:47:19

by Martin Dalecki

[permalink] [raw]
Subject: [PATCH] 2.5.21 IDE 87

diff -urN linux-2.5.21/drivers/ide/device.c linux/drivers/ide/device.c
--- linux-2.5.21/drivers/ide/device.c 2002-06-09 07:28:51.000000000 +0200
+++ linux/drivers/ide/device.c 2002-06-11 00:17:34.000000000 +0200
@@ -80,7 +80,29 @@
}

/*
+ * Spin until the drive is no longer busy.
+ *
+ * Not exported, since it's not used within any modules.
+ */
+int ata_busy_poll(struct ata_device *drive, unsigned long timeout)
+{
+ /* spec allows drive 400ns to assert "BUSY" */
+ udelay(1);
+ if (!ata_status(drive, 0, BUSY_STAT)) {
+ timeout += jiffies;
+ while (!ata_status(drive, 0, BUSY_STAT)) {
+ if (time_after(jiffies, timeout))
+ return 1;
+ }
+ }
+
+ return 0;
+}
+
+/*
* Check the state of the status register.
+ *
+ * FIXME: Channel lock should be held.
*/
int ata_status(struct ata_device *drive, u8 good, u8 bad)
{
@@ -94,6 +116,57 @@
EXPORT_SYMBOL(ata_status);

/*
+ * Busy-wait for the drive status to be not "busy". Check then the status for
+ * all of the "good" bits and none of the "bad" bits, and if all is okay it
+ * returns 0. All other cases return 1 after invoking error handler -- caller
+ * should just return.
+ *
+ * This routine should get fixed to not hog the cpu during extra long waits..
+ * That could be done by busy-waiting for the first jiffy or two, and then
+ * setting a timer to wake up at half second intervals thereafter, until
+ * timeout is achieved, before timing out.
+ *
+ * FIXME: Channel lock should be held.
+ */
+
+int ata_status_poll(struct ata_device *drive, u8 good, u8 bad,
+ unsigned long timeout,
+ struct request *rq, ide_startstop_t *startstop)
+{
+ int i;
+
+ /* bail early if we've exceeded max_failures */
+ if (drive->max_failures && (drive->failures > drive->max_failures)) {
+ *startstop = ide_stopped;
+
+ return 1;
+ }
+
+ if (ata_busy_poll(drive, timeout)) {
+ *startstop = ata_error(drive, rq, "status timeout");
+
+ return 1;
+ }
+
+ /*
+ * Allow status to settle, then read it again. A few rare drives
+ * vastly violate the 400ns spec here, so we'll wait up to 10usec for a
+ * "good" status rather than expensively fail things immediately. This
+ * fix courtesy of Matthew Faupel & Niccolo Rigacci.
+ */
+ for (i = 0; i < 10; i++) {
+ udelay(1);
+ if (ata_status(drive, good, bad))
+ return 0;
+ }
+ *startstop = ata_error(drive, rq, "status error");
+
+ return 1;
+}
+
+EXPORT_SYMBOL(ata_status_poll);
+
+/*
* Handle the nIEN - negated Interrupt ENable of the drive.
* This is controlling whatever the drive will acnowlenge commands
* with interrupts or not.
@@ -160,7 +233,7 @@
}

/*
- * Output a complete register file.
+ * Input a complete register file.
*/
void ata_in_regfile(struct ata_device *drive, struct hd_drive_task_hdr *rf)
{
diff -urN linux-2.5.21/drivers/ide/ide.c linux/drivers/ide/ide.c
--- linux-2.5.21/drivers/ide/ide.c 2002-06-11 02:11:03.000000000 +0200
+++ linux/drivers/ide/ide.c 2002-06-11 01:02:30.000000000 +0200
@@ -106,18 +106,19 @@
return 0;
}

-int __ide_end_request(struct ata_device *drive, struct request *rq, int uptodate, unsigned int nr_secs)
+/*
+ * Not locking variabt of the end_request method.
+ *
+ * Channel lock should be held.
+ */
+int __ata_end_request(struct ata_device *drive, struct request *rq, int uptodate, unsigned int nr_secs)
{
- unsigned long flags;
int ret = 1;

- spin_lock_irqsave(drive->channel->lock, flags);
-
BUG_ON(!(rq->flags & REQ_STARTED));

- /*
- * small hack to eliminate locking from ide_end_request to grab
- * the first segment number of sectors
+ /* FIXME: Make this "small" hack to eliminate locking from
+ * ata_end_request to grab the first segment number of sectors go away.
*/
if (!nr_secs)
nr_secs = rq->hard_cur_sectors;
@@ -126,7 +127,6 @@
* Decide whether to reenable DMA -- 3 is a random magic for now,
* if we DMA timeout more than 3 times, just stay in PIO.
*/
-
if (drive->state == DMA_PIO_RETRY && drive->retry_pio <= 3) {
drive->state = 0;
udma_enable(drive, 1, 1);
@@ -143,15 +143,24 @@
ret = 0;
}

- spin_unlock_irqrestore(drive->channel->lock, flags);

return ret;
}

-/* This is the default end request function as well */
-int ide_end_request(struct ata_device *drive, struct request *rq, int uptodate)
+/*
+ * This is the default end request function as well
+ */
+int ata_end_request(struct ata_device *drive, struct request *rq, int uptodate)
{
- return __ide_end_request(drive, rq, uptodate, 0);
+ unsigned long flags;
+ struct ata_channel *ch = drive->channel;
+ int ret;
+
+ spin_lock_irqsave(ch->lock, flags);
+ ret = __ata_end_request(drive, rq, uptodate, 0);
+ spin_unlock_irqrestore(drive->channel->lock, flags);
+
+ return ret;
}

/*
@@ -260,24 +269,25 @@
struct ata_channel *ch = drive->channel;
int ret = ide_stopped;

+ spin_lock_irqsave(ch->lock, flags);
ata_select(drive, 10);
-
if (!ata_status(drive, 0, BUSY_STAT)) {
if (time_before(jiffies, ch->poll_timeout)) {
- spin_lock_irqsave(ch->lock, flags);
ata_set_handler(drive, atapi_reset_pollfunc, HZ/20, NULL);
- spin_unlock_irqrestore(ch->lock, flags);
ret = ide_started; /* continue polling */
} else {
ch->poll_timeout = 0; /* end of polling */
printk("%s: ATAPI reset timed out, status=0x%02x\n", drive->name, drive->status);

- ret = do_reset1(drive, 1); /* do it the old fashioned way */
+ ret = do_reset1(drive, 0); /* do it the old fashioned way */
}
} else {
printk("%s: ATAPI reset complete\n", drive->name);
ch->poll_timeout = 0; /* done polling */
+
+ ret = ide_stopped;
}
+ spin_unlock_irqrestore(ch->lock, flags);

return ret;
}
@@ -289,20 +299,20 @@
*/
static ide_startstop_t reset_pollfunc(struct ata_device *drive, struct request *__rq)
{
+ unsigned long flags;
struct ata_channel *ch = drive->channel;
+ int ret;

+ spin_lock_irqsave(ch->lock, flags);
if (!ata_status(drive, 0, BUSY_STAT)) {
if (time_before(jiffies, ch->poll_timeout)) {
- unsigned long flags;
-
- spin_lock_irqsave(ch->lock, flags);
ata_set_handler(drive, reset_pollfunc, HZ/20, NULL);
- spin_unlock_irqrestore(ch->lock, flags);
-
- return ide_started; /* continue polling */
+ ret = ide_started; /* continue polling */
+ } else {
+ printk("%s: reset timed out, status=0x%02x\n", ch->name, drive->status);
+ ++drive->failures;
+ ret = ide_stopped;
}
- printk("%s: reset timed out, status=0x%02x\n", ch->name, drive->status);
- ++drive->failures;
} else {
u8 stat;

@@ -333,8 +343,11 @@
printk(KERN_ERR "%s error [%02x]\n", msg, stat);
++drive->failures;
}
+
+ ret = ide_stopped;
}
ch->poll_timeout = 0; /* done polling */
+ spin_unlock_irqrestore(ch->lock, flags);

return ide_stopped;
}
@@ -357,7 +370,7 @@
* Channel lock should be held.
*/

-static ide_startstop_t do_reset1(struct ata_device *drive, int do_not_try_atapi)
+static ide_startstop_t do_reset1(struct ata_device *drive, int try_atapi)
{
unsigned int unit;
unsigned long flags;
@@ -367,15 +380,17 @@
__cli(); /* local CPU only */

/* For an ATAPI device, first try an ATAPI SRST. */
- if (drive->type != ATA_DISK && !do_not_try_atapi) {
- check_crc_errors(drive);
- ata_select(drive, 20);
- OUT_BYTE(WIN_SRST, IDE_COMMAND_REG);
- ch->poll_timeout = jiffies + WAIT_WORSTCASE;
- ata_set_handler(drive, atapi_reset_pollfunc, HZ/20, NULL);
- __restore_flags(flags); /* local CPU only */
+ if (try_atapi) {
+ if (drive->type != ATA_DISK) {
+ check_crc_errors(drive);
+ ata_select(drive, 20);
+ OUT_BYTE(WIN_SRST, IDE_COMMAND_REG);
+ ch->poll_timeout = jiffies + WAIT_WORSTCASE;
+ ata_set_handler(drive, atapi_reset_pollfunc, HZ/20, NULL);
+ __restore_flags(flags); /* local CPU only */

- return ide_started;
+ return ide_started;
+ }
}

/*
@@ -572,6 +587,7 @@

return ide_stopped;
}
+
/* other bits are useless when BUSY */
if (stat & BUSY_STAT || ((stat & WRERR_STAT) && !drive->nowerr))
rq->errors |= ERROR_RESET; /* FIXME: What's that?! */
@@ -598,14 +614,15 @@

if (rq->errors >= ERROR_MAX) {
printk(KERN_ERR "%s: max number of retries exceeded!\n", drive->name);
+ /* FIXME: make sure all end_request implementations are lock free */
if (ata_ops(drive) && ata_ops(drive)->end_request)
ata_ops(drive)->end_request(drive, rq, 0);
else
- ide_end_request(drive, rq, 0);
+ __ata_end_request(drive, rq, 0, 0);
} else {
++rq->errors;
if ((rq->errors & ERROR_RESET) == ERROR_RESET)
- return do_reset1(drive, 0);
+ return do_reset1(drive, 1);
if ((rq->errors & ERROR_RECAL) == ERROR_RECAL)
return do_recalibrate(drive);
}
@@ -614,60 +631,6 @@
}

/*
- * Busy-wait for the drive status to be not "busy". Check then the status for
- * all of the "good" bits and none of the "bad" bits, and if all is okay it
- * returns 0. All other cases return 1 after invoking error handler -- caller
- * should just return.
- *
- * This routine should get fixed to not hog the cpu during extra long waits..
- * That could be done by busy-waiting for the first jiffy or two, and then
- * setting a timer to wake up at half second intervals thereafter, until
- * timeout is achieved, before timing out.
- *
- * FIXME: Channel lock should be held.
- */
-int ide_wait_stat(ide_startstop_t *startstop,
- struct ata_device *drive, struct request *rq,
- byte good, byte bad, unsigned long timeout)
-{
- int i;
-
- /* bail early if we've exceeded max_failures */
- if (drive->max_failures && (drive->failures > drive->max_failures)) {
- *startstop = ide_stopped;
-
- return 1;
- }
-
- /* spec allows drive 400ns to assert "BUSY" */
- udelay(1);
- if (!ata_status(drive, 0, BUSY_STAT)) {
- timeout += jiffies;
- while (!ata_status(drive, 0, BUSY_STAT)) {
- if (time_after(jiffies, timeout)) {
- *startstop = ata_error(drive, rq, "status timeout");
- return 1;
- }
- }
- }
-
- /*
- * Allow status to settle, then read it again. A few rare drives
- * vastly violate the 400ns spec here, so we'll wait up to 10usec for a
- * "good" status rather than expensively fail things immediately. This
- * fix courtesy of Matthew Faupel & Niccolo Rigacci.
- */
- for (i = 0; i < 10; i++) {
- udelay(1);
- if (ata_status(drive, good, bad))
- return 0;
- }
- *startstop = ata_error(drive, rq, "status error");
-
- return 1;
-}
-
-/*
* This initiates handling of a new I/O request.
*/
static ide_startstop_t start_request(struct ata_device *drive, struct request *rq)
@@ -710,8 +673,8 @@
ide_startstop_t res;

ata_select(drive, 0);
- if (ide_wait_stat(&res, drive, rq, drive->ready_stat,
- BUSY_STAT|DRQ_STAT, WAIT_READY)) {
+ if (ata_status_poll(drive, drive->ready_stat, BUSY_STAT | DRQ_STAT,
+ WAIT_READY, rq, &res)) {
printk(KERN_WARNING "%s: drive not ready for command\n", drive->name);

return res;
@@ -731,7 +694,7 @@
if (ata_ops(drive)->do_request)
return ata_ops(drive)->do_request(drive, rq, block);
else {
- ide_end_request(drive, rq, 0);
+ ata_end_request(drive, rq, 0);

return ide_stopped;
}
@@ -748,7 +711,7 @@
if (ata_ops(drive) && ata_ops(drive)->end_request)
ata_ops(drive)->end_request(drive, rq, 0);
else
- ide_end_request(drive, rq, 0);
+ ata_end_request(drive, rq, 0);

return ide_stopped;
}
@@ -1008,64 +971,24 @@
}

/*
- * Un-busy the hwgroup etc, and clear any pending DMA status. we want to
- * retry the current request in PIO mode instead of risking tossing it
- * all away
- */
-static void dma_timeout_retry(struct ata_device *drive, struct request *rq)
-{
- /*
- * end current dma transaction
- */
- udma_stop(drive);
- udma_timeout(drive);
-
- /*
- * Disable dma for now, but remember that we did so because of
- * a timeout -- we'll reenable after we finish this next request
- * (or rather the first chunk of it) in pio.
- */
- drive->retry_pio++;
- drive->state = DMA_PIO_RETRY;
- udma_enable(drive, 0, 0);
-
- /*
- * un-busy drive etc (hwgroup->busy is cleared on return) and
- * make sure request is sane
- */
- drive->rq = NULL;
-
- rq->errors = 0;
- if (rq->bio) {
- rq->sector = rq->bio->bi_sector;
- rq->current_nr_sectors = bio_iovec(rq->bio)->bv_len >> 9;
- rq->buffer = NULL;
- }
-}
-
-/*
* This is our timeout function for all drive operations. But note that it can
* also be invoked as a result of a "sleep" operation triggered by the
* mod_timer() call in do_request.
+ *
+ * FIXME: this should take a drive context instead of a channel.
*/
void ide_timer_expiry(unsigned long data)
{
- struct ata_channel *ch = (struct ata_channel *) data;
- ata_handler_t *handler;
- ata_expiry_t *expiry;
unsigned long flags;
- unsigned long wait;
-
- /*
- * A global lock protects timers etc -- shouldn't get contention
- * worth mentioning.
- */
+ struct ata_channel *ch = (struct ata_channel *) data;

spin_lock_irqsave(ch->lock, flags);
del_timer(&ch->timer);

- handler = ch->handler;
- if (!handler) {
+ if (!ch->drive) {
+ printk(KERN_ERR "%s: IRQ handler was NULL\n", __FUNCTION__);
+ ch->handler = NULL;
+ } else if (!ch->handler) {

/*
* Either a marginal timeout occurred (got the interrupt just
@@ -1078,69 +1001,103 @@
clear_bit(IDE_BUSY, ch->active);
} else {
struct ata_device *drive = ch->drive;
- if (!drive) {
- printk(KERN_ERR "ide_timer_expiry: IRQ handler was NULL\n");
- ch->handler = NULL;
- } else {
- ide_startstop_t startstop;
+ ide_startstop_t ret;
+ ata_handler_t *handler;

- /* paranoia */
- if (!test_and_set_bit(IDE_BUSY, ch->active))
- printk(KERN_ERR "%s: ide_timer_expiry: IRQ handler was not busy??\n", drive->name);
- if ((expiry = ch->expiry) != NULL) {
- /* continue */
- if ((wait = expiry(drive, drive->rq)) != 0) {
- /* reengage timer */
- ch->timer.expires = jiffies + wait;
- add_timer(&ch->timer);
+ /* paranoia */
+ if (!test_and_set_bit(IDE_BUSY, ch->active))
+ printk(KERN_ERR "%s: %s: IRQ handler was not busy?!\n",
+ drive->name, __FUNCTION__);
+
+ if (ch->expiry) {
+ unsigned long wait;
+
+ /* continue */
+ if ((wait = ch->expiry(drive, drive->rq)) != 0) {
+ /* reengage timer */
+ ch->timer.expires = jiffies + wait;
+ add_timer(&ch->timer);

- spin_unlock_irqrestore(ch->lock, flags);
+ spin_unlock_irqrestore(ch->lock, flags);

- return;
- }
+ return;
}
- ch->handler = NULL;
- /*
- * We need to simulate a real interrupt when invoking
- * the handler() function, which means we need to globally
- * mask the specific IRQ:
- */
+ }
+
+ /*
+ * We need to simulate a real interrupt when invoking the
+ * handler() function, which means we need to globally mask the
+ * specific IRQ:
+ */

- spin_unlock(ch->lock);
+ handler = ch->handler;
+ ch->handler = NULL;
+ spin_unlock(ch->lock);

- ch = drive->channel;
+ ch = drive->channel;
#if DISABLE_IRQ_NOSYNC
- disable_irq_nosync(ch->irq);
+ disable_irq_nosync(ch->irq);
#else
- disable_irq(ch->irq); /* disable_irq_nosync ?? */
+ disable_irq(ch->irq); /* disable_irq_nosync ?? */
#endif
- __cli(); /* local CPU only, as if we were handling an interrupt */
- if (ch->poll_timeout != 0) {
- startstop = handler(drive, drive->rq);
- } else if (drive_is_ready(drive)) {
- if (drive->waiting_for_dma)
- udma_irq_lost(drive);
- (void) ide_ack_intr(ch);
- printk("%s: lost interrupt\n", drive->name);
- startstop = handler(drive, drive->rq);
- } else {
- if (drive->waiting_for_dma) {
- startstop = ide_stopped;
- dma_timeout_retry(drive, drive->rq);
- } else
- startstop = ata_error(drive, drive->rq, "irq timeout");
+ __cli(); /* local CPU only, as if we were handling an interrupt */
+ if (ch->poll_timeout) {
+ ret = handler(drive, drive->rq);
+ } else if (drive_is_ready(drive)) {
+ if (drive->waiting_for_dma)
+ udma_irq_lost(drive);
+ (void) ide_ack_intr(ch);
+ printk("%s: lost interrupt\n", drive->name);
+ ret = handler(drive, drive->rq);
+ } else if (drive->waiting_for_dma) {
+ struct request *rq = drive->rq;
+
+ /*
+ * Un-busy the hwgroup etc, and clear any pending DMA
+ * status. we want to retry the current request in PIO
+ * mode instead of risking tossing it all away.
+ */
+
+ udma_stop(drive);
+ udma_timeout(drive);
+
+ /* Disable dma for now, but remember that we did so
+ * because of a timeout -- we'll reenable after we
+ * finish this next request (or rather the first chunk
+ * of it) in pio.
+ */
+
+ drive->retry_pio++;
+ drive->state = DMA_PIO_RETRY;
+ udma_enable(drive, 0, 0);
+
+ /* Un-busy drive etc (hwgroup->busy is cleared on
+ * return) and make sure request is sane.
+ */
+
+ drive->rq = NULL;
+
+ rq->errors = 0;
+ if (rq->bio) {
+ rq->sector = rq->bio->bi_sector;
+ rq->current_nr_sectors = bio_iovec(rq->bio)->bv_len >> 9;
+ rq->buffer = NULL;
}
- enable_irq(ch->irq);
+ ret = ide_stopped;
+ } else
+ ret = ata_error(drive, drive->rq, "irq timeout");

- spin_lock_irq(ch->lock);
+ enable_irq(ch->irq);

- if (startstop == ide_stopped)
- clear_bit(IDE_BUSY, ch->active);
- }
- }
+ spin_lock_irq(ch->lock);
+
+ if (ret == ide_stopped)
+ clear_bit(IDE_BUSY, ch->active);

- do_request(ch->drive->channel);

+ /* Reenter the request handling engine */
+ do_request(ch);
+ }
spin_unlock_irqrestore(ch->lock, flags);
}

@@ -1440,11 +1397,10 @@
EXPORT_SYMBOL(ata_dump);
EXPORT_SYMBOL(ata_error);

-EXPORT_SYMBOL(ide_wait_stat);
/* FIXME: this is a trully bad name */
EXPORT_SYMBOL(restart_request);
-EXPORT_SYMBOL(__ide_end_request);
-EXPORT_SYMBOL(ide_end_request);
+EXPORT_SYMBOL(ata_end_request);
+EXPORT_SYMBOL(__ata_end_request);
EXPORT_SYMBOL(ide_stall_queue);

EXPORT_SYMBOL(ide_setup_ports);
diff -urN linux-2.5.21/drivers/ide/ide-cd.c linux/drivers/ide/ide-cd.c
--- linux-2.5.21/drivers/ide/ide-cd.c 2002-06-11 02:11:03.000000000 +0200
+++ linux/drivers/ide/ide-cd.c 2002-06-11 00:02:07.000000000 +0200
@@ -556,7 +556,7 @@
if ((rq->flags & REQ_CMD) && !rq->current_nr_sectors)
uptodate = 1;

- ide_end_request(drive, rq, uptodate);
+ ata_end_request(drive, rq, uptodate);
}


@@ -734,7 +734,7 @@
struct cdrom_info *info = drive->driver_data;

/* Wait for the controller to be idle. */
- if (ide_wait_stat(&startstop, drive, rq, 0, BUSY_STAT, WAIT_READY))
+ if (ata_status_poll(drive, 0, BUSY_STAT, WAIT_READY, rq, &startstop))
return startstop;

spin_lock_irqsave(ch->lock, flags);
@@ -798,7 +798,8 @@
return startstop;
} else {
/* Otherwise, we must wait for DRQ to get set. */
- if (ide_wait_stat(&startstop, drive, rq, DRQ_STAT, BUSY_STAT, WAIT_READY))
+ if (ata_status_poll(drive, DRQ_STAT, BUSY_STAT,
+ WAIT_READY, rq, &startstop))
return startstop;
}

@@ -926,7 +927,14 @@

if (dma) {
if (!dma_error) {
- __ide_end_request(drive, rq, 1, rq->nr_sectors);
+ /* FIXME: this locking should encompass the above register
+ * file access too.
+ */
+
+ spin_lock_irqsave(ch->lock, flags);
+ __ata_end_request(drive, rq, 1, rq->nr_sectors);
+ spin_unlock_irqrestore(ch->lock, flags);
+
return ide_stopped;
} else
return ata_error(drive, rq, "dma error");
@@ -1518,7 +1526,14 @@
if (dma_error)
return ata_error(drive, rq, "dma error");

- __ide_end_request(drive, rq, 1, rq->nr_sectors);
+ /* FIXME: this locking should encompass the above register
+ * file access too.
+ */
+
+ spin_lock_irqsave(ch->lock, flags);
+ __ata_end_request(drive, rq, 1, rq->nr_sectors);
+ spin_unlock_irqrestore(ch->lock, flags);
+
return ide_stopped;
}

diff -urN linux-2.5.21/drivers/ide/ide-disk.c linux/drivers/ide/ide-disk.c
--- linux-2.5.21/drivers/ide/ide-disk.c 2002-06-11 02:11:03.000000000 +0200
+++ linux/drivers/ide/ide-disk.c 2002-06-11 02:02:50.000000000 +0200
@@ -91,104 +91,99 @@
}

/*
- * Handler for command with PIO data-in phase
+ * Handler for command with PIO data-in phase.
*/
static ide_startstop_t task_in_intr(struct ata_device *drive, struct request *rq)
{
unsigned long flags;
struct ata_channel *ch = drive->channel;
- char *buf = NULL;
+ int ret;
+
+ spin_lock_irqsave(ch->lock, flags);

if (!ata_status(drive, DATA_READY, BAD_R_STAT)) {
- if (drive->status & (ERR_STAT|DRQ_STAT))
+ if (drive->status & (ERR_STAT|DRQ_STAT)) {
+ spin_unlock_irqrestore(ch->lock, flags);
+
return ata_error(drive, rq, __FUNCTION__);
+ }

if (!(drive->status & BUSY_STAT)) {
-#if 0
- printk("task_in_intr to Soon wait for next interrupt\n");
-#endif
-
- /* FIXME: this locking should encompass the above register
- * file access too.
- */
-
- spin_lock_irqsave(ch->lock, flags);
+// printk("task_in_intr to Soon wait for next interrupt\n");
ata_set_handler(drive, task_in_intr, WAIT_CMD, NULL);
spin_unlock_irqrestore(ch->lock, flags);

return ide_started;
}
}
- buf = ide_map_rq(rq, &flags);
-#if 0
- printk("Read: %p, rq->current_nr_sectors: %d\n", buf, (int) rq->current_nr_sectors);
-#endif

- ata_read(drive, buf, SECTOR_WORDS);
- ide_unmap_rq(rq, buf, &flags);
+// printk("Read: %p, rq->current_nr_sectors: %d\n", buf, (int) rq->current_nr_sectors);
+ {
+ unsigned long flags;
+ char *buf;
+
+ buf = ide_map_rq(rq, &flags);
+ ata_read(drive, buf, SECTOR_WORDS);
+ ide_unmap_rq(rq, buf, &flags);
+ }

/* First segment of the request is complete. note that this does not
* necessarily mean that the entire request is done!! this is only true
- * if ide_end_request() returns 0.
+ * if ata_end_request() returns 0.
*/

- if (--rq->current_nr_sectors <= 0) {
-#if 0
- printk("Request Ended stat: %02x\n", drive->status);
-#endif
- if (!ide_end_request(drive, rq, 1))
- return ide_stopped;
- }
-
- /* FIXME: this locking should encompass the above register
- * file access too.
- */
+ if (--rq->current_nr_sectors <= 0 && !__ata_end_request(drive, rq, 1, 0)) {
+// printk("Request Ended stat: %02x\n", drive->status);
+ ret = ide_stopped;
+ } else {
+ /* still data left to transfer */
+ ata_set_handler(drive, task_in_intr, WAIT_CMD, NULL);

- spin_lock_irqsave(ch->lock, flags);
- /* still data left to transfer */
- ata_set_handler(drive, task_in_intr, WAIT_CMD, NULL);
+ ret = ide_started;
+ }
spin_unlock_irqrestore(ch->lock, flags);

- return ide_started;
+ return ret;
}

/*
- * Handler for command with PIO data-out phase
+ * Handler for command with PIO data-out phase.
*/
static ide_startstop_t task_out_intr(struct ata_device *drive, struct request *rq)
{
unsigned long flags;
struct ata_channel *ch = drive->channel;
- char *buf = NULL;
+ int ret;

- if (!ata_status(drive, DRIVE_READY, drive->bad_wstat))
- return ata_error(drive, rq, __FUNCTION__);
+ spin_lock_irqsave(ch->lock, flags);
+ if (!ata_status(drive, DRIVE_READY, drive->bad_wstat)) {
+ spin_unlock_irqrestore(ch->lock, flags);

- if (!rq->current_nr_sectors)
- if (!ide_end_request(drive, rq, 1))
- return ide_stopped;
+ return ata_error(drive, rq, __FUNCTION__);
+ }

- if ((rq->nr_sectors == 1) != (drive->status & DRQ_STAT)) {
- buf = ide_map_rq(rq, &flags);
-#if 0
- printk("write: %p, rq->current_nr_sectors: %d\n", buf, (int) rq->current_nr_sectors);
-#endif
+ if (!rq->current_nr_sectors && !__ata_end_request(drive, rq, 1, 0)) {
+ ret = ide_stopped;
+ } else {
+ if ((rq->nr_sectors == 1) != (drive->status & DRQ_STAT)) {
+ unsigned long flags;
+ char *buf;

- ata_write(drive, buf, SECTOR_WORDS);
- ide_unmap_rq(rq, buf, &flags);
- rq->errors = 0;
- rq->current_nr_sectors--;
- }
+// printk("write: %p, rq->current_nr_sectors: %d\n", buf, (int) rq->current_nr_sectors);
+ buf = ide_map_rq(rq, &flags);
+ ata_write(drive, buf, SECTOR_WORDS);
+ ide_unmap_rq(rq, buf, &flags);

- /* FIXME: this locking should encompass the above register
- * file access too.
- */
+ rq->errors = 0;
+ --rq->current_nr_sectors;
+ }
+ ata_set_handler(drive, task_out_intr, WAIT_CMD, NULL);

- spin_lock_irqsave(ch->lock, flags);
- ata_set_handler(drive, task_out_intr, WAIT_CMD, NULL);
+ ret = ide_started;
+ }
spin_unlock_irqrestore(ch->lock, flags);

- return ide_started;
+ return ret;
}

/*
@@ -198,63 +193,68 @@
{
unsigned long flags;
struct ata_channel *ch = drive->channel;
- char *buf = NULL;
- unsigned int msect;
- unsigned int nsect;
+ int ret;

+ spin_lock_irqsave(ch->lock, flags);
if (!ata_status(drive, DATA_READY, BAD_R_STAT)) {
- if (drive->status & (ERR_STAT|DRQ_STAT))
- return ata_error(drive, rq, __FUNCTION__);
+ if (drive->status & (ERR_STAT|DRQ_STAT)) {
+ spin_unlock_irqrestore(ch->lock, flags);

- /* FIXME: this locking should encompass the above register
- * file access too.
- */
+ return ata_error(drive, rq, __FUNCTION__);
+ }

- spin_lock_irqsave(ch->lock, flags);
/* no data yet, so wait for another interrupt */
ata_set_handler(drive, task_mulin_intr, WAIT_CMD, NULL);
- spin_unlock_irqrestore(ch->lock, flags);

- return ide_started;
- }
+ ret = ide_started;
+ } else {
+ unsigned int msect;

- /* (ks/hs): Fixed Multi-Sector transfer */
- msect = drive->mult_count;
+ /* (ks/hs): Fixed Multi-Sector transfer */
+ msect = drive->mult_count;

- do {
- nsect = rq->current_nr_sectors;
- if (nsect > msect)
- nsect = msect;
+ do {
+ unsigned int nsect;

- buf = ide_map_rq(rq, &flags);
+ nsect = rq->current_nr_sectors;
+ if (nsect > msect)
+ nsect = msect;

#if 0
- printk("Multiread: %p, nsect: %d , rq->current_nr_sectors: %d\n",
- buf, nsect, rq->current_nr_sectors);
+ printk("Multiread: %p, nsect: %d , rq->current_nr_sectors: %d\n",
+ buf, nsect, rq->current_nr_sectors);
#endif
- ata_read(drive, buf, nsect * SECTOR_WORDS);
- ide_unmap_rq(rq, buf, &flags);
- rq->errors = 0;
- rq->current_nr_sectors -= nsect;
- msect -= nsect;
- if (!rq->current_nr_sectors) {
- if (!ide_end_request(drive, rq, 1))
- return ide_stopped;
- }
- } while (msect);
+ {
+ unsigned long flags;
+ char *buf;
+
+ buf = ide_map_rq(rq, &flags);
+ ata_read(drive, buf, nsect * SECTOR_WORDS);
+ ide_unmap_rq(rq, buf, &flags);
+ }

- /* FIXME: this locking should encompass the above register
- * file access too.
- */
+ rq->errors = 0;
+ rq->current_nr_sectors -= nsect;
+ msect -= nsect;
+
+ /* FIXME: this seems buggy */
+ if (!rq->current_nr_sectors) {
+ if (!__ata_end_request(drive, rq, 1, 0)) {
+ spin_unlock_irqrestore(ch->lock, flags);

- spin_lock_irqsave(ch->lock, flags);
- /*
- * more data left
- */
- ata_set_handler(drive, task_mulin_intr, WAIT_CMD, NULL);
+ return ide_stopped;
+ }
+ }
+ } while (msect);
+
+ /* more data left */
+ ata_set_handler(drive, task_mulin_intr, WAIT_CMD, NULL);
+
+ ret = ide_started;
+ }
spin_unlock_irqrestore(ch->lock, flags);

- return ide_started;
+ return ret;
}

static ide_startstop_t task_mulout_intr(struct ata_device *drive, struct request *rq)
@@ -262,9 +262,9 @@
unsigned long flags;
struct ata_channel *ch = drive->channel;
int ok;
- int mcount = drive->mult_count;
- ide_startstop_t startstop;
+ int ret;

+ spin_lock_irqsave(ch->lock, flags);

/*
* FIXME: the drive->status checks here seem to be messy.
@@ -277,80 +277,67 @@

if (!ok || !rq->nr_sectors) {
if (drive->status & (ERR_STAT | DRQ_STAT)) {
- startstop = ata_error(drive, rq, __FUNCTION__);
+ spin_unlock_irqrestore(ch->lock, flags);

- return startstop;
+ return ata_error(drive, rq, __FUNCTION__);
}
}
-
if (!rq->nr_sectors) {
- __ide_end_request(drive, rq, 1, rq->hard_nr_sectors);
+ __ata_end_request(drive, rq, 1, rq->hard_nr_sectors);
rq->bio = NULL;
-
- return ide_stopped;
- }
-
- if (!ok) {
+ ret = ide_stopped;
+ } else if (!ok) {
/* no data yet, so wait for another interrupt */
- if (!ch->handler) {
- /* FIXME: this locking should encompass the above register
- * file access too.
- */
-
- spin_lock_irqsave(ch->lock, flags);
+ if (!ch->handler)
ata_set_handler(drive, task_mulout_intr, WAIT_CMD, NULL);
- spin_unlock_irqrestore(ch->lock, flags);
- }
+ ret = ide_started;
+ } else {
+ int mcount = drive->mult_count;

- return ide_started;
- }
+ do {
+ char *buf;
+ int nsect = rq->current_nr_sectors;
+ unsigned long flags;
+
+ if (nsect > mcount)
+ nsect = mcount;
+ mcount -= nsect;
+
+ buf = bio_kmap_irq(rq->bio, &flags) + ide_rq_offset(rq);
+ rq->sector += nsect;
+ rq->nr_sectors -= nsect;
+ rq->current_nr_sectors -= nsect;
+
+ /* Do we move to the next bio after this? */
+ if (!rq->current_nr_sectors) {
+ /* remember to fix this up /jens */
+ struct bio *bio = rq->bio->bi_next;
+
+ /* end early if we ran out of requests */
+ if (!bio) {
+ mcount = 0;
+ } else {
+ rq->bio = bio;
+ rq->current_nr_sectors = bio_iovec(bio)->bv_len >> 9;
+ }
+ }

- do {
- char *buffer;
- int nsect = rq->current_nr_sectors;
- unsigned long flags;
+ /*
+ * Ok, we're all setup for the interrupt re-entering us on the
+ * last transfer.
+ */
+ ata_write(drive, buf, nsect * SECTOR_WORDS);
+ bio_kunmap_irq(buffer, &flags);
+ } while (mcount);

- if (nsect > mcount)
- nsect = mcount;
- mcount -= nsect;
-
- buffer = bio_kmap_irq(rq->bio, &flags) + ide_rq_offset(rq);
- rq->sector += nsect;
- rq->nr_sectors -= nsect;
- rq->current_nr_sectors -= nsect;
-
- /* Do we move to the next bio after this? */
- if (!rq->current_nr_sectors) {
- /* remember to fix this up /jens */
- struct bio *bio = rq->bio->bi_next;
-
- /* end early if we ran out of requests */
- if (!bio) {
- mcount = 0;
- } else {
- rq->bio = bio;
- rq->current_nr_sectors = bio_iovec(bio)->bv_len >> 9;
- }
- }
+ rq->errors = 0;

- /*
- * Ok, we're all setup for the interrupt re-entering us on the
- * last transfer.
- */
- ata_write(drive, buffer, nsect * SECTOR_WORDS);
- bio_kunmap_irq(buffer, &flags);
- } while (mcount);
-
- rq->errors = 0;
- if (!ch->handler) {
- /* FIXME: this locking should encompass the above register
- * file access too.
- */
+ if (!ch->handler)
+ ata_set_handler(drive, task_mulout_intr, WAIT_CMD, NULL);

- spin_lock_irqsave(ch->lock, flags);
- ata_set_handler(drive, task_mulout_intr, WAIT_CMD, NULL);
- spin_unlock_irqrestore(ch->lock, flags);
+ ret = ide_started;
}
+ spin_unlock_irqrestore(ch->lock, flags);

return ide_started;
}
@@ -571,24 +558,34 @@
*/
static ide_startstop_t idedisk_do_request(struct ata_device *drive, struct request *rq, sector_t block)
{
- /*
- * Wait until all request have bin finished.
- */
+ unsigned long flags;
+ struct ata_channel *ch = drive->channel;
+ int ret;

+ /* make sure all request have bin finished
+ * FIXME: this check doesn't make sense go! */
while (drive->blocked) {
yield();
printk(KERN_ERR "ide: Request while drive blocked?");
}

+ /* FIXME: Move this lock entiery upstream. */
+ spin_lock_irqsave(ch->lock, flags);
+
+ /* FIXME: this check doesn't make sense */
if (!(rq->flags & REQ_CMD)) {
blk_dump_rq_flags(rq, "idedisk_do_request - bad command");
- ide_end_request(drive, rq, 0);
+ __ata_end_request(drive, rq, 0, 0);
+ spin_unlock_irqrestore(ch->lock, flags);
+
return ide_stopped;
}

if (IS_PDC4030_DRIVE) {
extern ide_startstop_t promise_do_request(struct ata_device *, struct request *, sector_t);

+ spin_unlock_irqrestore(drive->channel->lock, flags);
+
return promise_do_request(drive, rq, block);
}

@@ -596,11 +593,8 @@
* start a tagged operation
*/
if (drive->using_tcq) {
- unsigned long flags;
int ret;

- spin_lock_irqsave(drive->channel->lock, flags);
-
ret = blk_queue_start_tag(&drive->queue, rq);

if (ata_pending_commands(drive) > drive->max_depth)
@@ -608,27 +602,27 @@
if (ata_pending_commands(drive) > drive->max_last_depth)
drive->max_last_depth = ata_pending_commands(drive);

- spin_unlock_irqrestore(drive->channel->lock, flags);
-
if (ret) {
BUG_ON(!ata_pending_commands(drive));
+ spin_unlock_irqrestore(ch->lock, flags);
+
return ide_started;
}
}

- /* 48-bit LBA */
if ((drive->id->cfs_enable_2 & 0x0400) && (drive->addressing))
- return lba48_do_request(drive, rq, block);
+ ret = lba48_do_request(drive, rq, block);
+ else if (drive->select.b.lba)
+ ret = lba28_do_request(drive, rq, block);
+ else
+ ret = chs_do_request(drive, rq, block);

- /* 28-bit LBA */
- if (drive->select.b.lba)
- return lba28_do_request(drive, rq, block);
+ spin_unlock_irqrestore(ch->lock, flags);

- /* 28-bit CHS */
- return chs_do_request(drive, rq, block);
+ return ret;
}

-static int idedisk_open (struct inode *inode, struct file *filp, struct ata_device *drive)
+static int idedisk_open(struct inode *inode, struct file *filp, struct ata_device *drive)
{
MOD_INC_USE_COUNT;
if (drive->removable && drive->usage == 1) {
@@ -648,10 +642,11 @@
drive->doorlocking = 0;
}
}
+
return 0;
}

-static int idedisk_flushcache(struct ata_device *drive)
+static int flush_cache(struct ata_device *drive)
{
struct ata_taskfile args;

@@ -661,6 +656,7 @@
args.cmd = WIN_FLUSH_CACHE_EXT;
else
args.cmd = WIN_FLUSH_CACHE;
+
return ide_raw_taskfile(drive, &args);
}

@@ -680,7 +676,7 @@
}
}
if ((drive->id->cfs_enable_2 & 0x3000) && drive->wcache)
- if (idedisk_flushcache(drive))
+ if (flush_cache(drive))
printk (KERN_INFO "%s: Write Cache FAILED Flushing!\n",
drive->name);
MOD_DEC_USE_COUNT;
@@ -1244,15 +1240,27 @@

static int idedisk_cleanup(struct ata_device *drive)
{
+ int ret;
+
if (!drive)
return 0;

- put_device(&drive->device);
- if ((drive->id->cfs_enable_2 & 0x3000) && drive->wcache)
- if (idedisk_flushcache(drive))
+ if ((drive->id->cfs_enable_2 & 0x3000) && drive->wcache) {
+ if (flush_cache(drive))
printk (KERN_INFO "%s: Write Cache FAILED Flushing!\n",
drive->name);
- return ide_unregister_subdriver(drive);
+ }
+ ret = ide_unregister_subdriver(drive);
+
+ /* FIXME: This is killing the kernel with BUG 185 at asm/spinlocks.h
+ * horribly. Check whatever we did REGISTER the device properly
+ * in front?
+ */
+#if 0
+ put_device(&drive->device);
+#endif
+
+ return ret;
}

static int idedisk_ioctl(struct ata_device *drive, struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg)
diff -urN linux-2.5.21/drivers/ide/ide-floppy.c linux/drivers/ide/ide-floppy.c
--- linux-2.5.21/drivers/ide/ide-floppy.c 2002-06-11 02:11:03.000000000 +0200
+++ linux/drivers/ide/ide-floppy.c 2002-06-10 23:58:47.000000000 +0200
@@ -608,7 +608,7 @@
/*
* idefloppy_end_request is used to finish servicing a request.
*
- * For read/write requests, we will call ide_end_request to pass to the
+ * For read/write requests, we will call ata_end_request to pass to the
* next buffer.
*/
static int idefloppy_end_request(struct ata_device *drive, struct request *rq, int uptodate)
@@ -632,7 +632,7 @@
return 0;

if (!(rq->flags & REQ_SPECIAL)) {
- ide_end_request(drive, rq, uptodate);
+ ata_end_request(drive, rq, uptodate);
return 0;
}

@@ -956,9 +956,12 @@
ide_startstop_t startstop;
idefloppy_floppy_t *floppy = drive->driver_data;
idefloppy_ireason_reg_t ireason;
+ int ret;

- if (ide_wait_stat (&startstop, drive, rq, DRQ_STAT, BUSY_STAT, WAIT_READY)) {
+ if (ata_status_poll(drive, DRQ_STAT, BUSY_STAT,
+ WAIT_READY, rq, &startstop)) {
printk (KERN_ERR "ide-floppy: Strange, packet command initiated yet DRQ isn't asserted\n");
+
return startstop;
}

@@ -968,18 +971,18 @@

spin_lock_irqsave(ch->lock, flags);
ireason.all=IN_BYTE (IDE_IREASON_REG);
- if (!ireason.b.cod || ireason.b.io) {
- spin_unlock_irqrestore(ch->lock, flags);

+ if (!ireason.b.cod || ireason.b.io) {
printk (KERN_ERR "ide-floppy: (IO,CoD) != (0,1) while issuing a packet command\n");
- return ide_stopped;
+ ret = ide_stopped;
+ } else {
+ ata_set_handler (drive, idefloppy_pc_intr, IDEFLOPPY_WAIT_CMD, NULL); /* Set the interrupt routine */
+ atapi_write(drive, floppy->pc->c, 12); /* Send the actual packet */
+ ret = ide_started;
}
-
- ata_set_handler (drive, idefloppy_pc_intr, IDEFLOPPY_WAIT_CMD, NULL); /* Set the interrupt routine */
- atapi_write(drive, floppy->pc->c, 12); /* Send the actual packet */
spin_unlock_irqrestore(ch->lock, flags);

- return ide_started;
+ return ret;
}


@@ -1010,39 +1013,43 @@
idefloppy_floppy_t *floppy = drive->driver_data;
ide_startstop_t startstop;
idefloppy_ireason_reg_t ireason;
+ int ret;

- if (ide_wait_stat(&startstop, drive, rq, DRQ_STAT, BUSY_STAT, WAIT_READY)) {
+ if (ata_status_poll(drive, DRQ_STAT, BUSY_STAT,
+ WAIT_READY, rq, &startstop)) {
printk (KERN_ERR "ide-floppy: Strange, packet command initiated yet DRQ isn't asserted\n");
+
return startstop;
}
+
/* FIXME: this locking should encompass the above register
* file access too.
*/

spin_lock_irqsave(ch->lock, flags);
- ireason.all=IN_BYTE (IDE_IREASON_REG);
+ ireason.all=IN_BYTE(IDE_IREASON_REG);
if (!ireason.b.cod || ireason.b.io) {
- spin_unlock_irqrestore(ch->lock, flags);
-
printk (KERN_ERR "ide-floppy: (IO,CoD) != (0,1) while issuing a packet command\n");
- return ide_stopped;
- }
+ ret = ide_stopped;
+ } else {

- /*
- * The following delay solves a problem with ATAPI Zip 100 drives where
- * the Busy flag was apparently being deasserted before the unit was
- * ready to receive data. This was happening on a 1200 MHz Athlon
- * system. 10/26/01 25msec is too short, 40 and 50msec work well.
- * idefloppy_pc_intr will not be actually used until after the packet
- * is moved in about 50 msec.
- */
- ata_set_handler(drive,
- idefloppy_pc_intr, /* service routine for packet command */
- floppy->ticks, /* wait this long before "failing" */
- idefloppy_transfer_pc2); /* fail == transfer_pc2 */
+ /*
+ * The following delay solves a problem with ATAPI Zip 100 drives where
+ * the Busy flag was apparently being deasserted before the unit was
+ * ready to receive data. This was happening on a 1200 MHz Athlon
+ * system. 10/26/01 25msec is too short, 40 and 50msec work well.
+ * idefloppy_pc_intr will not be actually used until after the packet
+ * is moved in about 50 msec.
+ */
+ ata_set_handler(drive,
+ idefloppy_pc_intr, /* service routine for packet command */
+ floppy->ticks, /* wait this long before "failing" */
+ idefloppy_transfer_pc2); /* fail == transfer_pc2 */
+ ret = ide_started;
+ }
spin_unlock_irqrestore(ch->lock, flags);

- return ide_started;
+ return ret;
}

/*
diff -urN linux-2.5.21/drivers/ide/ide-tape.c linux/drivers/ide/ide-tape.c
--- linux-2.5.21/drivers/ide/ide-tape.c 2002-06-11 02:11:03.000000000 +0200
+++ linux/drivers/ide/ide-tape.c 2002-06-11 00:18:38.000000000 +0200
@@ -2196,9 +2196,12 @@
idetape_ireason_reg_t ireason;
int retries = 100;
ide_startstop_t startstop;
+ int ret;

- if (ide_wait_stat(&startstop, drive, rq, DRQ_STAT, BUSY_STAT, WAIT_READY)) {
+ if (ata_status_poll(drive, DRQ_STAT, BUSY_STAT,
+ WAIT_READY, rq, &startstop)) {
printk (KERN_ERR "ide-tape: Strange, packet command initiated yet DRQ isn't asserted\n");
+
return startstop;
}

@@ -2220,16 +2223,16 @@
}
if (!ireason.b.cod || ireason.b.io) {
printk (KERN_ERR "ide-tape: (IO,CoD) != (0,1) while issuing a packet command\n");
- spin_unlock_irqrestore(ch->lock, flags);
-
- return ide_stopped;
+ ret = ide_stopped;
+ } else {
+ tape->cmd_start_time = jiffies;
+ ata_set_handler(drive, idetape_pc_intr, IDETAPE_WAIT_CMD, NULL); /* Set the interrupt routine */
+ atapi_write(drive,pc->c,12); /* Send the actual packet */
+ ret = ide_started;
}
- tape->cmd_start_time = jiffies;
- ata_set_handler(drive, idetape_pc_intr, IDETAPE_WAIT_CMD, NULL); /* Set the interrupt routine */
- atapi_write(drive,pc->c,12); /* Send the actual packet */
spin_unlock_irqrestore(ch->lock, flags);

- return ide_started;
+ return ret;
}

static ide_startstop_t idetape_issue_packet_command(struct ata_device *drive,
@@ -2618,7 +2621,7 @@
* We do not support buffer cache originated requests.
*/
printk (KERN_NOTICE "ide-tape: %s: Unsupported command in request queue (%ld)\n", drive->name, rq->flags);
- ide_end_request(drive, rq, 0); /* Let the common code handle it */
+ ata_end_request(drive, rq, 0); /* Let the common code handle it */
return ide_stopped;
}

diff -urN linux-2.5.21/drivers/ide/ide-taskfile.c linux/drivers/ide/ide-taskfile.c
--- linux-2.5.21/drivers/ide/ide-taskfile.c 2002-06-11 02:11:03.000000000 +0200
+++ linux/drivers/ide/ide-taskfile.c 2002-06-10 23:42:40.000000000 +0200
@@ -233,7 +233,8 @@
ar->cmd == WIN_MULTWRITE_EXT) {
ide_startstop_t startstop;

- if (ide_wait_stat(&startstop, drive, rq, DATA_READY, drive->bad_wstat, WAIT_DRQ)) {
+ if (ata_status_poll(drive, DATA_READY, drive->bad_wstat,
+ WAIT_DRQ, rq, &startstop)) {
printk(KERN_ERR "%s: no DRQ after issuing %s\n",
drive->name, drive->mult_count ? "MULTWRITE" : "WRITE");
return startstop;
diff -urN linux-2.5.21/drivers/ide/main.c linux/drivers/ide/main.c
--- linux-2.5.21/drivers/ide/main.c 2002-06-11 02:11:03.000000000 +0200
+++ linux/drivers/ide/main.c 2002-06-11 02:04:39.000000000 +0200
@@ -430,7 +430,7 @@
struct ata_device *drive = &ch->drives[i];

if (drive->de) {
- devfs_unregister (drive->de);
+ devfs_unregister(drive->de);
drive->de = NULL;
}
if (!drive->present)
@@ -1246,7 +1246,7 @@
return NOTIFY_DONE;
}

- printk("flushing ide devices: ");
+ printk(KERN_INFO "flushing ATA/ATAPI devices: ");

for (i = 0; i < MAX_HWIFS; i++) {
int unit;
@@ -1264,9 +1264,10 @@
/* set the drive to standby */
printk("%s ", drive->name);
if (ata_ops(drive)) {
- if (event != SYS_RESTART)
+ if (event != SYS_RESTART) {
if (ata_ops(drive)->standby && ata_ops(drive)->standby(drive))
continue;
+ }

if (ata_ops(drive)->cleanup)
ata_ops(drive)->cleanup(drive);
@@ -1290,8 +1291,7 @@
{
printk(KERN_INFO "ATA/ATAPI device driver v" VERSION "\n");

- ide_devfs_handle = devfs_mk_dir(NULL, "ata", NULL);
- devfs_mk_symlink(NULL, "ide", DEVFS_FL_DEFAULT, "ata", NULL, NULL);
+ ide_devfs_handle = devfs_mk_dir(NULL, "ide", NULL);

/*
* Because most of the ATA adapters represent the timings in unit of
diff -urN linux-2.5.21/drivers/ide/pcidma.c linux/drivers/ide/pcidma.c
--- linux-2.5.21/drivers/ide/pcidma.c 2002-06-11 02:11:03.000000000 +0200
+++ linux/drivers/ide/pcidma.c 2002-06-10 03:24:16.000000000 +0200
@@ -44,7 +44,17 @@

if (ata_status(drive, DRIVE_READY, drive->bad_wstat | DRQ_STAT)) {
if (!dma_stat) {
- __ide_end_request(drive, rq, 1, rq->nr_sectors);
+ unsigned long flags;
+ struct ata_channel *ch = drive->channel;
+
+ /* FIXME: this locking should encompass the above register
+ * file access too.
+ */
+
+ spin_lock_irqsave(ch->lock, flags);
+ __ata_end_request(drive, rq, 1, rq->nr_sectors);
+ spin_unlock_irqrestore(ch->lock, flags);
+
return ide_stopped;
}
printk(KERN_ERR "%s: dma_intr: bad DMA status (dma_stat=%x)\n",
diff -urN linux-2.5.21/drivers/ide/pdc4030.c linux/drivers/ide/pdc4030.c
--- linux-2.5.21/drivers/ide/pdc4030.c 2002-06-11 02:11:07.000000000 +0200
+++ linux/drivers/ide/pdc4030.c 2002-06-10 23:47:13.000000000 +0200
@@ -247,7 +247,8 @@
if (pdc4030_cmd(drive, PROMISE_GET_CONFIG)) {
return 0;
}
- if (ide_wait_stat(&startstop, drive, NULL, DATA_READY,BAD_W_STAT,WAIT_DRQ)) {
+ if (ata_status_poll(drive, DATA_READY, BAD_W_STAT,
+ WAIT_DRQ, NULL, &startstop)) {
printk(KERN_INFO
"%s: Failed Promise read config!\n",hwif->name);
return 0;
@@ -407,7 +408,8 @@
rq->nr_sectors -= nsect;
total_remaining = rq->nr_sectors;
if ((rq->current_nr_sectors -= nsect) <= 0) {
- ide_end_request(drive, rq, 1);
+ /* FIXME: no queue locking above! */
+ ata_end_request(drive, rq, 1);
}

/*
@@ -461,13 +463,11 @@
*/
static ide_startstop_t promise_complete_pollfunc(struct ata_device *drive, struct request *rq)
{
+ unsigned long flags;
struct ata_channel *ch = drive->channel;

if (!ata_status(drive, 0, BUSY_STAT)) {
if (time_before(jiffies, ch->poll_timeout)) {
- unsigned long flags;
- struct ata_channel *ch = drive->channel;
-
/* FIXME: this locking should encompass the above
* register file access too.
*/
@@ -488,7 +488,13 @@
#ifdef DEBUG_WRITE
printk(KERN_DEBUG "%s: Write complete - end_request\n", drive->name);
#endif
- __ide_end_request(drive, rq, 1, rq->nr_sectors);
+ /* FIXME: this locking should encompass the above
+ * register file access too.
+ */
+
+ spin_lock_irqsave(ch->lock, flags);
+ __ata_end_request(drive, rq, 1, rq->nr_sectors);
+ spin_unlock_irqrestore(ch->lock, flags);

return ide_stopped;
}
@@ -653,7 +659,7 @@
/* Check that it's a regular command. If not, bomb out early. */
if (!(rq->flags & REQ_CMD)) {
blk_dump_rq_flags(rq, "pdc4030 bad flags");
- ide_end_request(drive, rq, 0);
+ ata_end_request(drive, rq, 0);

return ide_stopped;
}
@@ -721,7 +727,8 @@
* call the promise_write function to deal with writing the data out
* NOTE: No interrupts are generated on writes. Write completion must be polled
*/
- if (ide_wait_stat(&startstop, drive, rq, DATA_READY, drive->bad_wstat, WAIT_DRQ)) {
+ if (ata_status_poll(drive, DATA_READY, drive->bad_wstat,
+ WAIT_DRQ, rq, &startstop )) {
printk(KERN_ERR "%s: no DRQ after issuing "
"PROMISE_WRITE\n", drive->name);
return startstop;
@@ -733,7 +740,8 @@

default:
printk(KERN_ERR "pdc4030: command not READ or WRITE! Huh?\n");
- ide_end_request(drive, rq, 0);
+ /* FIXME: This should already run under the lock. */
+ ata_end_request(drive, rq, 0);
return ide_stopped;
}
}
diff -urN linux-2.5.21/drivers/ide/probe.c linux/drivers/ide/probe.c
--- linux-2.5.21/drivers/ide/probe.c 2002-06-09 07:26:25.000000000 +0200
+++ linux/drivers/ide/probe.c 2002-06-11 00:18:00.000000000 +0200
@@ -307,16 +307,7 @@
(drive->id->hw_config & 0x6000)) ? 1 : 0);
}

-/*
- * Similar to ide_wait_stat(), except it never calls ata_error internally.
- * This is a kludge to handle the new ide_config_drive_speed() function,
- * and should not otherwise be used anywhere. Eventually, the tuneproc's
- * should be updated to return ide_startstop_t, in which case we can get
- * rid of this abomination again. :) -ml
- *
- * It is gone..........
- *
- * const char *msg == consider adding for verbose errors.
+/* FIXME: Channel lock should be held.
*/
int ide_config_drive_speed(struct ata_device *drive, byte speed)
{
@@ -329,12 +320,10 @@
outb(inb(ch->dma_base + 2) & ~(1 << (5 + unit)), ch->dma_base + 2);
#endif

- /*
- * Don't use ide_wait_cmd here - it will attempt to set_geometry and
+ /* Don't use ide_wait_cmd here - it will attempt to set_geometry and
* recalibrate, but for some reason these don't work at this point
* (lost interrupt).
- */
- /*
+ *
* Select the drive, and issue the SETFEATURES command
*/
disable_irq(ch->irq); /* disable_irq_nosync ?? */
@@ -350,20 +339,7 @@
ata_irq_enable(drive, 1);
udelay(1);

- /*
- * Wait for drive to become non-BUSY
- */
- if (!ata_status(drive, 0, BUSY_STAT)) {
- unsigned long flags, timeout;
- __save_flags(flags); /* local CPU only */
- ide__sti(); /* local CPU only -- for jiffies */
- timeout = jiffies + WAIT_CMD;
- while (!ata_status(drive, 0, BUSY_STAT)) {
- if (time_after(jiffies, timeout))
- break;
- }
- __restore_flags(flags); /* local CPU only */
- }
+ ata_busy_poll(drive, WAIT_CMD);

/*
* Allow status to settle, then read it again.
diff -urN linux-2.5.21/drivers/ide/tcq.c linux/drivers/ide/tcq.c
--- linux-2.5.21/drivers/ide/tcq.c 2002-06-11 02:11:07.000000000 +0200
+++ linux/drivers/ide/tcq.c 2002-06-10 03:25:55.000000000 +0200
@@ -327,6 +327,8 @@

static ide_startstop_t dmaq_complete(struct ata_device *drive, struct request *rq)
{
+ unsigned long flags;
+ struct ata_channel *ch = drive->channel;
u8 dma_stat;

/*
@@ -348,7 +350,14 @@
printk("%s: bad DMA status (dma_stat=%x)\n", drive->name, dma_stat);

TCQ_PRINTK("%s: ending %p, tag %d\n", __FUNCTION__, rq, rq->tag);
- __ide_end_request(drive, rq, !dma_stat, rq->nr_sectors);
+
+ /* FIXME: this locking should encompass the above register
+ * file access too.
+ */
+
+ spin_lock_irqsave(ch->lock, flags);
+ __ata_end_request(drive, rq, !dma_stat, rq->nr_sectors);
+ spin_unlock_irqrestore(ch->lock, flags);

/*
* we completed this command, check if we can service a new command
diff -urN linux-2.5.21/drivers/scsi/ide-scsi.c linux/drivers/scsi/ide-scsi.c
--- linux-2.5.21/drivers/scsi/ide-scsi.c 2002-06-11 02:11:07.000000000 +0200
+++ linux/drivers/scsi/ide-scsi.c 2002-06-10 23:54:50.000000000 +0200
@@ -244,7 +244,7 @@
unsigned long flags;

if (!(rq->flags & REQ_PC)) {
- ide_end_request(drive, rq, uptodate);
+ ata_end_request(drive, rq, uptodate);
return 0;
}

@@ -399,29 +399,33 @@
struct Scsi_Host *host = drive->driver_data;
idescsi_scsi_t *scsi = idescsi_private(host);
struct atapi_packet_command *pc = scsi->pc;
- byte ireason;
+ u8 ireason;
ide_startstop_t startstop;
+ int ret;

- if (ide_wait_stat(&startstop, drive, rq, DRQ_STAT, BUSY_STAT, WAIT_READY)) {
+ if (ata_status_poll(drive, DRQ_STAT, BUSY_STAT,
+ WAIT_READY, rq, &startstop)) {
printk (KERN_ERR "ide-scsi: Strange, packet command initiated yet DRQ isn't asserted\n");
return startstop;
}
- ireason = IN_BYTE (IDE_IREASON_REG);
- if ((ireason & (IDESCSI_IREASON_IO | IDESCSI_IREASON_COD)) != IDESCSI_IREASON_COD) {
- printk (KERN_ERR "ide-scsi: (IO,CoD) != (0,1) while issuing a packet command\n");
- return ide_stopped;
- }

/* FIXME: this locking should encompass the above register
* file access too.
*/
-
spin_lock_irqsave(ch->lock, flags);
- ata_set_handler(drive, idescsi_pc_intr, get_timeout(pc), NULL); /* Set the interrupt routine */
+ ireason = IN_BYTE(IDE_IREASON_REG);
+
+ if ((ireason & (IDESCSI_IREASON_IO | IDESCSI_IREASON_COD)) != IDESCSI_IREASON_COD) {
+ printk (KERN_ERR "ide-scsi: (IO,CoD) != (0,1) while issuing a packet command\n");
+ ret = ide_stopped;
+ } else {
+ ata_set_handler(drive, idescsi_pc_intr, get_timeout(pc), NULL);
+ atapi_write(drive, scsi->pc->c, 12);
+ ret = ide_started;
+ }
spin_unlock_irqrestore(ch->lock, flags);

- atapi_write(drive, scsi->pc->c, 12); /* Send the actual packet */
- return ide_started;
+ return ret;
}

/*
diff -urN linux-2.5.21/include/linux/ide.h linux/include/linux/ide.h
--- linux-2.5.21/include/linux/ide.h 2002-06-11 02:11:07.000000000 +0200
+++ linux/include/linux/ide.h 2002-06-11 00:17:30.000000000 +0200
@@ -601,8 +601,9 @@
#define LOCAL_END_REQUEST /* Don't generate end_request in blk.h */
#include <linux/blk.h>

-extern int __ide_end_request(struct ata_device *, struct request *, int, unsigned int);
-extern int ide_end_request(struct ata_device *drive, struct request *, int);
+/* Not locking and locking variant: */
+extern int __ata_end_request(struct ata_device *, struct request *, int, unsigned int);
+extern int ata_end_request(struct ata_device *drive, struct request *, int);

extern void ata_set_handler(struct ata_device *drive, ata_handler_t handler,
unsigned long timeout, ata_expiry_t expiry);
@@ -611,11 +612,6 @@
extern ide_startstop_t ata_error(struct ata_device *, struct request *rq, const char *);

extern void ide_fixstring(char *s, const int bytecount, const int byteswap);
-
-extern int ide_wait_stat(ide_startstop_t *,
- struct ata_device *, struct request *rq,
- byte, byte, unsigned long);
-
extern int ide_wait_noerr(struct ata_device *, byte, byte, unsigned long);

/*
@@ -831,7 +827,11 @@

extern void ata_select(struct ata_device *, unsigned long);
extern void ata_mask(struct ata_device *);
+extern int ata_busy_poll(struct ata_device *, unsigned long);
extern int ata_status(struct ata_device *, u8, u8);
+extern int ata_status_poll( struct ata_device *, u8, u8,
+ unsigned long, struct request *rq, ide_startstop_t *);
+
extern int ata_irq_enable(struct ata_device *, int);
extern void ata_reset(struct ata_channel *);
extern void ata_out_regfile(struct ata_device *, struct hd_drive_task_hdr *);


Attachments:
ide-clean-87.diff (51.10 kB)

2002-06-11 08:02:58

by Ingo Oeser

[permalink] [raw]
Subject: Re: [PATCH] 2.5.21 kill warinigs 14/19

On Mon, Jun 10, 2002 at 01:45:27PM +0200, Martin Dalecki wrote:
> irlap_frame this time. Let me guess they used emacs?!

The better way to solve this is to include:

/*
* Overrides for Emacs so that we follow Linus's tabbing style.
* Emacs will notice this stuff at the end of the file and automatically
* adjust the settings for this buffer only. This must remain at the end
* of the file.
* ---------------------------------------------------------------------------
* Local variables:
* c-indent-level: 8
* c-brace-imaginary-offset: 0
* c-brace-offset: -8
* c-argdecl-indent: 8
* c-label-offset: -8
* c-continued-statement-offset: 8
* c-continued-brace-offset: 0
* End:
*/

at the end of each file these people who cannot use their editor touch.

That's how I solved it with my own team mates ;-)

Regards

Ingo Oeser
--
Science is what we can tell a computer. Art is everything else. --- D.E.Knuth

2002-06-11 08:07:46

by Martin Dalecki

[permalink] [raw]
Subject: Re: [PATCH] 2.5.21 kill warinigs 14/19

U?ytkownik Ingo Oeser napisa?:
> On Mon, Jun 10, 2002 at 01:45:27PM +0200, Martin Dalecki wrote:
>
>>irlap_frame this time. Let me guess they used emacs?!
>
>
> The better way to solve this is to include:
>
> /*
> * Overrides for Emacs so that we follow Linus's tabbing style.
> * Emacs will notice this stuff at the end of the file and automatically
> * adjust the settings for this buffer only. This must remain at the end
> * of the file.
> * ---------------------------------------------------------------------------
> * Local variables:
> * c-indent-level: 8
> * c-brace-imaginary-offset: 0
> * c-brace-offset: -8
> * c-argdecl-indent: 8
> * c-label-offset: -8
> * c-continued-statement-offset: 8
> * c-continued-brace-offset: 0
> * End:
> */
>
> at the end of each file these people who cannot use their editor touch.
>
> That's how I solved it with my own team mates ;-)

And it's the best way to annoy everybody who know how to use a proper
programmers editor, aka gvim, too... This is becouse it doesn't
show how to hightlight trailing white space garbage. (Hint GVIM
handles it beautifully :-)

2002-06-11 08:26:46

by Russell King

[permalink] [raw]
Subject: Re: [PATCH] 2.5.21 kill warnings 4/19

On Tue, Jun 11, 2002 at 08:33:18AM +0200, Martin Dalecki wrote:
> 6. In esp. ARM seems to be much better off with GCC 3.1 then anything else.

Not yet proven. Only a minority of people are using gcc 3.1 compared
to gcc 2.95.x to build ARM kernels currently.

We've already found a few things that need changing in 2.5 (which haven't
been updated in 2.4 yet) that are needed for gcc 3.1 to build the kernel
properly.

--
Russell King ([email protected]) The developer of ARM Linux
http://www.arm.linux.org.uk/personal/aboutme.html

2002-06-11 08:34:53

by Martin Dalecki

[permalink] [raw]
Subject: Re: [PATCH] 2.5.21 kill warnings 4/19

U?ytkownik Russell King napisa?:
> On Tue, Jun 11, 2002 at 08:33:18AM +0200, Martin Dalecki wrote:
>
>>6. In esp. ARM seems to be much better off with GCC 3.1 then anything else.
>
>
> Not yet proven. Only a minority of people are using gcc 3.1 compared

Few +1. However this was the first "official" release which
was "working out of the box". Well at least for me.

2002-06-11 09:06:43

by Russell King

[permalink] [raw]
Subject: Re: [PATCH] 2.5.21 kill warnings 4/19

On Tue, Jun 11, 2002 at 10:34:39AM +0200, Martin Dalecki wrote:
> U?ytkownik Russell King napisa?:
> > On Tue, Jun 11, 2002 at 08:33:18AM +0200, Martin Dalecki wrote:
> >
> >>6. In esp. ARM seems to be much better off with GCC 3.1 then anything else.
> >
> >
> > Not yet proven. Only a minority of people are using gcc 3.1 compared
>
> Few +1. However this was the first "official" release which
> was "working out of the box". Well at least for me.

GCC 2.95.3, +4 both work with a patch from Phil Blundell, as detailed
in the build instructions for these versions.

GCC 3.x introduces the dodgy practice of removing the frame pointer
from every function despite telling the compiler not to with
-fno-omit-frame-pointer. It's also contary to the GCC documentation
when it interferes with debugging.

Overall, using gcc 3.1 causes the following problems in _any_ kernel:

1. crashes when things like knfsd and other kernel daemons exit.
2. you can't get a call trace from the kernel.

For anyone, I'd recommend using gcc 2.95.[34] for building a kernel that
should be stable and can be trusted. gcc 3.x is still very experimental
afaiac. We're still finding its quirks.

--
Russell King ([email protected]) The developer of ARM Linux
http://www.arm.linux.org.uk/personal/aboutme.html

2002-06-11 09:10:00

by Martin Dalecki

[permalink] [raw]
Subject: Re: [PATCH] 2.5.21 kill warnings 4/19

U?ytkownik Russell King napisa?:

> GCC 3.x introduces the dodgy practice of removing the frame pointer
> from every function despite telling the compiler not to with
> -fno-omit-frame-pointer. It's also contary to the GCC documentation
> when it interferes with debugging.

This can not be true - since otherwise task switching wouldn't work
at all!

2002-06-11 09:29:06

by Russell King

[permalink] [raw]
Subject: Re: [PATCH] 2.5.21 kill warnings 4/19

On Tue, Jun 11, 2002 at 11:09:47AM +0200, Martin Dalecki wrote:
> U?ytkownik Russell King napisa?:
> > GCC 3.x introduces the dodgy practice of removing the frame pointer
> > from every function despite telling the compiler not to with
> > -fno-omit-frame-pointer. It's also contary to the GCC documentation
> > when it interferes with debugging.
>
> This can not be true - since otherwise task switching wouldn't work
> at all!

It is indeed true. From your comment, it looks like you don't understand
the ARM architecture/what a frame pointer is.

--
Russell King ([email protected]) The developer of ARM Linux
http://www.arm.linux.org.uk/personal/aboutme.html

2002-06-11 09:43:00

by Martin Dalecki

[permalink] [raw]
Subject: Re: [PATCH] 2.5.21 kill warnings 4/19

U?ytkownik Russell King napisa?:
> On Tue, Jun 11, 2002 at 11:09:47AM +0200, Martin Dalecki wrote:
>
>>U?ytkownik Russell King napisa?:
>>
>>>GCC 3.x introduces the dodgy practice of removing the frame pointer
>>>from every function despite telling the compiler not to with
>>>-fno-omit-frame-pointer. It's also contary to the GCC documentation
>>>when it interferes with debugging.
>>
>>This can not be true - since otherwise task switching wouldn't work
>>at all!
>
>
> It is indeed true. From your comment, it looks like you don't understand
> the ARM architecture/what a frame pointer is.

Well I surely understand what a pointer to the local variable set is.
I know pascal and gdb well enough :-). However what I may have
missed is that ARM is using some other task switch mechanism.
I would be courious to see what it is?

2002-06-11 10:36:41

by Russell King

[permalink] [raw]
Subject: Re: [PATCH] 2.5.21 kill warnings 4/19

On Tue, Jun 11, 2002 at 11:42:51AM +0200, Martin Dalecki wrote:
> Well I surely understand what a pointer to the local variable set is.
> I know pascal and gdb well enough :-). However what I may have
> missed is that ARM is using some other task switch mechanism.
> I would be courious to see what it is?

Frame pointer - used to reference the function return state, and function
arguments. Optional.

Stack pointer - used to reference the function local variables. In the
absence of the frame pointer, this is also used to reference the function
return state and the function arguments.

As you can see, it has nothing to do with task switch mechanisms.

I suggest you revise your "pascal and gdb" and "task switch mechanism"
knowledge. I don't believe ARM is special in doing the above. In fact,
the above is probably very common indeed.

--
Russell King ([email protected]) The developer of ARM Linux
http://www.arm.linux.org.uk/personal/aboutme.html

2002-06-11 11:59:50

by Dave Jones

[permalink] [raw]
Subject: Re: [PATCH] 2.5.21 kill warinigs 14/19

On Mon, Jun 10, 2002 at 08:47:26PM +0200, Ingo Oeser wrote:
> The better way to solve this is to include:
>
> <snip lots of emacsisms>
>
> That's how I solved it with my own team mates ;-)

Without trying to degrade this into an editor troll,
those emacsisms solve 1 thing only. They allow other
emacs users to see the code as it should be.

Unfortunatly, they do bugger all in other editors,
or in tools such as diff, which leads to some
wierd looking patches at times.

sidenote: I've lost count how many times I've found
trivial bugs just by changing the indentation[*] and spotting
misplaced brackets.

Dave.

[*] To that that matches CodingStyle.

--
| Dave Jones. http://www.codemonkey.org.uk
| SuSE Labs

2002-06-11 19:09:06

by John Weber

[permalink] [raw]
Subject: Re: [PATCH] 2.5.21 IDE 87

Martin Dalecki wrote:
> Sun Jun 9 15:31:56 CEST 2002 ide-clean-87
>
> - Sync with 2.5.21
>
> - Don't call put_device inside idedisk_cleanup(). This is apparently
> triggering
> some bug inside the handling of device trees. Or we don't register the
> device
> properly within the tree. Check this later.
>
> - Further work on the channel register file access locking. Push the
> locking
> out from __ide_end_request to ide_end_request. Rename those functions to
> respective __ata_end_request() and ata_end_request().
>
> - Move ide_wait_status to device.c rename it to ata_status_poll().
>
> - Further work on locking scope issues.
>
> - devfs showed us once again that it changed the policy from agnostic
> numbers
> to unpleasant string names. What a piece of crap!

FYI, this latest cleanup fixes the oops I reported earlier...
not that anyone cared :).

flushing ide devices: hda <1> Unable to handle kernel NULL pointer at
address 00000004
*pde = 000000
Oops: 0002
CPU: 0
EIP: 0010:[<c01a692c>] Not tainted
Using defaults from ksymoops -t elf32-i386 -a i386
EFLAGS: 00010202
eax: c03077d0 ebx: c03077b8 ecx: 00000000 edx: 00000000
esi: c258e000 edi: c029ef40 ebp: c030766c esp: c258fe40
ds: 0018 es: 0018 ss: 0018
Stack: c030766c c03077b8 c0307540 00000001 c01a6d24 c03077b8 c0295788
c030766c
c01eaf9e c03077b8 c0307540 c0307540 c01e271f c030766c c0307670
c029e9cc
00000000 00000003 bffffcd8 c0122fdd c029e9cc 00000003 00000000
4321fedc
Call Trace: [<c01a6d24>] [<c01eaf9d>] [<c01e271f>] [<c0122fdd>] [<c0123576>]
[<c011331e>] [<c0121413>] [<c01217fe>] [<c0122438>]
[<c01512e0>] [<c013e01a>]
[<c013c373>] [<c013c422>] [<c010740f>]
Code: 89 4a 04 89 11 89 40 04 89 43 18 ff 4e 10 8b 46 08 83 e0 08

-o) J o h n W e b e r
/\\ [email protected]
_\/v http://www.linuxhq.com/people/weber/

2002-06-11 19:33:36

by Pavel Machek

[permalink] [raw]
Subject: Re: [PATCH] 2.5.21 kill warnings 4/19

Hi!!

> printk("i2c-core.o: while "
> "unregistering driver "
> "%s' could not
> - be detached; driver
> - not unloaded!",
> + "address %02x of "
> + "adapter

2002-06-12 07:00:44

by Martin Dalecki

[permalink] [raw]
Subject: Re: [PATCH] 2.5.21 IDE 87

U?ytkownik John Weber napisa?:
> Martin Dalecki wrote:
>
>> Sun Jun 9 15:31:56 CEST 2002 ide-clean-87
>>
>> - Sync with 2.5.21
>>
>> - Don't call put_device inside idedisk_cleanup(). This is apparently
>> triggering
>> some bug inside the handling of device trees. Or we don't register
>> the device
>> properly within the tree. Check this later.
>>
>> - Further work on the channel register file access locking. Push the
>> locking
>> out from __ide_end_request to ide_end_request. Rename those
>> functions to
>> respective __ata_end_request() and ata_end_request().
>>
>> - Move ide_wait_status to device.c rename it to ata_status_poll().
>>
>> - Further work on locking scope issues.
>>
>> - devfs showed us once again that it changed the policy from agnostic
>> numbers
>> to unpleasant string names. What a piece of crap!
>
>
> FYI, this latest cleanup fixes the oops I reported earlier...
> not that anyone cared :).

Please just don't expect an e-mail reply on every single
error report. Me beeing silent means sometimes that I'm just busy
fixing it...

2002-06-12 10:50:31

by Martin Dalecki

[permalink] [raw]
Subject: [PATCH] 2.5.21 inline abuse...

diff -urN linux-2.5.21/drivers/block/elevator.c linux/drivers/block/elevator.c
--- linux-2.5.21/drivers/block/elevator.c 2002-06-09 07:31:17.000000000 +0200
+++ linux/drivers/block/elevator.c 2002-06-12 12:13:53.000000000 +0200
@@ -378,18 +378,36 @@
e->elevator_merge_req_fn(rq, next);
}

-/*
- * add_request and next_request are required to be supported, naturally
- */
-void __elv_add_request(request_queue_t *q, struct request *rq,
- struct list_head *insert_here)
+struct request *elv_next_request(request_queue_t *q)
{
- q->elevator.elevator_add_req_fn(q, rq, insert_here);
-}
+ struct request *rq;

-struct request *__elv_next_request(request_queue_t *q)
-{
- return q->elevator.elevator_next_req_fn(q);
+ while ((rq = q->elevator.elevator_next_req_fn(q))) {
+ rq->flags |= REQ_STARTED;
+
+ if (&rq->queuelist == q->last_merge)
+ q->last_merge = NULL;
+
+ if ((rq->flags & REQ_DONTPREP) || !q->prep_rq_fn)
+ break;
+
+ /*
+ * all ok, break and return it
+ */
+ if (!q->prep_rq_fn(q, rq))
+ break;
+
+ /*
+ * prep said no-go, kill it
+ */
+ blkdev_dequeue_request(rq);
+ if (end_that_request_first(rq, 0, rq->nr_sectors))
+ BUG();
+
+ end_that_request_last(rq);
+ }
+
+ return rq;
}

void elv_remove_request(request_queue_t *q, struct request *rq)
@@ -421,6 +439,5 @@
EXPORT_SYMBOL(elevator_linus);
EXPORT_SYMBOL(elevator_noop);

-EXPORT_SYMBOL(__elv_add_request);
-EXPORT_SYMBOL(__elv_next_request);
+EXPORT_SYMBOL(elv_next_request);
EXPORT_SYMBOL(elv_remove_request);
diff -urN linux-2.5.21/drivers/block/ll_rw_blk.c linux/drivers/block/ll_rw_blk.c
--- linux-2.5.21/drivers/block/ll_rw_blk.c 2002-06-09 07:27:22.000000000 +0200
+++ linux/drivers/block/ll_rw_blk.c 2002-06-12 12:15:54.000000000 +0200
@@ -1110,7 +1110,7 @@
* Get a free request. queue lock must be held and interrupts
* disabled on the way in.
*/
-static inline struct request *get_request(request_queue_t *q, int rw)
+static struct request *get_request(request_queue_t *q, int rw)
{
struct request *rq = NULL;
struct request_list *rl = q->rq + rw;
@@ -1233,16 +1233,15 @@
* queue lock is held and interrupts disabled, as we muck with the
* request queue list.
*/
-static inline void add_request(request_queue_t * q, struct request * req,
+static inline void add_request(request_queue_t * q, struct request * rq,
struct list_head *insert_here)
{
- drive_stat_acct(req, req->nr_sectors, 1);
+ drive_stat_acct(rq, rq->nr_sectors, 1);

- /*
- * elevator indicated where it wants this request to be
- * inserted at elevator_merge time
+ /* Elevator indicated where it wants this request to be
+ * inserted at elevator_merge time.
*/
- __elv_add_request(q, req, insert_here);
+ q->elevator.elevator_add_req_fn(q, rq, insert_here);
}

/*
@@ -1816,7 +1815,7 @@
extern int stram_device_init (void);
#endif

-inline void blk_recalc_rq_segments(struct request *rq)
+void blk_recalc_rq_segments(struct request *rq)
{
struct bio *bio;
int nr_phys_segs, nr_hw_segs;
@@ -1836,7 +1835,7 @@
rq->nr_hw_segments = nr_hw_segs;
}

-inline void blk_recalc_rq_sectors(struct request *rq, int nsect)
+void blk_recalc_rq_sectors(struct request *rq, int nsect)
{
if (rq->flags & REQ_CMD) {
rq->hard_sector += nsect;
diff -urN linux-2.5.21/fs/binfmt_elf.c linux/fs/binfmt_elf.c
--- linux-2.5.21/fs/binfmt_elf.c 2002-06-09 07:29:40.000000000 +0200
+++ linux/fs/binfmt_elf.c 2002-06-12 09:31:44.000000000 +0200
@@ -44,8 +44,8 @@

static int load_elf_binary(struct linux_binprm * bprm, struct pt_regs * regs);
static int load_elf_library(struct file*);
-static unsigned long elf_map (struct file *, unsigned long, struct elf_phdr *, int, int);
-extern int dump_fpu (struct pt_regs *, elf_fpregset_t *);
+static unsigned long elf_map(struct file *, unsigned long, struct elf_phdr *, int, int);
+extern int dump_fpu(struct pt_regs *, elf_fpregset_t *);
extern void dump_thread(struct pt_regs *, struct user *);

#ifndef elf_addr_t
@@ -241,9 +241,8 @@
}

#ifndef elf_map
-
-static inline unsigned long
-elf_map (struct file *filep, unsigned long addr, struct elf_phdr *eppnt, int prot, int type)
+static unsigned long
+elf_map(struct file *filep, unsigned long addr, struct elf_phdr *eppnt, int prot, int type)
{
unsigned long map_addr;

@@ -254,8 +253,7 @@
up_write(&current->mm->mmap_sem);
return(map_addr);
}
-
-#endif /* !elf_map */
+#endif

/* This is much more generalized than the library routine read function,
so we keep this separate. Technically the library read function
@@ -319,11 +317,11 @@
if (eppnt->p_flags & PF_X) elf_prot |= PROT_EXEC;
vaddr = eppnt->p_vaddr;
if (interp_elf_ex->e_type == ET_EXEC || load_addr_set)
- elf_type |= MAP_FIXED;
+ elf_type |= MAP_FIXED;

map_addr = elf_map(interpreter, load_addr + vaddr, eppnt, elf_prot, elf_type);
if (BAD_ADDR(map_addr))
- goto out_close;
+ goto out_close;

if (!load_addr_set && interp_elf_ex->e_type == ET_DYN) {
load_addr = map_addr - ELF_PAGESTART(vaddr);
@@ -917,7 +915,7 @@
*
* I think we should skip something. But I am not sure how. H.J.
*/
-static inline int maydump(struct vm_area_struct *vma)
+static int maydump(struct vm_area_struct *vma)
{
/*
* If we may not read the contents, don't allow us to dump
diff -urN linux-2.5.21/fs/block_dev.c linux/fs/block_dev.c
--- linux-2.5.21/fs/block_dev.c 2002-06-09 07:30:05.000000000 +0200
+++ linux/fs/block_dev.c 2002-06-12 10:21:12.000000000 +0200
@@ -347,7 +347,7 @@
return bdev;
}

-static inline void __bd_forget(struct inode *inode)
+static void __bd_forget(struct inode *inode)
{
list_del_init(&inode->i_devices);
inode->i_bdev = NULL;
diff -urN linux-2.5.21/fs/dcache.c linux/fs/dcache.c
--- linux-2.5.21/fs/dcache.c 2002-06-09 07:27:28.000000000 +0200
+++ linux/fs/dcache.c 2002-06-12 09:35:20.000000000 +0200
@@ -54,7 +54,7 @@
struct dentry_stat_t dentry_stat = {0, 0, 45, 0,};

/* no dcache_lock, please */
-static inline void d_free(struct dentry *dentry)
+static void d_free(struct dentry *dentry)
{
if (dentry->d_op && dentry->d_op->d_release)
dentry->d_op->d_release(dentry);
@@ -69,7 +69,7 @@
* d_iput() operation if defined.
* Called with dcache_lock held, drops it.
*/
-static inline void dentry_iput(struct dentry * dentry)
+static void dentry_iput(struct dentry * dentry)
{
struct inode *inode = dentry->d_inode;
if (inode) {
@@ -213,7 +213,7 @@

/* This should be called _only_ with dcache_lock held */

-static inline struct dentry * __dget_locked(struct dentry *dentry)
+static struct dentry * __dget_locked(struct dentry *dentry)
{
atomic_inc(&dentry->d_count);
if (atomic_read(&dentry->d_count) == 1) {
@@ -298,7 +298,7 @@
* removed.
* Called with dcache_lock, drops it and then regains.
*/
-static inline void prune_one_dentry(struct dentry * dentry)
+static void prune_one_dentry(struct dentry * dentry)
{
struct dentry * parent;

@@ -717,7 +717,7 @@
return res;
}

-static inline struct list_head * d_hash(struct dentry * parent, unsigned long hash)
+static struct list_head * d_hash(struct dentry * parent, unsigned long hash)
{
hash += (unsigned long) parent / L1_CACHE_BYTES;
hash = hash ^ (hash >> D_HASHBITS);
@@ -1006,7 +1006,7 @@
* then no longer matches the actual (corrupted) string of the target.
* The hash value has to match the hash queue that the dentry is on..
*/
-static inline void switch_names(struct dentry * dentry, struct dentry * target)
+static void switch_names(struct dentry * dentry, struct dentry * target)
{
const unsigned char *old_name, *new_name;

diff -urN linux-2.5.21/fs/locks.c linux/fs/locks.c
--- linux-2.5.21/fs/locks.c 2002-06-09 07:29:12.000000000 +0200
+++ linux/fs/locks.c 2002-06-12 09:39:52.000000000 +0200
@@ -153,7 +153,7 @@
}

/* Free a lock which is not in use. */
-static inline void locks_free_lock(struct file_lock *fl)
+static void locks_free_lock(struct file_lock *fl)
{
if (fl == NULL) {
BUG();
@@ -501,7 +501,7 @@
* notify the FS that the lock has been cleared and
* finally free the lock.
*/
-static inline void _delete_lock(struct file_lock *fl)
+static void _delete_lock(struct file_lock *fl)
{
fasync_helper(0, fl->fl_file, 0, &fl->fl_fasync);
if (fl->fl_fasync != NULL){
diff -urN linux-2.5.21/fs/namei.c linux/fs/namei.c
--- linux-2.5.21/fs/namei.c 2002-06-09 07:28:50.000000000 +0200
+++ linux/fs/namei.c 2002-06-12 11:10:31.000000000 +0200
@@ -280,7 +280,7 @@
}

/*for fastwalking*/
-static inline void unlock_nd(struct nameidata *nd)
+static void unlock_nd(struct nameidata *nd)
{
struct vfsmount *mnt = nd->old_mnt;
struct dentry *dentry = nd->old_dentry;
@@ -293,7 +293,7 @@
mntput(mnt);
}

-static inline void lock_nd(struct nameidata *nd)
+static void lock_nd(struct nameidata *nd)
{
spin_lock(&dcache_lock);
nd->old_mnt = nd->mnt;
@@ -391,7 +391,7 @@
* Without that kind of total limit, nasty chains of consecutive
* symlinks can cause almost arbitrarily long lookups.
*/
-static inline int do_follow_link(struct dentry *dentry, struct nameidata *nd)
+static int do_follow_link(struct dentry *dentry, struct nameidata *nd)
{
int err;
if (current->link_count >= 5)
@@ -399,7 +399,7 @@
if (current->total_link_count >= 40)
goto loop;
if (need_resched()) {
- current->state = TASK_RUNNING;
+ set_current_state(TASK_RUNNING);
schedule();
}
current->link_count++;
@@ -447,7 +447,7 @@
return res;
}

-static inline int __follow_down(struct vfsmount **mnt, struct dentry **dentry)
+int follow_down(struct vfsmount **mnt, struct dentry **dentry)
{
struct vfsmount *mounted;

@@ -465,12 +465,7 @@
return 0;
}

-int follow_down(struct vfsmount **mnt, struct dentry **dentry)
-{
- return __follow_down(mnt,dentry);
-}
-
-static inline void follow_dotdot(struct vfsmount **mnt, struct dentry **dentry)
+static void follow_dotdot(struct vfsmount **mnt, struct dentry **dentry)
{
while(1) {
struct vfsmount *parent;
@@ -818,9 +813,56 @@
}
}

+/*
+ * Replace the fs->{rootmnt,root} with {mnt,dentry}. Put the old values.
+ * It can block. Requires the big lock held.
+ */
+void set_fs_root(struct fs_struct *fs,
+ struct vfsmount *mnt,
+ struct dentry *dentry)
+{
+ struct dentry *old_root;
+ struct vfsmount *old_rootmnt;
+ write_lock(&fs->lock);
+ spin_lock(&dcache_lock);
+ old_root = fs->root;
+ old_rootmnt = fs->rootmnt;
+ fs->rootmnt = mntget(mnt);
+ fs->root = dget(dentry);
+ spin_unlock(&dcache_lock);
+ write_unlock(&fs->lock);
+ if (old_root) {
+ dput(old_root);
+ mntput(old_rootmnt);
+ }
+}
+
+/*
+ * Replace the fs->{pwdmnt,pwd} with {mnt,dentry}. Put the old values.
+ * It can block. Requires the big lock held.
+ */
+void set_fs_pwd(struct fs_struct *fs,
+ struct vfsmount *mnt,
+ struct dentry *dentry)
+{
+ struct dentry *old_pwd;
+ struct vfsmount *old_pwdmnt;
+ write_lock(&fs->lock);
+ spin_lock(&dcache_lock);
+ old_pwd = fs->pwd;
+ old_pwdmnt = fs->pwdmnt;
+ fs->pwdmnt = mntget(mnt);
+ fs->pwd = dget(dentry);
+ spin_unlock(&dcache_lock);
+ write_unlock(&fs->lock);
+ if (old_pwd) {
+ dput(old_pwd);
+ mntput(old_pwdmnt);
+ }
+}
+
/* SMP-safe */
-static inline int
-walk_init_root(const char *name, struct nameidata *nd)
+static int walk_init_root(const char *name, struct nameidata *nd)
{
read_lock(&current->fs->lock);
if (current->fs->altroot && !(nd->flags & LOOKUP_NOALT)) {
@@ -977,10 +1019,10 @@
}

/*
- * It's inline, so penalty for filesystems that don't use sticky bit is
- * minimal.
+ * It is no longer inline, since GCC got really good at what's really worth
+ * inlining.
*/
-static inline int check_sticky(struct inode *dir, struct inode *inode)
+static int check_sticky(struct inode *dir, struct inode *inode)
{
if (!(dir->i_mode & S_ISVTX))
return 0;
@@ -992,7 +1034,7 @@
}

/*
- * Check whether we can remove a link victim from directory dir, check
+ * Check whether we can remove a link victim from directory dir, check
* whether the type of victim is right.
* 1. We can't do it if dir is read-only (done in permission())
* 2. We should have write and exec permissions on dir
@@ -1008,7 +1050,7 @@
* 8. If we were asked to remove a non-directory and victim isn't one - EISDIR.
* 9. We can't remove a root or mountpoint.
*/
-static inline int may_delete(struct inode *dir,struct dentry *victim, int isdir)
+static int may_delete(struct inode *dir,struct dentry *victim, int isdir)
{
int error;
if (!victim->d_inode || victim->d_parent->d_inode != dir)
@@ -1033,7 +1075,7 @@
return 0;
}

-/* Check whether we can create an object with dentry child in directory
+/* Check whether we can create an object with dentry child in directory
* dir.
* 1. We can't do it if child already exists (open has special treatment for
* this case, but since we are inlined it's OK)
@@ -1041,7 +1083,7 @@
* 3. We should have write and exec permissions on dir
* 4. We can't do it if dir is immutable (done in permission())
*/
-static inline int may_create(struct inode *dir, struct dentry *child) {
+static int may_create(struct inode *dir, struct dentry *child) {
if (child->d_inode)
return -EEXIST;
if (IS_DEADDIR(dir))
@@ -1061,10 +1103,10 @@

if (f & O_NOFOLLOW)
retval &= ~LOOKUP_FOLLOW;
-
+
if ((f & (O_CREAT|O_EXCL)) == (O_CREAT|O_EXCL))
retval &= ~LOOKUP_FOLLOW;
-
+
if (f & O_DIRECTORY)
retval |= LOOKUP_DIRECTORY;

@@ -1298,7 +1340,7 @@
error = -ELOOP;
if (flag & O_NOFOLLOW)
goto exit_dput;
- while (__follow_down(&nd->mnt,&dentry) && d_mountpoint(dentry));
+ while (follow_down(&nd->mnt,&dentry) && d_mountpoint(dentry));
}
error = -ENOENT;
if (!dentry->d_inode)
@@ -1937,7 +1979,7 @@
return error;
}

-static inline int do_rename(const char * oldname, const char * newname)
+static int do_rename(const char * oldname, const char * newname)
{
int error = 0;
struct dentry * old_dir, * new_dir;
@@ -2049,8 +2091,7 @@
return len;
}

-static inline int
-__vfs_follow_link(struct nameidata *nd, const char *link)
+int vfs_follow_link(struct nameidata *nd, const char *link)
{
int res = 0;
char *name;
@@ -2084,11 +2125,6 @@
return PTR_ERR(link);
}

-int vfs_follow_link(struct nameidata *nd, const char *link)
-{
- return __vfs_follow_link(nd, link);
-}
-
/* get the link contents into pagecache */
static char *page_getlink(struct dentry * dentry, struct page **ppage)
{
@@ -2128,7 +2164,7 @@
{
struct page *page = NULL;
char *s = page_getlink(dentry, &page);
- int res = __vfs_follow_link(nd, s);
+ int res = vfs_follow_link(nd, s);
if (page) {
kunmap(page);
page_cache_release(page);
diff -urN linux-2.5.21/fs/open.c linux/fs/open.c
--- linux-2.5.21/fs/open.c 2002-06-09 07:26:54.000000000 +0200
+++ linux/fs/open.c 2002-06-12 10:15:01.000000000 +0200
@@ -90,7 +90,7 @@
return err;
}

-static inline long do_sys_truncate(const char * path, loff_t length)
+static long do_sys_truncate(const char * path, loff_t length)
{
struct nameidata nd;
struct inode * inode;
@@ -156,7 +156,7 @@
return do_sys_truncate(path, (long)length);
}

-static inline long do_sys_ftruncate(unsigned int fd, loff_t length, int small)
+static long do_sys_ftruncate(unsigned int fd, loff_t length, int small)
{
struct inode * inode;
struct dentry *dentry;
diff -urN linux-2.5.21/fs/seq_file.c linux/fs/seq_file.c
--- linux-2.5.21/fs/seq_file.c 2002-06-09 07:30:56.000000000 +0200
+++ linux/fs/seq_file.c 2002-06-12 11:58:16.000000000 +0200
@@ -276,6 +276,18 @@
return 0;
}

+int seq_puts(struct seq_file *m, const char *s)
+{
+ int len = strlen(s);
+ if (m->count + len < m->size) {
+ memcpy(m->buf + m->count, s, len);
+ m->count += len;
+ return 0;
+ }
+ m->count = m->size;
+ return -1;
+}
+
int seq_printf(struct seq_file *m, const char *f, ...)
{
va_list args;
diff -urN linux-2.5.21/include/linux/blk.h linux/include/linux/blk.h
--- linux-2.5.21/include/linux/blk.h 2002-06-09 07:28:39.000000000 +0200
+++ linux/include/linux/blk.h 2002-06-12 12:13:46.000000000 +0200
@@ -49,38 +49,6 @@
elv_remove_request(req->q, req);
}

-extern inline struct request *elv_next_request(request_queue_t *q)
-{
- struct request *rq;
-
- while ((rq = __elv_next_request(q))) {
- rq->flags |= REQ_STARTED;
-
- if (&rq->queuelist == q->last_merge)
- q->last_merge = NULL;
-
- if ((rq->flags & REQ_DONTPREP) || !q->prep_rq_fn)
- break;
-
- /*
- * all ok, break and return it
- */
- if (!q->prep_rq_fn(q, rq))
- break;
-
- /*
- * prep said no-go, kill it
- */
- blkdev_dequeue_request(rq);
- if (end_that_request_first(rq, 0, rq->nr_sectors))
- BUG();
-
- end_that_request_last(rq);
- }
-
- return rq;
-}
-
#define _elv_add_request_core(q, rq, where, plug) \
do { \
if ((plug)) \
@@ -96,7 +64,7 @@
} while (0)

#define elv_add_request(q, rq, back) _elv_add_request((q), (rq), (back), 1)
-
+
#if defined(MAJOR_NR) || defined(IDE_DRIVER)

/*
diff -urN linux-2.5.21/include/linux/elevator.h linux/include/linux/elevator.h
--- linux-2.5.21/include/linux/elevator.h 2002-06-09 07:26:51.000000000 +0200
+++ linux/include/linux/elevator.h 2002-06-12 12:13:49.000000000 +0200
@@ -38,9 +38,7 @@
/*
* block elevator interface
*/
-extern void __elv_add_request(request_queue_t *, struct request *,
- struct list_head *);
-extern struct request *__elv_next_request(request_queue_t *);
+extern struct request *elv_next_request(request_queue_t *);
extern void elv_merge_cleanup(request_queue_t *, struct request *, int);
extern int elv_merge(request_queue_t *, struct request **, struct bio *);
extern void elv_merge_requests(request_queue_t *, struct request *,
diff -urN linux-2.5.21/include/linux/fs_struct.h linux/include/linux/fs_struct.h
--- linux-2.5.21/include/linux/fs_struct.h 2002-06-09 07:27:40.000000000 +0200
+++ linux/include/linux/fs_struct.h 2002-06-12 11:10:33.000000000 +0200
@@ -22,56 +22,8 @@

extern void exit_fs(struct task_struct *);
extern void set_fs_altroot(void);
-
-/*
- * Replace the fs->{rootmnt,root} with {mnt,dentry}. Put the old values.
- * It can block. Requires the big lock held.
- */
-
-static inline void set_fs_root(struct fs_struct *fs,
- struct vfsmount *mnt,
- struct dentry *dentry)
-{
- struct dentry *old_root;
- struct vfsmount *old_rootmnt;
- write_lock(&fs->lock);
- spin_lock(&dcache_lock);
- old_root = fs->root;
- old_rootmnt = fs->rootmnt;
- fs->rootmnt = mntget(mnt);
- fs->root = dget(dentry);
- spin_unlock(&dcache_lock);
- write_unlock(&fs->lock);
- if (old_root) {
- dput(old_root);
- mntput(old_rootmnt);
- }
-}
-
-/*
- * Replace the fs->{pwdmnt,pwd} with {mnt,dentry}. Put the old values.
- * It can block. Requires the big lock held.
- */
-
-static inline void set_fs_pwd(struct fs_struct *fs,
- struct vfsmount *mnt,
- struct dentry *dentry)
-{
- struct dentry *old_pwd;
- struct vfsmount *old_pwdmnt;
- write_lock(&fs->lock);
- spin_lock(&dcache_lock);
- old_pwd = fs->pwd;
- old_pwdmnt = fs->pwdmnt;
- fs->pwdmnt = mntget(mnt);
- fs->pwd = dget(dentry);
- spin_unlock(&dcache_lock);
- write_unlock(&fs->lock);
- if (old_pwd) {
- dput(old_pwd);
- mntput(old_pwdmnt);
- }
-}
+extern void set_fs_root(struct fs_struct *, struct vfsmount *, struct dentry *);
+extern void set_fs_pwd(struct fs_struct *, struct vfsmount *, struct dentry *);

struct fs_struct *copy_fs_struct(struct fs_struct *old);
void put_fs_struct(struct fs_struct *fs);
diff -urN linux-2.5.21/include/linux/quotaops.h linux/include/linux/quotaops.h
--- linux-2.5.21/include/linux/quotaops.h 2002-06-09 07:28:19.000000000 +0200
+++ linux/include/linux/quotaops.h 2002-06-12 12:25:08.000000000 +0200
@@ -190,7 +190,7 @@
#define DQUOT_SYNC(sb) do { } while(0)
#define DQUOT_OFF(sb) do { } while(0)
#define DQUOT_TRANSFER(inode, iattr) (0)
-extern __inline__ int DQUOT_PREALLOC_SPACE_NODIRTY(struct inode *inode, qsize_t nr)
+static inline int DQUOT_PREALLOC_SPACE_NODIRTY(struct inode *inode, qsize_t nr)
{
lock_kernel();
inode_add_bytes(inode, nr);
@@ -198,14 +198,14 @@
return 0;
}

-extern __inline__ int DQUOT_PREALLOC_SPACE(struct inode *inode, qsize_t nr)
+static inline int DQUOT_PREALLOC_SPACE(struct inode *inode, qsize_t nr)
{
DQUOT_PREALLOC_SPACE_NODIRTY(inode, nr);
mark_inode_dirty(inode);
return 0;
}

-extern __inline__ int DQUOT_ALLOC_SPACE_NODIRTY(struct inode *inode, qsize_t nr)
+static inline int DQUOT_ALLOC_SPACE_NODIRTY(struct inode *inode, qsize_t nr)
{
lock_kernel();
inode_add_bytes(inode, nr);
@@ -213,21 +213,21 @@
return 0;
}

-extern __inline__ int DQUOT_ALLOC_SPACE(struct inode *inode, qsize_t nr)
+static inline int DQUOT_ALLOC_SPACE(struct inode *inode, qsize_t nr)
{
DQUOT_ALLOC_SPACE_NODIRTY(inode, nr);
mark_inode_dirty(inode);
return 0;
}

-extern __inline__ void DQUOT_FREE_SPACE_NODIRTY(struct inode *inode, qsize_t nr)
+static inline void DQUOT_FREE_SPACE_NODIRTY(struct inode *inode, qsize_t nr)
{
lock_kernel();
inode_sub_bytes(inode, nr);
unlock_kernel();
}

-extern __inline__ void DQUOT_FREE_SPACE(struct inode *inode, qsize_t nr)
+static inline void DQUOT_FREE_SPACE(struct inode *inode, qsize_t nr)
{
DQUOT_FREE_SPACE_NODIRTY(inode, nr);
mark_inode_dirty(inode);
diff -urN linux-2.5.21/include/linux/seq_file.h linux/include/linux/seq_file.h
--- linux-2.5.21/include/linux/seq_file.h 2002-06-09 07:29:53.000000000 +0200
+++ linux/include/linux/seq_file.h 2002-06-12 11:58:06.000000000 +0200
@@ -43,19 +43,8 @@
return -1;
}

-static inline int seq_puts(struct seq_file *m, const char *s)
-{
- int len = strlen(s);
- if (m->count + len < m->size) {
- memcpy(m->buf + m->count, s, len);
- m->count += len;
- return 0;
- }
- m->count = m->size;
- return -1;
-}
-
-int seq_printf(struct seq_file *, const char *, ...)
+extern int seq_puts(struct seq_file *m, const char *s);
+extern int seq_printf(struct seq_file *, const char *, ...)
__attribute__ ((format (printf,2,3)));

int single_open(struct file *, int (*)(struct seq_file *, void *), void *);
diff -urN linux-2.5.21/kernel/exit.c linux/kernel/exit.c
--- linux-2.5.21/kernel/exit.c 2002-06-09 07:28:48.000000000 +0200
+++ linux/kernel/exit.c 2002-06-12 10:27:22.000000000 +0200
@@ -27,7 +27,7 @@

int getrusage(struct task_struct *, int, struct rusage *);

-static inline void __unhash_process(struct task_struct *p)
+void unhash_process(struct task_struct *p)
{
struct dentry *proc_dentry;
write_lock_irq(&tasklist_lock);
@@ -72,13 +72,6 @@
put_task_struct(p);
}

-/* we are using it only for SMP init */
-
-void unhash_process(struct task_struct *p)
-{
- return __unhash_process(p);
-}
-
/*
* This checks not only the pgrp, but falls back on the pid if no
* satisfactory pgrp is found. I dunno - gdb doesn't work correctly
@@ -310,7 +303,7 @@
}
}

-static inline void __exit_files(struct task_struct *tsk)
+void exit_files(struct task_struct *tsk)
{
struct files_struct * files = tsk->files;

@@ -322,12 +315,7 @@
}
}

-void exit_files(struct task_struct *tsk)
-{
- __exit_files(tsk);
-}
-
-static inline void __put_fs_struct(struct fs_struct *fs)
+void put_fs_struct(struct fs_struct *fs)
{
/* No need to hold fs->lock if we are killing it */
if (atomic_dec_and_test(&fs->count)) {
@@ -343,12 +331,7 @@
}
}

-void put_fs_struct(struct fs_struct *fs)
-{
- __put_fs_struct(fs);
-}
-
-static inline void __exit_fs(struct task_struct *tsk)
+void exit_fs(struct task_struct *tsk)
{
struct fs_struct * fs = tsk->fs;

@@ -356,15 +339,10 @@
task_lock(tsk);
tsk->fs = NULL;
task_unlock(tsk);
- __put_fs_struct(fs);
+ put_fs_struct(fs);
}
}

-void exit_fs(struct task_struct *tsk)
-{
- __exit_fs(tsk);
-}
-
/*
* We can use these to temporarily drop into
* "lazy TLB" mode and back.
@@ -395,7 +373,7 @@
* Turn us into a lazy TLB process if we
* aren't already..
*/
-static inline void __exit_mm(struct task_struct * tsk)
+void exit_mm(struct task_struct * tsk)
{
struct mm_struct * mm = tsk->mm;

@@ -412,11 +390,6 @@
}
}

-void exit_mm(struct task_struct *tsk)
-{
- __exit_mm(tsk);
-}
-
/*
* Send signals to all our closest relatives so that they know
* to properly mourn us..
@@ -538,11 +511,11 @@

fake_volatile:
acct_process(code);
- __exit_mm(tsk);
+ exit_mm(tsk);

sem_exit();
- __exit_files(tsk);
- __exit_fs(tsk);
+ exit_files(tsk);
+ exit_fs(tsk);
exit_namespace(tsk);
exit_sighand(tsk);
exit_thread();
diff -urN linux-2.5.21/kernel/fork.c linux/kernel/fork.c
--- linux-2.5.21/kernel/fork.c 2002-06-09 07:27:21.000000000 +0200
+++ linux/kernel/fork.c 2002-06-12 10:30:41.000000000 +0200
@@ -293,7 +293,7 @@
* is dropped: either by a lazy thread or by
* mmput. Free the page directory and the mm.
*/
-inline void __mmdrop(struct mm_struct *mm)
+void __mmdrop(struct mm_struct *mm)
{
if (mm == &init_mm) BUG();
pgd_free(mm->pgd);
@@ -408,7 +408,7 @@
return retval;
}

-static inline struct fs_struct *__copy_fs_struct(struct fs_struct *old)
+struct fs_struct *copy_fs_struct(struct fs_struct *old)
{
struct fs_struct *fs = kmem_cache_alloc(fs_cachep, GFP_KERNEL);
/* We don't need to lock fs - think why ;-) */
@@ -433,18 +433,13 @@
return fs;
}

-struct fs_struct *copy_fs_struct(struct fs_struct *old)
-{
- return __copy_fs_struct(old);
-}
-
static inline int copy_fs(unsigned long clone_flags, struct task_struct * tsk)
{
if (clone_flags & CLONE_FS) {
atomic_inc(&current->fs->count);
return 0;
}
- tsk->fs = __copy_fs_struct(current->fs);
+ tsk->fs = copy_fs_struct(current->fs);
if (!tsk->fs)
return -1;
return 0;
diff -urN linux-2.5.21/kernel/ksyms.c linux/kernel/ksyms.c
--- linux-2.5.21/kernel/ksyms.c 2002-06-09 18:43:30.000000000 +0200
+++ linux/kernel/ksyms.c 2002-06-12 11:58:55.000000000 +0200
@@ -519,6 +519,7 @@
EXPORT_SYMBOL(daemonize);
EXPORT_SYMBOL(csum_partial); /* for networking and md */
EXPORT_SYMBOL(seq_escape);
+EXPORT_SYMBOL(seq_puts);
EXPORT_SYMBOL(seq_printf);
EXPORT_SYMBOL(seq_open);
EXPORT_SYMBOL(seq_release);
diff -urN linux-2.5.21/kernel/module.c linux/kernel/module.c
--- linux-2.5.21/kernel/module.c 2002-06-09 07:27:45.000000000 +0200
+++ linux/kernel/module.c 2002-06-12 10:32:01.000000000 +0200
@@ -256,7 +256,7 @@
* Copy the name of a module from user space.
*/

-static inline long
+static long
get_mod_name(const char *user_name, char **buf)
{
unsigned long page;
diff -urN linux-2.5.21/kernel/timer.c linux/kernel/timer.c
--- linux-2.5.21/kernel/timer.c 2002-06-09 07:28:28.000000000 +0200
+++ linux/kernel/timer.c 2002-06-12 10:40:30.000000000 +0200
@@ -127,7 +127,7 @@

static unsigned long timer_jiffies;

-static inline void internal_add_timer(struct timer_list *timer)
+static void internal_add_timer(struct timer_list *timer)
{
/*
* must be cli-ed when calling this
@@ -197,7 +197,7 @@
__builtin_return_address(0));
}

-static inline int detach_timer (struct timer_list *timer)
+static inline int detach_timer(struct timer_list *timer)
{
if (!timer_pending(timer))
return 0;
diff -urN linux-2.5.21/lib/rwsem.c linux/lib/rwsem.c
--- linux-2.5.21/lib/rwsem.c 2002-06-09 07:26:50.000000000 +0200
+++ linux/lib/rwsem.c 2002-06-12 11:04:50.000000000 +0200
@@ -35,7 +35,7 @@
* - the spinlock must be held by the caller
* - woken process blocks are discarded from the list after having flags zeroised
*/
-static inline struct rw_semaphore *__rwsem_do_wake(struct rw_semaphore *sem)
+static struct rw_semaphore *__rwsem_do_wake(struct rw_semaphore *sem)
{
struct rwsem_waiter *waiter;
struct list_head *next;
@@ -110,7 +110,7 @@
/*
* wait for a lock to be granted
*/
-static inline struct rw_semaphore *rwsem_down_failed_common(struct rw_semaphore *sem,
+static struct rw_semaphore *rwsem_down_failed_common(struct rw_semaphore *sem,
struct rwsem_waiter *waiter,
signed long adjustment)
{
diff -urN linux-2.5.21/mm/filemap.c linux/mm/filemap.c
--- linux-2.5.21/mm/filemap.c 2002-06-09 07:28:49.000000000 +0200
+++ linux/mm/filemap.c 2002-06-12 10:42:45.000000000 +0200
@@ -1631,7 +1631,7 @@
return 0;
}

-static inline void setup_read_behavior(struct vm_area_struct * vma,
+static void setup_read_behavior(struct vm_area_struct * vma,
int behavior)
{
VM_ClearReadHint(vma);
diff -urN linux-2.5.21/mm/highmem.c linux/mm/highmem.c
--- linux-2.5.21/mm/highmem.c 2002-06-09 07:26:59.000000000 +0200
+++ linux/mm/highmem.c 2002-06-12 10:46:00.000000000 +0200
@@ -290,7 +290,7 @@
}
}

-static inline void bounce_end_io(struct bio *bio, mempool_t *pool)
+static void bounce_end_io(struct bio *bio, mempool_t *pool)
{
struct bio *bio_orig = bio->bi_private;
struct bio_vec *bvec, *org_vec;
diff -urN linux-2.5.21/mm/slab.c linux/mm/slab.c
--- linux-2.5.21/mm/slab.c 2002-06-09 07:31:17.000000000 +0200
+++ linux/mm/slab.c 2002-06-12 10:56:07.000000000 +0200
@@ -533,7 +533,7 @@
}

/* Interface to system's page release. */
-static inline void kmem_freepages (kmem_cache_t *cachep, void *addr)
+static void kmem_freepages(kmem_cache_t *cachep, void *addr)
{
unsigned long i = (1<<cachep->gfporder);
struct page *page = virt_to_page(addr);
@@ -551,7 +551,7 @@
}

#if DEBUG
-static inline void kmem_poison_obj (kmem_cache_t *cachep, void *addr)
+static void kmem_poison_obj(kmem_cache_t *cachep, void *addr)
{
int size = cachep->objsize;
if (cachep->flags & SLAB_RED_ZONE) {
@@ -562,7 +562,7 @@
*(unsigned char *)(addr+size-1) = POISON_END;
}

-static inline int kmem_check_poison_obj (kmem_cache_t *cachep, void *addr)
+static int kmem_check_poison_obj(kmem_cache_t *cachep, void *addr)
{
int size = cachep->objsize;
void *end;
@@ -1363,7 +1363,16 @@
}
#endif

-static inline void * __kmem_cache_alloc (kmem_cache_t *cachep, int flags)
+
+/**
+ * kmem_cache_alloc - Allocate an object
+ * @cachep: The cache to allocate from.
+ * @flags: See kmalloc().
+ *
+ * Allocate an object from this cache. The flags are only relevant
+ * if the cache has no available objects.
+ */
+void * kmem_cache_alloc(kmem_cache_t *cachep, int flags)
{
unsigned long save_flags;
void* objp;
@@ -1548,19 +1557,6 @@
}

/**
- * kmem_cache_alloc - Allocate an object
- * @cachep: The cache to allocate from.
- * @flags: See kmalloc().
- *
- * Allocate an object from this cache. The flags are only relevant
- * if the cache has no available objects.
- */
-void * kmem_cache_alloc (kmem_cache_t *cachep, int flags)
-{
- return __kmem_cache_alloc(cachep, flags);
-}
-
-/**
* kmalloc - allocate memory
* @size: how many bytes of memory are required.
* @flags: the type of memory to allocate.
@@ -1588,7 +1584,7 @@
for (; csizep->cs_size; csizep++) {
if (size > csizep->cs_size)
continue;
- return __kmem_cache_alloc(flags & GFP_DMA ?
+ return kmem_cache_alloc(flags & GFP_DMA ?
csizep->cs_dmacachep : csizep->cs_cachep, flags);
}
return NULL;


Attachments:
inline-2.5.21.diff (30.15 kB)

2002-06-12 17:40:01

by Brad Heilbrun

[permalink] [raw]
Subject: Re: [PATCH] 2.5.21 IDE 87

On Tue, Jun 11, 2002 at 09:46:21AM +0200, Martin Dalecki wrote:

> - char *buffer;
> - int nsect = rq->current_nr_sectors;
> - unsigned long flags;
> + /*
> + * Ok, we're all setup for the interrupt re-entering us on the
> + * last transfer.
> + */
> + ata_write(drive, buf, nsect * SECTOR_WORDS);
> + bio_kunmap_irq(buffer, &flags);

The above is an excerpt from the diff on ide_disk.c: task_mulout_intr()

The first and last line conflict. You remove 'char *buffer' then try to
pass it to bio_kunmap_irq(). I think it should be passing 'char
*buf' instead.

BK patch below.

You can import this changeset into BK by piping this whole message to:
'| bk receive [path to repository]' or apply the patch as usual.

===================================================================


[email protected], 2002-06-12 10:25:57-07:00, [email protected]
The IDE 87 patch removed char *buffer from task_mulout_intr() then added
a line which passes it as an argument to bio_kunmap_irq(). It should be
passing char *buf instead. Fixed.


ide-disk.c | 2 +-
1 files changed, 1 insertion, 1 deletion


diff -Nru a/drivers/ide/ide-disk.c b/drivers/ide/ide-disk.c
--- a/drivers/ide/ide-disk.c Wed Jun 12 10:28:07 2002
+++ b/drivers/ide/ide-disk.c Wed Jun 12 10:28:07 2002
@@ -327,7 +327,7 @@
* last transfer.
*/
ata_write(drive, buf, nsect * SECTOR_WORDS);
- bio_kunmap_irq(buffer, &flags);
+ bio_kunmap_irq(buf, &flags);
} while (mcount);

rq->errors = 0;

===================================================================


This BitKeeper patch contains the following changesets:
1.457
## Wrapped with gzip_uu ##


begin 664 bkpatch2009
M'XL(`*>$!ST``[64;6_3,!#'7\>?XJ1):`.2^)+8Z8**!MN`"22FP5Y73NPV
M5O-0;*?;I'QXW$Y:T1B,QSS(T>GR]__N?O(>7%IEBJ"LE6Y*,W1D#][UUA7!
M2MRL1!-5?>M#%WWO0_%@3=STE6AB:ZJXT=UP'281(S[C7+BJAK4RM@@P2N\B
M[F:EBN#B].WEAU<7A$RG<%R+;J$^*0?3*7&]68M&VB/AZJ;O(F=$9UOEQ&;C
M\2YU3"A-_,TP3RGC(W*:Y6.%$E%DJ"1-L@G/R%T51SOW]T4X)LC8)$M&AICF
MY`[email protected](DICS$!I$7""I:'-"\HA8<TX1E"2,EK^+?VCTD%GVL%9R>G,,EA
MM6V@46V_5A*J6AAX6@[SN3(P-]Z$$W8Y:X>F']Q,=\[L'X"K50="2B6]E``_
M(057M?8R*V&MLJ`="`O")YG%T*K.^1*@U/UL.72M6,VT^;)_$,&9`UOW0R.A
M5%YI\[/N%CL/H#OKE)`1O-'72D;D/3":(I+SW7A)^)L7(510\O*1IDJC-Y3%
M6JK-&TIMEU'U38<SBGRD>'B8C8>LFF=YRE*>TJ3DY8/#_*GBAI8\811'_\7X
M%N"'\Q^G^6^<$RD:52WUD5IKJ_LN7/O9#4;97Z@`D6?<*W-D>;KEG4_NXT[Q
M,=SQO^"^Q><[`,$?,<T&JMNF?X307&T?#\GY#_K_![B=I"D%)&>W2Q`$]WQX
CT)_#DWDC%O;@Q>Z0JVH_"3NTTXF<5+G`.?D*SOV$*T8%````
`
end

2002-06-13 01:31:18

by John Weber

[permalink] [raw]
Subject: Re: [PATCH] 2.5.21 IDE 87

Martin Dalecki wrote:
> U?ytkownik John Weber napisa?:
>
>> Martin Dalecki wrote:
>>
>>> Sun Jun 9 15:31:56 CEST 2002 ide-clean-87
>>>
>>> - Sync with 2.5.21
>>>
>>> - Don't call put_device inside idedisk_cleanup(). This is apparently
>>> triggering
>>> some bug inside the handling of device trees. Or we don't register
>>> the device
>>> properly within the tree. Check this later.
>>>
>>> - Further work on the channel register file access locking. Push the
>>> locking
>>> out from __ide_end_request to ide_end_request. Rename those
>>> functions to
>>> respective __ata_end_request() and ata_end_request().
>>>
>>> - Move ide_wait_status to device.c rename it to ata_status_poll().
>>>
>>> - Further work on locking scope issues.
>>>
>>> - devfs showed us once again that it changed the policy from agnostic
>>> numbers
>>> to unpleasant string names. What a piece of crap!
>>
>>
>>
>> FYI, this latest cleanup fixes the oops I reported earlier...
>> not that anyone cared :).
>
>
> Please just don't expect an e-mail reply on every single
> error report. Me beeing silent means sometimes that I'm just busy
> fixing it...
>

I was mostly joking about the fact that no one else on the list seemed
to run into the error. I think you did more than your part when you
released IDE 87... I posted to the list as a way of "cancelling" the bug
report.

I apologize for the ill-planned joke... <TOTAL JOKE>I realize that
touchy bitch syndrome seems to be running rampant on LKML this
season</TOTAL JOKE>.

-o) J o h n W e b e r
/\\ [email protected]
_\/v http://www.linuxhq.com/people/weber/

2002-06-13 09:51:40

by Martin Dalecki

[permalink] [raw]
Subject: [PATCH] 2.5.21 IDE 88


Tue Jun 11 02:30:03 CEST 2002 ide-clean-88

- Bunch of cleanups by Bartlomiej (accounts for over a half of the patch):

cmd64x.c:
- kill SPLIT_BYTE() macro
- kill wrappers for cmd64x_config_drive_for_dma()
- misc cleanups

cy82c693.c:
- kill obsolete comments
- clean cy82c693_tune_drive() and calc_clk()
- misc cleanups

hpt34x.c:
- kill obsolete comment
- kill SPLIT_BYTE()
- kill hpt34x_clear_chipset()
- simplify hpt34x_tune_drive()

hpt366.c:
- kill hpt_min_rev()
- kill redundant hpt368_tune_chipset() and hpt374_tune_chipset()
- fix badlists checking in config_chipset_for_dma()
- misc cleanups

pdc202xx.c:
- clean registers decoding
- clean pdc202xx_tune_chipset()
- kill pdc202xx_udma_irq_status(), use generic udma_pci_irq_status()
- rationalize pdc202xx_reset()
- kill UDMA_SPEED_FLAG() and PDC_CLOCK() macros,
do it right by defining constants PDC_UDMA and PDC_CLK
- kill init_high_16() inline, no need to hide internals
- clean pdc202xx_init_chipset()
- split ata66_pdc202xx() and pdc202xx_init_chipset()
- clean config_chipset_for_dma()
- misc cleanups

- Fix plug in of CF cards. The previously used sub device driver attach method
lookup was entirely hosed.

- Enforce indentation style on ide-cs.c. Enable debugging there. (Makes the
patch quite big...)


Attachments:
ide-clean-88.diff.gz (19.64 kB)

2002-06-13 12:01:53

by Martin Dalecki

[permalink] [raw]
Subject: Re: [PATCH] 2.5.21 kill warnings 4/19

U?ytkownik Maksim (Max) Krasnyanskiy napisa?:
> Hi Martin,
>
> How about replacing __FUNCTION__ with __func__ ?
> GCC 3.x warns that __FUNCTION__ is obsolete and will be removed.
> Here is how I did it in Bluetooth code:
> #define BT_DBG(fmt, arg...) printk(KERN_INFO "%s: " fmt "\n" ,
> __func__ , ## arg)
> no more warnings from gcc.

At the paces where there are wrapper macros this would
make sense indeed. Otherwise - well not worth the trouble.



2002-06-13 13:21:37

by Richard Zidlicky

[permalink] [raw]
Subject: Re: [PATCH] 2.5.21 inline abuse...

On Wed, Jun 12, 2002 at 12:50:15PM +0200, Martin Dalecki wrote:
> The attached patch is trying to address the most obvious
> abuses or inadequacies in the usage of the inline attribute
> to functions. Many of the remaining usages should be removed
> as well since apparently GCC got really good at figuring out
> on its own whatever it makes sense to inline a function or not.

do you compile your kernels with -O3 or -finline-functions?
Otherwise gcc should not inline anything at all without the
explicit inline keyword.

Richard

2002-06-14 11:06:45

by Martin Dalecki

[permalink] [raw]
Subject: [PATCH] 2.5.21 IDE 89

diff -urN linux-2.5.21/drivers/ide/ide.c linux/drivers/ide/ide.c
--- linux-2.5.21/drivers/ide/ide.c 2002-06-11 01:02:30.000000000 +0200
+++ linux/drivers/ide/ide.c 2002-06-13 18:32:20.000000000 +0200
@@ -635,15 +635,16 @@
*/
static ide_startstop_t start_request(struct ata_device *drive, struct request *rq)
{
+ struct ata_channel *ch = drive->channel;
sector_t block;
unsigned int minor = minor(rq->rq_dev);
unsigned int unit = minor >> PARTN_BITS;
- struct ata_channel *ch = drive->channel;
+ ide_startstop_t ret;

BUG_ON(!(rq->flags & REQ_STARTED));

#ifdef DEBUG
- printk("%s: start_request: current=0x%08lx\n", ch->name, (unsigned long) rq);
+ printk("%s: %s: current=0x%08lx\n", ch->name, __FUNCTION__, (unsigned long) rq);
#endif

/* bail early if we've exceeded max_failures */
@@ -663,55 +664,63 @@
if (drive->type == ATA_DISK || drive->type == ATA_FLOPPY)
block += drive->sect0;

-
/* Yecch - this will shift the entire interval, possibly killing some
* innocent following sector.
*/
if (block == 0 && drive->remap_0_to_1 == 1)
block = 1; /* redirect MBR access to EZ-Drive partn table */
- {
- ide_startstop_t res;

- ata_select(drive, 0);
- if (ata_status_poll(drive, drive->ready_stat, BUSY_STAT | DRQ_STAT,
- WAIT_READY, rq, &res)) {
- printk(KERN_WARNING "%s: drive not ready for command\n", drive->name);
+ ata_select(drive, 0);
+ spin_unlock_irq(ch->lock);
+ if (ata_status_poll(drive, drive->ready_stat, BUSY_STAT | DRQ_STAT,
+ WAIT_READY, rq, &ret)) {
+ printk(KERN_WARNING "%s: drive not ready for command\n", drive->name);
+ spin_lock_irq(ch->lock);

- return res;
- }
+ return ret;
}
+ spin_lock_irq(ch->lock);

/* This issues a special drive command.
+ *
+ * FIXME: move this down to idedisk_do_request().
*/
if (rq->flags & REQ_SPECIAL)
- if (drive->type == ATA_DISK)
- return ata_taskfile(drive, rq->special, NULL);
+ if (drive->type == ATA_DISK) {
+ spin_unlock_irq(ch->lock);
+ ret = ata_taskfile(drive, rq->special, NULL);
+ spin_lock_irq(ch->lock);

- /* The normal way of execution is to pass and execute the request
- * handler down to the device type driver.
- */
- if (ata_ops(drive)) {
- if (ata_ops(drive)->do_request)
- return ata_ops(drive)->do_request(drive, rq, block);
- else {
- ata_end_request(drive, rq, 0);
-
- return ide_stopped;
+ return ret;
}
+
+ if (!ata_ops(drive)) {
+ printk(KERN_WARNING "%s: device type %d not supported\n",
+ drive->name, drive->type);
+ goto kill_rq;
}

- /*
- * Error handling:
+ /* The normal way of execution is to pass and execute the request
+ * handler down to the device type driver.
*/

- printk(KERN_WARNING "%s: device type %d not supported\n",
- drive->name, drive->type);
+ if (ata_ops(drive)->XXX_do_request) {
+ ret = ata_ops(drive)->XXX_do_request(drive, rq, block);
+ } else {
+ __ata_end_request(drive, rq, 0, 0);
+ ret = ide_stopped;
+ }
+ return ret;

kill_rq:
- if (ata_ops(drive) && ata_ops(drive)->end_request)
- ata_ops(drive)->end_request(drive, rq, 0);
- else
- ata_end_request(drive, rq, 0);
+ if (ata_ops(drive)) {
+ if (ata_ops(drive)->end_request) {
+ spin_unlock_irq(ch->lock);
+ ata_ops(drive)->end_request(drive, rq, 0);
+ spin_lock_irq(ch->lock);
+ }
+ } else
+ __ata_end_request(drive, rq, 0, 0);

return ide_stopped;
}
@@ -726,13 +735,8 @@

ch->handler = NULL;
del_timer(&ch->timer);
-
- spin_unlock_irqrestore(ch->lock, flags);
-
- /* FIXME make start_request do the unlock itself and
- * push this locking further down. */
-
ret = start_request(drive, drive->rq);
+ spin_unlock_irqrestore(ch->lock, flags);

return ret;
}
@@ -902,11 +906,8 @@

drive->rq = rq;

- /* FIXME: push this locaing further down */
- spin_unlock(drive->channel->lock);
ide__sti(); /* allow other IRQs while we start this request */
startstop = start_request(drive, rq);
- spin_lock_irq(drive->channel->lock);

/* command started, we are busy */
if (startstop == ide_started)
diff -urN linux-2.5.21/drivers/ide/ide-cd.c linux/drivers/ide/ide-cd.c
--- linux-2.5.21/drivers/ide/ide-cd.c 2002-06-11 00:02:07.000000000 +0200
+++ linux/drivers/ide/ide-cd.c 2002-06-13 17:23:46.000000000 +0200
@@ -804,6 +804,7 @@
}

/* Arm the interrupt handler and send the command to the device. */
+ /* FIXME: make this locking go away */
spin_lock_irqsave(ch->lock, flags);
ata_set_handler(drive, handler, timeout, cdrom_timer_expiry);
atapi_write(drive, cmd, CDROM_PACKET_SIZE);
@@ -1648,7 +1649,8 @@
static ide_startstop_t
ide_cdrom_do_request(struct ata_device *drive, struct request *rq, sector_t block)
{
- ide_startstop_t action;
+ struct ata_channel *ch = drive->channel;
+ int ret;
struct cdrom_info *info = drive->driver_data;

if (rq->flags & REQ_CMD) {
@@ -1664,19 +1666,29 @@
}
CDROM_CONFIG_FLAGS(drive)->seeking = 0;
}
- if (IDE_LARGE_SEEK(info->last_block, block, IDECD_SEEK_THRESHOLD) && drive->dsc_overlap)
- action = cdrom_start_seek(drive, rq, block);
- else {
+ /* FIXME: make this unlocking go away*/
+ spin_unlock_irq(ch->lock);
+ if (IDE_LARGE_SEEK(info->last_block, block, IDECD_SEEK_THRESHOLD) && drive->dsc_overlap) {
+ ret = cdrom_start_seek(drive, rq, block);
+ } else {
if (rq_data_dir(rq) == READ)
- action = cdrom_start_read(drive, rq, block);
+ ret = cdrom_start_read(drive, rq, block);
else
- action = cdrom_start_write(drive, rq);
+ ret = cdrom_start_write(drive, rq);
}
info->last_block = block;
- return action;
+ spin_lock_irq(ch->lock);
+ return ret;
} else if (rq->flags & (REQ_PC | REQ_SENSE)) {
- return cdrom_do_packet_command(drive, rq);
+ /* FIXME: make this unlocking go away*/
+ spin_unlock_irq(ch->lock);
+ ret = cdrom_do_packet_command(drive, rq);
+ spin_lock_irq(ch->lock);
+
+ return ret;
} else if (rq->flags & REQ_SPECIAL) {
+ /* FIXME: make this unlocking go away*/
+ spin_unlock_irq(ch->lock);
/*
* FIXME: Kill REQ_SEPCIAL and replace it with commands queued
* at the request queue instead as suggested by Linus.
@@ -1685,11 +1697,15 @@
*/

cdrom_end_request(drive, rq, 1);
+ spin_lock_irq(ch->lock);
+
return ide_stopped;
} else if (rq->flags & REQ_BLOCK_PC) {
struct packet_command pc;
ide_startstop_t startstop;

+ /* FIXME: make this unlocking go away*/
+ spin_unlock_irq(ch->lock);
memset(&pc, 0, sizeof(pc));
pc.quiet = 1;
pc.timeout = 60 * HZ;
@@ -1700,12 +1716,17 @@
startstop = cdrom_do_packet_command(drive, rq);
if (pc.stat)
++rq->errors;
+ spin_lock_irq(ch->lock);

return startstop;
}

blk_dump_rq_flags(rq, "ide-cd bad flags");
+ /* FIXME: make this unlocking go away*/
+ spin_unlock_irq(ch->lock);
cdrom_end_request(drive, rq, 0);
+ spin_lock_irq(ch->lock);
+
return ide_stopped;
}

@@ -2969,7 +2990,7 @@
attach: ide_cdrom_attach,
cleanup: ide_cdrom_cleanup,
standby: NULL,
- do_request: ide_cdrom_do_request,
+ XXX_do_request: ide_cdrom_do_request,
end_request: NULL,
ioctl: ide_cdrom_ioctl,
open: ide_cdrom_open,
diff -urN linux-2.5.21/drivers/ide/ide-disk.c linux/drivers/ide/ide-disk.c
--- linux-2.5.21/drivers/ide/ide-disk.c 2002-06-13 20:15:09.000000000 +0200
+++ linux/drivers/ide/ide-disk.c 2002-06-13 17:02:38.000000000 +0200
@@ -555,6 +555,8 @@
* Issue a READ or WRITE command to a disk, using LBA if supported, or CHS
* otherwise, to address sectors. It also takes care of issuing special
* DRIVE_CMDs.
+ *
+ * Channel lock should be held.
*/
static ide_startstop_t idedisk_do_request(struct ata_device *drive, struct request *rq, sector_t block)
{
@@ -562,30 +564,16 @@
struct ata_channel *ch = drive->channel;
int ret;

- /* make sure all request have bin finished
- * FIXME: this check doesn't make sense go! */
- while (drive->blocked) {
- yield();
- printk(KERN_ERR "ide: Request while drive blocked?");
- }
-
- /* FIXME: Move this lock entiery upstream. */
- spin_lock_irqsave(ch->lock, flags);
-
/* FIXME: this check doesn't make sense */
if (!(rq->flags & REQ_CMD)) {
blk_dump_rq_flags(rq, "idedisk_do_request - bad command");
__ata_end_request(drive, rq, 0, 0);
- spin_unlock_irqrestore(ch->lock, flags);
-
return ide_stopped;
}

if (IS_PDC4030_DRIVE) {
extern ide_startstop_t promise_do_request(struct ata_device *, struct request *, sector_t);

- spin_unlock_irqrestore(drive->channel->lock, flags);
-
return promise_do_request(drive, rq, block);
}

@@ -593,33 +581,25 @@
* start a tagged operation
*/
if (drive->using_tcq) {
- int ret;
-
- ret = blk_queue_start_tag(&drive->queue, rq);
+ int st = blk_queue_start_tag(&drive->queue, rq);

if (ata_pending_commands(drive) > drive->max_depth)
drive->max_depth = ata_pending_commands(drive);
if (ata_pending_commands(drive) > drive->max_last_depth)
drive->max_last_depth = ata_pending_commands(drive);

- if (ret) {
+ if (st) {
BUG_ON(!ata_pending_commands(drive));
- spin_unlock_irqrestore(ch->lock, flags);
-
return ide_started;
}
}

if ((drive->id->cfs_enable_2 & 0x0400) && (drive->addressing))
- ret = lba48_do_request(drive, rq, block);
+ return lba48_do_request(drive, rq, block);
else if (drive->select.b.lba)
- ret = lba28_do_request(drive, rq, block);
+ return lba28_do_request(drive, rq, block);
else
- ret = chs_do_request(drive, rq, block);
-
- spin_unlock_irqrestore(ch->lock, flags);
-
- return ret;
+ return chs_do_request(drive, rq, block);
}

static int idedisk_open(struct inode *inode, struct file *filp, struct ata_device *drive)
@@ -868,9 +848,10 @@
/* This is just a hook for the overall driver tree.
*/

-static struct device_driver idedisk_devdrv = {
- suspend: idedisk_suspend,
- resume: idedisk_resume,
+static struct device_driver disk_devdrv = {
+ .lock = RW_LOCK_UNLOCKED,
+ .suspend = idedisk_suspend,
+ .resume = idedisk_resume,
};

/*
@@ -1011,6 +992,7 @@
sector_t capacity;
sector_t set_max;
int drvid = -1;
+ struct ata_channel *ch = drive->channel;

if (id == NULL)
return;
@@ -1020,35 +1002,31 @@
* to us, but they are removable and don't have a doorlock mechanism.
*/
if (drive->removable && !drive_is_flashcard(drive)) {
- /*
- * Removable disks (eg. SYQUEST); ignore 'WD' drives.
+ /* Removable disks (eg. SYQUEST); ignore 'WD' drives.
*/
- if (id->model[0] != 'W' || id->model[1] != 'D') {
+ if (!strncmp(id->model, "WD", 2))
drive->doorlocking = 1;
- }
}
- for (i = 0; i < MAX_DRIVES; ++i) {
- struct ata_channel *hwif = drive->channel;

- if (drive != &hwif->drives[i])
+ for (i = 0; i < MAX_DRIVES; ++i) {
+ if (drive != &ch->drives[i])
continue;
drvid = i;
- hwif->gd->de_arr[i] = drive->de;
+ ch->gd->de_arr[i] = drive->de;
if (drive->removable)
- hwif->gd->flags[i] |= GENHD_FL_REMOVABLE;
+ ch->gd->flags[i] |= GENHD_FL_REMOVABLE;
break;
}

/* Register us within the device tree.
*/
-
if (drvid != -1) {
- sprintf(drive->device.bus_id, "%d", drvid);
- sprintf(drive->device.name, "ide-disk");
- drive->device.driver = &idedisk_devdrv;
- drive->device.parent = &drive->channel->dev;
- drive->device.driver_data = drive;
- device_register(&drive->device);
+ sprintf(drive->dev.bus_id, "sd@%x,%x", ch->unit, drvid);
+ strcpy(drive->dev.name, "ATA-Disk");
+ drive->dev.driver = &disk_devdrv;
+ drive->dev.parent = &ch->dev;
+ drive->dev.driver_data = drive;
+ device_register(&drive->dev);
}

/* Extract geometry if we did not already have one for the drive */
@@ -1173,7 +1151,6 @@
printk(KERN_INFO " %s: %ld sectors", drive->name, capacity);

#if 0
-
/* Right now we avoid this calculation, since it can result in the
* usage of not supported compiler internal functions on 32 bit hosts.
* However since the calculation appears to be an interesting piece of
@@ -1428,7 +1405,7 @@
attach: idedisk_attach,
cleanup: idedisk_cleanup,
standby: idedisk_standby,
- do_request: idedisk_do_request,
+ XXX_do_request: idedisk_do_request,
end_request: NULL,
ioctl: idedisk_ioctl,
open: idedisk_open,
diff -urN linux-2.5.21/drivers/ide/ide-floppy.c linux/drivers/ide/ide-floppy.c
--- linux-2.5.21/drivers/ide/ide-floppy.c 2002-06-10 23:58:47.000000000 +0200
+++ linux/drivers/ide/ide-floppy.c 2002-06-13 17:27:12.000000000 +0200
@@ -1279,8 +1279,10 @@
*/
static ide_startstop_t idefloppy_do_request(struct ata_device *drive, struct request *rq, sector_t block)
{
+ struct ata_channel *ch = drive->channel;
idefloppy_floppy_t *floppy = drive->driver_data;
struct atapi_packet_command *pc;
+ int ret;

#if IDEFLOPPY_DEBUG_LOG
printk (KERN_INFO "rq_status: %d, rq_dev: %u, flags: %lx, errors: %d\n",rq->rq_status,(unsigned int) rq->rq_dev,rq->flags,rq->errors);
@@ -1293,13 +1295,22 @@
drive->name, floppy->failed_pc->c[0], floppy->sense_key, floppy->asc, floppy->ascq);
else
printk (KERN_ERR "ide-floppy: %s: I/O error\n", drive->name);
+
+ /* FIXME: make this unlocking go away*/
+ spin_unlock_irq(ch->lock);
idefloppy_end_request(drive, rq, 0);
+ spin_lock_irq(ch->lock);
+
return ide_stopped;
}
if (rq->flags & REQ_CMD) {
if (rq->sector % floppy->bs_factor || rq->nr_sectors % floppy->bs_factor) {
printk ("%s: unsupported r/w request size\n", drive->name);
+ /* FIXME: make this unlocking go away*/
+ spin_unlock_irq(ch->lock);
idefloppy_end_request(drive, rq, 0);
+ spin_lock_irq(ch->lock);
+
return ide_stopped;
}
pc = idefloppy_next_pc_storage(drive);
@@ -1309,11 +1320,20 @@
pc = (struct atapi_packet_command *) rq->buffer;
} else {
blk_dump_rq_flags(rq, "ide-floppy: unsupported command in queue");
+ /* FIXME: make this unlocking go away*/
+ spin_unlock_irq(ch->lock);
idefloppy_end_request(drive, rq, 0);
+ spin_lock_irq(ch->lock);
+
return ide_stopped;
}

- return idefloppy_issue_pc(drive, rq, pc);
+ /* FIXME: make this unlocking go away*/
+ spin_unlock_irq(ch->lock);
+ ret = idefloppy_issue_pc(drive, rq, pc);
+ spin_lock_irq(ch->lock);
+
+ return ret;
}

/*
@@ -2027,7 +2047,7 @@
attach: idefloppy_attach,
cleanup: idefloppy_cleanup,
standby: NULL,
- do_request: idefloppy_do_request,
+ XXX_do_request: idefloppy_do_request,
end_request: idefloppy_end_request,
ioctl: idefloppy_ioctl,
open: idefloppy_open,
diff -urN linux-2.5.21/drivers/ide/ide-tape.c linux/drivers/ide/ide-tape.c
--- linux-2.5.21/drivers/ide/ide-tape.c 2002-06-11 00:18:38.000000000 +0200
+++ linux/drivers/ide/ide-tape.c 2002-06-13 17:14:25.000000000 +0200
@@ -2604,10 +2604,12 @@
*/
static ide_startstop_t idetape_do_request(struct ata_device *drive, struct request *rq, sector_t block)
{
+ struct ata_channel *ch = drive->channel;
idetape_tape_t *tape = drive->driver_data;
struct atapi_packet_command *pc;
struct request *postponed_rq = tape->postponed_rq;
idetape_status_reg_t status;
+ int ret;

#if IDETAPE_DEBUG_LOG
/* if (tape->debug_level >= 5)
@@ -2621,7 +2623,7 @@
* We do not support buffer cache originated requests.
*/
printk (KERN_NOTICE "ide-tape: %s: Unsupported command in request queue (%ld)\n", drive->name, rq->flags);
- ata_end_request(drive, rq, 0); /* Let the common code handle it */
+ __ata_end_request(drive, rq, 0, 0); /* Let the common code handle it */
return ide_stopped;
}

@@ -2629,13 +2631,24 @@
* Retry a failed packet command
*/
if (tape->failed_pc != NULL && tape->pc->c[0] == IDETAPE_REQUEST_SENSE_CMD) {
- return idetape_issue_packet_command(drive, rq, tape->failed_pc);
+ int ret;
+
+ /* FIXME: make this unlocking go away*/
+ spin_unlock_irq(ch->lock);
+ ret = idetape_issue_packet_command(drive, rq, tape->failed_pc);
+ spin_lock_irq(ch->lock);
+
+ return ret;
}
#if IDETAPE_DEBUG_BUGS
if (postponed_rq != NULL)
if (rq != postponed_rq) {
printk (KERN_ERR "ide-tape: ide-tape.c bug - Two DSC requests were queued\n");
+ /* FIXME: make this unlocking go away*/
+ spin_unlock_irq(ch->lock);
idetape_end_request(drive, rq, 0);
+ spin_lock_irq(ch->lock);
+
return ide_stopped;
}
#endif
@@ -2656,7 +2669,7 @@
if (tape->onstream)
status.b.dsc = 1;
if (!drive->dsc_overlap && rq->flags != IDETAPE_PC_RQ2)
- set_bit (IDETAPE_IGNORE_DSC, &tape->flags);
+ set_bit(IDETAPE_IGNORE_DSC, &tape->flags);

/*
* For the OnStream tape, check the current status of the tape
@@ -2701,7 +2714,7 @@
tape->req_buffer_fill = 1;
}
#if ONSTREAM_DEBUG
- else if (tape->debug_level >= 4)
+ else if (tape->debug_level >= 4)
printk(KERN_INFO "ide-tape: %s: postpone_cnt %d\n", tape->name, tape->postpone_cnt);
#endif
}
@@ -2713,14 +2726,20 @@
} else if ((signed long) (jiffies - tape->dsc_timeout) > 0) {
printk (KERN_ERR "ide-tape: %s: DSC timeout\n", tape->name);
if (rq->flags == IDETAPE_PC_RQ2) {
+ /* FIXME: make this unlocking go away*/
+ spin_unlock_irq(ch->lock);
idetape_media_access_finished(drive, rq);
+ spin_lock_irq(ch->lock);
return ide_stopped;
} else {
return ide_stopped;
}
} else if (jiffies - tape->dsc_polling_start > IDETAPE_DSC_MA_THRESHOLD)
tape->dsc_polling_frequency = IDETAPE_DSC_MA_SLOW;
+ /* FIXME: make this unlocking go away*/
+ spin_unlock_irq(ch->lock);
idetape_postpone_request(drive, rq);
+ spin_lock_irq(ch->lock);
return ide_stopped;
}
switch (rq->flags) {
@@ -2737,8 +2756,8 @@
if (jiffies > tape->last_buffer_fill + 5 * HZ / 100)
tape->req_buffer_fill = 1;
}
- pc = idetape_next_pc_storage (drive);
- idetape_create_read_cmd (tape, pc, rq->current_nr_sectors, rq->bio);
+ pc = idetape_next_pc_storage(drive);
+ idetape_create_read_cmd(tape, pc, rq->current_nr_sectors, rq->bio);
break;
case IDETAPE_WRITE_RQ:
tape->buffer_head++;
@@ -2755,12 +2774,12 @@
calculate_speeds(drive);
}
pc = idetape_next_pc_storage (drive);
- idetape_create_write_cmd (tape, pc, rq->current_nr_sectors, rq->bio);
+ idetape_create_write_cmd(tape, pc, rq->current_nr_sectors, rq->bio);
break;
case IDETAPE_READ_BUFFER_RQ:
tape->postpone_cnt = 0;
pc = idetape_next_pc_storage (drive);
- idetape_create_read_buffer_cmd (tape, pc, rq->current_nr_sectors, rq->bio);
+ idetape_create_read_buffer_cmd(tape, pc, rq->current_nr_sectors, rq->bio);
break;
case IDETAPE_ABORTED_WRITE_RQ:
rq->flags = IDETAPE_WRITE_RQ;
@@ -2780,14 +2799,25 @@
rq->flags = IDETAPE_PC_RQ2;
break;
case IDETAPE_PC_RQ2:
+ /* FIXME: make this unlocking go away*/
+ spin_unlock_irq(ch->lock);
idetape_media_access_finished(drive, rq);
+ spin_lock_irq(ch->lock);
return ide_stopped;
default:
printk (KERN_ERR "ide-tape: bug in IDETAPE_RQ_CMD macro\n");
+ /* FIXME: make this unlocking go away*/
+ spin_unlock_irq(ch->lock);
idetape_end_request(drive, rq, 0);
+ spin_lock_irq(ch->lock);
return ide_stopped;
}
- return idetape_issue_packet_command(drive, rq, pc);
+ /* FIXME: make this unlocking go away*/
+ spin_unlock_irq(ch->lock);
+ ret = idetape_issue_packet_command(drive, rq, pc);
+ spin_lock_irq(ch->lock);
+
+ return ret;
}

/*
@@ -6098,7 +6128,7 @@
attach: idetape_attach,
cleanup: idetape_cleanup,
standby: NULL,
- do_request: idetape_do_request,
+ XXX_do_request: idetape_do_request,
end_request: idetape_end_request,
ioctl: idetape_blkdev_ioctl,
open: idetape_blkdev_open,
diff -urN linux-2.5.21/drivers/ide/main.c linux/drivers/ide/main.c
--- linux-2.5.21/drivers/ide/main.c 2002-06-13 20:15:09.000000000 +0200
+++ linux/drivers/ide/main.c 2002-06-13 15:16:57.000000000 +0200
@@ -622,8 +622,6 @@
struct ata_operations *tmp;
unsigned long flags;

- struct ata_operations *sd = NULL;
-
spin_lock_irqsave(&ata_drivers_lock, flags);
for(tmp = ata_drivers; tmp; tmp = tmp->next) {
if (subdriver_match(ch, tmp) > 0)
diff -urN linux-2.5.21/drivers/ide/pdc202xx.c linux/drivers/ide/pdc202xx.c
--- linux-2.5.21/drivers/ide/pdc202xx.c 2002-06-13 20:15:09.000000000 +0200
+++ linux/drivers/ide/pdc202xx.c 2002-06-13 15:59:20.000000000 +0200
@@ -159,7 +159,10 @@
{
struct pci_dev *dev = drive->channel->pci_dev;
u32 drive_conf;
- u8 drive_pci, AP, BP, CP, DP, TA = 0, TB, TC = 0;
+ u8 drive_pci, AP, BP, CP, TA = 0, TB, TC = 0;
+#if PDC202XX_DECODE_REGISTER_INFO
+ u8 DP;
+#endif

if (drive->dn > 3) /* FIXME: remove this --bkz */
return -1;
@@ -188,7 +191,7 @@
case XFER_SW_DMA_2: TB = 0x60; TC = 0x05; break;
case XFER_SW_DMA_1: TB = 0x80; TC = 0x06; break;
case XFER_SW_DMA_0: TB = 0xC0; TC = 0x0B; break;
-#endif /* CONFIG_BLK_DEV_IDEDMA */
+#endif
case XFER_PIO_4: TA = 0x01; TB = 0x04; break;
case XFER_PIO_3: TA = 0x02; TB = 0x06; break;
case XFER_PIO_2: TA = 0x03; TB = 0x08; break;
diff -urN linux-2.5.21/drivers/ide/probe.c linux/drivers/ide/probe.c
--- linux-2.5.21/drivers/ide/probe.c 2002-06-11 00:18:00.000000000 +0200
+++ linux/drivers/ide/probe.c 2002-06-13 15:34:50.000000000 +0200
@@ -850,10 +850,11 @@
goto not_found;

/* Register this hardware interface within the global device tree.
+ *
+ * FIXME: This should be handled as a pci subdevice in a generic way.
*/
- sprintf(ch->dev.bus_id, "%04lx",
- (unsigned long) ch->io_ports[IDE_DATA_OFFSET]);
- sprintf(ch->dev.name, "ide");
+ sprintf(ch->dev.bus_id, "ata@%02x", ch->unit);
+ strcpy(ch->dev.name, "ATA/ATAPI Host-Channel");
ch->dev.driver_data = ch;
#ifdef CONFIG_PCI
if (ch->pci_dev)
diff -urN linux-2.5.21/drivers/scsi/ide-scsi.c linux/drivers/scsi/ide-scsi.c
--- linux-2.5.21/drivers/scsi/ide-scsi.c 2002-06-10 23:54:50.000000000 +0200
+++ linux/drivers/scsi/ide-scsi.c 2002-06-13 17:29:27.000000000 +0200
@@ -482,6 +482,9 @@
*/
static ide_startstop_t idescsi_do_request(struct ata_device *drive, struct request *rq, sector_t block)
{
+ struct ata_channel *ch = drive->channel;
+ int ret;
+
#ifdef DEBUG
printk(KERN_INFO "rq_status: %d, cmd: %d, errors: %d\n",
rq->rq_status,
@@ -494,12 +497,18 @@
rq->current_nr_sectors);
#endif

+ /* FIXME: make this unlocking go away*/
+ spin_unlock_irq(ch->lock);
if (rq->flags & REQ_PC) {
- return idescsi_issue_pc(drive, rq, (struct atapi_packet_command *) rq->special);
+ ret = idescsi_issue_pc(drive, rq, (struct atapi_packet_command *) rq->special);
+ } else {
+ blk_dump_rq_flags(rq, "ide-scsi: unsup command");
+ idescsi_end_request(drive, rq, 0);
+ ret = ide_stopped;
}
- blk_dump_rq_flags(rq, "ide-scsi: unsup command");
- idescsi_end_request(drive, rq, 0);
- return ide_stopped;
+ spin_lock_irq(ch->lock);
+
+ return ret;
}

static int idescsi_open(struct inode *inode, struct file *filp, struct ata_device *drive)
@@ -540,7 +549,7 @@
owner: THIS_MODULE,
attach: idescsi_attach,
cleanup: idescsi_cleanup,
- do_request: idescsi_do_request,
+ XXX_do_request: idescsi_do_request,
end_request: idescsi_end_request,
open: idescsi_open,
release: idescsi_release,
diff -urN linux-2.5.21/include/linux/ide.h linux/include/linux/ide.h
--- linux-2.5.21/include/linux/ide.h 2002-06-13 20:15:09.000000000 +0200
+++ linux/include/linux/ide.h 2002-06-13 15:52:17.000000000 +0200
@@ -357,7 +357,7 @@
byte queue_depth; /* max queue depth */
unsigned int failures; /* current failure count */
unsigned int max_failures; /* maximum allowed failure count */
- struct device device; /* global device tree handle */
+ struct device dev; /* global device tree handle */

/*
* tcq statistics
@@ -545,7 +545,7 @@
void (*attach) (struct ata_device *);
int (*cleanup)(struct ata_device *);
int (*standby)(struct ata_device *);
- ide_startstop_t (*do_request)(struct ata_device *, struct request *, sector_t);
+ ide_startstop_t (*XXX_do_request)(struct ata_device *, struct request *, sector_t);
int (*end_request)(struct ata_device *, struct request *, int);

int (*ioctl)(struct ata_device *, struct inode *, struct file *, unsigned int, unsigned long);


Attachments:
ide-clean-89.diff (23.39 kB)

2002-06-14 11:08:54

by Martin Dalecki

[permalink] [raw]
Subject: [PATCH] 2.5.21 IDE 90

diff -urN linux-2.5.21/drivers/ide/alim15x3.c linux/drivers/ide/alim15x3.c
--- linux-2.5.21/drivers/ide/alim15x3.c 2002-06-09 07:30:37.000000000 +0200
+++ linux/drivers/ide/alim15x3.c 2002-06-13 22:53:06.000000000 +0200
@@ -176,11 +176,6 @@
return ide_config_drive_speed(drive, speed);
}

-static void config_chipset_for_pio(struct ata_device *drive)
-{
- ali15x3_tune_drive(drive, 5);
-}
-
#ifdef CONFIG_BLK_DEV_IDEDMA
static int config_chipset_for_dma(struct ata_device *drive, u8 udma)
{
@@ -253,7 +248,7 @@
on = 0;
verbose = 0;
no_dma_set:
- config_chipset_for_pio(drive);
+ ali15x3_tune_drive(drive, 255);
}

udma_enable(drive, on, verbose);
diff -urN linux-2.5.21/drivers/ide/ata-timing.c linux/drivers/ide/ata-timing.c
--- linux-2.5.21/drivers/ide/ata-timing.c 2002-06-09 17:44:23.000000000 +0200
+++ linux/drivers/ide/ata-timing.c 2002-06-13 22:53:06.000000000 +0200
@@ -270,3 +270,25 @@

return 0;
}
+
+u8 ata_best_pio_mode(struct ata_device *drive)
+{
+ static u16 eide_pio_timing[6] = { 600, 383, 240, 180, 120, 90 };
+ u16 pio_min;
+ u8 pio;
+
+ pio = ata_timing_mode(drive, XFER_PIO | XFER_EPIO) - XFER_PIO_0;
+
+ /* downgrade mode if necessary */
+ pio_min = (pio > 2) ? drive->id->eide_pio_iordy : drive->id->eide_pio;
+
+ if (pio_min)
+ while (pio && pio_min > eide_pio_timing[pio])
+ pio--;
+
+ if (!pio && drive->id->tPIO)
+ return XFER_PIO_SLOW;
+
+ /* don't allow XFER_PIO_5 for now */
+ return XFER_PIO_0 + min_t(u8, pio, 4);
+}
diff -urN linux-2.5.21/drivers/ide/ata-timing.h linux/drivers/ide/ata-timing.h
--- linux-2.5.21/drivers/ide/ata-timing.h 2002-06-09 17:44:23.000000000 +0200
+++ linux/drivers/ide/ata-timing.h 2002-06-13 22:53:06.000000000 +0200
@@ -83,5 +83,6 @@
extern struct ata_timing* ata_timing_data(short speed);
extern int ata_timing_compute(struct ata_device *drive,
short speed, struct ata_timing *t, int T, int UT);
+extern u8 ata_best_pio_mode(struct ata_device *drive);

#endif
diff -urN linux-2.5.21/drivers/ide/cmd64x.c linux/drivers/ide/cmd64x.c
--- linux-2.5.21/drivers/ide/cmd64x.c 2002-06-13 20:15:09.000000000 +0200
+++ linux/drivers/ide/cmd64x.c 2002-06-13 22:53:06.000000000 +0200
@@ -152,16 +152,14 @@
}

/*
- * Attempts to set the interface PIO mode.
- * The preferred method of selecting PIO modes (e.g. mode 4) is
- * "echo 'piomode:4' > /proc/ide/hdx/settings". Special cases are
+ * Attempts to set the interface PIO mode. Special cases are
* 8: prefetch off, 9: prefetch on, 255: auto-select best mode.
* Called with 255 at boot time.
*/
static void cmd64x_tuneproc(struct ata_device *drive, byte mode_wanted)
{
int recovery_time, clock_time;
- byte recovery_count2, cycle_count;
+ u8 recovery_count2, cycle_count, speed;
int setup_count, active_count, recovery_count;
struct ata_timing *t;

@@ -172,10 +170,14 @@
/*set_prefetch_mode(index, mode_wanted);*/
cmdprintk("%s: %sabled cmd640 prefetch\n", drive->name, mode_wanted ? "en" : "dis");
return;
- case 255: mode_wanted = ata_timing_mode(drive, XFER_PIO | XFER_EPIO);
}

- t = ata_timing_data(XFER_PIO_0 + min_t(byte, mode_wanted, 4));
+ if (mode_wanted == 255)
+ speed = ata_best_pio_mode(drive);
+ else
+ speed = XFER_PIO_0 + min_t(u8, mode_wanted, 4);
+
+ t = ata_timing_data(speed);

/*
* I copied all this complicated stuff from cmd640.c and made a few minor changes.
@@ -213,6 +215,9 @@
cmdprintk("%s: selected cmd646 PIO mode%d : %d (%dns), clocks=%d/%d/%d\n",
drive->name, t.mode - XFER_PIO_0, mode_wanted, cycle_time,
setup_count, active_count, recovery_count);
+
+ drive->current_speed = speed;
+ ide_config_drive_speed(drive, speed);
}

static int cmd64x_ratemask(struct ata_device *drive)
@@ -283,13 +288,26 @@
}
}

-static void cmd680_tuneproc(struct ata_device *drive, u8 mode_wanted)
+static void cmd680_tuneproc(struct ata_device *drive, u8 pio)
{
- struct ata_channel *hwif = drive->channel;
- struct pci_dev *dev = hwif->pci_dev;
- u8 drive_pci;
+ struct ata_channel *ch = drive->channel;
+ struct pci_dev *dev = ch->pci_dev;
+ u8 unit = (drive->select.b.unit & 0x01);
+ u8 addr_mask = (ch->unit) ? 0x84 : 0x80;
+ u8 drive_pci, mode_pci, speed;
+ u8 channel_timings = cmd680_taskfile_timing(ch);
u16 speedt;

+ pci_read_config_byte(dev, addr_mask, &mode_pci);
+ mode_pci &= ~(unit ? 0x30 : 0x03);
+
+ if (pio == 255)
+ pio = ata_best_pio_mode(drive) - XFER_PIO_0;
+
+ /* WARNING PIO timing mess is going to happen b/w devices, argh */
+ if ((channel_timings != pio) && (pio > channel_timings))
+ pio = channel_timings;
+
switch (drive->dn) {
case 0: drive_pci = 0xA4; break;
case 1: drive_pci = 0xA6; break;
@@ -302,7 +320,7 @@

/* cheat for now and use the docs */
// switch(cmd680_taskfile_timing(hwif)) {
- switch(mode_wanted) {
+ switch(pio) {
case 4: speedt = 0x10c1; break;
case 3: speedt = 0x10C3; break;
case 2: speedt = 0x1104; break;
@@ -311,50 +329,11 @@
default: speedt = 0x328A; break;
}
pci_write_config_word(dev, drive_pci, speedt);
-}
-
-static void config_cmd64x_chipset_for_pio(struct ata_device *drive, u8 set_speed)
-{
- u8 set_pio = ata_timing_mode(drive, XFER_PIO | XFER_EPIO) - XFER_PIO_0;
-
- cmd64x_tuneproc(drive, set_pio);
- if (set_speed)
- (void) ide_config_drive_speed(drive, XFER_PIO_0 + set_pio);
-}
-
-static void config_cmd680_chipset_for_pio(struct ata_device *drive, u8 set_speed)
-{
- struct ata_channel *hwif = drive->channel;
- struct pci_dev *dev = hwif->pci_dev;
- u8 unit = (drive->select.b.unit & 0x01);
- u8 addr_mask = (hwif->unit) ? 0x84 : 0x80;
- u8 speed;
- u8 mode_pci;
- u8 channel_timings = cmd680_taskfile_timing(hwif);
- u8 set_pio = ata_timing_mode(drive, XFER_PIO | XFER_EPIO) - XFER_PIO_0;
-
- pci_read_config_byte(dev, addr_mask, &mode_pci);
- mode_pci &= ~((unit) ? 0x30 : 0x03);

- /* WARNING PIO timing mess is going to happen b/w devices, argh */
- if ((channel_timings != set_pio) && (set_pio > channel_timings))
- set_pio = channel_timings;
+ speed = XFER_PIO_0 + min_t(u8, pio, 4);

- cmd680_tuneproc(drive, set_pio);
- speed = XFER_PIO_0 + set_pio;
- if (set_speed) {
- (void) ide_config_drive_speed(drive, speed);
- drive->current_speed = speed;
- }
-}
-
-static void config_chipset_for_pio(struct ata_device *drive, byte set_speed)
-{
- if (drive->channel->pci_dev->device == PCI_DEVICE_ID_CMD_680) {
- config_cmd680_chipset_for_pio(drive, set_speed);
- } else {
- config_cmd64x_chipset_for_pio(drive, set_speed);
- }
+ drive->current_speed = speed;
+ ide_config_drive_speed(drive, speed);
}

static int cmd64x_tune_chipset(struct ata_device *drive, byte speed)
@@ -403,11 +382,13 @@
case XFER_PIO_1:
case XFER_PIO_0:
cmd64x_tuneproc(drive, speed - XFER_PIO_0);
- break;
+ /* FIXME: error checking --bkz */
+ return 0;
default:
return 1;
}

+ cmd64x_tuneproc(drive, 255);
#ifdef CONFIG_BLK_DEV_IDEDMA
(void) pci_write_config_byte(dev, pciU, regU);
#endif /* CONFIG_BLK_DEV_IDEDMA */
@@ -510,14 +491,13 @@
case XFER_PIO_1:
case XFER_PIO_0:
cmd680_tuneproc(drive, speed - XFER_PIO_0);
- break;
+ /* FIXME: error checking --bkz */
+ return 0;
default:
return 1;
}

- if (speed >= XFER_MW_DMA_0)
- config_cmd680_chipset_for_pio(drive, 0);
-
+ cmd680_tuneproc(drive, 255);
if (speed >= XFER_UDMA_0)
mode_pci |= ((unit) ? 0x30 : 0x03);
else if (speed >= XFER_MW_DMA_0)
@@ -552,12 +532,6 @@

mode = ata_timing_mode(drive, map);

- if (mode < XFER_SW_DMA_0) {
- config_chipset_for_pio(drive, 1);
- return 0;
- }
-
- config_chipset_for_pio(drive, 0);
return !drive->channel->speedproc(drive, mode);
}

@@ -568,6 +542,8 @@
int on = 1;
int verbose = 1;

+ hwif->tuneproc(drive, 255);
+
if ((id != NULL) && ((id->capability & 1) != 0) &&
hwif->autodma && (drive->type == ATA_DISK)) {
/* Consult the list of known "bad" drives */
@@ -610,7 +586,7 @@
on = 0;
verbose = 0;
no_dma_set:
- config_chipset_for_pio(drive, 1);
+ hwif->tuneproc(drive, 255);
}

udma_enable(drive, on, verbose);
diff -urN linux-2.5.21/drivers/ide/device.c linux/drivers/ide/device.c
--- linux-2.5.21/drivers/ide/device.c 2002-06-11 00:17:34.000000000 +0200
+++ linux/drivers/ide/device.c 2002-06-14 00:02:43.000000000 +0200
@@ -126,9 +126,8 @@
* setting a timer to wake up at half second intervals thereafter, until
* timeout is achieved, before timing out.
*
- * FIXME: Channel lock should be held.
+ * Channel lock should be held.
*/
-
int ata_status_poll(struct ata_device *drive, u8 good, u8 bad,
unsigned long timeout,
struct request *rq, ide_startstop_t *startstop)
@@ -159,6 +158,7 @@
if (ata_status(drive, good, bad))
return 0;
}
+
*startstop = ata_error(drive, rq, "status error");

return 1;
diff -urN linux-2.5.21/drivers/ide/hpt34x.c linux/drivers/ide/hpt34x.c
--- linux-2.5.21/drivers/ide/hpt34x.c 2002-06-13 20:15:09.000000000 +0200
+++ linux/drivers/ide/hpt34x.c 2002-06-13 22:53:06.000000000 +0200
@@ -67,43 +67,6 @@
return ide_config_drive_speed(drive, speed);
}

-static void config_chipset_for_pio(struct ata_device *drive)
-{
- unsigned short eide_pio_timing[6] = {960, 480, 240, 180, 120, 90};
- unsigned short xfer_pio = drive->id->eide_pio_modes;
-
- u8 timing, speed, pio;
-
- pio = ata_timing_mode(drive, XFER_PIO | XFER_EPIO) - XFER_PIO_0;
-
- if (xfer_pio > 4)
- xfer_pio = 0;
-
- if (drive->id->eide_pio_iordy > 0) {
- for (xfer_pio = 5;
- xfer_pio>0 &&
- drive->id->eide_pio_iordy>eide_pio_timing[xfer_pio];
- xfer_pio--);
- } else {
- xfer_pio = (drive->id->eide_pio_modes & 4) ? 0x05 :
- (drive->id->eide_pio_modes & 2) ? 0x04 :
- (drive->id->eide_pio_modes & 1) ? 0x03 : xfer_pio;
- }
-
- timing = (xfer_pio >= pio) ? xfer_pio : pio;
-
- switch(timing) {
- case 4: speed = XFER_PIO_4;break;
- case 3: speed = XFER_PIO_3;break;
- case 2: speed = XFER_PIO_2;break;
- case 1: speed = XFER_PIO_1;break;
- default:
- speed = (!drive->id->tPIO) ? XFER_PIO_0 : XFER_PIO_SLOW;
- break;
- }
- (void) hpt34x_tune_chipset(drive, speed);
-}
-
static void hpt34x_tune_drive(struct ata_device *drive, u8 pio)
{
(void) hpt34x_tune_chipset(drive, XFER_PIO_0 + min_t(u8, pio, 4));
@@ -177,7 +140,7 @@
on = 0;
verbose = 0;
no_dma_set:
- config_chipset_for_pio(drive);
+ hpt34x_tune_chipset(drive, ata_best_pio_mode(drive));
}

#ifndef CONFIG_HPT34X_AUTODMA
diff -urN linux-2.5.21/drivers/ide/hpt366.c linux/drivers/ide/hpt366.c
--- linux-2.5.21/drivers/ide/hpt366.c 2002-06-13 20:15:09.000000000 +0200
+++ linux/drivers/ide/hpt366.c 2002-06-13 22:53:06.000000000 +0200
@@ -682,44 +682,6 @@
return ide_config_drive_speed(drive, speed);
}

-static void config_chipset_for_pio(struct ata_device *drive)
-{
- static unsigned short eide_pio_timing[6] = {960, 480, 240, 180, 120, 90};
- unsigned short xfer_pio = drive->id->eide_pio_modes;
- u8 timing, speed, pio;
-
- pio = ata_timing_mode(drive, XFER_PIO | XFER_EPIO) - XFER_PIO_0;
-
- if (xfer_pio > 4)
- xfer_pio = 0;
-
- if (drive->id->eide_pio_iordy > 0) {
- for (xfer_pio = 5;
- xfer_pio>0 &&
- drive->id->eide_pio_iordy>eide_pio_timing[xfer_pio];
- xfer_pio--);
- } else {
- xfer_pio = (drive->id->eide_pio_modes & 4) ? 0x05 :
- (drive->id->eide_pio_modes & 2) ? 0x04 :
- (drive->id->eide_pio_modes & 1) ? 0x03 :
- (drive->id->tPIO & 2) ? 0x02 :
- (drive->id->tPIO & 1) ? 0x01 : xfer_pio;
- }
-
- timing = (xfer_pio >= pio) ? xfer_pio : pio;
-
- switch(timing) {
- case 4: speed = XFER_PIO_4;break;
- case 3: speed = XFER_PIO_3;break;
- case 2: speed = XFER_PIO_2;break;
- case 1: speed = XFER_PIO_1;break;
- default:
- speed = (!drive->id->tPIO) ? XFER_PIO_0 : XFER_PIO_SLOW;
- break;
- }
- hpt3xx_tune_chipset(drive, speed);
-}
-
static void hpt3xx_tune_drive(struct ata_device *drive, u8 pio)
{
u8 speed;
@@ -866,8 +828,7 @@
on = 0;
verbose = 0;
no_dma_set:
-
- config_chipset_for_pio(drive);
+ hpt3xx_tune_chipset(drive, ata_best_pio_mode(drive));
}
udma_enable(drive, on, verbose);

diff -urN linux-2.5.21/drivers/ide/ide.c linux/drivers/ide/ide.c
--- linux-2.5.21/drivers/ide/ide.c 2002-06-13 20:29:39.000000000 +0200
+++ linux/drivers/ide/ide.c 2002-06-13 23:34:16.000000000 +0200
@@ -671,28 +671,12 @@
block = 1; /* redirect MBR access to EZ-Drive partn table */

ata_select(drive, 0);
- spin_unlock_irq(ch->lock);
if (ata_status_poll(drive, drive->ready_stat, BUSY_STAT | DRQ_STAT,
WAIT_READY, rq, &ret)) {
printk(KERN_WARNING "%s: drive not ready for command\n", drive->name);
- spin_lock_irq(ch->lock);

- return ret;
+ goto kill_rq;
}
- spin_lock_irq(ch->lock);
-
- /* This issues a special drive command.
- *
- * FIXME: move this down to idedisk_do_request().
- */
- if (rq->flags & REQ_SPECIAL)
- if (drive->type == ATA_DISK) {
- spin_unlock_irq(ch->lock);
- ret = ata_taskfile(drive, rq->special, NULL);
- spin_lock_irq(ch->lock);
-
- return ret;
- }

if (!ata_ops(drive)) {
printk(KERN_WARNING "%s: device type %d not supported\n",
@@ -704,8 +688,8 @@
* handler down to the device type driver.
*/

- if (ata_ops(drive)->XXX_do_request) {
- ret = ata_ops(drive)->XXX_do_request(drive, rq, block);
+ if (ata_ops(drive)->do_request) {
+ ret = ata_ops(drive)->do_request(drive, rq, block);
} else {
__ata_end_request(drive, rq, 0, 0);
ret = ide_stopped;
diff -urN linux-2.5.21/drivers/ide/ide-cd.c linux/drivers/ide/ide-cd.c
--- linux-2.5.21/drivers/ide/ide-cd.c 2002-06-13 20:29:39.000000000 +0200
+++ linux/drivers/ide/ide-cd.c 2002-06-13 23:39:32.000000000 +0200
@@ -732,46 +732,49 @@
struct ata_channel *ch = drive->channel;
ide_startstop_t startstop;
struct cdrom_info *info = drive->driver_data;
+ int ret;

+ spin_lock_irqsave(ch->lock, flags);
/* Wait for the controller to be idle. */
if (ata_status_poll(drive, 0, BUSY_STAT, WAIT_READY, rq, &startstop))
- return startstop;
-
- spin_lock_irqsave(ch->lock, flags);
-
- if (info->dma) {
- if (info->cmd == READ || info->cmd == WRITE)
- info->dma = !udma_init(drive, rq);
- else
- printk("ide-cd: DMA set, but not allowed\n");
- }
-
- /* Set up the controller registers. */
- OUT_BYTE(info->dma, IDE_FEATURE_REG);
- OUT_BYTE(0, IDE_NSECTOR_REG);
- OUT_BYTE(0, IDE_SECTOR_REG);
-
- OUT_BYTE(xferlen & 0xff, IDE_LCYL_REG);
- OUT_BYTE(xferlen >> 8 , IDE_HCYL_REG);
- ata_irq_enable(drive, 1);
- if (info->dma)
- udma_start(drive, rq);
-
- if (CDROM_CONFIG_FLAGS (drive)->drq_interrupt) {
- ata_set_handler(drive, handler, WAIT_CMD, cdrom_timer_expiry);
- OUT_BYTE (WIN_PACKETCMD, IDE_COMMAND_REG); /* packet command */
- spin_unlock_irqrestore(ch->lock, flags);
+ ret = startstop;
+ else {
+ if (info->dma) {
+ if (info->cmd == READ || info->cmd == WRITE)
+ info->dma = !udma_init(drive, rq);
+ else
+ printk("ide-cd: DMA set, but not allowed\n");
+ }

- return ide_started;
- } else {
- OUT_BYTE (WIN_PACKETCMD, IDE_COMMAND_REG); /* packet command */
- spin_unlock_irqrestore(ch->lock, flags);
+ /* Set up the controller registers. */
+ OUT_BYTE(info->dma, IDE_FEATURE_REG);
+ OUT_BYTE(0, IDE_NSECTOR_REG);
+ OUT_BYTE(0, IDE_SECTOR_REG);
+
+ OUT_BYTE(xferlen & 0xff, IDE_LCYL_REG);
+ OUT_BYTE(xferlen >> 8 , IDE_HCYL_REG);
+ ata_irq_enable(drive, 1);
+ if (info->dma)
+ udma_start(drive, rq);
+
+ if (CDROM_CONFIG_FLAGS (drive)->drq_interrupt) {
+ ata_set_handler(drive, handler, WAIT_CMD, cdrom_timer_expiry);
+ OUT_BYTE (WIN_PACKETCMD, IDE_COMMAND_REG); /* packet command */
+ ret = ide_started;
+ } else {
+ OUT_BYTE (WIN_PACKETCMD, IDE_COMMAND_REG); /* packet command */

- /* FIXME: Woah we have to ungrab the lock before the IRQ
- * handler gets called.
- */
- return handler(drive, rq);
+ /* FIXME: Oj kurwa! We have to ungrab the lock before
+ * the IRQ handler gets called.
+ */
+ spin_unlock_irqrestore(ch->lock, flags);
+ ret = handler(drive, rq);
+ spin_lock_irqsave(ch->lock, flags);
+ }
}
+ spin_unlock_irqrestore(ch->lock, flags);
+
+ return ret;
}

/*
@@ -797,10 +800,16 @@
if (cdrom_decode_status(&startstop, drive, rq, DRQ_STAT, &stat_dum))
return startstop;
} else {
+ /* FIXME: make this locking go away */
+ spin_lock_irqsave(ch->lock, flags);
/* Otherwise, we must wait for DRQ to get set. */
if (ata_status_poll(drive, DRQ_STAT, BUSY_STAT,
- WAIT_READY, rq, &startstop))
+ WAIT_READY, rq, &startstop)) {
+ spin_unlock_irqrestore(ch->lock, flags);
+
return startstop;
+ }
+ spin_unlock_irqrestore(ch->lock, flags);
}

/* Arm the interrupt handler and send the command to the device. */
@@ -1687,8 +1696,6 @@

return ret;
} else if (rq->flags & REQ_SPECIAL) {
- /* FIXME: make this unlocking go away*/
- spin_unlock_irq(ch->lock);
/*
* FIXME: Kill REQ_SEPCIAL and replace it with commands queued
* at the request queue instead as suggested by Linus.
@@ -1696,6 +1703,8 @@
* right now this can only be a reset...
*/

+ /* FIXME: make this unlocking go away*/
+ spin_unlock_irq(ch->lock);
cdrom_end_request(drive, rq, 1);
spin_lock_irq(ch->lock);

@@ -1704,8 +1713,6 @@
struct packet_command pc;
ide_startstop_t startstop;

- /* FIXME: make this unlocking go away*/
- spin_unlock_irq(ch->lock);
memset(&pc, 0, sizeof(pc));
pc.quiet = 1;
pc.timeout = 60 * HZ;
@@ -1713,10 +1720,13 @@
/* FIXME --mdcki */
rq->special = (char *) &pc;

+ /* FIXME: make this unlocking go away*/
+ spin_unlock_irq(ch->lock);
startstop = cdrom_do_packet_command(drive, rq);
+ spin_lock_irq(ch->lock);
+
if (pc.stat)
++rq->errors;
- spin_lock_irq(ch->lock);

return startstop;
}
@@ -2990,7 +3000,7 @@
attach: ide_cdrom_attach,
cleanup: ide_cdrom_cleanup,
standby: NULL,
- XXX_do_request: ide_cdrom_do_request,
+ do_request: ide_cdrom_do_request,
end_request: NULL,
ioctl: ide_cdrom_ioctl,
open: ide_cdrom_open,
diff -urN linux-2.5.21/drivers/ide/ide-disk.c linux/drivers/ide/ide-disk.c
--- linux-2.5.21/drivers/ide/ide-disk.c 2002-06-13 20:29:39.000000000 +0200
+++ linux/drivers/ide/ide-disk.c 2002-06-13 23:42:53.000000000 +0200
@@ -456,7 +456,7 @@

rq->special = &args;

- return ata_taskfile(drive, &args, rq);
+ return ata_do_taskfile(drive, &args, rq);
}

static ide_startstop_t lba28_do_request(struct ata_device *drive, struct request *rq, sector_t block)
@@ -496,7 +496,7 @@

rq->special = &args;

- return ata_taskfile(drive, &args, rq);
+ return ata_do_taskfile(drive, &args, rq);
}

/*
@@ -548,7 +548,7 @@

rq->special = &args;

- return ata_taskfile(drive, &args, rq);
+ return ata_do_taskfile(drive, &args, rq);
}

/*
@@ -560,14 +560,16 @@
*/
static ide_startstop_t idedisk_do_request(struct ata_device *drive, struct request *rq, sector_t block)
{
- unsigned long flags;
- struct ata_channel *ch = drive->channel;
- int ret;
+ /* This issues a special drive command.
+ */
+ if (rq->flags & REQ_SPECIAL)
+ return ata_do_taskfile(drive, rq->special, rq);

/* FIXME: this check doesn't make sense */
if (!(rq->flags & REQ_CMD)) {
blk_dump_rq_flags(rq, "idedisk_do_request - bad command");
__ata_end_request(drive, rq, 0, 0);
+
return ide_stopped;
}

@@ -590,6 +592,7 @@

if (st) {
BUG_ON(!ata_pending_commands(drive));
+
return ide_started;
}
}
@@ -1405,7 +1408,7 @@
attach: idedisk_attach,
cleanup: idedisk_cleanup,
standby: idedisk_standby,
- XXX_do_request: idedisk_do_request,
+ do_request: idedisk_do_request,
end_request: NULL,
ioctl: idedisk_ioctl,
open: idedisk_open,
diff -urN linux-2.5.21/drivers/ide/ide-floppy.c linux/drivers/ide/ide-floppy.c
--- linux-2.5.21/drivers/ide/ide-floppy.c 2002-06-13 20:29:39.000000000 +0200
+++ linux/drivers/ide/ide-floppy.c 2002-06-13 23:22:32.000000000 +0200
@@ -958,27 +958,25 @@
idefloppy_ireason_reg_t ireason;
int ret;

+ /* FIXME: Move this lock upwards.
+ */
+ spin_lock_irqsave(ch->lock, flags);
if (ata_status_poll(drive, DRQ_STAT, BUSY_STAT,
WAIT_READY, rq, &startstop)) {
printk (KERN_ERR "ide-floppy: Strange, packet command initiated yet DRQ isn't asserted\n");

- return startstop;
- }
-
- /* FIXME: this locking should encompass the above register
- * file access too.
- */
-
- spin_lock_irqsave(ch->lock, flags);
- ireason.all=IN_BYTE (IDE_IREASON_REG);
-
- if (!ireason.b.cod || ireason.b.io) {
- printk (KERN_ERR "ide-floppy: (IO,CoD) != (0,1) while issuing a packet command\n");
- ret = ide_stopped;
+ ret = startstop;
} else {
- ata_set_handler (drive, idefloppy_pc_intr, IDEFLOPPY_WAIT_CMD, NULL); /* Set the interrupt routine */
- atapi_write(drive, floppy->pc->c, 12); /* Send the actual packet */
- ret = ide_started;
+ ireason.all=IN_BYTE (IDE_IREASON_REG);
+
+ if (!ireason.b.cod || ireason.b.io) {
+ printk (KERN_ERR "ide-floppy: (IO,CoD) != (0,1) while issuing a packet command\n");
+ ret = ide_stopped;
+ } else {
+ ata_set_handler (drive, idefloppy_pc_intr, IDEFLOPPY_WAIT_CMD, NULL); /* Set the interrupt routine */
+ atapi_write(drive, floppy->pc->c, 12); /* Send the actual packet */
+ ret = ide_started;
+ }
}
spin_unlock_irqrestore(ch->lock, flags);

@@ -2047,7 +2045,7 @@
attach: idefloppy_attach,
cleanup: idefloppy_cleanup,
standby: NULL,
- XXX_do_request: idefloppy_do_request,
+ do_request: idefloppy_do_request,
end_request: idefloppy_end_request,
ioctl: idefloppy_ioctl,
open: idefloppy_open,
diff -urN linux-2.5.21/drivers/ide/ide-tape.c linux/drivers/ide/ide-tape.c
--- linux-2.5.21/drivers/ide/ide-tape.c 2002-06-13 20:29:39.000000000 +0200
+++ linux/drivers/ide/ide-tape.c 2002-06-13 23:21:33.000000000 +0200
@@ -2067,6 +2067,7 @@
tape->dsc_polling_frequency = IDETAPE_DSC_MA_FAST;
tape->dsc_timeout = jiffies + IDETAPE_DSC_MA_TIMEOUT;
idetape_postpone_request(drive, rq); /* Allow ide.c to handle other requests */
+
return ide_stopped;
}
if (tape->failed_pc == pc)
@@ -2074,20 +2075,22 @@
pc->callback(drive, rq); /* Command finished - Call the callback function */
return ide_stopped;
}
+ /* FIXME: this locking should encompass the above register
+ * file access too.
+ */
+
+ spin_lock_irqsave(ch->lock, flags);
#ifdef CONFIG_BLK_DEV_IDEDMA
if (test_and_clear_bit (PC_DMA_IN_PROGRESS, &pc->flags)) {
printk (KERN_ERR "ide-tape: The tape wants to issue more interrupts in DMA mode\n");
printk (KERN_ERR "ide-tape: DMA disabled, reverting to PIO\n");
udma_enable(drive, 0, 1);
+ spin_unlock_irqrestore(ch->lock, flags);

return ide_stopped;
}
#endif
- /* FIXME: this locking should encompass the above register
- * file access too.
- */

- spin_lock_irqsave(ch->lock, flags);
bcount.b.high = IN_BYTE (IDE_BCOUNTH_REG); /* Get the number of bytes to transfer */
bcount.b.low = IN_BYTE (IDE_BCOUNTL_REG); /* on this interrupt */
ireason.all = IN_BYTE (IDE_IREASON_REG);
@@ -2198,37 +2201,35 @@
ide_startstop_t startstop;
int ret;

+ /* FIXME: Move this lock upwards.
+ */
+ spin_lock_irqsave(ch->lock, flags);
if (ata_status_poll(drive, DRQ_STAT, BUSY_STAT,
WAIT_READY, rq, &startstop)) {
printk (KERN_ERR "ide-tape: Strange, packet command initiated yet DRQ isn't asserted\n");

- return startstop;
- }
-
- /* FIXME: this locking should encompass the above register
- * file access too.
- */
-
- spin_lock_irqsave(ch->lock, flags);
- ireason.all = IN_BYTE (IDE_IREASON_REG);
- while (retries-- && (!ireason.b.cod || ireason.b.io)) {
- printk(KERN_ERR "ide-tape: (IO,CoD != (0,1) while issuing a packet command, retrying\n");
- udelay(100);
- ireason.all = IN_BYTE(IDE_IREASON_REG);
- if (retries == 0) {
- printk(KERN_ERR "ide-tape: (IO,CoD != (0,1) while issuing a packet command, ignoring\n");
- ireason.b.cod = 1;
- ireason.b.io = 0;
- }
- }
- if (!ireason.b.cod || ireason.b.io) {
- printk (KERN_ERR "ide-tape: (IO,CoD) != (0,1) while issuing a packet command\n");
- ret = ide_stopped;
+ ret = startstop;
} else {
- tape->cmd_start_time = jiffies;
- ata_set_handler(drive, idetape_pc_intr, IDETAPE_WAIT_CMD, NULL); /* Set the interrupt routine */
- atapi_write(drive,pc->c,12); /* Send the actual packet */
- ret = ide_started;
+ ireason.all = IN_BYTE (IDE_IREASON_REG);
+ while (retries-- && (!ireason.b.cod || ireason.b.io)) {
+ printk(KERN_ERR "ide-tape: (IO,CoD != (0,1) while issuing a packet command, retrying\n");
+ udelay(100);
+ ireason.all = IN_BYTE(IDE_IREASON_REG);
+ if (retries == 0) {
+ printk(KERN_ERR "ide-tape: (IO,CoD != (0,1) while issuing a packet command, ignoring\n");
+ ireason.b.cod = 1;
+ ireason.b.io = 0;
+ }
+ }
+ if (!ireason.b.cod || ireason.b.io) {
+ printk (KERN_ERR "ide-tape: (IO,CoD) != (0,1) while issuing a packet command\n");
+ ret = ide_stopped;
+ } else {
+ tape->cmd_start_time = jiffies;
+ ata_set_handler(drive, idetape_pc_intr, IDETAPE_WAIT_CMD, NULL); /* Set the interrupt routine */
+ atapi_write(drive,pc->c,12); /* Send the actual packet */
+ ret = ide_started;
+ }
}
spin_unlock_irqrestore(ch->lock, flags);

@@ -2736,10 +2737,8 @@
}
} else if (jiffies - tape->dsc_polling_start > IDETAPE_DSC_MA_THRESHOLD)
tape->dsc_polling_frequency = IDETAPE_DSC_MA_SLOW;
- /* FIXME: make this unlocking go away*/
- spin_unlock_irq(ch->lock);
idetape_postpone_request(drive, rq);
- spin_lock_irq(ch->lock);
+
return ide_stopped;
}
switch (rq->flags) {
@@ -6128,7 +6127,7 @@
attach: idetape_attach,
cleanup: idetape_cleanup,
standby: NULL,
- XXX_do_request: idetape_do_request,
+ do_request: idetape_do_request,
end_request: idetape_end_request,
ioctl: idetape_blkdev_ioctl,
open: idetape_blkdev_open,
diff -urN linux-2.5.21/drivers/ide/ide-taskfile.c linux/drivers/ide/ide-taskfile.c
--- linux-2.5.21/drivers/ide/ide-taskfile.c 2002-06-13 20:15:09.000000000 +0200
+++ linux/drivers/ide/ide-taskfile.c 2002-06-13 23:41:56.000000000 +0200
@@ -177,9 +177,9 @@
}

/*
- * FIXME: Channel lock should be held on entry.
+ * Channel lock should be held on entry.
*/
-ide_startstop_t ata_taskfile(struct ata_device *drive,
+ide_startstop_t ata_do_taskfile(struct ata_device *drive,
struct ata_taskfile *ar, struct request *rq)
{
struct hd_driveid *id = drive->id;
@@ -196,27 +196,21 @@
if ((id->command_set_2 & 0x0400) && (id->cfs_enable_2 & 0x0400) &&
(drive->addressing == 1))
ata_out_regfile(drive, &ar->hobfile);
+
ata_out_regfile(drive, &ar->taskfile);

OUT_BYTE((ar->taskfile.device_head & (drive->addressing ? 0xE0 : 0xEF)) | drive->select.all,
IDE_SELECT_REG);

if (ar->handler) {
- unsigned long flags;
struct ata_channel *ch = drive->channel;

/* This is apparently supposed to reset the wait timeout for
* the interrupt to accur.
*/

- /* FIXME: this locking should encompass the above register
- * file access too.
- */
-
- spin_lock_irqsave(ch->lock, flags);
ata_set_handler(drive, ar->handler, WAIT_CMD, NULL);
OUT_BYTE(ar->cmd, IDE_COMMAND_REG);
- spin_unlock_irqrestore(ch->lock, flags);

/* FIXME: Warning check for race between handler and prehandler
* for writing first block of data. however since we are well
@@ -240,6 +234,7 @@
WAIT_DRQ, rq, &startstop)) {
printk(KERN_ERR "%s: no DRQ after issuing %s\n",
drive->name, drive->mult_count ? "MULTWRITE" : "WRITE");
+
return startstop;
}

@@ -261,6 +256,7 @@
return ide_started;
} else {
int i;
+ int ret;

/* Polling wait until the drive is ready.
*
@@ -278,7 +274,12 @@
if (!drive_is_ready(drive)) {
printk(KERN_ERR "DISASTER WAITING TO HAPPEN!\n");
}
- return ar->handler(drive, rq);
+ /* FIXME: make this unlocking go away*/
+ spin_unlock_irq(ch->lock);
+ ret = ar->handler(drive, rq);
+ spin_lock_irq(ch->lock);
+
+ return ret;
}
}
} else {
@@ -448,6 +449,6 @@
EXPORT_SYMBOL(ide_do_drive_cmd);
EXPORT_SYMBOL(ata_read);
EXPORT_SYMBOL(ata_write);
-EXPORT_SYMBOL(ata_taskfile);
+EXPORT_SYMBOL(ata_do_taskfile);
EXPORT_SYMBOL(ata_special_intr);
EXPORT_SYMBOL(ide_raw_taskfile);
diff -urN linux-2.5.21/drivers/ide/pdc202xx.c linux/drivers/ide/pdc202xx.c
--- linux-2.5.21/drivers/ide/pdc202xx.c 2002-06-13 20:29:39.000000000 +0200
+++ linux/drivers/ide/pdc202xx.c 2002-06-13 22:53:06.000000000 +0200
@@ -364,12 +364,12 @@
* 180, 120, 90, 90, 90, 60, 30
* 11, 5, 4, 3, 2, 1, 0
*/
-static void config_chipset_for_pio(struct ata_device *drive, byte pio)
+static void pdc202xx_tune_drive(struct ata_device *drive, u8 pio)
{
- byte speed;
+ u8 speed;

if (pio == 255)
- speed = ata_timing_mode(drive, XFER_PIO | XFER_EPIO);
+ speed = ata_best_pio_mode(drive);
else speed = XFER_PIO_0 + min_t(byte, pio, 4);

pdc202xx_tune_chipset(drive, speed);
@@ -543,7 +543,7 @@
} else goto no_dma_set;
} else if ((id->capability & 8) || (id->field_valid & 2)) {
no_dma_set:
- config_chipset_for_pio(drive, 5);
+ pdc202xx_tune_drive(drive, 255);
}

udma_enable(drive, on, verbose);
@@ -723,7 +723,7 @@

static void __init ide_init_pdc202xx(struct ata_channel *hwif)
{
- hwif->tuneproc = &config_chipset_for_pio;
+ hwif->tuneproc = &pdc202xx_tune_drive;
hwif->quirkproc = &check_in_drive_lists;

switch(hwif->pci_dev->device) {
diff -urN linux-2.5.21/drivers/ide/pdc4030.c linux/drivers/ide/pdc4030.c
--- linux-2.5.21/drivers/ide/pdc4030.c 2002-06-10 23:47:13.000000000 +0200
+++ linux/drivers/ide/pdc4030.c 2002-06-13 21:54:55.000000000 +0200
@@ -247,12 +247,19 @@
if (pdc4030_cmd(drive, PROMISE_GET_CONFIG)) {
return 0;
}
+
+ /* FIXME: Make this go away. */
+ spin_lock_irq(hwif->lock);
if (ata_status_poll(drive, DATA_READY, BAD_W_STAT,
WAIT_DRQ, NULL, &startstop)) {
printk(KERN_INFO
"%s: Failed Promise read config!\n",hwif->name);
+ spin_unlock_irq(hwif->lock);
+
return 0;
}
+ spin_unlock_irq(hwif->lock);
+
promise_read(drive, &ident, SECTOR_WORDS);
if (ident.id[1] != 'P' || ident.id[0] != 'T') {
return 0;
@@ -720,21 +727,34 @@

case WRITE: {
ide_startstop_t startstop;
-/*
- * Strategy on write is:
- * look for the DRQ that should have been immediately asserted
- * copy the request into the hwgroup's scratchpad
- * call the promise_write function to deal with writing the data out
- * NOTE: No interrupts are generated on writes. Write completion must be polled
- */
+ unsigned long flags;
+ struct ata_channel *ch = drive->channel;
+
+ /*
+ * Strategy on write is: look for the DRQ that should have been
+ * immediately asserted copy the request into the hwgroup's
+ * scratchpad call the promise_write function to deal with
+ * writing the data out.
+ *
+ * NOTE: No interrupts are generated on writes. Write
+ * completion must be polled
+ */
+
+ /* FIXME: Move this lock upwards.
+ */
+ spin_lock_irqsave(ch->lock, flags);
if (ata_status_poll(drive, DATA_READY, drive->bad_wstat,
WAIT_DRQ, rq, &startstop )) {
printk(KERN_ERR "%s: no DRQ after issuing "
"PROMISE_WRITE\n", drive->name);
+ spin_unlock_irqrestore(ch->lock, flags);
+
return startstop;
}
if (!drive->channel->unmask)
__cli(); /* local CPU only */
+ spin_unlock_irqrestore(ch->lock, flags);
+
return promise_do_write(drive, rq);
}

diff -urN linux-2.5.21/drivers/ide/serverworks.c linux/drivers/ide/serverworks.c
--- linux-2.5.21/drivers/ide/serverworks.c 2002-06-09 17:44:23.000000000 +0200
+++ linux/drivers/ide/serverworks.c 2002-06-13 22:53:06.000000000 +0200
@@ -226,44 +226,6 @@
return ide_config_drive_speed(drive, speed);
}

-static void config_chipset_for_pio(struct ata_device *drive)
-{
- unsigned short eide_pio_timing[6] = {960, 480, 240, 180, 120, 90};
- unsigned short xfer_pio = drive->id->eide_pio_modes;
- byte timing, speed, pio;
-
- pio = ata_timing_mode(drive, XFER_PIO | XFER_EPIO) - XFER_PIO_0;
-
- if (xfer_pio > 4)
- xfer_pio = 0;
-
- if (drive->id->eide_pio_iordy > 0)
- for (xfer_pio = 5;
- xfer_pio>0 &&
- drive->id->eide_pio_iordy>eide_pio_timing[xfer_pio];
- xfer_pio--);
- else
- xfer_pio = (drive->id->eide_pio_modes & 4) ? 0x05 :
- (drive->id->eide_pio_modes & 2) ? 0x04 :
- (drive->id->eide_pio_modes & 1) ? 0x03 :
- (drive->id->tPIO & 2) ? 0x02 :
- (drive->id->tPIO & 1) ? 0x01 : xfer_pio;
-
- timing = (xfer_pio >= pio) ? xfer_pio : pio;
-
- switch(timing) {
- case 4: speed = XFER_PIO_4;break;
- case 3: speed = XFER_PIO_3;break;
- case 2: speed = XFER_PIO_2;break;
- case 1: speed = XFER_PIO_1;break;
- default:
- speed = (!drive->id->tPIO) ? XFER_PIO_0 : XFER_PIO_SLOW;
- break;
- }
- (void) svwks_tune_chipset(drive, speed);
- drive->current_speed = speed;
-}
-
static void svwks_tune_drive(struct ata_device *drive, byte pio)
{
byte speed;
@@ -337,7 +299,7 @@
on = 0;
verbose = 0;
no_dma_set:
- config_chipset_for_pio(drive);
+ svwks_tune_chipset(drive, ata_best_pio_mode(drive));
}

udma_enable(drive, on, verbose);
diff -urN linux-2.5.21/drivers/ide/sis5513.c linux/drivers/ide/sis5513.c
--- linux-2.5.21/drivers/ide/sis5513.c 2002-06-09 07:29:00.000000000 +0200
+++ linux/drivers/ide/sis5513.c 2002-06-13 22:53:06.000000000 +0200
@@ -263,15 +263,11 @@


/* Set per-drive active and recovery time */
-static void config_art_rwp_pio(struct ata_device *drive, u8 pio)
+static int config_art_rwp_pio(struct ata_device *drive, u8 pio)
{
struct ata_channel *hwif = drive->channel;
- struct pci_dev *dev = hwif->pci_dev;
-
- byte timing, drive_pci, test1, test2;
-
- unsigned short eide_pio_timing[6] = {600, 390, 240, 180, 120, 90};
- unsigned short xfer_pio = drive->id->eide_pio_modes;
+ struct pci_dev *dev = hwif->pci_dev;
+ u8 drive_pci, test1, test2, speed;

#ifdef DEBUG
sis5513_load_verify_registers(dev, "config_drive_art_rwp_pio start");
@@ -279,25 +275,6 @@

config_drive_art_rwp(drive);

- if (pio == 255)
- pio = ata_timing_mode(drive, XFER_PIO | XFER_EPIO) - XFER_PIO_0;
-
- if (xfer_pio> 4)
- xfer_pio = 0;
-
- if (drive->id->eide_pio_iordy > 0) {
- for (xfer_pio = 5;
- (xfer_pio > 0) &&
- (drive->id->eide_pio_iordy > eide_pio_timing[xfer_pio]);
- xfer_pio--);
- } else {
- xfer_pio = (drive->id->eide_pio_modes & 4) ? 0x05 :
- (drive->id->eide_pio_modes & 2) ? 0x04 :
- (drive->id->eide_pio_modes & 1) ? 0x03 : xfer_pio;
- }
-
- timing = (xfer_pio >= pio) ? xfer_pio : pio;
-
#ifdef DEBUG
printk("SIS5513: config_drive_art_rwp_pio, drive %d, pio %d, timing %d\n",
drive->dn, pio, timing);
@@ -308,7 +285,7 @@
case 1: drive_pci = 0x42; break;
case 2: drive_pci = 0x44; break;
case 3: drive_pci = 0x46; break;
- default: return;
+ default: return 1;
}

/* register layout changed with newer ATA100 chips */
@@ -320,7 +297,7 @@
test1 &= ~0x0F;
test2 &= ~0x07;

- switch(timing) {
+ switch(pio) {
case 4: test1 |= 0x01; test2 |= 0x03; break;
case 3: test1 |= 0x03; test2 |= 0x03; break;
case 2: test1 |= 0x04; test2 |= 0x04; break;
@@ -330,7 +307,7 @@
pci_write_config_byte(dev, drive_pci, test1);
pci_write_config_byte(dev, drive_pci+1, test2);
} else {
- switch(timing) { /* active recovery
+ switch(pio) { /* active recovery
v v */
case 4: test1 = 0x30|0x01; break;
case 3: test1 = 0x30|0x03; break;
@@ -344,21 +321,7 @@
#ifdef DEBUG
sis5513_load_verify_registers(dev, "config_drive_art_rwp_pio start");
#endif
-}
-
-static int config_chipset_for_pio(struct ata_device *drive, u8 pio)
-{
- u8 speed;
-
- switch(pio) {
- case 4: speed = XFER_PIO_4; break;
- case 3: speed = XFER_PIO_3; break;
- case 2: speed = XFER_PIO_2; break;
- case 1: speed = XFER_PIO_1; break;
- default: speed = XFER_PIO_0; break;
- }
-
- config_art_rwp_pio(drive, pio);
+ speed = XFER_PIO_0 + min_t(u8, pio, 4);
drive->current_speed = speed;
return ide_config_drive_speed(drive, speed);
}
@@ -424,12 +387,14 @@
case XFER_SW_DMA_0:
break;
#endif /* CONFIG_BLK_DEV_IDEDMA */
- case XFER_PIO_4: return((int) config_chipset_for_pio(drive, 4));
- case XFER_PIO_3: return((int) config_chipset_for_pio(drive, 3));
- case XFER_PIO_2: return((int) config_chipset_for_pio(drive, 2));
- case XFER_PIO_1: return((int) config_chipset_for_pio(drive, 1));
+ case XFER_PIO_4:
+ case XFER_PIO_3:
+ case XFER_PIO_2:
+ case XFER_PIO_1:
case XFER_PIO_0:
- default: return((int) config_chipset_for_pio(drive, 0));
+ return config_art_rwp_pio(drive, speed - XFER_PIO_0);
+ default:
+ return config_art_rwp_pio(drive, 0);
}
drive->current_speed = speed;
#ifdef DEBUG
@@ -440,7 +405,10 @@

static void sis5513_tune_drive(struct ata_device *drive, u8 pio)
{
- (void) config_chipset_for_pio(drive, pio);
+ if (pio == 255)
+ pio = ata_best_pio_mode(drive) - XFER_PIO_0;
+
+ (void)config_art_rwp_pio(drive, min_t(u8, pio, 4));
}

#ifdef CONFIG_BLK_DEV_IDEDMA
@@ -473,8 +441,7 @@
int verbose = 1;

config_drive_art_rwp(drive);
- config_art_rwp_pio(drive, 5);
- config_chipset_for_pio(drive, 5);
+ sis5513_tune_drive(drive, 255);

if (id && (id->capability & 1) && drive->channel->autodma) {
/* Consult the list of known "bad" drives */
@@ -515,7 +482,7 @@
on = 0;
verbose = 0;
no_dma_set:
- (void) config_chipset_for_pio(drive, 5);
+ sis5513_tune_drive(drive, 255);
}

udma_enable(drive, on, verbose);
diff -urN linux-2.5.21/drivers/scsi/ide-scsi.c linux/drivers/scsi/ide-scsi.c
--- linux-2.5.21/drivers/scsi/ide-scsi.c 2002-06-13 20:29:39.000000000 +0200
+++ linux/drivers/scsi/ide-scsi.c 2002-06-13 23:23:25.000000000 +0200
@@ -403,25 +403,24 @@
ide_startstop_t startstop;
int ret;

+ /* FIXME: Move this lock upwards.
+ */
+ spin_lock_irqsave(ch->lock, flags);
if (ata_status_poll(drive, DRQ_STAT, BUSY_STAT,
WAIT_READY, rq, &startstop)) {
printk (KERN_ERR "ide-scsi: Strange, packet command initiated yet DRQ isn't asserted\n");
- return startstop;
- }
-
- /* FIXME: this locking should encompass the above register
- * file access too.
- */
- spin_lock_irqsave(ch->lock, flags);
- ireason = IN_BYTE(IDE_IREASON_REG);
-
- if ((ireason & (IDESCSI_IREASON_IO | IDESCSI_IREASON_COD)) != IDESCSI_IREASON_COD) {
- printk (KERN_ERR "ide-scsi: (IO,CoD) != (0,1) while issuing a packet command\n");
- ret = ide_stopped;
+ ret = startstop;
} else {
- ata_set_handler(drive, idescsi_pc_intr, get_timeout(pc), NULL);
- atapi_write(drive, scsi->pc->c, 12);
- ret = ide_started;
+ ireason = IN_BYTE(IDE_IREASON_REG);
+
+ if ((ireason & (IDESCSI_IREASON_IO | IDESCSI_IREASON_COD)) != IDESCSI_IREASON_COD) {
+ printk (KERN_ERR "ide-scsi: (IO,CoD) != (0,1) while issuing a packet command\n");
+ ret = ide_stopped;
+ } else {
+ ata_set_handler(drive, idescsi_pc_intr, get_timeout(pc), NULL);
+ atapi_write(drive, scsi->pc->c, 12);
+ ret = ide_started;
+ }
}
spin_unlock_irqrestore(ch->lock, flags);

@@ -549,7 +548,7 @@
owner: THIS_MODULE,
attach: idescsi_attach,
cleanup: idescsi_cleanup,
- XXX_do_request: idescsi_do_request,
+ do_request: idescsi_do_request,
end_request: idescsi_end_request,
open: idescsi_open,
release: idescsi_release,
diff -urN linux-2.5.21/include/linux/ide.h linux/include/linux/ide.h
--- linux-2.5.21/include/linux/ide.h 2002-06-13 20:29:39.000000000 +0200
+++ linux/include/linux/ide.h 2002-06-13 23:29:55.000000000 +0200
@@ -545,7 +545,7 @@
void (*attach) (struct ata_device *);
int (*cleanup)(struct ata_device *);
int (*standby)(struct ata_device *);
- ide_startstop_t (*XXX_do_request)(struct ata_device *, struct request *, sector_t);
+ ide_startstop_t (*do_request)(struct ata_device *, struct request *, sector_t);
int (*end_request)(struct ata_device *, struct request *, int);

int (*ioctl)(struct ata_device *, struct inode *, struct file *, unsigned int, unsigned long);
@@ -657,7 +657,7 @@
extern void ata_read(struct ata_device *, void *, unsigned int);
extern void ata_write(struct ata_device *, void *, unsigned int);

-extern ide_startstop_t ata_taskfile(struct ata_device *,
+extern ide_startstop_t ata_do_taskfile(struct ata_device *,
struct ata_taskfile *, struct request *);

/*


Attachments:
ide-clean-90.diff (39.19 kB)

2002-06-14 14:02:55

by Martin Dalecki

[permalink] [raw]
Subject: [PATCH] 2.5.21 IDE 91

diff -urN linux-2.5.21/drivers/ide/alim15x3.c linux/drivers/ide/alim15x3.c
--- linux-2.5.21/drivers/ide/alim15x3.c 2002-06-14 12:45:13.000000000 +0200
+++ linux/drivers/ide/alim15x3.c 2002-06-14 14:23:39.000000000 +0200
@@ -259,7 +259,7 @@
static int ali15x3_udma_init(struct ata_device *drive, struct request *rq)
{
if ((m5229_revision < 0xC2) && (drive->type != ATA_DISK))
- return 1; /* try PIO instead of DMA */
+ return ide_stopped; /* try PIO instead of DMA */

return udma_pci_init(drive, rq);
}
diff -urN linux-2.5.21/drivers/ide/hpt34x.c linux/drivers/ide/hpt34x.c
--- linux-2.5.21/drivers/ide/hpt34x.c 2002-06-14 12:45:13.000000000 +0200
+++ linux/drivers/ide/hpt34x.c 2002-06-14 14:20:16.000000000 +0200
@@ -175,7 +175,7 @@
u8 cmd;

if (!(count = udma_new_table(drive, rq)))
- return 1; /* try PIO instead of DMA */
+ return ide_stopped; /* try PIO instead of DMA */

if (rq_data_dir(rq) == READ)
cmd = 0x09;
@@ -192,7 +192,7 @@
OUT_BYTE((cmd == 0x09) ? WIN_READDMA : WIN_WRITEDMA, IDE_COMMAND_REG);
}

- return 0;
+ return ide_started;
}
#endif

diff -urN linux-2.5.21/drivers/ide/hpt366.c linux/drivers/ide/hpt366.c
--- linux-2.5.21/drivers/ide/hpt366.c 2002-06-14 12:45:13.000000000 +0200
+++ linux/drivers/ide/hpt366.c 2002-06-14 15:11:39.000000000 +0200
@@ -858,7 +858,7 @@
udelay(10);
}

-static int hpt370_udma_start(struct ata_device *drive, struct request *__rq)
+static void hpt370_udma_start(struct ata_device *drive, struct request *__rq)
{
struct ata_channel *ch = drive->channel;

@@ -870,8 +870,6 @@
*/

outb(inb(ch->dma_base) | 1, ch->dma_base); /* start DMA */
-
- return 0;
}

static void do_timeout_irq(struct ata_device *drive)
diff -urN linux-2.5.21/drivers/ide/icside.c linux/drivers/ide/icside.c
--- linux-2.5.21/drivers/ide/icside.c 2002-06-14 12:45:00.000000000 +0200
+++ linux/drivers/ide/icside.c 2002-06-14 15:11:08.000000000 +0200
@@ -447,18 +447,13 @@
return get_dma_residue(ch->hw.dma) != 0;
}

-static int icside_dma_start(struct ata_device *drive, struct request *rq)
+static void icside_dma_start(struct ata_device *drive, struct request *rq)
{
struct ata_channel *ch = drive->channel;

- /*
- * We can not enable DMA on both channels.
- */
+ /* We can not enable DMA on both channels simultaneously. */
BUG_ON(dma_channel_active(ch->hw.dma));
-
enable_dma(ch->hw.dma);
-
- return 0;
}

/*
@@ -524,10 +519,10 @@
u8 int cmd;

if (icside_dma_common(drive, rq, DMA_MODE_WRITE))
- return 1;
+ return ide_stopped;

if (drive->type != ATA_DISK)
- return 0;
+ return ide_started;

ata_set_handler(drive, icside_dmaintr, WAIT_CMD, NULL);

@@ -543,7 +538,7 @@

enable_dma(ch->hw.dma);

- return 0;
+ return ide_started;
}

static int icside_irq_status(struct ata_device *drive)
diff -urN linux-2.5.21/drivers/ide/ide.c linux/drivers/ide/ide.c
--- linux-2.5.21/drivers/ide/ide.c 2002-06-14 12:45:13.000000000 +0200
+++ linux/drivers/ide/ide.c 2002-06-14 13:18:44.000000000 +0200
@@ -702,7 +702,8 @@
spin_unlock_irq(ch->lock);
ata_ops(drive)->end_request(drive, rq, 0);
spin_lock_irq(ch->lock);
- }
+ } else
+ __ata_end_request(drive, rq, 0, 0);
} else
__ata_end_request(drive, rq, 0, 0);

diff -urN linux-2.5.21/drivers/ide/ide-cd.c linux/drivers/ide/ide-cd.c
--- linux-2.5.21/drivers/ide/ide-cd.c 2002-06-14 12:45:13.000000000 +0200
+++ linux/drivers/ide/ide-cd.c 2002-06-14 14:23:18.000000000 +0200
@@ -741,7 +741,7 @@
else {
if (info->dma) {
if (info->cmd == READ || info->cmd == WRITE)
- info->dma = !udma_init(drive, rq);
+ info->dma = udma_init(drive, rq);
else
printk("ide-cd: DMA set, but not allowed\n");
}
diff -urN linux-2.5.21/drivers/ide/ide-disk.c linux/drivers/ide/ide-disk.c
--- linux-2.5.21/drivers/ide/ide-disk.c 2002-06-14 12:45:13.000000000 +0200
+++ linux/drivers/ide/ide-disk.c 2002-06-14 14:18:25.000000000 +0200
@@ -102,40 +102,44 @@
spin_lock_irqsave(ch->lock, flags);

if (!ata_status(drive, DATA_READY, BAD_R_STAT)) {
- if (drive->status & (ERR_STAT|DRQ_STAT)) {
+ if (drive->status & (ERR_STAT | DRQ_STAT)) {
spin_unlock_irqrestore(ch->lock, flags);

return ata_error(drive, rq, __FUNCTION__);
}

- if (!(drive->status & BUSY_STAT)) {
-// printk("task_in_intr to Soon wait for next interrupt\n");
- ata_set_handler(drive, task_in_intr, WAIT_CMD, NULL);
- spin_unlock_irqrestore(ch->lock, flags);
+ /* no data yet, so wait for another interrupt */
+ ata_set_handler(drive, task_in_intr, WAIT_CMD, NULL);

- return ide_started;
+ ret = ide_started;
+ } else {
+
+ // printk("Read: %p, rq->current_nr_sectors: %d\n", buf, (int) rq->current_nr_sectors);
+ {
+ unsigned long flags;
+ char *buf;
+
+ buf = ide_map_rq(rq, &flags);
+ ata_read(drive, buf, SECTOR_WORDS);
+ ide_unmap_rq(rq, buf, &flags);
}
- }

-// printk("Read: %p, rq->current_nr_sectors: %d\n", buf, (int) rq->current_nr_sectors);
- {
- unsigned long flags;
- char *buf;
-
- buf = ide_map_rq(rq, &flags);
- ata_read(drive, buf, SECTOR_WORDS);
- ide_unmap_rq(rq, buf, &flags);
- }
+ /* First segment of the request is complete. note that this does not
+ * necessarily mean that the entire request is done!! this is only true
+ * if ata_end_request() returns 0.
+ */
+ rq->errors = 0;
+ --rq->current_nr_sectors;

- /* First segment of the request is complete. note that this does not
- * necessarily mean that the entire request is done!! this is only true
- * if ata_end_request() returns 0.
- */
+ if (rq->current_nr_sectors <= 0) {
+ if (!__ata_end_request(drive, rq, 1, 0)) {
+ // printk("Request Ended stat: %02x\n", drive->status);
+ spin_unlock_irqrestore(ch->lock, flags);
+
+ return ide_stopped;
+ }
+ }

- if (--rq->current_nr_sectors <= 0 && !__ata_end_request(drive, rq, 1, 0)) {
-// printk("Request Ended stat: %02x\n", drive->status);
- ret = ide_stopped;
- } else {
/* still data left to transfer */
ata_set_handler(drive, task_in_intr, WAIT_CMD, NULL);

@@ -197,7 +201,7 @@

spin_lock_irqsave(ch->lock, flags);
if (!ata_status(drive, DATA_READY, BAD_R_STAT)) {
- if (drive->status & (ERR_STAT|DRQ_STAT)) {
+ if (drive->status & (ERR_STAT | DRQ_STAT)) {
spin_unlock_irqrestore(ch->lock, flags);

return ata_error(drive, rq, __FUNCTION__);
@@ -235,16 +239,16 @@

rq->errors = 0;
rq->current_nr_sectors -= nsect;
- msect -= nsect;

/* FIXME: this seems buggy */
- if (!rq->current_nr_sectors) {
+ if (rq->current_nr_sectors <= 0) {
if (!__ata_end_request(drive, rq, 1, 0)) {
spin_unlock_irqrestore(ch->lock, flags);

return ide_stopped;
}
}
+ msect -= nsect;
} while (msect);

/* more data left */
@@ -343,212 +347,138 @@
}

/*
- * Decode with physical ATA command to use and setup associated data.
+ * Channel lock should be held on entry.
*/
-static u8 get_command(struct ata_device *drive, struct ata_taskfile *ar, int cmd)
+static ide_startstop_t __do_request(struct ata_device *drive,
+ struct ata_taskfile *ar, struct request *rq)
{
- int lba48bit = (drive->id->cfs_enable_2 & 0x0400) ? 1 : 0;
-
-#if 1
- lba48bit = drive->addressing;
-#endif
-
- if (lba48bit) {
- if (cmd == READ) {
- ar->command_type = IDE_DRIVE_TASK_IN;
- if (drive->using_tcq) {
- return WIN_READDMA_QUEUED_EXT;
- } else if (drive->using_dma) {
- return WIN_READDMA_EXT;
- } else if (drive->mult_count) {
- ar->handler = task_mulin_intr;
- return WIN_MULTREAD_EXT;
- } else {
- ar->handler = task_in_intr;
- return WIN_READ_EXT;
- }
- } else if (cmd == WRITE) {
- ar->command_type = IDE_DRIVE_TASK_RAW_WRITE;
- if (drive->using_tcq) {
- return WIN_WRITEDMA_QUEUED_EXT;
- } else if (drive->using_dma) {
- return WIN_WRITEDMA_EXT;
- } else if (drive->mult_count) {
- ar->handler = task_mulout_intr;
- return WIN_MULTWRITE_EXT;
- } else {
- ar->handler = task_out_intr;
- return WIN_WRITE_EXT;
- }
- }
- } else {
- if (cmd == READ) {
- ar->command_type = IDE_DRIVE_TASK_IN;
- if (drive->using_tcq) {
- return WIN_READDMA_QUEUED;
- } else if (drive->using_dma) {
- return WIN_READDMA;
- } else if (drive->mult_count) {
- ar->handler = task_in_intr;
- return WIN_MULTREAD;
- } else {
- ar->handler = task_in_intr;
- return WIN_READ;
- }
- } else if (cmd == WRITE) {
- ar->command_type = IDE_DRIVE_TASK_RAW_WRITE;
- if (drive->using_tcq) {
- return WIN_WRITEDMA_QUEUED;
- } else if (drive->using_dma) {
- return WIN_WRITEDMA;
- } else if (drive->mult_count) {
- ar->handler = task_mulout_intr;
- return WIN_MULTWRITE;
- } else {
- ar->handler = task_out_intr;
- return WIN_WRITE;
- }
- }
- }
-
- /* not reached! */
- return WIN_NOP;
-}
-
-static ide_startstop_t chs_do_request(struct ata_device *drive, struct request *rq, sector_t block)
-{
- struct ata_taskfile args;
- int sectors;
-
- unsigned int track = (block / drive->sect);
- unsigned int sect = (block % drive->sect) + 1;
- unsigned int head = (track % drive->head);
- unsigned int cyl = (track / drive->head);
-
- sectors = rq->nr_sectors;
- if (sectors == 256)
- sectors = 0;
-
- memset(&args, 0, sizeof(args));
-
- if (blk_rq_tagged(rq)) {
- args.taskfile.feature = sectors;
- args.taskfile.sector_count = rq->tag << 3;
- } else
- args.taskfile.sector_count = sectors;
-
- args.taskfile.sector_number = sect;
- args.taskfile.low_cylinder = cyl;
- args.taskfile.high_cylinder = (cyl>>8);
-
- args.taskfile.device_head = head;
- args.taskfile.device_head |= drive->select.all;
- args.cmd = get_command(drive, &args, rq_data_dir(rq));
-
-#ifdef DEBUG
- printk("%s: %sing: ", drive->name,
- (rq_data_dir(rq)==READ) ? "read" : "writ");
- if (lba) printk("LBAsect=%lld, ", block);
- else printk("CHS=%d/%d/%d, ", cyl, head, sect);
- printk("sectors=%ld, ", rq->nr_sectors);
- printk("buffer=%p\n", rq->buffer);
-#endif
-
- rq->special = &args;
-
- return ata_do_taskfile(drive, &args, rq);
-}
-
-static ide_startstop_t lba28_do_request(struct ata_device *drive, struct request *rq, sector_t block)
-{
- struct ata_taskfile args;
- int sectors;
-
- sectors = rq->nr_sectors;
- if (sectors == 256)
- sectors = 0;
-
- memset(&args, 0, sizeof(args));
-
- if (blk_rq_tagged(rq)) {
- args.taskfile.feature = sectors;
- args.taskfile.sector_count = rq->tag << 3;
- } else
- args.taskfile.sector_count = sectors;
-
- args.taskfile.sector_number = block;
- args.taskfile.low_cylinder = (block >>= 8);
-
- args.taskfile.high_cylinder = (block >>= 8);
+ struct hd_driveid *id = drive->id;

- args.taskfile.device_head = ((block >> 8) & 0x0f);
- args.taskfile.device_head |= drive->select.all;
- args.cmd = get_command(drive, &args, rq_data_dir(rq));
+ /* (ks/hs): Moved to start, do not use for multiple out commands.
+ * FIXME: why not?! */
+ if (!(ar->cmd == CFA_WRITE_MULTI_WO_ERASE ||
+ ar->cmd == WIN_MULTWRITE ||
+ ar->cmd == WIN_MULTWRITE_EXT)) {
+ ata_irq_enable(drive, 1);
+ ata_mask(drive);
+ }
+
+ if ((id->command_set_2 & 0x0400) && (id->cfs_enable_2 & 0x0400) &&
+ (drive->addressing == 1))
+ ata_out_regfile(drive, &ar->hobfile);
+
+ ata_out_regfile(drive, &ar->taskfile);
+
+ OUT_BYTE((ar->taskfile.device_head & (drive->addressing ? 0xE0 : 0xEF)) | drive->select.all,
+ IDE_SELECT_REG);
+
+ if (ar->XXX_handler) {
+ struct ata_channel *ch = drive->channel;
+
+ ata_set_handler(drive, ar->XXX_handler, WAIT_CMD, NULL);
+ OUT_BYTE(ar->cmd, IDE_COMMAND_REG);
+
+ /* FIXME: Warning check for race between handler and prehandler
+ * for writing first block of data. however since we are well
+ * inside the boundaries of the seek, we should be okay.
+ *
+ * FIXME: Replace the switch by using a proper command_type.
+ */

-#ifdef DEBUG
- printk("%s: %sing: ", drive->name,
- (rq_data_dir(rq)==READ) ? "read" : "writ");
- if (lba) printk("LBAsect=%lld, ", block);
- else printk("CHS=%d/%d/%d, ", cyl, head, sect);
- printk("sectors=%ld, ", rq->nr_sectors);
- printk("buffer=%p\n", rq->buffer);
-#endif
+ if (ar->cmd == CFA_WRITE_SECT_WO_ERASE ||
+ ar->cmd == WIN_WRITE ||
+ ar->cmd == WIN_WRITE_EXT ||
+ ar->cmd == WIN_WRITE_VERIFY ||
+ ar->cmd == WIN_WRITE_BUFFER ||
+ ar->cmd == WIN_DOWNLOAD_MICROCODE ||
+ ar->cmd == CFA_WRITE_MULTI_WO_ERASE ||
+ ar->cmd == WIN_MULTWRITE ||
+ ar->cmd == WIN_MULTWRITE_EXT) {
+ ide_startstop_t startstop;
+
+ if (ata_status_poll(drive, DATA_READY, drive->bad_wstat,
+ WAIT_DRQ, rq, &startstop)) {
+ printk(KERN_ERR "%s: no DRQ after issuing %s\n",
+ drive->name, drive->mult_count ? "MULTWRITE" : "WRITE");

- rq->special = &args;
+ return startstop;
+ }

- return ata_do_taskfile(drive, &args, rq);
-}
+ /* FIXME: This doesn't make the slightest sense.
+ * (ks/hs): Fixed Multi Write
+ */
+ if (!(ar->cmd == CFA_WRITE_MULTI_WO_ERASE ||
+ ar->cmd == WIN_MULTWRITE ||
+ ar->cmd == WIN_MULTWRITE_EXT)) {
+ unsigned long flags;
+ char *buf = ide_map_rq(rq, &flags);

-/*
- * 268435455 == 137439 MB or 28bit limit
- * 320173056 == 163929 MB or 48bit addressing
- * 1073741822 == 549756 MB or 48bit addressing fake drive
- */
+ /* For Write_sectors we need to stuff the first sector */
+ ata_write(drive, buf, SECTOR_WORDS);

-static ide_startstop_t lba48_do_request(struct ata_device *drive, struct request *rq, sector_t block)
-{
- struct ata_taskfile args;
- int sectors;
+ rq->current_nr_sectors--;
+ ide_unmap_rq(rq, buf, &flags);

- sectors = rq->nr_sectors;
- if (sectors == 65536)
- sectors = 0;
+ return ide_started;
+ } else {
+ int i;
+ int ret;

- memset(&args, 0, sizeof(args));
+ /* Polling wait until the drive is ready.
+ *
+ * Stuff the first sector(s) by calling the
+ * handler driectly therafter.
+ *
+ * FIXME: Replace hard-coded 100, what about
+ * error handling?
+ */
+
+ for (i = 0; i < 100; ++i) {
+ if (drive_is_ready(drive))
+ break;
+ }
+ if (!drive_is_ready(drive)) {
+ printk(KERN_ERR "DISASTER WAITING TO HAPPEN!\n");
+ }
+ /* FIXME: make this unlocking go away*/
+ spin_unlock_irq(ch->lock);
+ ret = ar->XXX_handler(drive, rq);
+ spin_lock_irq(ch->lock);

- if (blk_rq_tagged(rq)) {
- args.taskfile.feature = sectors;
- args.hobfile.feature = sectors >> 8;
- args.taskfile.sector_count = rq->tag << 3;
+ return ret;
+ }
+ }
} else {
- args.taskfile.sector_count = sectors;
- args.hobfile.sector_count = sectors >> 8;
- }
-
- args.taskfile.sector_number = block; /* low lba */
- args.taskfile.low_cylinder = (block >>= 8); /* mid lba */
- args.taskfile.high_cylinder = (block >>= 8); /* hi lba */
- args.taskfile.device_head = drive->select.all;
-
- args.hobfile.sector_number = (block >>= 8); /* low lba */
- args.hobfile.low_cylinder = (block >>= 8); /* mid lba */
- args.hobfile.high_cylinder = (block >>= 8); /* hi lba */
- args.hobfile.device_head = drive->select.all;
+ /*
+ * FIXME: This is a gross hack, need to unify tcq dma proc and
+ * regular dma proc. It should now be easier.
+ *
+ * FIXME: Handle the alternateives by a command type.
+ */

- args.cmd = get_command(drive, &args, rq_data_dir(rq));
+ if (!drive->using_dma)
+ return ide_started;

-#ifdef DEBUG
- printk("%s: %sing: ", drive->name,
- (rq_data_dir(rq)==READ) ? "read" : "writ");
- if (lba) printk("LBAsect=%lld, ", block);
- else printk("CHS=%d/%d/%d, ", cyl, head, sect);
- printk("sectors=%ld, ", rq->nr_sectors);
- printk("buffer=%p\n",rq->buffer);
+ /* for dma commands we don't set the handler */
+ if (ar->cmd == WIN_WRITEDMA ||
+ ar->cmd == WIN_WRITEDMA_EXT ||
+ ar->cmd == WIN_READDMA ||
+ ar->cmd == WIN_READDMA_EXT)
+ return udma_init(drive, rq);
+#ifdef CONFIG_BLK_DEV_IDE_TCQ
+ else if (ar->cmd == WIN_WRITEDMA_QUEUED ||
+ ar->cmd == WIN_WRITEDMA_QUEUED_EXT ||
+ ar->cmd == WIN_READDMA_QUEUED ||
+ ar->cmd == WIN_READDMA_QUEUED_EXT)
+ return udma_tcq_init(drive, rq);
#endif
+ else {
+ printk(KERN_ERR "%s: unknown command %x\n", __FUNCTION__, ar->cmd);
+ return ide_stopped;
+ }
+ }

- rq->special = &args;
-
- return ata_do_taskfile(drive, &args, rq);
+ return ide_started;
}

/*
@@ -560,10 +490,13 @@
*/
static ide_startstop_t idedisk_do_request(struct ata_device *drive, struct request *rq, sector_t block)
{
+ struct ata_taskfile args;
+ unsigned int sectors;
+
/* This issues a special drive command.
*/
if (rq->flags & REQ_SPECIAL)
- return ata_do_taskfile(drive, rq->special, rq);
+ return __do_request(drive, rq->special, rq);

/* FIXME: this check doesn't make sense */
if (!(rq->flags & REQ_CMD)) {
@@ -597,15 +530,150 @@
}
}

- if ((drive->id->cfs_enable_2 & 0x0400) && (drive->addressing))
- return lba48_do_request(drive, rq, block);
- else if (drive->select.b.lba)
- return lba28_do_request(drive, rq, block);
- else
- return chs_do_request(drive, rq, block);
+ memset(&args, 0, sizeof(args));
+ sectors = rq->nr_sectors;
+ /* Dispatch depending up on the drive access method. */
+ if ((drive->id->cfs_enable_2 & 0x0400) && (drive->addressing)) {
+ /* LBA 48 bit */
+ /*
+ * 268435455 == 137439 MB or 28bit limit
+ * 320173056 == 163929 MB or 48bit addressing
+ * 1073741822 == 549756 MB or 48bit addressing fake drive
+ */
+ if (sectors == 65536)
+ sectors = 0;
+
+ if (blk_rq_tagged(rq)) {
+ args.taskfile.feature = sectors;
+ args.hobfile.feature = sectors >> 8;
+ args.taskfile.sector_count = rq->tag << 3;
+ } else {
+ args.taskfile.sector_count = sectors;
+ args.hobfile.sector_count = sectors >> 8;
+ }
+
+ args.taskfile.sector_number = block; /* low lba */
+ args.taskfile.low_cylinder = (block >>= 8); /* mid lba */
+ args.taskfile.high_cylinder = (block >>= 8); /* hi lba */
+ args.taskfile.device_head = drive->select.all;
+
+ args.hobfile.sector_number = (block >>= 8); /* low lba */
+ args.hobfile.low_cylinder = (block >>= 8); /* mid lba */
+ args.hobfile.high_cylinder = (block >>= 8); /* hi lba */
+ } else if (drive->select.b.lba) {
+ /* LBA 28 bit */
+ if (sectors == 256)
+ sectors = 0;
+
+ if (blk_rq_tagged(rq)) {
+ args.taskfile.feature = sectors;
+ args.taskfile.sector_count = rq->tag << 3;
+ } else
+ args.taskfile.sector_count = sectors;
+
+ args.taskfile.sector_number = block;
+ args.taskfile.low_cylinder = (block >>= 8);
+ args.taskfile.high_cylinder = (block >>= 8);
+ args.taskfile.device_head = ((block >> 8) & 0x0f);
+ } else {
+ /* CHS */
+ unsigned int track = (block / drive->sect);
+ unsigned int sect = (block % drive->sect) + 1;
+ unsigned int head = (track % drive->head);
+ unsigned int cyl = (track / drive->head);
+
+ if (sectors == 256)
+ sectors = 0;
+
+ if (blk_rq_tagged(rq)) {
+ args.taskfile.feature = sectors;
+ args.taskfile.sector_count = rq->tag << 3;
+ } else
+ args.taskfile.sector_count = sectors;
+
+ args.taskfile.sector_number = sect;
+ args.taskfile.low_cylinder = cyl;
+ args.taskfile.high_cylinder = (cyl>>8);
+ args.taskfile.device_head = head;
+ }
+ args.taskfile.device_head |= drive->select.all;
+
+ /*
+ * Decode with physical ATA command to use and setup associated data.
+ */
+
+ if (rq_data_dir(rq) == READ) {
+ args.command_type = IDE_DRIVE_TASK_IN;
+ if (drive->addressing) {
+ if (drive->using_tcq) {
+ args.cmd = WIN_READDMA_QUEUED_EXT;
+ } else if (drive->using_dma) {
+ args.cmd = WIN_READDMA_EXT;
+ } else if (drive->mult_count) {
+ args.XXX_handler = task_mulin_intr;
+ args.cmd = WIN_MULTREAD_EXT;
+ } else {
+ args.XXX_handler = task_in_intr;
+ args.cmd = WIN_READ_EXT;
+ }
+ } else {
+ if (drive->using_tcq) {
+ args.cmd = WIN_READDMA_QUEUED;
+ } else if (drive->using_dma) {
+ args.cmd = WIN_READDMA;
+ } else if (drive->mult_count) {
+ /* FIXME : Shouldn't this be task_mulin_intr?! */
+ args.XXX_handler = task_in_intr;
+ args.cmd = WIN_MULTREAD;
+ } else {
+ args.XXX_handler = task_in_intr;
+ args.cmd = WIN_READ;
+ }
+ }
+ } else {
+ args.command_type = IDE_DRIVE_TASK_RAW_WRITE;
+ if (drive->addressing) {
+ if (drive->using_tcq) {
+ args.cmd = WIN_WRITEDMA_QUEUED_EXT;
+ } else if (drive->using_dma) {
+ args.cmd = WIN_WRITEDMA_EXT;
+ } else if (drive->mult_count) {
+ args.XXX_handler = task_mulout_intr;
+ args.cmd = WIN_MULTWRITE_EXT;
+ } else {
+ args.XXX_handler = task_out_intr;
+ args.cmd = WIN_WRITE_EXT;
+ }
+ } else {
+ if (drive->using_tcq) {
+ args.cmd = WIN_WRITEDMA_QUEUED;
+ } else if (drive->using_dma) {
+ args.cmd = WIN_WRITEDMA;
+ } else if (drive->mult_count) {
+ args.XXX_handler = task_mulout_intr;
+ args.cmd = WIN_MULTWRITE;
+ } else {
+ args.XXX_handler = task_out_intr;
+ args.cmd = WIN_WRITE;
+ }
+ }
+ }
+
+
+#ifdef DEBUG
+ printk("%s: %sing: ", drive->name,
+ (rq_data_dir(rq)==READ) ? "read" : "writ");
+ if (lba) printk("LBAsect=%lld, ", block);
+ else printk("CHS=%d/%d/%d, ", cyl, head, sect);
+ printk("sectors=%ld, ", rq->nr_sectors);
+ printk("buffer=%p\n", rq->buffer);
+#endif
+ rq->special = &args;
+
+ return __do_request(drive, &args, rq);
}

-static int idedisk_open(struct inode *inode, struct file *filp, struct ata_device *drive)
+static int idedisk_open(struct inode *inode, struct file *__fp, struct ata_device *drive)
{
MOD_INC_USE_COUNT;
if (drive->removable && drive->usage == 1) {
diff -urN linux-2.5.21/drivers/ide/ide-floppy.c linux/drivers/ide/ide-floppy.c
--- linux-2.5.21/drivers/ide/ide-floppy.c 2002-06-14 12:45:13.000000000 +0200
+++ linux/drivers/ide/ide-floppy.c 2002-06-14 14:21:59.000000000 +0200
@@ -1102,7 +1102,7 @@
udma_enable(drive, 0, 1);

if (test_bit (PC_DMA_RECOMMENDED, &pc->flags) && drive->using_dma)
- dma_ok = !udma_init(drive, rq);
+ dma_ok = udma_init(drive, rq);
#endif

ata_irq_enable(drive, 1);
diff -urN linux-2.5.21/drivers/ide/ide-pmac.c linux/drivers/ide/ide-pmac.c
--- linux-2.5.21/drivers/ide/ide-pmac.c 2002-06-14 12:45:00.000000000 +0200
+++ linux/drivers/ide/ide-pmac.c 2002-06-14 15:03:31.000000000 +0200
@@ -1365,7 +1365,8 @@
*/
ix = pmac_ide_find(drive);
if (ix < 0)
- return 0;
+ return ide_started;
+
dma = pmac_ide[ix].dma_regs;
ata4 = (pmac_ide[ix].kind == controller_kl_ata4 ||
pmac_ide[ix].kind == controller_kl_ata4_80);
@@ -1373,7 +1374,8 @@
out_le32(&dma->control, (RUN << 16) | RUN);
/* Make sure it gets to the controller right now */
(void)in_le32(&dma->control);
- return 0;
+
+ return ide_started;
}

static int pmac_udma_stop(struct ata_device *drive)
@@ -1411,7 +1413,7 @@
*/
ix = pmac_ide_find(drive);
if (ix < 0)
- return 0;
+ return ide_stopped;

if (rq_data_dir(rq) == READ)
reading = 1;
@@ -1423,7 +1425,7 @@
pmac_ide[ix].kind == controller_kl_ata4_80);

if (!pmac_ide_build_dmatable(drive, rq, ix, !reading))
- return 1;
+ return ide_stopped;
/* Apple adds 60ns to wrDataSetup on reads */
if (ata4 && (pmac_ide[ix].timings[unit] & TR_66_UDMA_EN)) {
out_le32((unsigned *)(IDE_DATA_REG + IDE_TIMING_CONFIG + _IO_BASE),
@@ -1433,7 +1435,7 @@
}
drive->waiting_for_dma = 1;
if (drive->type != ATA_DISK)
- return 0;
+ return ide_started;

ata_set_handler(drive, ide_dma_intr, WAIT_CMD, NULL);
if ((rq->flags & REQ_SPECIAL) &&
@@ -1447,7 +1449,9 @@
OUT_BYTE(reading ? WIN_READDMA : WIN_WRITEDMA, IDE_COMMAND_REG);
}

- return udma_start(drive, rq);
+ udma_start(drive, rq);
+
+ return ide_started;
}

/*
diff -urN linux-2.5.21/drivers/ide/ide-tape.c linux/drivers/ide/ide-tape.c
--- linux-2.5.21/drivers/ide/ide-tape.c 2002-06-14 12:45:13.000000000 +0200
+++ linux/drivers/ide/ide-tape.c 2002-06-14 14:20:30.000000000 +0200
@@ -2290,7 +2290,7 @@
udma_enable(drive, 0, 1);
}
if (test_bit (PC_DMA_RECOMMENDED, &pc->flags) && drive->using_dma)
- dma_ok = !udma_init(drive, rq);
+ dma_ok = udma_init(drive, rq);
#endif

ata_irq_enable(drive, 1);
diff -urN linux-2.5.21/drivers/ide/ide-taskfile.c linux/drivers/ide/ide-taskfile.c
--- linux-2.5.21/drivers/ide/ide-taskfile.c 2002-06-14 12:45:13.000000000 +0200
+++ linux/drivers/ide/ide-taskfile.c 2002-06-14 02:04:27.000000000 +0200
@@ -177,145 +177,6 @@
}

/*
- * Channel lock should be held on entry.
- */
-ide_startstop_t ata_do_taskfile(struct ata_device *drive,
- struct ata_taskfile *ar, struct request *rq)
-{
- struct hd_driveid *id = drive->id;
-
- /* (ks/hs): Moved to start, do not use for multiple out commands.
- * FIXME: why not?! */
- if (!(ar->cmd == CFA_WRITE_MULTI_WO_ERASE ||
- ar->cmd == WIN_MULTWRITE ||
- ar->cmd == WIN_MULTWRITE_EXT)) {
- ata_irq_enable(drive, 1);
- ata_mask(drive);
- }
-
- if ((id->command_set_2 & 0x0400) && (id->cfs_enable_2 & 0x0400) &&
- (drive->addressing == 1))
- ata_out_regfile(drive, &ar->hobfile);
-
- ata_out_regfile(drive, &ar->taskfile);
-
- OUT_BYTE((ar->taskfile.device_head & (drive->addressing ? 0xE0 : 0xEF)) | drive->select.all,
- IDE_SELECT_REG);
-
- if (ar->handler) {
- struct ata_channel *ch = drive->channel;
-
- /* This is apparently supposed to reset the wait timeout for
- * the interrupt to accur.
- */
-
- ata_set_handler(drive, ar->handler, WAIT_CMD, NULL);
- OUT_BYTE(ar->cmd, IDE_COMMAND_REG);
-
- /* FIXME: Warning check for race between handler and prehandler
- * for writing first block of data. however since we are well
- * inside the boundaries of the seek, we should be okay.
- *
- * FIXME: Replace the switch by using a proper command_type.
- */
-
- if (ar->cmd == CFA_WRITE_SECT_WO_ERASE ||
- ar->cmd == WIN_WRITE ||
- ar->cmd == WIN_WRITE_EXT ||
- ar->cmd == WIN_WRITE_VERIFY ||
- ar->cmd == WIN_WRITE_BUFFER ||
- ar->cmd == WIN_DOWNLOAD_MICROCODE ||
- ar->cmd == CFA_WRITE_MULTI_WO_ERASE ||
- ar->cmd == WIN_MULTWRITE ||
- ar->cmd == WIN_MULTWRITE_EXT) {
- ide_startstop_t startstop;
-
- if (ata_status_poll(drive, DATA_READY, drive->bad_wstat,
- WAIT_DRQ, rq, &startstop)) {
- printk(KERN_ERR "%s: no DRQ after issuing %s\n",
- drive->name, drive->mult_count ? "MULTWRITE" : "WRITE");
-
- return startstop;
- }
-
- /* FIXME: This doesn't make the slightest sense.
- * (ks/hs): Fixed Multi Write
- */
- if (!(ar->cmd == CFA_WRITE_MULTI_WO_ERASE ||
- ar->cmd == WIN_MULTWRITE ||
- ar->cmd == WIN_MULTWRITE_EXT)) {
- unsigned long flags;
- char *buf = ide_map_rq(rq, &flags);
-
- /* For Write_sectors we need to stuff the first sector */
- ata_write(drive, buf, SECTOR_WORDS);
-
- rq->current_nr_sectors--;
- ide_unmap_rq(rq, buf, &flags);
-
- return ide_started;
- } else {
- int i;
- int ret;
-
- /* Polling wait until the drive is ready.
- *
- * Stuff the first sector(s) by calling the
- * handler driectly therafter.
- *
- * FIXME: Replace hard-coded 100, what about
- * error handling?
- */
-
- for (i = 0; i < 100; ++i) {
- if (drive_is_ready(drive))
- break;
- }
- if (!drive_is_ready(drive)) {
- printk(KERN_ERR "DISASTER WAITING TO HAPPEN!\n");
- }
- /* FIXME: make this unlocking go away*/
- spin_unlock_irq(ch->lock);
- ret = ar->handler(drive, rq);
- spin_lock_irq(ch->lock);
-
- return ret;
- }
- }
- } else {
- /*
- * FIXME: This is a gross hack, need to unify tcq dma proc and
- * regular dma proc. It should now be easier.
- *
- * FIXME: Handle the alternateives by a command type.
- */
-
- if (!drive->using_dma)
- return ide_started;
-
- /* for dma commands we don't set the handler */
- if (ar->cmd == WIN_WRITEDMA ||
- ar->cmd == WIN_WRITEDMA_EXT ||
- ar->cmd == WIN_READDMA ||
- ar->cmd == WIN_READDMA_EXT)
- return !udma_init(drive, rq);
-#ifdef CONFIG_BLK_DEV_IDE_TCQ
- else if (ar->cmd == WIN_WRITEDMA_QUEUED ||
- ar->cmd == WIN_WRITEDMA_QUEUED_EXT ||
- ar->cmd == WIN_READDMA_QUEUED ||
- ar->cmd == WIN_READDMA_QUEUED_EXT)
- return udma_tcq_taskfile(drive, rq);
-#endif
- else {
- printk(KERN_ERR "%s: unknown command %x\n", __FUNCTION__, ar->cmd);
- return ide_stopped;
- }
- }
-
- return ide_started;
-}
-
-/*
* This function issues a special IDE device request onto the request queue.
*
* If action is ide_wait, then the rq is queued at the end of the request
@@ -436,7 +297,7 @@
struct request req;

ar->command_type = IDE_DRIVE_TASK_NO_DATA;
- ar->handler = ata_special_intr;
+ ar->XXX_handler = ata_special_intr;

memset(&req, 0, sizeof(req));
req.flags = REQ_SPECIAL;
@@ -449,6 +310,5 @@
EXPORT_SYMBOL(ide_do_drive_cmd);
EXPORT_SYMBOL(ata_read);
EXPORT_SYMBOL(ata_write);
-EXPORT_SYMBOL(ata_do_taskfile);
EXPORT_SYMBOL(ata_special_intr);
EXPORT_SYMBOL(ide_raw_taskfile);
diff -urN linux-2.5.21/drivers/ide/ioctl.c linux/drivers/ide/ioctl.c
--- linux-2.5.21/drivers/ide/ioctl.c 2002-06-14 12:45:00.000000000 +0200
+++ linux/drivers/ide/ioctl.c 2002-06-14 02:08:02.000000000 +0200
@@ -54,9 +54,6 @@
if (copy_from_user(vals, (void *)arg, 4))
return -EFAULT;

- memset(&req, 0, sizeof(req));
- req.flags = REQ_SPECIAL;
-
memset(&args, 0, sizeof(args));

args.taskfile.feature = vals[2];
@@ -83,10 +80,14 @@

/* Issue ATA command and wait for completion.
*/
- args.handler = ata_special_intr;
+ args.command_type = IDE_DRIVE_TASK_NO_DATA;
+ args.XXX_handler = ata_special_intr;

- req.buffer = argbuf + 4;
+ memset(&req, 0, sizeof(req));
+ req.flags = REQ_SPECIAL;
req.special = &args;
+
+ req.buffer = argbuf + 4;
err = ide_do_drive_cmd(drive, &req, ide_wait);

argbuf[0] = drive->status;
diff -urN linux-2.5.21/drivers/ide/ns87415.c linux/drivers/ide/ns87415.c
--- linux-2.5.21/drivers/ide/ns87415.c 2002-06-09 07:28:49.000000000 +0200
+++ linux/drivers/ide/ns87415.c 2002-06-14 14:27:42.000000000 +0200
@@ -105,12 +105,12 @@
{
ns87415_prepare_drive(drive, 1); /* select DMA xfer */

- if (!udma_pci_init(drive, rq)) /* use standard DMA stuff */
- return 0;
+ if (udma_pci_init(drive, rq)) /* use standard DMA stuff */
+ return ide_started;

ns87415_prepare_drive(drive, 0); /* DMA failed: select PIO xfer */

- return 1;
+ return ide_stopped;
}

static int ns87415_udma_setup(struct ata_device *drive)
diff -urN linux-2.5.21/drivers/ide/pcidma.c linux/drivers/ide/pcidma.c
--- linux-2.5.21/drivers/ide/pcidma.c 2002-06-14 12:45:03.000000000 +0200
+++ linux/drivers/ide/pcidma.c 2002-06-14 15:12:30.000000000 +0200
@@ -420,13 +420,11 @@
struct ata_channel *ch = drive->channel;
unsigned long dma_base = ch->dma_base;

- /* Note that this is done *after* the cmd has
- * been issued to the drive, as per the BM-IDE spec.
- * The Promise Ultra33 doesn't work correctly when
- * we do this part before issuing the drive cmd.
+ /* Note that this is done *after* the cmd has been issued to the drive,
+ * as per the BM-IDE spec. The Promise Ultra33 doesn't work correctly
+ * when we do this part before issuing the drive cmd.
*/
- outb(inb(dma_base)|1, dma_base); /* start DMA */
- return 0;
+ outb(inb(dma_base) | 1, dma_base); /* start DMA */
}

/*
@@ -545,11 +543,11 @@
u8 cmd;

if (ata_start_dma(drive, rq))
- return 1;
+ return ide_stopped;

/* No DMA transfers on ATAPI devices. */
if (drive->type != ATA_DISK)
- return 0;
+ return ide_started;

if (rq_data_dir(rq) == READ)
cmd = 0x08;
@@ -562,7 +560,9 @@
else
outb(cmd ? WIN_READDMA : WIN_WRITEDMA, IDE_COMMAND_REG);

- return udma_start(drive, rq);
+ udma_start(drive, rq);
+
+ return ide_started;
}

EXPORT_SYMBOL(ide_dma_intr);
diff -urN linux-2.5.21/drivers/ide/pdc202xx.c linux/drivers/ide/pdc202xx.c
--- linux-2.5.21/drivers/ide/pdc202xx.c 2002-06-14 12:45:13.000000000 +0200
+++ linux/drivers/ide/pdc202xx.c 2002-06-14 15:13:37.000000000 +0200
@@ -573,8 +573,6 @@
*/

outb(inb(ch->dma_base) | 1, ch->dma_base); /* start DMA */
-
- return 0;
}

int pdc202xx_udma_stop(struct ata_device *drive)
diff -urN linux-2.5.21/drivers/ide/pdc4030.c linux/drivers/ide/pdc4030.c
--- linux-2.5.21/drivers/ide/pdc4030.c 2002-06-14 12:45:13.000000000 +0200
+++ linux/drivers/ide/pdc4030.c 2002-06-14 02:09:46.000000000 +0200
@@ -784,7 +784,7 @@
args.taskfile.high_cylinder = (block>>=8);
args.taskfile.device_head = ((block>>8)&0x0f)|drive->select.all;
args.cmd = (rq_data_dir(rq) == READ) ? PROMISE_READ : PROMISE_WRITE;
- args.handler = NULL;
+ args.XXX_handler = NULL;
rq->special = &args;

return do_pdc4030_io(drive, &args, rq);
diff -urN linux-2.5.21/drivers/ide/sl82c105.c linux/drivers/ide/sl82c105.c
--- linux-2.5.21/drivers/ide/sl82c105.c 2002-06-09 07:28:39.000000000 +0200
+++ linux/drivers/ide/sl82c105.c 2002-06-14 14:22:23.000000000 +0200
@@ -209,6 +209,7 @@
static int sl82c105_dma_init(struct ata_device *drive, struct request *rq)
{
sl82c105_reset_host(drive->channel->pci_dev);
+
return udma_pci_init(drive, rq);
}

diff -urN linux-2.5.21/drivers/ide/tcq.c linux/drivers/ide/tcq.c
--- linux-2.5.21/drivers/ide/tcq.c 2002-06-14 12:45:03.000000000 +0200
+++ linux/drivers/ide/tcq.c 2002-06-14 15:04:59.000000000 +0200
@@ -84,7 +84,7 @@
{
struct ata_channel *ch = drive->channel;
request_queue_t *q = &drive->queue;
- struct ata_taskfile *args;
+ struct ata_taskfile *ar;
struct request *rq;
unsigned long flags;

@@ -110,8 +110,8 @@
* executed before any new commands are started. issue a NOP
* to clear internal queue on drive.
*/
- args = kmalloc(sizeof(*args), GFP_ATOMIC);
- if (!args) {
+ ar = kmalloc(sizeof(*ar), GFP_ATOMIC);
+ if (!ar) {
printk(KERN_ERR "ATA: %s: failed to issue NOP\n", drive->name);
goto out;
}
@@ -126,10 +126,10 @@
*/
BUG_ON(!rq);

- rq->special = args;
- args->cmd = WIN_NOP;
- args->handler = tcq_nop_handler;
- args->command_type = IDE_DRIVE_TASK_NO_DATA;
+ rq->special = ar;
+ ar->cmd = WIN_NOP;
+ ar->XXX_handler = tcq_nop_handler;
+ ar->command_type = IDE_DRIVE_TASK_NO_DATA;

rq->rq_dev = mk_kdev(drive->channel->major, (drive->select.b.unit)<<PARTN_BITS);
_elv_add_request(q, rq, 0, 0);
@@ -539,10 +539,9 @@
return ide_stopped;

set_irq(drive, ide_dmaq_intr);
- if (!udma_start(drive, rq))
- return ide_started;
+ udma_start(drive, rq);

- return ide_stopped;
+ return ide_started;
}

/*
@@ -550,7 +549,7 @@
*
* Channel lock should be held.
*/
-ide_startstop_t udma_tcq_taskfile(struct ata_device *drive, struct request *rq)
+ide_startstop_t udma_tcq_init(struct ata_device *drive, struct request *rq)
{
u8 stat;
u8 feat;
diff -urN linux-2.5.21/drivers/ide/trm290.c linux/drivers/ide/trm290.c
--- linux-2.5.21/drivers/ide/trm290.c 2002-06-14 12:45:00.000000000 +0200
+++ linux/drivers/ide/trm290.c 2002-06-14 15:12:48.000000000 +0200
@@ -179,7 +179,6 @@
static int trm290_udma_start(struct ata_device *drive, struct request *__rq)
{
/* Nothing to be done here. */
- return 0;
}

static int trm290_udma_stop(struct ata_device *drive)
@@ -210,7 +209,7 @@
#ifdef TRM290_NO_DMA_WRITES
trm290_prepare_drive(drive, 0); /* select PIO xfer */

- return 1;
+ return ide_stopped;
#endif
} else {
reading = 2;
@@ -219,7 +218,7 @@

if (!(count = udma_new_table(drive, rq))) {
trm290_prepare_drive(drive, 0); /* select PIO xfer */
- return 1; /* try PIO instead of DMA */
+ return ide_stopped; /* try PIO instead of DMA */
}

trm290_prepare_drive(drive, 1); /* select DMA xfer */
@@ -233,7 +232,7 @@
outb(reading ? WIN_READDMA : WIN_WRITEDMA, IDE_COMMAND_REG);
}

- return 0;
+ return ide_started;
}

static int trm290_udma_irq_status(struct ata_device *drive)
diff -urN linux-2.5.21/drivers/scsi/ide-scsi.c linux/drivers/scsi/ide-scsi.c
--- linux-2.5.21/drivers/scsi/ide-scsi.c 2002-06-14 12:45:13.000000000 +0200
+++ linux/drivers/scsi/ide-scsi.c 2002-06-14 14:18:13.000000000 +0200
@@ -444,7 +444,7 @@
bcount = min(pc->request_transfer, 63 * 1024); /* Request to transfer the entire buffer at once */

if (drive->using_dma && rq->bio)
- dma_ok = !udma_init(drive, rq);
+ dma_ok = udma_init(drive, rq);

ata_select(drive, 10);
ata_irq_enable(drive, 1);
diff -urN linux-2.5.21/include/linux/ide.h linux/include/linux/ide.h
--- linux-2.5.21/include/linux/ide.h 2002-06-14 12:45:13.000000000 +0200
+++ linux/include/linux/ide.h 2002-06-14 15:14:20.000000000 +0200
@@ -459,9 +459,9 @@
int (*udma_setup)(struct ata_device *);

void (*udma_enable)(struct ata_device *, int, int);
- int (*udma_start) (struct ata_device *, struct request *rq);
+ void (*udma_start) (struct ata_device *, struct request *);
int (*udma_stop) (struct ata_device *);
- int (*udma_init) (struct ata_device *, struct request *rq);
+ int (*udma_init) (struct ata_device *, struct request *);
int (*udma_irq_status) (struct ata_device *);
void (*udma_timeout) (struct ata_device *);
void (*udma_irq_lost) (struct ata_device *);
@@ -651,15 +651,12 @@
struct hd_drive_task_hdr hobfile;
u8 cmd; /* actual ATA command */
int command_type;
- ide_startstop_t (*handler)(struct ata_device *, struct request *);
+ ide_startstop_t (*XXX_handler)(struct ata_device *, struct request *);
};

extern void ata_read(struct ata_device *, void *, unsigned int);
extern void ata_write(struct ata_device *, void *, unsigned int);

-extern ide_startstop_t ata_do_taskfile(struct ata_device *,
- struct ata_taskfile *, struct request *);
-
/*
* Special Flagged Register Validation Caller
*/
@@ -751,9 +748,9 @@
drive->channel->udma_enable(drive, on, verbose);
}

-static inline int udma_start(struct ata_device *drive, struct request *rq)
+static inline void udma_start(struct ata_device *drive, struct request *rq)
{
- return drive->channel->udma_start(drive, rq);
+ drive->channel->udma_start(drive, rq);
}

static inline int udma_stop(struct ata_device *drive)
@@ -764,7 +761,7 @@
/*
* Initiate actual DMA data transfer. The direction is encoded in the request.
*/
-static inline int udma_init(struct ata_device *drive, struct request *rq)
+static inline ide_startstop_t udma_init(struct ata_device *drive, struct request *rq)
{
return drive->channel->udma_init(drive, rq);
}
@@ -802,7 +799,7 @@
extern int udma_black_list(struct ata_device *);
extern int udma_white_list(struct ata_device *);

-extern ide_startstop_t udma_tcq_taskfile(struct ata_device *, struct request *);
+extern ide_startstop_t udma_tcq_init(struct ata_device *, struct request *);
extern int udma_tcq_enable(struct ata_device *, int);

extern ide_startstop_t ide_dma_intr(struct ata_device *, struct request *);


Attachments:
ide-clean-91.diff (37.61 kB)

2002-06-14 15:17:17

by Jens Axboe

[permalink] [raw]
Subject: Re: [PATCH] 2.5.21 IDE 91

On Fri, Jun 14 2002, Martin Dalecki wrote:
> Thu Jun 13 22:59:54 CEST 2002 ide-clean-91
>
> - Realize that the only place where ata_do_taskfile gets used is ide-disk.c
> move it and its "friends' over there.

Ehm, isn't that a bit odd? The typical "I'm not looking at the
interface, if only one person is currently using it then heck lets move
it" Martin approach (refer to prep_rq_fn cdb builder as well)

The above is just a minor thing, the reason I'm mailing is really:

- current 2.5 bk deadlocks reading partition info off disk. Again a
locking problem I suppose, to be honest I just got very tired when
seeing it happen and didn't want to spend tim looking into it.

I thought IDE locking couldn't get worse than 2.4, but I think you are
well into doing just that. What exactly are you plans with the channel
locks? Right now, to me, it seems you are extending the use of them to
the point where they would be used to serialize the entire request
operation start? Heck, ide-cd is even holding the channel lock when
outputting the cdb now.

- ata_end_request(). why didn't you just remove the last argument to
__ata_end_request() instead just changing the comment saying why we
pass nr_secs == 0 in from some sites?

- what's the reasoning behind moving the active request into the
ata_device?! we are serializing requests for ata_device's on the
ata_channel anyways, which is why it made sense to have the active
request there.

And finally a small plea for more testing. Do you even test before
blindly sending patches off to Linus?! Sometimes just watching how
quickly these big patches appears makes it impossible that they have
gotten any kind of testing other than the 'hey it compiles', which I
think it just way too little for something that could possible screw
peoples data up very badly. Frankly, _I'm_ too scared to run 2.5 IDE
currently. The success ratio of posted over working patches is too big.

--
Jens Axboe

2002-06-14 15:43:31

by Dave Jones

[permalink] [raw]
Subject: Re: [PATCH] 2.5.21 IDE 91

On Fri, Jun 14, 2002 at 05:17:03PM +0200, Jens Axboe wrote:

> And finally a small plea for more testing. Do you even test before
> blindly sending patches off to Linus?! Sometimes just watching how
> quickly these big patches appears makes it impossible that they have
> gotten any kind of testing other than the 'hey it compiles', which I
> think it just way too little for something that could possible screw
> peoples data up very badly. Frankly, _I'm_ too scared to run 2.5 IDE
> currently. The success ratio of posted over working patches is too big.

Ditto. As we rapidly approach the 100th incarnation of Martin's IDE
patches, there are still cases where we die within seconds of booting
on some old PIO-only boxes for eg. There seems to be far too much
"lets rip this out as it doesn't do much anyway" rather than fixing
known problems.

When the IDE carnage first started back circa 2.5.3, I had contemplated
not merging *any* of the IDE patches, just so that people who want to
work on other areas could have something solid to build upon.
I regret not following through on that instinct.

Dave.

--
| Dave Jones. http://www.codemonkey.org.uk
| SuSE Labs

2002-06-14 15:49:03

by John Weber

[permalink] [raw]
Subject: Re: [PATCH] 2.5.21 IDE 91

> And finally a small plea for more testing. Do you even test before
> blindly sending patches off to Linus?! Sometimes just watching how
> quickly these big patches appears makes it impossible that they have
> gotten any kind of testing other than the 'hey it compiles', which I
> think it just way too little for something that could possible screw
> peoples data up very badly. Frankly, _I'm_ too scared to run 2.5 IDE
> currently. The success ratio of posted over working patches is too big.

I run all all of Martin's patches on my machine, and I haven't run into
any catastrophic problems (by this I mean problems that cause data loss
though I realize that this may not be much of a standard).

I rather like the fact that Martin releases early and often... it
usually means that I get a fix right away. I like the "release early and
often" approach in a development kernel branch since I do not believe
that releasing less often has any correlation to the stability of the
product released (look at Windows :).

Martin or Jens, are there any test suites that you would like me to run?

I am currently too stupid to be able to aid in the development directly
(lord knows i'm trying to get up to speed), but, in the meantime, I can
test the crap out of a kernel :).

-o) J o h n W e b e r
/\\ [email protected]
_\/v http://www.linuxhq.com/people/weber/

2002-06-14 15:56:35

by Benjamin LaHaise

[permalink] [raw]
Subject: Re: [PATCH] 2.5.21 IDE 91

On Fri, Jun 14, 2002 at 05:17:03PM +0200, Jens Axboe wrote:
> And finally a small plea for more testing. Do you even test before
> blindly sending patches off to Linus?! Sometimes just watching how
> quickly these big patches appears makes it impossible that they have
> gotten any kind of testing other than the 'hey it compiles', which I
> think it just way too little for something that could possible screw
> peoples data up very badly. Frankly, _I'm_ too scared to run 2.5 IDE
> currently. The success ratio of posted over working patches is too big.

Add my voice to these concerns. At the very least the code should have
been moved into a second tree to allow people to work with the old stable
driver as needed.

-ben
--
"You will be reincarnated as a toad; and you will be much happier."

2002-06-14 16:04:51

by Dave Jones

[permalink] [raw]
Subject: Re: [PATCH] 2.5.21 IDE 91

On Fri, Jun 14, 2002 at 11:56:34AM -0400, Benjamin LaHaise wrote:

> Add my voice to these concerns. At the very least the code should have
> been moved into a second tree to allow people to work with the old stable
> driver as needed.

*nod*, with periodic known-good _tested_ bits getting merged to
mainline, to avoid the need for an IDE merge flag day as has been
the norm in the past.

Dave
--
| Dave Jones. http://www.codemonkey.org.uk
| SuSE Labs

Subject: Re: [PATCH] 2.5.21 IDE 91


Just my 0.02 plns...

On Fri, 14 Jun 2002, Dave Jones wrote:

> On Fri, Jun 14, 2002 at 05:17:03PM +0200, Jens Axboe wrote:
>
> > And finally a small plea for more testing. Do you even test before
> > blindly sending patches off to Linus?! Sometimes just watching how
> > quickly these big patches appears makes it impossible that they have
> > gotten any kind of testing other than the 'hey it compiles', which I
> > think it just way too little for something that could possible screw
> > peoples data up very badly. Frankly, _I'm_ too scared to run 2.5 IDE
> > currently. The success ratio of posted over working patches is too big.
>

I review every single patch from Martin and they are usually ok,
but it is generally good habbit to wait for next patch before running
previous one (just to see if there was any bugs in previous one)...

> Ditto. As we rapidly approach the 100th incarnation of Martin's IDE
> patches, there are still cases where we die within seconds of booting
> on some old PIO-only boxes for eg. There seems to be far too much
> "lets rip this out as it doesn't do much anyway" rather than fixing
> known problems.

I will try to fix them one by one soon...

>
> When the IDE carnage first started back circa 2.5.3, I had contemplated
> not merging *any* of the IDE patches, just so that people who want to
> work on other areas could have something solid to build upon.
> I regret not following through on that instinct.
>

Your mistake, Dave ;)

> Dave.
>
> --
> | Dave Jones. http://www.codemonkey.org.uk
> | SuSE Labs
> -

--
Bartlomiej

Subject: Re: [PATCH] 2.5.21 IDE 91


You can just copy old drives/ide/ + include/linux/[ide.h, hdreg.h]
+ asm/ide.h and it should compile/work?...

On Fri, 14 Jun 2002, Benjamin LaHaise wrote:

> On Fri, Jun 14, 2002 at 05:17:03PM +0200, Jens Axboe wrote:
> > And finally a small plea for more testing. Do you even test before
> > blindly sending patches off to Linus?! Sometimes just watching how
> > quickly these big patches appears makes it impossible that they have
> > gotten any kind of testing other than the 'hey it compiles', which I
> > think it just way too little for something that could possible screw
> > peoples data up very badly. Frankly, _I'm_ too scared to run 2.5 IDE
> > currently. The success ratio of posted over working patches is too big.
>
> Add my voice to these concerns. At the very least the code should have
> been moved into a second tree to allow people to work with the old stable
> driver as needed.
>
> -ben
> --
> "You will be reincarnated as a toad; and you will be much happier."
> -
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to [email protected]
> More majordomo info at http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at http://www.tux.org/lkml/
>

2002-06-14 16:15:24

by Martin Dalecki

[permalink] [raw]
Subject: Re: [PATCH] 2.5.21 IDE 91

U?ytkownik Jens Axboe napisa?:
> On Fri, Jun 14 2002, Martin Dalecki wrote:
>
>>Thu Jun 13 22:59:54 CEST 2002 ide-clean-91
>>
>>- Realize that the only place where ata_do_taskfile gets used is ide-disk.c
>> move it and its "friends' over there.
>
>
> Ehm, isn't that a bit odd? The typical "I'm not looking at the
> interface, if only one person is currently using it then heck lets move
> it" Martin approach (refer to prep_rq_fn cdb builder as well)

Yes this is the usual Marcin aproach. The fscking best road to bloat
is providing interfaces "on the heap" and "just in case", which
then nobody sane uses. Wen one discovers later that they are inadequate,
we try to support them until the end of days becouse
some silly python based incompetently written setup application
turns out to love to having you know what with.

And since application level programming expierence shows me that in 99%
of the cases where interfaces are designed in front of beeing used
they turn out to be inadequate I don't do it.

Won't to see some silly things like the situation described above?
Please just count the number of ioctl for the /dev/random.
90% of them qualify as "debuggin during developement" or are
working against the purpose of the thing. Just one example.
Once another even more striking is the whole /proc/ mess.

> The above is just a minor thing, the reason I'm mailing is really:
>
> - current 2.5 bk deadlocks reading partition info off disk. Again a
> locking problem I suppose, to be honest I just got very tired when
> seeing it happen and didn't want to spend tim looking into it.

2.5.21 + the patches I did doesn't. Likely it's the driverfs?

> I thought IDE locking couldn't get worse than 2.4, but I think you are
> well into doing just that. What exactly are you plans with the channel
> locks? Right now, to me, it seems you are extending the use of them to
> the point where they would be used to serialize the entire request
> operation start? Heck, ide-cd is even holding the channel lock when
> outputting the cdb now.

After extracting out 80% of the host controller register file
access one has to realize that in reality we where releasing the lock
just to regain it immediately. Or alternatively accessing them
without any lock protection at all. (Same goes for BIO ummer layer
memmbers.) This is why they are pushed up. It's just avoiding the
"windows" between unlock and immediate relock and making the real
behaviour more "obvious". You have just realized this.

2.4 prevents the locking problems basically by georgeously
disabling IRQs. Too fine grained locking is a futile exercise.
Unless I see the time spent in system state during concurrent disk
access going really up (it doesn't right now), I don't see any thing
bad in making the locking more coarse. Locks don't came for free and
having fine grained locking isn't justifying itself.

Another "usual Marcin approach" - don't optimze for the sake of it.
See futile unlikely() tagging and inlining in tcq.c for example.
I don't do somethig like that. I have just written too much
numerical code which was really time constrained to do something
like this before looking at benchmarks.
Really constrained means having a program running 7 or "just"
5 *days*. This can make a difference, a difference in hard real
money on the range of multiple kEUR!

Finally - unless there appears some aother way to block access to
busy devices on the generic block layer I do it the only way
we have right now - spinlocks. (... looking forward to working
queue pugging and the work done by Adam richter).
Unless there is a sane way to signal partial completion - we will
be doing it at once. Unless we have a sane async io infrastructure
most of the above will be likely not solved anyway.

> - ata_end_request(). why didn't you just remove the last argument to
> __ata_end_request() instead just changing the comment saying why we
> pass nr_secs == 0 in from some sites?

One step after another. Watch for hard_xxx members from struch request
to see why I hesitated please.

> - what's the reasoning behind moving the active request into the
> ata_device?! we are serializing requests for ata_device's on the
> ata_channel anyways, which is why it made sense to have the active
> request there.

Becouse it is going to go away altogether. We need it there
just only for the purpose of the default ide_timer_expiry function, which
is subject to go away since a long time. And finally becouse
it doesn't hurt.

Further on I refer you to the discussion we had (or was it Linus?)
once about the fact that attaching physical properties of the
device to the request queue and replicating those parameters in
every single request struct, is well ... "unpleasant" on behalf of the
upper layers. Loop devices expose the same problem.
Once again just grepping for hard_ memebers of the struct
request makes it obvious.

Somce people say that using the gratest common denominator in
the case of the loop devices is the solution,
but I think that it's rather a work around.

> And finally a small plea for more testing. Do you even test before
> blindly sending patches off to Linus?! Sometimes just watching how
> quickly these big patches appears makes it impossible that they have
> gotten any kind of testing other than the 'hey it compiles', which I
> think it just way too little for something that could possible screw
> peoples data up very badly. Frankly, _I'm_ too scared to run 2.5 IDE
> currently. The success ratio of posted over working patches is too big.

Fact is: many of the patches are just big becouse they contain
host chip handling cleanups done by others, and becouse
we have just too many different drivers for the same purpose:
ATAPI packet command devices. Which I'm more and more tempted
to scarp... in favour of just ide-scsi.c. But that's another
story. (Adam J. Richter is givng me constant preassure to do just that and I
start really tending to admitt that he is just right.)

As of testing. Well at least I can assure you that I'm eating my dogfood,
since I run constantly on the patches. (Heck even the time I write this.)
But I don't use kernels from the BK repository at all.
In fact I just don't use BK at all and I don't intend too.

2002-06-14 16:30:10

by Hron, Randall

[permalink] [raw]
Subject: Re: [PATCH] 2.5.21 IDE 91

> (lord knows i'm trying to get up to speed), but, in the meantime, I can
> test the crap out of a kernel :).

tiobench is having trouble completing in kernels >= 2.5.19 on my K6-2
384 mb ram, IDE test system. The parameters I'm using are:

tiobench.pl --size 2048 --numruns 3 --threads 1 --threads 32 --threads 64
--threads 128

--size depends on ram and disk space.

Early in 2.5, dbench 192 would exercise a bug or two.
(requires about 5GB of disk space)

Linux Test Project's runalltests.sh has occasionally triggered a bug.

2.5 took a drop in dbench throughput recently.

dbench ext2 128 processes Average High Low(MB/sec)
2.5.19 18.60 21.69 14.58
2.5.20 12.89 13.15 12.79
2.5.21 12.67 12.94 12.51

If you want to benchmark some stuff while you're stress testing,
http://home.earthlink.net/~rwhron/kernel/index.html might be a
starting point for ideas.



2002-06-14 16:33:53

by Martin Dalecki

[permalink] [raw]
Subject: Re: [PATCH] 2.5.21 IDE 91

U?ytkownik Bartlomiej Zolnierkiewicz napisa?:
> Just my 0.02 plns...
>
> On Fri, 14 Jun 2002, Dave Jones wrote:
>
>
>>On Fri, Jun 14, 2002 at 05:17:03PM +0200, Jens Axboe wrote:
>>
>> > And finally a small plea for more testing. Do you even test before
>> > blindly sending patches off to Linus?! Sometimes just watching how
>> > quickly these big patches appears makes it impossible that they have
>> > gotten any kind of testing other than the 'hey it compiles', which I
>> > think it just way too little for something that could possible screw
>> > peoples data up very badly. Frankly, _I'm_ too scared to run 2.5 IDE
>> > currently. The success ratio of posted over working patches is too big.
>
> I review every single patch from Martin and they are usually ok,
> but it is generally good habbit to wait for next patch before running
> previous one (just to see if there was any bugs in previous one)...

And I'm gald you do. You know that I admit if I screw
things up even in my change logs. Finally I'm sometimes just
the shield for screwups done by others. (No problem I can
take the heat :-).

>>Ditto. As we rapidly approach the 100th incarnation of Martin's IDE
>>patches, there are still cases where we die within seconds of booting
>>on some old PIO-only boxes for eg. There seems to be far too much
>>"lets rip this out as it doesn't do much anyway" rather than fixing
>>known problems.
>
>
> I will try to fix them one by one soon...

Many people just do not realize that I don't hunt for the
easy fruits. I tend to solve fundamental things first before
getting down. (See for example the TCQ in and out
discussion I had with Jens - it turned out to be much
better to do the infrastructure thing at same time instead of
hacking up on the existing thing.)

Down to the point - there was *no way in hell* to
solve the PIO problems util:

1. The basic datastructures we have now where there.

2. The locking issues get resolved and take place on a sane
level.

3. The number of possible code flows got sanitized.

Heck, contrary to the habbits of many others I'm constantly
trying to explain even the reasoning behing the changes I do.
Not just what gets changes.

But fortunately right now we are indeed "getting just there" as
the fact shows that the last series of the IDE patches is moving
more and more down to the actual transport layer. And since
the overall structure starts to become more and more
clean even more and more people start to work together with
me on not just some very well separated areas like for
example host chip timing but the overall infrastructure as well.
(Adam, Bartek - I'm glad you are around :-).

Everybody out there proclaiming that this could have
all been solved far earlier by some kind of "easy" fix had just
enough of time to prove me worng on this issue.

Unless I get complains from people who work with me together
on the code itself I indeed tend to follow my own agenda
of prio.

It's that simple.

2002-06-14 16:43:14

by Linus Torvalds

[permalink] [raw]
Subject: Re: [PATCH] 2.5.21 IDE 91



On Fri, 14 Jun 2002, Jens Axboe wrote:
>
> - current 2.5 bk deadlocks reading partition info off disk. Again a
> locking problem I suppose, to be honest I just got very tired when
> seeing it happen and didn't want to spend tim looking into it.

Hmm. There's a bug in "balance_irq()" if you are trying to run a SMP
kernel on an UP machine right now, and it _might_ be that the lockup has
nothing to do with the IDE layer, but simple with the first PCI interrupt
(as opposed to local timer interrupt) coming in.

One-liner from Zwane Mwaikambo (cut-and-paste, so space is wrong, please
apply by hand).

--- linux-2.5.19/arch/i386/kernel/io_apic.c.orig Fri Jun 14 17:43:20 2002
+++ linux-2.5.19/arch/i386/kernel/io_apic.c Fri Jun 14 17:42:23 2002
@@ -251,7 +251,7 @@
irq_balance_t *entry = irq_balance + irq;
unsigned long now = jiffies;

- if (unlikely(entry->timestamp != now)) {
+ if ((entry->timestamp != now) && (smp_num_cpus > 1)) {
unsigned long allowed_mask;
int random_number;

I don't know. Might be the IDE code too, of course.

Linus

2002-06-14 16:47:49

by Martin Dalecki

[permalink] [raw]
Subject: Re: [PATCH] 2.5.21 IDE 91

U?ytkownik Linus Torvalds napisa?:
>
> On Fri, 14 Jun 2002, Jens Axboe wrote:
>
>>- current 2.5 bk deadlocks reading partition info off disk. Again a
>> locking problem I suppose, to be honest I just got very tired when
>> seeing it happen and didn't want to spend tim looking into it.
>
>
> Hmm. There's a bug in "balance_irq()" if you are trying to run a SMP
> kernel on an UP machine right now, and it _might_ be that the lockup has
> nothing to do with the IDE layer, but simple with the first PCI interrupt
> (as opposed to local timer interrupt) coming in.

...

> I don't know. Might be the IDE code too, of course.

Just to complete the picture: I'm running SMP kernels on
UP for the sake of spinlock debugging and compilatoin coverage too.
But as I have already stated - I run my own patches on
top of the last offical release instead of BK contents.


2002-06-14 17:10:00

by Andries E. Brouwer

[permalink] [raw]
Subject: Re: [PATCH] 2.5.21 IDE 91

> Frankly, _I'm_ too scared to run 2.5 IDE currently.

Backups, that is what you need. Or a scratch machine.

This is what vanilla 2.5.21 can do to your filesystem
(after a reboot and a e2fsck -a):

% ls /lost+found
#10416
#104719
#104724
#10537
#10540
#10547
#10548
#10549
#10550
#10551
#106768
#108545
#108550
#108576
...
(thousands and thousands of files - not lost, only their
names suffered a bit...)

But, to be fair, only a small part of the damage is due
to the kernel. Afterwards, e2fsck made things much worse.

Andries


(Vanilla 2.5.21 does not compile, you say?
OK, 2.5.21 together with the addition of the #include lines
that make it compile.)

2002-06-14 17:15:36

by Martin Dalecki

[permalink] [raw]
Subject: Re: [PATCH] 2.5.21 IDE 91

U?ytkownik [email protected] napisa?:
>>Frankly, _I'm_ too scared to run 2.5 IDE currently.
>
>
> Backups, that is what you need. Or a scratch machine.
>
> This is what vanilla 2.5.21 can do to your filesystem
> (after a reboot and a e2fsck -a):
>
> % ls /lost+found
> #10416
> #104719

> ...
> (thousands and thousands of files - not lost, only their
> names suffered a bit...)
>
> But, to be fair, only a small part of the damage is due
> to the kernel. Afterwards, e2fsck made things much worse.

Just curious: Becouse dir entires beeing
affected looks like the effect of the recent changes to
the VFS.

2002-06-14 17:23:09

by Martin Dalecki

[permalink] [raw]
Subject: Re: [PATCH] 2.5.21 IDE 91

U?ytkownik Dave Jones napisa?:
> On Fri, Jun 14, 2002 at 11:56:34AM -0400, Benjamin LaHaise wrote:
>
> > Add my voice to these concerns. At the very least the code should have
> > been moved into a second tree to allow people to work with the old stable
> > driver as needed.
>
> *nod*, with periodic known-good _tested_ bits getting merged to
> mainline, to avoid the need for an IDE merge flag day as has been
> the norm in the past.

And they where the best way to basically halt the whole thing.
Right now the only thing you would achieve would be to kick out
the other people with wich I work *together*.
Oh perhaps noone of them would have got involved...
I simply don't like to idea of lonely developement on a separate
small iland called a "dedicated mailing list". And I don't see any
need for it - the traffic on LKML isn't that high if one
learn how to use mozillas filtering facilities.



2002-06-14 17:56:25

by Linus Torvalds

[permalink] [raw]
Subject: Re: [PATCH] 2.5.21 IDE 91



On Fri, 14 Jun 2002, Dave Jones wrote:
> On Fri, Jun 14, 2002 at 05:17:03PM +0200, Jens Axboe wrote:
>
> > And finally a small plea for more testing. Do you even test before
> > blindly sending patches off to Linus?! Sometimes just watching how
> > quickly these big patches appears makes it impossible that they have
> > gotten any kind of testing other than the 'hey it compiles', which I
> > think it just way too little for something that could possible screw
> > peoples data up very badly. Frankly, _I'm_ too scared to run 2.5 IDE
> > currently. The success ratio of posted over working patches is too big.
>
> Ditto. As we rapidly approach the 100th incarnation of Martin's IDE
> patches, there are still cases where we die within seconds of booting
> on some old PIO-only boxes for eg. There seems to be far too much
> "lets rip this out as it doesn't do much anyway" rather than fixing
> known problems.

Are we perhaps forgetting the _point_ of open source?

We're not supposed to be writing code and then releasing it when it is
done. We _want_ incremental changes, and open breakage.

Do bugs happen? Should we expect locking problems if the author is working
on changing the locking (which everybody who has ever looked at the code
admits was totally broken)?

YES.

Am I personally disturbed over the fact that PIO is still totally broken?
Yes. I don't like that part at all, but I do know that Martin is aware of
it, and I keep pushing on him all the time. Martin claims to be on top of
it, and getting close to be able to fix it. I haven't seen any real reason
to doubt him on that so far. We'll get there.

Linus

2002-06-14 18:36:33

by Andries E. Brouwer

[permalink] [raw]
Subject: Re: [PATCH] 2.5.21 IDE 91

>>>Frankly, _I'm_ too scared to run 2.5 IDE currently.

>> Backups, that is what you need. Or a scratch machine.

> Just curious: Becouse dir entires beeing affected
> looks like the effect of the recent changes to the VFS.

I am not ready to blame any part of the kernel.
Don't read an implicit complaint about IDE into my note.
No, just a warning: this is what vanilla 2.5.21 can do.

Andries

2002-06-14 23:34:05

by Andrew Morton

[permalink] [raw]
Subject: Re: [PATCH] 2.5.21 IDE 91

"Hron, Randall" wrote:
>
> > (lord knows i'm trying to get up to speed), but, in the meantime, I can
> > test the crap out of a kernel :).
>
> tiobench is having trouble completing in kernels >= 2.5.19 on my K6-2
> 384 mb ram, IDE test system. The parameters I'm using are:
>
> tiobench.pl --size 2048 --numruns 3 --threads 1 --threads 32 --threads 64
> --threads 128
>
> --size depends on ram and disk space.
>
> Early in 2.5, dbench 192 would exercise a bug or two.
> (requires about 5GB of disk space)
>
> Linux Test Project's runalltests.sh has occasionally triggered a bug.

Is this still happening? What was the bug?

> 2.5 took a drop in dbench throughput recently.
>
> dbench ext2 128 processes Average High Low(MB/sec)

Is this still with 384 megs of memory?

> 2.5.19 18.60 21.69 14.58
> 2.5.20 12.89 13.15 12.79
> 2.5.21 12.67 12.94 12.51
>

One possibile culprit here is the doubling of the request queue size
in 2.5.20. A long time ago it was 1024 slots. Then it went to
128. That's where it is in Marcelo kernels. Then -ac kernels
went up to 1024 because they have read-latency2. Somehow 2.5 found
itself at 256 slots. In 2.5.20 it slealthily snuck up to 512
slots. I didn't squeak about this because I was interested to see what
effect it would have.

Does this patch get the throughput back?


Index: drivers/block/ll_rw_blk.c
===================================================================
RCS file: /opt/cvs/lk/drivers/block/ll_rw_blk.c,v
retrieving revision 1.66
diff -u -r1.66 ll_rw_blk.c
--- drivers/block/ll_rw_blk.c 9 Jun 2002 07:13:15 -0000 1.66
+++ drivers/block/ll_rw_blk.c 14 Jun 2002 23:35:54 -0000
@@ -1974,6 +1974,8 @@
if (queue_nr_requests > 512)
queue_nr_requests = 512;

+ queue_nr_requests = 256;
+
/*
* Batch frees according to queue length
*/


-

2002-06-15 08:16:08

by Jens Axboe

[permalink] [raw]
Subject: Re: [PATCH] 2.5.21 IDE 91

On Fri, Jun 14 2002, Martin Dalecki wrote:
> >- current 2.5 bk deadlocks reading partition info off disk. Again a
> > locking problem I suppose, to be honest I just got very tired when
> > seeing it happen and didn't want to spend tim looking into it.
>
> 2.5.21 + the patches I did doesn't. Likely it's the driverfs?

This particular problem I don't know, I'm simply just out lining it.

> >I thought IDE locking couldn't get worse than 2.4, but I think you are
> >well into doing just that. What exactly are you plans with the channel
> >locks? Right now, to me, it seems you are extending the use of them to
> >the point where they would be used to serialize the entire request
> >operation start? Heck, ide-cd is even holding the channel lock when
> >outputting the cdb now.
>
> After extracting out 80% of the host controller register file
> access one has to realize that in reality we where releasing the lock
> just to regain it immediately. Or alternatively accessing them
> without any lock protection at all. (Same goes for BIO ummer layer
> memmbers.) This is why they are pushed up. It's just avoiding the
> "windows" between unlock and immediate relock and making the real
> behaviour more "obvious". You have just realized this.

I know the locking needs to be reworked, it just very much looks like
that you are just extending the scope of the channel lock to basically
be held the entire way through. I'm hoping this is just a transition?

> 2.4 prevents the locking problems basically by georgeously
> disabling IRQs. Too fine grained locking is a futile exercise.

Yep

> Unless I see the time spent in system state during concurrent disk
> access going really up (it doesn't right now), I don't see any thing
> bad in making the locking more coarse. Locks don't came for free and
> having fine grained locking isn't justifying itself.

That's silly. Most of the "locking" required is just serializing access
to the channel (or interface). Just making the locking coarse and
grabbing it to do just that is pretty dumb.

> Another "usual Marcin approach" - don't optimze for the sake of it.
> See futile unlikely() tagging and inlining in tcq.c for example.
> I don't do somethig like that. I have just written too much
> numerical code which was really time constrained to do something
> like this before looking at benchmarks.
> Really constrained means having a program running 7 or "just"
> 5 *days*. This can make a difference, a difference in hard real
> money on the range of multiple kEUR!

Listing to complaints about unlikely() as micro-optimization from
someone who doesn't think that using a spin lock to serialize looong
operations is a problem doesn't carry a lot of weight, sorry. I don't
know why you bring this up again, I've already stated my case in the
last mail and I see no reason to repeat it.

> Finally - unless there appears some aother way to block access to
> busy devices on the generic block layer I do it the only way
> we have right now - spinlocks. (... looking forward to working
> queue pugging and the work done by Adam richter).

First of all, queue plugging works now. Second, this is no excuse for
using a spin lock to serialize request starts?! Please tell me you don't
really mean this. At worst you could have spurious request_fn runs
before, but that's hardly a big problem. I know the start/stop queue is
a nicer interface (that's why it's there now), but there's nothing wrong
with simply recalling your queueing function once a request completes.
That's how it was done before too. In short, this is not an argument, it
has little relevance to this case. And the big-bio stuff, how is that
relevant?

> Unless there is a sane way to signal partial completion - we will
> be doing it at once. Unless we have a sane async io infrastructure
> most of the above will be likely not solved anyway.

??

> > ata_device?! we are serializing requests for ata_device's on the
> > ata_channel anyways, which is why it made sense to have the active
> > request there.
>
> Becouse it is going to go away altogether. We need it there
> just only for the purpose of the default ide_timer_expiry function, which
> is subject to go away since a long time. And finally becouse
> it doesn't hurt.

Because it doesn't hurt? From the same book of code writing an
optimization? Again, the serialization point is the channel, why move
the active request to the drive?! To me, this is loosing information
and making the whole thing more confusing.

> Further on I refer you to the discussion we had (or was it Linus?)
> once about the fact that attaching physical properties of the
> device to the request queue and replicating those parameters in
> every single request struct, is well ... "unpleasant" on behalf of the

The drive <-> queue relationship has no bearing on the active request
serialization.

> upper layers. Loop devices expose the same problem.

Please explain the loop case?

> Once again just grepping for hard_ memebers of the struct
> request makes it obvious.

Do you understand why we have the hard_ members? It seems you don't,
because I don't see how that is remotely related to this. The hard_
members are just there so that low level drivers can screw with the
nr_sectors and current_nr_sectors as much as they want, and the block
layer can still maintain a consistent request state regardless of what
happens.

> Somce people say that using the gratest common denominator in
> the case of the loop devices is the solution,
> but I think that it's rather a work around.

This sounds like nonsense.

> >And finally a small plea for more testing. Do you even test before
> >blindly sending patches off to Linus?! Sometimes just watching how
> >quickly these big patches appears makes it impossible that they have
> >gotten any kind of testing other than the 'hey it compiles', which I
> >think it just way too little for something that could possible screw
> >peoples data up very badly. Frankly, _I'm_ too scared to run 2.5 IDE
> >currently. The success ratio of posted over working patches is too big.
>
> Fact is: many of the patches are just big becouse they contain
> host chip handling cleanups done by others, and becouse
> we have just too many different drivers for the same purpose:
> ATAPI packet command devices. Which I'm more and more tempted
> to scarp... in favour of just ide-scsi.c. But that's another
> story. (Adam J. Richter is givng me constant preassure to do just that and
> I start really tending to admitt that he is just right.)

Yeah I know that they are mostly big because of cleanups, and I'm not
worried about that at all. But even when just maybe 10% of the patch is
changing stuff radically, problems can sneak in. Plus, there appears to
be no clear goal in what you are doing. Things change in one direction
one day, back in another the next day. I have a hard time seeing how
this will lead to a cleaner and more maintainable code base.

> As of testing. Well at least I can assure you that I'm eating my dogfood,
> since I run constantly on the patches. (Heck even the time I write this.)

That's good for you, but a single person testing is usually not enough.
Especially not with stuff like IDE where there are sooo many different
pieces of hardware and setups out there. I'm not saying that you should
do complete validation of the code every single time, but maybe having a
bleding edge tree and a linus tree would go along way. Then you could
ship cleanups as much as you want, but do the more radical changes a bit
slower. I think that would also solve your direction problem, letting
the more radical changes mature a bit before shipping it.

> But I don't use kernels from the BK repository at all.
> In fact I just don't use BK at all and I don't intend too.

Doesn't matter. Fact is, you don't know when Linus will tag the BK tree
as the next release. Or how many of your ide-xx patches are in at that
point.

--
Jens Axboe

2002-06-15 08:20:00

by Jens Axboe

[permalink] [raw]
Subject: Re: [PATCH] 2.5.21 IDE 91

On Fri, Jun 14 2002, Linus Torvalds wrote:
>
>
> On Fri, 14 Jun 2002, Jens Axboe wrote:
> >
> > - current 2.5 bk deadlocks reading partition info off disk. Again a
> > locking problem I suppose, to be honest I just got very tired when
> > seeing it happen and didn't want to spend tim looking into it.
>
> Hmm. There's a bug in "balance_irq()" if you are trying to run a SMP
> kernel on an UP machine right now, and it _might_ be that the lockup has
> nothing to do with the IDE layer, but simple with the first PCI interrupt
> (as opposed to local timer interrupt) coming in.
>
> One-liner from Zwane Mwaikambo (cut-and-paste, so space is wrong, please
> apply by hand).
>
> --- linux-2.5.19/arch/i386/kernel/io_apic.c.orig Fri Jun 14 17:43:20 2002
> +++ linux-2.5.19/arch/i386/kernel/io_apic.c Fri Jun 14 17:42:23 2002
> @@ -251,7 +251,7 @@
> irq_balance_t *entry = irq_balance + irq;
> unsigned long now = jiffies;
>
> - if (unlikely(entry->timestamp != now)) {
> + if ((entry->timestamp != now) && (smp_num_cpus > 1)) {
> unsigned long allowed_mask;
> int random_number;
>
> I don't know. Might be the IDE code too, of course.

If it's just a SMP kernel on UP, then that's not the problem here. This
was SMP kernel on SMP machine.

--
Jens Axboe

2002-06-15 10:41:30

by Randy Hron

[permalink] [raw]
Subject: Re: [PATCH] 2.5.21 IDE 91

>> > test the crap out of a kernel :).

>> Linux Test Project's runalltests.sh has occasionally triggered a bug.

> Is this still happening? What was the bug?

That's just a general suggestion with regard to kernel testing.
Recent 2.5.x hasn't had a problem completing LTP runalltests.sh.
I've used LTP to narrow down a couple early 2.4.x reiserfs bugs to
a specific test case. LTP has occasionally triggered oops and
livelocks too. It's a useful regression test.

>> 2.5 took a drop in dbench throughput recently.
>>
>> dbench ext2 128 processes Average High Low(MB/sec)

> Is this still with 384 megs of memory?

Yes.

> 2.5.19 18.60 21.69 14.58
> 2.5.20 12.89 13.15 12.79

> One possibile culprit here is the doubling of the request queue size
> in 2.5.20. A long time ago it was 1024 slots. Then it went to
> 128. That's where it is in Marcelo kernels. Then -ac kernels
> went up to 1024 because they have read-latency2. Somehow 2.5 found
> itself at 256 slots. In 2.5.20 it slealthily snuck up to 512
> slots. I didn't squeak about this because I was interested to see what
> effect it would have.

Interesting. I've seen read-latency2 drop dbench throughput in -aa
kernels (but I use it anyway). I'd like to capture the request
queue size. Is there a command or file in /proc that displays
it, or should I just grep drivers/block/ll_rw_blk.c?

> Does this patch get the throughput back?

I will try that next.

--
Randy Hron

2002-06-15 11:39:53

by Randy Hron

[permalink] [raw]
Subject: Re: [PATCH] 2.5.21 IDE 91

> When the IDE carnage first started back circa 2.5.3, I had contemplated
> not merging *any* of the IDE patches, just so that people who want to
> work on other areas could have something solid to build upon.
> I regret not following through on that instinct.

I give the -dj series a vote of "good taste". In my testing they have
been reliable. Recently, 2.5.20-dj[34] completed all my tests, whereas
2.5.{19,20,21} haven't. I realize breakage in the development series
is expected and sometimes good. Nonetheless, "two thumbs up" for -dj.

--
Randy Hron

2002-06-15 11:50:13

by Dave Jones

[permalink] [raw]
Subject: Re: [PATCH] 2.5.21 IDE 91

On Sat, Jun 15, 2002 at 07:41:06AM -0400, [email protected] wrote:
> > When the IDE carnage first started back circa 2.5.3, I had contemplated
> > not merging *any* of the IDE patches, just so that people who want to
> > work on other areas could have something solid to build upon.
> > I regret not following through on that instinct.
>
> I give the -dj series a vote of "good taste". In my testing they have
> been reliable. Recently, 2.5.20-dj[34] completed all my tests, whereas
> 2.5.{19,20,21} haven't. I realize breakage in the development series
> is expected and sometimes good. Nonetheless, "two thumbs up" for -dj.

That's interesting. What exactly was failing ? It'd be in everyones
interests to get those bits pushed to Linus sooner.

Dave.

--
| Dave Jones. http://www.codemonkey.org.uk
| SuSE Labs

2002-06-15 12:03:58

by Randy Hron

[permalink] [raw]
Subject: Re: [PATCH] 2.5.21 IDE 91

>> Recently, 2.5.20-dj[34] completed all my tests, whereas
>> 2.5.{19,20,21} haven't. I realize breakage in the development series
>> is expected and sometimes good. Nonetheless, "two thumbs up" for -dj.

> That's interesting. What exactly was failing ? It'd be in everyones
> interests to get those bits pushed to Linus sooner.

tiobench.pl --size 2048 --numruns 3 --threads 128 # 384 MB ram in machine

The ssh session running vmstat no longer updates. Console won't
give a new "login" prompt with <Enter>. <sysrq T> prints a
trace (which I haven't captured - it's really long with > 128 processes).

Does <sysrq T> need any post processing to convert addresses to
something more useful? I'll save it on 2.5.22 if it happens.

--
Randy Hron

2002-06-15 17:17:35

by Jens Axboe

[permalink] [raw]
Subject: Re: [PATCH] 2.5.21 IDE 91

On Sat, Jun 15 2002, [email protected] wrote:
> > One possibile culprit here is the doubling of the request queue size
> > in 2.5.20. A long time ago it was 1024 slots. Then it went to
> > 128. That's where it is in Marcelo kernels. Then -ac kernels
> > went up to 1024 because they have read-latency2. Somehow 2.5 found
> > itself at 256 slots. In 2.5.20 it slealthily snuck up to 512
> > slots. I didn't squeak about this because I was interested to see what
> > effect it would have.
>
> Interesting. I've seen read-latency2 drop dbench throughput in -aa
> kernels (but I use it anyway). I'd like to capture the request
> queue size. Is there a command or file in /proc that displays
> it, or should I just grep drivers/block/ll_rw_blk.c?

There is currently no way you can capture the queue request state. In
the past I've done sysrq hacks to display it, but that's about it.

--
Jens Axboe

2002-06-15 21:01:38

by William Lee Irwin III

[permalink] [raw]
Subject: Re: [PATCH] 2.5.21 IDE 91

At some point in the past, akpm wrote:
>> Does this patch get the throughput back?

On Sat, Jun 15, 2002 at 05:00:09PM -0400, [email protected] wrote:
> That makes all the difference to dbench. Throughput
> for dbench 128 up over 40% compared to vanilla 2.5.21.

How does it do against the prior 2.5 kernels?


Cheers,
Bill

2002-06-15 20:58:58

by Randy Hron

[permalink] [raw]
Subject: Re: [PATCH] 2.5.21 IDE 91

> Does this patch get the throughput back?

That makes all the difference to dbench. Throughput
for dbench 128 up over 40% compared to vanilla 2.5.21.
--
Randy Hron

2002-06-15 21:19:58

by Andrew Morton

[permalink] [raw]
Subject: Re: [PATCH] 2.5.21 IDE 91

[email protected] wrote:
>
> > Does this patch get the throughput back?
>
> That makes all the difference to dbench. Throughput
> for dbench 128 up over 40% compared to vanilla 2.5.21.

ho hum. Now we need to work out why a larger request queue
whacks dbench, whether it penalises workloads which we actually
care about and if so, what the appropriate size really should be.
If indeed that algorithms are optimal. urgh.

Thanks again, Randy.

-

2002-06-16 10:51:32

by Randy Hron

[permalink] [raw]
Subject: Re: [PATCH] 2.5.21 IDE 91

> That's interesting. What exactly was failing ? It'd be in everyones
> interests to get those bits pushed to Linus sooner.

This time it was tiobench with 32 threads. The <sysrq Tasks>
and a few other details on the livelock are at:

http://home.earthlink.net/~rwhron/kernel/2.5.21-sysrq.txt

If the System.map file is useful, it is at:
http://home.earthlink.net/~rwhron/kernel/System.map-2.5.21.bz2

--
Randy Hron

2002-06-16 11:04:12

by Randy Hron

[permalink] [raw]
Subject: Re: [PATCH] 2.5.21 IDE 91

> At some point in the past, akpm wrote:
>>> Does this patch get the throughput back?

>> That makes all the difference to dbench.

> How does it do against the prior 2.5 kernels?

dbench ext2 128 Average
2.5.1-dj13 8.04 mb/sec
2.5.2-dj6 8.59
2.5.4-dj2 8.45
2.5.16 11.06
2.5.18-akpm 18.11
2.5.18-wli 18.54
2.5.19 18.60
2.5.19-wli 18.54
2.5.19-wli3 20.93
2.5.20 12.89
2.5.20-dj4 10.58
2.5.21 12.67
2.5.21-akpm 19.65

--
Randy Hron

2002-06-16 11:05:10

by Adrian Bunk

[permalink] [raw]
Subject: Re: [PATCH] 2.5.21 kill warnings 6/19

On Mon, 10 Jun 2002, Martin Dalecki wrote:

>...
> - Fix improper __FUNCTION__ usage in smb_debug.h.
>...


Was it intended that this change breaks the compilation of
fs/smbfs/proc.c?


<-- snip -->

...
gcc -Wp,-MD,./.proc.o.d -D__KERNEL__
-I/home/bunk/linux/kernel-2.5/linux-2.5.21-full/include -Wall -Wstrict-prototypes -Wno-trigraphs -O2
-fomit-frame-pointer
-fno-strict-aliasing -fno-common -pipe -mpreferred-stack-boundary=2
-march=k6 -nostdinc -iwithprefix include -DSMBFS_PARANOIA -DKBUILD_BASENAME=proc
-c -o proc.o proc.c
proc.c: In function `smb_request_ok':
proc.c:875: parse error before `)'
make[2]: *** [proc.o] Error 1
make[2]: Leaving directory
`/home/bunk/linux/kernel-2.5/linux-2.5.21-full/fs/smbfs'

<-- snip -->


cu
Adrian

--

You only think this is a free country. Like the US the UK spends a lot of
time explaining its a free country because its a police state.
Alan Cox


2002-06-16 13:01:41

by Randy Hron

[permalink] [raw]
Subject: Re: [PATCH] 2.5.21 IDE 91

This oops occured after rebooting into 2.5.21, compiling a kernel,
then init 6.

flushing ide devices: hda <1>Unable to handle kernel NULL pointer dereference at virtual address 00000004
c0199a8b
*pde = 00000000
Oops: 0002
CPU: 0
EIP: 0010:[<c0199a8b>] Not tainted
Using defaults from ksymoops -t elf32-i386 -a i386
EFLAGS: 00010286
eax: c02c1944 ebx: c02c192c ecx: 00000000 edx: 00000000
esi: c025cc60 edi: 00000001 ebp: 00000001 esp: d01fde58
ds: 0018 es: 0018 ss: 0018
Stack: c02c192c c02c17d4 c0199d0e c02c192c c02c17d0 c01c6b1c c02c192c c02c17d0
c01c072b c02c17d0 c025c77c 00000000 00000001 bffffd54 c011910e c025c77c
00000001 00000000 d01fc000 080498c0 fee1dead c01193ee c02a1b48 00000001
Call Trace: [<c0199d0e>] [<c01c6b1c>] [<c01c072b>] [<c011910e>] [<c01193ee>]
[<c01dbaa3>] [<c01d7ab5>] [<c01ffaac>] [<c01ffdb9>] [<c01d0e57>] [<c013c264>]
[<c013ccfc>] [<c013b016>] [<c012c654>] [<c012b6f5>] [<c012b745>] [<c01069f7>]
Code: 89 4a 04 89 11 89 43 18 89 40 04 83 7e 38 00 74 09 53 8b 46


>>EIP; c0199a8b <device_detach+23/4c> <=====

>>eax; c02c1944 <ide_hwifs+2a4/3d90>
>>ebx; c02c192c <ide_hwifs+28c/3d90>
>>esi; c025cc60 <idedisk_devdrv+0/60>
>>esp; d01fde58 <END_OF_CODE+ff35f3c/????>

Trace; c0199d0e <put_device+4a/7c>
Trace; c01c6b1c <idedisk_cleanup+1c/60>
Trace; c01c072b <ata_sys_notify+9f/d4>
Trace; c011910e <notifier_call_chain+1e/38>
Trace; c01193ee <sys_reboot+c2/1d0>
Trace; c01dbaa3 <rtmsg_ifinfo+6f/74>
Trace; c01d7ab5 <dev_change_flags+f1/fc>
Trace; c01ffaac <devinet_ioctl+348/6b4>
Trace; c01ffdb9 <devinet_ioctl+655/6b4>
Trace; c01d0e57 <sock_destroy_inode+13/18>
Trace; c013c264 <destroy_inode+2c/4c>
Trace; c013ccfc <generic_forget_inode+c4/cc>
Trace; c013b016 <dput+126/144>
Trace; c012c654 <fput+bc/e0>
Trace; c012b6f5 <filp_close+59/64>
Trace; c012b745 <sys_close+45/58>
Trace; c01069f7 <syscall_call+7/b>

Code; c0199a8b <device_detach+23/4c>
00000000 <_EIP>:
Code; c0199a8b <device_detach+23/4c> <=====
0: 89 4a 04 mov %ecx,0x4(%edx) <=====
Code; c0199a8e <device_detach+26/4c>
3: 89 11 mov %edx,(%ecx)
Code; c0199a90 <device_detach+28/4c>
5: 89 43 18 mov %eax,0x18(%ebx)
Code; c0199a93 <device_detach+2b/4c>
8: 89 40 04 mov %eax,0x4(%eax)
Code; c0199a96 <device_detach+2e/4c>
b: 83 7e 38 00 cmpl $0x0,0x38(%esi)
Code; c0199a9a <device_detach+32/4c>
f: 74 09 je 1a <_EIP+0x1a> c0199aa5 <device_detach+3d/4c>
Code; c0199a9c <device_detach+34/4c>
11: 53 push %ebx
Code; c0199a9d <device_detach+35/4c>
12: 8b 46 00 mov 0x0(%esi),%eax


--
Randy Hron