bogus __KERNEL_SYSCALLS__ usage
Subsystems (12)
PATCH 1/1 bogus __KERNEL_SYSCALLS__ usage
I just did a mini-audit of users of __KERNEL_SYSCALLS and turned up a bunch of uglies. The patch below is the easy ones
(nothing to fix, they were defining it and including unistd.h for no reason). The remainders will need more work.
arch/ppc/platforms/chrp_smp.c:#define __KERNEL_SYSCALLS__ arch/ppc/platforms/pmac_smp.c:#define __KERNEL_SYSCALLS__ arch/ppc/kernel/smp.c:#define __KERNEL_SYSCALLS__ arch/ppc/kernel/ppc_ksyms.c:#define __KERNEL_SYSCALLS__ arch/cris/kernel/process.c:#define __KERNEL_SYSCALLS__ arch/ia64/kernel/smp.c:#define __KERNEL_SYSCALLS__ arch/ia64/kernel/smpboot.c:#define __KERNEL_SYSCALLS__ arch/ia64/kernel/process.c:#define __KERNEL_SYSCALLS__ /* see <asm/unistd.h> */ arch/alpha/kernel/smp.c:#define __KERNEL_SYSCALLS__ arch/alpha/kernel/alpha_ksyms.c:#define __KERNEL_SYSCALLS__ arch/ppc64/kernel/pmac_smp.c:#define __KERNEL_SYSCALLS__ arch/sparc/kernel/smp.c:#define __KERNEL_SYSCALLS__ arch/sparc/kernel/sun4m_smp.c:#define __KERNEL_SYSCALLS__ arch/sparc/kernel/process.c:#define __KERNEL_SYSCALLS__ arch/sparc/kernel/sun4d_smp.c:#define __KERNEL_SYSCALLS__ arch/sparc64/kernel/smp.c:#define __KERNEL_SYSCALLS__ arch/sparc64/kernel/process.c:#define __KERNEL_SYSCALLS__ arch/sparc64/kernel/power.c:#define __KERNEL_SYSCALLS__ arch/parisc/kernel/smp.c:#define __KERNEL_SYSCALLS__ arch/parisc/kernel/process.c:#define __KERNEL_SYSCALLS__ arch/x86_64/kernel/process.c:#define __KERNEL_SYSCALLS__
These can probably all go, but I don't have all the archs/toolchains to testbuild them.
drivers/sbus/char/bbc_envctrl.c:#define __KERNEL_SYSCALLS__ drivers/sbus/char/envctrl.c:#define __KERNEL_SYSCALLS__
Ditto. Probably a hangover from when kernel_thread was in unistd.h on some archs.
drivers/scsi/cpqfcTSinit.c:#define __KERNEL_SYSCALLS__
Can probably go. wrapped in an ifdef __alpha__. Probably the same reason as previous. Alpha folks?
drivers/scsi/oktagon_esp.c:#define __KERNEL_SYSCALLS__
m68k
drivers/media/dvb/frontends/tda1004x.c:#define __KERNEL_SYSCALLS__ drivers/media/dvb/frontends/sp887x.c:#define __KERNEL_SYSCALLS__ drivers/media/dvb/frontends/alps_tdlb7.c:#define __KERNEL_SYSCALLS__
Joy joy. Implementing their own firmware loaders by directly reading files into kernel space. Icky.
drivers/macintosh/mediabay.c:#define __KERNEL_SYSCALLS__
ppc. can probably go.
init/do_mounts.h:#define __KERNEL_SYSCALLS__ init/do_mounts.h~:#define __KERNEL_SYSCALLS__ init/main.c:#define __KERNEL_SYSCALLS__ init/initramfs.c:#define __KERNEL_SYSCALLS__ kernel/kmod.c:#define __KERNEL_SYSCALLS__
various magick. I'll leave these alone.
net/ipv4/ipvs/ip_vs_sync.c:#define __KERNEL_SYSCALLS__ /* for waitpid */
Icky. I've already pinging maintainers about this, as this one is totally broken on amd64 (whose waitpid calls sys_wait4 -- oops).
sound/isa/wavefront/wavefront_synth.c:#define __KERNEL_SYSCALLS__ sound/oss/wavfront.c:#define __KERNEL_SYSCALLS__
Firmware loaders again.
Patch below fixes up the 'easy' cases. In case I've broken something on non-x86 arch, this should probably go for a spin in -mm before mainline.
Dave
drivers/md/md.c renamed from drivers/md/md.c~ +0 -3
@@ -45,9 +45,6 @@#include <linux/kmod.h> #endif -#define __KERNEL_SYSCALLS__ -#include <linux/unistd.h> -#include <asm/unaligned.h> #define MAJOR_NR MD_MAJOR
drivers/net/hamradio/baycom_epp.c renamed from drivers/net/hamradio/baycom_epp.c~ +0 -3
@@ -59,9 +59,6 @@#include <net/ax25.h> #endif /* CONFIG_AX25 || CONFIG_AX25_MODULE */ -#define __KERNEL_SYSCALLS__ -#include <linux/unistd.h> -/* --------------------------------------------------------------------- */ #define BAYCOM_DEBUG
drivers/char/h8.c renamed from drivers/char/h8.c~ +0 -3
@@ -30,9 +30,6 @@#include <linux/init.h> #include <linux/slab.h> -#define __KERNEL_SYSCALLS__ -#include <asm/unistd.h> -#include "h8.h" #define DEBUG_H8
drivers/scsi/qla2xxx/qla_os.h renamed from drivers/scsi/qla2xxx/qla_os.h~ +0 -2
@@ -41,8 +41,6 @@#include <linux/slab.h> #include <linux/mempool.h> #include <linux/vmalloc.h> -#define __KERNEL_SYSCALLS__ -#include <linux/unistd.h> #include <linux/smp_lock.h> #include <linux/bio.h> #include <linux/moduleparam.h>
drivers/scsi/cpqfcTSworker.c renamed from drivers/scsi/cpqfcTSworker.c~ +0 -4
@@ -32,12 +32,8 @@#include <linux/smp_lock.h> #include <linux/pci.h> -#define __KERNEL_SYSCALLS__ -#define SHUTDOWN_SIGS (sigmask(SIGKILL)|sigmask(SIGINT)|sigmask(SIGTERM)) -#include <linux/unistd.h> -#include <asm/system.h> #include <asm/irq.h> #include <asm/dma.h>
net/core/netfilter.c renamed from net/core/netfilter.c~ +0 -3
@@ -27,9 +27,6 @@#include <net/route.h> #include <linux/ip.h> -#define __KERNEL_SYSCALLS__ -#include <linux/unistd.h> -/* In this code, we can be waiting indefinitely for userspace to * service a packet if a hook returns NF_QUEUE. We could keep a count * of skbuffs queued for userspace, and not deregister a hook unless
net/sunrpc/svc.c renamed from net/sunrpc/svc.c~ +0 -2
@@ -6,13 +6,11 @@* Copyright (C) 1995, 1996 Olaf Kirch <[email protected]> */ -#define __KERNEL_SYSCALLS__#include <linux/linkage.h> #include <linux/sched.h> #include <linux/errno.h> #include <linux/net.h> #include <linux/in.h> -#include <linux/unistd.h> #include <linux/mm.h> #include <linux/sunrpc/types.h>
net/sunrpc/sched.c renamed from net/sunrpc/sched.c~ +0 -2
@@ -11,12 +11,10 @@#include <linux/module.h> -#define __KERNEL_SYSCALLS__#include <linux/sched.h> #include <linux/interrupt.h> #include <linux/slab.h> #include <linux/mempool.h> -#include <linux/unistd.h> #include <linux/smp.h> #include <linux/smp_lock.h> #include <linux/spinlock.h>
net/sunrpc/xprt.c renamed from net/sunrpc/xprt.c~ +0 -3
@@ -43,8 +43,6 @@* (C) 1999 Trond Myklebust <[email protected]> */ -#define __KERNEL_SYSCALLS__ -#include <linux/types.h> #include <linux/slab.h> #include <linux/capability.h>
@@ -56,7 +54,6 @@#include <linux/mm.h> #include <linux/udp.h> #include <linux/tcp.h> -#include <linux/unistd.h> #include <linux/sunrpc/clnt.h> #include <linux/file.h> #include <linux/workqueue.h>
net/bluetooth/bnep/core.c renamed from net/bluetooth/bnep/core.c~ +0 -2
@@ -29,8 +29,6 @@* $Id: core.c,v 1.20 2002/08/04 21:23:58 maxk Exp $ */ -#define __KERNEL_SYSCALLS__ -#include <linux/config.h> #include <linux/module.h>
net/bluetooth/rfcomm/core.c renamed from net/bluetooth/rfcomm/core.c~ +0 -2
@@ -31,8 +31,6 @@* $Id: core.c,v 1.42 2002/10/01 23:26:25 maxk Exp $ */ -#define __KERNEL_SYSCALLS__ -#include <linux/config.h> #include <linux/module.h> #include <linux/errno.h>
arch/i386/kernel/process.c renamed from arch/i386/kernel/process.c~ +0 -2
@@ -11,7 +11,6 @@* This file handles the architecture-dependent parts of process handling.. */ -#define __KERNEL_SYSCALLS__#include <stdarg.h> #include <linux/errno.h>
@@ -23,7 +22,6 @@#include <linux/smp.h> #include <linux/smp_lock.h> #include <linux/stddef.h> -#include <linux/unistd.h> #include <linux/slab.h> #include <linux/vmalloc.h> #include <linux/user.h>
fs/jffs/inode-v23.c renamed from fs/jffs/inode-v23.c~ +0 -7
@@ -26,14 +26,7 @@* maybe other stuff do to. */ -/* Argh. Some architectures have kernel_thread in asm/processor.h -Some have it in unistd.h and you need to define __KERNEL_SYSCALLS__ -Pass me a baseball bat and the person responsible. -dwmw2 -*/ -#define __KERNEL_SYSCALLS__#include <linux/time.h> -#include <linux/unistd.h> #include <linux/module.h> #include <linux/init.h>
fs/jffs2/background.c renamed from fs/jffs2/background.c~ +0 -4
@@ -11,14 +11,10 @@* */ -#define __KERNEL_SYSCALLS__ -#include <linux/kernel.h> #include <linux/jffs2.h> #include <linux/mtd/mtd.h> #include <linux/completion.h> -#include <linux/sched.h> -#include <linux/unistd.h> #include <linux/suspend.h> #include "nodelist.h"
fs/lockd/svc.c renamed from fs/lockd/svc.c~ +0 -2
@@ -12,7 +12,6 @@* Copyright (C) 1995, 1996 Olaf Kirch <[email protected]> */ -#define __KERNEL_SYSCALLS__#include <linux/config.h> #include <linux/module.h> #include <linux/init.h>
@@ -23,7 +22,6 @@#include <linux/errno.h> #include <linux/in.h> #include <linux/uio.h> -#include <linux/unistd.h> #include <linux/slab.h> #include <linux/smp.h> #include <linux/smp_lock.h>
fs/lockd/clntlock.c renamed from fs/lockd/clntlock.c~ +0 -3
@@ -6,13 +6,10 @@* Copyright (C) 1996, Olaf Kirch <[email protected]> */ -#define __KERNEL_SYSCALLS__ -#include <linux/module.h> #include <linux/types.h> #include <linux/time.h> #include <linux/nfs_fs.h> -#include <linux/unistd.h> #include <linux/sunrpc/clnt.h> #include <linux/sunrpc/svc.h> #include <linux/lockd/lockd.h>
kernel/signal.c renamed from kernel/signal.c~ +0 -3
@@ -10,12 +10,9 @@* to allow signals to be sent reliably. */ -#define __KERNEL_SYSCALLS__ -#include <linux/config.h> #include <linux/slab.h> #include <linux/module.h> -#include <linux/unistd.h> #include <linux/smp_lock.h> #include <linux/init.h> #include <linux/sched.h>
drivers/media/dvb/dvb-core/dvb_ringbuffer.c renamed from drivers/media/dvb/dvb-core/dvb_ringbuffer.c~ +0 -2
@@ -24,8 +24,6 @@*/ - -#define __KERNEL_SYSCALLS__#include <linux/errno.h> #include <linux/kernel.h> #include <linux/module.h>
Quoted 4 lines · Dave Jones
I just did a mini-audit of users of
__KERNEL_SYSCALLSand turned up a bunch of uglies. The patch below is the easy ones
(nothing to fix, they were defining it and includingunistd.hfor no reason). The remainders will need more work.
...
Quoted 6 lines
drivers/media/dvb/frontends/tda1004x.c:#define
__KERNEL_SYSCALLS__drivers/media/dvb/frontends/sp887x.c:#define__KERNEL_SYSCALLS__drivers/media/dvb/frontends/alps_tdlb7.c:#define__KERNEL_SYSCALLS__Joy joy. Implementing their own firmware loaders by directly reading files into kernel space. Icky.
Old code, implemented before request_firmware() existed.
The problem is that the current dvb_i2c stuff has no direct access to a sysfs struct device, which is necessary for request_firmware(). Possible solutions have briefly been discussed on the linux-dvb list, one of them ditching dvb_i2c in favor of the kernel i2c subsystem.
So please be patient, work is under way. See alsoDocumentation/dvb/firmware.txt.
Johannes
Quoted 3 lines · Dave Jones
I just did a mini-audit of users of
__KERNEL_SYSCALLSand turned up a bunch of uglies. The patch below is the easy ones
OK. But Randy is currently beavering away at the astonishing number of open-coded sys_foo() declarations, and that work has a significant intersection with yours.
So can we please park this for now, pick it up again when Randy has finished?
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line · Dave Jones
Dave> arch/ia64/kernel/smp.c
Dave> arch/ia64/kernel/smpboot.c
Looks like these don't need __KERNEL_SYSCALLS__ anymore.
Dave> arch/ia64/kernel/process.c
This one still needs it, because it calls clone() and _exit().
I'll fix the former two in my tree.
Thanks,
--david
Quoted 9 lines · Andrew Morton
Quoted 2 lines
I just did a mini-audit of users of
__KERNEL_SYSCALLSand turned up a bunch of uglies. The patch below is the easy onesOK. But Randy is currently beavering away at the astonishing number of open-coded
sys_foo()declarations, and that work has a significant intersection with yours.So can we please park this for now, pick it up again when Randy has finished?
Yeah, that's fine with me, as is Randy hoovering this up and rolling it in with his stuff if he wants..
Dave