summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--arch/i386/kernel/signal.c11
-rw-r--r--crypto/deflate.c77
-rw-r--r--crypto/twofish.c3
-rw-r--r--drivers/acpi/toshiba_acpi.c10
-rw-r--r--drivers/atm/ambassador.c4
-rw-r--r--drivers/atm/firestream.c2
-rw-r--r--drivers/atm/he.c2
-rw-r--r--drivers/atm/horizon.c14
-rw-r--r--drivers/atm/idt77252.c2
-rw-r--r--drivers/atm/iphase.c2
-rw-r--r--drivers/atm/lanai.c2
-rw-r--r--drivers/block/cryptoloop.c8
-rw-r--r--drivers/block/paride/paride.c2
-rw-r--r--drivers/block/paride/pcd.c2
-rw-r--r--drivers/block/paride/pf.c4
-rw-r--r--drivers/block/xd.c22
-rw-r--r--drivers/bluetooth/bfusb.c2
-rw-r--r--drivers/char/h8.c1180
-rw-r--r--drivers/char/h8.h246
-rw-r--r--drivers/char/mwave/mwavedd.c8
-rw-r--r--drivers/char/mwave/tp3780i.c8
-rw-r--r--drivers/char/pcmcia/synclink_cs.c8
-rw-r--r--drivers/char/rocket.c8
-rw-r--r--drivers/char/rtc.c2
-rw-r--r--drivers/ide/legacy/ide-cs.c2
-rw-r--r--drivers/ide/pci/siimage.c2
-rw-r--r--drivers/input/joystick/grip.c4
-rw-r--r--drivers/input/joystick/grip_mp.c4
-rw-r--r--drivers/isdn/act2000/act2000.h4
-rw-r--r--drivers/isdn/act2000/act2000_isa.c8
-rw-r--r--drivers/isdn/act2000/act2000_isa.h2
-rw-r--r--drivers/isdn/act2000/module.c23
-rw-r--r--drivers/isdn/capi/capi.c42
-rw-r--r--drivers/isdn/capi/capidrv.c229
-rw-r--r--drivers/isdn/capi/capilib.c8
-rw-r--r--drivers/isdn/capi/capiutil.c262
-rw-r--r--drivers/isdn/capi/kcapi.c37
-rw-r--r--drivers/isdn/capi/kcapi_proc.c6
-rw-r--r--drivers/isdn/hardware/eicon/capifunc.c4
-rw-r--r--drivers/isdn/hardware/eicon/capimain.c4
-rw-r--r--drivers/isdn/hardware/eicon/dadapter.c4
-rw-r--r--drivers/isdn/hardware/eicon/debug.c92
-rw-r--r--drivers/isdn/hardware/eicon/di.c6
-rw-r--r--drivers/isdn/hardware/eicon/diddfunc.c2
-rw-r--r--drivers/isdn/hardware/eicon/diva.c34
-rw-r--r--drivers/isdn/hardware/eicon/diva.h10
-rw-r--r--drivers/isdn/hardware/eicon/diva_dma.c9
-rw-r--r--drivers/isdn/hardware/eicon/divamnt.c28
-rw-r--r--drivers/isdn/hardware/eicon/divasfunc.c2
-rw-r--r--drivers/isdn/hardware/eicon/divasi.c8
-rw-r--r--drivers/isdn/hardware/eicon/divasmain.c12
-rw-r--r--drivers/isdn/hardware/eicon/divasproc.c29
-rw-r--r--drivers/isdn/hardware/eicon/dqueue.c8
-rw-r--r--drivers/isdn/hardware/eicon/idifunc.c2
-rw-r--r--drivers/isdn/hardware/eicon/maintidi.c8
-rw-r--r--drivers/isdn/hardware/eicon/message.c90
-rw-r--r--drivers/isdn/hardware/eicon/mntfunc.c10
-rw-r--r--drivers/isdn/hardware/eicon/os_4bri.c26
-rw-r--r--drivers/isdn/hardware/eicon/os_bri.c12
-rw-r--r--drivers/isdn/hardware/eicon/os_pri.c10
-rw-r--r--drivers/isdn/hardware/eicon/um_idi.c30
-rw-r--r--drivers/isdn/hisax/config.c16
-rw-r--r--drivers/isdn/hisax/diva.c2
-rw-r--r--drivers/isdn/hisax/elsa_ser.c2
-rw-r--r--drivers/isdn/hisax/hfc_usb.c4
-rw-r--r--drivers/isdn/hisax/isar.c6
-rw-r--r--drivers/isdn/hisax/tei.c6
-rw-r--r--drivers/isdn/i4l/isdn_common.c8
-rw-r--r--drivers/isdn/i4l/isdn_net.c23
-rw-r--r--drivers/isdn/i4l/isdn_tty.c14
-rw-r--r--drivers/isdn/icn/icn.c45
-rw-r--r--drivers/isdn/isdnloop/isdnloop.c17
-rw-r--r--drivers/isdn/pcbit/drv.c69
-rw-r--r--drivers/isdn/pcbit/module.c6
-rw-r--r--drivers/isdn/sc/command.c4
-rw-r--r--drivers/isdn/sc/ioctl.c28
-rw-r--r--drivers/isdn/sc/scioc.h2
-rw-r--r--drivers/isdn/tpam/tpam.h4
-rw-r--r--drivers/isdn/tpam/tpam_commands.c8
-rw-r--r--drivers/isdn/tpam/tpam_memory.c4
-rw-r--r--drivers/md/kcopyd.c2
-rw-r--r--drivers/media/common/saa7146_vbi.c2
-rw-r--r--drivers/media/common/saa7146_video.c2
-rw-r--r--drivers/media/dvb/dvb-core/dmxdev.c10
-rw-r--r--drivers/media/dvb/dvb-core/dvb_ca_en50221.c6
-rw-r--r--drivers/media/dvb/dvb-core/dvb_functions.c6
-rw-r--r--drivers/media/dvb/dvb-core/dvb_ringbuffer.c21
-rw-r--r--drivers/media/dvb/dvb-core/dvb_ringbuffer.h7
-rw-r--r--drivers/media/dvb/ttpci/av7110_av.c61
-rw-r--r--drivers/media/dvb/ttpci/av7110_ca.c36
-rw-r--r--drivers/media/dvb/ttpci/av7110_hw.c25
-rw-r--r--drivers/media/dvb/ttpci/av7110_ir.c2
-rw-r--r--drivers/media/radio/miropcm20-radio.c2
-rw-r--r--drivers/media/radio/miropcm20-rds.c2
-rw-r--r--drivers/media/radio/radio-cadet.c2
-rw-r--r--drivers/media/video/bttv-cards.c2
-rw-r--r--drivers/media/video/bttv-driver.c6
-rw-r--r--drivers/media/video/bw-qcam.c6
-rw-r--r--drivers/media/video/c-qcam.c4
-rw-r--r--drivers/media/video/cpia.c10
-rw-r--r--drivers/media/video/cx88/cx88-video.c2
-rw-r--r--drivers/media/video/dpc7146.c2
-rw-r--r--drivers/media/video/hexium_orion.c2
-rw-r--r--drivers/media/video/meye.c4
-rw-r--r--drivers/media/video/mxb.c2
-rw-r--r--drivers/media/video/pms.c4
-rw-r--r--drivers/media/video/saa7134/saa7134-oss.c69
-rw-r--r--drivers/media/video/saa7134/saa7134-ts.c2
-rw-r--r--drivers/media/video/saa7134/saa7134-video.c2
-rw-r--r--drivers/media/video/stradis.c14
-rw-r--r--drivers/media/video/tea6415c.c2
-rw-r--r--drivers/media/video/tvmixer.c12
-rw-r--r--drivers/media/video/v4l1-compat.c2
-rw-r--r--drivers/media/video/video-buf.c6
-rw-r--r--drivers/media/video/videocodec.c4
-rw-r--r--drivers/media/video/videodev.c10
-rw-r--r--drivers/media/video/w9966.c22
-rw-r--r--drivers/media/video/zoran_driver.c20
-rw-r--r--drivers/media/video/zoran_procfs.c6
-rw-r--r--drivers/message/fusion/mptscsih.c2
-rw-r--r--drivers/message/i2o/i2o_config.c2
-rw-r--r--drivers/message/i2o/i2o_proc.c4
-rw-r--r--drivers/net/appletalk/ltpc.c4
-rw-r--r--drivers/net/irda/irtty-sir.c2
-rw-r--r--drivers/net/irda/vlsi_ir.c6
-rw-r--r--drivers/net/pcmcia/smc91c92_cs.c2
-rw-r--r--drivers/net/pcmcia/xirc2ps_cs.c2
-rw-r--r--drivers/net/tokenring/ibmtr.c2
-rw-r--r--drivers/net/wan/cosa.c10
-rw-r--r--drivers/scsi/aacraid/aachba.c8
-rw-r--r--drivers/scsi/aacraid/aacraid.h6
-rw-r--r--drivers/scsi/aacraid/commctrl.c48
-rw-r--r--drivers/scsi/aacraid/linit.c4
-rw-r--r--drivers/scsi/megaraid.c390
-rw-r--r--drivers/scsi/megaraid.h24
-rw-r--r--fs/cifs/cifs_uniupr.h2
-rw-r--r--fs/coda/inode.c2
-rw-r--r--fs/coda/psdev.c2
-rw-r--r--fs/coda/sysctl.c2
-rw-r--r--fs/ext2/acl.c2
-rw-r--r--fs/ext3/acl.c2
-rw-r--r--fs/hfsplus/inode.c2
-rw-r--r--fs/hpfs/buffer.c4
-rw-r--r--fs/isofs/compress.c2
-rw-r--r--fs/minix/inode.c4
-rw-r--r--fs/qnx4/inode.c6
-rw-r--r--fs/reiserfs/do_balan.c22
-rw-r--r--fs/reiserfs/file.c2
-rw-r--r--fs/reiserfs/fix_node.c12
-rw-r--r--fs/reiserfs/ibalance.c4
-rw-r--r--fs/reiserfs/inode.c16
-rw-r--r--fs/reiserfs/item_ops.c2
-rw-r--r--fs/reiserfs/lbalance.c14
-rw-r--r--fs/reiserfs/namei.c24
-rw-r--r--fs/reiserfs/prints.c14
-rw-r--r--fs/reiserfs/procfs.c4
-rw-r--r--fs/reiserfs/stree.c14
-rw-r--r--fs/reiserfs/super.c6
-rw-r--r--fs/reiserfs/tail_conversion.c2
-rw-r--r--fs/sysv/inode.c4
-rw-r--r--include/linux/capi.h2
-rw-r--r--include/linux/dvb/osd.h2
-rw-r--r--include/linux/dvb/video.h2
-rw-r--r--include/linux/isdnif.h12
-rw-r--r--include/linux/kernelcapi.h2
-rw-r--r--include/linux/pkt_sched.h30
-rw-r--r--include/linux/reiserfs_fs.h2
-rw-r--r--include/linux/videodev.h2
-rw-r--r--include/linux/videodev2.h4
-rw-r--r--include/linux/videotext.h2
-rw-r--r--include/linux/xfrm.h9
-rw-r--r--include/media/saa7146_vv.h2
-rw-r--r--include/media/video-buf.h4
-rw-r--r--include/net/bluetooth/l2cap.h8
-rw-r--r--include/net/dst.h4
-rw-r--r--include/net/pkt_act.h2
-rw-r--r--include/net/sock.h29
-rw-r--r--include/net/tcp.h6
-rw-r--r--include/net/xfrm.h1
-rw-r--r--net/bluetooth/l2cap.c58
-rw-r--r--net/bridge/br_device.c10
-rw-r--r--net/bridge/br_forward.c1
-rw-r--r--net/bridge/br_if.c20
-rw-r--r--net/bridge/br_notify.c4
-rw-r--r--net/bridge/br_private.h1
-rw-r--r--net/core/sock.c23
-rw-r--r--net/ipv4/Kconfig3
-rw-r--r--net/ipv4/Makefile3
-rw-r--r--net/ipv4/ah4.c76
-rw-r--r--net/ipv4/esp4.c79
-rw-r--r--net/ipv4/ip_output.c6
-rw-r--r--net/ipv4/ipcomp.c76
-rw-r--r--net/ipv4/ipmr.c10
-rw-r--r--net/ipv4/netfilter/ipt_LOG.c4
-rw-r--r--net/ipv4/netfilter/ipt_ULOG.c4
-rw-r--r--net/ipv4/route.c2
-rw-r--r--net/ipv4/tcp_output.c33
-rw-r--r--net/ipv4/xfrm4_output.c120
-rw-r--r--net/ipv4/xfrm4_policy.c2
-rw-r--r--net/ipv4/xfrm4_tunnel.c49
-rw-r--r--net/ipv6/ipcomp6.c18
-rw-r--r--net/irda/discovery.c2
-rw-r--r--net/irda/ircomm/ircomm_core.c2
-rw-r--r--net/irda/iriap.c2
-rw-r--r--net/sched/Kconfig15
-rw-r--r--net/sched/Makefile1
-rw-r--r--net/sched/sch_csz.c1055
-rw-r--r--net/sched/sch_netem.c750
-rw-r--r--net/sctp/inqueue.c2
-rw-r--r--net/sctp/output.c6
-rw-r--r--net/sctp/outqueue.c12
-rw-r--r--net/sctp/protocol.c2
-rw-r--r--net/sctp/sm_statefuns.c2
-rw-r--r--net/sctp/socket.c123
-rw-r--r--net/sctp/ulpevent.c77
-rw-r--r--net/sctp/ulpqueue.c24
-rw-r--r--net/xfrm/xfrm_user.c20
217 files changed, 2461 insertions, 4418 deletions
diff --git a/arch/i386/kernel/signal.c b/arch/i386/kernel/signal.c
index f7708df372d6..37d7f8b82583 100644
--- a/arch/i386/kernel/signal.c
+++ b/arch/i386/kernel/signal.c
@@ -116,11 +116,14 @@ sys_sigaction(int sig, const struct old_sigaction __user *act,
}
asmlinkage int
-sys_sigaltstack(struct pt_regs regs)
+sys_sigaltstack(unsigned long ebx)
{
- const stack_t __user *uss = (const stack_t __user *)regs.ebx;
- stack_t __user *uoss = (stack_t __user *)regs.ecx;
- return do_sigaltstack(uss, uoss, regs.esp);
+ /* This is needed to make gcc realize it doesn't own the "struct pt_regs" */
+ struct pt_regs *regs = (struct pt_regs *)&ebx;
+ const stack_t __user *uss = (const stack_t __user *)ebx;
+ stack_t __user *uoss = (stack_t __user *)regs->ecx;
+
+ return do_sigaltstack(uss, uoss, regs->esp);
}
diff --git a/crypto/deflate.c b/crypto/deflate.c
index e2726b652a9d..77d7655d316a 100644
--- a/crypto/deflate.c
+++ b/crypto/deflate.c
@@ -39,44 +39,16 @@
#define DEFLATE_DEF_MEMLEVEL MAX_MEM_LEVEL
struct deflate_ctx {
- int comp_initialized;
- int decomp_initialized;
struct z_stream_s comp_stream;
struct z_stream_s decomp_stream;
};
-static inline int deflate_gfp(void)
-{
- return in_softirq() ? GFP_ATOMIC : GFP_KERNEL;
-}
-
-static int deflate_init(void *ctx)
-{
- return 0;
-}
-
-static void deflate_exit(void *ctx)
-{
- struct deflate_ctx *dctx = ctx;
-
- if (dctx->comp_initialized)
- vfree(dctx->comp_stream.workspace);
- if (dctx->decomp_initialized)
- kfree(dctx->decomp_stream.workspace);
-}
-
-/*
- * Lazy initialization to make interface simple without allocating
- * un-needed workspaces. Thus can be called in softirq context.
- */
static int deflate_comp_init(struct deflate_ctx *ctx)
{
int ret = 0;
struct z_stream_s *stream = &ctx->comp_stream;
- stream->workspace = __vmalloc(zlib_deflate_workspacesize(),
- deflate_gfp()|__GFP_HIGHMEM,
- PAGE_KERNEL);
+ stream->workspace = vmalloc(zlib_deflate_workspacesize());
if (!stream->workspace ) {
ret = -ENOMEM;
goto out;
@@ -89,7 +61,6 @@ static int deflate_comp_init(struct deflate_ctx *ctx)
ret = -EINVAL;
goto out_free;
}
- ctx->comp_initialized = 1;
out:
return ret;
out_free:
@@ -102,8 +73,7 @@ static int deflate_decomp_init(struct deflate_ctx *ctx)
int ret = 0;
struct z_stream_s *stream = &ctx->decomp_stream;
- stream->workspace = kmalloc(zlib_inflate_workspacesize(),
- deflate_gfp());
+ stream->workspace = kmalloc(zlib_inflate_workspacesize(), GFP_KERNEL);
if (!stream->workspace ) {
ret = -ENOMEM;
goto out;
@@ -114,7 +84,6 @@ static int deflate_decomp_init(struct deflate_ctx *ctx)
ret = -EINVAL;
goto out_free;
}
- ctx->decomp_initialized = 1;
out:
return ret;
out_free:
@@ -122,6 +91,36 @@ out_free:
goto out;
}
+static void deflate_comp_exit(struct deflate_ctx *ctx)
+{
+ vfree(ctx->comp_stream.workspace);
+}
+
+static void deflate_decomp_exit(struct deflate_ctx *ctx)
+{
+ kfree(ctx->decomp_stream.workspace);
+}
+
+static int deflate_init(void *ctx)
+{
+ int ret;
+
+ ret = deflate_comp_init(ctx);
+ if (ret)
+ goto out;
+ ret = deflate_decomp_init(ctx);
+ if (ret)
+ deflate_comp_exit(ctx);
+out:
+ return ret;
+}
+
+static void deflate_exit(void *ctx)
+{
+ deflate_comp_exit(ctx);
+ deflate_decomp_exit(ctx);
+}
+
static int deflate_compress(void *ctx, const u8 *src, unsigned int slen,
u8 *dst, unsigned int *dlen)
{
@@ -129,12 +128,6 @@ static int deflate_compress(void *ctx, const u8 *src, unsigned int slen,
struct deflate_ctx *dctx = ctx;
struct z_stream_s *stream = &dctx->comp_stream;
- if (!dctx->comp_initialized) {
- ret = deflate_comp_init(dctx);
- if (ret)
- goto out;
- }
-
ret = zlib_deflateReset(stream);
if (ret != Z_OK) {
ret = -EINVAL;
@@ -165,12 +158,6 @@ static int deflate_decompress(void *ctx, const u8 *src, unsigned int slen,
struct deflate_ctx *dctx = ctx;
struct z_stream_s *stream = &dctx->decomp_stream;
- if (!dctx->decomp_initialized) {
- ret = deflate_decomp_init(dctx);
- if (ret)
- goto out;
- }
-
ret = zlib_inflateReset(stream);
if (ret != Z_OK) {
ret = -EINVAL;
diff --git a/crypto/twofish.c b/crypto/twofish.c
index 9feced721b76..5d6d02c1a95d 100644
--- a/crypto/twofish.c
+++ b/crypto/twofish.c
@@ -663,7 +663,10 @@ static int twofish_setkey(void *cx, const u8 *key,
/* Check key length. */
if (key_len != 16 && key_len != 24 && key_len != 32)
+ {
+ *flags |= CRYPTO_TFM_RES_BAD_KEY_LEN;
return -EINVAL; /* unsupported key length */
+ }
/* Compute the first two words of the S vector. The magic numbers are
* the entries of the RS matrix, preprocessed through poly_to_exp. The
diff --git a/drivers/acpi/toshiba_acpi.c b/drivers/acpi/toshiba_acpi.c
index 508bcb4955da..a073256386e9 100644
--- a/drivers/acpi/toshiba_acpi.c
+++ b/drivers/acpi/toshiba_acpi.c
@@ -115,7 +115,7 @@ is_valid_acpi_path(const char* methodName)
acpi_handle handle;
acpi_status status;
- status = acpi_get_handle(0, (char*)methodName, &handle);
+ status = acpi_get_handle(NULL, (char*)methodName, &handle);
return !ACPI_FAILURE(status);
}
@@ -131,7 +131,7 @@ write_acpi_int(const char* methodName, int val)
in_objs[0].type = ACPI_TYPE_INTEGER;
in_objs[0].integer.value = val;
- status = acpi_evaluate_object(0, (char*)methodName, &params, 0);
+ status = acpi_evaluate_object(NULL, (char*)methodName, &params, NULL);
return (status == AE_OK);
}
@@ -178,7 +178,7 @@ hci_raw(const u32 in[HCI_WORDS], u32 out[HCI_WORDS])
results.length = sizeof(out_objs);
results.pointer = out_objs;
- status = acpi_evaluate_object(0, (char*)method_hci, &params,
+ status = acpi_evaluate_object(NULL, (char*)method_hci, &params,
&results);
if ((status == AE_OK) && (out_objs->package.count <= HCI_WORDS)) {
for (i = 0; i < out_objs->package.count; ++i) {
@@ -487,8 +487,8 @@ ProcItem proc_items[] =
{ "video" , read_video , write_video },
{ "fan" , read_fan , write_fan },
{ "keys" , read_keys , write_keys },
- { "version" , read_version , 0 },
- { 0 , 0 , 0 },
+ { "version" , read_version , NULL },
+ { NULL }
};
static acpi_status __init
diff --git a/drivers/atm/ambassador.c b/drivers/atm/ambassador.c
index c26a12e56a4e..fe809480e299 100644
--- a/drivers/atm/ambassador.c
+++ b/drivers/atm/ambassador.c
@@ -1126,7 +1126,7 @@ static int amb_open (struct atm_vcc * atm_vcc)
} else {
r = round_up;
}
- error = make_rate (pcr, r, &tx_rate_bits, 0);
+ error = make_rate (pcr, r, &tx_rate_bits, NULL);
tx_vc_bits = TX_UBR_CAPPED;
tx_frame_bits = TX_FRAME_CAPPED;
}
@@ -1333,7 +1333,7 @@ static void amb_close (struct atm_vcc * atm_vcc) {
PRINTK (KERN_ERR, "%s vcc=%p rxer[vci]=%p",
"arghhh! we're going to die!",
vcc, dev->rxer[vci]);
- dev->rxer[vci] = 0;
+ dev->rxer[vci] = NULL;
while (command_do (dev, &cmd))
schedule();
diff --git a/drivers/atm/firestream.c b/drivers/atm/firestream.c
index 025c692fd1e0..08fe3008a516 100644
--- a/drivers/atm/firestream.c
+++ b/drivers/atm/firestream.c
@@ -1000,7 +1000,7 @@ static int fs_open(struct atm_vcc *atm_vcc)
} else {
r = ROUND_UP;
}
- error = make_rate (pcr, r, &tmc0, 0);
+ error = make_rate (pcr, r, &tmc0, NULL);
}
fs_dprintk (FS_DEBUG_OPEN, "pcr = %d.\n", pcr);
}
diff --git a/drivers/atm/he.c b/drivers/atm/he.c
index ad746d981c7c..71e5b5146004 100644
--- a/drivers/atm/he.c
+++ b/drivers/atm/he.c
@@ -360,7 +360,7 @@ he_init_one(struct pci_dev *pci_dev, const struct pci_device_id *pci_ent)
goto init_one_failure;
}
- atm_dev = atm_dev_register(DEV_LABEL, &he_ops, -1, 0);
+ atm_dev = atm_dev_register(DEV_LABEL, &he_ops, -1, NULL);
if (!atm_dev) {
err = -ENODEV;
goto init_one_failure;
diff --git a/drivers/atm/horizon.c b/drivers/atm/horizon.c
index a794610da3c7..9ae4121aef47 100644
--- a/drivers/atm/horizon.c
+++ b/drivers/atm/horizon.c
@@ -1184,7 +1184,7 @@ static void tx_schedule (hrz_dev * const dev, int irq) {
// tx_regions == 0
// that's all folks - end of frame
struct sk_buff * skb = dev->tx_skb;
- dev->tx_iovec = 0;
+ dev->tx_iovec = NULL;
// VC layer stats
atomic_inc(&ATM_SKB(skb)->vcc->stats->tx);
@@ -1761,7 +1761,7 @@ static int hrz_send (struct atm_vcc * atm_vcc, struct sk_buff * skb) {
if (tx_iovcnt) {
// scatter gather transfer
dev->tx_regions = tx_iovcnt;
- dev->tx_iovec = 0; /* @@@ needs rewritten */
+ dev->tx_iovec = NULL; /* @@@ needs rewritten */
dev->tx_bytes = 0;
PRINTD (DBG_TX|DBG_BUS, "TX start scatter-gather transfer (iovec %p, len %d)",
skb->data, tx_len);
@@ -1771,7 +1771,7 @@ static int hrz_send (struct atm_vcc * atm_vcc, struct sk_buff * skb) {
} else {
// simple transfer
dev->tx_regions = 0;
- dev->tx_iovec = 0;
+ dev->tx_iovec = NULL;
dev->tx_bytes = tx_len;
dev->tx_addr = skb->data;
PRINTD (DBG_TX|DBG_BUS, "TX start simple transfer (addr %p, len %d)",
@@ -2278,7 +2278,7 @@ static int hrz_open (struct atm_vcc *atm_vcc)
// we take "the PCR" as a rate-cap
// not reserved
vcc.tx_rate = 0;
- make_rate (dev, 1<<30, round_nearest, &vcc.tx_pcr_bits, 0);
+ make_rate (dev, 1<<30, round_nearest, &vcc.tx_pcr_bits, NULL);
vcc.tx_xbr_bits = ABR_RATE_TYPE;
break;
}
@@ -2583,7 +2583,7 @@ static void hrz_close (struct atm_vcc * atm_vcc) {
PRINTK (KERN_ERR, "%s atm_vcc=%p rxer[channel]=%p",
"arghhh! we're going to die!",
atm_vcc, dev->rxer[channel]);
- dev->rxer[channel] = 0;
+ dev->rxer[channel] = NULL;
}
// atomically release our rate reservation
@@ -2806,8 +2806,8 @@ static int __init hrz_probe (void) {
dev->tx_regions = 0;
dev->tx_bytes = 0;
- dev->tx_skb = 0;
- dev->tx_iovec = 0;
+ dev->tx_skb = NULL;
+ dev->tx_iovec = NULL;
dev->tx_cell_count = 0;
dev->rx_cell_count = 0;
diff --git a/drivers/atm/idt77252.c b/drivers/atm/idt77252.c
index b929f43d0f4b..b2bede540782 100644
--- a/drivers/atm/idt77252.c
+++ b/drivers/atm/idt77252.c
@@ -3729,7 +3729,7 @@ idt77252_init_one(struct pci_dev *pcidev, const struct pci_device_id *id)
return -EIO;
}
- dev = atm_dev_register("idt77252", &idt77252_ops, -1, 0);
+ dev = atm_dev_register("idt77252", &idt77252_ops, -1, NULL);
if (!dev) {
printk("%s: can't register atm device\n", card->name);
iounmap((void *) card->membase);
diff --git a/drivers/atm/iphase.c b/drivers/atm/iphase.c
index 3c964ecfb15d..0c8395cfb942 100644
--- a/drivers/atm/iphase.c
+++ b/drivers/atm/iphase.c
@@ -2667,7 +2667,7 @@ static void ia_close(struct atm_vcc *vcc)
}
// Drain the packets
rx_dle_intr(vcc->dev);
- iadev->rx_open[vcc->vci] = 0;
+ iadev->rx_open[vcc->vci] = NULL;
}
kfree(INPH_IA_VCC(vcc));
ia_vcc = NULL;
diff --git a/drivers/atm/lanai.c b/drivers/atm/lanai.c
index ac80b9efdbe5..53f6d29c5b08 100644
--- a/drivers/atm/lanai.c
+++ b/drivers/atm/lanai.c
@@ -2702,7 +2702,7 @@ static int __devinit lanai_init_one(struct pci_dev *pci,
return -ENOMEM;
}
- atmdev = atm_dev_register(DEV_LABEL, &ops, -1, 0);
+ atmdev = atm_dev_register(DEV_LABEL, &ops, -1, NULL);
if (atmdev == NULL) {
printk(KERN_ERR DEV_LABEL
": couldn't register atm device!\n");
diff --git a/drivers/block/cryptoloop.c b/drivers/block/cryptoloop.c
index 6dc9a09159b6..5be6f998d8c5 100644
--- a/drivers/block/cryptoloop.c
+++ b/drivers/block/cryptoloop.c
@@ -93,8 +93,8 @@ cryptoloop_transfer_ecb(struct loop_device *lo, int cmd,
int size, sector_t IV)
{
struct crypto_tfm *tfm = (struct crypto_tfm *) lo->key_data;
- struct scatterlist sg_out = { 0, };
- struct scatterlist sg_in = { 0, };
+ struct scatterlist sg_out = { NULL, };
+ struct scatterlist sg_in = { NULL, };
encdec_ecb_t encdecfunc;
struct page *in_page, *out_page;
@@ -147,8 +147,8 @@ cryptoloop_transfer_cbc(struct loop_device *lo, int cmd,
int size, sector_t IV)
{
struct crypto_tfm *tfm = (struct crypto_tfm *) lo->key_data;
- struct scatterlist sg_out = { 0, };
- struct scatterlist sg_in = { 0, };
+ struct scatterlist sg_out = { NULL, };
+ struct scatterlist sg_in = { NULL, };
encdec_cbc_t encdecfunc;
struct page *in_page, *out_page;
diff --git a/drivers/block/paride/paride.c b/drivers/block/paride/paride.c
index d95e4f8ec93a..9f9401c1a929 100644
--- a/drivers/block/paride/paride.c
+++ b/drivers/block/paride/paride.c
@@ -264,7 +264,7 @@ void pi_unregister(PIP * pr)
printk("paride: %s not registered\n", pr->name);
return;
}
- protocols[pr->index] = 0;
+ protocols[pr->index] = NULL;
}
EXPORT_SYMBOL(pi_unregister);
diff --git a/drivers/block/paride/pcd.c b/drivers/block/paride/pcd.c
index 4ab5efad0fe5..2f1901b606c2 100644
--- a/drivers/block/paride/pcd.c
+++ b/drivers/block/paride/pcd.c
@@ -752,7 +752,7 @@ static void do_pcd_request(request_queue_t * q)
pcd_count = pcd_req->current_nr_sectors;
pcd_buf = pcd_req->buffer;
pcd_busy = 1;
- ps_set_intr(do_pcd_read, 0, 0, nice);
+ ps_set_intr(do_pcd_read, NULL, 0, nice);
return;
} else
end_request(pcd_req, 0);
diff --git a/drivers/block/paride/pf.c b/drivers/block/paride/pf.c
index b4a696e73795..c4fab51d96e4 100644
--- a/drivers/block/paride/pf.c
+++ b/drivers/block/paride/pf.c
@@ -841,7 +841,7 @@ static inline void next_request(int success)
/* detach from the calling context - in case the spinlock is held */
static void do_pf_read(void)
{
- ps_set_intr(do_pf_read_start, 0, 0, nice);
+ ps_set_intr(do_pf_read_start, NULL, 0, nice);
}
static void do_pf_read_start(void)
@@ -887,7 +887,7 @@ static void do_pf_read_drq(void)
static void do_pf_write(void)
{
- ps_set_intr(do_pf_write_start, 0, 0, nice);
+ ps_set_intr(do_pf_write_start, NULL, 0, nice);
}
static void do_pf_write_start(void)
diff --git a/drivers/block/xd.c b/drivers/block/xd.c
index 1fd72e00500e..5ca834fcdeec 100644
--- a/drivers/block/xd.c
+++ b/drivers/block/xd.c
@@ -96,7 +96,7 @@ XD_INFO xd_info[XD_MAXDRIVES];
#include <asm/page.h>
#define xd_dma_mem_alloc(size) __get_dma_pages(GFP_KERNEL,get_order(size))
#define xd_dma_mem_free(addr, size) free_pages(addr, get_order(size))
-static char *xd_dma_buffer = 0;
+static char *xd_dma_buffer;
static XD_SIGNATURE xd_sigs[] __initdata = {
{ 0x0000,"Override geometry handler",NULL,xd_override_init_drive,"n unknown" }, /* Pat Mackinlay, pat@it.com.au */
@@ -344,7 +344,7 @@ static int xd_ioctl (struct inode *inode,struct file *file,u_int cmd,u_long arg)
if (nodma && xd_dma_buffer) {
xd_dma_mem_free((unsigned long)xd_dma_buffer,
xd_maxsectors * 0x200);
- xd_dma_buffer = 0;
+ xd_dma_buffer = NULL;
} else if (!nodma && !xd_dma_buffer) {
xd_dma_buffer = (char *)xd_dma_mem_alloc(xd_maxsectors * 0x200);
if (!xd_dma_buffer) {
@@ -448,7 +448,7 @@ static void xd_recalibrate (u_char drive)
u_char cmdblk[6];
xd_build(cmdblk,CMD_RECALIBRATE,drive,0,0,0,0,0);
- if (xd_command(cmdblk,PIO_MODE,0,0,0,XD_TIMEOUT * 8))
+ if (xd_command(cmdblk,PIO_MODE,NULL,NULL,NULL,XD_TIMEOUT * 8))
printk("xd%c: warning! error recalibrating, controller may be unstable\n", 'a'+drive);
}
@@ -607,7 +607,7 @@ static u_int xd_command (u_char *command,u_char mode,u_char *indata,u_char *outd
if (csb & CSB_ERROR) { /* read sense data if error */
xd_build(cmdblk,CMD_SENSE,(csb & CSB_LUN) >> 5,0,0,0,0,0);
- if (xd_command(cmdblk,0,sense,0,0,XD_TIMEOUT))
+ if (xd_command(cmdblk,0,sense,NULL,NULL,XD_TIMEOUT))
printk("xd: warning! sense command failed!\n");
}
@@ -624,7 +624,7 @@ static u_char __init xd_initdrives (void (*init_drive)(u_char drive))
for (i = 0; i < XD_MAXDRIVES; i++) {
xd_build(cmdblk,CMD_TESTREADY,i,0,0,0,0,0);
- if (!xd_command(cmdblk,PIO_MODE,0,0,0,XD_TIMEOUT * 8)) {
+ if (!xd_command(cmdblk,PIO_MODE,NULL,NULL,NULL,XD_TIMEOUT*8)) {
set_current_state(TASK_INTERRUPTIBLE);
schedule_timeout(XD_INIT_DISK_DELAY);
@@ -714,7 +714,7 @@ static void __init xd_dtc_init_drive (u_char drive)
u_char cmdblk[6],buf[64];
xd_build(cmdblk,CMD_DTCGETGEOM,drive,0,0,0,0,0);
- if (!xd_command(cmdblk,PIO_MODE,buf,0,0,XD_TIMEOUT * 2)) {
+ if (!xd_command(cmdblk,PIO_MODE,buf,NULL,NULL,XD_TIMEOUT * 2)) {
xd_info[drive].heads = buf[0x0A]; /* heads */
xd_info[drive].cylinders = ((u_short *) (buf))[0x04]; /* cylinders */
xd_info[drive].sectors = 17; /* sectors */
@@ -729,7 +729,7 @@ static void __init xd_dtc_init_drive (u_char drive)
xd_setparam(CMD_DTCSETPARAM,drive,xd_info[drive].heads,xd_info[drive].cylinders,((u_short *) (buf + 1))[0x05],((u_short *) (buf + 1))[0x06],buf[0x0F]);
xd_build(cmdblk,CMD_DTCSETSTEP,drive,0,0,0,0,7);
- if (xd_command(cmdblk,PIO_MODE,0,0,0,XD_TIMEOUT * 2))
+ if (xd_command(cmdblk,PIO_MODE,NULL,NULL,NULL,XD_TIMEOUT * 2))
printk("xd_dtc_init_drive: error setting step rate for xd%c\n", 'a'+drive);
}
else
@@ -785,7 +785,7 @@ static void __init xd_wd_init_drive (u_char drive)
xd_irq = 9;
rll = (jumper_state & 0x30) ? (0x04 << wd_1002) : 0;
xd_build(cmdblk,CMD_READ,drive,0,0,0,1,0);
- if (!xd_command(cmdblk,PIO_MODE,buf,0,0,XD_TIMEOUT * 2)) {
+ if (!xd_command(cmdblk,PIO_MODE,buf,NULL,NULL,XD_TIMEOUT * 2)) {
xd_info[drive].heads = buf[0x1AF]; /* heads */
xd_info[drive].cylinders = ((u_short *) (buf + 1))[0xD6]; /* cylinders */
xd_info[drive].sectors = 17; /* sectors */
@@ -862,7 +862,7 @@ static void __init xd_seagate_init_drive (u_char drive)
u_char cmdblk[6],buf[0x200];
xd_build(cmdblk,CMD_ST11GETGEOM,drive,0,0,0,1,0);
- if (!xd_command(cmdblk,PIO_MODE,buf,0,0,XD_TIMEOUT * 2)) {
+ if (!xd_command(cmdblk,PIO_MODE,buf,NULL,NULL,XD_TIMEOUT * 2)) {
xd_info[drive].heads = buf[0x04]; /* heads */
xd_info[drive].cylinders = (buf[0x02] << 8) | buf[0x03]; /* cylinders */
xd_info[drive].sectors = buf[0x05]; /* sectors */
@@ -987,7 +987,7 @@ static void __init xd_override_init_drive (u_char drive)
while (min[i] != max[i] - 1) {
test[i] = (min[i] + max[i]) / 2;
xd_build(cmdblk,CMD_SEEK,drive,(u_char) test[0],(u_short) test[1],(u_char) test[2],0,0);
- if (!xd_command(cmdblk,PIO_MODE,0,0,0,XD_TIMEOUT * 2))
+ if (!xd_command(cmdblk,PIO_MODE,NULL,NULL,NULL,XD_TIMEOUT * 2))
min[i] = test[i];
else
max[i] = test[i];
@@ -1039,7 +1039,7 @@ static void __init xd_setparam (u_char command,u_char drive,u_char heads,u_short
/* Some controllers require geometry info as data, not command */
- if (xd_command(cmdblk,PIO_MODE,0,&cmdblk[6],0,XD_TIMEOUT * 2))
+ if (xd_command(cmdblk,PIO_MODE,NULL,&cmdblk[6],NULL,XD_TIMEOUT * 2))
printk("xd: error setting characteristics for xd%c\n", 'a'+drive);
}
diff --git a/drivers/bluetooth/bfusb.c b/drivers/bluetooth/bfusb.c
index bffbc85c1f5c..79ff338e92e5 100644
--- a/drivers/bluetooth/bfusb.c
+++ b/drivers/bluetooth/bfusb.c
@@ -586,7 +586,6 @@ static int bfusb_load_firmware(struct bfusb *bfusb, unsigned char *firmware, int
}
bfusb->udev->toggle[0] = bfusb->udev->toggle[1] = 0;
- bfusb->udev->halted[0] = bfusb->udev->halted[1] = 0;
buf = kmalloc(BFUSB_MAX_BLOCK_SIZE + 3, GFP_ATOMIC);
if (!buf) {
@@ -628,7 +627,6 @@ static int bfusb_load_firmware(struct bfusb *bfusb, unsigned char *firmware, int
}
bfusb->udev->toggle[0] = bfusb->udev->toggle[1] = 0;
- bfusb->udev->halted[0] = bfusb->udev->halted[1] = 0;
BT_INFO("BlueFRITZ! USB device ready");
diff --git a/drivers/char/h8.c b/drivers/char/h8.c
deleted file mode 100644
index 19843a0d1538..000000000000
--- a/drivers/char/h8.c
+++ /dev/null
@@ -1,1180 +0,0 @@
-/*
- * Hitachi H8/337 Microcontroller driver
- *
- * The H8 is used to deal with the power and thermal environment
- * of a system.
- *
- * Fixes:
- * June 1999, AV added releasing /proc/driver/h8
- * Feb 2000, Borislav Deianov
- * changed queues to use list.h instead of lists.h
- */
-
-#include <linux/config.h>
-#include <linux/module.h>
-
-#include <asm/system.h>
-#include <asm/io.h>
-
-#include <linux/types.h>
-#include <linux/stddef.h>
-#include <linux/timer.h>
-#include <linux/fcntl.h>
-#include <linux/linkage.h>
-#include <linux/stat.h>
-#include <linux/proc_fs.h>
-#include <linux/miscdevice.h>
-#include <linux/list.h>
-#include <linux/ioport.h>
-#include <linux/poll.h>
-#include <linux/init.h>
-#include <linux/slab.h>
-
-#include "h8.h"
-
-#define DEBUG_H8
-
-#ifdef DEBUG_H8
-#define Dprintk printk
-#else
-#define Dprintk
-#endif
-
-#define XDprintk if(h8_debug==-1)printk
-
-/*
- * The h8 device is one of the misc char devices.
- */
-#define H8_MINOR_DEV 140
-
-/*
- * Forward declarations.
- */
-static int h8_init(void);
-static int h8_display_blank(void);
-static int h8_display_unblank(void);
-
-static void h8_intr(int irq, void *dev_id, struct pt_regs *regs);
-
-static int h8_get_info(char *, char **, off_t, int);
-
-/*
- * Support Routines.
- */
-static void h8_hw_init(void);
-static void h8_start_new_cmd(void);
-static void h8_send_next_cmd_byte(void);
-static void h8_read_event_status(void);
-static void h8_sync(void);
-static void h8_q_cmd(u_char *, int, int);
-static void h8_cmd_done(h8_cmd_q_t *qp);
-static int h8_alloc_queues(void);
-
-static u_long h8_get_cpu_speed(void);
-static int h8_get_curr_temp(u_char curr_temp[]);
-static void h8_get_max_temp(void);
-static void h8_get_upper_therm_thold(void);
-static void h8_set_upper_therm_thold(int);
-static int h8_get_ext_status(u_char stat_word[]);
-
-static int h8_monitor_thread(void *);
-
-static int h8_manage_therm(void);
-static void h8_set_cpu_speed(int speed_divisor);
-
-static void h8_start_monitor_timer(unsigned long secs);
-static void h8_activate_monitor(unsigned long unused);
-
-/* in arch/alpha/kernel/lca.c */
-extern void lca_clock_print(void);
-extern int lca_get_clock(void);
-extern void lca_clock_fiddle(int);
-
-static void h8_set_event_mask(int);
-static void h8_clear_event_mask(int);
-
-/*
- * Driver structures
- */
-
-static struct timer_list h8_monitor_timer;
-static int h8_monitor_timer_active = 0;
-
-static char driver_version[] = "X0.0";/* no spaces */
-
-static union intr_buf intrbuf;
-static int intr_buf_ptr;
-static union intr_buf xx;
-static u_char last_temp;
-
-/*
- * I/O Macros for register reads and writes.
- */
-#define H8_READ(a) inb((a))
-#define H8_WRITE(d,a) outb((d),(a))
-
-#define H8_GET_STATUS H8_READ((h8_base) + H8_STATUS_REG_OFF)
-#define H8_READ_DATA H8_READ((h8_base) + H8_DATA_REG_OFF)
-#define WRITE_DATA(d) H8_WRITE((d), h8_base + H8_DATA_REG_OFF)
-#define WRITE_CMD(d) H8_WRITE((d), h8_base + H8_CMD_REG_OFF)
-
-static unsigned int h8_base = H8_BASE_ADDR;
-static unsigned int h8_irq = H8_IRQ;
-static unsigned int h8_state = H8_IDLE;
-static unsigned int h8_index = -1;
-static unsigned int h8_enabled = 0;
-
-static LIST_HEAD(h8_actq);
-static LIST_HEAD(h8_cmdq);
-static LIST_HEAD(h8_freeq);
-
-/*
- * Globals used in thermal control of Alphabook1.
- */
-static int cpu_speed_divisor = -1;
-static int h8_event_mask = 0;
-static DECLARE_WAIT_QUEUE_HEAD(h8_monitor_wait);
-static unsigned int h8_command_mask = 0;
-static int h8_uthermal_threshold = DEFAULT_UTHERMAL_THRESHOLD;
-static int h8_uthermal_window = UTH_HYSTERESIS;
-static int h8_debug = 0xfffffdfc;
-static int h8_ldamp = MHZ_115;
-static int h8_udamp = MHZ_57;
-static u_char h8_current_temp = 0;
-static u_char h8_system_temp = 0;
-static int h8_sync_channel = 0;
-static DECLARE_WAIT_QUEUE_HEAD(h8_sync_wait);
-static int h8_init_performed;
-
-/* CPU speeds and clock divisor values */
-static int speed_tab[6] = {230, 153, 115, 57, 28, 14};
-
-/*
- * H8 interrupt handler
- */
-static void h8_intr(int irq, void *dev_id, struct pt_regs *regs)
-{
- u_char stat_reg, data_reg;
- h8_cmd_q_t *qp = list_entry(h8_actq.next, h8_cmd_q_t, link);
-
- stat_reg = H8_GET_STATUS;
- data_reg = H8_READ_DATA;
-
- XDprintk("h8_intr: state %d status 0x%x data 0x%x\n", h8_state, stat_reg, data_reg);
-
- switch (h8_state) {
- /* Response to an asynchronous event. */
- case H8_IDLE: { /* H8_IDLE */
- if (stat_reg & H8_OFULL) {
- if (data_reg == H8_INTR) {
- h8_state = H8_INTR_MODE;
- /* Executing a command to determine what happened. */
- WRITE_CMD(H8_RD_EVENT_STATUS);
- intr_buf_ptr = 1;
- WRITE_CMD(H8_RD_EVENT_STATUS);
- } else {
- Dprintk("h8_intr: idle stat 0x%x data 0x%x\n",
- stat_reg, data_reg);
- }
- } else {
- Dprintk("h8_intr: bogus interrupt\n");
- }
- break;
- }
- case H8_INTR_MODE: { /* H8_INTR_MODE */
- XDprintk("H8 intr/intr_mode\n");
- if (data_reg == H8_BYTE_LEVEL_ACK) {
- return;
- } else if (data_reg == H8_CMD_ACK) {
- return;
- } else {
- intrbuf.byte[intr_buf_ptr] = data_reg;
- if(!intr_buf_ptr) {
- h8_state = H8_IDLE;
- h8_read_event_status();
- }
- intr_buf_ptr--;
- }
- break;
- }
- /* Placed in this state by h8_start_new_cmd(). */
- case H8_XMIT: { /* H8_XMIT */
- XDprintk("H8 intr/xmit\n");
- /* If a byte level acknowledgement has been received */
- if (data_reg == H8_BYTE_LEVEL_ACK) {
- XDprintk("H8 intr/xmit BYTE ACK\n");
- qp->nacks++;
- if (qp->nacks > qp->ncmd)
- if(h8_debug & 0x1)
- Dprintk("h8intr: bogus # of acks!\n");
- /*
- * If the number of bytes sent is less than the total
- * number of bytes in the command.
- */
- if (qp->cnt < qp->ncmd) {
- h8_send_next_cmd_byte();
- }
- return;
- /* If the complete command has produced an acknowledgement. */
- } else if (data_reg == H8_CMD_ACK) {
- XDprintk("H8 intr/xmit CMD ACK\n");
- /* If there are response bytes */
- if (qp->nrsp)
- h8_state = H8_RCV;
- else
- h8_state = H8_IDLE;
- qp->cnt = 0;
- return;
- /* Error, need to start over with a clean slate. */
- } else if (data_reg == H8_NACK) {
- XDprintk("h8_intr: NACK received restarting command\n");
- qp->nacks = 0;
- qp->cnt = 0;
- h8_state = H8_IDLE;
- WRITE_CMD(H8_SYNC);
- return;
- } else {
- Dprintk ("h8intr: xmit unknown data 0x%x \n", data_reg);
- return;
- }
- break;
- }
- case H8_RESYNC: { /* H8_RESYNC */
- XDprintk("H8 intr/resync\n");
- if (data_reg == H8_BYTE_LEVEL_ACK) {
- return;
- } else if (data_reg == H8_SYNC_BYTE) {
- h8_state = H8_IDLE;
- if (!list_empty(&h8_actq))
- h8_send_next_cmd_byte();
- } else {
- Dprintk ("h8_intr: resync unknown data 0x%x \n", data_reg);
- return;
- }
- break;
- }
- case H8_RCV: { /* H8_RCV */
- XDprintk("H8 intr/rcv\n");
- if (qp->cnt < qp->nrsp) {
- qp->rcvbuf[qp->cnt] = data_reg;
- qp->cnt++;
- /* If command reception finished. */
- if (qp->cnt == qp->nrsp) {
- h8_state = H8_IDLE;
- list_del(&qp->link);
- h8_cmd_done (qp);
- /* More commands to send over? */
- if (!list_empty(&h8_cmdq))
- h8_start_new_cmd();
- }
- return;
- } else {
- Dprintk ("h8intr: rcv overflow cmd 0x%x\n", qp->cmdbuf[0]);
- }
- break;
- }
- default: /* default */
- Dprintk("H8 intr/unknown\n");
- break;
- }
- return;
-}
-
-static void __exit h8_cleanup (void)
-{
- remove_proc_entry("driver/h8", NULL);
- release_region(h8_base, 8);
- free_irq(h8_irq, NULL);
-}
-
-static int __init h8_init(void)
-{
- if(request_irq(h8_irq, h8_intr, SA_INTERRUPT, "h8", NULL))
- {
- printk(KERN_ERR "H8: error: IRQ %d is not free\n", h8_irq);
- return -EIO;
- }
- printk(KERN_INFO "H8 at 0x%x IRQ %d\n", h8_base, h8_irq);
-
- if (!request_region(h8_base, 8, "h8"))
- {
- free_irq(h8_irq, NULL);
- return -EIO;
- }
-
- create_proc_info_entry("driver/h8", 0, NULL, h8_get_info);
-
- h8_alloc_queues();
-
- h8_hw_init();
-
- kernel_thread(h8_monitor_thread, NULL, 0);
-
- return 0;
-}
-
-module_init(h8_init);
-module_exit(h8_cleanup);
-
-static void __init h8_hw_init(void)
-{
- u_char buf[H8_MAX_CMD_SIZE];
-
- /* set CPU speed to max for booting */
- h8_set_cpu_speed(MHZ_230);
-
- /*
- * Initialize the H8
- */
- h8_sync(); /* activate interrupts */
-
- /* To clear conditions left by console */
- h8_read_event_status();
-
- /* Perform a conditioning read */
- buf[0] = H8_DEVICE_CONTROL;
- buf[1] = 0xff;
- buf[2] = 0x0;
- h8_q_cmd(buf, 3, 1);
-
- /* Turn on built-in and external mice, capture power switch */
- buf[0] = H8_DEVICE_CONTROL;
- buf[1] = 0x0;
- buf[2] = H8_ENAB_INT_PTR | H8_ENAB_EXT_PTR |
- /*H8_DISAB_PWR_OFF_SW |*/ H8_ENAB_LOW_SPD_IND;
- h8_q_cmd(buf, 3, 1);
-
- h8_enabled = 1;
- return;
-}
-
-static int h8_get_info(char *buf, char **start, off_t fpos, int length)
-{
-#ifdef CONFIG_PROC_FS
- char *p;
-
- if (!h8_enabled)
- return 0;
- p = buf;
-
-
- /*
- 0) Linux driver version (this will change if format changes)
- 1)
- 2)
- 3)
- 4)
- */
-
- p += sprintf(p, "%s \n",
- driver_version
- );
-
- return p - buf;
-#else
- return 0;
-#endif
-}
-
-/* Called from console driver -- must make sure h8_enabled. */
-static int h8_display_blank(void)
-{
-#ifdef CONFIG_H8_DISPLAY_BLANK
- int error;
-
- if (!h8_enabled)
- return 0;
- error = h8_set_display_power_state(H8_STATE_STANDBY);
- if (error == H8_SUCCESS)
- return 1;
- h8_error("set display standby", error);
-#endif
- return 0;
-}
-
-/* Called from console driver -- must make sure h8_enabled. */
-static int h8_display_unblank(void)
-{
-#ifdef CONFIG_H8_DISPLAY_BLANK
- int error;
-
- if (!h8_enabled)
- return 0;
- error = h8_set_display_power_state(H8_STATE_READY);
- if (error == H8_SUCCESS)
- return 1;
- h8_error("set display ready", error);
-#endif
- return 0;
-}
-
-static int h8_alloc_queues(void)
-{
- h8_cmd_q_t *qp;
- unsigned long flags;
- int i;
-
- qp = (h8_cmd_q_t *)kmalloc((sizeof (h8_cmd_q_t) * H8_Q_ALLOC_AMOUNT),
- GFP_KERNEL);
-
- if (!qp) {
- printk(KERN_ERR "H8: could not allocate memory for command queue\n");
- return(0);
- }
- /* add to the free queue */
- save_flags(flags); cli();
- for (i = 0; i < H8_Q_ALLOC_AMOUNT; i++) {
- /* place each at front of freeq */
- list_add(&qp[i].link, &h8_freeq);
- }
- restore_flags(flags);
- return (1);
-}
-
-/*
- * Basic means by which commands are sent to the H8.
- */
-void
-h8_q_cmd(u_char *cmd, int cmd_size, int resp_size)
-{
- h8_cmd_q_t *qp;
- unsigned long flags;
- int i;
-
- /* get cmd buf */
- save_flags(flags); cli();
- while (list_empty(&h8_freeq)) {
- Dprintk("H8: need to allocate more cmd buffers\n");
- restore_flags(flags);
- h8_alloc_queues();
- save_flags(flags); cli();
- }
- /* get first element from queue */
- qp = list_entry(h8_freeq.next, h8_cmd_q_t, link);
- list_del(&qp->link);
-
- restore_flags(flags);
-
- /* fill it in */
- for (i = 0; i < cmd_size; i++)
- qp->cmdbuf[i] = cmd[i];
- qp->ncmd = cmd_size;
- qp->nrsp = resp_size;
-
- /* queue it at the end of the cmd queue */
- save_flags(flags); cli();
-
- /* XXX this actually puts it at the start of cmd queue, bug? */
- list_add(&qp->link, &h8_cmdq);
-
- restore_flags(flags);
-
- h8_start_new_cmd();
-}
-
-void
-h8_start_new_cmd(void)
-{
- unsigned long flags;
- h8_cmd_q_t *qp;
-
- save_flags(flags); cli();
- if (h8_state != H8_IDLE) {
- if (h8_debug & 0x1)
- Dprintk("h8_start_new_cmd: not idle\n");
- restore_flags(flags);
- return;
- }
-
- if (!list_empty(&h8_actq)) {
- Dprintk("h8_start_new_cmd: inconsistency: IDLE with non-empty active queue!\n");
- restore_flags(flags);
- return;
- }
-
- if (list_empty(&h8_cmdq)) {
- Dprintk("h8_start_new_cmd: no command to dequeue\n");
- restore_flags(flags);
- return;
- }
- /*
- * Take first command off of the command queue and put
- * it on the active queue.
- */
- qp = list_entry(h8_cmdq.next, h8_cmd_q_t, link);
- list_del(&qp->link);
- /* XXX should this go to the end of the active queue? */
- list_add(&qp->link, &h8_actq);
- h8_state = H8_XMIT;
- if (h8_debug & 0x1)
- Dprintk("h8_start_new_cmd: Starting a command\n");
-
- qp->cnt = 1;
- WRITE_CMD(qp->cmdbuf[0]); /* Kick it off */
-
- restore_flags(flags);
- return;
-}
-
-void
-h8_send_next_cmd_byte(void)
-{
- h8_cmd_q_t *qp = list_entry(h8_actq.next, h8_cmd_q_t, link);
- int cnt;
-
- cnt = qp->cnt;
- qp->cnt++;
-
- if (h8_debug & 0x1)
- Dprintk("h8 sending next cmd byte 0x%x (0x%x)\n",
- cnt, qp->cmdbuf[cnt]);
-
- if (cnt) {
- WRITE_DATA(qp->cmdbuf[cnt]);
- } else {
- WRITE_CMD(qp->cmdbuf[cnt]);
- }
- return;
-}
-
-/*
- * Synchronize H8 communications channel for command transmission.
- */
-void
-h8_sync(void)
-{
- u_char buf[H8_MAX_CMD_SIZE];
-
- buf[0] = H8_SYNC;
- buf[1] = H8_SYNC_BYTE;
- h8_q_cmd(buf, 2, 1);
-}
-
-/*
- * Responds to external interrupt. Reads event status word and
- * decodes type of interrupt.
- */
-void
-h8_read_event_status(void)
-{
-
- if(h8_debug & 0x200)
- printk(KERN_DEBUG "h8_read_event_status: value 0x%x\n", intrbuf.word);
-
- /*
- * Power related items
- */
- if (intrbuf.word & H8_DC_CHANGE) {
- if(h8_debug & 0x4)
- printk(KERN_DEBUG "h8_read_event_status: DC_CHANGE\n");
- /* see if dc added or removed, set batt/dc flag, send event */
-
- h8_set_event_mask(H8_MANAGE_BATTERY);
- wake_up(&h8_monitor_wait);
- }
-
- if (intrbuf.word & H8_POWER_BUTTON) {
- printk(KERN_CRIT "Power switch pressed - please wait - preparing to power
-off\n");
- h8_set_event_mask(H8_POWER_BUTTON);
- wake_up(&h8_monitor_wait);
- }
-
- /*
- * Thermal related items
- */
- if (intrbuf.word & H8_THERMAL_THRESHOLD) {
- if(h8_debug & 0x4)
- printk(KERN_DEBUG "h8_read_event_status: THERMAL_THRESHOLD\n");
- h8_set_event_mask(H8_MANAGE_UTHERM);
- wake_up(&h8_monitor_wait);
- }
-
- /*
- * nops -for now
- */
- if (intrbuf.word & H8_DOCKING_STATION_STATUS) {
- if(h8_debug & 0x4)
- printk(KERN_DEBUG "h8_read_event_status: DOCKING_STATION_STATUS\n");
- /* read_ext_status */
- }
- if (intrbuf.word & H8_EXT_BATT_STATUS) {
- if(h8_debug & 0x4)
- printk(KERN_DEBUG "h8_read_event_status: EXT_BATT_STATUS\n");
-
- }
- if (intrbuf.word & H8_EXT_BATT_CHARGE_STATE) {
- if(h8_debug & 0x4)
- printk(KERN_DEBUG "h8_read_event_status: EXT_BATT_CHARGE_STATE\n");
-
- }
- if (intrbuf.word & H8_BATT_CHANGE_OVER) {
- if(h8_debug & 0x4)
- printk(KERN_DEBUG "h8_read_event_status: BATT_CHANGE_OVER\n");
-
- }
- if (intrbuf.word & H8_WATCHDOG) {
- if(h8_debug & 0x4)
- printk(KERN_DEBUG "h8_read_event_status: WATCHDOG\n");
- /* nop */
- }
- if (intrbuf.word & H8_SHUTDOWN) {
- if(h8_debug & 0x4)
- printk(KERN_DEBUG "h8_read_event_status: SHUTDOWN\n");
- /* nop */
- }
- if (intrbuf.word & H8_KEYBOARD) {
- if(h8_debug & 0x4)
- printk(KERN_DEBUG "h8_read_event_status: KEYBOARD\n");
- /* nop */
- }
- if (intrbuf.word & H8_EXT_MOUSE_OR_CASE_SWITCH) {
- if(h8_debug & 0x4)
- printk(KERN_DEBUG "h8_read_event_status: EXT_MOUSE_OR_CASE_SWITCH\n");
- /* read_ext_status*/
- }
- if (intrbuf.word & H8_INT_BATT_LOW) {
- if(h8_debug & 0x4)
- printk(KERN_DEBUG "h8_read_event_status: INT_BATT_LOW\n"); post
- /* event, warn user */
- }
- if (intrbuf.word & H8_INT_BATT_CHARGE_STATE) {
- if(h8_debug & 0x4)
- printk(KERN_DEBUG "h8_read_event_status: INT_BATT_CHARGE_STATE\n");
- /* nop - happens often */
- }
- if (intrbuf.word & H8_INT_BATT_STATUS) {
- if(h8_debug & 0x4)
- printk(KERN_DEBUG "h8_read_event_status: INT_BATT_STATUS\n");
-
- }
- if (intrbuf.word & H8_INT_BATT_CHARGE_THRESHOLD) {
- if(h8_debug & 0x4)
- printk(KERN_DEBUG "h8_read_event_status: INT_BATT_CHARGE_THRESHOLD\n");
- /* nop - happens often */
- }
- if (intrbuf.word & H8_EXT_BATT_LOW) {
- if(h8_debug & 0x4)
- printk(KERN_DEBUG "h8_read_event_status: EXT_BATT_LOW\n");
- /*if no internal, post event, warn user */
- /* else nop */
- }
-
- return;
-}
-
-/*
- * Function called when H8 has performed requested command.
- */
-static void
-h8_cmd_done(h8_cmd_q_t *qp)
-{
-
- /* what to do */
- switch (qp->cmdbuf[0]) {
- case H8_SYNC:
- if (h8_debug & 0x40000)
- printk(KERN_DEBUG "H8: Sync command done - byte returned was 0x%x\n",
- qp->rcvbuf[0]);
- list_add(&qp->link, &h8_freeq);
- break;
-
- case H8_RD_SN:
- case H8_RD_ENET_ADDR:
- printk(KERN_DEBUG "H8: read Ethernet address: command done - address: %x - %x - %x - %x - %x - %x \n",
- qp->rcvbuf[0], qp->rcvbuf[1], qp->rcvbuf[2],
- qp->rcvbuf[3], qp->rcvbuf[4], qp->rcvbuf[5]);
- list_add(&qp->link, &h8_freeq);
- break;
-
- case H8_RD_HW_VER:
- case H8_RD_MIC_VER:
- case H8_RD_MAX_TEMP:
- printk(KERN_DEBUG "H8: Max recorded CPU temp %d, Sys temp %d\n",
- qp->rcvbuf[0], qp->rcvbuf[1]);
- list_add(&qp->link, &h8_freeq);
- break;
-
- case H8_RD_MIN_TEMP:
- printk(KERN_DEBUG "H8: Min recorded CPU temp %d, Sys temp %d\n",
- qp->rcvbuf[0], qp->rcvbuf[1]);
- list_add(&qp->link, &h8_freeq);
- break;
-
- case H8_RD_CURR_TEMP:
- h8_sync_channel |= H8_RD_CURR_TEMP;
- xx.byte[0] = qp->rcvbuf[0];
- xx.byte[1] = qp->rcvbuf[1];
- wake_up(&h8_sync_wait);
- list_add(&qp->link, &h8_freeq);
- break;
-
- case H8_RD_SYS_VARIENT:
- case H8_RD_PWR_ON_CYCLES:
- printk(KERN_DEBUG " H8: RD_PWR_ON_CYCLES command done\n");
- break;
-
- case H8_RD_PWR_ON_SECS:
- printk(KERN_DEBUG "H8: RD_PWR_ON_SECS command done\n");
- break;
-
- case H8_RD_RESET_STATUS:
- case H8_RD_PWR_DN_STATUS:
- case H8_RD_EVENT_STATUS:
- case H8_RD_ROM_CKSM:
- case H8_RD_EXT_STATUS:
- xx.byte[1] = qp->rcvbuf[0];
- xx.byte[0] = qp->rcvbuf[1];
- h8_sync_channel |= H8_GET_EXT_STATUS;
- wake_up(&h8_sync_wait);
- list_add(&qp->link, &h8_freeq);
- break;
-
- case H8_RD_USER_CFG:
- case H8_RD_INT_BATT_VOLT:
- case H8_RD_DC_INPUT_VOLT:
- case H8_RD_HORIZ_PTR_VOLT:
- case H8_RD_VERT_PTR_VOLT:
- case H8_RD_EEPROM_STATUS:
- case H8_RD_ERR_STATUS:
- case H8_RD_NEW_BUSY_SPEED:
- case H8_RD_CONFIG_INTERFACE:
- case H8_RD_INT_BATT_STATUS:
- printk(KERN_DEBUG "H8: Read int batt status cmd done - returned was %x %x %x\n",
- qp->rcvbuf[0], qp->rcvbuf[1], qp->rcvbuf[2]);
- list_add(&qp->link, &h8_freeq);
- break;
-
- case H8_RD_EXT_BATT_STATUS:
- case H8_RD_PWR_UP_STATUS:
- case H8_RD_EVENT_STATUS_MASK:
- case H8_CTL_EMU_BITPORT:
- case H8_DEVICE_CONTROL:
- if(h8_debug & 0x20000) {
- printk(KERN_DEBUG "H8: Device control cmd done - byte returned was 0x%x\n",
- qp->rcvbuf[0]);
- }
- list_add(&qp->link, &h8_freeq);
- break;
-
- case H8_CTL_TFT_BRT_DC:
- case H8_CTL_WATCHDOG:
- case H8_CTL_MIC_PROT:
- case H8_CTL_INT_BATT_CHG:
- case H8_CTL_EXT_BATT_CHG:
- case H8_CTL_MARK_SPACE:
- case H8_CTL_MOUSE_SENSITIVITY:
- case H8_CTL_DIAG_MODE:
- case H8_CTL_IDLE_AND_BUSY_SPDS:
- printk(KERN_DEBUG "H8: Idle and busy speed command done\n");
- break;
-
- case H8_CTL_TFT_BRT_BATT:
- case H8_CTL_UPPER_TEMP:
- if(h8_debug & 0x10) {
- XDprintk("H8: ctl upper thermal thresh cmd done - returned was %d\n",
- qp->rcvbuf[0]);
- }
- list_add(&qp->link, &h8_freeq);
- break;
-
- case H8_CTL_LOWER_TEMP:
- case H8_CTL_TEMP_CUTOUT:
- case H8_CTL_WAKEUP:
- case H8_CTL_CHG_THRESHOLD:
- case H8_CTL_TURBO_MODE:
- case H8_SET_DIAG_STATUS:
- case H8_SOFTWARE_RESET:
- case H8_RECAL_PTR:
- case H8_SET_INT_BATT_PERCENT:
- case H8_WRT_CFG_INTERFACE_REG:
- case H8_WRT_EVENT_STATUS_MASK:
- case H8_ENTER_POST_MODE:
- case H8_EXIT_POST_MODE:
- case H8_RD_EEPROM:
- case H8_WRT_EEPROM:
- case H8_WRT_TO_STATUS_DISP:
- printk("H8: Write IO status display command done\n");
- break;
-
- case H8_DEFINE_SPC_CHAR:
- case H8_DEFINE_TABLE_STRING_ENTRY:
- case H8_PERFORM_EMU_CMD:
- case H8_EMU_RD_REG:
- case H8_EMU_WRT_REG:
- case H8_EMU_RD_RAM:
- case H8_EMU_WRT_RAM:
- case H8_BQ_RD_REG:
- case H8_BQ_WRT_REG:
- case H8_PWR_OFF:
- printk (KERN_DEBUG "H8: misc command completed\n");
- break;
- }
- return;
-}
-
-/*
- * Retrieve the current CPU temperature and case temperature. Provides
- * the feedback for the thermal control algorithm. Synchcronized via
- * sleep() for priority so that no other actions in the process will take
- * place before the data becomes available.
- */
-int
-h8_get_curr_temp(u_char curr_temp[])
-{
- u_char buf[H8_MAX_CMD_SIZE];
- unsigned long flags;
-
- memset(buf, 0, H8_MAX_CMD_SIZE);
- buf[0] = H8_RD_CURR_TEMP;
-
- h8_q_cmd(buf, 1, 2);
-
- save_flags(flags); cli();
-
- while((h8_sync_channel & H8_RD_CURR_TEMP) == 0)
- sleep_on(&h8_sync_wait);
-
- restore_flags(flags);
-
- h8_sync_channel &= ~H8_RD_CURR_TEMP;
- curr_temp[0] = xx.byte[0];
- curr_temp[1] = xx.byte[1];
- xx.word = 0;
-
- if(h8_debug & 0x8)
- printk("H8: curr CPU temp %d, Sys temp %d\n",
- curr_temp[0], curr_temp[1]);
- return 0;
-}
-
-static void
-h8_get_max_temp(void)
-{
- u_char buf[H8_MAX_CMD_SIZE];
-
- buf[0] = H8_RD_MAX_TEMP;
- h8_q_cmd(buf, 1, 2);
-}
-
-/*
- * Assigns an upper limit to the value of the H8 thermal interrupt.
- * As an example setting a value of 115 F here will cause the
- * interrupt to trigger when the CPU temperature reaches 115 F.
- */
-static void
-h8_set_upper_therm_thold(int thold)
-{
- u_char buf[H8_MAX_CMD_SIZE];
-
- /* write 0 to reinitialize interrupt */
- buf[0] = H8_CTL_UPPER_TEMP;
- buf[1] = 0x0;
- buf[2] = 0x0;
- h8_q_cmd(buf, 3, 1);
-
- /* Do it for real */
- buf[0] = H8_CTL_UPPER_TEMP;
- buf[1] = 0x0;
- buf[2] = thold;
- h8_q_cmd(buf, 3, 1);
-}
-
-static void
-h8_get_upper_therm_thold(void)
-{
- u_char buf[H8_MAX_CMD_SIZE];
-
- buf[0] = H8_CTL_UPPER_TEMP;
- buf[1] = 0xff;
- buf[2] = 0;
- h8_q_cmd(buf, 3, 1);
-}
-
-/*
- * The external status word contains information on keyboard controller,
- * power button, changes in external batt status, change in DC state,
- * docking station, etc. General purpose querying use.
- */
-int
-h8_get_ext_status(u_char stat_word[])
-{
- u_char buf[H8_MAX_CMD_SIZE];
- unsigned long flags;
-
- memset(buf, 0, H8_MAX_CMD_SIZE);
- buf[0] = H8_RD_EXT_STATUS;
-
- h8_q_cmd(buf, 1, 2);
-
- save_flags(flags); cli();
-
- while((h8_sync_channel & H8_GET_EXT_STATUS) == 0)
- sleep_on(&h8_sync_wait);
-
- restore_flags(flags);
-
- h8_sync_channel &= ~H8_GET_EXT_STATUS;
- stat_word[0] = xx.byte[0];
- stat_word[1] = xx.byte[1];
- xx.word = 0;
-
- if(h8_debug & 0x8)
- printk("H8: curr ext status %x, %x\n",
- stat_word[0], stat_word[1]);
-
- return 0;
-}
-
-/*
- * Thread attached to task 0 manages thermal/physcial state of Alphabook.
- * When a condition is detected by the interrupt service routine, the
- * isr does a wakeup() on h8_monitor_wait. The mask value is then
- * screened for the appropriate action.
- */
-
-int
-h8_monitor_thread(void * unused)
-{
- u_char curr_temp[2];
-
- /*
- * Need a logic based safety valve here. During boot when this thread is
- * started and the thermal interrupt is not yet initialized this logic
- * checks the temperature and acts accordingly. When this path is acted
- * upon system boot is painfully slow, however, the priority associated
- * with overheating is high enough to warrant this action.
- */
- h8_get_curr_temp(curr_temp);
-
- printk(KERN_INFO "H8: Initial CPU temp: %d\n", curr_temp[0]);
-
- if(curr_temp[0] >= h8_uthermal_threshold) {
- h8_set_event_mask(H8_MANAGE_UTHERM);
- h8_manage_therm();
- } else {
- /*
- * Arm the upper thermal limit of the H8 so that any temp in
- * excess will trigger the thermal control mechanism.
- */
- h8_set_upper_therm_thold(h8_uthermal_threshold);
- }
-
- for(;;) {
- sleep_on(&h8_monitor_wait);
-
- if(h8_debug & 0x2)
- printk(KERN_DEBUG "h8_monitor_thread awakened, mask:%x\n",
- h8_event_mask);
-
- if (h8_event_mask & (H8_MANAGE_UTHERM|H8_MANAGE_LTHERM)) {
- h8_manage_therm();
- }
-
-#if 0
- if (h8_event_mask & H8_POWER_BUTTON) {
- h8_system_down();
- }
-
- /*
- * If an external DC supply is removed or added make
- * appropriate CPU speed adjustments.
- */
- if (h8_event_mask & H8_MANAGE_BATTERY) {
- h8_run_level_3_manage(H8_RUN);
- h8_clear_event_mask(H8_MANAGE_BATTERY);
- }
-#endif
- }
-}
-
-/*
- * Function implements the following policy. When the machine is booted
- * the system is set to run at full clock speed. When the upper thermal
- * threshold is reached as a result of full clock a damping factor is
- * applied to cool off the cpu. The default value is one quarter clock
- * (57 Mhz). When as a result of this cooling a temperature lower by
- * hmc_uthermal_window is reached, the machine is reset to a higher
- * speed, one half clock (115 Mhz). One half clock is maintained until
- * the upper thermal threshold is again reached restarting the cycle.
- */
-
-int
-h8_manage_therm(void)
-{
- u_char curr_temp[2];
-
- if(h8_event_mask & H8_MANAGE_UTHERM) {
- /* Upper thermal interrupt received, need to cool down. */
- if(h8_debug & 0x10)
- printk(KERN_WARNING "H8: Thermal threshold %d F reached\n",
- h8_uthermal_threshold);
- h8_set_cpu_speed(h8_udamp);
- h8_clear_event_mask(H8_MANAGE_UTHERM);
- h8_set_event_mask(H8_MANAGE_LTHERM);
- /* Check again in 30 seconds for CPU temperature */
- h8_start_monitor_timer(H8_TIMEOUT_INTERVAL);
- } else if (h8_event_mask & H8_MANAGE_LTHERM) {
- /* See how cool the system has become as a result
- of the reduction in speed. */
- h8_get_curr_temp(curr_temp);
- last_temp = curr_temp[0];
- if (curr_temp[0] < (h8_uthermal_threshold - h8_uthermal_window))
- {
- /* System cooling has progressed to a point
- that the CPU may be sped up. */
- h8_set_upper_therm_thold(h8_uthermal_threshold);
- h8_set_cpu_speed(h8_ldamp); /* adjustable */
- if(h8_debug & 0x10)
- printk(KERN_WARNING "H8: CPU cool, applying cpu_divisor: %d \n",
- h8_ldamp);
- h8_clear_event_mask(H8_MANAGE_LTHERM);
- }
- else /* Not cool enough yet, check again in 30 seconds. */
- h8_start_monitor_timer(H8_TIMEOUT_INTERVAL);
- } else {
-
- }
- return 0;
-}
-
-/*
- * Function conditions the value of global_rpb_counter before
- * calling the primitive which causes the actual speed change.
- */
-void
-h8_set_cpu_speed(int speed_divisor)
-{
-
-#ifdef NOT_YET
-/*
- * global_rpb_counter is consumed by alpha_delay() in determining just
- * how much time to delay. It is necessary that the number of microseconds
- * in DELAY(n) be kept consistent over a variety of CPU clock speeds.
- * To that end global_rpb_counter is here adjusted.
- */
-
- switch (speed_divisor) {
- case 0:
- global_rpb_counter = rpb->rpb_counter * 2L;
- break;
- case 1:
- global_rpb_counter = rpb->rpb_counter * 4L / 3L ;
- break;
- case 3:
- global_rpb_counter = rpb->rpb_counter / 2L;
- break;
- case 4:
- global_rpb_counter = rpb->rpb_counter / 4L;
- break;
- case 5:
- global_rpb_counter = rpb->rpb_counter / 8L;
- break;
- /*
- * This case most commonly needed for cpu_speed_divisor
- * of 2 which is the value assigned by the firmware.
- */
- default:
- global_rpb_counter = rpb->rpb_counter;
- break;
- }
-#endif /* NOT_YET */
-
- if(h8_debug & 0x8)
- printk(KERN_DEBUG "H8: Setting CPU speed to %d MHz\n",
- speed_tab[speed_divisor]);
-
- /* Make the actual speed change */
- lca_clock_fiddle(speed_divisor);
-}
-
-/*
- * Gets value stored in rpb representing CPU clock speed and adjusts this
- * value based on the current clock speed divisor.
- */
-u_long
-h8_get_cpu_speed(void)
-{
- u_long speed = 0;
- u_long counter;
-
-#ifdef NOT_YET
- counter = rpb->rpb_counter / 1000000L;
-
- switch (alphabook_get_clock()) {
- case 0:
- speed = counter * 2L;
- break;
- case 1:
- speed = counter * 4L / 3L ;
- break;
- case 2:
- speed = counter;
- break;
- case 3:
- speed = counter / 2L;
- break;
- case 4:
- speed = counter / 4L;
- break;
- case 5:
- speed = counter / 8L;
- break;
- default:
- break;
- }
- if(h8_debug & 0x8)
- printk(KERN_DEBUG "H8: CPU speed current setting: %d MHz\n", speed);
-#endif /* NOT_YET */
- return speed;
-}
-
-static void
-h8_activate_monitor(unsigned long unused)
-{
- unsigned long flags;
-
- save_flags(flags); cli();
- h8_monitor_timer_active = 0;
- restore_flags(flags);
-
- wake_up(&h8_monitor_wait);
-}
-
-static void
-h8_start_monitor_timer(unsigned long secs)
-{
- unsigned long flags;
-
- if (h8_monitor_timer_active)
- return;
-
- save_flags(flags); cli();
- h8_monitor_timer_active = 1;
- restore_flags(flags);
-
- init_timer(&h8_monitor_timer);
- h8_monitor_timer.function = h8_activate_monitor;
- h8_monitor_timer.expires = secs * HZ + jiffies;
- add_timer(&h8_monitor_timer);
-}
-
-static void h8_set_event_mask(int mask)
-{
- unsigned long flags;
-
- save_flags(flags); cli();
- h8_event_mask |= mask;
- restore_flags(flags);
-}
-
-static void h8_clear_event_mask(int mask)
-{
- unsigned long flags;
-
- save_flags(flags); cli();
- h8_event_mask &= (~mask);
- restore_flags(flags);
-}
-
-MODULE_LICENSE("GPL");
diff --git a/drivers/char/h8.h b/drivers/char/h8.h
deleted file mode 100644
index 986eef5917da..000000000000
--- a/drivers/char/h8.h
+++ /dev/null
@@ -1,246 +0,0 @@
-/*
- */
-
-#ifndef __H8_H__
-#define __H8_H__
-
-/*
- * Register address and offsets
- */
-#define H8_BASE_ADDR 0x170 /* default */
-#define H8_IRQ 9 /* default */
-#define H8_STATUS_REG_OFF 0x4
-#define H8_CMD_REG_OFF 0x4
-#define H8_DATA_REG_OFF 0x0
-
-
-/* H8 register bit definitions */
-/* status register */
-#define H8_OFULL 0x1 /* output data register full */
-#define H8_IFULL 0x2 /* input data register full */
-#define H8_CMD 0x8 /* command / not data */
-
-#define H8_INTR 0xfa
-#define H8_NACK 0xfc
-#define H8_BYTE_LEVEL_ACK 0xfd
-#define H8_CMD_ACK 0xfe
-#define H8_SYNC_BYTE 0x99
-
-/*
- * H8 command definitions
- */
-/* System info commands */
-#define H8_SYNC 0x0
-#define H8_RD_SN 0x1
-#define H8_RD_ENET_ADDR 0x2
-#define H8_RD_HW_VER 0x3
-#define H8_RD_MIC_VER 0x4
-#define H8_RD_MAX_TEMP 0x5
-#define H8_RD_MIN_TEMP 0x6
-#define H8_RD_CURR_TEMP 0x7
-#define H8_RD_SYS_VARIENT 0x8
-#define H8_RD_PWR_ON_CYCLES 0x9
-#define H8_RD_PWR_ON_SECS 0xa
-#define H8_RD_RESET_STATUS 0xb
-#define H8_RD_PWR_DN_STATUS 0xc
-#define H8_RD_EVENT_STATUS 0xd
-#define H8_RD_ROM_CKSM 0xe
-#define H8_RD_EXT_STATUS 0xf
-#define H8_RD_USER_CFG 0x10
-#define H8_RD_INT_BATT_VOLT 0x11
-#define H8_RD_DC_INPUT_VOLT 0x12
-#define H8_RD_HORIZ_PTR_VOLT 0x13
-#define H8_RD_VERT_PTR_VOLT 0x14
-#define H8_RD_EEPROM_STATUS 0x15
-#define H8_RD_ERR_STATUS 0x16
-#define H8_RD_NEW_BUSY_SPEED 0x17
-#define H8_RD_CONFIG_INTERFACE 0x18
-#define H8_RD_INT_BATT_STATUS 0x19
-#define H8_RD_EXT_BATT_STATUS 0x1a
-#define H8_RD_PWR_UP_STATUS 0x1b
-#define H8_RD_EVENT_STATUS_MASK 0x56
-
-/* Read/write/modify commands */
-#define H8_CTL_EMU_BITPORT 0x32
-#define H8_DEVICE_CONTROL 0x21
-#define H8_CTL_TFT_BRT_DC 0x22
-#define H8_CTL_WATCHDOG 0x23
-#define H8_CTL_MIC_PROT 0x24
-#define H8_CTL_INT_BATT_CHG 0x25
-#define H8_CTL_EXT_BATT_CHG 0x26
-#define H8_CTL_MARK_SPACE 0x27
-#define H8_CTL_MOUSE_SENSITIVITY 0x28
-#define H8_CTL_DIAG_MODE 0x29
-#define H8_CTL_IDLE_AND_BUSY_SPDS 0x2a
-#define H8_CTL_TFT_BRT_BATT 0x2b
-#define H8_CTL_UPPER_TEMP 0x2c
-#define H8_CTL_LOWER_TEMP 0x2d
-#define H8_CTL_TEMP_CUTOUT 0x2e
-#define H8_CTL_WAKEUP 0x2f
-#define H8_CTL_CHG_THRESHOLD 0x30
-#define H8_CTL_TURBO_MODE 0x31
-#define H8_SET_DIAG_STATUS 0x40
-#define H8_SOFTWARE_RESET 0x41
-#define H8_RECAL_PTR 0x42
-#define H8_SET_INT_BATT_PERCENT 0x43
-#define H8_WRT_CFG_INTERFACE_REG 0x45
-#define H8_WRT_EVENT_STATUS_MASK 0x57
-#define H8_ENTER_POST_MODE 0x46
-#define H8_EXIT_POST_MODE 0x47
-
-/* Block transfer commands */
-#define H8_RD_EEPROM 0x50
-#define H8_WRT_EEPROM 0x51
-#define H8_WRT_TO_STATUS_DISP 0x52
-#define H8_DEFINE_SPC_CHAR 0x53
-
-/* Generic commands */
-#define H8_DEFINE_TABLE_STRING_ENTRY 0x60
-
-/* Battery control commands */
-#define H8_PERFORM_EMU_CMD 0x70
-#define H8_EMU_RD_REG 0x71
-#define H8_EMU_WRT_REG 0x72
-#define H8_EMU_RD_RAM 0x73
-#define H8_EMU_WRT_RAM 0x74
-#define H8_BQ_RD_REG 0x75
-#define H8_BQ_WRT_REG 0x76
-
-/* System admin commands */
-#define H8_PWR_OFF 0x80
-
-/*
- * H8 command related definitions
- */
-
-/* device control argument bits */
-#define H8_ENAB_EXTSMI 0x1
-#define H8_DISAB_IRQ 0x2
-#define H8_ENAB_FLASH_WRT 0x4
-#define H8_ENAB_THERM 0x8
-#define H8_ENAB_INT_PTR 0x10
-#define H8_ENAB_LOW_SPD_IND 0x20
-#define H8_ENAB_EXT_PTR 0x40
-#define H8_DISAB_PWR_OFF_SW 0x80
-#define H8_POWER_OFF 0x80
-
-/* H8 read event status bits */
-#define H8_DC_CHANGE 0x1
-#define H8_INT_BATT_LOW 0x2
-#define H8_INT_BATT_CHARGE_THRESHOLD 0x4
-#define H8_INT_BATT_CHARGE_STATE 0x8
-#define H8_INT_BATT_STATUS 0x10
-#define H8_EXT_BATT_CHARGE_STATE 0x20
-#define H8_EXT_BATT_LOW 0x40
-#define H8_EXT_BATT_STATUS 0x80
-#define H8_THERMAL_THRESHOLD 0x100
-#define H8_WATCHDOG 0x200
-#define H8_DOCKING_STATION_STATUS 0x400
-#define H8_EXT_MOUSE_OR_CASE_SWITCH 0x800
-#define H8_KEYBOARD 0x1000
-#define H8_BATT_CHANGE_OVER 0x2000
-#define H8_POWER_BUTTON 0x4000
-#define H8_SHUTDOWN 0x8000
-
-/* H8 control idle and busy speeds */
-#define H8_SPEED_LOW 0x1
-#define H8_SPEED_MED 0x2
-#define H8_SPEED_HI 0x3
-#define H8_SPEED_LOCKED 0x80
-
-#define H8_MAX_CMD_SIZE 18
-#define H8_Q_ALLOC_AMOUNT 10
-
-/* H8 state field values */
-#define H8_IDLE 1
-#define H8_XMIT 2
-#define H8_RCV 3
-#define H8_RESYNC 4
-#define H8_INTR_MODE 5
-
-/* Mask values for control functions */
-#define UTH_HYSTERESIS 5
-#define DEFAULT_UTHERMAL_THRESHOLD 115
-#define H8_TIMEOUT_INTERVAL 30
-#define H8_RUN 4
-
-#define H8_GET_MAX_TEMP 0x1
-#define H8_GET_CURR_TEMP 0x2
-#define H8_GET_UPPR_THRMAL_THOLD 0x4
-#define H8_GET_ETHERNET_ADDR 0x8
-#define H8_SYNC_OP 0x10
-#define H8_SET_UPPR_THRMAL_THOLD 0x20
-#define H8_GET_INT_BATT_STAT 0x40
-#define H8_GET_CPU_SPD 0x80
-#define H8_MANAGE_UTHERM 0x100
-#define H8_MANAGE_LTHERM 0x200
-#define H8_HALT 0x400
-#define H8_CRASH 0x800
-#define H8_GET_EXT_STATUS 0x10000
-#define H8_MANAGE_QUIET 0x20000
-#define H8_MANAGE_SPEEDUP 0x40000
-#define H8_MANAGE_BATTERY 0x80000
-#define H8_SYSTEM_DELAY_TEST 0x100000
-#define H8_POWER_SWITCH_TEST 0x200000
-
-/* CPU speeds and clock divisor values */
-#define MHZ_14 5
-#define MHZ_28 4
-#define MHZ_57 3
-#define MHZ_115 2
-#define MHZ_230 0
-
-/*
- * H8 data
- */
-struct h8_data {
- u_int ser_num;
- u_char ether_add[6];
- u_short hw_ver;
- u_short mic_ver;
- u_short max_tmp;
- u_short min_tmp;
- u_short cur_tmp;
- u_int sys_var;
- u_int pow_on;
- u_int pow_on_secs;
- u_char reset_status;
- u_char pwr_dn_status;
- u_short event_status;
- u_short rom_cksm;
- u_short ext_status;
- u_short u_cfg;
- u_char ibatt_volt;
- u_char dc_volt;
- u_char ptr_horiz;
- u_char ptr_vert;
- u_char eeprom_status;
- u_char error_status;
- u_char new_busy_speed;
- u_char cfg_interface;
- u_short int_batt_status;
- u_short ext_batt_status;
- u_char pow_up_status;
- u_char event_status_mask;
-};
-
-
-/*
- * H8 command buffers
- */
-typedef struct h8_cmd_q {
- struct list_head link; /* double linked list */
- int ncmd; /* number of bytes in command */
- int nrsp; /* number of bytes in response */
- int cnt; /* number of bytes sent/received */
- int nacks; /* number of byte level acks */
- u_char cmdbuf[H8_MAX_CMD_SIZE]; /* buffer to store command */
- u_char rcvbuf[H8_MAX_CMD_SIZE]; /* buffer to store response */
-} h8_cmd_q_t;
-
-union intr_buf {
- u_char byte[2];
- u_int word;
-};
-
-#endif /* __H8_H_ */
diff --git a/drivers/char/mwave/mwavedd.c b/drivers/char/mwave/mwavedd.c
index 7f54c84fd3f0..a38f0fe1a846 100644
--- a/drivers/char/mwave/mwavedd.c
+++ b/drivers/char/mwave/mwavedd.c
@@ -179,7 +179,7 @@ static int mwave_ioctl(struct inode *inode, struct file *file,
case IOCTL_MW_READ_DATA:
case IOCTL_MW_READCLEAR_DATA: {
MW_READWRITE rReadData;
- unsigned short __user *pusBuffer = 0;
+ unsigned short __user *pusBuffer = NULL;
if( copy_from_user(&rReadData, arg,
sizeof(MW_READWRITE)) )
@@ -200,7 +200,7 @@ static int mwave_ioctl(struct inode *inode, struct file *file,
case IOCTL_MW_READ_INST: {
MW_READWRITE rReadData;
- unsigned short __user *pusBuffer = 0;
+ unsigned short __user *pusBuffer = NULL;
if( copy_from_user(&rReadData, arg,
sizeof(MW_READWRITE)) )
@@ -221,7 +221,7 @@ static int mwave_ioctl(struct inode *inode, struct file *file,
case IOCTL_MW_WRITE_DATA: {
MW_READWRITE rWriteData;
- unsigned short __user *pusBuffer = 0;
+ unsigned short __user *pusBuffer = NULL;
if( copy_from_user(&rWriteData, arg,
sizeof(MW_READWRITE)) )
@@ -242,7 +242,7 @@ static int mwave_ioctl(struct inode *inode, struct file *file,
case IOCTL_MW_WRITE_INST: {
MW_READWRITE rWriteData;
- unsigned short __user *pusBuffer = 0;
+ unsigned short __user *pusBuffer = NULL;
if( copy_from_user(&rWriteData, arg,
sizeof(MW_READWRITE)) )
diff --git a/drivers/char/mwave/tp3780i.c b/drivers/char/mwave/tp3780i.c
index c830fc6727eb..bfc3732e0210 100644
--- a/drivers/char/mwave/tp3780i.c
+++ b/drivers/char/mwave/tp3780i.c
@@ -277,7 +277,7 @@ int tp3780I_ReleaseResources(THINKPAD_BD_DATA * pBDData)
release_region(pSettings->usDspBaseIO & (~3), 16);
if (pSettings->bInterruptClaimed) {
- free_irq(pSettings->usDspIrq, 0);
+ free_irq(pSettings->usDspIrq, NULL);
pSettings->bInterruptClaimed = FALSE;
}
@@ -372,7 +372,7 @@ int tp3780I_EnableDSP(THINKPAD_BD_DATA * pBDData)
PRINTK_ERROR(KERN_ERR_MWAVE "tp3780i::tp3780I_EnableDSP: Error: Could not get UART IRQ %x\n", pSettings->usUartIrq);
goto exit_cleanup;
} else { /* no conflict just release */
- free_irq(pSettings->usUartIrq, 0);
+ free_irq(pSettings->usUartIrq, NULL);
}
if (request_irq(pSettings->usDspIrq, &DspInterrupt, 0, "mwave_3780i", 0)) {
@@ -416,7 +416,7 @@ exit_cleanup:
if (bDSPPoweredUp)
smapi_set_DSP_power_state(FALSE);
if (bInterruptAllocated) {
- free_irq(pSettings->usDspIrq, 0);
+ free_irq(pSettings->usDspIrq, NULL);
pSettings->bInterruptClaimed = FALSE;
}
return -EIO;
@@ -433,7 +433,7 @@ int tp3780I_DisableDSP(THINKPAD_BD_DATA * pBDData)
if (pBDData->bDSPEnabled) {
dsp3780I_DisableDSP(&pBDData->rDspSettings);
if (pSettings->bInterruptClaimed) {
- free_irq(pSettings->usDspIrq, 0);
+ free_irq(pSettings->usDspIrq, NULL);
pSettings->bInterruptClaimed = FALSE;
}
smapi_set_DSP_power_state(FALSE);
diff --git a/drivers/char/pcmcia/synclink_cs.c b/drivers/char/pcmcia/synclink_cs.c
index 970e2331a4fb..adfd48e298a8 100644
--- a/drivers/char/pcmcia/synclink_cs.c
+++ b/drivers/char/pcmcia/synclink_cs.c
@@ -1513,7 +1513,7 @@ static void shutdown(MGSLPC_INFO * info)
if (info->tx_buf) {
free_page((unsigned long) info->tx_buf);
- info->tx_buf = 0;
+ info->tx_buf = NULL;
}
spin_lock_irqsave(&info->lock,flags);
@@ -2591,7 +2591,7 @@ static void mgslpc_close(struct tty_struct *tty, struct file * filp)
shutdown(info);
tty->closing = 0;
- info->tty = 0;
+ info->tty = NULL;
if (info->blocked_open) {
if (info->close_delay) {
@@ -2695,7 +2695,7 @@ static void mgslpc_hangup(struct tty_struct *tty)
info->count = 0;
info->flags &= ~ASYNC_NORMAL_ACTIVE;
- info->tty = 0;
+ info->tty = NULL;
wake_up_interruptible(&info->open_wait);
}
@@ -2872,7 +2872,7 @@ static int mgslpc_open(struct tty_struct *tty, struct file * filp)
cleanup:
if (retval) {
if (tty->count == 1)
- info->tty = 0; /* tty layer will release tty struct */
+ info->tty = NULL;/* tty layer will release tty struct */
if(info->count)
info->count--;
}
diff --git a/drivers/char/rocket.c b/drivers/char/rocket.c
index be9c6943d549..129b8ccd85b7 100644
--- a/drivers/char/rocket.c
+++ b/drivers/char/rocket.c
@@ -1115,7 +1115,7 @@ static void rp_close(struct tty_struct *tty, struct file *filp)
} else {
if (info->xmit_buf) {
free_page((unsigned long) info->xmit_buf);
- info->xmit_buf = 0;
+ info->xmit_buf = NULL;
}
}
info->flags &= ~(ROCKET_INITIALIZED | ROCKET_CLOSING | ROCKET_NORMAL_ACTIVE);
@@ -1292,7 +1292,7 @@ static int set_config(struct r_port *info, struct rocket_config __user *new_info
if ((new_serial.flags & ~ROCKET_USR_MASK) != (info->flags & ~ROCKET_USR_MASK))
return -EPERM;
info->flags = ((info->flags & ~ROCKET_USR_MASK) | (new_serial.flags & ROCKET_USR_MASK));
- configure_r_port(info, 0);
+ configure_r_port(info, NULL);
return 0;
}
@@ -1309,7 +1309,7 @@ static int set_config(struct r_port *info, struct rocket_config __user *new_info
if ((info->flags & ROCKET_SPD_MASK) == ROCKET_SPD_WARP)
info->tty->alt_speed = 460800;
- configure_r_port(info, 0);
+ configure_r_port(info, NULL);
return 0;
}
@@ -1572,7 +1572,7 @@ static void rp_hangup(struct tty_struct *tty)
info->count = 0;
info->flags &= ~ROCKET_NORMAL_ACTIVE;
- info->tty = 0;
+ info->tty = NULL;
cp = &info->channel;
sDisRxFIFO(cp);
diff --git a/drivers/char/rtc.c b/drivers/char/rtc.c
index ae93abc07272..1b3b25889f44 100644
--- a/drivers/char/rtc.c
+++ b/drivers/char/rtc.c
@@ -974,7 +974,7 @@ no_irq:
release_region(RTC_PORT(0), RTC_IO_EXTENT);
return -ENODEV;
}
- if (create_proc_read_entry ("driver/rtc", 0, 0, rtc_read_proc, NULL) == NULL) {
+ if (!create_proc_read_entry ("driver/rtc", 0, NULL, rtc_read_proc, NULL)) {
#ifdef RTC_IRQ
free_irq(RTC_IRQ, NULL);
#endif
diff --git a/drivers/ide/legacy/ide-cs.c b/drivers/ide/legacy/ide-cs.c
index 079ff9da361c..3147d909998c 100644
--- a/drivers/ide/legacy/ide-cs.c
+++ b/drivers/ide/legacy/ide-cs.c
@@ -230,7 +230,7 @@ void ide_config(dev_link_t *link)
cisparse_t parse;
config_info_t conf;
cistpl_cftable_entry_t dflt;
- } *stk = 0;
+ } *stk = NULL;
cistpl_cftable_entry_t *cfg;
int i, pass, last_ret = 0, last_fn = 0, hd, is_kme = 0;
unsigned long io_base, ctl_base;
diff --git a/drivers/ide/pci/siimage.c b/drivers/ide/pci/siimage.c
index b1c9e8cd5d7c..91b039826fe3 100644
--- a/drivers/ide/pci/siimage.c
+++ b/drivers/ide/pci/siimage.c
@@ -1007,7 +1007,7 @@ static void __devinit init_iops_siimage(ide_hwif_t *hwif)
pci_read_config_dword(dev, PCI_CLASS_REVISION, &class_rev);
class_rev &= 0xff;
- hwif->hwif_data = 0;
+ hwif->hwif_data = NULL;
hwif->rqsize = 128;
if (is_sata(hwif) && is_dev_seagate_sata(&hwif->drives[0]))
diff --git a/drivers/input/joystick/grip.c b/drivers/input/joystick/grip.c
index 3b1b07e2dfe3..cd2bb5d623c1 100644
--- a/drivers/input/joystick/grip.c
+++ b/drivers/input/joystick/grip.c
@@ -76,8 +76,8 @@ static int grip_abs_dc[] = { ABS_X, ABS_Y, ABS_RX, ABS_RY, ABS_THROTTLE, ABS_HAT
static char *grip_name[] = { NULL, "Gravis GamePad Pro", "Gravis Blackhawk Digital",
"Gravis Xterminator Digital", "Gravis Xterminator DualControl" };
-static int *grip_abs[] = { 0, grip_abs_gpp, grip_abs_bd, grip_abs_xt, grip_abs_dc };
-static int *grip_btn[] = { 0, grip_btn_gpp, grip_btn_bd, grip_btn_xt, grip_btn_dc };
+static int *grip_abs[] = { NULL, grip_abs_gpp, grip_abs_bd, grip_abs_xt, grip_abs_dc };
+static int *grip_btn[] = { NULL, grip_btn_gpp, grip_btn_bd, grip_btn_xt, grip_btn_dc };
static char grip_anx[] = { 0, 0, 3, 5, 5 };
static char grip_cen[] = { 0, 0, 2, 2, 4 };
diff --git a/drivers/input/joystick/grip_mp.c b/drivers/input/joystick/grip_mp.c
index 995caa3e44d7..8e1949683e97 100644
--- a/drivers/input/joystick/grip_mp.c
+++ b/drivers/input/joystick/grip_mp.c
@@ -92,8 +92,8 @@ static int grip_btn_c64[] = { BTN_JOYSTICK, -1 };
static int grip_abs_gp[] = { ABS_X, ABS_Y, -1 };
static int grip_abs_c64[] = { ABS_X, ABS_Y, -1 };
-static int *grip_abs[] = { 0, 0, grip_abs_gp, grip_abs_c64 };
-static int *grip_btn[] = { 0, 0, grip_btn_gp, grip_btn_c64 };
+static int *grip_abs[] = { NULL, NULL, grip_abs_gp, grip_abs_c64 };
+static int *grip_btn[] = { NULL, NULL, grip_btn_gp, grip_btn_c64 };
static char *grip_name[] = { NULL, NULL, "Gravis Grip Pad", "Commodore 64 Joystick" };
diff --git a/drivers/isdn/act2000/act2000.h b/drivers/isdn/act2000/act2000.h
index aa219cbbc41f..b091d1a54125 100644
--- a/drivers/isdn/act2000/act2000.h
+++ b/drivers/isdn/act2000/act2000.h
@@ -15,6 +15,8 @@
#ifndef act2000_h
#define act2000_h
+#include <linux/compiler.h>
+
#define ACT2000_IOCTL_SETPORT 1
#define ACT2000_IOCTL_GETPORT 2
#define ACT2000_IOCTL_SETIRQ 3
@@ -46,7 +48,7 @@ typedef struct act2000_cdef {
/* Struct for downloading firmware */
typedef struct act2000_ddef {
int length; /* Length of code */
- char *buffer; /* Ptr. to code */
+ char __user *buffer; /* Ptr. to code */
} act2000_ddef;
typedef struct act2000_fwid {
diff --git a/drivers/isdn/act2000/act2000_isa.c b/drivers/isdn/act2000/act2000_isa.c
index 662a61e67d6b..e84aa5fb3449 100644
--- a/drivers/isdn/act2000/act2000_isa.c
+++ b/drivers/isdn/act2000/act2000_isa.c
@@ -405,7 +405,7 @@ act2000_isa_getid(act2000_card * card)
* Download microcode into card, check Firmware signature.
*/
int
-act2000_isa_download(act2000_card * card, act2000_ddef * cb)
+act2000_isa_download(act2000_card * card, act2000_ddef __user * cb)
{
unsigned int length;
int ret;
@@ -413,18 +413,18 @@ act2000_isa_download(act2000_card * card, act2000_ddef * cb)
int c;
long timeout;
u_char *b;
- u_char *p;
+ u_char __user *p;
u_char *buf;
act2000_ddef cblock;
if (!act2000_isa_reset(card->port))
return -ENXIO;
act2000_isa_delay(HZ / 2);
- if(copy_from_user(&cblock, (char *) cb, sizeof(cblock)))
+ if(copy_from_user(&cblock, cb, sizeof(cblock)))
return -EFAULT;
length = cblock.length;
p = cblock.buffer;
- if ((ret = verify_area(VERIFY_READ, (void *) p, length)))
+ if ((ret = verify_area(VERIFY_READ, p, length)))
return ret;
buf = (u_char *) kmalloc(1024, GFP_KERNEL);
if (!buf)
diff --git a/drivers/isdn/act2000/act2000_isa.h b/drivers/isdn/act2000/act2000_isa.h
index caee2ba8047f..ad86c5ed9aad 100644
--- a/drivers/isdn/act2000/act2000_isa.h
+++ b/drivers/isdn/act2000/act2000_isa.h
@@ -128,7 +128,7 @@ typedef enum {
extern int act2000_isa_detect(unsigned short portbase);
extern int act2000_isa_config_irq(act2000_card * card, short irq);
extern int act2000_isa_config_port(act2000_card * card, unsigned short portbase);
-extern int act2000_isa_download(act2000_card * card, act2000_ddef * cb);
+extern int act2000_isa_download(act2000_card * card, act2000_ddef __user * cb);
extern void act2000_isa_release(act2000_card * card);
extern void act2000_isa_receive(act2000_card *card);
extern void act2000_isa_send(act2000_card *card);
diff --git a/drivers/isdn/act2000/module.c b/drivers/isdn/act2000/module.c
index 6129c8e509d9..07522663b800 100644
--- a/drivers/isdn/act2000/module.c
+++ b/drivers/isdn/act2000/module.c
@@ -243,16 +243,18 @@ act2000_command(act2000_card * card, isdn_ctrl * c)
char tmp[17];
int ret;
unsigned long flags;
+ void __user *arg;
switch (c->command) {
case ISDN_CMD_IOCTL:
memcpy(&a, c->parm.num, sizeof(ulong));
+ arg = (void __user *)a;
switch (c->arg) {
case ACT2000_IOCTL_LOADBOOT:
switch (card->bus) {
case ACT2000_BUS_ISA:
ret = act2000_isa_download(card,
- (act2000_ddef *)a);
+ arg);
if (!ret) {
card->flags |= ACT2000_FLAGS_LOADED;
if (!(card->flags & ACT2000_FLAGS_IVALID)) {
@@ -278,7 +280,7 @@ act2000_command(act2000_card * card, isdn_ctrl * c)
actcapi_manufacturer_req_net(card);
return 0;
case ACT2000_IOCTL_SETMSN:
- if (copy_from_user(tmp, (char *)a,
+ if (copy_from_user(tmp, arg,
sizeof(tmp)))
return -EFAULT;
if ((ret = act2000_set_msn(card, tmp)))
@@ -287,7 +289,7 @@ act2000_command(act2000_card * card, isdn_ctrl * c)
return(actcapi_manufacturer_req_msn(card));
return 0;
case ACT2000_IOCTL_ADDCARD:
- if (copy_from_user(&cdef, (char *)a,
+ if (copy_from_user(&cdef, arg,
sizeof(cdef)))
return -EFAULT;
if (act2000_addcard(cdef.bus, cdef.port, cdef.irq, cdef.id))
@@ -463,18 +465,15 @@ act2000_sendbuf(act2000_card *card, int channel, int ack, struct sk_buff *skb)
/* Read the Status-replies from the Interface */
static int
-act2000_readstatus(u_char * buf, int len, int user, act2000_card * card)
+act2000_readstatus(u_char __user * buf, int len, act2000_card * card)
{
int count;
- u_char *p;
+ u_char __user *p;
for (p = buf, count = 0; count < len; p++, count++) {
if (card->status_buf_read == card->status_buf_write)
return count;
- if (user)
- put_user(*card->status_buf_read++, p);
- else
- *p = *card->status_buf_read++;
+ put_user(*card->status_buf_read++, p);
if (card->status_buf_read > card->status_buf_end)
card->status_buf_read = card->status_buf;
}
@@ -514,7 +513,7 @@ if_command(isdn_ctrl * c)
}
static int
-if_writecmd(const u_char * buf, int len, int user, int id, int channel)
+if_writecmd(const u_char __user *buf, int len, int id, int channel)
{
act2000_card *card = act2000_findcard(id);
@@ -529,14 +528,14 @@ if_writecmd(const u_char * buf, int len, int user, int id, int channel)
}
static int
-if_readstatus(u_char * buf, int len, int user, int id, int channel)
+if_readstatus(u_char __user * buf, int len, int id, int channel)
{
act2000_card *card = act2000_findcard(id);
if (card) {
if (!card->flags & ACT2000_FLAGS_RUNNING)
return -ENODEV;
- return (act2000_readstatus(buf, len, user, card));
+ return (act2000_readstatus(buf, len, card));
}
printk(KERN_ERR
"act2000: if_readstatus called with invalid driverId!\n");
diff --git a/drivers/isdn/capi/capi.c b/drivers/isdn/capi/capi.c
index 53c0acf229c7..42d7c6b97eb2 100644
--- a/drivers/isdn/capi/capi.c
+++ b/drivers/isdn/capi/capi.c
@@ -162,7 +162,7 @@ static int capincci_add_ack(struct capiminor *mp, u16 datahandle)
printk(KERN_ERR "capi: alloc datahandle failed\n");
return -1;
}
- n->next = 0;
+ n->next = NULL;
n->datahandle = datahandle;
for (pp = &mp->ackqueue; *pp; pp = &(*pp)->next) ;
*pp = n;
@@ -211,7 +211,7 @@ static struct capiminor *capiminor_alloc(struct capi20_appl *ap, u32 ncci)
mp = kmalloc(sizeof(*mp), GFP_ATOMIC);
if (!mp) {
printk(KERN_ERR "capi: can't alloc capiminor\n");
- return 0;
+ return NULL;
}
memset(mp, 0, sizeof(struct capiminor));
@@ -245,7 +245,7 @@ static struct capiminor *capiminor_alloc(struct capi20_appl *ap, u32 ncci)
if (!(minor < capi_ttyminors)) {
printk(KERN_NOTICE "capi: out of minors\n");
kfree(mp);
- return 0;
+ return NULL;
}
return mp;
@@ -260,7 +260,7 @@ static void capiminor_free(struct capiminor *mp)
write_unlock_irqrestore(&capiminor_list_lock, flags);
if (mp->ttyskb) kfree_skb(mp->ttyskb);
- mp->ttyskb = 0;
+ mp->ttyskb = NULL;
skb_queue_purge(&mp->inqueue);
skb_queue_purge(&mp->outqueue);
capiminor_del_all_ack(mp);
@@ -292,17 +292,17 @@ static struct capincci *capincci_alloc(struct capidev *cdev, u32 ncci)
{
struct capincci *np, **pp;
#ifdef CONFIG_ISDN_CAPI_MIDDLEWARE
- struct capiminor *mp = 0;
+ struct capiminor *mp = NULL;
#endif /* CONFIG_ISDN_CAPI_MIDDLEWARE */
np = kmalloc(sizeof(*np), GFP_ATOMIC);
if (!np)
- return 0;
+ return NULL;
memset(np, 0, sizeof(struct capincci));
np->ncci = ncci;
np->cdev = cdev;
#ifdef CONFIG_ISDN_CAPI_MIDDLEWARE
- mp = 0;
+ mp = NULL;
if (cdev->userflags & CAPIFLAG_HIGHJACKING)
mp = np->minorp = capiminor_alloc(&cdev->ap, ncci);
if (mp) {
@@ -339,7 +339,7 @@ static void capincci_free(struct capidev *cdev, u32 ncci)
capifs_free_ncci(mp->minor);
#endif
if (mp->tty) {
- mp->nccip = 0;
+ mp->nccip = NULL;
#ifdef _DEBUG_REFCOUNT
printk(KERN_DEBUG "reset mp->nccip\n");
#endif
@@ -377,7 +377,7 @@ static struct capidev *capidev_alloc(void)
cdev = kmalloc(sizeof(*cdev), GFP_KERNEL);
if (!cdev)
- return 0;
+ return NULL;
memset(cdev, 0, sizeof(struct capidev));
init_MUTEX(&cdev->ncci_list_sem);
@@ -473,7 +473,7 @@ static int handle_recv_skb(struct capiminor *mp, struct sk_buff *skb)
printk(KERN_DEBUG "capi: DATA_B3_RESP %u len=%d => ldisc\n",
datahandle, skb->len);
#endif
- mp->tty->ldisc.receive_buf(mp->tty, skb->data, 0, skb->len);
+ mp->tty->ldisc.receive_buf(mp->tty, skb->data, NULL, skb->len);
kfree_skb(skb);
return 0;
@@ -878,8 +878,7 @@ capi_ioctl(struct inode *inode, struct file *file,
struct capi_manufacturer_cmd mcmd;
if (!capable(CAP_SYS_ADMIN))
return -EPERM;
- if (copy_from_user(&mcmd, argp,
- sizeof(mcmd)))
+ if (copy_from_user(&mcmd, argp, sizeof(mcmd)))
return -EFAULT;
return capi20_manufacturer(mcmd.cmd, mcmd.data);
}
@@ -1026,8 +1025,8 @@ static void capinc_tty_close(struct tty_struct * tty, struct file * file)
#ifdef _DEBUG_REFCOUNT
printk(KERN_DEBUG "capinc_tty_close lastclose\n");
#endif
- tty->driver_data = (void *)0;
- mp->tty = 0;
+ tty->driver_data = NULL;
+ mp->tty = NULL;
}
#ifdef _DEBUG_REFCOUNT
printk(KERN_DEBUG "capinc_tty_close ocount=%d\n", atomic_read(&mp->ttyopencount));
@@ -1062,7 +1061,7 @@ static int capinc_tty_write(struct tty_struct * tty, int from_user,
skb = mp->ttyskb;
if (skb) {
- mp->ttyskb = 0;
+ mp->ttyskb = NULL;
skb_queue_tail(&mp->outqueue, skb);
mp->outbytes += skb->len;
}
@@ -1075,7 +1074,8 @@ static int capinc_tty_write(struct tty_struct * tty, int from_user,
skb_reserve(skb, CAPI_DATA_B3_REQ_LEN);
if (from_user) {
- if ((retval = copy_from_user(skb_put(skb, count), buf, count))) {
+ retval = copy_from_user(skb_put(skb, count), buf, count);
+ if (retval) {
kfree_skb(skb);
#ifdef _DEBUG_TTYFUNCS
printk(KERN_DEBUG "capinc_tty_write: copy_from_user=%d\n", retval);
@@ -1115,7 +1115,7 @@ static void capinc_tty_put_char(struct tty_struct *tty, unsigned char ch)
*(skb_put(skb, 1)) = ch;
return;
}
- mp->ttyskb = 0;
+ mp->ttyskb = NULL;
skb_queue_tail(&mp->outqueue, skb);
mp->outbytes += skb->len;
(void)handle_minor_send(mp);
@@ -1148,7 +1148,7 @@ static void capinc_tty_flush_chars(struct tty_struct *tty)
skb = mp->ttyskb;
if (skb) {
- mp->ttyskb = 0;
+ mp->ttyskb = NULL;
skb_queue_tail(&mp->outqueue, skb);
mp->outbytes += skb->len;
(void)handle_minor_send(mp);
@@ -1466,7 +1466,7 @@ static void __init proc_init(void)
for (i=0; i < nelem; i++) {
struct procfsentries *p = procfsentries + i;
- p->procent = create_proc_entry(p->name, p->mode, 0);
+ p->procent = create_proc_entry(p->name, p->mode, NULL);
if (p->procent) p->procent->read_proc = p->read_proc;
}
}
@@ -1479,8 +1479,8 @@ static void __exit proc_exit(void)
for (i=nelem-1; i >= 0; i--) {
struct procfsentries *p = procfsentries + i;
if (p->procent) {
- remove_proc_entry(p->name, 0);
- p->procent = 0;
+ remove_proc_entry(p->name, NULL);
+ p->procent = NULL;
}
}
}
diff --git a/drivers/isdn/capi/capidrv.c b/drivers/isdn/capi/capidrv.c
index 36ee8c2d0492..710665aff5be 100644
--- a/drivers/isdn/capi/capidrv.c
+++ b/drivers/isdn/capi/capidrv.c
@@ -230,7 +230,7 @@ static _cstruct b1config(int l2, int l3)
case ISDN_PROTO_L2_HDLC:
case ISDN_PROTO_L2_TRANS:
default:
- return 0;
+ return NULL;
case ISDN_PROTO_L2_V11096:
return b1config_async_v110(9600);
case ISDN_PROTO_L2_V11019:
@@ -336,7 +336,7 @@ static capidrv_plci *new_plci(capidrv_contr * card, int chan)
plcip = (capidrv_plci *) kmalloc(sizeof(capidrv_plci), GFP_ATOMIC);
if (plcip == 0)
- return 0;
+ return NULL;
memset(plcip, 0, sizeof(capidrv_plci));
plcip->state = ST_PLCI_NONE;
@@ -356,7 +356,7 @@ static capidrv_plci *find_plci_by_plci(capidrv_contr * card, u32 plci)
for (p = card->plci_list; p; p = p->next)
if (p->plci == plci)
return p;
- return 0;
+ return NULL;
}
static capidrv_plci *find_plci_by_msgid(capidrv_contr * card, u16 msgid)
@@ -365,7 +365,7 @@ static capidrv_plci *find_plci_by_msgid(capidrv_contr * card, u16 msgid)
for (p = card->plci_list; p; p = p->next)
if (p->msgid == msgid)
return p;
- return 0;
+ return NULL;
}
static capidrv_plci *find_plci_by_ncci(capidrv_contr * card, u32 ncci)
@@ -374,7 +374,7 @@ static capidrv_plci *find_plci_by_ncci(capidrv_contr * card, u32 ncci)
for (p = card->plci_list; p; p = p->next)
if (p->plci == (ncci & 0xffff))
return p;
- return 0;
+ return NULL;
}
static void free_plci(capidrv_contr * card, capidrv_plci * plcip)
@@ -384,7 +384,7 @@ static void free_plci(capidrv_contr * card, capidrv_plci * plcip)
for (pp = &card->plci_list; *pp; pp = &(*pp)->next) {
if (*pp == plcip) {
*pp = (*pp)->next;
- card->bchans[plcip->chan].plcip = 0;
+ card->bchans[plcip->chan].plcip = NULL;
card->bchans[plcip->chan].disconnecting = 0;
card->bchans[plcip->chan].incoming = 0;
kfree(plcip);
@@ -406,7 +406,7 @@ static inline capidrv_ncci *new_ncci(capidrv_contr * card,
nccip = (capidrv_ncci *) kmalloc(sizeof(capidrv_ncci), GFP_ATOMIC);
if (nccip == 0)
- return 0;
+ return NULL;
memset(nccip, 0, sizeof(capidrv_ncci));
nccip->ncci = ncci;
@@ -429,12 +429,12 @@ static inline capidrv_ncci *find_ncci(capidrv_contr * card, u32 ncci)
capidrv_ncci *p;
if ((plcip = find_plci_by_ncci(card, ncci)) == 0)
- return 0;
+ return NULL;
for (p = plcip->ncci_list; p; p = p->next)
if (p->ncci == ncci)
return p;
- return 0;
+ return NULL;
}
static inline capidrv_ncci *find_ncci_by_msgid(capidrv_contr * card,
@@ -444,12 +444,12 @@ static inline capidrv_ncci *find_ncci_by_msgid(capidrv_contr * card,
capidrv_ncci *p;
if ((plcip = find_plci_by_ncci(card, ncci)) == 0)
- return 0;
+ return NULL;
for (p = plcip->ncci_list; p; p = p->next)
if (p->msgid == msgid)
return p;
- return 0;
+ return NULL;
}
static void free_ncci(capidrv_contr * card, struct capidrv_ncci *nccip)
@@ -462,7 +462,7 @@ static void free_ncci(capidrv_contr * card, struct capidrv_ncci *nccip)
break;
}
}
- card->bchans[nccip->chan].nccip = 0;
+ card->bchans[nccip->chan].nccip = NULL;
kfree(nccip);
}
@@ -477,7 +477,7 @@ static int capidrv_add_ack(struct capidrv_ncci *nccip,
printk(KERN_ERR "capidrv: kmalloc ncci_datahandle failed\n");
return -1;
}
- n->next = 0;
+ n->next = NULL;
n->datahandle = datahandle;
n->len = len;
for (pp = &nccip->ackqueue; *pp; pp = &(*pp)->next) ;
@@ -560,7 +560,7 @@ static void p0(capidrv_contr * card, capidrv_plci * plci)
{
isdn_ctrl cmd;
- card->bchans[plci->chan].contr = 0;
+ card->bchans[plci->chan].contr = NULL;
cmd.command = ISDN_STAT_DHUP;
cmd.driver = card->myid;
cmd.arg = plci->chan;
@@ -580,54 +580,54 @@ struct plcistatechange {
static struct plcistatechange plcitable[] =
{
/* P-0 */
- {ST_PLCI_NONE, ST_PLCI_OUTGOING, EV_PLCI_CONNECT_REQ, 0},
- {ST_PLCI_NONE, ST_PLCI_ALLOCATED, EV_PLCI_FACILITY_IND_UP, 0},
- {ST_PLCI_NONE, ST_PLCI_INCOMING, EV_PLCI_CONNECT_IND, 0},
- {ST_PLCI_NONE, ST_PLCI_RESUMEING, EV_PLCI_RESUME_REQ, 0},
+ {ST_PLCI_NONE, ST_PLCI_OUTGOING, EV_PLCI_CONNECT_REQ, NULL},
+ {ST_PLCI_NONE, ST_PLCI_ALLOCATED, EV_PLCI_FACILITY_IND_UP, NULL},
+ {ST_PLCI_NONE, ST_PLCI_INCOMING, EV_PLCI_CONNECT_IND, NULL},
+ {ST_PLCI_NONE, ST_PLCI_RESUMEING, EV_PLCI_RESUME_REQ, NULL},
/* P-0.1 */
{ST_PLCI_OUTGOING, ST_PLCI_NONE, EV_PLCI_CONNECT_CONF_ERROR, p0},
- {ST_PLCI_OUTGOING, ST_PLCI_ALLOCATED, EV_PLCI_CONNECT_CONF_OK, 0},
+ {ST_PLCI_OUTGOING, ST_PLCI_ALLOCATED, EV_PLCI_CONNECT_CONF_OK, NULL},
/* P-1 */
- {ST_PLCI_ALLOCATED, ST_PLCI_ACTIVE, EV_PLCI_CONNECT_ACTIVE_IND, 0},
- {ST_PLCI_ALLOCATED, ST_PLCI_DISCONNECTING, EV_PLCI_DISCONNECT_REQ, 0},
- {ST_PLCI_ALLOCATED, ST_PLCI_DISCONNECTING, EV_PLCI_FACILITY_IND_DOWN, 0},
- {ST_PLCI_ALLOCATED, ST_PLCI_DISCONNECTED, EV_PLCI_DISCONNECT_IND, 0},
+ {ST_PLCI_ALLOCATED, ST_PLCI_ACTIVE, EV_PLCI_CONNECT_ACTIVE_IND, NULL},
+ {ST_PLCI_ALLOCATED, ST_PLCI_DISCONNECTING, EV_PLCI_DISCONNECT_REQ, NULL},
+ {ST_PLCI_ALLOCATED, ST_PLCI_DISCONNECTING, EV_PLCI_FACILITY_IND_DOWN, NULL},
+ {ST_PLCI_ALLOCATED, ST_PLCI_DISCONNECTED, EV_PLCI_DISCONNECT_IND, NULL},
/* P-ACT */
- {ST_PLCI_ACTIVE, ST_PLCI_DISCONNECTING, EV_PLCI_DISCONNECT_REQ, 0},
- {ST_PLCI_ACTIVE, ST_PLCI_DISCONNECTING, EV_PLCI_FACILITY_IND_DOWN, 0},
- {ST_PLCI_ACTIVE, ST_PLCI_DISCONNECTED, EV_PLCI_DISCONNECT_IND, 0},
- {ST_PLCI_ACTIVE, ST_PLCI_HELD, EV_PLCI_HOLD_IND, 0},
- {ST_PLCI_ACTIVE, ST_PLCI_DISCONNECTING, EV_PLCI_SUSPEND_IND, 0},
+ {ST_PLCI_ACTIVE, ST_PLCI_DISCONNECTING, EV_PLCI_DISCONNECT_REQ, NULL},
+ {ST_PLCI_ACTIVE, ST_PLCI_DISCONNECTING, EV_PLCI_FACILITY_IND_DOWN, NULL},
+ {ST_PLCI_ACTIVE, ST_PLCI_DISCONNECTED, EV_PLCI_DISCONNECT_IND, NULL},
+ {ST_PLCI_ACTIVE, ST_PLCI_HELD, EV_PLCI_HOLD_IND, NULL},
+ {ST_PLCI_ACTIVE, ST_PLCI_DISCONNECTING, EV_PLCI_SUSPEND_IND, NULL},
/* P-2 */
- {ST_PLCI_INCOMING, ST_PLCI_DISCONNECTING, EV_PLCI_CONNECT_REJECT, 0},
- {ST_PLCI_INCOMING, ST_PLCI_FACILITY_IND, EV_PLCI_FACILITY_IND_UP, 0},
- {ST_PLCI_INCOMING, ST_PLCI_ACCEPTING, EV_PLCI_CONNECT_RESP, 0},
- {ST_PLCI_INCOMING, ST_PLCI_DISCONNECTING, EV_PLCI_DISCONNECT_REQ, 0},
- {ST_PLCI_INCOMING, ST_PLCI_DISCONNECTING, EV_PLCI_FACILITY_IND_DOWN, 0},
- {ST_PLCI_INCOMING, ST_PLCI_DISCONNECTED, EV_PLCI_DISCONNECT_IND, 0},
- {ST_PLCI_INCOMING, ST_PLCI_DISCONNECTING, EV_PLCI_CD_IND, 0},
+ {ST_PLCI_INCOMING, ST_PLCI_DISCONNECTING, EV_PLCI_CONNECT_REJECT, NULL},
+ {ST_PLCI_INCOMING, ST_PLCI_FACILITY_IND, EV_PLCI_FACILITY_IND_UP, NULL},
+ {ST_PLCI_INCOMING, ST_PLCI_ACCEPTING, EV_PLCI_CONNECT_RESP, NULL},
+ {ST_PLCI_INCOMING, ST_PLCI_DISCONNECTING, EV_PLCI_DISCONNECT_REQ, NULL},
+ {ST_PLCI_INCOMING, ST_PLCI_DISCONNECTING, EV_PLCI_FACILITY_IND_DOWN, NULL},
+ {ST_PLCI_INCOMING, ST_PLCI_DISCONNECTED, EV_PLCI_DISCONNECT_IND, NULL},
+ {ST_PLCI_INCOMING, ST_PLCI_DISCONNECTING, EV_PLCI_CD_IND, NULL},
/* P-3 */
- {ST_PLCI_FACILITY_IND, ST_PLCI_DISCONNECTING, EV_PLCI_CONNECT_REJECT, 0},
- {ST_PLCI_FACILITY_IND, ST_PLCI_ACCEPTING, EV_PLCI_CONNECT_ACTIVE_IND, 0},
- {ST_PLCI_FACILITY_IND, ST_PLCI_DISCONNECTING, EV_PLCI_DISCONNECT_REQ, 0},
- {ST_PLCI_FACILITY_IND, ST_PLCI_DISCONNECTING, EV_PLCI_FACILITY_IND_DOWN, 0},
- {ST_PLCI_FACILITY_IND, ST_PLCI_DISCONNECTED, EV_PLCI_DISCONNECT_IND, 0},
+ {ST_PLCI_FACILITY_IND, ST_PLCI_DISCONNECTING, EV_PLCI_CONNECT_REJECT, NULL},
+ {ST_PLCI_FACILITY_IND, ST_PLCI_ACCEPTING, EV_PLCI_CONNECT_ACTIVE_IND, NULL},
+ {ST_PLCI_FACILITY_IND, ST_PLCI_DISCONNECTING, EV_PLCI_DISCONNECT_REQ, NULL},
+ {ST_PLCI_FACILITY_IND, ST_PLCI_DISCONNECTING, EV_PLCI_FACILITY_IND_DOWN, NULL},
+ {ST_PLCI_FACILITY_IND, ST_PLCI_DISCONNECTED, EV_PLCI_DISCONNECT_IND, NULL},
/* P-4 */
- {ST_PLCI_ACCEPTING, ST_PLCI_ACTIVE, EV_PLCI_CONNECT_ACTIVE_IND, 0},
- {ST_PLCI_ACCEPTING, ST_PLCI_DISCONNECTING, EV_PLCI_DISCONNECT_REQ, 0},
- {ST_PLCI_ACCEPTING, ST_PLCI_DISCONNECTING, EV_PLCI_FACILITY_IND_DOWN, 0},
- {ST_PLCI_ACCEPTING, ST_PLCI_DISCONNECTED, EV_PLCI_DISCONNECT_IND, 0},
+ {ST_PLCI_ACCEPTING, ST_PLCI_ACTIVE, EV_PLCI_CONNECT_ACTIVE_IND, NULL},
+ {ST_PLCI_ACCEPTING, ST_PLCI_DISCONNECTING, EV_PLCI_DISCONNECT_REQ, NULL},
+ {ST_PLCI_ACCEPTING, ST_PLCI_DISCONNECTING, EV_PLCI_FACILITY_IND_DOWN, NULL},
+ {ST_PLCI_ACCEPTING, ST_PLCI_DISCONNECTED, EV_PLCI_DISCONNECT_IND, NULL},
/* P-5 */
- {ST_PLCI_DISCONNECTING, ST_PLCI_DISCONNECTED, EV_PLCI_DISCONNECT_IND, 0},
+ {ST_PLCI_DISCONNECTING, ST_PLCI_DISCONNECTED, EV_PLCI_DISCONNECT_IND, NULL},
/* P-6 */
{ST_PLCI_DISCONNECTED, ST_PLCI_NONE, EV_PLCI_DISCONNECT_RESP, p0},
/* P-0.Res */
{ST_PLCI_RESUMEING, ST_PLCI_NONE, EV_PLCI_RESUME_CONF_ERROR, p0},
- {ST_PLCI_RESUMEING, ST_PLCI_RESUME, EV_PLCI_RESUME_CONF_OK, 0},
+ {ST_PLCI_RESUMEING, ST_PLCI_RESUME, EV_PLCI_RESUME_CONF_OK, NULL},
/* P-RES */
- {ST_PLCI_RESUME, ST_PLCI_ACTIVE, EV_PLCI_RESUME_IND, 0},
+ {ST_PLCI_RESUME, ST_PLCI_ACTIVE, EV_PLCI_RESUME_IND, NULL},
/* P-HELD */
- {ST_PLCI_HELD, ST_PLCI_ACTIVE, EV_PLCI_RETRIEVE_IND, 0},
+ {ST_PLCI_HELD, ST_PLCI_ACTIVE, EV_PLCI_RETRIEVE_IND, NULL},
{},
};
@@ -662,10 +662,10 @@ static void n0(capidrv_contr * card, capidrv_ncci * ncci)
global.ap.applid,
card->msgid++,
ncci->plcip->plci,
- 0, /* BChannelinformation */
- 0, /* Keypadfacility */
- 0, /* Useruserdata */ /* $$$$ */
- 0 /* Facilitydataarray */
+ NULL, /* BChannelinformation */
+ NULL, /* Keypadfacility */
+ NULL, /* Useruserdata */ /* $$$$ */
+ NULL /* Facilitydataarray */
);
send_message(card, &cmsg);
plci_change_state(card, ncci->plcip, EV_PLCI_DISCONNECT_REQ);
@@ -689,32 +689,32 @@ struct nccistatechange {
static struct nccistatechange nccitable[] =
{
/* N-0 */
- {ST_NCCI_NONE, ST_NCCI_OUTGOING, EV_NCCI_CONNECT_B3_REQ, 0},
- {ST_NCCI_NONE, ST_NCCI_INCOMING, EV_NCCI_CONNECT_B3_IND, 0},
+ {ST_NCCI_NONE, ST_NCCI_OUTGOING, EV_NCCI_CONNECT_B3_REQ, NULL},
+ {ST_NCCI_NONE, ST_NCCI_INCOMING, EV_NCCI_CONNECT_B3_IND, NULL},
/* N-0.1 */
- {ST_NCCI_OUTGOING, ST_NCCI_ALLOCATED, EV_NCCI_CONNECT_B3_CONF_OK, 0},
+ {ST_NCCI_OUTGOING, ST_NCCI_ALLOCATED, EV_NCCI_CONNECT_B3_CONF_OK, NULL},
{ST_NCCI_OUTGOING, ST_NCCI_NONE, EV_NCCI_CONNECT_B3_CONF_ERROR, n0},
/* N-1 */
- {ST_NCCI_INCOMING, ST_NCCI_DISCONNECTING, EV_NCCI_CONNECT_B3_REJECT, 0},
- {ST_NCCI_INCOMING, ST_NCCI_ALLOCATED, EV_NCCI_CONNECT_B3_RESP, 0},
- {ST_NCCI_INCOMING, ST_NCCI_DISCONNECTED, EV_NCCI_DISCONNECT_B3_IND, 0},
- {ST_NCCI_INCOMING, ST_NCCI_DISCONNECTING, EV_NCCI_DISCONNECT_B3_REQ, 0},
+ {ST_NCCI_INCOMING, ST_NCCI_DISCONNECTING, EV_NCCI_CONNECT_B3_REJECT, NULL},
+ {ST_NCCI_INCOMING, ST_NCCI_ALLOCATED, EV_NCCI_CONNECT_B3_RESP, NULL},
+ {ST_NCCI_INCOMING, ST_NCCI_DISCONNECTED, EV_NCCI_DISCONNECT_B3_IND, NULL},
+ {ST_NCCI_INCOMING, ST_NCCI_DISCONNECTING, EV_NCCI_DISCONNECT_B3_REQ, NULL},
/* N-2 */
- {ST_NCCI_ALLOCATED, ST_NCCI_ACTIVE, EV_NCCI_CONNECT_B3_ACTIVE_IND, 0},
- {ST_NCCI_ALLOCATED, ST_NCCI_DISCONNECTED, EV_NCCI_DISCONNECT_B3_IND, 0},
- {ST_NCCI_ALLOCATED, ST_NCCI_DISCONNECTING, EV_NCCI_DISCONNECT_B3_REQ, 0},
+ {ST_NCCI_ALLOCATED, ST_NCCI_ACTIVE, EV_NCCI_CONNECT_B3_ACTIVE_IND, NULL},
+ {ST_NCCI_ALLOCATED, ST_NCCI_DISCONNECTED, EV_NCCI_DISCONNECT_B3_IND, NULL},
+ {ST_NCCI_ALLOCATED, ST_NCCI_DISCONNECTING, EV_NCCI_DISCONNECT_B3_REQ, NULL},
/* N-ACT */
- {ST_NCCI_ACTIVE, ST_NCCI_ACTIVE, EV_NCCI_RESET_B3_IND, 0},
- {ST_NCCI_ACTIVE, ST_NCCI_RESETING, EV_NCCI_RESET_B3_REQ, 0},
- {ST_NCCI_ACTIVE, ST_NCCI_DISCONNECTED, EV_NCCI_DISCONNECT_B3_IND, 0},
- {ST_NCCI_ACTIVE, ST_NCCI_DISCONNECTING, EV_NCCI_DISCONNECT_B3_REQ, 0},
+ {ST_NCCI_ACTIVE, ST_NCCI_ACTIVE, EV_NCCI_RESET_B3_IND, NULL},
+ {ST_NCCI_ACTIVE, ST_NCCI_RESETING, EV_NCCI_RESET_B3_REQ, NULL},
+ {ST_NCCI_ACTIVE, ST_NCCI_DISCONNECTED, EV_NCCI_DISCONNECT_B3_IND, NULL},
+ {ST_NCCI_ACTIVE, ST_NCCI_DISCONNECTING, EV_NCCI_DISCONNECT_B3_REQ, NULL},
/* N-3 */
- {ST_NCCI_RESETING, ST_NCCI_ACTIVE, EV_NCCI_RESET_B3_IND, 0},
- {ST_NCCI_RESETING, ST_NCCI_DISCONNECTED, EV_NCCI_DISCONNECT_B3_IND, 0},
- {ST_NCCI_RESETING, ST_NCCI_DISCONNECTING, EV_NCCI_DISCONNECT_B3_REQ, 0},
+ {ST_NCCI_RESETING, ST_NCCI_ACTIVE, EV_NCCI_RESET_B3_IND, NULL},
+ {ST_NCCI_RESETING, ST_NCCI_DISCONNECTED, EV_NCCI_DISCONNECT_B3_IND, NULL},
+ {ST_NCCI_RESETING, ST_NCCI_DISCONNECTING, EV_NCCI_DISCONNECT_B3_REQ, NULL},
/* N-4 */
- {ST_NCCI_DISCONNECTING, ST_NCCI_DISCONNECTED, EV_NCCI_DISCONNECT_B3_IND, 0},
- {ST_NCCI_DISCONNECTING, ST_NCCI_PREVIOUS, EV_NCCI_DISCONNECT_B3_CONF_ERROR,0},
+ {ST_NCCI_DISCONNECTING, ST_NCCI_DISCONNECTED, EV_NCCI_DISCONNECT_B3_IND, NULL},
+ {ST_NCCI_DISCONNECTING, ST_NCCI_PREVIOUS, EV_NCCI_DISCONNECT_B3_CONF_ERROR,NULL},
/* N-5 */
{ST_NCCI_DISCONNECTED, ST_NCCI_NONE, EV_NCCI_DISCONNECT_B3_RESP, n0},
{},
@@ -821,7 +821,7 @@ static void handle_controller(_cmsg * cmsg)
goto ignored;
case CAPI_MANUFACTURER_CONF: /* Controller */
if (cmsg->ManuID == 0x214D5641) {
- char *s = 0;
+ char *s = NULL;
switch (cmsg->Class) {
case 0: break;
case 1: s = "unknown class"; break;
@@ -950,10 +950,10 @@ static void handle_incoming_call(capidrv_contr * card, _cmsg * cmsg)
global.ap.applid,
card->msgid++,
plcip->plci, /* adr */
- 0, /* BChannelinformation */
- 0, /* Keypadfacility */
- 0, /* Useruserdata */
- 0 /* Facilitydataarray */
+ NULL,/* BChannelinformation */
+ NULL,/* Keypadfacility */
+ NULL,/* Useruserdata */
+ NULL /* Facilitydataarray */
);
plcip->msgid = cmsg->Messagenumber;
send_message(card, cmsg);
@@ -1090,7 +1090,7 @@ static void handle_plci(_cmsg * cmsg)
global.ap.applid,
card->msgid++,
plcip->plci, /* adr */
- 0 /* NCPI */
+ NULL /* NCPI */
);
nccip->msgid = cmsg->Messagenumber;
send_message(card, cmsg);
@@ -1208,7 +1208,7 @@ static void handle_ncci(_cmsg * cmsg)
card->msgid++,
nccip->ncci, /* adr */
0, /* Reject */
- 0 /* NCPI */
+ NULL /* NCPI */
);
send_message(card, cmsg);
ncci_change_state(card, nccip, EV_NCCI_CONNECT_B3_RESP);
@@ -1226,7 +1226,7 @@ static void handle_ncci(_cmsg * cmsg)
card->msgid++,
cmsg->adr.adrNCCI,
2, /* Reject */
- 0 /* NCPI */
+ NULL /* NCPI */
);
send_message(card, cmsg);
break;
@@ -1624,22 +1624,22 @@ static int capidrv_command(isdn_ctrl * c, capidrv_contr * card)
si2cip(bchan->si1, bchan->si2), /* cipvalue */
called, /* CalledPartyNumber */
calling, /* CallingPartyNumber */
- 0, /* CalledPartySubaddress */
- 0, /* CallingPartySubaddress */
+ NULL, /* CalledPartySubaddress */
+ NULL, /* CallingPartySubaddress */
b1prot(bchan->l2, bchan->l3), /* B1protocol */
b2prot(bchan->l2, bchan->l3), /* B2protocol */
b3prot(bchan->l2, bchan->l3), /* B3protocol */
b1config(bchan->l2, bchan->l3), /* B1configuration */
- 0, /* B2configuration */
- 0, /* B3configuration */
- 0, /* BC */
- 0, /* LLC */
- 0, /* HLC */
+ NULL, /* B2configuration */
+ NULL, /* B3configuration */
+ NULL, /* BC */
+ NULL, /* LLC */
+ NULL, /* HLC */
/* BChannelinformation */
isleasedline ? AdditionalInfo : 0,
- 0, /* Keypadfacility */
- 0, /* Useruserdata */
- 0 /* Facilitydataarray */
+ NULL, /* Keypadfacility */
+ NULL, /* Useruserdata */
+ NULL /* Facilitydataarray */
);
if ((plcip = new_plci(card, (c->arg % card->nbchan))) == 0) {
cmd.command = ISDN_STAT_DHUP;
@@ -1672,15 +1672,15 @@ static int capidrv_command(isdn_ctrl * c, capidrv_contr * card)
b2prot(bchan->l2, bchan->l3), /* B2protocol */
b3prot(bchan->l2, bchan->l3), /* B3protocol */
b1config(bchan->l2, bchan->l3), /* B1configuration */
- 0, /* B2configuration */
- 0, /* B3configuration */
- 0, /* ConnectedNumber */
- 0, /* ConnectedSubaddress */
- 0, /* LLC */
- 0, /* BChannelinformation */
- 0, /* Keypadfacility */
- 0, /* Useruserdata */
- 0 /* Facilitydataarray */
+ NULL, /* B2configuration */
+ NULL, /* B3configuration */
+ NULL, /* ConnectedNumber */
+ NULL, /* ConnectedSubaddress */
+ NULL, /* LLC */
+ NULL, /* BChannelinformation */
+ NULL, /* Keypadfacility */
+ NULL, /* Useruserdata */
+ NULL /* Facilitydataarray */
);
capi_cmsg2message(&cmdcmsg, cmdcmsg.buf);
plci_change_state(card, bchan->plcip, EV_PLCI_CONNECT_RESP);
@@ -1714,7 +1714,7 @@ static int capidrv_command(isdn_ctrl * c, capidrv_contr * card)
global.ap.applid,
card->msgid++,
bchan->nccip->ncci,
- 0 /* NCPI */
+ NULL /* NCPI */
);
ncci_change_state(card, bchan->nccip, EV_NCCI_DISCONNECT_B3_REQ);
send_message(card, &cmdcmsg);
@@ -1735,10 +1735,10 @@ static int capidrv_command(isdn_ctrl * c, capidrv_contr * card)
global.ap.applid,
card->msgid++,
bchan->plcip->plci,
- 0, /* BChannelinformation */
- 0, /* Keypadfacility */
- 0, /* Useruserdata */
- 0 /* Facilitydataarray */
+ NULL, /* BChannelinformation */
+ NULL, /* Keypadfacility */
+ NULL, /* Useruserdata */
+ NULL /* Facilitydataarray */
);
plci_change_state(card, bchan->plcip, EV_PLCI_DISCONNECT_REQ);
send_message(card, &cmdcmsg);
@@ -1892,11 +1892,11 @@ static int if_sendbuf(int id, int channel, int doack, struct sk_buff *skb)
}
}
-static int if_readstat(u8 *buf, int len, int user, int id, int channel)
+static int if_readstat(u8 __user *buf, int len, int id, int channel)
{
capidrv_contr *card = findcontrbydriverid(id);
int count;
- u8 *p;
+ u8 __user *p;
if (!card) {
printk(KERN_ERR "capidrv: if_readstat called with invalid driverId %d!\n",
@@ -1905,10 +1905,7 @@ static int if_readstat(u8 *buf, int len, int user, int id, int channel)
}
for (p=buf, count=0; count < len; p++, count++) {
- if (user)
- put_user(*card->q931_read++, p);
- else
- *p = *card->q931_read++;
+ put_user(*card->q931_read++, p);
if (card->q931_read > card->q931_end)
card->q931_read = card->q931_buf;
}
@@ -1977,7 +1974,7 @@ static void send_listen(capidrv_contr *card)
1 << 6, /* Infomask */
card->cipmask,
card->cipmask2,
- 0, 0);
+ NULL, NULL);
send_message(card, &cmdcmsg);
listen_change_state(card, EV_LISTEN_REQ);
}
@@ -2028,7 +2025,7 @@ static int capidrv_addcontr(u16 contr, struct capi_profile *profp)
card->interface.maxbufsize = 2048;
card->interface.command = if_command;
card->interface.writebuf_skb = if_sendbuf;
- card->interface.writecmd = 0;
+ card->interface.writecmd = NULL;
card->interface.readstat = if_readstat;
card->interface.features = ISDN_FEATURE_L2_HDLC |
ISDN_FEATURE_L2_TRANS |
@@ -2141,7 +2138,7 @@ static int capidrv_delcontr(u16 contr)
card->nbchan--;
}
kfree(card->bchans);
- card->bchans = 0;
+ card->bchans = NULL;
if (debugmode)
printk(KERN_DEBUG "capidrv-%d: id=%d isdn unload\n",
@@ -2159,7 +2156,7 @@ static int capidrv_delcontr(u16 contr)
for (pp = &global.contr_list; *pp; pp = &(*pp)->next) {
if (*pp == card) {
*pp = (*pp)->next;
- card->next = 0;
+ card->next = NULL;
global.ncontr--;
break;
}
@@ -2228,7 +2225,7 @@ static void __init proc_init(void)
for (i=0; i < nelem; i++) {
struct procfsentries *p = procfsentries + i;
- p->procent = create_proc_entry(p->name, p->mode, 0);
+ p->procent = create_proc_entry(p->name, p->mode, NULL);
if (p->procent) p->procent->read_proc = p->read_proc;
}
}
@@ -2241,8 +2238,8 @@ static void __exit proc_exit(void)
for (i=nelem-1; i >= 0; i--) {
struct procfsentries *p = procfsentries + i;
if (p->procent) {
- remove_proc_entry(p->name, 0);
- p->procent = 0;
+ remove_proc_entry(p->name, NULL);
+ p->procent = NULL;
}
}
}
diff --git a/drivers/isdn/capi/capilib.c b/drivers/isdn/capi/capilib.c
index 00d8795b9cc7..68409d971e73 100644
--- a/drivers/isdn/capi/capilib.c
+++ b/drivers/isdn/capi/capilib.c
@@ -30,8 +30,8 @@ struct capilib_ncci {
static inline void mq_init(struct capilib_ncci * np)
{
u_int i;
- np->msgidqueue = 0;
- np->msgidlast = 0;
+ np->msgidqueue = NULL;
+ np->msgidlast = NULL;
np->nmsg = 0;
memset(np->msgidpool, 0, sizeof(np->msgidpool));
np->msgidfree = &np->msgidpool[0];
@@ -48,7 +48,7 @@ static inline int mq_enqueue(struct capilib_ncci * np, u16 msgid)
return 0;
np->msgidfree = mq->next;
mq->msgid = msgid;
- mq->next = 0;
+ mq->next = NULL;
if (np->msgidlast)
np->msgidlast->next = mq;
np->msgidlast = mq;
@@ -66,7 +66,7 @@ static inline int mq_dequeue(struct capilib_ncci * np, u16 msgid)
struct capilib_msgidqueue *mq = *pp;
*pp = mq->next;
if (mq == np->msgidlast)
- np->msgidlast = 0;
+ np->msgidlast = NULL;
mq->next = np->msgidfree;
np->msgidfree = mq;
np->nmsg--;
diff --git a/drivers/isdn/capi/capiutil.c b/drivers/isdn/capi/capiutil.c
index c26dec646a87..e7cf6bc286a6 100644
--- a/drivers/isdn/capi/capiutil.c
+++ b/drivers/isdn/capi/capiutil.c
@@ -335,85 +335,54 @@ static _cdef cdef[] =
static unsigned char *cpars[] =
{
- /*00 */ 0,
- /*01 ALERT_REQ */ (unsigned char *) "\x03\x04\x0c\x27\x2f\x1c\x01\x01",
- /*02 CONNECT_REQ */ (unsigned char *) "\x03\x14\x0e\x10\x0f\x11\x0d\x06\x08\x0a\x05\x07\x09\x01\x0b\x28\x22\x04\x0c\x27\x2f\x1c\x01\x01",
- /*03 */ 0,
- /*04 DISCONNECT_REQ */ (unsigned char *) "\x03\x04\x0c\x27\x2f\x1c\x01\x01",
- /*05 LISTEN_REQ */ (unsigned char *) "\x03\x25\x12\x13\x10\x11\x01",
- /*06 */ 0,
- /*07 */ 0,
- /*08 INFO_REQ */ (unsigned char *) "\x03\x0e\x04\x0c\x27\x2f\x1c\x01\x01",
- /*09 FACILITY_REQ */ (unsigned char *) "\x03\x1f\x1e\x01",
- /*0a SELECT_B_PROTOCOL_REQ */ (unsigned char *) "\x03\x0d\x06\x08\x0a\x05\x07\x09\x01\x01",
- /*0b CONNECT_B3_REQ */ (unsigned char *) "\x03\x2b\x01",
- /*0c */ 0,
- /*0d DISCONNECT_B3_REQ */ (unsigned char *) "\x03\x2b\x01",
- /*0e */ 0,
- /*0f DATA_B3_REQ */ (unsigned char *) "\x03\x18\x1a\x19\x20\x01",
- /*10 RESET_B3_REQ */ (unsigned char *) "\x03\x2b\x01",
- /*11 */ 0,
- /*12 */ 0,
- /*13 ALERT_CONF */ (unsigned char *) "\x03\x23\x01",
- /*14 CONNECT_CONF */ (unsigned char *) "\x03\x23\x01",
- /*15 */ 0,
- /*16 DISCONNECT_CONF */ (unsigned char *) "\x03\x23\x01",
- /*17 LISTEN_CONF */ (unsigned char *) "\x03\x23\x01",
- /*18 MANUFACTURER_REQ */ (unsigned char *) "\x03\x2a\x15\x21\x29\x01",
- /*19 */ 0,
- /*1a INFO_CONF */ (unsigned char *) "\x03\x23\x01",
- /*1b FACILITY_CONF */ (unsigned char *) "\x03\x23\x1f\x1b\x01",
- /*1c SELECT_B_PROTOCOL_CONF */ (unsigned char *) "\x03\x23\x01",
- /*1d CONNECT_B3_CONF */ (unsigned char *) "\x03\x23\x01",
- /*1e */ 0,
- /*1f DISCONNECT_B3_CONF */ (unsigned char *) "\x03\x23\x01",
- /*20 */ 0,
- /*21 DATA_B3_CONF */ (unsigned char *) "\x03\x19\x23\x01",
- /*22 RESET_B3_CONF */ (unsigned char *) "\x03\x23\x01",
- /*23 */ 0,
- /*24 */ 0,
- /*25 */ 0,
- /*26 CONNECT_IND */ (unsigned char *) "\x03\x14\x0e\x10\x0f\x11\x0b\x28\x22\x04\x0c\x27\x2f\x1c\x01\x01",
- /*27 CONNECT_ACTIVE_IND */ (unsigned char *) "\x03\x16\x17\x28\x01",
- /*28 DISCONNECT_IND */ (unsigned char *) "\x03\x2c\x01",
- /*29 */ 0,
- /*2a MANUFACTURER_CONF */ (unsigned char *) "\x03\x2a\x15\x21\x29\x01",
- /*2b */ 0,
- /*2c INFO_IND */ (unsigned char *) "\x03\x26\x24\x01",
- /*2d FACILITY_IND */ (unsigned char *) "\x03\x1f\x1d\x01",
- /*2e */ 0,
- /*2f CONNECT_B3_IND */ (unsigned char *) "\x03\x2b\x01",
- /*30 CONNECT_B3_ACTIVE_IND */ (unsigned char *) "\x03\x2b\x01",
- /*31 DISCONNECT_B3_IND */ (unsigned char *) "\x03\x2d\x2b\x01",
- /*32 */ 0,
- /*33 DATA_B3_IND */ (unsigned char *) "\x03\x18\x1a\x19\x20\x01",
- /*34 RESET_B3_IND */ (unsigned char *) "\x03\x2b\x01",
- /*35 CONNECT_B3_T90_ACTIVE_IND */ (unsigned char *) "\x03\x2b\x01",
- /*36 */ 0,
- /*37 */ 0,
- /*38 CONNECT_RESP */ (unsigned char *) "\x03\x2e\x0d\x06\x08\x0a\x05\x07\x09\x01\x16\x17\x28\x04\x0c\x27\x2f\x1c\x01\x01",
- /*39 CONNECT_ACTIVE_RESP */ (unsigned char *) "\x03\x01",
- /*3a DISCONNECT_RESP */ (unsigned char *) "\x03\x01",
- /*3b */ 0,
- /*3c MANUFACTURER_IND */ (unsigned char *) "\x03\x2a\x15\x21\x29\x01",
- /*3d */ 0,
- /*3e INFO_RESP */ (unsigned char *) "\x03\x01",
- /*3f FACILITY_RESP */ (unsigned char *) "\x03\x1f\x01",
- /*40 */ 0,
- /*41 CONNECT_B3_RESP */ (unsigned char *) "\x03\x2e\x2b\x01",
- /*42 CONNECT_B3_ACTIVE_RESP */ (unsigned char *) "\x03\x01",
- /*43 DISCONNECT_B3_RESP */ (unsigned char *) "\x03\x01",
- /*44 */ 0,
- /*45 DATA_B3_RESP */ (unsigned char *) "\x03\x19\x01",
- /*46 RESET_B3_RESP */ (unsigned char *) "\x03\x01",
- /*47 CONNECT_B3_T90_ACTIVE_RESP */ (unsigned char *) "\x03\x01",
- /*48 */ 0,
- /*49 */ 0,
- /*4a */ 0,
- /*4b */ 0,
- /*4c */ 0,
- /*4d */ 0,
- /*4e MANUFACTURER_RESP */ (unsigned char *) "\x03\x2a\x15\x21\x29\x01",
+ /* ALERT_REQ */ [0x01] = "\x03\x04\x0c\x27\x2f\x1c\x01\x01",
+ /* CONNECT_REQ */ [0x02] = "\x03\x14\x0e\x10\x0f\x11\x0d\x06\x08\x0a\x05\x07\x09\x01\x0b\x28\x22\x04\x0c\x27\x2f\x1c\x01\x01",
+ /* DISCONNECT_REQ */ [0x04] = "\x03\x04\x0c\x27\x2f\x1c\x01\x01",
+ /* LISTEN_REQ */ [0x05] = "\x03\x25\x12\x13\x10\x11\x01",
+ /* INFO_REQ */ [0x08] = "\x03\x0e\x04\x0c\x27\x2f\x1c\x01\x01",
+ /* FACILITY_REQ */ [0x09] = "\x03\x1f\x1e\x01",
+ /* SELECT_B_PROTOCOL_REQ */ [0x0a] = "\x03\x0d\x06\x08\x0a\x05\x07\x09\x01\x01",
+ /* CONNECT_B3_REQ */ [0x0b] = "\x03\x2b\x01",
+ /* DISCONNECT_B3_REQ */ [0x0d] = "\x03\x2b\x01",
+ /* DATA_B3_REQ */ [0x0f] = "\x03\x18\x1a\x19\x20\x01",
+ /* RESET_B3_REQ */ [0x10] = "\x03\x2b\x01",
+ /* ALERT_CONF */ [0x13] = "\x03\x23\x01",
+ /* CONNECT_CONF */ [0x14] = "\x03\x23\x01",
+ /* DISCONNECT_CONF */ [0x16] = "\x03\x23\x01",
+ /* LISTEN_CONF */ [0x17] = "\x03\x23\x01",
+ /* MANUFACTURER_REQ */ [0x18] = "\x03\x2a\x15\x21\x29\x01",
+ /* INFO_CONF */ [0x1a] = "\x03\x23\x01",
+ /* FACILITY_CONF */ [0x1b] = "\x03\x23\x1f\x1b\x01",
+ /* SELECT_B_PROTOCOL_CONF */ [0x1c] = "\x03\x23\x01",
+ /* CONNECT_B3_CONF */ [0x1d] = "\x03\x23\x01",
+ /* DISCONNECT_B3_CONF */ [0x1f] = "\x03\x23\x01",
+ /* DATA_B3_CONF */ [0x21] = "\x03\x19\x23\x01",
+ /* RESET_B3_CONF */ [0x22] = "\x03\x23\x01",
+ /* CONNECT_IND */ [0x26] = "\x03\x14\x0e\x10\x0f\x11\x0b\x28\x22\x04\x0c\x27\x2f\x1c\x01\x01",
+ /* CONNECT_ACTIVE_IND */ [0x27] = "\x03\x16\x17\x28\x01",
+ /* DISCONNECT_IND */ [0x28] = "\x03\x2c\x01",
+ /* MANUFACTURER_CONF */ [0x2a] = "\x03\x2a\x15\x21\x29\x01",
+ /* INFO_IND */ [0x2c] = "\x03\x26\x24\x01",
+ /* FACILITY_IND */ [0x2d] = "\x03\x1f\x1d\x01",
+ /* CONNECT_B3_IND */ [0x2f] = "\x03\x2b\x01",
+ /* CONNECT_B3_ACTIVE_IND */ [0x30] = "\x03\x2b\x01",
+ /* DISCONNECT_B3_IND */ [0x31] = "\x03\x2d\x2b\x01",
+ /* DATA_B3_IND */ [0x33] = "\x03\x18\x1a\x19\x20\x01",
+ /* RESET_B3_IND */ [0x34] = "\x03\x2b\x01",
+ /* CONNECT_B3_T90_ACTIVE_IND */ [0x35] = "\x03\x2b\x01",
+ /* CONNECT_RESP */ [0x38] = "\x03\x2e\x0d\x06\x08\x0a\x05\x07\x09\x01\x16\x17\x28\x04\x0c\x27\x2f\x1c\x01\x01",
+ /* CONNECT_ACTIVE_RESP */ [0x39] = "\x03\x01",
+ /* DISCONNECT_RESP */ [0x3a] = "\x03\x01",
+ /* MANUFACTURER_IND */ [0x3c] = "\x03\x2a\x15\x21\x29\x01",
+ /* INFO_RESP */ [0x3e] = "\x03\x01",
+ /* FACILITY_RESP */ [0x3f] = "\x03\x1f\x01",
+ /* CONNECT_B3_RESP */ [0x41] = "\x03\x2e\x2b\x01",
+ /* CONNECT_B3_ACTIVE_RESP */ [0x42] = "\x03\x01",
+ /* DISCONNECT_B3_RESP */ [0x43] = "\x03\x01",
+ /* DATA_B3_RESP */ [0x45] = "\x03\x19\x01",
+ /* RESET_B3_RESP */ [0x46] = "\x03\x01",
+ /* CONNECT_B3_T90_ACTIVE_RESP */ [0x47] = "\x03\x01",
+ /* MANUFACTURER_RESP */ [0x4e] = "\x03\x2a\x15\x21\x29\x01",
};
/*-------------------------------------------------------*/
@@ -623,85 +592,54 @@ unsigned capi_cmsg_header(_cmsg * cmsg, u16 _ApplId,
static char *mnames[] =
{
- 0,
- "ALERT_REQ",
- "CONNECT_REQ",
- 0,
- "DISCONNECT_REQ",
- "LISTEN_REQ",
- 0,
- 0,
- "INFO_REQ",
- "FACILITY_REQ",
- "SELECT_B_PROTOCOL_REQ",
- "CONNECT_B3_REQ",
- 0,
- "DISCONNECT_B3_REQ",
- 0,
- "DATA_B3_REQ",
- "RESET_B3_REQ",
- 0,
- 0,
- "ALERT_CONF",
- "CONNECT_CONF",
- 0,
- "DISCONNECT_CONF",
- "LISTEN_CONF",
- "MANUFACTURER_REQ",
- 0,
- "INFO_CONF",
- "FACILITY_CONF",
- "SELECT_B_PROTOCOL_CONF",
- "CONNECT_B3_CONF",
- 0,
- "DISCONNECT_B3_CONF",
- 0,
- "DATA_B3_CONF",
- "RESET_B3_CONF",
- 0,
- 0,
- 0,
- "CONNECT_IND",
- "CONNECT_ACTIVE_IND",
- "DISCONNECT_IND",
- 0,
- "MANUFACTURER_CONF",
- 0,
- "INFO_IND",
- "FACILITY_IND",
- 0,
- "CONNECT_B3_IND",
- "CONNECT_B3_ACTIVE_IND",
- "DISCONNECT_B3_IND",
- 0,
- "DATA_B3_IND",
- "RESET_B3_IND",
- "CONNECT_B3_T90_ACTIVE_IND",
- 0,
- 0,
- "CONNECT_RESP",
- "CONNECT_ACTIVE_RESP",
- "DISCONNECT_RESP",
- 0,
- "MANUFACTURER_IND",
- 0,
- "INFO_RESP",
- "FACILITY_RESP",
- 0,
- "CONNECT_B3_RESP",
- "CONNECT_B3_ACTIVE_RESP",
- "DISCONNECT_B3_RESP",
- 0,
- "DATA_B3_RESP",
- "RESET_B3_RESP",
- "CONNECT_B3_T90_ACTIVE_RESP",
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- "MANUFACTURER_RESP"
+ [0x01] = "ALERT_REQ",
+ [0x02] = "CONNECT_REQ",
+ [0x04] = "DISCONNECT_REQ",
+ [0x05] = "LISTEN_REQ",
+ [0x08] = "INFO_REQ",
+ [0x09] = "FACILITY_REQ",
+ [0x0a] = "SELECT_B_PROTOCOL_REQ",
+ [0x0b] = "CONNECT_B3_REQ",
+ [0x0d] = "DISCONNECT_B3_REQ",
+ [0x0f] = "DATA_B3_REQ",
+ [0x10] = "RESET_B3_REQ",
+ [0x13] = "ALERT_CONF",
+ [0x14] = "CONNECT_CONF",
+ [0x16] = "DISCONNECT_CONF",
+ [0x17] = "LISTEN_CONF",
+ [0x18] = "MANUFACTURER_REQ",
+ [0x1a] = "INFO_CONF",
+ [0x1b] = "FACILITY_CONF",
+ [0x1c] = "SELECT_B_PROTOCOL_CONF",
+ [0x1d] = "CONNECT_B3_CONF",
+ [0x1f] = "DISCONNECT_B3_CONF",
+ [0x21] = "DATA_B3_CONF",
+ [0x22] = "RESET_B3_CONF",
+ [0x26] = "CONNECT_IND",
+ [0x27] = "CONNECT_ACTIVE_IND",
+ [0x28] = "DISCONNECT_IND",
+ [0x2a] = "MANUFACTURER_CONF",
+ [0x2c] = "INFO_IND",
+ [0x2d] = "FACILITY_IND",
+ [0x2f] = "CONNECT_B3_IND",
+ [0x30] = "CONNECT_B3_ACTIVE_IND",
+ [0x31] = "DISCONNECT_B3_IND",
+ [0x33] = "DATA_B3_IND",
+ [0x34] = "RESET_B3_IND",
+ [0x35] = "CONNECT_B3_T90_ACTIVE_IND",
+ [0x38] = "CONNECT_RESP",
+ [0x39] = "CONNECT_ACTIVE_RESP",
+ [0x3a] = "DISCONNECT_RESP",
+ [0x3c] = "MANUFACTURER_IND",
+ [0x3e] = "INFO_RESP",
+ [0x3f] = "FACILITY_RESP",
+ [0x41] = "CONNECT_B3_RESP",
+ [0x42] = "CONNECT_B3_ACTIVE_RESP",
+ [0x43] = "DISCONNECT_B3_RESP",
+ [0x45] = "DATA_B3_RESP",
+ [0x46] = "RESET_B3_RESP",
+ [0x47] = "CONNECT_B3_T90_ACTIVE_RESP",
+ [0x4e] = "MANUFACTURER_RESP"
};
char *capi_cmd2str(u8 cmd, u8 subcmd)
@@ -715,9 +653,9 @@ char *capi_cmd2str(u8 cmd, u8 subcmd)
static char *pnames[] =
{
- /*00 */ 0,
- /*01 */ 0,
- /*02 */ 0,
+ /*00 */ NULL,
+ /*01 */ NULL,
+ /*02 */ NULL,
/*03 */ "Controller/PLCI/NCCI",
/*04 */ "AdditionalInfo",
/*05 */ "B1configuration",
@@ -767,7 +705,7 @@ static char *pnames[] =
static char buf[8192];
-static char *p = 0;
+static char *p = NULL;
#include <stdarg.h>
diff --git a/drivers/isdn/capi/kcapi.c b/drivers/isdn/capi/kcapi.c
index 8524997b10b6..8d58cfd45b0e 100644
--- a/drivers/isdn/capi/kcapi.c
+++ b/drivers/isdn/capi/kcapi.c
@@ -193,7 +193,7 @@ static void notify_down(u32 contr)
for (applid = 1; applid <= CAPI_MAXAPPL; applid++) {
ap = get_capi_appl_by_nr(applid);
if (ap && ap->callback && !ap->release_in_progress)
- ap->callback(KCI_CONTRDOWN, contr, 0);
+ ap->callback(KCI_CONTRDOWN, contr, NULL);
}
}
@@ -421,7 +421,7 @@ attach_capi_ctr(struct capi_ctr *card)
card->traceflag = showcapimsgs;
sprintf(card->procfn, "capi/controllers/%d", card->cnr);
- card->procent = create_proc_entry(card->procfn, 0, 0);
+ card->procent = create_proc_entry(card->procfn, 0, NULL);
if (card->procent) {
card->procent->read_proc =
(int (*)(char *,char **,off_t,int,int *,void *))
@@ -445,8 +445,8 @@ int detach_capi_ctr(struct capi_ctr *card)
ncards--;
if (card->procent) {
- remove_proc_entry(card->procfn, 0);
- card->procent = 0;
+ remove_proc_entry(card->procfn, NULL);
+ card->procent = NULL;
}
capi_cards[card->cnr - 1] = NULL;
printk(KERN_NOTICE "kcapi: Controller %d: %s unregistered\n",
@@ -524,7 +524,7 @@ u16 capi20_register(struct capi20_appl *ap)
ap->nrecvdatapkt = 0;
ap->nsentctlpkt = 0;
ap->nsentdatapkt = 0;
- ap->callback = 0;
+ ap->callback = NULL;
init_MUTEX(&ap->recv_sem);
skb_queue_head_init(&ap->recv_queue);
INIT_WORK(&ap->recv_work, recv_handler, (void *)ap);
@@ -711,14 +711,14 @@ u16 capi20_get_profile(u32 contr, struct capi_profile *profp)
EXPORT_SYMBOL(capi20_get_profile);
#ifdef CONFIG_AVMB1_COMPAT
-static int old_capi_manufacturer(unsigned int cmd, void *data)
+static int old_capi_manufacturer(unsigned int cmd, void __user *data)
{
avmb1_loadandconfigdef ldef;
avmb1_extcarddef cdef;
avmb1_resetdef rdef;
capicardparams cparams;
struct capi_ctr *card;
- struct capi_driver *driver = 0;
+ struct capi_driver *driver = NULL;
capiloaddata ldata;
struct list_head *l;
unsigned long flags;
@@ -728,12 +728,12 @@ static int old_capi_manufacturer(unsigned int cmd, void *data)
case AVMB1_ADDCARD:
case AVMB1_ADDCARD_WITH_TYPE:
if (cmd == AVMB1_ADDCARD) {
- if ((retval = copy_from_user((void *) &cdef, data,
+ if ((retval = copy_from_user(&cdef, data,
sizeof(avmb1_carddef))))
return retval;
cdef.cardtype = AVM_CARDTYPE_B1;
} else {
- if ((retval = copy_from_user((void *) &cdef, data,
+ if ((retval = copy_from_user(&cdef, data,
sizeof(avmb1_extcarddef))))
return retval;
}
@@ -758,7 +758,7 @@ static int old_capi_manufacturer(unsigned int cmd, void *data)
}
break;
default:
- driver = 0;
+ driver = NULL;
break;
}
if (!driver) {
@@ -780,13 +780,13 @@ static int old_capi_manufacturer(unsigned int cmd, void *data)
case AVMB1_LOAD_AND_CONFIG:
if (cmd == AVMB1_LOAD) {
- if (copy_from_user((void *)&ldef, data,
+ if (copy_from_user(&ldef, data,
sizeof(avmb1_loaddef)))
return -EFAULT;
ldef.t4config.len = 0;
- ldef.t4config.data = 0;
+ ldef.t4config.data = NULL;
} else {
- if (copy_from_user((void *)&ldef, data,
+ if (copy_from_user(&ldef, data,
sizeof(avmb1_loadandconfigdef)))
return -EFAULT;
}
@@ -843,7 +843,7 @@ static int old_capi_manufacturer(unsigned int cmd, void *data)
return 0;
case AVMB1_RESETCARD:
- if (copy_from_user((void *)&rdef, data, sizeof(avmb1_resetdef)))
+ if (copy_from_user(&rdef, data, sizeof(avmb1_resetdef)))
return -EFAULT;
card = get_capi_ctr_by_nr(rdef.contr);
if (!card)
@@ -869,7 +869,7 @@ static int old_capi_manufacturer(unsigned int cmd, void *data)
}
#endif
-int capi20_manufacturer(unsigned int cmd, void *data)
+int capi20_manufacturer(unsigned int cmd, void __user *data)
{
struct capi_ctr *card;
@@ -886,7 +886,7 @@ int capi20_manufacturer(unsigned int cmd, void *data)
{
kcapi_flagdef fdef;
- if (copy_from_user((void *)&fdef, data, sizeof(kcapi_flagdef)))
+ if (copy_from_user(&fdef, data, sizeof(kcapi_flagdef)))
return -EFAULT;
card = get_capi_ctr_by_nr(fdef.contr);
@@ -901,13 +901,12 @@ int capi20_manufacturer(unsigned int cmd, void *data)
case KCAPI_CMD_ADDCARD:
{
struct list_head *l;
- struct capi_driver *driver = 0;
+ struct capi_driver *driver = NULL;
capicardparams cparams;
kcapi_carddef cdef;
int retval;
- if ((retval = copy_from_user((void *) &cdef, data,
- sizeof(cdef))))
+ if ((retval = copy_from_user(&cdef, data, sizeof(cdef))))
return retval;
cparams.port = cdef.port;
diff --git a/drivers/isdn/capi/kcapi_proc.c b/drivers/isdn/capi/kcapi_proc.c
index 195be3b8bf38..16dc5418ff41 100644
--- a/drivers/isdn/capi/kcapi_proc.c
+++ b/drivers/isdn/capi/kcapi_proc.c
@@ -246,7 +246,7 @@ create_seq_entry(char *name, mode_t mode, struct file_operations *f)
static __inline__ struct capi_driver *capi_driver_get_idx(loff_t pos)
{
- struct capi_driver *drv = 0;
+ struct capi_driver *drv = NULL;
struct list_head *l;
loff_t i;
@@ -256,7 +256,7 @@ static __inline__ struct capi_driver *capi_driver_get_idx(loff_t pos)
if (i++ == pos)
return drv;
}
- return 0;
+ return NULL;
}
static void *capi_driver_start(struct seq_file *seq, loff_t *pos)
@@ -271,7 +271,7 @@ static void *capi_driver_next(struct seq_file *seq, void *v, loff_t *pos)
{
struct capi_driver *drv = (struct capi_driver *)v;
++*pos;
- if (drv->list.next == &capi_drivers) return 0;
+ if (drv->list.next == &capi_drivers) return NULL;
return list_entry(drv->list.next, struct capi_driver, list);
}
diff --git a/drivers/isdn/hardware/eicon/capifunc.c b/drivers/isdn/hardware/eicon/capifunc.c
index ba5dc752f2fe..15d081a09f64 100644
--- a/drivers/isdn/hardware/eicon/capifunc.c
+++ b/drivers/isdn/hardware/eicon/capifunc.c
@@ -228,7 +228,7 @@ void sendf(APPL * appl, word command, dword Id, word Number, byte * format, ...)
word length = 12, dlength = 0;
byte *write;
CAPI_MSG msg;
- byte *string = 0;
+ byte *string = NULL;
va_list ap;
diva_os_message_buffer_s *dmb;
diva_card *card = NULL;
@@ -1072,7 +1072,7 @@ static int divacapi_connect_didd(void)
req.didd_notify.e.Rc =
IDI_SYNC_REQ_DIDD_REGISTER_ADAPTER_NOTIFY;
req.didd_notify.info.callback = (void *)didd_callback;
- req.didd_notify.info.context = 0;
+ req.didd_notify.info.context = NULL;
DAdapter.request((ENTITY *) & req);
if (req.didd_notify.e.Rc != 0xff) {
stop_dbg();
diff --git a/drivers/isdn/hardware/eicon/capimain.c b/drivers/isdn/hardware/eicon/capimain.c
index 4a1702523632..8fe4f3f09353 100644
--- a/drivers/isdn/hardware/eicon/capimain.c
+++ b/drivers/isdn/hardware/eicon/capimain.c
@@ -102,8 +102,8 @@ static int diva_ctl_read_proc(char *page, char **start, off_t off,
void diva_os_set_controller_struct(struct capi_ctr *ctrl)
{
ctrl->driver_name = DRIVERLNAME;
- ctrl->load_firmware = 0;
- ctrl->reset_ctr = 0;
+ ctrl->load_firmware = NULL;
+ ctrl->reset_ctr = NULL;
ctrl->ctr_read_proc = diva_ctl_read_proc;
ctrl->owner = THIS_MODULE;
}
diff --git a/drivers/isdn/hardware/eicon/dadapter.c b/drivers/isdn/hardware/eicon/dadapter.c
index dcfae9e9ad7b..3d4cfe919fce 100644
--- a/drivers/isdn/hardware/eicon/dadapter.c
+++ b/drivers/isdn/hardware/eicon/dadapter.c
@@ -293,8 +293,8 @@ static void diva_remove_adapter_callback (dword handle) {
diva_os_spin_lock_magic_t irql;
if (handle && ((--handle) < DIVA_DIDD_MAX_NOTIFICATIONS)) {
diva_os_enter_spin_lock (&didd_spin, &irql, "didd_nfy_rm");
- NotificationTable[handle].callback = 0;
- NotificationTable[handle].context = 0;
+ NotificationTable[handle].callback = NULL;
+ NotificationTable[handle].context = NULL;
diva_os_leave_spin_lock (&didd_spin, &irql, "didd_nfy_rm");
DBG_TRC(("Remove adapter notification[%d]", (int)(handle+1)))
return;
diff --git a/drivers/isdn/hardware/eicon/debug.c b/drivers/isdn/hardware/eicon/debug.c
index 907364c9cb9b..e8e99ad354fb 100644
--- a/drivers/isdn/hardware/eicon/debug.c
+++ b/drivers/isdn/hardware/eicon/debug.c
@@ -89,7 +89,7 @@ static void queueInit (MSG_QUEUE *Q, byte *Buffer, dword sizeBuffer) {
Q->Size = sizeBuffer;
Q->Base = Q->Head = Q->Tail = Buffer;
Q->High = Buffer + sizeBuffer;
- Q->Wrap = 0;
+ Q->Wrap = NULL;
Q->Count= 0;
}
@@ -107,7 +107,7 @@ static byte *queueAllocMsg (MSG_QUEUE *Q, word size) {
if (Q->Tail == Q->Head) {
if (Q->Wrap || need > Q->Size) {
- return(0); /* full */
+ return NULL; /* full */
}
goto alloc; /* empty */
}
@@ -115,7 +115,7 @@ static byte *queueAllocMsg (MSG_QUEUE *Q, word size) {
if (Q->Tail > Q->Head) {
if (Q->Tail + need <= Q->High) goto alloc; /* append */
if (Q->Base + need > Q->Head) {
- return (0); /* too much */
+ return NULL; /* too much */
}
/* wraparound the queue (but not the message) */
Q->Wrap = Q->Tail;
@@ -124,7 +124,7 @@ static byte *queueAllocMsg (MSG_QUEUE *Q, word size) {
}
if (Q->Tail + need > Q->Head) {
- return (0); /* too much */
+ return NULL; /* too much */
}
alloc:
@@ -151,7 +151,7 @@ static void queueFreeMsg (MSG_QUEUE *Q) {
if (Q->Wrap) {
if (Q->Head >= Q->Wrap) {
Q->Head = Q->Base;
- Q->Wrap = 0;
+ Q->Wrap = NULL;
}
} else if (Q->Head >= Q->Tail) {
Q->Head = Q->Tail = Q->Base;
@@ -167,7 +167,7 @@ static byte *queuePeekMsg (MSG_QUEUE *Q, word *size) {
if (((byte *)Msg == Q->Tail && !Q->Wrap) ||
(Msg->Size & MSG_INCOMPLETE)) {
- return (0);
+ return NULL;
} else {
*size = Msg->Size;
return ((byte *)(Msg + 1));
@@ -177,13 +177,13 @@ static byte *queuePeekMsg (MSG_QUEUE *Q, word *size) {
/*
Message queue header
*/
-static MSG_QUEUE* dbg_queue = 0;
-static byte* dbg_base = 0;
-static int external_dbg_queue = 0;
+static MSG_QUEUE* dbg_queue;
+static byte* dbg_base;
+static int external_dbg_queue;
static diva_os_spin_lock_t dbg_q_lock;
static diva_os_spin_lock_t dbg_adapter_lock;
-static int dbg_q_busy = 0;
-static volatile dword dbg_sequence = 0;
+static int dbg_q_busy;
+static volatile dword dbg_sequence;
static dword start_sec;
static dword start_usec;
@@ -235,16 +235,16 @@ int diva_maint_init (byte* base, unsigned long length, int do_init) {
if (diva_os_initialize_spin_lock (&dbg_q_lock, "dbg_init")) {
- dbg_queue = 0;
- dbg_base = 0;
+ dbg_queue = NULL;
+ dbg_base = NULL;
external_dbg_queue = 0;
return (-1);
}
if (diva_os_initialize_spin_lock (&dbg_adapter_lock, "dbg_init")) {
diva_os_destroy_spin_lock(&dbg_q_lock, "dbg_init");
- dbg_queue = 0;
- dbg_base = 0;
+ dbg_queue = NULL;
+ dbg_base = NULL;
external_dbg_queue = 0;
return (-1);
}
@@ -263,8 +263,8 @@ void* diva_maint_finit (void) {
void* ret = (void*)dbg_base;
int i;
- dbg_queue = 0;
- dbg_base = 0;
+ dbg_queue = NULL;
+ dbg_base = NULL;
if (ret) {
diva_os_destroy_spin_lock(&dbg_q_lock, "dbg_finit");
@@ -272,7 +272,7 @@ void* diva_maint_finit (void) {
}
if (external_dbg_queue) {
- ret = 0;
+ ret = NULL;
}
external_dbg_queue = 0;
@@ -300,12 +300,12 @@ dword diva_dbg_q_length (void) {
*/
diva_dbg_entry_head_t* diva_maint_get_message (word* size,
diva_os_spin_lock_magic_t* old_irql) {
- diva_dbg_entry_head_t* pmsg = 0;
+ diva_dbg_entry_head_t* pmsg = NULL;
diva_os_enter_spin_lock_hard (&dbg_q_lock, old_irql, "read");
if (dbg_q_busy) {
diva_os_leave_spin_lock_hard (&dbg_q_lock, old_irql, "read_busy");
- return (0);
+ return NULL;
}
dbg_q_busy = 1;
@@ -406,7 +406,7 @@ static void DI_register (void *arg) {
}
if (free_id != -1) {
- diva_dbg_entry_head_t* pmsg = 0;
+ diva_dbg_entry_head_t* pmsg = NULL;
int len;
char tmp[256];
word size;
@@ -476,7 +476,7 @@ static void DI_deregister (pDbgHandle hDbg) {
dword sec, usec;
int i;
word size;
- byte* pmem = 0;
+ byte* pmem = NULL;
diva_os_get_time (&sec, &usec);
@@ -489,24 +489,24 @@ static void DI_deregister (pDbgHandle hDbg) {
char tmp[256];
int len;
- clients[i].hDbg = 0;
+ clients[i].hDbg = NULL;
hDbg->id = -1;
hDbg->dbgMask = 0;
- hDbg->dbg_end = 0;
- hDbg->dbg_prt = 0;
- hDbg->dbg_irq = 0;
+ hDbg->dbg_end = NULL;
+ hDbg->dbg_prt = NULL;
+ hDbg->dbg_irq = NULL;
if (hDbg->Version > 0)
- hDbg->dbg_old = 0;
+ hDbg->dbg_old = NULL;
hDbg->Registered = 0;
- hDbg->next = 0;
+ hDbg->next = NULL;
if (clients[i].pIdiLib) {
(*(clients[i].pIdiLib->DivaSTraceLibraryFinit))(clients[i].pIdiLib->hLib);
- clients[i].pIdiLib = 0;
+ clients[i].pIdiLib = NULL;
pmem = clients[i].pmem;
- clients[i].pmem = 0;
+ clients[i].pmem = NULL;
}
/*
@@ -565,7 +565,7 @@ static void DI_format (int do_lock,
va_list ap) {
diva_os_spin_lock_magic_t old_irql;
dword sec, usec;
- diva_dbg_entry_head_t* pmsg = 0;
+ diva_dbg_entry_head_t* pmsg = NULL;
dword length;
word size;
static char fmtBuf[MSG_FRAME_MAX_SIZE+sizeof(*pmsg)+1];
@@ -843,7 +843,7 @@ void diva_mnt_add_xdi_adapter (const DESCRIPTOR* d) {
dword sec, usec, logical, serial, org_mask;
int id, best_id = 0, free_id = -1;
char tmp[256];
- diva_dbg_entry_head_t* pmsg = 0;
+ diva_dbg_entry_head_t* pmsg = NULL;
int len;
word size;
byte* pmem;
@@ -938,7 +938,7 @@ void diva_mnt_add_xdi_adapter (const DESCRIPTOR* d) {
if (((*(clients[id].pIdiLib->DivaSTraceLibraryStart))(clients[id].pIdiLib->hLib))) {
diva_mnt_internal_dprintf (0, DLI_ERR, "Adapter(%d) Start failed", (int)logical);
(*(clients[id].pIdiLib->DivaSTraceLibraryFinit))(clients[id].pIdiLib->hLib);
- clients[id].pIdiLib = 0;
+ clients[id].pIdiLib = NULL;
}
} else {
diva_mnt_internal_dprintf (0, DLI_ERR, "A(%d) management init failed", (int)logical);
@@ -946,9 +946,9 @@ void diva_mnt_add_xdi_adapter (const DESCRIPTOR* d) {
}
if (!clients[id].pIdiLib) {
- clients[id].request = 0;
+ clients[id].request = NULL;
clients[id].request_pending = 0;
- clients[id].hDbg = 0;
+ clients[id].hDbg = NULL;
diva_os_leave_spin_lock_hard (&dbg_q_lock, &old_irql, "register");
diva_os_leave_spin_lock_hard (&dbg_adapter_lock, &old_irql1, "register");
diva_os_free (0, pmem);
@@ -1008,7 +1008,7 @@ void diva_mnt_remove_xdi_adapter (const DESCRIPTOR* d) {
dword sec, usec;
int i;
word size;
- byte* pmem = 0;
+ byte* pmem = NULL;
diva_os_get_time (&sec, &usec);
@@ -1023,14 +1023,14 @@ void diva_mnt_remove_xdi_adapter (const DESCRIPTOR* d) {
if (clients[i].pIdiLib) {
(*(clients[i].pIdiLib->DivaSTraceLibraryFinit))(clients[i].pIdiLib->hLib);
- clients[i].pIdiLib = 0;
+ clients[i].pIdiLib = NULL;
pmem = clients[i].pmem;
- clients[i].pmem = 0;
+ clients[i].pmem = NULL;
}
- clients[i].hDbg = 0;
- clients[i].request = 0;
+ clients[i].hDbg = NULL;
+ clients[i].request = NULL;
clients[i].request_pending = 0;
/*
@@ -1092,7 +1092,7 @@ void* SuperTraceOpenAdapter (int AdapterNumber) {
}
}
- return (0);
+ return NULL;
}
int SuperTraceCloseAdapter (void* AdapterHandle) {
@@ -1741,7 +1741,7 @@ int diva_mnt_shutdown_xdi_adapters (void) {
for (i = 1; i < (sizeof(clients)/sizeof(clients[0])); i++) {
- pmem = 0;
+ pmem = NULL;
diva_os_enter_spin_lock_hard (&dbg_adapter_lock, &old_irql1, "unload");
diva_os_enter_spin_lock_hard (&dbg_q_lock, &old_irql, "unload");
@@ -1753,13 +1753,13 @@ int diva_mnt_shutdown_xdi_adapters (void) {
*/
if (clients[i].pIdiLib) {
(*(clients[i].pIdiLib->DivaSTraceLibraryFinit))(clients[i].pIdiLib->hLib);
- clients[i].pIdiLib = 0;
+ clients[i].pIdiLib = NULL;
pmem = clients[i].pmem;
- clients[i].pmem = 0;
+ clients[i].pmem = NULL;
}
- clients[i].hDbg = 0;
- clients[i].request = 0;
+ clients[i].hDbg = NULL;
+ clients[i].request = NULL;
clients[i].request_pending = 0;
} else {
fret = -1;
diff --git a/drivers/isdn/hardware/eicon/di.c b/drivers/isdn/hardware/eicon/di.c
index 8e1791d3b194..24fa5943b7c7 100644
--- a/drivers/isdn/hardware/eicon/di.c
+++ b/drivers/isdn/hardware/eicon/di.c
@@ -81,7 +81,7 @@ static void xdi_xlog_ind (byte Adapter,
void pr_out(ADAPTER * a)
{
byte e_no;
- ENTITY * this = 0;
+ ENTITY * this = NULL;
BUFFERS *X;
word length;
word i;
@@ -761,7 +761,7 @@ byte isdn_ind(ADAPTER * a,
word clength;
word offset;
BUFFERS *R;
- byte* cma = 0;
+ byte* cma = NULL;
#ifdef USE_EXTENDED_DEBUGS
{
DBG_TRC(("<A%d Id=0x%x Ind=0x%x", ((ISDN_ADAPTER *)a->io)->ANum, Id, Ind))
@@ -814,7 +814,7 @@ byte isdn_ind(ADAPTER * a,
Id,
cma,
sizeof(a->stream_buffer),
- &final, 0, 0);
+ &final, NULL, NULL);
}
IoAdapter->RBuffer.length = MIN(MLength, 270);
if (IoAdapter->RBuffer.length != MLength) {
diff --git a/drivers/isdn/hardware/eicon/diddfunc.c b/drivers/isdn/hardware/eicon/diddfunc.c
index 69abacc7c85b..33172c1d64e1 100644
--- a/drivers/isdn/hardware/eicon/diddfunc.c
+++ b/drivers/isdn/hardware/eicon/diddfunc.c
@@ -66,7 +66,7 @@ static int DIVA_INIT_FUNCTION connect_didd(void)
req.didd_notify.e.Rc =
IDI_SYNC_REQ_DIDD_REGISTER_ADAPTER_NOTIFY;
req.didd_notify.info.callback = (void *)didd_callback;
- req.didd_notify.info.context = 0;
+ req.didd_notify.info.context = NULL;
_DAdapter.request((ENTITY *) & req);
if (req.didd_notify.e.Rc != 0xff)
return (0);
diff --git a/drivers/isdn/hardware/eicon/diva.c b/drivers/isdn/hardware/eicon/diva.c
index 47cf327eb3e4..8ab8027f33c0 100644
--- a/drivers/isdn/hardware/eicon/diva.c
+++ b/drivers/isdn/hardware/eicon/diva.c
@@ -131,7 +131,7 @@ static diva_supported_cards_info_t divas_supported_cards[] = {
/*
EOL
*/
- {-1, 0}
+ {-1}
};
static void diva_init_request_array(void);
@@ -174,7 +174,7 @@ void *diva_driver_add_card(void *pdev, unsigned long CardOrdinal)
for (i = 0; divas_supported_cards[i].CardOrdinal != -1; i++) {
if (divas_supported_cards[i].CardOrdinal == CardOrdinal) {
if (!(pdiva = divas_create_pci_card(i, pdev))) {
- return (0);
+ return NULL;
}
switch (CardOrdinal) {
case CARDTYPE_DIVASRV_Q_8M_PCI:
@@ -237,11 +237,11 @@ void *diva_driver_add_card(void *pdev, unsigned long CardOrdinal)
DBG_ERR(("can not alloc request array"))
diva_driver_remove_card(pdiva);
- return (0);
+ return NULL;
}
}
- return (0);
+ return NULL;
}
/* --------------------------------------------------------------------------
@@ -286,7 +286,7 @@ void diva_driver_remove_card(void *pdiva)
int i;
pa = a[0] = (diva_os_xdi_adapter_t *) pdiva;
- a[1] = a[2] = a[3] = 0;
+ a[1] = a[2] = a[3] = NULL;
diva_os_enter_spin_lock(&adapter_lock, &old_irql, "remode adapter");
@@ -311,7 +311,7 @@ void diva_driver_remove_card(void *pdiva)
if (a[i]) {
if (a[i]->controller) {
DBG_LOG(("remove adapter (%d)",
- a[i]->controller)) IoAdapters[a[i]->controller - 1] = 0;
+ a[i]->controller)) IoAdapters[a[i]->controller - 1] = NULL;
remove_adapter_proc(a[i]);
}
diva_os_free(0, a[i]);
@@ -332,7 +332,7 @@ static void *divas_create_pci_card(int handle, void *pci_dev_handle)
if (!(a = (diva_os_xdi_adapter_t *) diva_os_malloc(0, sizeof(*a)))) {
DBG_ERR(("A: can't alloc adapter"));
- return (0);
+ return NULL;
}
memset(a, 0x00, sizeof(*a));
@@ -359,7 +359,7 @@ static void *divas_create_pci_card(int handle, void *pci_dev_handle)
diva_os_leave_spin_lock(&adapter_lock, &old_irql, "found_pci_card");
diva_os_free(0, a);
DBG_ERR(("A: can't get adapter resources"));
- return (0);
+ return NULL;
}
return (a);
@@ -377,7 +377,7 @@ void divasa_xdi_driver_unload(void)
(*(a->interface.cleanup_adapter_proc)) (a);
}
if (a->controller) {
- IoAdapters[a->controller - 1] = 0;
+ IoAdapters[a->controller - 1] = NULL;
remove_adapter_proc(a);
}
diva_os_free(0, a);
@@ -388,7 +388,7 @@ void divasa_xdi_driver_unload(void)
/*
** Receive and process command from user mode utility
*/
-void *diva_xdi_open_adapter(void *os_handle, const void *src,
+void *diva_xdi_open_adapter(void *os_handle, const void __user *src,
int length,
divas_xdi_copy_from_user_fn_t cp_fn)
{
@@ -400,11 +400,11 @@ void *diva_xdi_open_adapter(void *os_handle, const void *src,
if (length < sizeof(diva_xdi_um_cfg_cmd_t)) {
DBG_ERR(("A: A(?) open, msg too small (%d < %d)",
length, sizeof(diva_xdi_um_cfg_cmd_t)))
- return (0);
+ return NULL;
}
if ((*cp_fn) (os_handle, &msg, src, sizeof(msg)) <= 0) {
DBG_ERR(("A: A(?) open, write error"))
- return (0);
+ return NULL;
}
diva_os_enter_spin_lock(&adapter_lock, &old_irql, "open_adapter");
list_for_each(tmp, &adapter_queue) {
@@ -432,12 +432,12 @@ void diva_xdi_close_adapter(void *adapter, void *os_handle)
a->xdi_mbox.status &= ~DIVA_XDI_MBOX_BUSY;
if (a->xdi_mbox.data) {
diva_os_free(0, a->xdi_mbox.data);
- a->xdi_mbox.data = 0;
+ a->xdi_mbox.data = NULL;
}
}
int
-diva_xdi_write(void *adapter, void *os_handle, const void *src,
+diva_xdi_write(void *adapter, void *os_handle, const void __user *src,
int length, divas_xdi_copy_from_user_fn_t cp_fn)
{
diva_os_xdi_adapter_t *a = (diva_os_xdi_adapter_t *) adapter;
@@ -480,7 +480,7 @@ diva_xdi_write(void *adapter, void *os_handle, const void *src,
** Write answers to user mode utility, if any
*/
int
-diva_xdi_read(void *adapter, void *os_handle, void *dst,
+diva_xdi_read(void *adapter, void *os_handle, void __user *dst,
int max_length, divas_xdi_copy_to_user_fn_t cp_fn)
{
diva_os_xdi_adapter_t *a = (diva_os_xdi_adapter_t *) adapter;
@@ -507,7 +507,7 @@ diva_xdi_read(void *adapter, void *os_handle, void *dst,
a->xdi_mbox.data_length);
if (ret > 0) {
diva_os_free(0, a->xdi_mbox.data);
- a->xdi_mbox.data = 0;
+ a->xdi_mbox.data = NULL;
a->xdi_mbox.status &= ~DIVA_XDI_MBOX_BUSY;
}
@@ -526,7 +526,7 @@ irqreturn_t diva_os_irq_wrapper(int irq, void *context, struct pt_regs *regs)
if ((clear_int_proc = a->clear_interrupts_proc)) {
(*clear_int_proc) (a);
- a->clear_interrupts_proc = 0;
+ a->clear_interrupts_proc = NULL;
return IRQ_HANDLED;
}
diff --git a/drivers/isdn/hardware/eicon/diva.h b/drivers/isdn/hardware/eicon/diva.h
index 7d51009314a0..e979085d1b89 100644
--- a/drivers/isdn/hardware/eicon/diva.h
+++ b/drivers/isdn/hardware/eicon/diva.h
@@ -9,19 +9,19 @@ void divasa_xdi_driver_unload(void);
void *diva_driver_add_card(void *pdev, unsigned long CardOrdinal);
void diva_driver_remove_card(void *pdiva);
-typedef int (*divas_xdi_copy_to_user_fn_t) (void *os_handle, void *dst,
+typedef int (*divas_xdi_copy_to_user_fn_t) (void *os_handle, void __user *dst,
const void *src, int length);
typedef int (*divas_xdi_copy_from_user_fn_t) (void *os_handle, void *dst,
- const void *src, int length);
+ const void __user *src, int length);
-int diva_xdi_read(void *adapter, void *os_handle, void *dst,
+int diva_xdi_read(void *adapter, void *os_handle, void __user *dst,
int max_length, divas_xdi_copy_to_user_fn_t cp_fn);
-int diva_xdi_write(void *adapter, void *os_handle, const void *src,
+int diva_xdi_write(void *adapter, void *os_handle, const void __user *src,
int length, divas_xdi_copy_from_user_fn_t cp_fn);
-void *diva_xdi_open_adapter(void *os_handle, const void *src,
+void *diva_xdi_open_adapter(void *os_handle, const void __user *src,
int length,
divas_xdi_copy_from_user_fn_t cp_fn);
diff --git a/drivers/isdn/hardware/eicon/diva_dma.c b/drivers/isdn/hardware/eicon/diva_dma.c
index bdf2969e69fb..f53a7407605f 100644
--- a/drivers/isdn/hardware/eicon/diva_dma.c
+++ b/drivers/isdn/hardware/eicon/diva_dma.c
@@ -39,11 +39,10 @@ struct _diva_dma_map_entry {
Create local mapping structure and init it to default state
*/
struct _diva_dma_map_entry* diva_alloc_dma_map (void* os_context, int nentries) {
- diva_dma_map_entry_t* pmap;
- if (!(pmap = diva_os_malloc (0, sizeof(*pmap)*(nentries+1))))
- return (0);
- memset (pmap, 0x00, sizeof(*pmap)*(nentries+1));
- return (pmap);
+ diva_dma_map_entry_t* pmap = diva_os_malloc(0, sizeof(*pmap)*(nentries+1));
+ if (pmap)
+ memset (pmap, 0, sizeof(*pmap)*(nentries+1));
+ return pmap;
}
/*
Free local map (context should be freed before) if any
diff --git a/drivers/isdn/hardware/eicon/divamnt.c b/drivers/isdn/hardware/eicon/divamnt.c
index abd70d0d0268..1d664813f7b6 100644
--- a/drivers/isdn/hardware/eicon/divamnt.c
+++ b/drivers/isdn/hardware/eicon/divamnt.c
@@ -53,7 +53,7 @@ static struct timeval start_time;
extern int mntfunc_init(int *, void **, unsigned long);
extern void mntfunc_finit(void);
-extern int maint_read_write(void *buf, int count);
+extern int maint_read_write(void __user *buf, int count);
/*
* helper functions
@@ -90,12 +90,12 @@ void diva_os_free_tbuffer(unsigned long flags, void *ptr)
/*
* kernel/user space copy functions
*/
-int diva_os_copy_to_user(void *os_handle, void *dst, const void *src,
+int diva_os_copy_to_user(void *os_handle, void __user *dst, const void *src,
int length)
{
return (copy_to_user(dst, src, length));
}
-int diva_os_copy_from_user(void *os_handle, void *dst, const void *src,
+int diva_os_copy_from_user(void *os_handle, void *dst, const void __user *src,
int length)
{
return (copy_from_user(dst, src, length));
@@ -142,9 +142,9 @@ static struct proc_dir_entry *maint_proc_entry = NULL;
to read unstructured traces, formated as ascii string only
*/
static ssize_t
-maint_read(struct file *file, char *buf, size_t count, loff_t * off)
+maint_read(struct file *file, char __user *buf, size_t count, loff_t * off)
{
- diva_dbg_entry_head_t *pmsg = 0;
+ diva_dbg_entry_head_t *pmsg = NULL;
diva_os_spin_lock_magic_t old_irql;
word size;
char *pstr, *dli_label = "UNK";
@@ -264,20 +264,20 @@ maint_read(struct file *file, char *buf, size_t count, loff_t * off)
if (diva_os_copy_to_user(NULL, buf, pstr, str_length)) {
diva_os_free_tbuffer(0, str_msg);
- file->private_data = 0;
+ file->private_data = NULL;
return (-EFAULT);
}
str_msg[1] += str_length;
if ((str_msg[0] - str_msg[1]) <= 0) {
diva_os_free_tbuffer(0, str_msg);
- file->private_data = 0;
+ file->private_data = NULL;
}
return (str_length);
}
static ssize_t
-maint_write(struct file *file, const char *buf, size_t count, loff_t * off)
+maint_write(struct file *file, const char __user *buf, size_t count, loff_t * off)
{
return (-ENODEV);
}
@@ -304,7 +304,7 @@ static int maint_open(struct inode *ino, struct file *filep)
opened++;
up(&opened_sem);
- filep->private_data = 0;
+ filep->private_data = NULL;
return (0);
}
@@ -313,7 +313,7 @@ static int maint_close(struct inode *ino, struct file *filep)
{
if (filep->private_data) {
diva_os_free_tbuffer(0, filep->private_data);
- filep->private_data = 0;
+ filep->private_data = NULL;
}
down(&opened_sem);
@@ -360,13 +360,13 @@ static void remove_maint_proc(void)
/*
* device node operations
*/
-static ssize_t divas_maint_write(struct file *file, const char *buf,
+static ssize_t divas_maint_write(struct file *file, const char __user *buf,
size_t count, loff_t * ppos)
{
- return (maint_read_write((char *) buf, (int) count));
+ return (maint_read_write((char __user *) buf, (int) count));
}
-static ssize_t divas_maint_read(struct file *file, char *buf,
+static ssize_t divas_maint_read(struct file *file, char __user *buf,
size_t count, loff_t * ppos)
{
return (maint_read_write(buf, (int) count));
@@ -416,7 +416,7 @@ static int DIVA_INIT_FUNCTION maint_init(void)
{
char tmprev[50];
int ret = 0;
- void *buffer = 0;
+ void *buffer = NULL;
do_gettimeofday(&start_time);
init_waitqueue_head(&msgwaitq);
diff --git a/drivers/isdn/hardware/eicon/divasfunc.c b/drivers/isdn/hardware/eicon/divasfunc.c
index 52385931f3a4..4ee56d4bb409 100644
--- a/drivers/isdn/hardware/eicon/divasfunc.c
+++ b/drivers/isdn/hardware/eicon/divasfunc.c
@@ -173,7 +173,7 @@ static int DIVA_INIT_FUNCTION connect_didd(void)
req.didd_notify.e.Rc =
IDI_SYNC_REQ_DIDD_REGISTER_ADAPTER_NOTIFY;
req.didd_notify.info.callback = (void *)didd_callback;
- req.didd_notify.info.context = 0;
+ req.didd_notify.info.context = NULL;
DAdapter.request((ENTITY *) & req);
if (req.didd_notify.e.Rc != 0xff) {
stop_dbg();
diff --git a/drivers/isdn/hardware/eicon/divasi.c b/drivers/isdn/hardware/eicon/divasi.c
index 1a0640d824d0..058b5c29cf69 100644
--- a/drivers/isdn/hardware/eicon/divasi.c
+++ b/drivers/isdn/hardware/eicon/divasi.c
@@ -71,9 +71,9 @@ static char *getrev(const char *revision)
/*
* LOCALS
*/
-static ssize_t um_idi_read(struct file *file, char *buf, size_t count,
+static ssize_t um_idi_read(struct file *file, char __user *buf, size_t count,
loff_t * offset);
-static ssize_t um_idi_write(struct file *file, const char *buf,
+static ssize_t um_idi_write(struct file *file, const char __user *buf,
size_t count, loff_t * offset);
static unsigned int um_idi_poll(struct file *file, poll_table * wait);
static int um_idi_open(struct inode *inode, struct file *file);
@@ -231,7 +231,7 @@ divas_um_idi_copy_to_user(void *os_handle, void *dst, const void *src,
}
static ssize_t
-um_idi_read(struct file *file, char *buf, size_t count, loff_t * offset)
+um_idi_read(struct file *file, char __user *buf, size_t count, loff_t * offset)
{
diva_um_idi_os_context_t *p_os;
int ret = -EINVAL;
@@ -312,7 +312,7 @@ static int um_idi_open_adapter(struct file *file, int adapter_nr)
}
static ssize_t
-um_idi_write(struct file *file, const char *buf, size_t count,
+um_idi_write(struct file *file, const char __user *buf, size_t count,
loff_t * offset)
{
diva_um_idi_os_context_t *p_os;
diff --git a/drivers/isdn/hardware/eicon/divasmain.c b/drivers/isdn/hardware/eicon/divasmain.c
index f00f6ba1975a..866ae64d2cfa 100644
--- a/drivers/isdn/hardware/eicon/divasmain.c
+++ b/drivers/isdn/hardware/eicon/divasmain.c
@@ -556,7 +556,7 @@ void diva_os_remove_soft_isr(diva_os_soft_isr_t * psoft_isr)
tasklet_kill(&pdpc->divas_task);
flush_scheduled_work();
mem = psoft_isr->object;
- psoft_isr->object = 0;
+ psoft_isr->object = NULL;
diva_os_free(0, mem);
}
}
@@ -565,7 +565,7 @@ void diva_os_remove_soft_isr(diva_os_soft_isr_t * psoft_isr)
* kernel/user space copy functions
*/
static int
-xdi_copy_to_user(void *os_handle, void *dst, const void *src, int length)
+xdi_copy_to_user(void *os_handle, void __user *dst, const void *src, int length)
{
if (copy_to_user(dst, src, length)) {
return (-EFAULT);
@@ -574,7 +574,7 @@ xdi_copy_to_user(void *os_handle, void *dst, const void *src, int length)
}
static int
-xdi_copy_from_user(void *os_handle, void *dst, const void *src, int length)
+xdi_copy_from_user(void *os_handle, void *dst, const void __user *src, int length)
{
if (copy_from_user(dst, src, length)) {
return (-EFAULT);
@@ -598,7 +598,7 @@ static int divas_release(struct inode *inode, struct file *file)
return (0);
}
-static ssize_t divas_write(struct file *file, const char *buf,
+static ssize_t divas_write(struct file *file, const char __user *buf,
size_t count, loff_t * ppos)
{
int ret = -EINVAL;
@@ -629,7 +629,7 @@ static ssize_t divas_write(struct file *file, const char *buf,
return (ret);
}
-static ssize_t divas_read(struct file *file, char *buf,
+static ssize_t divas_read(struct file *file, char __user *buf,
size_t count, loff_t * ppos)
{
int ret = -EINVAL;
@@ -703,7 +703,7 @@ static int DIVA_INIT_FUNCTION divas_register_chrdev(void)
static int __devinit divas_init_one(struct pci_dev *pdev,
const struct pci_device_id *ent)
{
- void *pdiva = 0;
+ void *pdiva = NULL;
u8 pci_latency;
u8 new_latency = 32;
diff --git a/drivers/isdn/hardware/eicon/divasproc.c b/drivers/isdn/hardware/eicon/divasproc.c
index abf80d82e704..192fae4c6465 100644
--- a/drivers/isdn/hardware/eicon/divasproc.c
+++ b/drivers/isdn/hardware/eicon/divasproc.c
@@ -54,7 +54,7 @@ extern struct proc_dir_entry *proc_net_eicon;
static struct proc_dir_entry *divas_proc_entry = NULL;
static ssize_t
-divas_read(struct file *file, char *buf, size_t count, loff_t * off)
+divas_read(struct file *file, char __user *buf, size_t count, loff_t * off)
{
int len = 0;
int cadapter;
@@ -95,7 +95,7 @@ divas_read(struct file *file, char *buf, size_t count, loff_t * off)
}
static ssize_t
-divas_write(struct file *file, const char *buf, size_t count, loff_t * off)
+divas_write(struct file *file, const char __user *buf, size_t count, loff_t * off)
{
return (-ENODEV);
}
@@ -151,14 +151,17 @@ void remove_divas_proc(void)
** write group_optimization
*/
static int
-write_grp_opt(struct file *file, const char *buffer, unsigned long count,
+write_grp_opt(struct file *file, const char __user *buffer, unsigned long count,
void *data)
{
diva_os_xdi_adapter_t *a = (diva_os_xdi_adapter_t *) data;
PISDN_ADAPTER IoAdapter = IoAdapters[a->controller - 1];
if ((count == 1) || (count == 2)) {
- switch (buffer[0]) {
+ char c;
+ if (get_user(c, buffer))
+ return -EFAULT;
+ switch (c) {
case '0':
IoAdapter->capi_cfg.cfg_1 &=
~DIVA_XDI_CAPI_CFG_1_GROUP_POPTIMIZATION_ON;
@@ -179,14 +182,17 @@ write_grp_opt(struct file *file, const char *buffer, unsigned long count,
** write dynamic_l1_down
*/
static int
-write_d_l1_down(struct file *file, const char *buffer, unsigned long count,
+write_d_l1_down(struct file *file, const char __user *buffer, unsigned long count,
void *data)
{
diva_os_xdi_adapter_t *a = (diva_os_xdi_adapter_t *) data;
PISDN_ADAPTER IoAdapter = IoAdapters[a->controller - 1];
if ((count == 1) || (count == 2)) {
- switch (buffer[0]) {
+ char c;
+ if (get_user(c, buffer))
+ return -EFAULT;
+ switch (c) {
case '0':
IoAdapter->capi_cfg.cfg_1 &=
~DIVA_XDI_CAPI_CFG_1_DYNAMIC_L1_ON;
@@ -256,14 +262,21 @@ read_grp_opt(char *page, char **start, off_t off, int count, int *eof,
** info write
*/
static int
-info_write(struct file *file, const char *buffer, unsigned long count,
+info_write(struct file *file, const char __user *buffer, unsigned long count,
void *data)
{
diva_os_xdi_adapter_t *a = (diva_os_xdi_adapter_t *) data;
PISDN_ADAPTER IoAdapter = IoAdapters[a->controller - 1];
+ char c[4];
+
+ if (count <= 4)
+ return -EINVAL;
+
+ if (copy_from_user(c, buffer, 4))
+ return -EFAULT;
/* this is for test purposes only */
- if ((count > 4) && (!memcmp(buffer, "trap", 4))) {
+ if (!memcmp(c, "trap", 4)) {
(*(IoAdapter->os_trap_nfy_Fnc)) (IoAdapter, IoAdapter->ANum);
return (count);
}
diff --git a/drivers/isdn/hardware/eicon/dqueue.c b/drivers/isdn/hardware/eicon/dqueue.c
index f1d7997f3379..982258225174 100644
--- a/drivers/isdn/hardware/eicon/dqueue.c
+++ b/drivers/isdn/hardware/eicon/dqueue.c
@@ -23,7 +23,7 @@ diva_data_q_init(diva_um_idi_data_queue_t * q,
q->segments = max_segments;
for (i = 0; i < q->segments; i++) {
- q->data[i] = 0;
+ q->data[i] = NULL;
q->length[i] = 0;
}
q->read = q->write = q->count = q->segment_pending = 0;
@@ -46,7 +46,7 @@ int diva_data_q_finit(diva_um_idi_data_queue_t * q)
if (q->data[i]) {
diva_os_free(0, q->data[i]);
}
- q->data[i] = 0;
+ q->data[i] = NULL;
q->length[i] = 0;
}
q->read = q->write = q->count = q->segment_pending = 0;
@@ -66,7 +66,7 @@ void *diva_data_q_get_segment4write(diva_um_idi_data_queue_t * q)
return (q->data[q->write]);
}
- return (0);
+ return NULL;
}
void
@@ -89,7 +89,7 @@ const void *diva_data_q_get_segment4read(const diva_um_idi_data_queue_t *
if (q->count) {
return (q->data[q->read]);
}
- return (0);
+ return NULL;
}
int diva_data_q_get_segment_length(const diva_um_idi_data_queue_t * q)
diff --git a/drivers/isdn/hardware/eicon/idifunc.c b/drivers/isdn/hardware/eicon/idifunc.c
index f3427aad634b..63746f4016e8 100644
--- a/drivers/isdn/hardware/eicon/idifunc.c
+++ b/drivers/isdn/hardware/eicon/idifunc.c
@@ -199,7 +199,7 @@ static int DIVA_INIT_FUNCTION connect_didd(void)
req.didd_notify.e.Rc =
IDI_SYNC_REQ_DIDD_REGISTER_ADAPTER_NOTIFY;
req.didd_notify.info.callback = (void *)didd_callback;
- req.didd_notify.info.context = 0;
+ req.didd_notify.info.context = NULL;
DAdapter.request((ENTITY *) & req);
if (req.didd_notify.e.Rc != 0xff) {
stop_dbg();
diff --git a/drivers/isdn/hardware/eicon/maintidi.c b/drivers/isdn/hardware/eicon/maintidi.c
index 29850cf198ae..8bef29b8b9b5 100644
--- a/drivers/isdn/hardware/eicon/maintidi.c
+++ b/drivers/isdn/hardware/eicon/maintidi.c
@@ -112,7 +112,7 @@ diva_strace_library_interface_t* DivaSTraceLibraryCreateInstance (int Adapter,
int i;
if (!pLib) {
- return (0);
+ return NULL;
}
pmem += sizeof(*pLib);
@@ -161,7 +161,7 @@ diva_strace_library_interface_t* DivaSTraceLibraryCreateInstance (int Adapter,
if (!(pLib->hAdapter = SuperTraceOpenAdapter (Adapter))) {
diva_mnt_internal_dprintf (0, DLI_ERR, "Can not open XDI adapter");
- return (0);
+ return NULL;
}
pLib->Channels = SuperTraceGetNumberOfChannels (pLib->hAdapter);
@@ -1170,13 +1170,13 @@ static diva_man_var_header_t* get_next_var (diva_man_var_header_t* pVar) {
byte* start;
int msg_length;
- if (*msg != ESC) return (0);
+ if (*msg != ESC) return NULL;
start = msg + 2;
msg_length = *(msg+1);
msg = (start+msg_length);
- if (*msg != ESC) return (0);
+ if (*msg != ESC) return NULL;
return ((diva_man_var_header_t*)msg);
}
diff --git a/drivers/isdn/hardware/eicon/message.c b/drivers/isdn/hardware/eicon/message.c
index 03d89d4265a0..5ce359aac9e0 100644
--- a/drivers/isdn/hardware/eicon/message.c
+++ b/drivers/isdn/hardware/eicon/message.c
@@ -414,7 +414,7 @@ word api_put(APPL * appl, CAPI_MSG * msg)
}
a = &adapter[controller];
- plci = 0;
+ plci = NULL;
if ((msg->header.plci != 0) && (msg->header.plci <= a->max_plci) && !a->adapter_disabled)
{
dbug(1,dprintf("plci=%x",msg->header.plci));
@@ -547,7 +547,7 @@ word api_put(APPL * appl, CAPI_MSG * msg)
}
else
{
- plci = 0;
+ plci = NULL;
}
}
dbug(1,dprintf("com=%x",msg->header.command));
@@ -629,7 +629,7 @@ word api_parse(byte * msg, word length, byte * format, API_PARSE * parms)
if(p>length) return TRUE;
}
- if(parms) parms[i].info = 0;
+ if(parms) parms[i].info = NULL;
return FALSE;
}
@@ -661,7 +661,7 @@ void api_save_msg(API_PARSE *in, byte *format, API_SAVE *out)
for (j = 0; j < n; j++)
*(p++) = in[i].info[j];
}
- out->parms[i].info = 0;
+ out->parms[i].info = NULL;
out->parms[i].length = 0;
}
@@ -725,7 +725,7 @@ void init_internal_command_queue (PLCI *plci)
plci->internal_command = 0;
for (i = 0; i < MAX_INTERNAL_COMMAND_LEVELS; i++)
- plci->internal_command_queue[i] = 0;
+ plci->internal_command_queue[i] = NULL;
}
@@ -759,16 +759,16 @@ void next_internal_command (dword Id, PLCI *plci)
UnMapId (Id), (char *)(FILE_), __LINE__));
plci->internal_command = 0;
- plci->internal_command_queue[0] = 0;
+ plci->internal_command_queue[0] = NULL;
while (plci->internal_command_queue[1] != 0)
{
for (i = 0; i < MAX_INTERNAL_COMMAND_LEVELS - 1; i++)
plci->internal_command_queue[i] = plci->internal_command_queue[i+1];
- plci->internal_command_queue[MAX_INTERNAL_COMMAND_LEVELS - 1] = 0;
+ plci->internal_command_queue[MAX_INTERNAL_COMMAND_LEVELS - 1] = NULL;
(*(plci->internal_command_queue[0]))(Id, plci, OK);
if (plci->internal_command != 0)
return;
- plci->internal_command_queue[0] = 0;
+ plci->internal_command_queue[0] = NULL;
}
}
@@ -1085,7 +1085,7 @@ void plci_remove(PLCI * plci)
plci_free_msg_in_queue (plci);
plci->channels = 0;
- plci->appl = 0;
+ plci->appl = NULL;
if ((plci->State == INC_CON_PENDING) || (plci->State == INC_CON_ALERT))
plci->State = OUTG_DIS_PENDING;
}
@@ -1715,7 +1715,7 @@ byte info_req(dword Id, word Number, DIVA_CAPI_ADAPTER * a, PLCI * plci, APP
{
word i;
API_PARSE * ai;
- PLCI * rc_plci = 0;
+ PLCI * rc_plci = NULL;
API_PARSE ai_parms[5];
word Info = 0;
@@ -2195,7 +2195,7 @@ byte facility_req(dword Id, word Number, DIVA_CAPI_ADAPTER * a, PLCI * plci,
relatedadapter = &adapter[MapController ((byte)(relatedPLCIvalue & 0x7f))-1];
relatedPLCIvalue >>=8;
/* find PLCI PTR*/
- for(i=0,rplci=0;i<relatedadapter->max_plci;i++)
+ for(i=0,rplci=NULL;i<relatedadapter->max_plci;i++)
{
if(relatedadapter->plci[i].Id == (byte)relatedPLCIvalue)
{
@@ -4355,7 +4355,7 @@ void control_rc(PLCI * plci, byte req, byte rc, byte ch, byte global_req, byte
if(rc!=OK)
{
Info = 0x300E; /* not supported */
- plci->relatedPTYPLCI = 0;
+ plci->relatedPTYPLCI = NULL;
plci->ptyState = 0;
}
sendf(rplci->appl,
@@ -4376,7 +4376,7 @@ void control_rc(PLCI * plci, byte req, byte rc, byte ch, byte global_req, byte
if(rc!=OK)
{
Info = 0x300E; /* not supported */
- plci->relatedPTYPLCI = 0;
+ plci->relatedPTYPLCI = NULL;
plci->ptyState = 0;
}
sendf(rplci->appl,
@@ -4560,7 +4560,7 @@ void control_rc(PLCI * plci, byte req, byte rc, byte ch, byte global_req, byte
if(rc!=OK)
{
Info = 0x300E; /* not supported */
- plci->relatedPTYPLCI = 0;
+ plci->relatedPTYPLCI = NULL;
plci->ptyState = 0;
}
sendf(rplci->appl,
@@ -4722,7 +4722,7 @@ void control_rc(PLCI * plci, byte req, byte rc, byte ch, byte global_req, byte
dbug(1,dprintf("Auto-Law assign failed"));
a->automatic_law = 3;
plci->internal_command = 0;
- a->automatic_lawPLCI = 0;
+ a->automatic_lawPLCI = NULL;
}
break;
}
@@ -4739,7 +4739,7 @@ void control_rc(PLCI * plci, byte req, byte rc, byte ch, byte global_req, byte
plci->internal_command = 0;
sig_req(plci,REMOVE,0);
send_req(plci);
- a->automatic_lawPLCI = 0;
+ a->automatic_lawPLCI = NULL;
}
break;
}
@@ -4839,7 +4839,7 @@ void sig_ind(PLCI * plci)
byte *esc_profile = "";
byte facility[256];
- PLCI * tplci = 0;
+ PLCI * tplci = NULL;
byte chi[] = "\x02\x18\x01";
byte voice_cai[] = "\x06\x14\x00\x00\x00\x00\x08";
byte resume_cau[] = "\x05\x05\x00\x02\x00\x00";
@@ -4981,7 +4981,7 @@ void sig_ind(PLCI * plci)
plci->internal_command = 0;
sig_req(plci,REMOVE,0);
send_req(plci);
- a->automatic_lawPLCI = 0;
+ a->automatic_lawPLCI = NULL;
}
}
if (esc_profile[0])
@@ -5073,7 +5073,7 @@ void sig_ind(PLCI * plci)
{
force_mt_info = SendMultiIE(plci,Id,multi_fac_parms, FTY, 0x20, 0);
force_mt_info |= SendMultiIE(plci,Id,multi_pi_parms, PI, 0x210, 0);
- SendSSExtInd(0,plci,Id,multi_ssext_parms);
+ SendSSExtInd(NULL,plci,Id,multi_ssext_parms);
SendInfo(plci,Id, parms, force_mt_info);
VSwitchReqInd(plci,Id,multi_vswitch_parms);
@@ -5144,7 +5144,7 @@ void sig_ind(PLCI * plci)
{
WRITE_WORD(&SS_Ind[4],0x300E);
}
- plci->relatedPTYPLCI = 0;
+ plci->relatedPTYPLCI = NULL;
plci->ptyState = 0;
sendf(tplci->appl,_FACILITY_I,rId,0,"ws",3, SS_Ind);
break;
@@ -5298,7 +5298,7 @@ void sig_ind(PLCI * plci)
break;
case CONF_ADD:
WRITE_WORD(&CONF_Ind[1],S_CONF_ADD);
- plci->relatedPTYPLCI = 0;
+ plci->relatedPTYPLCI = NULL;
tplci=plci->relatedPTYPLCI;
if(tplci) tplci->ptyState = CONNECTED;
plci->ptyState = CONNECTED;
@@ -5342,7 +5342,7 @@ void sig_ind(PLCI * plci)
{
plci->ptyState = IDLE;
- plci->relatedPTYPLCI = 0;
+ plci->relatedPTYPLCI = NULL;
plci->ptyState = 0;
}
@@ -5364,7 +5364,7 @@ void sig_ind(PLCI * plci)
case S_3PTY_END:
plci->ptyState = IDLE;
- plci->relatedPTYPLCI = 0;
+ plci->relatedPTYPLCI = NULL;
plci->ptyState = 0;
dbug(1,dprintf("3PTY OFF"));
break;
@@ -5904,7 +5904,7 @@ void sig_ind(PLCI * plci)
/* and signal '+'.Appl must decide */
/* with connect_res if call must */
/* accepted or not */
- for(i=0, tplci=0;i<max_appl;i++){
+ for(i=0, tplci=NULL;i<max_appl;i++){
if(a->codec_listen[i]
&& (a->codec_listen[i]->State==INC_CON_PENDING
||a->codec_listen[i]->State==INC_CON_ALERT) ){
@@ -5927,7 +5927,7 @@ void sig_ind(PLCI * plci)
add_p(tplci, CAI, voice_cai);
add_p(tplci, OAD, a->TelOAD);
add_p(tplci, OSA, a->TelOSA);
- add_p(tplci,SHIFT|6,0);
+ add_p(tplci,SHIFT|6,NULL);
add_p(tplci,SIN,"\x02\x01\x00");
add_p(tplci,UID,"\x06\x43\x61\x70\x69\x32\x30");
sig_req(tplci,ASSIGN,DSIG_ID);
@@ -6080,7 +6080,7 @@ void sig_ind(PLCI * plci)
break;
case SSEXT_IND:
- SendSSExtInd(0,plci,Id,multi_ssext_parms);
+ SendSSExtInd(NULL,plci,Id,multi_ssext_parms);
break;
case VSWITCH_REQ:
@@ -6218,7 +6218,7 @@ void SendInfo(PLCI * plci, dword Id, byte * * parms, byte iesent)
Info_Number = 0x0008;
Info_Mask = 0x00;
cause[2] = ie[2];
- Info_Element = 0;
+ Info_Element = NULL;
break;
case 8: /* display */
dbug(1,dprintf("display(%d)",i));
@@ -7273,8 +7273,8 @@ word get_plci(DIVA_CAPI_ADAPTER * a)
plci->sig_req = 0;
plci->nl_req = 0;
- plci->appl = 0;
- plci->relatedPTYPLCI = 0;
+ plci->appl = NULL;
+ plci->relatedPTYPLCI = NULL;
plci->State = IDLE;
plci->SuppState = IDLE;
plci->channels = 0;
@@ -8899,7 +8899,7 @@ void listen_check(DIVA_CAPI_ADAPTER * a)
add_p(plci,CAI,"\x01\xc0");
add_p(plci,UID,"\x06\x43\x61\x70\x69\x32\x30");
add_p(plci,LLI,"\x01\xc4"); /* support Dummy CR FAC + MWI + SpoofNotify */
- add_p(plci,SHIFT|6,0);
+ add_p(plci,SHIFT|6,NULL);
add_p(plci,SIN,"\x02\x00\x00");
plci->internal_command = LISTEN_SIG_ASSIGN_PEND; /* do indicate_req if OK */
sig_req(plci,ASSIGN,DSIG_ID);
@@ -9216,10 +9216,10 @@ void CodecIdCheck(DIVA_CAPI_ADAPTER *a, PLCI *plci)
dbug(1,dprintf("remove temp codec PLCI"));
plci_remove(a->AdvCodecPLCI);
a->AdvCodecFLAG = 0;
- a->AdvCodecPLCI = 0;
- a->AdvSignalAppl = 0;
+ a->AdvCodecPLCI = NULL;
+ a->AdvSignalAppl = NULL;
}
- a->AdvSignalPLCI = 0;
+ a->AdvSignalPLCI = NULL;
}
}
@@ -9351,7 +9351,7 @@ word CapiRelease(word Id)
a->Info_Mask[Id-1] = 0;
a->CIP_Mask[Id-1] = 0;
a->Notification_Mask[Id-1] = 0;
- a->codec_listen[Id-1] = 0;
+ a->codec_listen[Id-1] = NULL;
a->requested_options_table[Id-1] = 0;
for(j=0; j<a->max_plci; j++) /* and all PLCIs connected */
{ /* with this application */
@@ -9386,7 +9386,7 @@ word CapiRelease(word Id)
}
if(plci->appl==this)
{
- plci->appl = 0;
+ plci->appl = NULL;
plci_remove(plci);
plci->State = IDLE;
}
@@ -9405,7 +9405,7 @@ word CapiRelease(word Id)
add_p(plci,OAD,"\x01\xfd");
add_p(plci,CAI,"\x01\x80");
add_p(plci,UID,"\x06\x43\x61\x70\x69\x32\x30");
- add_p(plci,SHIFT|6,0);
+ add_p(plci,SHIFT|6,NULL);
add_p(plci,SIN,"\x02\x00\x00");
plci->internal_command = REM_L1_SIG_ASSIGN_PEND;
sig_req(plci,ASSIGN,DSIG_ID);
@@ -9424,10 +9424,10 @@ word CapiRelease(word Id)
a->AdvCodecPLCI->tel = 0;
a->AdvCodecPLCI->adv_nl = 0;
}
- a->AdvSignalAppl = 0;
- a->AdvSignalPLCI = 0;
+ a->AdvSignalAppl = NULL;
+ a->AdvSignalPLCI = NULL;
a->AdvCodecFLAG = 0;
- a->AdvCodecPLCI = 0;
+ a->AdvCodecPLCI = NULL;
}
}
}
@@ -9458,7 +9458,7 @@ static word plci_remove_check(PLCI *plci)
plci->Id = 0;
plci->State = IDLE;
plci->channels = 0;
- plci->appl = 0;
+ plci->appl = NULL;
plci->notifiedcall = 0;
}
listen_check(plci->adapter);
@@ -10265,8 +10265,8 @@ static word dtmf_parameter_restore_config (dword Id, PLCI *plci, byte Rc)
/*------------------------------------------------------------------*/
-LI_CONFIG *li_config_table = 0;
-word li_total_channels = 0;
+LI_CONFIG *li_config_table;
+word li_total_channels;
/*------------------------------------------------------------------*/
@@ -14948,7 +14948,7 @@ word CapiRegister(word id)
add_p(plci,OAD,"\x01\xfd");
add_p(plci,CAI,"\x01\x80");
add_p(plci,UID,"\x06\x43\x61\x70\x69\x32\x30");
- add_p(plci,SHIFT|6,0);
+ add_p(plci,SHIFT|6,NULL);
add_p(plci,SIN,"\x02\x00\x00");
plci->internal_command = START_L1_SIG_ASSIGN_PEND;
sig_req(plci,ASSIGN,DSIG_ID);
@@ -15068,7 +15068,7 @@ static int diva_get_dma_descriptor (PLCI *plci, dword *dma_magic) {
pReq->xdi_dma_descriptor_operation.info.operation = IDI_SYNC_REQ_DMA_DESCRIPTOR_ALLOC;
pReq->xdi_dma_descriptor_operation.info.descriptor_number = -1;
- pReq->xdi_dma_descriptor_operation.info.descriptor_address = 0;
+ pReq->xdi_dma_descriptor_operation.info.descriptor_address = NULL;
pReq->xdi_dma_descriptor_operation.info.descriptor_magic = 0;
e.user[0] = plci->adapter->Id - 1;
@@ -15102,7 +15102,7 @@ static void diva_free_dma_descriptor (PLCI *plci, int nr) {
pReq->xdi_dma_descriptor_operation.info.operation = IDI_SYNC_REQ_DMA_DESCRIPTOR_FREE;
pReq->xdi_dma_descriptor_operation.info.descriptor_number = nr;
- pReq->xdi_dma_descriptor_operation.info.descriptor_address = 0;
+ pReq->xdi_dma_descriptor_operation.info.descriptor_address = NULL;
pReq->xdi_dma_descriptor_operation.info.descriptor_magic = 0;
e.user[0] = plci->adapter->Id - 1;
diff --git a/drivers/isdn/hardware/eicon/mntfunc.c b/drivers/isdn/hardware/eicon/mntfunc.c
index 00ef979d6c7c..c94229904f1a 100644
--- a/drivers/isdn/hardware/eicon/mntfunc.c
+++ b/drivers/isdn/hardware/eicon/mntfunc.c
@@ -34,10 +34,10 @@ static DESCRIPTOR MaintDescriptor =
extern void *diva_os_malloc_tbuffer(unsigned long flags,
unsigned long size);
extern void diva_os_free_tbuffer(unsigned long flags, void *ptr);
-extern int diva_os_copy_to_user(void *os_handle, void *dst,
+extern int diva_os_copy_to_user(void *os_handle, void __user *dst,
const void *src, int length);
extern int diva_os_copy_from_user(void *os_handle, void *dst,
- const void *src, int length);
+ const void __user *src, int length);
static void no_printf(unsigned char *x, ...)
{
@@ -102,7 +102,7 @@ static int DIVA_INIT_FUNCTION connect_didd(void)
req.didd_notify.e.Rc =
IDI_SYNC_REQ_DIDD_REGISTER_ADAPTER_NOTIFY;
req.didd_notify.info.callback = (void *)didd_callback;
- req.didd_notify.info.context = 0;
+ req.didd_notify.info.context = NULL;
DAdapter.request((ENTITY *) & req);
if (req.didd_notify.e.Rc != 0xff)
return (0);
@@ -148,7 +148,7 @@ static void DIVA_EXIT_FUNCTION disconnect_didd(void)
/*
* read/write maint
*/
-int maint_read_write(void *buf, int count)
+int maint_read_write(void __user *buf, int count)
{
byte data[128];
dword cmd, id, mask;
@@ -228,7 +228,7 @@ int maint_read_write(void *buf, int count)
diva_os_spin_lock_magic_t old_irql;
word size;
diva_dbg_entry_head_t *pmsg;
- byte *pbuf = 0;
+ byte *pbuf = NULL;
int written = 0;
if (mask < 4096) {
diff --git a/drivers/isdn/hardware/eicon/os_4bri.c b/drivers/isdn/hardware/eicon/os_4bri.c
index 7dade2d8db95..e6016f92400d 100644
--- a/drivers/isdn/hardware/eicon/os_4bri.c
+++ b/drivers/isdn/hardware/eicon/os_4bri.c
@@ -17,7 +17,7 @@
#include "mi_pc.h"
#include "dsrv4bri.h"
-void *diva_xdiLoadFileFile = 0;
+void *diva_xdiLoadFileFile = NULL;
dword diva_xdiLoadFileLength = 0;
/*
@@ -268,7 +268,7 @@ int diva_4bri_init_card(diva_os_xdi_adapter_t * a)
(diva_os_xdi_adapter_t *) diva_os_malloc(0, sizeof(*a))))
{
diva_os_free(0, a->slave_adapters[0]);
- a->slave_adapters[0] = 0;
+ a->slave_adapters[0] = NULL;
diva_4bri_cleanup_adapter(a);
return (-1);
}
@@ -277,8 +277,8 @@ int diva_4bri_init_card(diva_os_xdi_adapter_t * a)
{
diva_os_free(0, a->slave_adapters[0]);
diva_os_free(0, a->slave_adapters[1]);
- a->slave_adapters[0] = 0;
- a->slave_adapters[1] = 0;
+ a->slave_adapters[0] = NULL;
+ a->slave_adapters[1] = NULL;
diva_4bri_cleanup_adapter(a);
return (-1);
}
@@ -300,7 +300,7 @@ int diva_4bri_init_card(diva_os_xdi_adapter_t * a)
if (!(a->slave_list = quadro_list)) {
for (i = 0; i < (tasks - 1); i++) {
diva_os_free(0, a->slave_adapters[i]);
- a->slave_adapters[i] = 0;
+ a->slave_adapters[i] = NULL;
}
diva_4bri_cleanup_adapter(a);
return (-1);
@@ -499,7 +499,7 @@ static int diva_4bri_cleanup_adapter(diva_os_xdi_adapter_t * a)
&& a->resources.pci.addr[bar]) {
divasa_unmap_pci_bar(a->resources.pci.addr[bar]);
a->resources.pci.bar[bar] = 0;
- a->resources.pci.addr[bar] = 0;
+ a->resources.pci.addr[bar] = NULL;
}
}
}
@@ -515,12 +515,12 @@ static int diva_4bri_cleanup_adapter(diva_os_xdi_adapter_t * a)
_4bri_bar_length[1],
&a->port_name[0], 1);
a->resources.pci.bar[1] = 0;
- a->resources.pci.addr[1] = 0;
+ a->resources.pci.addr[1] = NULL;
}
if (a->slave_list) {
diva_os_free(0, a->slave_list);
- a->slave_list = 0;
+ a->slave_list = NULL;
}
return (0);
@@ -607,14 +607,14 @@ static int diva_4bri_cleanup_slave_adapters(diva_os_xdi_adapter_t * a)
diva_os_remove_soft_isr(&diva_current->xdi_adapter.
req_soft_isr);
- diva_current->xdi_adapter.isr_soft_isr.object = 0;
+ diva_current->xdi_adapter.isr_soft_isr.object = NULL;
if (diva_current->xdi_adapter.e_tbl) {
diva_os_free(0,
diva_current->xdi_adapter.
e_tbl);
}
- diva_current->xdi_adapter.e_tbl = 0;
+ diva_current->xdi_adapter.e_tbl = NULL;
diva_current->xdi_adapter.e_max = 0;
diva_current->xdi_adapter.e_count = 0;
}
@@ -823,7 +823,7 @@ void *xdiLoadFile(char *FileName, unsigned long *FileLength,
if (FileLength) {
*FileLength = diva_xdiLoadFileLength;
}
- diva_xdiLoadFileFile = 0;
+ diva_xdiLoadFileFile = NULL;
diva_xdiLoadFileLength = 0;
return (ret);
@@ -848,7 +848,7 @@ diva_4bri_write_fpga_image(diva_os_xdi_adapter_t * a, byte * data,
ret = qBri_FPGA_download(&a->xdi_adapter);
- diva_xdiLoadFileFile = 0;
+ diva_xdiLoadFileFile = NULL;
diva_xdiLoadFileLength = 0;
return (ret ? 0 : -1);
@@ -1116,7 +1116,7 @@ static int diva_4bri_stop_adapter(diva_os_xdi_adapter_t * a)
if (a->clear_interrupts_proc) {
diva_4bri_clear_interrupts(a);
- a->clear_interrupts_proc = 0;
+ a->clear_interrupts_proc = NULL;
DBG_ERR(("A: A(%d) no final interrupt from 4BRI adapter",
IoAdapter->ANum))
}
diff --git a/drivers/isdn/hardware/eicon/os_bri.c b/drivers/isdn/hardware/eicon/os_bri.c
index b2acc3fd8beb..e8f023d2df89 100644
--- a/drivers/isdn/hardware/eicon/os_bri.c
+++ b/drivers/isdn/hardware/eicon/os_bri.c
@@ -282,7 +282,7 @@ static int diva_bri_cleanup_adapter(diva_os_xdi_adapter_t * a)
if (a->resources.pci.addr[0] && a->resources.pci.bar[0]) {
divasa_unmap_pci_bar(a->resources.pci.addr[0]);
- a->resources.pci.addr[0] = 0;
+ a->resources.pci.addr[0] = NULL;
a->resources.pci.bar[0] = 0;
}
@@ -293,7 +293,7 @@ static int diva_bri_cleanup_adapter(diva_os_xdi_adapter_t * a)
a->resources.pci.
length[i],
&a->port_name[0], i);
- a->resources.pci.addr[i] = 0;
+ a->resources.pci.addr[i] = NULL;
a->resources.pci.bar[i] = 0;
}
}
@@ -305,7 +305,7 @@ static int diva_bri_cleanup_adapter(diva_os_xdi_adapter_t * a)
diva_os_cancel_soft_isr(&a->xdi_adapter.isr_soft_isr);
diva_os_remove_soft_isr(&a->xdi_adapter.req_soft_isr);
- a->xdi_adapter.isr_soft_isr.object = 0;
+ a->xdi_adapter.isr_soft_isr.object = NULL;
diva_os_destroy_spin_lock(&a->xdi_adapter.isr_spin_lock, "rm");
diva_os_destroy_spin_lock(&a->xdi_adapter.data_spin_lock, "rm");
@@ -315,7 +315,7 @@ static int diva_bri_cleanup_adapter(diva_os_xdi_adapter_t * a)
*/
if (a->xdi_adapter.e_tbl) {
diva_os_free(0, a->xdi_adapter.e_tbl);
- a->xdi_adapter.e_tbl = 0;
+ a->xdi_adapter.e_tbl = NULL;
}
return (0);
@@ -367,7 +367,7 @@ static int diva_bri_reregister_io(diva_os_xdi_adapter_t * a)
diva_os_register_io_port(a, 0, a->resources.pci.bar[i],
a->resources.pci.length[i],
&a->port_name[0], i);
- a->resources.pci.addr[i] = 0;
+ a->resources.pci.addr[i] = NULL;
}
sprintf(a->port_name, "DIVA BRI %ld",
@@ -797,7 +797,7 @@ static int diva_bri_stop_adapter(diva_os_xdi_adapter_t * a)
} while (i-- && a->clear_interrupts_proc);
if (a->clear_interrupts_proc) {
diva_bri_clear_interrupts(a);
- a->clear_interrupts_proc = 0;
+ a->clear_interrupts_proc = NULL;
DBG_ERR(("A: A(%d) no final interrupt from BRI adapter",
IoAdapter->ANum))
}
diff --git a/drivers/isdn/hardware/eicon/os_pri.c b/drivers/isdn/hardware/eicon/os_pri.c
index 0fafdc154d25..28e9df236ca4 100644
--- a/drivers/isdn/hardware/eicon/os_pri.c
+++ b/drivers/isdn/hardware/eicon/os_pri.c
@@ -283,7 +283,7 @@ static int diva_pri_cleanup_adapter(diva_os_xdi_adapter_t * a)
&& a->resources.pci.addr[bar]) {
divasa_unmap_pci_bar(a->resources.pci.addr[bar]);
a->resources.pci.bar[bar] = 0;
- a->resources.pci.addr[bar] = 0;
+ a->resources.pci.addr[bar] = NULL;
}
}
@@ -294,7 +294,7 @@ static int diva_pri_cleanup_adapter(diva_os_xdi_adapter_t * a)
diva_os_cancel_soft_isr(&a->xdi_adapter.req_soft_isr);
diva_os_remove_soft_isr(&a->xdi_adapter.req_soft_isr);
- a->xdi_adapter.isr_soft_isr.object = 0;
+ a->xdi_adapter.isr_soft_isr.object = NULL;
diva_os_destroy_spin_lock(&a->xdi_adapter.isr_spin_lock, "rm");
diva_os_destroy_spin_lock(&a->xdi_adapter.data_spin_lock, "rm");
@@ -304,7 +304,7 @@ static int diva_pri_cleanup_adapter(diva_os_xdi_adapter_t * a)
*/
if (a->xdi_adapter.e_tbl) {
diva_os_free(0, a->xdi_adapter.e_tbl);
- a->xdi_adapter.e_tbl = 0;
+ a->xdi_adapter.e_tbl = NULL;
}
a->xdi_adapter.Channels = 0;
a->xdi_adapter.e_max = 0;
@@ -316,7 +316,7 @@ static int diva_pri_cleanup_adapter(diva_os_xdi_adapter_t * a)
diva_free_dma_map(a->resources.pci.hdev,
(struct _diva_dma_map_entry *) a->xdi_adapter.
dma_map);
- a->xdi_adapter.dma_map = 0;
+ a->xdi_adapter.dma_map = NULL;
/*
@@ -576,7 +576,7 @@ static int diva_pri_stop_adapter(diva_os_xdi_adapter_t * a)
if (a->clear_interrupts_proc) {
diva_pri_clear_interrupts(a);
- a->clear_interrupts_proc = 0;
+ a->clear_interrupts_proc = NULL;
DBG_ERR(("A: A(%d) no final interrupt from PRI adapter",
IoAdapter->ANum))
}
diff --git a/drivers/isdn/hardware/eicon/um_idi.c b/drivers/isdn/hardware/eicon/um_idi.c
index decb8989c34c..6563db998d06 100644
--- a/drivers/isdn/hardware/eicon/um_idi.c
+++ b/drivers/isdn/hardware/eicon/um_idi.c
@@ -188,9 +188,9 @@ static void cleanup_adapter(diva_um_idi_adapter_t * a)
------------------------------------------------------------------------ */
static void cleanup_entity(divas_um_idi_entity_t * e)
{
- e->os_ref = 0;
+ e->os_ref = NULL;
e->status = 0;
- e->adapter = 0;
+ e->adapter = NULL;
e->e.Id = 0;
e->rc_count = 0;
@@ -218,20 +218,20 @@ void *divas_um_idi_create_entity(dword adapter_nr, void *file)
diva_os_malloc(0, diva_os_get_context_size()))) {
DBG_LOG(("E(%08x) no memory for os context", e));
diva_os_free(0, e);
- return (0);
+ return NULL;
}
memset(e->os_context, 0x00, diva_os_get_context_size());
if ((diva_data_q_init(&e->data, 2048 + 512, 16))) {
diva_os_free(0, e->os_context);
diva_os_free(0, e);
- return (0);
+ return NULL;
}
if ((diva_data_q_init(&e->rc, sizeof(diva_um_idi_ind_hdr_t), 2))) {
diva_data_q_finit(&e->data);
diva_os_free(0, e->os_context);
diva_os_free(0, e);
- return (0);
+ return NULL;
}
diva_os_enter_spin_lock(&adapter_lock, &old_irql, "create_entity");
@@ -250,7 +250,7 @@ void *divas_um_idi_create_entity(dword adapter_nr, void *file)
diva_os_free(0, e->os_context);
diva_os_free(0, e);
- return (0);
+ return NULL;
}
e->os_ref = file; /* link to os handle */
@@ -608,9 +608,9 @@ static int process_idi_request(divas_um_idi_entity_t * e,
e->e.IndCh = 0;
e->e.XNum = 0;
e->e.RNum = 0;
- e->e.callback = 0;
- e->e.X = 0;
- e->e.R = 0;
+ e->e.callback = NULL;
+ e->e.X = NULL;
+ e->e.R = NULL;
write_return_code(e, ASSIGN_RC | OUT_OF_RESOURCES);
return (-2);
} else {
@@ -631,7 +631,7 @@ static int process_idi_rc(divas_um_idi_entity_t * e, byte rc)
if (rc != ASSIGN_OK) {
DBG_ERR(("A: A(%d) E(%08x) ASSIGN failed",
e->adapter->adapter_nr, e));
- e->e.callback = 0;
+ e->e.callback = NULL;
e->e.Id = 0;
e->e.Req = 0;
e->e.ReqCh = 0;
@@ -639,8 +639,8 @@ static int process_idi_rc(divas_um_idi_entity_t * e, byte rc)
e->e.RcCh = 0;
e->e.Ind = 0;
e->e.IndCh = 0;
- e->e.X = 0;
- e->e.R = 0;
+ e->e.X = NULL;
+ e->e.R = NULL;
e->e.XNum = 0;
e->e.RNum = 0;
}
@@ -651,7 +651,7 @@ static int process_idi_rc(divas_um_idi_entity_t * e, byte rc)
return (0); /* let us do it in the driver */
}
if ((e->e.Req == REMOVE) && (!e->e.Id)) { /* REMOVE COMPLETE */
- e->e.callback = 0;
+ e->e.callback = NULL;
e->e.Id = 0;
e->e.Req = 0;
e->e.ReqCh = 0;
@@ -659,8 +659,8 @@ static int process_idi_rc(divas_um_idi_entity_t * e, byte rc)
e->e.RcCh = 0;
e->e.Ind = 0;
e->e.IndCh = 0;
- e->e.X = 0;
- e->e.R = 0;
+ e->e.X = NULL;
+ e->e.R = NULL;
e->e.XNum = 0;
e->e.RNum = 0;
e->rc_count = 0;
diff --git a/drivers/isdn/hisax/config.c b/drivers/isdn/hisax/config.c
index b3a26ffd5ded..7a2d65a911e7 100644
--- a/drivers/isdn/hisax/config.c
+++ b/drivers/isdn/hisax/config.c
@@ -618,10 +618,10 @@ struct IsdnCardState *hisax_get_card(int cardnr)
return NULL;
}
-int HiSax_readstatus(u_char * buf, int len, int user, int id, int channel)
+int HiSax_readstatus(u_char __user *buf, int len, int id, int channel)
{
int count, cnt;
- u_char *p = buf;
+ u_char __user *p = buf;
struct IsdnCardState *cs = hisax_findcard(id);
if (cs) {
@@ -633,10 +633,7 @@ int HiSax_readstatus(u_char * buf, int len, int user, int id, int channel)
count = cs->status_end - cs->status_read + 1;
if (count >= len)
count = len;
- if (user)
- copy_to_user(p, cs->status_read, count);
- else
- memcpy(p, cs->status_read, count);
+ copy_to_user(p, cs->status_read, count);
cs->status_read += count;
if (cs->status_read > cs->status_end)
cs->status_read = cs->status_buf;
@@ -647,10 +644,7 @@ int HiSax_readstatus(u_char * buf, int len, int user, int id, int channel)
cnt = HISAX_STATUS_BUFSIZE;
else
cnt = count;
- if (user)
- copy_to_user(p, cs->status_read, cnt);
- else
- memcpy(p, cs->status_read, cnt);
+ copy_to_user(p, cs->status_read, cnt);
p += cnt;
cs->status_read += cnt % HISAX_STATUS_BUFSIZE;
count -= cnt;
@@ -1586,7 +1580,7 @@ int hisax_register(struct hisax_d_if *hisax_d_if, struct hisax_b_if *b_if[],
cards[i].protocol = protocol;
sprintf(id, "%s%d", name, i);
nrcards++;
- retval = checkcard(i, id, 0, hisax_d_if->owner);
+ retval = checkcard(i, id, NULL, hisax_d_if->owner);
if (retval == 0) { // yuck
cards[i].typ = 0;
nrcards--;
diff --git a/drivers/isdn/hisax/diva.c b/drivers/isdn/hisax/diva.c
index 7471d4b87330..843ed75f82c2 100644
--- a/drivers/isdn/hisax/diva.c
+++ b/drivers/isdn/hisax/diva.c
@@ -1158,7 +1158,7 @@ ready:
cs->writeisacfifo = &MemWriteISACfifo_IPACX;
cs->BC_Read_Reg = &MemReadHSCX_IPACX;
cs->BC_Write_Reg = &MemWriteHSCX_IPACX;
- cs->BC_Send_Data = 0; // function located in ipacx module
+ cs->BC_Send_Data = NULL; // function located in ipacx module
cs->irq_func = &diva_irq_ipacx_pci;
printk(KERN_INFO "Diva: IPACX Design Id: %x\n",
MemReadISAC_IPACX(cs, IPACX_ID) &0x3F);
diff --git a/drivers/isdn/hisax/elsa_ser.c b/drivers/isdn/hisax/elsa_ser.c
index 479164b3a213..689c83395693 100644
--- a/drivers/isdn/hisax/elsa_ser.c
+++ b/drivers/isdn/hisax/elsa_ser.c
@@ -401,7 +401,7 @@ static void rs_interrupt_elsa(int irq, struct IsdnCardState *cs)
if (status & UART_LSR_DR)
receive_chars(cs, &status);
if (status & UART_LSR_THRE)
- transmit_chars(cs, 0);
+ transmit_chars(cs, NULL);
if (pass_counter++ > RS_ISR_PASS_LIMIT) {
printk("rs_single loop break.\n");
break;
diff --git a/drivers/isdn/hisax/hfc_usb.c b/drivers/isdn/hisax/hfc_usb.c
index c95d91d58c1d..4490c883f755 100644
--- a/drivers/isdn/hisax/hfc_usb.c
+++ b/drivers/isdn/hisax/hfc_usb.c
@@ -133,7 +133,7 @@ static const char *hfcusb_revision = "4.0";
/**********/
/* macros */
/**********/
-#define write_usb(a,b,c) usb_control_msg((a)->dev,(a)->ctrl_out_pipe,0,0x40,(c),(b),0,0,HFC_CTRL_TIMEOUT)
+#define write_usb(a,b,c) usb_control_msg((a)->dev,(a)->ctrl_out_pipe,0,0x40,(c),(b),NULL,0,HFC_CTRL_TIMEOUT)
#define read_usb(a,b,c) usb_control_msg((a)->dev,(a)->ctrl_in_pipe,1,0xC0,0,(b),(c),1,HFC_CTRL_TIMEOUT)
/*************************************************/
@@ -353,7 +353,7 @@ vendor_data vdata[]=
{0x8e3, 0x0301, "Olitec USB RNIS", LED_SCHEME1, LED_NORMAL, {2,0,1,4}}, /* Olitec TA */
{0x675, 0x1688, "DrayTec USB ISDN TA", LED_SCHEME1, LED_NORMAL, {4,0,2,1}}, /* Draytec TA */
{0x7fa, 0x0846, "Bewan Modem RNIS USB", LED_SCHEME1, LED_INVERTED, {8,0x40,0x20,0x10}}, /* Bewan TA */
- {0,0,0} // EOL element
+ {0} // EOL element
};
/***************************************************/
diff --git a/drivers/isdn/hisax/isar.c b/drivers/isdn/hisax/isar.c
index 44aecafa658c..ee081321efb2 100644
--- a/drivers/isdn/hisax/isar.c
+++ b/drivers/isdn/hisax/isar.c
@@ -186,12 +186,12 @@ ISARVersion(struct IsdnCardState *cs, char *s)
}
int
-isar_load_firmware(struct IsdnCardState *cs, u_char *buf)
+isar_load_firmware(struct IsdnCardState *cs, u_char __user *buf)
{
int ret, size, cnt, debug;
u_char len, nom, noc;
u_short sadr, left, *sp;
- u_char *p = buf;
+ u_char __user *p = buf;
u_char *msg, *tmpmsg, *mp, tmp[64];
u_long flags;
struct isar_reg *ireg = cs->bcs[0].hw.isar.reg;
@@ -1856,7 +1856,7 @@ isar_auxcmd(struct IsdnCardState *cs, isdn_ctrl *ic) {
ISDN_FEATURE_L2_FAX |
ISDN_FEATURE_L3_FCLASS1;
memcpy(&adr, ic->parm.num, sizeof(ulong));
- if (isar_load_firmware(cs, (u_char *)adr))
+ if (isar_load_firmware(cs, (u_char __user *)adr))
return(1);
else
ll_run(cs, features);
diff --git a/drivers/isdn/hisax/tei.c b/drivers/isdn/hisax/tei.c
index 30143651666b..6056ac1d7673 100644
--- a/drivers/isdn/hisax/tei.c
+++ b/drivers/isdn/hisax/tei.c
@@ -239,7 +239,7 @@ tei_id_remove(struct FsmInst *fi, int event, void *arg)
if ((st->l2.tei != -1) && ((tei == GROUP_TEI) || (tei == st->l2.tei))) {
FsmDelTimer(&st->ma.t202, 5);
FsmChangeState(&st->ma.tei_m, ST_TEI_NOP);
- st->l3.l3l2(st, MDL_REMOVE | REQUEST, 0);
+ st->l3.l3l2(st, MDL_REMOVE | REQUEST, NULL);
cs = (struct IsdnCardState *) st->l1.hardware;
cs->cardmsg(cs, MDL_REMOVE | REQUEST, NULL);
}
@@ -275,7 +275,7 @@ tei_id_req_tout(struct FsmInst *fi, int event, void *arg)
FsmAddTimer(&st->ma.t202, st->ma.T202, EV_T202, NULL, 3);
} else {
st->ma.tei_m.printdebug(&st->ma.tei_m, "assign req failed");
- st->l3.l3l2(st, MDL_ERROR | RESPONSE, 0);
+ st->l3.l3l2(st, MDL_ERROR | RESPONSE, NULL);
cs = (struct IsdnCardState *) st->l1.hardware;
cs->cardmsg(cs, MDL_REMOVE | REQUEST, NULL);
FsmChangeState(fi, ST_TEI_NOP);
@@ -298,7 +298,7 @@ tei_id_ver_tout(struct FsmInst *fi, int event, void *arg)
} else {
st->ma.tei_m.printdebug(&st->ma.tei_m,
"verify req for tei %d failed", st->l2.tei);
- st->l3.l3l2(st, MDL_REMOVE | REQUEST, 0);
+ st->l3.l3l2(st, MDL_REMOVE | REQUEST, NULL);
cs = (struct IsdnCardState *) st->l1.hardware;
cs->cardmsg(cs, MDL_REMOVE | REQUEST, NULL);
FsmChangeState(fi, ST_TEI_NOP);
diff --git a/drivers/isdn/i4l/isdn_common.c b/drivers/isdn/i4l/isdn_common.c
index bace9a557ed9..eb71c80924a0 100644
--- a/drivers/isdn/i4l/isdn_common.c
+++ b/drivers/isdn/i4l/isdn_common.c
@@ -959,7 +959,7 @@ isdn_read(struct file *file, char __user *buf, size_t count, loff_t * off)
interruptible_sleep_on(&(dev->info_waitq));
}
p = isdn_statstr();
- file->private_data = 0;
+ file->private_data = NULL;
if ((len = strlen(p)) <= count) {
if (copy_to_user(buf, p, len)) {
retval = -EFAULT;
@@ -992,7 +992,7 @@ isdn_read(struct file *file, char __user *buf, size_t count, loff_t * off)
retval = -ENOMEM;
goto out;
}
- len = isdn_readbchan(drvidx, chidx, p, 0, count,
+ len = isdn_readbchan(drvidx, chidx, p, NULL, count,
&dev->drv[drvidx]->rcv_waitq[chidx]);
*off += len;
if (copy_to_user(buf,p,len))
@@ -1018,7 +1018,7 @@ isdn_read(struct file *file, char __user *buf, size_t count, loff_t * off)
if (count > dev->drv[drvidx]->stavail)
count = dev->drv[drvidx]->stavail;
len = dev->drv[drvidx]->interface->
- readstat(buf, count, 1, drvidx,
+ readstat(buf, count, drvidx,
isdn_minor2chan(minor));
} else {
len = 0;
@@ -1091,7 +1091,7 @@ isdn_write(struct file *file, const char __user *buf, size_t count, loff_t * off
*/
if (dev->drv[drvidx]->interface->writecmd)
retval = dev->drv[drvidx]->interface->
- writecmd(buf, count, 1, drvidx, isdn_minor2chan(minor));
+ writecmd(buf, count, drvidx, isdn_minor2chan(minor));
else
retval = count;
goto out;
diff --git a/drivers/isdn/i4l/isdn_net.c b/drivers/isdn/i4l/isdn_net.c
index 87015695256d..443cb25e1270 100644
--- a/drivers/isdn/i4l/isdn_net.c
+++ b/drivers/isdn/i4l/isdn_net.c
@@ -396,8 +396,8 @@ isdn_net_stat_callback(int idx, isdn_ctrl *c)
if (p) {
isdn_net_local *lp = p->local;
#ifdef CONFIG_ISDN_X25
- struct concap_proto *cprot = lp -> netdev -> cprot;
- struct concap_proto_ops *pops = cprot ? cprot -> pops : 0;
+ struct concap_proto *cprot = lp->netdev->cprot;
+ struct concap_proto_ops *pops = cprot ? cprot->pops : NULL;
#endif
switch (cmd) {
case ISDN_STAT_BSENT:
@@ -617,7 +617,7 @@ isdn_net_dial(void)
s = "dial suppressed: isdn system stopped";
else
s = "dial suppressed: dialmode `off'";
- isdn_net_unreachable(&p->dev, 0, s);
+ isdn_net_unreachable(&p->dev, NULL, s);
isdn_net_hangup(&p->dev);
break;
}
@@ -645,7 +645,7 @@ isdn_net_dial(void)
if (time_after(jiffies, lp->dialstarted + lp->dialtimeout)) {
lp->dialwait_timer = jiffies + lp->dialwait;
lp->dialstarted = 0;
- isdn_net_unreachable(&p->dev, 0, "dial: timed out");
+ isdn_net_unreachable(&p->dev, NULL, "dial: timed out");
isdn_net_hangup(&p->dev);
break;
}
@@ -675,7 +675,7 @@ isdn_net_dial(void)
if (lp->dialtimeout == 0) {
lp->dialwait_timer = jiffies + lp->dialwait;
lp->dialstarted = 0;
- isdn_net_unreachable(&p->dev, 0, "dial: tried all numbers dialmax times");
+ isdn_net_unreachable(&p->dev, NULL, "dial: tried all numbers dialmax times");
}
isdn_net_hangup(&p->dev);
break;
@@ -827,8 +827,8 @@ isdn_net_hangup(struct net_device *d)
isdn_net_local *lp = (isdn_net_local *) d->priv;
isdn_ctrl cmd;
#ifdef CONFIG_ISDN_X25
- struct concap_proto *cprot = lp -> netdev -> cprot;
- struct concap_proto_ops *pops = cprot ? cprot -> pops : 0;
+ struct concap_proto *cprot = lp->netdev->cprot;
+ struct concap_proto_ops *pops = cprot ? cprot->pops : NULL;
#endif
if (lp->flags & ISDN_NET_CONNECTED) {
@@ -1416,11 +1416,10 @@ isdn_net_ciscohdlck_alloc_skb(isdn_net_local *lp, int len)
struct sk_buff *skb;
skb = alloc_skb(hl + len, GFP_ATOMIC);
- if (!skb) {
+ if (skb)
+ skb_reserve(skb, hl);
+ else
printk("isdn out of mem at %s:%d!\n", __FILE__, __LINE__);
- return 0;
- }
- skb_reserve(skb, hl);
return skb;
}
@@ -2182,7 +2181,7 @@ isdn_net_find_icall(int di, int ch, int idx, setup_parm *setup)
*my_eaz == 'b' || *my_eaz == 'B')
my_eaz++; /* skip to allow a match */
else
- my_eaz = 0; /* force non match */
+ my_eaz = NULL; /* force non match */
} else { /* it's a DATA call, check if we allow it */
if (*my_eaz == 'b' || *my_eaz == 'B')
my_eaz++; /* skip to allow a match */
diff --git a/drivers/isdn/i4l/isdn_tty.c b/drivers/isdn/i4l/isdn_tty.c
index 3fc515dca012..02b912ab138c 100644
--- a/drivers/isdn/i4l/isdn_tty.c
+++ b/drivers/isdn/i4l/isdn_tty.c
@@ -134,7 +134,7 @@ isdn_tty_readmodem(void)
if (c > 0) {
r = isdn_readbchan(info->isdn_driver, info->isdn_channel,
tty->flip.char_buf_ptr,
- tty->flip.flag_buf_ptr, c, 0);
+ tty->flip.flag_buf_ptr, c, NULL);
/* CISCO AsyncPPP Hack */
if (!(info->emu.mdmreg[REG_CPPP] & BIT_CPPP))
memset(tty->flip.flag_buf_ptr, 0, r);
@@ -1483,7 +1483,7 @@ isdn_tty_ioctl(struct tty_struct *tty, struct file *file,
#ifdef ISDN_DEBUG_MODEM_IOCTL
printk(KERN_DEBUG "ttyI%d ioctl TIOCSERGETLSR\n", info->line);
#endif
- return isdn_tty_get_lsr_info(info, (uint *) arg);
+ return isdn_tty_get_lsr_info(info, (uint __user *) arg);
default:
#ifdef ISDN_DEBUG_MODEM_IOCTL
printk(KERN_DEBUG "UNKNOWN ioctl 0x%08x on ttyi%d\n", cmd, info->line);
@@ -1751,7 +1751,7 @@ isdn_tty_close(struct tty_struct *tty, struct file *filp)
tty->driver->flush_buffer(tty);
if (tty->ldisc.flush_buffer)
tty->ldisc.flush_buffer(tty);
- info->tty = 0;
+ info->tty = NULL;
info->ncarrier = 0;
tty->closing = 0;
module_put(info->owner);
@@ -1780,7 +1780,7 @@ isdn_tty_hangup(struct tty_struct *tty)
isdn_tty_shutdown(info);
info->count = 0;
info->flags &= ~(ISDN_ASYNC_NORMAL_ACTIVE | ISDN_ASYNC_CALLOUT_ACTIVE);
- info->tty = 0;
+ info->tty = NULL;
wake_up_interruptible(&info->open_wait);
}
@@ -1959,7 +1959,7 @@ isdn_tty_modem_init(void)
isdn_tty_modem_reset_regs(info, 1);
info->magic = ISDN_ASYNC_MAGIC;
info->line = i;
- info->tty = 0;
+ info->tty = NULL;
info->x_char = 0;
info->count = 0;
info->blocked_open = 0;
@@ -2373,8 +2373,8 @@ isdn_tty_at_cout(char *msg, modem_info * info)
char *p;
char c;
u_long flags;
- struct sk_buff *skb = 0;
- char *sp = 0;
+ struct sk_buff *skb = NULL;
+ char *sp = NULL;
if (!msg) {
printk(KERN_WARNING "isdn_tty: Null-Message in isdn_tty_at_cout\n");
diff --git a/drivers/isdn/icn/icn.c b/drivers/isdn/icn/icn.c
index 391a8f139c08..0c256d698686 100644
--- a/drivers/isdn/icn/icn.c
+++ b/drivers/isdn/icn/icn.c
@@ -798,7 +798,7 @@ int slsec = sec; \
#endif
static int
-icn_loadboot(u_char * buffer, icn_card * card)
+icn_loadboot(u_char __user * buffer, icn_card * card)
{
int ret;
u_char *codebuf;
@@ -903,9 +903,9 @@ icn_loadboot(u_char * buffer, icn_card * card)
}
static int
-icn_loadproto(u_char * buffer, icn_card * card)
+icn_loadproto(u_char __user * buffer, icn_card * card)
{
- register u_char *p = buffer;
+ register u_char __user *p = buffer;
u_char codebuf[256];
uint left = ICN_CODE_STAGE2;
uint cnt;
@@ -916,7 +916,7 @@ icn_loadproto(u_char * buffer, icn_card * card)
#ifdef BOOT_DEBUG
printk(KERN_DEBUG "icn_loadproto called\n");
#endif
- if ((ret = verify_area(VERIFY_READ, (void *) buffer, ICN_CODE_STAGE2)))
+ if ((ret = verify_area(VERIFY_READ, buffer, ICN_CODE_STAGE2)))
return ret;
timer = 0;
spin_lock_irqsave(&dev.devlock, flags);
@@ -1007,18 +1007,15 @@ icn_loadproto(u_char * buffer, icn_card * card)
/* Read the Status-replies from the Interface */
static int
-icn_readstatus(u_char * buf, int len, int user, icn_card * card)
+icn_readstatus(u_char __user *buf, int len, icn_card * card)
{
int count;
- u_char *p;
+ u_char __user *p;
for (p = buf, count = 0; count < len; p++, count++) {
if (card->msg_buf_read == card->msg_buf_write)
return count;
- if (user)
- put_user(*card->msg_buf_read++, p);
- else
- *p = *card->msg_buf_read++;
+ put_user(*card->msg_buf_read++, p);
if (card->msg_buf_read > card->msg_buf_end)
card->msg_buf_read = card->msg_buf;
}
@@ -1163,10 +1160,12 @@ icn_command(isdn_ctrl * c, icn_card * card)
char cbuf[60];
isdn_ctrl cmd;
icn_cdef cdef;
+ char __user *arg;
switch (c->command) {
case ISDN_CMD_IOCTL:
memcpy(&a, c->parm.num, sizeof(ulong));
+ arg = (char __user *)a;
switch (c->arg) {
case ICN_IOCTL_SETMMIO:
if (dev.memaddr != (a & 0x0ffc000)) {
@@ -1230,15 +1229,15 @@ icn_command(isdn_ctrl * c, icn_card * card)
case ICN_IOCTL_GETDOUBLE:
return (int) card->doubleS0;
case ICN_IOCTL_DEBUGVAR:
- if (copy_to_user((char *)a,
- (char *)&card,
+ if (copy_to_user(arg,
+ &card,
sizeof(ulong)))
return -EFAULT;
a += sizeof(ulong);
{
ulong l = (ulong) & dev;
- if (copy_to_user((char *)a,
- (char *)&l,
+ if (copy_to_user(arg,
+ &l,
sizeof(ulong)))
return -EFAULT;
}
@@ -1249,20 +1248,20 @@ icn_command(isdn_ctrl * c, icn_card * card)
dev.firstload = 0;
}
icn_stopcard(card);
- return (icn_loadboot((u_char *) a, card));
+ return (icn_loadboot(arg, card));
case ICN_IOCTL_LOADPROTO:
icn_stopcard(card);
- if ((i = (icn_loadproto((u_char *) a, card))))
+ if ((i = (icn_loadproto(arg, card))))
return i;
if (card->doubleS0)
- i = icn_loadproto((u_char *) (a + ICN_CODE_STAGE2), card->other);
+ i = icn_loadproto(arg + ICN_CODE_STAGE2, card->other);
return i;
break;
case ICN_IOCTL_ADDCARD:
if (!dev.firstload)
return -EBUSY;
- if (copy_from_user((char *)&cdef,
- (char *)a,
+ if (copy_from_user(&cdef,
+ arg,
sizeof(cdef)))
return -EFAULT;
return (icn_addcard(cdef.port, cdef.id1, cdef.id2));
@@ -1470,14 +1469,14 @@ if_command(isdn_ctrl * c)
}
static int
-if_writecmd(const u_char * buf, int len, int user, int id, int channel)
+if_writecmd(const u_char __user *buf, int len, int id, int channel)
{
icn_card *card = icn_findcard(id);
if (card) {
if (!card->flags & ICN_FLAGS_RUNNING)
return -ENODEV;
- return (icn_writecmd(buf, len, user, card));
+ return (icn_writecmd(buf, len, 1, card));
}
printk(KERN_ERR
"icn: if_writecmd called with invalid driverId!\n");
@@ -1485,14 +1484,14 @@ if_writecmd(const u_char * buf, int len, int user, int id, int channel)
}
static int
-if_readstatus(u_char * buf, int len, int user, int id, int channel)
+if_readstatus(u_char __user *buf, int len, int id, int channel)
{
icn_card *card = icn_findcard(id);
if (card) {
if (!card->flags & ICN_FLAGS_RUNNING)
return -ENODEV;
- return (icn_readstatus(buf, len, user, card));
+ return (icn_readstatus(buf, len, card));
}
printk(KERN_ERR
"icn: if_readstatus called with invalid driverId!\n");
diff --git a/drivers/isdn/isdnloop/isdnloop.c b/drivers/isdn/isdnloop/isdnloop.c
index fde3db9abb60..544f41b413ed 100644
--- a/drivers/isdn/isdnloop/isdnloop.c
+++ b/drivers/isdn/isdnloop/isdnloop.c
@@ -443,18 +443,15 @@ isdnloop_sendbuf(int channel, struct sk_buff *skb, isdnloop_card * card)
* number of bytes actually transferred.
*/
static int
-isdnloop_readstatus(u_char * buf, int len, int user, isdnloop_card * card)
+isdnloop_readstatus(u_char __user *buf, int len, isdnloop_card * card)
{
int count;
- u_char *p;
+ u_char __user *p;
for (p = buf, count = 0; count < len; p++, count++) {
if (card->msg_buf_read == card->msg_buf_write)
return count;
- if (user)
- put_user(*card->msg_buf_read++, p);
- else
- *p = *card->msg_buf_read++;
+ put_user(*card->msg_buf_read++, p);
if (card->msg_buf_read > card->msg_buf_end)
card->msg_buf_read = card->msg_buf;
}
@@ -1388,14 +1385,14 @@ if_command(isdn_ctrl * c)
}
static int
-if_writecmd(const u_char * buf, int len, int user, int id, int channel)
+if_writecmd(const u_char __user *buf, int len, int id, int channel)
{
isdnloop_card *card = isdnloop_findcard(id);
if (card) {
if (!card->flags & ISDNLOOP_FLAGS_RUNNING)
return -ENODEV;
- return (isdnloop_writecmd(buf, len, user, card));
+ return (isdnloop_writecmd(buf, len, 1, card));
}
printk(KERN_ERR
"isdnloop: if_writecmd called with invalid driverId!\n");
@@ -1403,14 +1400,14 @@ if_writecmd(const u_char * buf, int len, int user, int id, int channel)
}
static int
-if_readstatus(u_char * buf, int len, int user, int id, int channel)
+if_readstatus(u_char __user *buf, int len, int id, int channel)
{
isdnloop_card *card = isdnloop_findcard(id);
if (card) {
if (!card->flags & ISDNLOOP_FLAGS_RUNNING)
return -ENODEV;
- return (isdnloop_readstatus(buf, len, user, card));
+ return (isdnloop_readstatus(buf, len, card));
}
printk(KERN_ERR
"isdnloop: if_readstatus called with invalid driverId!\n");
diff --git a/drivers/isdn/pcbit/drv.c b/drivers/isdn/pcbit/drv.c
index c3f43a56b6f7..ed8af7ff0a4f 100644
--- a/drivers/isdn/pcbit/drv.c
+++ b/drivers/isdn/pcbit/drv.c
@@ -57,9 +57,9 @@ static char* pcbit_devname[MAX_PCBIT_CARDS] = {
*/
int pcbit_command(isdn_ctrl* ctl);
-int pcbit_stat(u_char* buf, int len, int user, int, int);
+int pcbit_stat(u_char __user * buf, int len, int, int);
int pcbit_xmit(int driver, int chan, int ack, struct sk_buff *skb);
-int pcbit_writecmd(const u_char*, int, int, int, int);
+int pcbit_writecmd(const u_char __user *, int, int, int);
static int set_protocol_running(struct pcbit_dev * dev);
@@ -389,12 +389,13 @@ int pcbit_xmit(int driver, int chnum, int ack, struct sk_buff *skb)
return len;
}
-int pcbit_writecmd(const u_char* buf, int len, int user, int driver, int channel)
+int pcbit_writecmd(const u_char __user *buf, int len, int driver, int channel)
{
struct pcbit_dev * dev;
int i, j;
const u_char * loadbuf;
u_char * ptr = NULL;
+ u_char *cbuf;
int errstat;
@@ -415,37 +416,28 @@ int pcbit_writecmd(const u_char* buf, int len, int user, int driver, int channel
return -EINVAL;
}
- if (user)
- {
- u_char *cbuf = kmalloc(len, GFP_KERNEL);
- if (!cbuf)
- return -ENOMEM;
+ cbuf = kmalloc(len, GFP_KERNEL);
+ if (!cbuf)
+ return -ENOMEM;
- if (copy_from_user(cbuf, buf, len)) {
- kfree(cbuf);
- return -EFAULT;
- }
- memcpy_toio(dev->sh_mem, cbuf, len);
+ if (copy_from_user(cbuf, buf, len)) {
kfree(cbuf);
+ return -EFAULT;
}
- else
- memcpy_toio(dev->sh_mem, buf, len);
+ memcpy_toio(dev->sh_mem, cbuf, len);
+ kfree(cbuf);
return len;
case L2_FWMODE:
/* this is the hard part */
/* dumb board */
- if (user) {
- /* get it into kernel space */
- if ((ptr = kmalloc(len, GFP_KERNEL))==NULL)
- return -ENOMEM;
- if (copy_from_user(ptr, buf, len)) {
- kfree(ptr);
- return -EFAULT;
- }
- loadbuf = ptr;
+ /* get it into kernel space */
+ if ((ptr = kmalloc(len, GFP_KERNEL))==NULL)
+ return -ENOMEM;
+ if (copy_from_user(ptr, buf, len)) {
+ kfree(ptr);
+ return -EFAULT;
}
- else
- loadbuf = buf;
+ loadbuf = ptr;
errstat = 0;
@@ -468,9 +460,7 @@ int pcbit_writecmd(const u_char* buf, int len, int user, int driver, int channel
if (dev->loadptr > LOAD_ZONE_END)
dev->loadptr = LOAD_ZONE_START;
}
-
- if (user)
- kfree(ptr);
+ kfree(ptr);
return errstat ? errstat : len;
default:
@@ -723,17 +713,7 @@ static char statbuf[STATBUF_LEN];
static int stat_st = 0;
static int stat_end = 0;
-
-static __inline void
-memcpy_to_COND(int flag, char *d, const char *s, int len) {
- if (flag)
- copy_to_user(d, s, len);
- else
- memcpy(d, s, len);
-}
-
-
-int pcbit_stat(u_char* buf, int len, int user, int driver, int channel)
+int pcbit_stat(u_char __user *buf, int len, int driver, int channel)
{
int stat_count;
stat_count = stat_end - stat_st;
@@ -747,24 +727,23 @@ int pcbit_stat(u_char* buf, int len, int user, int driver, int channel)
if (stat_st < stat_end)
{
- memcpy_to_COND(user, buf, statbuf + stat_st, len);
+ copy_to_user(buf, statbuf + stat_st, len);
stat_st += len;
}
else
{
if (len > STATBUF_LEN - stat_st)
{
- memcpy_to_COND(user, buf, statbuf + stat_st,
+ copy_to_user(buf, statbuf + stat_st,
STATBUF_LEN - stat_st);
- memcpy_to_COND(user, buf, statbuf,
+ copy_to_user(buf, statbuf,
len - (STATBUF_LEN - stat_st));
stat_st = len - (STATBUF_LEN - stat_st);
}
else
{
- memcpy_to_COND(user, buf, statbuf + stat_st,
- len);
+ copy_to_user(buf, statbuf + stat_st, len);
stat_st += len;
diff --git a/drivers/isdn/pcbit/module.c b/drivers/isdn/pcbit/module.c
index 1a0d6b8482dc..c546ad3c8128 100644
--- a/drivers/isdn/pcbit/module.c
+++ b/drivers/isdn/pcbit/module.c
@@ -25,11 +25,11 @@ MODULE_LICENSE("GPL");
MODULE_PARM(mem, "1-" __MODULE_STRING(MAX_PCBIT_CARDS) "i");
MODULE_PARM(irq, "1-" __MODULE_STRING(MAX_PCBIT_CARDS) "i");
-static int mem[MAX_PCBIT_CARDS] = {0, };
-static int irq[MAX_PCBIT_CARDS] = {0, };
+static int mem[MAX_PCBIT_CARDS];
+static int irq[MAX_PCBIT_CARDS];
static int num_boards;
-struct pcbit_dev * dev_pcbit[MAX_PCBIT_CARDS] = {0, };
+struct pcbit_dev * dev_pcbit[MAX_PCBIT_CARDS];
extern void pcbit_terminate(int board);
extern int pcbit_init_dev(int board, int mem_base, int irq);
diff --git a/drivers/isdn/sc/command.c b/drivers/isdn/sc/command.c
index e37879a9acb5..b2c4eac7cef5 100644
--- a/drivers/isdn/sc/command.c
+++ b/drivers/isdn/sc/command.c
@@ -117,7 +117,7 @@ int command(isdn_ctrl *cmd)
scs_ioctl ioc;
memcpy(&cmdptr, cmd->parm.num, sizeof(unsigned long));
- if (copy_from_user(&ioc, (scs_ioctl *)cmdptr,
+ if (copy_from_user(&ioc, (scs_ioctl __user *)cmdptr,
sizeof(scs_ioctl))) {
pr_debug("%s: Failed to verify user space 0x%x\n",
sc_adapter[card]->devicename, cmdptr);
@@ -215,7 +215,7 @@ int startproc(int card)
status = sendmessage(card, CMPID,cmReqType2,
cmReqClass0,
cmReqStartProc,
- 0,0,0);
+ 0,0,NULL);
pr_debug("%s: Sent startProc\n", sc_adapter[card]->devicename);
return status;
diff --git a/drivers/isdn/sc/ioctl.c b/drivers/isdn/sc/ioctl.c
index 70e0faadc906..1371a990416a 100644
--- a/drivers/isdn/sc/ioctl.c
+++ b/drivers/isdn/sc/ioctl.c
@@ -72,7 +72,7 @@ int sc_ioctl(int card, scs_ioctl *data)
/*
* Get the SRec from user space
*/
- if (copy_from_user(srec, (char *) data->dataptr, sizeof(srec))) {
+ if (copy_from_user(srec, data->dataptr, sizeof(srec))) {
kfree(rcvmsg);
kfree(srec);
return -EFAULT;
@@ -118,8 +118,7 @@ int sc_ioctl(int card, scs_ioctl *data)
/*
* Get the switch type from user space
*/
- if (copy_from_user(&switchtype, (char *)data->dataptr,
- sizeof(char))) {
+ if (copy_from_user(&switchtype, data->dataptr, sizeof(char))) {
kfree(rcvmsg);
return -EFAULT;
}
@@ -152,7 +151,7 @@ int sc_ioctl(int card, scs_ioctl *data)
* Get the switch type from the board
*/
status = send_and_receive(card, CEPID, ceReqTypeCall, ceReqClass0,
- ceReqCallGetSwitchType, 0, 0, 0, rcvmsg, SAR_TIMEOUT);
+ ceReqCallGetSwitchType, 0, 0, NULL, rcvmsg, SAR_TIMEOUT);
if (!status && !(rcvmsg->rsp_status)) {
pr_debug("%s: SCIOCGETSWITCH: command successful\n",
sc_adapter[card]->devicename);
@@ -169,7 +168,7 @@ int sc_ioctl(int card, scs_ioctl *data)
/*
* Package the switch type and send to user space
*/
- if (copy_to_user((char *)data->dataptr, &switchtype,
+ if (copy_to_user(data->dataptr, &switchtype,
sizeof(char))) {
kfree(rcvmsg);
return -EFAULT;
@@ -193,7 +192,7 @@ int sc_ioctl(int card, scs_ioctl *data)
* Get the spid from the board
*/
status = send_and_receive(card, CEPID, ceReqTypeCall, ceReqClass0, ceReqCallGetSPID,
- data->channel, 0, 0, rcvmsg, SAR_TIMEOUT);
+ data->channel, 0, NULL, rcvmsg, SAR_TIMEOUT);
if (!status) {
pr_debug("%s: SCIOCGETSPID: command successful\n",
sc_adapter[card]->devicename);
@@ -209,7 +208,7 @@ int sc_ioctl(int card, scs_ioctl *data)
/*
* Package the switch type and send to user space
*/
- if (copy_to_user((char *)data->dataptr, spid, SCIOC_SPIDSIZE)) {
+ if (copy_to_user(data->dataptr, spid, SCIOC_SPIDSIZE)) {
kfree(spid);
kfree(rcvmsg);
return -EFAULT;
@@ -234,7 +233,7 @@ int sc_ioctl(int card, scs_ioctl *data)
/*
* Get the spid from user space
*/
- if (copy_from_user(spid, (char *) data->dataptr, SCIOC_SPIDSIZE)) {
+ if (copy_from_user(spid, data->dataptr, SCIOC_SPIDSIZE)) {
kfree(rcvmsg);
return -EFAULT;
}
@@ -269,7 +268,7 @@ int sc_ioctl(int card, scs_ioctl *data)
* Get the dn from the board
*/
status = send_and_receive(card, CEPID, ceReqTypeCall, ceReqClass0, ceReqCallGetMyNumber,
- data->channel, 0, 0, rcvmsg, SAR_TIMEOUT);
+ data->channel, 0, NULL, rcvmsg, SAR_TIMEOUT);
if (!status) {
pr_debug("%s: SCIOCGETDN: command successful\n",
sc_adapter[card]->devicename);
@@ -292,7 +291,7 @@ int sc_ioctl(int card, scs_ioctl *data)
/*
* Package the dn and send to user space
*/
- if (copy_to_user((char *)data->dataptr, dn, SCIOC_DNSIZE)) {
+ if (copy_to_user(data->dataptr, dn, SCIOC_DNSIZE)) {
kfree(dn);
return -EFAULT;
}
@@ -313,7 +312,7 @@ int sc_ioctl(int card, scs_ioctl *data)
/*
* Get the spid from user space
*/
- if (copy_from_user(dn, (char *)data->dataptr, SCIOC_DNSIZE)) {
+ if (copy_from_user(dn, data->dataptr, SCIOC_DNSIZE)) {
kfree(rcvmsg);
kfree(dn);
return -EFAULT;
@@ -366,8 +365,7 @@ int sc_ioctl(int card, scs_ioctl *data)
kfree(rcvmsg);
GetStatus(card, bi);
- if (copy_to_user((boardInfo *)data->dataptr, bi,
- sizeof(boardInfo))) {
+ if (copy_to_user(data->dataptr, bi, sizeof(boardInfo))) {
kfree(bi);
return -EFAULT;
}
@@ -385,7 +383,7 @@ int sc_ioctl(int card, scs_ioctl *data)
* Get the speed from the board
*/
status = send_and_receive(card, CEPID, ceReqTypeCall, ceReqClass0,
- ceReqCallGetCallType, data->channel, 0, 0, rcvmsg, SAR_TIMEOUT);
+ ceReqCallGetCallType, data->channel, 0, NULL, rcvmsg, SAR_TIMEOUT);
if (!status && !(rcvmsg->rsp_status)) {
pr_debug("%s: SCIOCGETSPEED: command successful\n",
sc_adapter[card]->devicename);
@@ -405,7 +403,7 @@ int sc_ioctl(int card, scs_ioctl *data)
* Package the switch type and send to user space
*/
- if (copy_to_user((char *) data->dataptr, &speed, sizeof(char)))
+ if (copy_to_user(data->dataptr, &speed, sizeof(char)))
return -EFAULT;
return 0;
diff --git a/drivers/isdn/sc/scioc.h b/drivers/isdn/sc/scioc.h
index c3dd551ecc3c..d08e650c7b6a 100644
--- a/drivers/isdn/sc/scioc.h
+++ b/drivers/isdn/sc/scioc.h
@@ -27,7 +27,7 @@ typedef struct {
int device;
int channel;
unsigned long command;
- void *dataptr;
+ void __user *dataptr;
} scs_ioctl;
/* Size of strings */
diff --git a/drivers/isdn/tpam/tpam.h b/drivers/isdn/tpam/tpam.h
index 96d0db3e5508..c1456d4b6170 100644
--- a/drivers/isdn/tpam/tpam.h
+++ b/drivers/isdn/tpam/tpam.h
@@ -173,8 +173,8 @@ extern void copy_to_pam_dword(tpam_card *, const void *, u32);
extern void copy_to_pam(tpam_card *, void *, const void *, u32);
extern u32 copy_from_pam_dword(tpam_card *, const void *);
extern void copy_from_pam(tpam_card *, void *, const void *, u32);
-extern int copy_from_pam_to_user(tpam_card *, void *, const void *, u32);
-extern int copy_from_user_to_pam(tpam_card *, void *, const void *, u32);
+extern int copy_from_pam_to_user(tpam_card *, void __user *, const void *, u32);
+extern int copy_from_user_to_pam(tpam_card *, void *, const void __user *, u32);
extern int tpam_verify_area(u32, u32);
/* Function prototypes from tpam_nco.c */
diff --git a/drivers/isdn/tpam/tpam_commands.c b/drivers/isdn/tpam/tpam_commands.c
index 02c199594c2e..9cf6ef14fb1d 100644
--- a/drivers/isdn/tpam/tpam_commands.c
+++ b/drivers/isdn/tpam/tpam_commands.c
@@ -120,7 +120,7 @@ static int tpam_command_ioctl_dspload(tpam_card *card, u32 arg) {
dprintk("TurboPAM(tpam_command_ioctl_dspload): card=%d\n", card->id);
/* get the IOCTL parameter from userspace */
- if (copy_from_user(&tdl, (void *)arg, sizeof(tpam_dsp_ioctl)))
+ if (copy_from_user(&tdl, (void __user *)arg, sizeof(tpam_dsp_ioctl)))
return -EFAULT;
/* if the board's firmware was started, protect against writes
@@ -131,7 +131,7 @@ static int tpam_command_ioctl_dspload(tpam_card *card, u32 arg) {
/* write the data in the board's memory */
return copy_from_user_to_pam(card, (void *)tdl.address,
- (void *)arg + sizeof(tpam_dsp_ioctl),
+ (void __user *)arg + sizeof(tpam_dsp_ioctl),
tdl.data_len);
}
@@ -150,7 +150,7 @@ static int tpam_command_ioctl_dspsave(tpam_card *card, u32 arg) {
dprintk("TurboPAM(tpam_command_ioctl_dspsave): card=%d\n", card->id);
/* get the IOCTL parameter from userspace */
- if (copy_from_user(&tdl, (void *)arg, sizeof(tpam_dsp_ioctl)))
+ if (copy_from_user(&tdl, (void __user *)arg, sizeof(tpam_dsp_ioctl)))
return -EFAULT;
/* protect against read from unallowed memory areas */
@@ -158,7 +158,7 @@ static int tpam_command_ioctl_dspsave(tpam_card *card, u32 arg) {
return -EPERM;
/* read the data from the board's memory */
- return copy_from_pam_to_user(card, (void *)arg + sizeof(tpam_dsp_ioctl),
+ return copy_from_pam_to_user(card, (void __user *)arg + sizeof(tpam_dsp_ioctl),
(void *)tdl.address, tdl.data_len);
}
diff --git a/drivers/isdn/tpam/tpam_memory.c b/drivers/isdn/tpam/tpam_memory.c
index fe70c08b5477..c1b6118a424e 100644
--- a/drivers/isdn/tpam/tpam_memory.c
+++ b/drivers/isdn/tpam/tpam_memory.c
@@ -125,7 +125,7 @@ void copy_from_pam(tpam_card *card, void *to, const void *from, u32 n) {
*
* Return: 0 if OK, <0 if error.
*/
-int copy_from_pam_to_user(tpam_card *card, void *to, const void *from, u32 n) {
+int copy_from_pam_to_user(tpam_card *card, void __user *to, const void *from, u32 n) {
void *page;
u32 count;
@@ -171,7 +171,7 @@ int copy_from_pam_to_user(tpam_card *card, void *to, const void *from, u32 n) {
*
* Return: 0 if OK, <0 if error.
*/
-int copy_from_user_to_pam(tpam_card *card, void *to, const void *from, u32 n) {
+int copy_from_user_to_pam(tpam_card *card, void *to, const void __user *from, u32 n) {
void *page;
u32 count;
diff --git a/drivers/md/kcopyd.c b/drivers/md/kcopyd.c
index 8bdf11700ce1..f2961618b742 100644
--- a/drivers/md/kcopyd.c
+++ b/drivers/md/kcopyd.c
@@ -84,7 +84,7 @@ static int kcopyd_get_pages(struct kcopyd_client *kc,
;
kc->pages = pl->next;
- pl->next = 0;
+ pl->next = NULL;
spin_unlock(&kc->lock);
diff --git a/drivers/media/common/saa7146_vbi.c b/drivers/media/common/saa7146_vbi.c
index 0a6c5d6a9025..6c4f0bedda1c 100644
--- a/drivers/media/common/saa7146_vbi.c
+++ b/drivers/media/common/saa7146_vbi.c
@@ -459,7 +459,7 @@ static void vbi_irq_done(struct saa7146_dev *dev, unsigned long status)
spin_unlock(&dev->slock);
}
-static ssize_t vbi_read(struct file *file, char *data, size_t count, loff_t *ppos)
+static ssize_t vbi_read(struct file *file, char __user *data, size_t count, loff_t *ppos)
{
struct saa7146_fh *fh = file->private_data;
struct saa7146_dev *dev = fh->dev;
diff --git a/drivers/media/common/saa7146_video.c b/drivers/media/common/saa7146_video.c
index 93299758d7ad..56484f892b42 100644
--- a/drivers/media/common/saa7146_video.c
+++ b/drivers/media/common/saa7146_video.c
@@ -1450,7 +1450,7 @@ static void video_irq_done(struct saa7146_dev *dev, unsigned long st)
spin_unlock(&dev->slock);
}
-static ssize_t video_read(struct file *file, char *data, size_t count, loff_t *ppos)
+static ssize_t video_read(struct file *file, char __user *data, size_t count, loff_t *ppos)
{
struct saa7146_fh *fh = file->private_data;
struct saa7146_dev *dev = fh->dev;
diff --git a/drivers/media/dvb/dvb-core/dmxdev.c b/drivers/media/dvb/dvb-core/dmxdev.c
index 4a780e55e189..530a0a45dbde 100644
--- a/drivers/media/dvb/dvb-core/dmxdev.c
+++ b/drivers/media/dvb/dvb-core/dmxdev.c
@@ -97,7 +97,7 @@ static inline int dvb_dmxdev_buffer_write(struct dmxdev_buffer *buf, const u8 *s
}
static ssize_t dvb_dmxdev_buffer_read(struct dmxdev_buffer *src,
- int non_blocking, char *buf, size_t count, loff_t *ppos)
+ int non_blocking, char __user *buf, size_t count, loff_t *ppos)
{
unsigned long todo=count;
int split, avail, error;
@@ -253,7 +253,7 @@ static int dvb_dvr_release(struct inode *inode, struct file *file)
return 0;
}
-static ssize_t dvb_dvr_write(struct file *file, const char *buf,
+static ssize_t dvb_dvr_write(struct file *file, const char __user *buf,
size_t count, loff_t *ppos)
{
struct dvb_device *dvbdev=(struct dvb_device *) file->private_data;
@@ -271,7 +271,7 @@ static ssize_t dvb_dvr_write(struct file *file, const char *buf,
return ret;
}
-static ssize_t dvb_dvr_read(struct file *file, char *buf, size_t count,
+static ssize_t dvb_dvr_read(struct file *file, char __user *buf, size_t count,
loff_t *ppos)
{
struct dvb_device *dvbdev=(struct dvb_device *) file->private_data;
@@ -806,7 +806,7 @@ static int dvb_dmxdev_pes_filter_set(struct dmxdev *dmxdev,
}
static ssize_t dvb_dmxdev_read_sec(struct dmxdev_filter *dfil,
- struct file *file, char *buf, size_t count, loff_t *ppos)
+ struct file *file, char __user *buf, size_t count, loff_t *ppos)
{
int result, hcount;
int done=0;
@@ -845,7 +845,7 @@ static ssize_t dvb_dmxdev_read_sec(struct dmxdev_filter *dfil,
ssize_t
-dvb_demux_read(struct file *file, char *buf, size_t count, loff_t *ppos)
+dvb_demux_read(struct file *file, char __user *buf, size_t count, loff_t *ppos)
{
struct dmxdev_filter *dmxdevfilter=dvb_dmxdev_file_to_filter(file);
int ret=0;
diff --git a/drivers/media/dvb/dvb-core/dvb_ca_en50221.c b/drivers/media/dvb/dvb-core/dvb_ca_en50221.c
index 88ed3b92c37f..85adf5eef850 100644
--- a/drivers/media/dvb/dvb-core/dvb_ca_en50221.c
+++ b/drivers/media/dvb/dvb-core/dvb_ca_en50221.c
@@ -621,7 +621,7 @@ static int dvb_ca_en50221_read_data(struct dvb_ca_private* ca, int slot, u8* ebu
/* OK, add it to the receive buffer, or copy into external buffer if supplied */
if (ebuf == NULL) {
- dvb_ringbuffer_pkt_write(&ca->slot_info[slot].rx_buffer, buf, bytes_read, 0);
+ dvb_ringbuffer_pkt_write(&ca->slot_info[slot].rx_buffer, buf, bytes_read);
} else {
memcpy(ebuf, buf, bytes_read);
}
@@ -1188,7 +1188,7 @@ static int dvb_ca_en50221_io_ioctl(struct inode *inode, struct file *file, unsig
*
* @return Number of bytes read, or <0 on error.
*/
-static ssize_t dvb_ca_en50221_io_write(struct file *file, const char *buf, size_t count, loff_t *ppos)
+static ssize_t dvb_ca_en50221_io_write(struct file *file, const char __user *buf, size_t count, loff_t *ppos)
{
struct dvb_device *dvbdev=(struct dvb_device *) file->private_data;
struct dvb_ca_private *ca=(struct dvb_ca_private*) dvbdev->priv;
@@ -1303,7 +1303,7 @@ nextslot:
*
* @return Number of bytes read, or <0 on error.
*/
-static ssize_t dvb_ca_en50221_io_read(struct file *file, char *buf, size_t count, loff_t *ppos)
+static ssize_t dvb_ca_en50221_io_read(struct file *file, char __user *buf, size_t count, loff_t *ppos)
{
struct dvb_device *dvbdev=(struct dvb_device *) file->private_data;
struct dvb_ca_private *ca=(struct dvb_ca_private*) dvbdev->priv;
diff --git a/drivers/media/dvb/dvb-core/dvb_functions.c b/drivers/media/dvb/dvb-core/dvb_functions.c
index d608fdbb1769..4559f7c46d4f 100644
--- a/drivers/media/dvb/dvb-core/dvb_functions.c
+++ b/drivers/media/dvb/dvb-core/dvb_functions.c
@@ -36,7 +36,7 @@ int dvb_usercopy(struct inode *inode, struct file *file,
/* Copy arguments into temp kernel buffer */
switch (_IOC_DIR(cmd)) {
case _IOC_NONE:
- parg = (void *)arg;
+ parg = NULL;
break;
case _IOC_READ: /* some v4l ioctls are marked wrong ... */
case _IOC_WRITE:
@@ -52,7 +52,7 @@ int dvb_usercopy(struct inode *inode, struct file *file,
}
err = -EFAULT;
- if (copy_from_user(parg, (void *)arg, _IOC_SIZE(cmd)))
+ if (copy_from_user(parg, (void __user *)arg, _IOC_SIZE(cmd)))
goto out;
break;
}
@@ -69,7 +69,7 @@ int dvb_usercopy(struct inode *inode, struct file *file,
{
case _IOC_READ:
case (_IOC_WRITE | _IOC_READ):
- if (copy_to_user((void *)arg, parg, _IOC_SIZE(cmd)))
+ if (copy_to_user((void __user *)arg, parg, _IOC_SIZE(cmd)))
err = -EFAULT;
break;
}
diff --git a/drivers/media/dvb/dvb-core/dvb_ringbuffer.c b/drivers/media/dvb/dvb-core/dvb_ringbuffer.c
index b8bc3e6c4388..fd04a1f3fb14 100644
--- a/drivers/media/dvb/dvb-core/dvb_ringbuffer.c
+++ b/drivers/media/dvb/dvb-core/dvb_ringbuffer.c
@@ -133,8 +133,7 @@ ssize_t dvb_ringbuffer_read(struct dvb_ringbuffer *rbuf, u8 *buf, size_t len, in
-ssize_t dvb_ringbuffer_write(struct dvb_ringbuffer *rbuf, const u8 *buf,
- size_t len, int usermem)
+ssize_t dvb_ringbuffer_write(struct dvb_ringbuffer *rbuf, const u8 *buf, size_t len)
{
size_t todo = len;
size_t split;
@@ -142,28 +141,18 @@ ssize_t dvb_ringbuffer_write(struct dvb_ringbuffer *rbuf, const u8 *buf,
split = (rbuf->pwrite + len > rbuf->size) ? rbuf->size - rbuf->pwrite : 0;
if (split > 0) {
- if (!usermem)
- memcpy(rbuf->data+rbuf->pwrite, buf, split);
- else
- if (copy_from_user(rbuf->data+rbuf->pwrite,
- buf, split))
- return -EFAULT;
+ memcpy(rbuf->data+rbuf->pwrite, buf, split);
buf += split;
todo -= split;
rbuf->pwrite = 0;
}
- if (!usermem)
- memcpy(rbuf->data+rbuf->pwrite, buf, todo);
- else
- if (copy_from_user(rbuf->data+rbuf->pwrite, buf, todo))
- return -EFAULT;
-
+ memcpy(rbuf->data+rbuf->pwrite, buf, todo);
rbuf->pwrite = (rbuf->pwrite + todo) % rbuf->size;
return len;
}
-ssize_t dvb_ringbuffer_pkt_write(struct dvb_ringbuffer *rbuf, u8* buf, size_t len, int usermem)
+ssize_t dvb_ringbuffer_pkt_write(struct dvb_ringbuffer *rbuf, u8* buf, size_t len)
{
int status;
ssize_t oldpwrite = rbuf->pwrite;
@@ -171,7 +160,7 @@ ssize_t dvb_ringbuffer_pkt_write(struct dvb_ringbuffer *rbuf, u8* buf, size_t le
DVB_RINGBUFFER_WRITE_BYTE(rbuf, len >> 8);
DVB_RINGBUFFER_WRITE_BYTE(rbuf, len & 0xff);
DVB_RINGBUFFER_WRITE_BYTE(rbuf, PKT_READY);
- status = dvb_ringbuffer_write(rbuf, buf, len, usermem);
+ status = dvb_ringbuffer_write(rbuf, buf, len);
if (status < 0) rbuf->pwrite = oldpwrite;
return status;
diff --git a/drivers/media/dvb/dvb-core/dvb_ringbuffer.h b/drivers/media/dvb/dvb-core/dvb_ringbuffer.h
index 4158406c65aa..c1ffa271f583 100644
--- a/drivers/media/dvb/dvb-core/dvb_ringbuffer.h
+++ b/drivers/media/dvb/dvb-core/dvb_ringbuffer.h
@@ -53,7 +53,7 @@ struct dvb_ringbuffer {
** *** write <buflen> bytes ***
** free = dvb_ringbuffer_free(rbuf);
** if (free >= buflen)
-** count = dvb_ringbuffer_write(rbuf, buffer, buflen, 0);
+** count = dvb_ringbuffer_write(rbuf, buffer, buflen);
** else
** ...
**
@@ -121,7 +121,7 @@ extern ssize_t dvb_ringbuffer_read(struct dvb_ringbuffer *rbuf, u8 *buf,
** returns number of bytes transferred or -EFAULT
*/
extern ssize_t dvb_ringbuffer_write(struct dvb_ringbuffer *rbuf, const u8 *buf,
- size_t len, int usermem);
+ size_t len);
/**
@@ -130,11 +130,10 @@ extern ssize_t dvb_ringbuffer_write(struct dvb_ringbuffer *rbuf, const u8 *buf,
* <rbuf> Ringbuffer to write to.
* <buf> Buffer to write.
* <len> Length of buffer (currently limited to 65535 bytes max).
- * <usermem> Set to 1 if <buf> is in userspace.
* returns Number of bytes written, or -EFAULT, -ENOMEM, -EVINAL.
*/
extern ssize_t dvb_ringbuffer_pkt_write(struct dvb_ringbuffer *rbuf, u8* buf,
- size_t len, int usermem);
+ size_t len);
/**
* Read from a packet in the ringbuffer. Note: unlike dvb_ringbuffer_read(), this
diff --git a/drivers/media/dvb/ttpci/av7110_av.c b/drivers/media/dvb/ttpci/av7110_av.c
index 054e2e90d0fe..5f5cf20f1caf 100644
--- a/drivers/media/dvb/ttpci/av7110_av.c
+++ b/drivers/media/dvb/ttpci/av7110_av.c
@@ -393,7 +393,7 @@ static inline long aux_ring_buffer_write(struct dvb_ringbuffer *rbuf,
free = dvb_ringbuffer_free(rbuf);
if (free > todo)
free = todo;
- dvb_ringbuffer_write(rbuf, buf, free, 0);
+ dvb_ringbuffer_write(rbuf, buf, free);
todo -= free;
buf += free;
}
@@ -424,8 +424,8 @@ static void play_audio_cb(u8 *buf, int count, void *priv)
#define FREE_COND (dvb_ringbuffer_free(&av7110->avout) >= 20 * 1024 && \
dvb_ringbuffer_free(&av7110->aout) >= 20 * 1024)
-static ssize_t dvb_play(struct av7110 *av7110, const u8 *buf,
- unsigned long count, int nonblock, int type, int umem)
+static ssize_t dvb_play(struct av7110 *av7110, const u8 __user *buf,
+ unsigned long count, int nonblock, int type)
{
unsigned long todo = count, n;
DEB_EE(("av7110: %p\n", av7110));
@@ -447,22 +447,47 @@ static ssize_t dvb_play(struct av7110 *av7110, const u8 *buf,
n = todo;
if (n > IPACKS * 2)
n = IPACKS * 2;
- if (umem) {
- if (copy_from_user(av7110->kbuf[type], buf, n))
- return -EFAULT;
- av7110_ipack_instant_repack(av7110->kbuf[type], n,
- &av7110->ipack[type]);
- } else {
- av7110_ipack_instant_repack(buf, n,
- &av7110->ipack[type]);
+ if (copy_from_user(av7110->kbuf[type], buf, n))
+ return -EFAULT;
+ av7110_ipack_instant_repack(av7110->kbuf[type], n,
+ &av7110->ipack[type]);
+ todo -= n;
+ buf += n;
+ }
+ return count - todo;
+}
+
+static ssize_t dvb_play_kernel(struct av7110 *av7110, const u8 *buf,
+ unsigned long count, int nonblock, int type)
+{
+ unsigned long todo = count, n;
+ DEB_EE(("av7110: %p\n", av7110));
+
+ if (!av7110->kbuf[type])
+ return -ENOBUFS;
+
+ if (nonblock && !FREE_COND)
+ return -EWOULDBLOCK;
+
+ while (todo > 0) {
+ if (!FREE_COND) {
+ if (nonblock)
+ return count - todo;
+ if (wait_event_interruptible(av7110->avout.queue,
+ FREE_COND))
+ return count - todo;
}
+ n = todo;
+ if (n > IPACKS * 2)
+ n = IPACKS * 2;
+ av7110_ipack_instant_repack(buf, n, &av7110->ipack[type]);
todo -= n;
buf += n;
}
return count - todo;
}
-static ssize_t dvb_aplay(struct av7110 *av7110, const u8 *buf,
+static ssize_t dvb_aplay(struct av7110 *av7110, const u8 __user *buf,
unsigned long count, int nonblock, int type)
{
unsigned long todo = count, n;
@@ -871,7 +896,7 @@ static unsigned int dvb_video_poll(struct file *file, poll_table *wait)
return mask;
}
-static ssize_t dvb_video_write(struct file *file, const char *buf,
+static ssize_t dvb_video_write(struct file *file, const char __user *buf,
size_t count, loff_t *ppos)
{
struct dvb_device *dvbdev = (struct dvb_device *) file->private_data;
@@ -885,7 +910,7 @@ static ssize_t dvb_video_write(struct file *file, const char *buf,
if (av7110->videostate.stream_source != VIDEO_SOURCE_MEMORY)
return -EPERM;
- return dvb_play(av7110, buf, count, file->f_flags & O_NONBLOCK, 1, 1);
+ return dvb_play(av7110, buf, count, file->f_flags & O_NONBLOCK, 1);
}
static unsigned int dvb_audio_poll(struct file *file, poll_table *wait)
@@ -907,7 +932,7 @@ static unsigned int dvb_audio_poll(struct file *file, poll_table *wait)
return mask;
}
-static ssize_t dvb_audio_write(struct file *file, const char *buf,
+static ssize_t dvb_audio_write(struct file *file, const char __user *buf,
size_t count, loff_t *ppos)
{
struct dvb_device *dvbdev = (struct dvb_device *) file->private_data;
@@ -926,7 +951,7 @@ u8 iframe_header[] = { 0x00, 0x00, 0x01, 0xe0, 0x00, 0x00, 0x80, 0x00, 0x00 };
#define MIN_IFRAME 400000
-static int play_iframe(struct av7110 *av7110, u8 *buf, unsigned int len, int nonblock)
+static int play_iframe(struct av7110 *av7110, u8 __user *buf, unsigned int len, int nonblock)
{
int i, n;
@@ -942,10 +967,10 @@ static int play_iframe(struct av7110 *av7110, u8 *buf, unsigned int len, int non
n = MIN_IFRAME / len + 1;
/* FIXME: nonblock? */
- dvb_play(av7110, iframe_header, sizeof(iframe_header), 0, 1, 0);
+ dvb_play_kernel(av7110, iframe_header, sizeof(iframe_header), 0, 1);
for (i = 0; i < n; i++)
- dvb_play(av7110, buf, len, 0, 1, 1);
+ dvb_play(av7110, buf, len, 0, 1);
av7110_ipack_flush(&av7110->ipack[1]);
return 0;
diff --git a/drivers/media/dvb/ttpci/av7110_ca.c b/drivers/media/dvb/ttpci/av7110_ca.c
index 7c9a5c84e1e9..6de61258cc98 100644
--- a/drivers/media/dvb/ttpci/av7110_ca.c
+++ b/drivers/media/dvb/ttpci/av7110_ca.c
@@ -85,7 +85,7 @@ void ci_get_data(struct dvb_ringbuffer *cibuf, u8 *data, int len)
DVB_RINGBUFFER_WRITE_BYTE(cibuf, len >> 8);
DVB_RINGBUFFER_WRITE_BYTE(cibuf, len & 0xff);
- dvb_ringbuffer_write(cibuf, data, len, 0);
+ dvb_ringbuffer_write(cibuf, data, len);
wake_up_interruptible(&cibuf->queue);
}
@@ -133,7 +133,7 @@ int ci_ll_reset(struct dvb_ringbuffer *cibuf, struct file *file,
for (i = 0; i < 2; i++) {
if (slots & (1 << i)) {
msg[2] = i;
- dvb_ringbuffer_write(cibuf, msg, 8, 0);
+ dvb_ringbuffer_write(cibuf, msg, 8);
slot[i].flags = 0;
}
}
@@ -142,30 +142,46 @@ int ci_ll_reset(struct dvb_ringbuffer *cibuf, struct file *file,
}
static ssize_t ci_ll_write(struct dvb_ringbuffer *cibuf, struct file *file,
- const char *buf, size_t count, loff_t *ppos)
+ const char __user *buf, size_t count, loff_t *ppos)
{
int free;
int non_blocking = file->f_flags & O_NONBLOCK;
+ char *page = (char *)__get_free_page(GFP_USER);
+ int res;
+ if (!page)
+ return -ENOMEM;
+
+ res = -EINVAL;
if (count > 2048)
- return -EINVAL;
+ goto out;
+
+ res = -EFAULT;
+ if (copy_from_user(page, buf, count))
+ goto out;
+
free = dvb_ringbuffer_free(cibuf);
if (count + 2 > free) {
+ res = -EWOULDBLOCK;
if (non_blocking)
- return -EWOULDBLOCK;
+ goto out;
+ res = -ERESTARTSYS;
if (wait_event_interruptible(cibuf->queue,
(dvb_ringbuffer_free(cibuf) >= count + 2)))
- return -ERESTARTSYS;
+ goto out;
}
DVB_RINGBUFFER_WRITE_BYTE(cibuf, count >> 8);
DVB_RINGBUFFER_WRITE_BYTE(cibuf, count & 0xff);
- return dvb_ringbuffer_write(cibuf, buf, count, 1);
+ res = dvb_ringbuffer_write(cibuf, page, count);
+out:
+ free_page((unsigned long)page);
+ return res;
}
static ssize_t ci_ll_read(struct dvb_ringbuffer *cibuf, struct file *file,
- char *buf, size_t count, loff_t *ppos)
+ char __user *buf, size_t count, loff_t *ppos)
{
int avail;
int non_blocking = file->f_flags & O_NONBLOCK;
@@ -301,7 +317,7 @@ static int dvb_ca_ioctl(struct inode *inode, struct file *file,
return 0;
}
-static ssize_t dvb_ca_write(struct file *file, const char *buf,
+static ssize_t dvb_ca_write(struct file *file, const char __user *buf,
size_t count, loff_t *ppos)
{
struct dvb_device *dvbdev = (struct dvb_device *) file->private_data;
@@ -311,7 +327,7 @@ static ssize_t dvb_ca_write(struct file *file, const char *buf,
return ci_ll_write(&av7110->ci_wbuffer, file, buf, count, ppos);
}
-static ssize_t dvb_ca_read(struct file *file, char *buf,
+static ssize_t dvb_ca_read(struct file *file, char __user *buf,
size_t count, loff_t *ppos)
{
struct dvb_device *dvbdev = (struct dvb_device *) file->private_data;
diff --git a/drivers/media/dvb/ttpci/av7110_hw.c b/drivers/media/dvb/ttpci/av7110_hw.c
index f56e9dcfb090..054018b3fe78 100644
--- a/drivers/media/dvb/ttpci/av7110_hw.c
+++ b/drivers/media/dvb/ttpci/av7110_hw.c
@@ -737,7 +737,7 @@ static enum av7110_window_display_type bpp2bit[8] = {
};
static inline int LoadBitmap(struct av7110 *av7110, u16 format,
- u16 dx, u16 dy, int inc, u8* data)
+ u16 dx, u16 dy, int inc, u8 __user * data)
{
int bpp;
int i;
@@ -887,7 +887,7 @@ static int OSDSetPalette(struct av7110 *av7110, u32 *colors, u8 first, u8 last)
}
static int OSDSetBlock(struct av7110 *av7110, int x0, int y0,
- int x1, int y1, int inc, u8 *data)
+ int x1, int y1, int inc, u8 __user *data)
{
uint w, h, bpp, bpl, size, lpb, bnum, brest;
int i;
@@ -953,17 +953,32 @@ int av7110_osd_cmd(struct av7110 *av7110, osd_cmd_t *dc)
return 0;
case OSD_SetPalette:
{
+ int len = dc->x0-dc->color+1;
+ void *buf;
+ if (len <= 0)
+ return 0;
+
+ buf = kmalloc(len * 4, GFP_KERNEL);
+ if (!buf)
+ return -ENOMEM;
+
+ if (copy_from_user(buf, dc->data, len * 4)) {
+ kfree(buf);
+ return -EFAULT;
+ }
+
if (FW_VERSION(av7110->arm_app) >= 0x2618)
- OSDSetPalette(av7110, (u32 *)dc->data, dc->color, dc->x0);
+ OSDSetPalette(av7110, buf, dc->color, dc->x0);
else {
- int i, len = dc->x0-dc->color+1;
- u8 *colors = (u8 *)dc->data;
+ int i;
+ u8 *colors = buf;
for (i = 0; i<len; i++)
OSDSetColor(av7110, dc->color + i,
colors[i * 4], colors[i * 4 + 1],
colors[i * 4 + 2], colors[i * 4 + 3]);
}
+ kfree(buf);
return 0;
}
case OSD_SetTrans:
diff --git a/drivers/media/dvb/ttpci/av7110_ir.c b/drivers/media/dvb/ttpci/av7110_ir.c
index 609e6862de2d..22039beb41d1 100644
--- a/drivers/media/dvb/ttpci/av7110_ir.c
+++ b/drivers/media/dvb/ttpci/av7110_ir.c
@@ -138,7 +138,7 @@ static void input_repeat_key(unsigned long data)
}
-static int av7110_ir_write_proc (struct file *file, const char *buffer,
+static int av7110_ir_write_proc (struct file *file, const char __user *buffer,
unsigned long count, void *data)
{
char *page;
diff --git a/drivers/media/radio/miropcm20-radio.c b/drivers/media/radio/miropcm20-radio.c
index a4bc55c93b7b..18e47719f555 100644
--- a/drivers/media/radio/miropcm20-radio.c
+++ b/drivers/media/radio/miropcm20-radio.c
@@ -61,7 +61,7 @@ static int pcm20_setfreq(struct pcm20_device *dev, unsigned long freq)
freql = freq & 0xff;
freqh = freq >> 8;
- aci_rds_cmd(RDS_RESET, 0, 0);
+ aci_rds_cmd(RDS_RESET, NULL, 0);
pcm20_stereo(dev, 1);
return aci_rw_cmd(ACI_WRITE_TUNE, freql, freqh);
diff --git a/drivers/media/radio/miropcm20-rds.c b/drivers/media/radio/miropcm20-rds.c
index f98d4c50bcb0..6b11044e7085 100644
--- a/drivers/media/radio/miropcm20-rds.c
+++ b/drivers/media/radio/miropcm20-rds.c
@@ -53,7 +53,7 @@ static void print_matrix(char *ch, char out[])
}
}
-static ssize_t rds_f_read(struct file *file, char *buffer, size_t length, loff_t *offset)
+static ssize_t rds_f_read(struct file *file, char __user *buffer, size_t length, loff_t *offset)
{
// i = sprintf(text_buffer, "length: %d, offset: %d\n", length, *offset);
diff --git a/drivers/media/radio/radio-cadet.c b/drivers/media/radio/radio-cadet.c
index 842e14baad7b..8cc5191acd19 100644
--- a/drivers/media/radio/radio-cadet.c
+++ b/drivers/media/radio/radio-cadet.c
@@ -323,7 +323,7 @@ void cadet_handler(unsigned long data)
-static ssize_t cadet_read(struct file *file, char *data,
+static ssize_t cadet_read(struct file *file, char __user *data,
size_t count, loff_t *ppos)
{
int i=0;
diff --git a/drivers/media/video/bttv-cards.c b/drivers/media/video/bttv-cards.c
index 857d3043859c..7ea762f354af 100644
--- a/drivers/media/video/bttv-cards.c
+++ b/drivers/media/video/bttv-cards.c
@@ -4063,7 +4063,7 @@ static void PXC200_muxsel(struct bttv *btv, unsigned int input)
return;
}
- rc=bttv_I2CRead(btv,(PX_I2C_PIC<<1),0);
+ rc=bttv_I2CRead(btv,(PX_I2C_PIC<<1),NULL);
if (!(rc & PX_CFG_PXC200F)) {
printk(KERN_DEBUG "bttv%d: PXC200_muxsel: not PXC200F rc:%d \n", btv->c.nr,rc);
return;
diff --git a/drivers/media/video/bttv-driver.c b/drivers/media/video/bttv-driver.c
index affe68732cea..e7ffe18411fb 100644
--- a/drivers/media/video/bttv-driver.c
+++ b/drivers/media/video/bttv-driver.c
@@ -1068,7 +1068,7 @@ static void init_bt848(struct bttv *btv)
init_irqreg(btv);
}
-extern void bttv_reinit_bt848(struct bttv *btv)
+void bttv_reinit_bt848(struct bttv *btv)
{
unsigned long flags;
@@ -2261,7 +2261,7 @@ static int bttv_do_ioctl(struct inode *inode, struct file *file,
w2.w.width = win->width;
w2.w.height = win->height;
w2.clipcount = win->clipcount;
- w2.clips = (struct v4l2_clip*)win->clips;
+ w2.clips = (struct v4l2_clip __user *)win->clips;
retval = setup_window(fh, btv, &w2, 0);
if (0 == retval) {
/* on v4l1 this ioctl affects the read() size too */
@@ -2821,7 +2821,7 @@ static int bttv_ioctl(struct inode *inode, struct file *file,
}
}
-static ssize_t bttv_read(struct file *file, char *data,
+static ssize_t bttv_read(struct file *file, char __user *data,
size_t count, loff_t *ppos)
{
struct bttv_fh *fh = file->private_data;
diff --git a/drivers/media/video/bw-qcam.c b/drivers/media/video/bw-qcam.c
index c90ec3be7ced..31412e8d32db 100644
--- a/drivers/media/video/bw-qcam.c
+++ b/drivers/media/video/bw-qcam.c
@@ -599,7 +599,7 @@ static inline int qc_readbytes(struct qcam_device *q, char buffer[])
* n=2^(bit depth)-1. Ask me for more details if you don't understand
* this. */
-long qc_capture(struct qcam_device * q, char *buf, unsigned long len)
+long qc_capture(struct qcam_device * q, char __user *buf, unsigned long len)
{
int i, j, k, yield;
int bytes;
@@ -660,7 +660,7 @@ long qc_capture(struct qcam_device * q, char *buf, unsigned long len)
}
pixels_read += bytes;
}
- (void) qc_readbytes(q, 0); /* reset state machine */
+ (void) qc_readbytes(q, NULL); /* reset state machine */
/* Grabbing an entire frame from the quickcam is a lengthy
process. We don't (usually) want to busy-block the
@@ -855,7 +855,7 @@ static int qcam_ioctl(struct inode *inode, struct file *file,
return video_usercopy(inode, file, cmd, arg, qcam_do_ioctl);
}
-static ssize_t qcam_read(struct file *file, char *buf,
+static ssize_t qcam_read(struct file *file, char __user *buf,
size_t count, loff_t *ppos)
{
struct video_device *v = video_devdata(file);
diff --git a/drivers/media/video/c-qcam.c b/drivers/media/video/c-qcam.c
index ee97110002c1..bd9fef419a88 100644
--- a/drivers/media/video/c-qcam.c
+++ b/drivers/media/video/c-qcam.c
@@ -358,7 +358,7 @@ get_fragment:
#define BUFSZ 150
-static long qc_capture(struct qcam_device *q, char *buf, unsigned long len)
+static long qc_capture(struct qcam_device *q, char __user *buf, unsigned long len)
{
unsigned lines, pixelsperline, bitsperxfer;
unsigned int is_bi_dir = q->bidirectional;
@@ -667,7 +667,7 @@ static int qcam_ioctl(struct inode *inode, struct file *file,
return video_usercopy(inode, file, cmd, arg, qcam_do_ioctl);
}
-static ssize_t qcam_read(struct file *file, char *buf,
+static ssize_t qcam_read(struct file *file, char __user *buf,
size_t count, loff_t *ppos)
{
struct video_device *v = video_devdata(file);
diff --git a/drivers/media/video/cpia.c b/drivers/media/video/cpia.c
index 38d75f38898a..02c012dbcb53 100644
--- a/drivers/media/video/cpia.c
+++ b/drivers/media/video/cpia.c
@@ -585,7 +585,7 @@ static unsigned long int value(char **buffer, unsigned long *count, int *err)
return ret;
}
-static int cpia_write_proc(struct file *file, const char *buf,
+static int cpia_write_proc(struct file *file, const char __user *buf,
unsigned long count, void *data)
{
struct cam_data *cam = data;
@@ -1400,7 +1400,7 @@ static void destroy_proc_cpia_cam(struct cam_data *cam)
static void proc_cpia_create(void)
{
- cpia_proc_root = create_proc_entry("cpia", S_IFDIR, 0);
+ cpia_proc_root = create_proc_entry("cpia", S_IFDIR, NULL);
if (cpia_proc_root)
cpia_proc_root->owner = THIS_MODULE;
@@ -1410,7 +1410,7 @@ static void proc_cpia_create(void)
static void __exit proc_cpia_destroy(void)
{
- remove_proc_entry("cpia", 0);
+ remove_proc_entry("cpia", NULL);
}
#endif /* CONFIG_PROC_FS */
@@ -1624,7 +1624,7 @@ static int free_frame_buf(struct cam_data *cam)
int i;
rvfree(cam->frame_buf, FRAME_NUM*CPIA_MAX_FRAME_SIZE);
- cam->frame_buf = 0;
+ cam->frame_buf = NULL;
for (i=0; i < FRAME_NUM; i++)
cam->frame[i].data = NULL;
@@ -3299,7 +3299,7 @@ static int cpia_close(struct inode *inode, struct file *file)
return 0;
}
-static ssize_t cpia_read(struct file *file, char *buf,
+static ssize_t cpia_read(struct file *file, char __user *buf,
size_t count, loff_t *ppos)
{
struct video_device *dev = file->private_data;
diff --git a/drivers/media/video/cx88/cx88-video.c b/drivers/media/video/cx88/cx88-video.c
index 91fdc67789b8..e73b8ce4e210 100644
--- a/drivers/media/video/cx88/cx88-video.c
+++ b/drivers/media/video/cx88/cx88-video.c
@@ -1279,7 +1279,7 @@ static int video_open(struct inode *inode, struct file *file)
}
static ssize_t
-video_read(struct file *file, char *data, size_t count, loff_t *ppos)
+video_read(struct file *file, char __user *data, size_t count, loff_t *ppos)
{
struct cx8800_fh *fh = file->private_data;
diff --git a/drivers/media/video/dpc7146.c b/drivers/media/video/dpc7146.c
index 7fb4ae734b70..3944f3f6af7a 100644
--- a/drivers/media/video/dpc7146.c
+++ b/drivers/media/video/dpc7146.c
@@ -91,7 +91,7 @@ struct dpc
/* fixme: add vbi stuff here */
static int dpc_probe(struct saa7146_dev* dev)
{
- struct dpc* dpc = 0;
+ struct dpc* dpc = NULL;
struct i2c_client *client;
struct list_head *item;
diff --git a/drivers/media/video/hexium_orion.c b/drivers/media/video/hexium_orion.c
index 1a3bbb6d3950..8a577d718b09 100644
--- a/drivers/media/video/hexium_orion.c
+++ b/drivers/media/video/hexium_orion.c
@@ -212,7 +212,7 @@ static struct saa7146_standard hexium_standards[] = {
without eeprom */
static int hexium_probe(struct saa7146_dev *dev)
{
- struct hexium *hexium = 0;
+ struct hexium *hexium = NULL;
union i2c_smbus_data data;
int err = 0;
diff --git a/drivers/media/video/meye.c b/drivers/media/video/meye.c
index d312d3995724..6f3fe234e2d3 100644
--- a/drivers/media/video/meye.c
+++ b/drivers/media/video/meye.c
@@ -203,7 +203,7 @@ static int ptable_alloc(void) {
PAGE_SIZE,
meye.mchip_ptable_toc,
meye.mchip_dmahandle);
- meye.mchip_ptable_toc = 0;
+ meye.mchip_ptable_toc = NULL;
meye.mchip_dmahandle = 0;
return -1;
}
@@ -232,7 +232,7 @@ static void ptable_free(void) {
meye.mchip_dmahandle);
memset(meye.mchip_ptable, 0, sizeof(meye.mchip_ptable));
- meye.mchip_ptable_toc = 0;
+ meye.mchip_ptable_toc = NULL;
meye.mchip_dmahandle = 0;
}
diff --git a/drivers/media/video/mxb.c b/drivers/media/video/mxb.c
index 56b42fde4047..121d626f03b6 100644
--- a/drivers/media/video/mxb.c
+++ b/drivers/media/video/mxb.c
@@ -150,7 +150,7 @@ static struct saa7146_extension extension;
static int mxb_probe(struct saa7146_dev* dev)
{
- struct mxb* mxb = 0;
+ struct mxb* mxb = NULL;
struct i2c_client *client;
struct list_head *item;
int result;
diff --git a/drivers/media/video/pms.c b/drivers/media/video/pms.c
index 82119dc9bbf9..d127e291f5eb 100644
--- a/drivers/media/video/pms.c
+++ b/drivers/media/video/pms.c
@@ -625,7 +625,7 @@ static void pms_vcrinput(short input)
}
-static int pms_capture(struct pms_device *dev, char *buf, int rgb555, int count)
+static int pms_capture(struct pms_device *dev, char __user *buf, int rgb555, int count)
{
int y;
int dw = 2*dev->width;
@@ -865,7 +865,7 @@ static int pms_ioctl(struct inode *inode, struct file *file,
return video_usercopy(inode, file, cmd, arg, pms_do_ioctl);
}
-static int pms_read(struct file *file, char *buf,
+static int pms_read(struct file *file, char __user *buf,
size_t count, loff_t *ppos)
{
struct video_device *v = video_devdata(file);
diff --git a/drivers/media/video/saa7134/saa7134-oss.c b/drivers/media/video/saa7134/saa7134-oss.c
index b069a1fcdc05..63b32ab17e1c 100644
--- a/drivers/media/video/saa7134/saa7134-oss.c
+++ b/drivers/media/video/saa7134/saa7134-oss.c
@@ -281,7 +281,7 @@ static int dsp_release(struct inode *inode, struct file *file)
return 0;
}
-static ssize_t dsp_read(struct file *file, char *buffer,
+static ssize_t dsp_read(struct file *file, char __user *buffer,
size_t count, loff_t *ppos)
{
struct saa7134_dev *dev = file->private_data;
@@ -354,7 +354,7 @@ static ssize_t dsp_read(struct file *file, char *buffer,
return ret;
}
-static ssize_t dsp_write(struct file *file, const char *buffer,
+static ssize_t dsp_write(struct file *file, const char __user *buffer,
size_t count, loff_t *ppos)
{
return -EINVAL;
@@ -364,25 +364,27 @@ static int dsp_ioctl(struct inode *inode, struct file *file,
unsigned int cmd, unsigned long arg)
{
struct saa7134_dev *dev = file->private_data;
+ void __user *argp = (void __user *) arg;
+ int __user *p = argp;
int val = 0;
if (oss_debug > 1)
saa7134_print_ioctl(dev->name,cmd);
switch (cmd) {
case OSS_GETVERSION:
- return put_user(SOUND_VERSION, (int *)arg);
+ return put_user(SOUND_VERSION, p);
case SNDCTL_DSP_GETCAPS:
return 0;
case SNDCTL_DSP_SPEED:
- if (get_user(val, (int*)arg))
+ if (get_user(val, p))
return -EFAULT;
/* fall through */
case SOUND_PCM_READ_RATE:
- return put_user(dev->oss.rate, (int*)arg);
+ return put_user(dev->oss.rate, p);
case SNDCTL_DSP_STEREO:
- if (get_user(val, (int*)arg))
+ if (get_user(val, p))
return -EFAULT;
down(&dev->oss.lock);
dev->oss.channels = val ? 2 : 1;
@@ -391,10 +393,10 @@ static int dsp_ioctl(struct inode *inode, struct file *file,
dsp_rec_start(dev);
}
up(&dev->oss.lock);
- return put_user(dev->oss.channels-1, (int *)arg);
+ return put_user(dev->oss.channels-1, p);
case SNDCTL_DSP_CHANNELS:
- if (get_user(val, (int*)arg))
+ if (get_user(val, p))
return -EFAULT;
if (val != 1 && val != 2)
return -EINVAL;
@@ -407,15 +409,15 @@ static int dsp_ioctl(struct inode *inode, struct file *file,
up(&dev->oss.lock);
/* fall through */
case SOUND_PCM_READ_CHANNELS:
- return put_user(dev->oss.channels, (int *)arg);
+ return put_user(dev->oss.channels, p);
case SNDCTL_DSP_GETFMTS: /* Returns a mask */
return put_user(AFMT_U8 | AFMT_S8 |
AFMT_U16_LE | AFMT_U16_BE |
- AFMT_S16_LE | AFMT_S16_BE, (int*)arg);
+ AFMT_S16_LE | AFMT_S16_BE, p);
case SNDCTL_DSP_SETFMT: /* Selects ONE fmt */
- if (get_user(val, (int*)arg))
+ if (get_user(val, p))
return -EFAULT;
switch (val) {
case AFMT_QUERY:
@@ -434,7 +436,7 @@ static int dsp_ioctl(struct inode *inode, struct file *file,
dsp_rec_start(dev);
}
up(&dev->oss.lock);
- return put_user(dev->oss.afmt,(int*)arg);
+ return put_user(dev->oss.afmt, p);
default:
return -EINVAL;
}
@@ -443,12 +445,12 @@ static int dsp_ioctl(struct inode *inode, struct file *file,
switch (dev->oss.afmt) {
case AFMT_U8:
case AFMT_S8:
- return put_user(8, (int*)arg);
+ return put_user(8, p);
case AFMT_U16_LE:
case AFMT_U16_BE:
case AFMT_S16_LE:
case AFMT_S16_BE:
- return put_user(16, (int*)arg);
+ return put_user(16, p);
default:
return -EINVAL;
}
@@ -464,15 +466,16 @@ static int dsp_ioctl(struct inode *inode, struct file *file,
up(&dev->oss.lock);
return 0;
case SNDCTL_DSP_GETBLKSIZE:
- return put_user(dev->oss.blksize,(int*)arg);
+ return put_user(dev->oss.blksize, p);
case SNDCTL_DSP_SETFRAGMENT:
- if (get_user(val, (int*)arg))
+ if (get_user(val, p))
return -EFAULT;
if (dev->oss.recording_on)
return -EBUSY;
dsp_buffer_free(dev);
- dsp_buffer_conf(dev,1 << (val & 0xffff), (arg >> 16) & 0xffff);
+ /* used to be arg >> 16 instead of val >> 16; fixed */
+ dsp_buffer_conf(dev,1 << (val & 0xffff), (val >> 16) & 0xffff);
dsp_buffer_init(dev);
return 0;
@@ -487,7 +490,7 @@ static int dsp_ioctl(struct inode *inode, struct file *file,
info.fragstotal = dev->oss.blocks;
info.bytes = dev->oss.read_count;
info.fragments = info.bytes / info.fragsize;
- if (copy_to_user((void *)arg, &info, sizeof(info)))
+ if (copy_to_user(argp, &info, sizeof(info)))
return -EFAULT;
return 0;
}
@@ -648,12 +651,14 @@ static int mixer_ioctl(struct inode *inode, struct file *file,
struct saa7134_dev *dev = file->private_data;
enum saa7134_audio_in input;
int val,ret;
+ void __user *argp = (void __user *) arg;
+ int __user *p = argp;
if (oss_debug > 1)
saa7134_print_ioctl(dev->name,cmd);
switch (cmd) {
case OSS_GETVERSION:
- return put_user(SOUND_VERSION, (int *)arg);
+ return put_user(SOUND_VERSION, p);
case SOUND_MIXER_INFO:
{
mixer_info info;
@@ -661,7 +666,7 @@ static int mixer_ioctl(struct inode *inode, struct file *file,
strlcpy(info.id, "TV audio", sizeof(info.id));
strlcpy(info.name, dev->name, sizeof(info.name));
info.modify_counter = dev->oss.count;
- if (copy_to_user((void *)arg, &info, sizeof(info)))
+ if (copy_to_user(argp, &info, sizeof(info)))
return -EFAULT;
return 0;
}
@@ -671,23 +676,23 @@ static int mixer_ioctl(struct inode *inode, struct file *file,
memset(&info,0,sizeof(info));
strlcpy(info.id, "TV audio", sizeof(info.id));
strlcpy(info.name, dev->name, sizeof(info.name));
- if (copy_to_user((void *)arg, &info, sizeof(info)))
+ if (copy_to_user(argp, &info, sizeof(info)))
return -EFAULT;
return 0;
}
case MIXER_READ(SOUND_MIXER_CAPS):
- return put_user(SOUND_CAP_EXCL_INPUT,(int*)arg);
+ return put_user(SOUND_CAP_EXCL_INPUT, p);
case MIXER_READ(SOUND_MIXER_STEREODEVS):
- return put_user(0,(int*)arg);
+ return put_user(0, p);
case MIXER_READ(SOUND_MIXER_RECMASK):
case MIXER_READ(SOUND_MIXER_DEVMASK):
val = SOUND_MASK_LINE1 | SOUND_MASK_LINE2;
if (32000 == dev->oss.rate)
val |= SOUND_MASK_VIDEO;
- return put_user(val,(int*)arg);
+ return put_user(val, p);
case MIXER_WRITE(SOUND_MIXER_RECSRC):
- if (get_user(val, (int *)arg))
+ if (get_user(val, p))
return -EFAULT;
input = dev->oss.input;
if (32000 == dev->oss.rate &&
@@ -707,16 +712,16 @@ static int mixer_ioctl(struct inode *inode, struct file *file,
case LINE2: ret = SOUND_MASK_LINE2; break;
default: ret = 0;
}
- return put_user(ret,(int*)arg);
+ return put_user(ret, p);
case MIXER_WRITE(SOUND_MIXER_VIDEO):
case MIXER_READ(SOUND_MIXER_VIDEO):
if (32000 != dev->oss.rate)
return -EINVAL;
- return put_user(100 | 100 << 8,(int*)arg);
+ return put_user(100 | 100 << 8, p);
case MIXER_WRITE(SOUND_MIXER_LINE1):
- if (get_user(val, (int *)arg))
+ if (get_user(val, p))
return -EFAULT;
val &= 0xff;
val = (val <= 50) ? 50 : 100;
@@ -724,11 +729,10 @@ static int mixer_ioctl(struct inode *inode, struct file *file,
mixer_level(dev,LINE1,dev->oss.line1);
/* fall throuth */
case MIXER_READ(SOUND_MIXER_LINE1):
- return put_user(dev->oss.line1 | dev->oss.line1 << 8,
- (int*)arg);
+ return put_user(dev->oss.line1 | dev->oss.line1 << 8, p);
case MIXER_WRITE(SOUND_MIXER_LINE2):
- if (get_user(val, (int *)arg))
+ if (get_user(val, p))
return -EFAULT;
val &= 0xff;
val = (val <= 50) ? 50 : 100;
@@ -736,8 +740,7 @@ static int mixer_ioctl(struct inode *inode, struct file *file,
mixer_level(dev,LINE2,dev->oss.line2);
/* fall throuth */
case MIXER_READ(SOUND_MIXER_LINE2):
- return put_user(dev->oss.line2 | dev->oss.line2 << 8,
- (int*)arg);
+ return put_user(dev->oss.line2 | dev->oss.line2 << 8, p);
default:
return -EINVAL;
diff --git a/drivers/media/video/saa7134/saa7134-ts.c b/drivers/media/video/saa7134/saa7134-ts.c
index 1c144fe49b3d..f969b2747423 100644
--- a/drivers/media/video/saa7134/saa7134-ts.c
+++ b/drivers/media/video/saa7134/saa7134-ts.c
@@ -241,7 +241,7 @@ static int ts_release(struct inode *inode, struct file *file)
}
static ssize_t
-ts_read(struct file *file, char *data, size_t count, loff_t *ppos)
+ts_read(struct file *file, char __user *data, size_t count, loff_t *ppos)
{
struct saa7134_dev *dev = file->private_data;
diff --git a/drivers/media/video/saa7134/saa7134-video.c b/drivers/media/video/saa7134/saa7134-video.c
index acf4a45f7412..ec4c286dfddd 100644
--- a/drivers/media/video/saa7134/saa7134-video.c
+++ b/drivers/media/video/saa7134/saa7134-video.c
@@ -1238,7 +1238,7 @@ static int video_open(struct inode *inode, struct file *file)
}
static ssize_t
-video_read(struct file *file, char *data, size_t count, loff_t *ppos)
+video_read(struct file *file, char __user *data, size_t count, loff_t *ppos)
{
struct saa7134_fh *fh = file->private_data;
diff --git a/drivers/media/video/stradis.c b/drivers/media/video/stradis.c
index 10e4c56bfb33..37545acdb023 100644
--- a/drivers/media/video/stradis.c
+++ b/drivers/media/video/stradis.c
@@ -1322,7 +1322,7 @@ static int saa_ioctl(struct inode *inode, struct file *file,
unsigned int cmd, unsigned long argl)
{
struct saa7146 *saa = file->private_data;
- void *arg = (void *)argl;
+ void __user *arg = (void __user *)argl;
switch (cmd) {
case VIDIOCGCAP:
@@ -1580,7 +1580,7 @@ static int saa_ioctl(struct inode *inode, struct file *file,
vu.radio = VIDEO_NO_UNIT;
vu.audio = VIDEO_NO_UNIT;
vu.teletext = VIDEO_NO_UNIT;
- if (copy_to_user((void *) arg, (void *) &vu, sizeof(vu)))
+ if (copy_to_user(arg, &vu, sizeof(vu)))
return -EFAULT;
return 0;
}
@@ -1754,16 +1754,14 @@ static int saa_ioctl(struct inode *inode, struct file *file,
struct video_code ucode;
__u8 *udata;
int i;
- if (copy_from_user((void *) &ucode, arg,
- sizeof(ucode)))
+ if (copy_from_user(&ucode, arg, sizeof(ucode)))
return -EFAULT;
if (ucode.datasize > 65536 || ucode.datasize < 1024 ||
strncmp(ucode.loadwhat, "dec", 3))
return -EINVAL;
if ((udata = vmalloc(ucode.datasize)) == NULL)
return -ENOMEM;
- if (copy_from_user((void *) udata, ucode.data,
- ucode.datasize)) {
+ if (copy_from_user(udata, ucode.data, ucode.datasize)) {
vfree(udata);
return -EFAULT;
}
@@ -1814,13 +1812,13 @@ static int saa_mmap(struct file *file, struct vm_area_struct *vma)
return -EINVAL;
}
-static ssize_t saa_read(struct file *file, char *buf,
+static ssize_t saa_read(struct file *file, char __user *buf,
size_t count, loff_t *ppos)
{
return -EINVAL;
}
-static ssize_t saa_write(struct file *file, const char *buf,
+static ssize_t saa_write(struct file *file, const char __user *buf,
size_t count, loff_t *ppos)
{
struct saa7146 *saa = file->private_data;
diff --git a/drivers/media/video/tea6415c.c b/drivers/media/video/tea6415c.c
index 4673dfca6caf..326f12b3c87f 100644
--- a/drivers/media/video/tea6415c.c
+++ b/drivers/media/video/tea6415c.c
@@ -57,7 +57,7 @@ static int tea6415c_id = 0;
/* this function is called by i2c_probe */
static int tea6415c_detect(struct i2c_adapter *adapter, int address, int kind)
{
- struct i2c_client *client = 0;
+ struct i2c_client *client = NULL;
int err = 0;
/* let's see whether this adapter can support what we need */
diff --git a/drivers/media/video/tvmixer.c b/drivers/media/video/tvmixer.c
index f690126f0960..48b2f822e6c7 100644
--- a/drivers/media/video/tvmixer.c
+++ b/drivers/media/video/tvmixer.c
@@ -77,6 +77,8 @@ static int tvmixer_ioctl(struct inode *inode, struct file *file, unsigned int cm
int left,right,ret,val = 0;
struct TVMIXER *mix = file->private_data;
struct i2c_client *client = mix->dev;
+ void __user *argp = (void __user *)arg;
+ int __user *p = argp;
if (NULL == client)
return -ENODEV;
@@ -86,7 +88,7 @@ static int tvmixer_ioctl(struct inode *inode, struct file *file, unsigned int cm
strlcpy(info.id, "tv card", sizeof(info.id));
strlcpy(info.name, i2c_clientname(client), sizeof(info.name));
info.modify_counter = 42 /* FIXME */;
- if (copy_to_user((void *)arg, &info, sizeof(info)))
+ if (copy_to_user(argp, &info, sizeof(info)))
return -EFAULT;
return 0;
}
@@ -94,15 +96,15 @@ static int tvmixer_ioctl(struct inode *inode, struct file *file, unsigned int cm
_old_mixer_info info;
strlcpy(info.id, "tv card", sizeof(info.id));
strlcpy(info.name, i2c_clientname(client), sizeof(info.name));
- if (copy_to_user((void *)arg, &info, sizeof(info)))
+ if (copy_to_user(argp, &info, sizeof(info)))
return -EFAULT;
return 0;
}
if (cmd == OSS_GETVERSION)
- return put_user(SOUND_VERSION, (int *)arg);
+ return put_user(SOUND_VERSION, p);
if (_SIOC_DIR(cmd) & _SIOC_WRITE)
- if (get_user(val, (int *)arg))
+ if (get_user(val, p))
return -EFAULT;
/* read state */
@@ -168,7 +170,7 @@ static int tvmixer_ioctl(struct inode *inode, struct file *file, unsigned int cm
default:
return -EINVAL;
}
- if (put_user(ret, (int *)arg))
+ if (put_user(ret, p))
return -EFAULT;
return 0;
}
diff --git a/drivers/media/video/v4l1-compat.c b/drivers/media/video/v4l1-compat.c
index 441733d0b1b8..c75ca87b010b 100644
--- a/drivers/media/video/v4l1-compat.c
+++ b/drivers/media/video/v4l1-compat.c
@@ -490,7 +490,7 @@ v4l_compat_translate_ioctl(struct inode *inode,
fmt2->fmt.win.w.width = win->width;
fmt2->fmt.win.w.height = win->height;
fmt2->fmt.win.chromakey = win->chromakey;
- fmt2->fmt.win.clips = (void *)win->clips;
+ fmt2->fmt.win.clips = (void __user *)win->clips;
fmt2->fmt.win.clipcount = win->clipcount;
err2 = drv(inode, file, VIDIOC_S_FMT, fmt2);
if (err2 < 0)
diff --git a/drivers/media/video/video-buf.c b/drivers/media/video/video-buf.c
index 6b2eee6de4dc..c7c7465508f0 100644
--- a/drivers/media/video/video-buf.c
+++ b/drivers/media/video/video-buf.c
@@ -735,7 +735,7 @@ int videobuf_streamoff(struct file *file, struct videobuf_queue *q)
static ssize_t
videobuf_read_zerocopy(struct file *file, struct videobuf_queue *q,
- char *data, size_t count, loff_t *ppos)
+ char __user *data, size_t count, loff_t *ppos)
{
enum v4l2_field field;
unsigned long flags;
@@ -777,7 +777,7 @@ videobuf_read_zerocopy(struct file *file, struct videobuf_queue *q,
}
ssize_t videobuf_read_one(struct file *file, struct videobuf_queue *q,
- char *data, size_t count, loff_t *ppos)
+ char __user *data, size_t count, loff_t *ppos)
{
enum v4l2_field field;
unsigned long flags;
@@ -901,7 +901,7 @@ void videobuf_read_stop(struct file *file, struct videobuf_queue *q)
}
ssize_t videobuf_read_stream(struct file *file, struct videobuf_queue *q,
- char *data, size_t count, loff_t *ppos,
+ char __user *data, size_t count, loff_t *ppos,
int vbihack)
{
unsigned int *fc, bytes;
diff --git a/drivers/media/video/videocodec.c b/drivers/media/video/videocodec.c
index f7700bbf4ba0..081eb06a4c7a 100644
--- a/drivers/media/video/videocodec.c
+++ b/drivers/media/video/videocodec.c
@@ -458,7 +458,7 @@ videocodec_init (void)
videocodec_buf = NULL;
videocodec_bufsize = 0;
- videocodec_proc_entry = create_proc_entry("videocodecs", 0, 0);
+ videocodec_proc_entry = create_proc_entry("videocodecs", 0, NULL);
if (videocodec_proc_entry) {
videocodec_proc_entry->read_proc = videocodec_info;
videocodec_proc_entry->write_proc = NULL;
@@ -475,7 +475,7 @@ static void __exit
videocodec_exit (void)
{
#ifdef CONFIG_PROC_FS
- remove_proc_entry("videocodecs", 0);
+ remove_proc_entry("videocodecs", NULL);
if (videocodec_buf)
kfree(videocodec_buf);
#endif
diff --git a/drivers/media/video/videodev.c b/drivers/media/video/videodev.c
index afaf612fcd4b..fbc5cb1e286d 100644
--- a/drivers/media/video/videodev.c
+++ b/drivers/media/video/videodev.c
@@ -183,7 +183,7 @@ video_usercopy(struct inode *inode, struct file *file,
/* Copy arguments into temp kernel buffer */
switch (_IOC_DIR(cmd)) {
case _IOC_NONE:
- parg = (void *)arg;
+ parg = NULL;
break;
case _IOC_READ:
case _IOC_WRITE:
@@ -200,7 +200,7 @@ video_usercopy(struct inode *inode, struct file *file,
err = -EFAULT;
if (_IOC_DIR(cmd) & _IOC_WRITE)
- if (copy_from_user(parg, (void *)arg, _IOC_SIZE(cmd)))
+ if (copy_from_user(parg, (void __user *)arg, _IOC_SIZE(cmd)))
goto out;
break;
}
@@ -217,7 +217,7 @@ video_usercopy(struct inode *inode, struct file *file,
{
case _IOC_READ:
case (_IOC_WRITE | _IOC_READ):
- if (copy_to_user((void *)arg, parg, _IOC_SIZE(cmd)))
+ if (copy_to_user((void __user *)arg, parg, _IOC_SIZE(cmd)))
err = -EFAULT;
break;
}
@@ -231,7 +231,7 @@ out:
/*
* open/release helper functions -- handle exclusive opens
*/
-extern int video_exclusive_open(struct inode *inode, struct file *file)
+int video_exclusive_open(struct inode *inode, struct file *file)
{
struct video_device *vfl = video_devdata(file);
int retval = 0;
@@ -246,7 +246,7 @@ extern int video_exclusive_open(struct inode *inode, struct file *file)
return retval;
}
-extern int video_exclusive_release(struct inode *inode, struct file *file)
+int video_exclusive_release(struct inode *inode, struct file *file)
{
struct video_device *vfl = video_devdata(file);
diff --git a/drivers/media/video/w9966.c b/drivers/media/video/w9966.c
index 4c0a5bfb2913..4ab1267e1044 100644
--- a/drivers/media/video/w9966.c
+++ b/drivers/media/video/w9966.c
@@ -179,7 +179,7 @@ static int w9966_i2c_rbyte(struct w9966_dev* cam);
static int w9966_v4l_ioctl(struct inode *inode, struct file *file,
unsigned int cmd, unsigned long arg);
-static ssize_t w9966_v4l_read(struct file *file, char *buf,
+static ssize_t w9966_v4l_read(struct file *file, char __user *buf,
size_t count, loff_t *ppos);
static struct file_operations w9966_fops = {
@@ -555,6 +555,14 @@ static inline void w9966_i2c_setsda(struct w9966_dev* cam, int state)
udelay(5);
}
+// Get peripheral clock line
+// Expects a claimed pdev.
+static inline int w9966_i2c_getscl(struct w9966_dev* cam)
+{
+ const unsigned char state = w9966_rReg(cam, 0x18);
+ return ((state & W9966_I2C_R_CLOCK) > 0);
+}
+
// Sets the clock line on the i2c bus.
// Expects a claimed pdev. -1 on error
static inline int w9966_i2c_setscl(struct w9966_dev* cam, int state)
@@ -588,14 +596,6 @@ static inline int w9966_i2c_getsda(struct w9966_dev* cam)
return ((state & W9966_I2C_R_DATA) > 0);
}
-// Get peripheral clock line
-// Expects a claimed pdev.
-static inline int w9966_i2c_getscl(struct w9966_dev* cam)
-{
- const unsigned char state = w9966_rReg(cam, 0x18);
- return ((state & W9966_I2C_R_CLOCK) > 0);
-}
-
// Write a byte with ack to the i2c bus.
// Expects a claimed pdev. -1 on error
static int w9966_i2c_wbyte(struct w9966_dev* cam, int data)
@@ -867,13 +867,13 @@ static int w9966_v4l_ioctl(struct inode *inode, struct file *file,
}
// Capture data
-static ssize_t w9966_v4l_read(struct file *file, char *buf,
+static ssize_t w9966_v4l_read(struct file *file, char __user *buf,
size_t count, loff_t *ppos)
{
struct video_device *vdev = video_devdata(file);
struct w9966_dev *cam = (struct w9966_dev *)vdev->priv;
unsigned char addr = 0xa0; // ECP, read, CCD-transfer, 00000
- unsigned char* dest = (unsigned char*)buf;
+ unsigned char __user *dest = (unsigned char __user *)buf;
unsigned long dleft = count;
unsigned char *tbuf;
diff --git a/drivers/media/video/zoran_driver.c b/drivers/media/video/zoran_driver.c
index 6785211e0ec0..28f1a8d051b0 100644
--- a/drivers/media/video/zoran_driver.c
+++ b/drivers/media/video/zoran_driver.c
@@ -424,17 +424,15 @@ v4l_fbuffer_alloc (struct file *file)
ZR_DEVNAME(zr), size >> 10);
return -ENOBUFS;
}
- fh->v4l_buffers.buffer[0].fbuffer = 0;
- fh->v4l_buffers.buffer[0].fbuffer_phys =
- pmem;
- fh->v4l_buffers.buffer[0].fbuffer_bus =
- pmem;
+ fh->v4l_buffers.buffer[0].fbuffer = NULL;
+ fh->v4l_buffers.buffer[0].fbuffer_phys = pmem;
+ fh->v4l_buffers.buffer[0].fbuffer_bus = pmem;
dprintk(4,
KERN_INFO
"%s: v4l_fbuffer_alloc() - using %d KB high memory\n",
ZR_DEVNAME(zr), size >> 10);
} else {
- fh->v4l_buffers.buffer[i].fbuffer = 0;
+ fh->v4l_buffers.buffer[i].fbuffer = NULL;
fh->v4l_buffers.buffer[i].fbuffer_phys =
pmem + i * fh->v4l_buffers.buffer_size;
fh->v4l_buffers.buffer[i].fbuffer_bus =
@@ -1472,7 +1470,7 @@ zoran_close (struct inode *inode,
static ssize_t
zoran_read (struct file *file,
- char *data,
+ char __user *data,
size_t count,
loff_t *ppos)
{
@@ -1483,7 +1481,7 @@ zoran_read (struct file *file,
static ssize_t
zoran_write (struct file *file,
- const char *data,
+ const char __user *data,
size_t count,
loff_t *ppos)
{
@@ -1569,9 +1567,9 @@ setup_window (struct file *file,
int y,
int width,
int height,
- struct video_clip *clips,
+ struct video_clip __user *clips,
int clipcount,
- void *bitmap)
+ void __user *bitmap)
{
struct zoran_fh *fh = file->private_data;
struct zoran *zr = fh->zr;
@@ -2873,7 +2871,7 @@ zoran_do_ioctl (struct inode *inode,
fmt->fmt.win.w.top,
fmt->fmt.win.w.width,
fmt->fmt.win.w.height,
- (struct video_clip *)
+ (struct video_clip __user *)
fmt->fmt.win.clips,
fmt->fmt.win.clipcount,
fmt->fmt.win.bitmap);
diff --git a/drivers/media/video/zoran_procfs.c b/drivers/media/video/zoran_procfs.c
index 703d6bf8e516..7a70df4c4cff 100644
--- a/drivers/media/video/zoran_procfs.c
+++ b/drivers/media/video/zoran_procfs.c
@@ -196,7 +196,7 @@ zoran_read_proc (char *buffer,
static int
zoran_write_proc (struct file *file,
- const char *buffer,
+ const char __user *buffer,
unsigned long count,
void *data)
{
@@ -252,7 +252,7 @@ zoran_proc_init (struct zoran *zr)
char name[8];
snprintf(name, 7, "zoran%d", zr->id);
- if ((zr->zoran_proc = create_proc_entry(name, 0, 0))) {
+ if ((zr->zoran_proc = create_proc_entry(name, 0, NULL))) {
zr->zoran_proc->read_proc = zoran_read_proc;
zr->zoran_proc->write_proc = zoran_write_proc;
zr->zoran_proc->data = zr;
@@ -278,7 +278,7 @@ zoran_proc_cleanup (struct zoran *zr)
snprintf(name, 7, "zoran%d", zr->id);
if (zr->zoran_proc) {
- remove_proc_entry(name, 0);
+ remove_proc_entry(name, NULL);
}
zr->zoran_proc = NULL;
#endif
diff --git a/drivers/message/fusion/mptscsih.c b/drivers/message/fusion/mptscsih.c
index 048e40f587f8..8c82254b44c5 100644
--- a/drivers/message/fusion/mptscsih.c
+++ b/drivers/message/fusion/mptscsih.c
@@ -99,7 +99,7 @@ MODULE_LICENSE("GPL");
/* Set string for command line args from insmod */
#ifdef MODULE
-char *mptscsih = 0;
+char *mptscsih = NULL;
#endif
/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
diff --git a/drivers/message/i2o/i2o_config.c b/drivers/message/i2o/i2o_config.c
index 773096305b2f..a28c4423bddf 100644
--- a/drivers/message/i2o/i2o_config.c
+++ b/drivers/message/i2o/i2o_config.c
@@ -857,7 +857,7 @@ static int ioctl_passthru(unsigned long arg)
u32 sg_count = 0;
int sg_index = 0;
u32 i = 0;
- void *p = 0;
+ void *p = NULL;
unsigned int iop;
if (get_user(iop, &cmd->iop) || get_user(user_msg, &cmd->msg))
diff --git a/drivers/message/i2o/i2o_proc.c b/drivers/message/i2o/i2o_proc.c
index 7622e0aa3165..db85e21b941d 100644
--- a/drivers/message/i2o/i2o_proc.c
+++ b/drivers/message/i2o/i2o_proc.c
@@ -3337,7 +3337,7 @@ static int create_i2o_procfs(void)
struct i2o_controller *pctrl = NULL;
int i;
- i2o_proc_dir_root = proc_mkdir("i2o", 0);
+ i2o_proc_dir_root = proc_mkdir("i2o", NULL);
if(!i2o_proc_dir_root)
return -1;
i2o_proc_dir_root->owner = THIS_MODULE;
@@ -3371,7 +3371,7 @@ static int __exit destroy_i2o_procfs(void)
}
if(!atomic_read(&i2o_proc_dir_root->count))
- remove_proc_entry("i2o", 0);
+ remove_proc_entry("i2o", NULL);
else
return -1;
diff --git a/drivers/net/appletalk/ltpc.c b/drivers/net/appletalk/ltpc.c
index cc7476f1c041..70a7a181b8d8 100644
--- a/drivers/net/appletalk/ltpc.c
+++ b/drivers/net/appletalk/ltpc.c
@@ -501,7 +501,7 @@ static void idle(struct net_device *dev)
/* FIXME This is initialized to shut the warning up, but I need to
* think this through again.
*/
- struct xmitQel *q=0;
+ struct xmitQel *q = NULL;
int oops;
int i;
int base = dev->base_addr;
@@ -1203,7 +1203,7 @@ struct net_device * __init ltpc_probe(void)
if (err)
goto out4;
- return 0;
+ return NULL;
out4:
del_timer_sync(&ltpc_timer);
if (dev->irq)
diff --git a/drivers/net/irda/irtty-sir.c b/drivers/net/irda/irtty-sir.c
index b924ff1c0bef..b67441d0a234 100644
--- a/drivers/net/irda/irtty-sir.c
+++ b/drivers/net/irda/irtty-sir.c
@@ -584,7 +584,7 @@ static void irtty_close(struct tty_struct *tty)
*/
/* we are dead now */
- tty->disc_data = 0;
+ tty->disc_data = NULL;
sirdev_put_instance(priv->dev);
diff --git a/drivers/net/irda/vlsi_ir.c b/drivers/net/irda/vlsi_ir.c
index f7416342b945..eda2d01a5d8e 100644
--- a/drivers/net/irda/vlsi_ir.c
+++ b/drivers/net/irda/vlsi_ir.c
@@ -1876,7 +1876,7 @@ static int __init vlsi_mod_init(void)
* Failure to create the procfs entry is handled like running
* without procfs - it's not required for the driver to work.
*/
- vlsi_proc_root = create_proc_entry(PROC_DIR, S_IFDIR, 0);
+ vlsi_proc_root = create_proc_entry(PROC_DIR, S_IFDIR, NULL);
if (vlsi_proc_root) {
/* protect registered procdir against module removal.
* Because we are in the module init path there's no race
@@ -1888,7 +1888,7 @@ static int __init vlsi_mod_init(void)
ret = pci_module_init(&vlsi_irda_driver);
if (ret && vlsi_proc_root)
- remove_proc_entry(PROC_DIR, 0);
+ remove_proc_entry(PROC_DIR, NULL);
return ret;
}
@@ -1897,7 +1897,7 @@ static void __exit vlsi_mod_exit(void)
{
pci_unregister_driver(&vlsi_irda_driver);
if (vlsi_proc_root)
- remove_proc_entry(PROC_DIR, 0);
+ remove_proc_entry(PROC_DIR, NULL);
}
module_init(vlsi_mod_init);
diff --git a/drivers/net/pcmcia/smc91c92_cs.c b/drivers/net/pcmcia/smc91c92_cs.c
index d3d35ef7d31d..49d60d9ca062 100644
--- a/drivers/net/pcmcia/smc91c92_cs.c
+++ b/drivers/net/pcmcia/smc91c92_cs.c
@@ -1272,7 +1272,7 @@ static int smc_open(struct net_device *dev)
link->open++;
netif_start_queue(dev);
- smc->saved_skb = 0;
+ smc->saved_skb = NULL;
smc->packets_waiting = 0;
smc_reset(dev);
diff --git a/drivers/net/pcmcia/xirc2ps_cs.c b/drivers/net/pcmcia/xirc2ps_cs.c
index 870a2d25c1d2..5be2ba3b03e8 100644
--- a/drivers/net/pcmcia/xirc2ps_cs.c
+++ b/drivers/net/pcmcia/xirc2ps_cs.c
@@ -815,7 +815,7 @@ xirc2ps_config(dev_link_t * link)
cistpl_lan_node_id_t *node_id = (cistpl_lan_node_id_t*)parse.funce.data;
cistpl_cftable_entry_t *cf = &parse.cftable_entry;
- local->dingo_ccr = 0;
+ local->dingo_ccr = NULL;
DEBUG(0, "config(0x%p)\n", link);
diff --git a/drivers/net/tokenring/ibmtr.c b/drivers/net/tokenring/ibmtr.c
index dd1c6155fdd3..69e9246d8847 100644
--- a/drivers/net/tokenring/ibmtr.c
+++ b/drivers/net/tokenring/ibmtr.c
@@ -383,7 +383,7 @@ static int __devinit ibmtr_probe1(struct net_device *dev, int PIOaddr)
{
unsigned char segment, intr=0, irq=0, i, j, cardpresent=NOTOK, temp=0;
- void * t_mmio = 0;
+ void * t_mmio = NULL;
struct tok_info *ti = dev->priv;
void *cd_chanid;
unsigned char *tchanid, ctemp;
diff --git a/drivers/net/wan/cosa.c b/drivers/net/wan/cosa.c
index da86c5132a4d..dbd79016897d 100644
--- a/drivers/net/wan/cosa.c
+++ b/drivers/net/wan/cosa.c
@@ -729,7 +729,7 @@ static void cosa_sppp_timeout(struct net_device *dev)
cosa_kick(chan->cosa);
if (chan->tx_skb) {
dev_kfree_skb(chan->tx_skb);
- chan->tx_skb = 0;
+ chan->tx_skb = NULL;
}
netif_wake_queue(dev);
}
@@ -745,11 +745,11 @@ static int cosa_sppp_close(struct net_device *d)
spin_lock_irqsave(&chan->cosa->lock, flags);
if (chan->rx_skb) {
kfree_skb(chan->rx_skb);
- chan->rx_skb = 0;
+ chan->rx_skb = NULL;
}
if (chan->tx_skb) {
kfree_skb(chan->tx_skb);
- chan->tx_skb = 0;
+ chan->tx_skb = NULL;
}
chan->usage=0;
chan->cosa->usage--;
@@ -791,7 +791,7 @@ static int sppp_rx_done(struct channel_data *chan)
chan->stats.rx_packets++;
chan->stats.rx_bytes += chan->cosa->rxsize;
netif_rx(chan->rx_skb);
- chan->rx_skb = 0;
+ chan->rx_skb = NULL;
chan->pppdev.dev->last_rx = jiffies;
return 0;
}
@@ -807,7 +807,7 @@ static int sppp_tx_done(struct channel_data *chan, int size)
return 1;
}
dev_kfree_skb_irq(chan->tx_skb);
- chan->tx_skb = 0;
+ chan->tx_skb = NULL;
chan->stats.tx_packets++;
chan->stats.tx_bytes += size;
netif_wake_queue(chan->pppdev.dev);
diff --git a/drivers/scsi/aacraid/aachba.c b/drivers/scsi/aacraid/aachba.c
index 5b59fa6bb49f..7b02a48a2931 100644
--- a/drivers/scsi/aacraid/aachba.c
+++ b/drivers/scsi/aacraid/aachba.c
@@ -1080,7 +1080,7 @@ int aac_scsi_cmd(struct scsi_cmnd * scsicmd)
}
}
-static int query_disk(struct aac_dev *dev, void *arg)
+static int query_disk(struct aac_dev *dev, void __user *arg)
{
struct aac_query_disk qd;
struct fsa_scsi_hba *fsa_dev_ptr;
@@ -1117,7 +1117,7 @@ static int query_disk(struct aac_dev *dev, void *arg)
return 0;
}
-static int force_delete_disk(struct aac_dev *dev, void *arg)
+static int force_delete_disk(struct aac_dev *dev, void __user *arg)
{
struct aac_delete_disk dd;
struct fsa_scsi_hba *fsa_dev_ptr;
@@ -1140,7 +1140,7 @@ static int force_delete_disk(struct aac_dev *dev, void *arg)
return 0;
}
-static int delete_disk(struct aac_dev *dev, void *arg)
+static int delete_disk(struct aac_dev *dev, void __user *arg)
{
struct aac_delete_disk dd;
struct fsa_scsi_hba *fsa_dev_ptr;
@@ -1167,7 +1167,7 @@ static int delete_disk(struct aac_dev *dev, void *arg)
}
}
-int aac_dev_ioctl(struct aac_dev *dev, int cmd, void *arg)
+int aac_dev_ioctl(struct aac_dev *dev, int cmd, void __user *arg)
{
switch (cmd) {
case FSACTL_QUERY_DISK:
diff --git a/drivers/scsi/aacraid/aacraid.h b/drivers/scsi/aacraid/aacraid.h
index cd87bcba4be9..2592b6fe83af 100644
--- a/drivers/scsi/aacraid/aacraid.h
+++ b/drivers/scsi/aacraid/aacraid.h
@@ -1237,7 +1237,7 @@ struct fib_ioctl
{
u32 fibctx;
s32 wait;
- char *fib;
+ char __user *fib;
};
struct revision
@@ -1448,8 +1448,8 @@ int fib_complete(struct fib * context);
struct aac_dev *aac_init_adapter(struct aac_dev *dev);
int aac_get_containers(struct aac_dev *dev);
int aac_scsi_cmd(struct scsi_cmnd *cmd);
-int aac_dev_ioctl(struct aac_dev *dev, int cmd, void *arg);
-int aac_do_ioctl(struct aac_dev * dev, int cmd, void *arg);
+int aac_dev_ioctl(struct aac_dev *dev, int cmd, void __user *arg);
+int aac_do_ioctl(struct aac_dev * dev, int cmd, void __user *arg);
int aac_rx_init(struct aac_dev *dev);
int aac_rkt_init(struct aac_dev *dev);
int aac_sa_init(struct aac_dev *dev);
diff --git a/drivers/scsi/aacraid/commctrl.c b/drivers/scsi/aacraid/commctrl.c
index 5e17d049b7c2..36ae4af396ee 100644
--- a/drivers/scsi/aacraid/commctrl.c
+++ b/drivers/scsi/aacraid/commctrl.c
@@ -52,7 +52,7 @@
* program.
*/
-static int ioctl_send_fib(struct aac_dev * dev, void *arg)
+static int ioctl_send_fib(struct aac_dev * dev, void __user *arg)
{
struct hw_fib * kfib;
struct fib *fibptr;
@@ -127,7 +127,7 @@ static int ioctl_send_fib(struct aac_dev * dev, void *arg)
* passed in from the user.
*/
-static int open_getadapter_fib(struct aac_dev * dev, void *arg)
+static int open_getadapter_fib(struct aac_dev * dev, void __user *arg)
{
struct aac_fib_context * fibctx;
int status;
@@ -199,7 +199,7 @@ static int open_getadapter_fib(struct aac_dev * dev, void *arg)
* passed in from the user.
*/
-static int next_getadapter_fib(struct aac_dev * dev, void *arg)
+static int next_getadapter_fib(struct aac_dev * dev, void __user *arg)
{
struct fib_ioctl f;
struct fib *fib;
@@ -332,7 +332,7 @@ int aac_close_fib_context(struct aac_dev * dev, struct aac_fib_context * fibctx)
* This routine will close down the fibctx passed in from the user.
*/
-static int close_getadapter_fib(struct aac_dev * dev, void *arg)
+static int close_getadapter_fib(struct aac_dev * dev, void __user *arg)
{
struct aac_fib_context *fibctx;
int status;
@@ -384,7 +384,7 @@ static int close_getadapter_fib(struct aac_dev * dev, void *arg)
* simple!
*/
-static int check_revision(struct aac_dev *dev, void *arg)
+static int check_revision(struct aac_dev *dev, void __user *arg)
{
struct revision response;
@@ -403,20 +403,20 @@ static int check_revision(struct aac_dev *dev, void *arg)
*
*/
-int aac_send_raw_srb(struct aac_dev* dev, void* arg)
+int aac_send_raw_srb(struct aac_dev* dev, void __user * arg)
{
struct fib* srbfib;
int status;
struct aac_srb *srbcmd;
- struct aac_srb *user_srb = arg;
- struct aac_srb_reply* user_reply;
+ struct aac_srb __user *user_srb = arg;
+ struct aac_srb_reply __user *user_reply;
struct aac_srb_reply* reply;
u32 fibsize = 0;
u32 flags = 0;
s32 rcode = 0;
u32 data_dir;
- ulong sg_user[32];
- ulong sg_list[32];
+ void __user *sg_user[32];
+ void *sg_list[32];
u32 sg_indx = 0;
u32 byte_count = 0;
u32 actual_fibsize = 0;
@@ -437,7 +437,7 @@ int aac_send_raw_srb(struct aac_dev* dev, void* arg)
srbcmd = (struct aac_srb*) fib_data(srbfib);
- if(copy_from_user((void*)&fibsize, (void*)&user_srb->count,sizeof(u32))){
+ if(copy_from_user(&fibsize, &user_srb->count,sizeof(u32))){
printk(KERN_DEBUG"aacraid: Could not copy data size from user\n");
rcode = -EFAULT;
goto cleanup;
@@ -512,12 +512,12 @@ int aac_send_raw_srb(struct aac_dev* dev, void* arg)
rcode = -ENOMEM;
goto cleanup;
}
- sg_user[i] = (ulong)psg->sg[i].addr;
- sg_list[i] = (ulong)p; // save so we can clean up later
+ sg_user[i] = (void __user *)psg->sg[i].addr;
+ sg_list[i] = p; // save so we can clean up later
sg_indx = i;
if( flags & SRB_DataOut ){
- if(copy_from_user(p,psg->sg[i].addr,psg->sg[i].count)){
+ if(copy_from_user(p,sg_user[i],psg->sg[i].count)){
printk(KERN_DEBUG"aacraid: Could not copy sg data from user\n");
rcode = -EFAULT;
goto cleanup;
@@ -533,7 +533,7 @@ int aac_send_raw_srb(struct aac_dev* dev, void* arg)
}
srbcmd->count = cpu_to_le32(byte_count);
- status = fib_send(ScsiPortCommand64, srbfib, actual_fibsize, FsaNormal, 1, 1,0,0);
+ status = fib_send(ScsiPortCommand64, srbfib, actual_fibsize, FsaNormal, 1, 1,NULL,NULL);
} else {
struct sgmap* psg = &srbcmd->sg;
byte_count = 0;
@@ -559,12 +559,12 @@ int aac_send_raw_srb(struct aac_dev* dev, void* arg)
rcode = -ENOMEM;
goto cleanup;
}
- sg_user[i] = (ulong)(psg->sg[i].addr);
- sg_list[i] = (ulong)p; // save so we can clean up later
+ sg_user[i] = (void __user *)(psg->sg[i].addr);
+ sg_list[i] = p; // save so we can clean up later
sg_indx = i;
if( flags & SRB_DataOut ){
- if(copy_from_user((void*)p,(void*)(ulong)(psg->sg[i].addr),psg->sg[i].count)){
+ if(copy_from_user(p,sg_user[i],psg->sg[i].count)){
printk(KERN_DEBUG"aacraid: Could not copy sg data from user\n");
rcode = -EFAULT;
goto cleanup;
@@ -577,7 +577,7 @@ int aac_send_raw_srb(struct aac_dev* dev, void* arg)
byte_count += psg->sg[i].count;
}
srbcmd->count = cpu_to_le32(byte_count);
- status = fib_send(ScsiPortCommand, srbfib, actual_fibsize, FsaNormal, 1, 1, 0, 0);
+ status = fib_send(ScsiPortCommand, srbfib, actual_fibsize, FsaNormal, 1, 1, NULL, NULL);
}
if (status != 0){
@@ -588,7 +588,7 @@ int aac_send_raw_srb(struct aac_dev* dev, void* arg)
if( flags & SRB_DataIn ) {
for(i = 0 ; i <= sg_indx; i++){
- if(copy_to_user((void*)(sg_user[i]),(void*)(sg_list[i]),le32_to_cpu(srbcmd->sg.sg[i].count))){
+ if(copy_to_user(sg_user[i],sg_list[i],le32_to_cpu(srbcmd->sg.sg[i].count))){
printk(KERN_DEBUG"aacraid: Could not copy sg data to user\n");
rcode = -EFAULT;
goto cleanup;
@@ -606,7 +606,7 @@ int aac_send_raw_srb(struct aac_dev* dev, void* arg)
cleanup:
for(i=0; i <= sg_indx; i++){
- kfree((void*)sg_list[i]);
+ kfree(sg_list[i]);
}
fib_complete(srbfib);
fib_free(srbfib);
@@ -621,14 +621,14 @@ struct aac_pci_info {
};
-int aac_get_pci_info(struct aac_dev* dev, void* arg)
+int aac_get_pci_info(struct aac_dev* dev, void __user *arg)
{
struct aac_pci_info pci_info;
pci_info.bus = dev->pdev->bus->number;
pci_info.slot = PCI_SLOT(dev->pdev->devfn);
- if(copy_to_user( arg, (void*)&pci_info, sizeof(struct aac_pci_info))){
+ if (copy_to_user(arg, &pci_info, sizeof(struct aac_pci_info))) {
printk(KERN_DEBUG "aacraid: Could not copy pci info\n");
return -EFAULT;
}
@@ -636,7 +636,7 @@ int aac_get_pci_info(struct aac_dev* dev, void* arg)
}
-int aac_do_ioctl(struct aac_dev * dev, int cmd, void *arg)
+int aac_do_ioctl(struct aac_dev * dev, int cmd, void __user *arg)
{
int status;
diff --git a/drivers/scsi/aacraid/linit.c b/drivers/scsi/aacraid/linit.c
index 4f9247b5a664..1a16c13e7e02 100644
--- a/drivers/scsi/aacraid/linit.c
+++ b/drivers/scsi/aacraid/linit.c
@@ -356,7 +356,7 @@ static int aac_slave_configure(struct scsi_device *sdev)
return 0;
}
-static int aac_ioctl(struct scsi_device *sdev, int cmd, void * arg)
+static int aac_ioctl(struct scsi_device *sdev, int cmd, void __user * arg)
{
struct aac_dev *dev = (struct aac_dev *)sdev->host->hostdata;
return aac_do_ioctl(dev, cmd, arg);
@@ -463,7 +463,7 @@ static int aac_cfg_open(struct inode *inode, struct file *file)
static int aac_cfg_ioctl(struct inode *inode, struct file *file,
unsigned int cmd, unsigned long arg)
{
- return aac_do_ioctl(file->private_data, cmd, (void *)arg);
+ return aac_do_ioctl(file->private_data, cmd, (void __user *)arg);
}
static struct file_operations aac_cfg_fops = {
diff --git a/drivers/scsi/megaraid.c b/drivers/scsi/megaraid.c
index d8467ab41ae2..5fd685e9a23e 100644
--- a/drivers/scsi/megaraid.c
+++ b/drivers/scsi/megaraid.c
@@ -335,6 +335,18 @@ mega_query_adapter(adapter_t *adapter)
return 0;
}
+/**
+ * mega_runpendq()
+ * @adapter - pointer to our soft state
+ *
+ * Runs through the list of pending requests.
+ */
+static inline void
+mega_runpendq(adapter_t *adapter)
+{
+ if(!list_empty(&adapter->pending_list))
+ __mega_runpendq(adapter);
+}
/*
* megaraid_queue()
@@ -384,6 +396,95 @@ megaraid_queue(Scsi_Cmnd *scmd, void (*done)(Scsi_Cmnd *))
return busy;
}
+/**
+ * mega_allocate_scb()
+ * @adapter - pointer to our soft state
+ * @cmd - scsi command from the mid-layer
+ *
+ * Allocate a SCB structure. This is the central structure for controller
+ * commands.
+ */
+static inline scb_t *
+mega_allocate_scb(adapter_t *adapter, Scsi_Cmnd *cmd)
+{
+ struct list_head *head = &adapter->free_list;
+ scb_t *scb;
+
+ /* Unlink command from Free List */
+ if( !list_empty(head) ) {
+
+ scb = list_entry(head->next, scb_t, list);
+
+ list_del_init(head->next);
+
+ scb->state = SCB_ACTIVE;
+ scb->cmd = cmd;
+ scb->dma_type = MEGA_DMA_TYPE_NONE;
+
+ return scb;
+ }
+
+ return NULL;
+}
+
+/**
+ * mega_get_ldrv_num()
+ * @adapter - pointer to our soft state
+ * @cmd - scsi mid layer command
+ * @channel - channel on the controller
+ *
+ * Calculate the logical drive number based on the information in scsi command
+ * and the channel number.
+ */
+static inline int
+mega_get_ldrv_num(adapter_t *adapter, Scsi_Cmnd *cmd, int channel)
+{
+ int tgt;
+ int ldrv_num;
+
+ tgt = cmd->device->id;
+
+ if ( tgt > adapter->this_id )
+ tgt--; /* we do not get inquires for initiator id */
+
+ ldrv_num = (channel * 15) + tgt;
+
+
+ /*
+ * If we have a logical drive with boot enabled, project it first
+ */
+ if( adapter->boot_ldrv_enabled ) {
+ if( ldrv_num == 0 ) {
+ ldrv_num = adapter->boot_ldrv;
+ }
+ else {
+ if( ldrv_num <= adapter->boot_ldrv ) {
+ ldrv_num--;
+ }
+ }
+ }
+
+ /*
+ * If "delete logical drive" feature is enabled on this controller.
+ * Do only if at least one delete logical drive operation was done.
+ *
+ * Also, after logical drive deletion, instead of logical drive number,
+ * the value returned should be 0x80+logical drive id.
+ *
+ * These is valid only for IO commands.
+ */
+
+ if (adapter->support_random_del && adapter->read_ldidmap )
+ switch (cmd->cmnd[0]) {
+ case READ_6: /* fall through */
+ case WRITE_6: /* fall through */
+ case READ_10: /* fall through */
+ case WRITE_10:
+ ldrv_num += 0x80;
+ }
+
+ return ldrv_num;
+}
/**
* mega_build_cmd()
@@ -966,52 +1067,6 @@ mega_prepare_extpassthru(adapter_t *adapter, scb_t *scb, Scsi_Cmnd *cmd,
return epthru;
}
-
-/**
- * mega_allocate_scb()
- * @adapter - pointer to our soft state
- * @cmd - scsi command from the mid-layer
- *
- * Allocate a SCB structure. This is the central structure for controller
- * commands.
- */
-static inline scb_t *
-mega_allocate_scb(adapter_t *adapter, Scsi_Cmnd *cmd)
-{
- struct list_head *head = &adapter->free_list;
- scb_t *scb;
-
- /* Unlink command from Free List */
- if( !list_empty(head) ) {
-
- scb = list_entry(head->next, scb_t, list);
-
- list_del_init(head->next);
-
- scb->state = SCB_ACTIVE;
- scb->cmd = cmd;
- scb->dma_type = MEGA_DMA_TYPE_NONE;
-
- return scb;
- }
-
- return NULL;
-}
-
-
-/**
- * mega_runpendq()
- * @adapter - pointer to our soft state
- *
- * Runs through the list of pending requests.
- */
-static inline void
-mega_runpendq(adapter_t *adapter)
-{
- if(!list_empty(&adapter->pending_list))
- __mega_runpendq(adapter);
-}
-
static void
__mega_runpendq(adapter_t *adapter)
{
@@ -1043,7 +1098,7 @@ __mega_runpendq(adapter_t *adapter)
* busy. We also take the scb from the pending list if the mailbox is
* available.
*/
-static inline int
+static int
issue_scb(adapter_t *adapter, scb_t *scb)
{
volatile mbox64_t *mbox64 = adapter->mbox64;
@@ -1104,6 +1159,16 @@ issue_scb(adapter_t *adapter, scb_t *scb)
return 0;
}
+/*
+ * Wait until the controller's mailbox is available
+ */
+static inline int
+mega_busywait_mbox (adapter_t *adapter)
+{
+ if (adapter->mbox->m_in.busy)
+ return __mega_busywait_mbox(adapter);
+ return 0;
+}
/**
* issue_scb_block()
@@ -1350,7 +1415,7 @@ megaraid_isr_memmapped(int irq, void *devp, struct pt_regs *regs)
*
* Complete the comamnds and call the scsi mid-layer callback hooks.
*/
-static inline void
+static void
mega_cmd_done(adapter_t *adapter, u8 completed[], int nstatus, int status)
{
mega_ext_passthru *epthru = NULL;
@@ -1671,17 +1736,6 @@ mega_free_scb(adapter_t *adapter, scb_t *scb)
}
-/*
- * Wait until the controller's mailbox is available
- */
-static inline int
-mega_busywait_mbox (adapter_t *adapter)
-{
- if (adapter->mbox->m_in.busy)
- return __mega_busywait_mbox(adapter);
- return 0;
-}
-
static int
__mega_busywait_mbox (adapter_t *adapter)
{
@@ -2017,6 +2071,49 @@ megaraid_abort_and_reset(adapter_t *adapter, Scsi_Cmnd *cmd, int aor)
return FALSE;
}
+static inline int
+make_local_pdev(adapter_t *adapter, struct pci_dev **pdev)
+{
+ *pdev = kmalloc(sizeof(struct pci_dev), GFP_KERNEL);
+
+ if( *pdev == NULL ) return -1;
+
+ memcpy(*pdev, adapter->dev, sizeof(struct pci_dev));
+
+ if( pci_set_dma_mask(*pdev, 0xffffffff) != 0 ) {
+ kfree(*pdev);
+ return -1;
+ }
+
+ return 0;
+}
+
+static inline void
+free_local_pdev(struct pci_dev *pdev)
+{
+ kfree(pdev);
+}
+
+/**
+ * mega_allocate_inquiry()
+ * @dma_handle - handle returned for dma address
+ * @pdev - handle to pci device
+ *
+ * allocates memory for inquiry structure
+ */
+static inline void *
+mega_allocate_inquiry(dma_addr_t *dma_handle, struct pci_dev *pdev)
+{
+ return pci_alloc_consistent(pdev, sizeof(mega_inquiry3), dma_handle);
+}
+
+
+static inline void
+mega_free_inquiry(void *inquiry, dma_addr_t dma_handle, struct pci_dev *pdev)
+{
+ pci_free_consistent(pdev, sizeof(mega_inquiry3), inquiry, dma_handle);
+}
+
#ifdef CONFIG_PROC_FS
/* Following code handles /proc fs */
@@ -3269,13 +3366,13 @@ megadev_ioctl(struct inode *inode, struct file *filep, unsigned int cmd,
nitioctl_t uioc;
int adapno;
int rval;
- mega_passthru *upthru; /* user address for passthru */
+ mega_passthru __user *upthru; /* user address for passthru */
mega_passthru *pthru; /* copy user passthru here */
dma_addr_t pthru_dma_hndl;
void *data = NULL; /* data to be transferred */
dma_addr_t data_dma_hndl; /* dma handle for data xfer area */
megacmd_t mc;
- megastat_t *ustats;
+ megastat_t __user *ustats;
int num_ldrv;
u32 uxferaddr = 0;
struct pci_dev *pdev;
@@ -3300,20 +3397,20 @@ megadev_ioctl(struct inode *inode, struct file *filep, unsigned int cmd,
* addresses.
*/
memset(&uioc, 0, sizeof(nitioctl_t));
- if( (rval = mega_m_to_n( (void *)arg, &uioc)) != 0 )
+ if( (rval = mega_m_to_n( (void __user *)arg, &uioc)) != 0 )
return rval;
switch( uioc.opcode ) {
case GET_DRIVER_VER:
- if( put_user(driver_ver, (u32 *)uioc.uioc_uaddr) )
+ if( put_user(driver_ver, (u32 __user *)uioc.uioc_uaddr) )
return (-EFAULT);
break;
case GET_N_ADAP:
- if( put_user(hba_count, (u32 *)uioc.uioc_uaddr) )
+ if( put_user(hba_count, (u32 __user *)uioc.uioc_uaddr) )
return (-EFAULT);
/*
@@ -3347,7 +3444,7 @@ megadev_ioctl(struct inode *inode, struct file *filep, unsigned int cmd,
adapter = hba_soft_state[adapno];
- ustats = (megastat_t *)uioc.uioc_uaddr;
+ ustats = uioc.uioc_uaddr;
if( copy_from_user(&num_ldrv, &ustats->num_ldrv, sizeof(int)) )
return (-EFAULT);
@@ -3418,7 +3515,7 @@ megadev_ioctl(struct inode *inode, struct file *filep, unsigned int cmd,
mc.status = rval;
- rval = mega_n_to_m((void *)arg, &mc);
+ rval = mega_n_to_m((void __user *)arg, &mc);
}
return rval;
@@ -3458,12 +3555,12 @@ megadev_ioctl(struct inode *inode, struct file *filep, unsigned int cmd,
/*
* The user passthru structure
*/
- upthru = (mega_passthru *)MBOX(uioc)->xferaddr;
+ upthru = (mega_passthru __user *)MBOX(uioc)->xferaddr;
/*
* Copy in the user passthru here.
*/
- if( copy_from_user(pthru, (char *)upthru,
+ if( copy_from_user(pthru, upthru,
sizeof(mega_passthru)) ) {
pci_free_consistent(pdev,
@@ -3510,7 +3607,7 @@ megadev_ioctl(struct inode *inode, struct file *filep, unsigned int cmd,
/*
* Get the user data
*/
- if( copy_from_user(data, (char *)uxferaddr,
+ if( copy_from_user(data, (char __user *)uxferaddr,
pthru->dataxferlen) ) {
rval = (-EFAULT);
goto freemem_and_return;
@@ -3527,7 +3624,7 @@ megadev_ioctl(struct inode *inode, struct file *filep, unsigned int cmd,
*/
mega_internal_command(adapter, LOCK_INT, &mc, pthru);
- rval = mega_n_to_m((void *)arg, &mc);
+ rval = mega_n_to_m((void __user *)arg, &mc);
if( rval ) goto freemem_and_return;
@@ -3536,7 +3633,7 @@ megadev_ioctl(struct inode *inode, struct file *filep, unsigned int cmd,
* Is data going up-stream
*/
if( pthru->dataxferlen && (uioc.flags & UIOC_RD) ) {
- if( copy_to_user((char *)uxferaddr, data,
+ if( copy_to_user((char __user *)uxferaddr, data,
pthru->dataxferlen) ) {
rval = (-EFAULT);
}
@@ -3588,7 +3685,7 @@ freemem_and_return:
/*
* Get the user data
*/
- if( copy_from_user(data, (char *)uxferaddr,
+ if( copy_from_user(data, (char __user *)uxferaddr,
uioc.xferlen) ) {
pci_free_consistent(pdev,
@@ -3610,7 +3707,7 @@ freemem_and_return:
*/
mega_internal_command(adapter, LOCK_INT, &mc, NULL);
- rval = mega_n_to_m((void *)arg, &mc);
+ rval = mega_n_to_m((void __user *)arg, &mc);
if( rval ) {
if( uioc.xferlen ) {
@@ -3628,7 +3725,7 @@ freemem_and_return:
* Is data going up-stream
*/
if( uioc.xferlen && (uioc.flags & UIOC_RD) ) {
- if( copy_to_user((char *)uxferaddr, data,
+ if( copy_to_user((char __user *)uxferaddr, data,
uioc.xferlen) ) {
rval = (-EFAULT);
@@ -3664,7 +3761,7 @@ freemem_and_return:
* Converts the older mimd ioctl structure to newer NIT structure
*/
static int
-mega_m_to_n(void *arg, nitioctl_t *uioc)
+mega_m_to_n(void __user *arg, nitioctl_t *uioc)
{
struct uioctl_t uioc_mimd;
char signature[8] = {0};
@@ -3679,7 +3776,7 @@ mega_m_to_n(void *arg, nitioctl_t *uioc)
* begining of the structure.
*/
- if( copy_from_user(signature, (char *)arg, 7) )
+ if( copy_from_user(signature, arg, 7) )
return (-EFAULT);
if( memcmp(signature, "MEGANIT", 7) == 0 ) {
@@ -3692,7 +3789,7 @@ mega_m_to_n(void *arg, nitioctl_t *uioc)
*/
return -EINVAL;
#if 0
- if( copy_from_user(uioc, (char *)arg, sizeof(nitioctl_t)) )
+ if( copy_from_user(uioc, arg, sizeof(nitioctl_t)) )
return (-EFAULT);
return 0;
#endif
@@ -3703,7 +3800,7 @@ mega_m_to_n(void *arg, nitioctl_t *uioc)
*
* Get the user ioctl structure
*/
- if( copy_from_user(&uioc_mimd, (char *)arg, sizeof(struct uioctl_t)) )
+ if( copy_from_user(&uioc_mimd, arg, sizeof(struct uioctl_t)) )
return (-EFAULT);
@@ -3790,52 +3887,52 @@ mega_m_to_n(void *arg, nitioctl_t *uioc)
* conforms to older mimd ioctl interface or newer NIT ioctl interface
*/
static int
-mega_n_to_m(void *arg, megacmd_t *mc)
+mega_n_to_m(void __user *arg, megacmd_t *mc)
{
- nitioctl_t *uiocp;
- megacmd_t *umc;
- mega_passthru *upthru;
- struct uioctl_t *uioc_mimd;
+ nitioctl_t __user *uiocp;
+ megacmd_t __user *umc;
+ mega_passthru __user *upthru;
+ struct uioctl_t __user *uioc_mimd;
char signature[8] = {0};
/*
* check is the application conforms to NIT.
*/
- if( copy_from_user(signature, (char *)arg, 7) )
+ if( copy_from_user(signature, arg, 7) )
return -EFAULT;
if( memcmp(signature, "MEGANIT", 7) == 0 ) {
- uiocp = (nitioctl_t *)arg;
+ uiocp = arg;
- if( put_user(mc->status, (u8 *)&MBOX_P(uiocp)->status) )
+ if( put_user(mc->status, (u8 __user *)&MBOX_P(uiocp)->status) )
return (-EFAULT);
if( mc->cmd == MEGA_MBOXCMD_PASSTHRU ) {
umc = MBOX_P(uiocp);
- if (get_user(upthru, (mega_passthru **)&umc->xferaddr))
- return (-EFAULT);
+ if (get_user(upthru, (mega_passthru __user * __user *)&umc->xferaddr))
+ return -EFAULT;
- if( put_user(mc->status, (u8 *)&upthru->scsistatus) )
+ if( put_user(mc->status, (u8 __user *)&upthru->scsistatus))
return (-EFAULT);
}
}
else {
- uioc_mimd = (struct uioctl_t *)arg;
+ uioc_mimd = arg;
- if( put_user(mc->status, (u8 *)&uioc_mimd->mbox[17]) )
+ if( put_user(mc->status, (u8 __user *)&uioc_mimd->mbox[17]) )
return (-EFAULT);
if( mc->cmd == MEGA_MBOXCMD_PASSTHRU ) {
- umc = (megacmd_t *)uioc_mimd->mbox;
+ umc = (megacmd_t __user *)uioc_mimd->mbox;
- if (get_user(upthru, (mega_passthru **)&umc->xferaddr))
+ if (get_user(upthru, (mega_passthru __user * __user *)&umc->xferaddr))
return (-EFAULT);
- if( put_user(mc->status, (u8 *)&upthru->scsistatus) )
+ if( put_user(mc->status, (u8 __user *)&upthru->scsistatus) )
return (-EFAULT);
}
}
@@ -4233,67 +4330,6 @@ mega_support_cluster(adapter_t *adapter)
}
-
-/**
- * mega_get_ldrv_num()
- * @adapter - pointer to our soft state
- * @cmd - scsi mid layer command
- * @channel - channel on the controller
- *
- * Calculate the logical drive number based on the information in scsi command
- * and the channel number.
- */
-static inline int
-mega_get_ldrv_num(adapter_t *adapter, Scsi_Cmnd *cmd, int channel)
-{
- int tgt;
- int ldrv_num;
-
- tgt = cmd->device->id;
-
- if ( tgt > adapter->this_id )
- tgt--; /* we do not get inquires for initiator id */
-
- ldrv_num = (channel * 15) + tgt;
-
-
- /*
- * If we have a logical drive with boot enabled, project it first
- */
- if( adapter->boot_ldrv_enabled ) {
- if( ldrv_num == 0 ) {
- ldrv_num = adapter->boot_ldrv;
- }
- else {
- if( ldrv_num <= adapter->boot_ldrv ) {
- ldrv_num--;
- }
- }
- }
-
- /*
- * If "delete logical drive" feature is enabled on this controller.
- * Do only if at least one delete logical drive operation was done.
- *
- * Also, after logical drive deletion, instead of logical drive number,
- * the value returned should be 0x80+logical drive id.
- *
- * These is valid only for IO commands.
- */
-
- if (adapter->support_random_del && adapter->read_ldidmap )
- switch (cmd->cmnd[0]) {
- case READ_6: /* fall through */
- case WRITE_6: /* fall through */
- case READ_10: /* fall through */
- case WRITE_10:
- ldrv_num += 0x80;
- }
-
- return ldrv_num;
-}
-
-
/**
* mega_adapinq()
* @adapter - pointer to our soft state
@@ -4329,27 +4365,6 @@ mega_adapinq(adapter_t *adapter, dma_addr_t dma_handle)
}
-/**
- * mega_allocate_inquiry()
- * @dma_handle - handle returned for dma address
- * @pdev - handle to pci device
- *
- * allocates memory for inquiry structure
- */
-static inline caddr_t
-mega_allocate_inquiry(dma_addr_t *dma_handle, struct pci_dev *pdev)
-{
- return pci_alloc_consistent(pdev, sizeof(mega_inquiry3), dma_handle);
-}
-
-
-static inline void
-mega_free_inquiry(caddr_t inquiry, dma_addr_t dma_handle, struct pci_dev *pdev)
-{
- pci_free_consistent(pdev, sizeof(mega_inquiry3), inquiry, dma_handle);
-}
-
-
/** mega_internal_dev_inquiry()
* @adapter - pointer to our soft state
* @ch - channel for this device
@@ -4550,29 +4565,6 @@ mega_internal_done(Scsi_Cmnd *scmd)
}
-static inline int
-make_local_pdev(adapter_t *adapter, struct pci_dev **pdev)
-{
- *pdev = kmalloc(sizeof(struct pci_dev), GFP_KERNEL);
-
- if( *pdev == NULL ) return -1;
-
- memcpy(*pdev, adapter->dev, sizeof(struct pci_dev));
-
- if( pci_set_dma_mask(*pdev, 0xffffffff) != 0 ) {
- kfree(*pdev);
- return -1;
- }
-
- return 0;
-}
-
-static inline void
-free_local_pdev(struct pci_dev *pdev)
-{
- kfree(pdev);
-}
-
static struct scsi_host_template megaraid_template = {
.module = THIS_MODULE,
.name = "MegaRAID",
diff --git a/drivers/scsi/megaraid.h b/drivers/scsi/megaraid.h
index 268e9a7aa0f0..e25c4de9edd9 100644
--- a/drivers/scsi/megaraid.h
+++ b/drivers/scsi/megaraid.h
@@ -522,11 +522,11 @@ struct uioctl_t {
u8 mbox[18]; /* 16 bytes + 2 status bytes */
mega_passthru pthru;
#if BITS_PER_LONG == 32
- char *data; /* buffer <= 4096 for 0x80 commands */
+ char __user *data; /* buffer <= 4096 for 0x80 commands */
char pad[4];
#endif
#if BITS_PER_LONG == 64
- char *data;
+ char __user *data;
#endif
} __attribute__ ((packed));
@@ -622,12 +622,12 @@ typedef struct {
u32 adapno; /* adapter number */
union {
u8 __raw_mbox[18];
- caddr_t __uaddr; /* xferaddr for non-mbox cmds */
+ void __user *__uaddr; /* xferaddr for non-mbox cmds */
}__ua;
#define uioc_rmbox __ua.__raw_mbox
#define MBOX(uioc) ((megacmd_t *)&((uioc).__ua.__raw_mbox[0]))
-#define MBOX_P(uioc) ((megacmd_t *)&((uioc)->__ua.__raw_mbox[0]))
+#define MBOX_P(uioc) ((megacmd_t __user *)&((uioc)->__ua.__raw_mbox[0]))
#define uioc_uaddr __ua.__uaddr
u32 xferlen; /* xferlen for DCMD and non-mbox
@@ -990,14 +990,12 @@ typedef enum { LOCK_INT, LOCK_EXT } lockscope_t;
const char *megaraid_info (struct Scsi_Host *);
static int mega_query_adapter(adapter_t *);
-static inline int issue_scb(adapter_t *, scb_t *);
+static int issue_scb(adapter_t *, scb_t *);
static int mega_setup_mailbox(adapter_t *);
static int megaraid_queue (Scsi_Cmnd *, void (*)(Scsi_Cmnd *));
static scb_t * mega_build_cmd(adapter_t *, Scsi_Cmnd *, int *);
-static inline scb_t *mega_allocate_scb(adapter_t *, Scsi_Cmnd *);
static void __mega_runpendq(adapter_t *);
-static inline void mega_runpendq(adapter_t *);
static int issue_scb_block(adapter_t *, u_char *);
static irqreturn_t megaraid_isr_memmapped(int, void *, struct pt_regs *);
@@ -1014,10 +1012,9 @@ static int mega_print_inquiry(char *, char *);
static int mega_build_sglist (adapter_t *adapter, scb_t *scb,
u32 *buffer, u32 *length);
-static inline int mega_busywait_mbox (adapter_t *);
static int __mega_busywait_mbox (adapter_t *);
static void mega_rundoneq (adapter_t *);
-static inline void mega_cmd_done(adapter_t *, u8 [], int, int);
+static void mega_cmd_done(adapter_t *, u8 [], int, int);
static inline void mega_free_sgl (adapter_t *adapter);
static void mega_8_to_40ld (mraid_inquiry *inquiry,
mega_inquiry3 *enquiry3, mega_product_info *);
@@ -1025,8 +1022,8 @@ static void mega_8_to_40ld (mraid_inquiry *inquiry,
static int megadev_open (struct inode *, struct file *);
static int megadev_ioctl (struct inode *, struct file *, unsigned int,
unsigned long);
-static int mega_m_to_n(void *, nitioctl_t *);
-static int mega_n_to_m(void *, megacmd_t *);
+static int mega_m_to_n(void __user *, nitioctl_t *);
+static int mega_n_to_m(void __user *, megacmd_t *);
static int mega_init_scb (adapter_t *);
@@ -1053,10 +1050,6 @@ static int proc_rdrv(adapter_t *, char *, int, int);
static int mega_adapinq(adapter_t *, dma_addr_t);
static int mega_internal_dev_inquiry(adapter_t *, u8, u8, dma_addr_t);
-static inline caddr_t mega_allocate_inquiry(dma_addr_t *, struct pci_dev *);
-static inline void mega_free_inquiry(caddr_t, dma_addr_t, struct pci_dev *);
-static inline int make_local_pdev(adapter_t *, struct pci_dev **);
-static inline void free_local_pdev(struct pci_dev *);
static int mega_support_ext_cdb(adapter_t *);
static mega_passthru* mega_prepare_passthru(adapter_t *, scb_t *,
@@ -1065,7 +1058,6 @@ static mega_ext_passthru* mega_prepare_extpassthru(adapter_t *,
scb_t *, Scsi_Cmnd *, int, int);
static void mega_enum_raid_scsi(adapter_t *);
static void mega_get_boot_drv(adapter_t *);
-static inline int mega_get_ldrv_num(adapter_t *, Scsi_Cmnd *, int);
static int mega_support_random_del(adapter_t *);
static int mega_del_logdrv(adapter_t *, int);
static int mega_do_del_logdrv(adapter_t *, int);
diff --git a/fs/cifs/cifs_uniupr.h b/fs/cifs/cifs_uniupr.h
index 272d72df500b..decd138f14d4 100644
--- a/fs/cifs/cifs_uniupr.h
+++ b/fs/cifs/cifs_uniupr.h
@@ -132,7 +132,7 @@ const struct UniCaseRange CifsUniUpperRange[] = {
{0x0490, 0x04cc, UniCaseRangeU0490},
{0x1e00, 0x1ffc, UniCaseRangeU1e00},
{0xff40, 0xff5a, UniCaseRangeUff40},
- {0, 0, NULL}
+ {0}
};
#endif
diff --git a/fs/coda/inode.c b/fs/coda/inode.c
index 7345de45fb9a..9d39ef496b62 100644
--- a/fs/coda/inode.c
+++ b/fs/coda/inode.c
@@ -142,7 +142,7 @@ static int get_device_index(struct coda_mount_data *data)
static int coda_fill_super(struct super_block *sb, void *data, int silent)
{
- struct inode *root = 0;
+ struct inode *root = NULL;
struct coda_sb_info *sbi = NULL;
struct venus_comm *vc = NULL;
struct CodaFid fid;
diff --git a/fs/coda/psdev.c b/fs/coda/psdev.c
index 7d55a28b214c..6793b3740471 100644
--- a/fs/coda/psdev.c
+++ b/fs/coda/psdev.c
@@ -296,7 +296,7 @@ static int coda_psdev_open(struct inode * inode, struct file * file)
INIT_LIST_HEAD(&vcp->vc_pending);
INIT_LIST_HEAD(&vcp->vc_processing);
init_waitqueue_head(&vcp->vc_waitq);
- vcp->vc_sb = 0;
+ vcp->vc_sb = NULL;
vcp->vc_seq = 0;
}
diff --git a/fs/coda/sysctl.c b/fs/coda/sysctl.c
index f1692b56319c..60fc6f9ce240 100644
--- a/fs/coda/sysctl.c
+++ b/fs/coda/sysctl.c
@@ -240,7 +240,7 @@ void coda_sysctl_clean(void)
#ifdef CONFIG_SYSCTL
if ( fs_table_header ) {
unregister_sysctl_table(fs_table_header);
- fs_table_header = 0;
+ fs_table_header = NULL;
}
#endif
diff --git a/fs/ext2/acl.c b/fs/ext2/acl.c
index 091a3175dce3..89d1df91411f 100644
--- a/fs/ext2/acl.c
+++ b/fs/ext2/acl.c
@@ -161,7 +161,7 @@ ext2_get_acl(struct inode *inode, int type)
int retval;
if (!test_opt(inode->i_sb, POSIX_ACL))
- return 0;
+ return NULL;
switch(type) {
case ACL_TYPE_ACCESS:
diff --git a/fs/ext3/acl.c b/fs/ext3/acl.c
index fb2410c4704b..a3cf77de0e43 100644
--- a/fs/ext3/acl.c
+++ b/fs/ext3/acl.c
@@ -164,7 +164,7 @@ ext3_get_acl(struct inode *inode, int type)
int retval;
if (!test_opt(inode->i_sb, POSIX_ACL))
- return 0;
+ return NULL;
switch(type) {
case ACL_TYPE_ACCESS:
diff --git a/fs/hfsplus/inode.c b/fs/hfsplus/inode.c
index 69d9ea9948cc..5dc9bdbd1060 100644
--- a/fs/hfsplus/inode.c
+++ b/fs/hfsplus/inode.c
@@ -342,7 +342,7 @@ struct inode *hfsplus_new_inode(struct super_block *sb, int mode)
HFSPLUS_I(inode).cached_start = 0;
HFSPLUS_I(inode).cached_blocks = 0;
HFSPLUS_I(inode).phys_size = 0;
- HFSPLUS_I(inode).rsrc_inode = 0;
+ HFSPLUS_I(inode).rsrc_inode = NULL;
if (S_ISDIR(inode->i_mode)) {
inode->i_size = 2;
HFSPLUS_SB(sb).folder_count++;
diff --git a/fs/hpfs/buffer.c b/fs/hpfs/buffer.c
index 2d5c84455b5d..2807aa833e62 100644
--- a/fs/hpfs/buffer.c
+++ b/fs/hpfs/buffer.c
@@ -73,7 +73,7 @@ void *hpfs_map_4sectors(struct super_block *s, unsigned secno, struct quad_buffe
if (secno & 3) {
printk("HPFS: hpfs_map_4sectors: unaligned read\n");
- return 0;
+ return NULL;
}
qbh->data = data = (char *)kmalloc(2048, GFP_NOFS);
@@ -126,7 +126,7 @@ void *hpfs_get_4sectors(struct super_block *s, unsigned secno,
if (secno & 3) {
printk("HPFS: hpfs_get_4sectors: unaligned read\n");
- return 0;
+ return NULL;
}
/*return hpfs_map_4sectors(s, secno, qbh, 0);*/
diff --git a/fs/isofs/compress.c b/fs/isofs/compress.c
index 8877508ea039..877b4e47d76a 100644
--- a/fs/isofs/compress.c
+++ b/fs/isofs/compress.c
@@ -114,7 +114,7 @@ static int zisofs_readpage(struct file *file, struct page *page)
blockendptr = blockptr + 4;
indexblocks = ((blockptr^blockendptr) >> bufshift) ? 2 : 1;
- ptrbh[0] = ptrbh[1] = 0;
+ ptrbh[0] = ptrbh[1] = NULL;
if ( isofs_get_blocks(inode, blockptr >> bufshift, ptrbh, indexblocks) != indexblocks ) {
if ( ptrbh[0] ) brelse(ptrbh[0]);
diff --git a/fs/minix/inode.c b/fs/minix/inode.c
index 4b52a2ee41be..9295de94df66 100644
--- a/fs/minix/inode.c
+++ b/fs/minix/inode.c
@@ -453,7 +453,7 @@ static struct buffer_head * V1_minix_update_inode(struct inode * inode)
raw_inode = minix_V1_raw_inode(inode->i_sb, inode->i_ino, &bh);
if (!raw_inode)
- return 0;
+ return NULL;
raw_inode->i_mode = inode->i_mode;
raw_inode->i_uid = fs_high2lowuid(inode->i_uid);
raw_inode->i_gid = fs_high2lowgid(inode->i_gid);
@@ -480,7 +480,7 @@ static struct buffer_head * V2_minix_update_inode(struct inode * inode)
raw_inode = minix_V2_raw_inode(inode->i_sb, inode->i_ino, &bh);
if (!raw_inode)
- return 0;
+ return NULL;
raw_inode->i_mode = inode->i_mode;
raw_inode->i_uid = fs_high2lowuid(inode->i_uid);
raw_inode->i_gid = fs_high2lowgid(inode->i_gid);
diff --git a/fs/qnx4/inode.c b/fs/qnx4/inode.c
index aa9dadb489d7..19b7d5a053e1 100644
--- a/fs/qnx4/inode.c
+++ b/fs/qnx4/inode.c
@@ -232,8 +232,8 @@ unsigned long qnx4_block_map( struct inode *inode, long iblock )
int ix;
long offset, i_xblk;
unsigned long block = 0;
- struct buffer_head *bh = 0;
- struct qnx4_xblk *xblk = 0;
+ struct buffer_head *bh = NULL;
+ struct qnx4_xblk *xblk = NULL;
struct qnx4_inode_entry *qnx4_inode = qnx4_raw_inode(inode);
qnx4_nxtnt_t nxtnt = le16_to_cpu(qnx4_inode->di_num_xtnts);
@@ -269,7 +269,7 @@ unsigned long qnx4_block_map( struct inode *inode, long iblock )
i_xblk = le32_to_cpu(xblk->xblk_next_xblk);
ix = 0;
brelse( bh );
- bh = 0;
+ bh = NULL;
}
}
if ( bh )
diff --git a/fs/reiserfs/do_balan.c b/fs/reiserfs/do_balan.c
index 58b3c4272d04..4faa48685907 100644
--- a/fs/reiserfs/do_balan.c
+++ b/fs/reiserfs/do_balan.c
@@ -169,8 +169,8 @@ static int balance_leaf_when_delete (struct tree_balance * tb, int flag)
if ( PATH_H_POSITION (tb->tb_path, 1) == 0 && 1 < B_NR_ITEMS(tb->FR[0]) )
replace_key(tb, tb->CFL[0],tb->lkey[0],tb->FR[0],1);
- leaf_move_items (LEAF_FROM_S_TO_L, tb, n, -1, 0);
- leaf_move_items (LEAF_FROM_R_TO_L, tb, B_NR_ITEMS(tb->R[0]), -1, 0);
+ leaf_move_items (LEAF_FROM_S_TO_L, tb, n, -1, NULL);
+ leaf_move_items (LEAF_FROM_R_TO_L, tb, B_NR_ITEMS(tb->R[0]), -1, NULL);
reiserfs_invalidate_buffer (tb, tbS0);
reiserfs_invalidate_buffer (tb, tb->R[0]);
@@ -178,8 +178,8 @@ static int balance_leaf_when_delete (struct tree_balance * tb, int flag)
return 0;
}
/* all contents of all the 3 buffers will be in R[0] */
- leaf_move_items (LEAF_FROM_S_TO_R, tb, n, -1, 0);
- leaf_move_items (LEAF_FROM_L_TO_R, tb, B_NR_ITEMS(tb->L[0]), -1, 0);
+ leaf_move_items (LEAF_FROM_S_TO_R, tb, n, -1, NULL);
+ leaf_move_items (LEAF_FROM_L_TO_R, tb, B_NR_ITEMS(tb->L[0]), -1, NULL);
/* right_delimiting_key is correct in R[0] */
replace_key(tb, tb->CFR[0],tb->rkey[0],tb->R[0],0);
@@ -854,7 +854,7 @@ static int balance_leaf (struct tree_balance * tb,
/* Insert part of the item into S_new[i] before 0-th item */
bi.tb = tb;
bi.bi_bh = S_new[i];
- bi.bi_parent = 0;
+ bi.bi_parent = NULL;
bi.bi_position = 0;
if ( (old_len - sbytes[i]) > zeros_num ) {
@@ -882,7 +882,7 @@ static int balance_leaf (struct tree_balance * tb,
/* Insert new item into S_new[i] */
bi.tb = tb;
bi.bi_bh = S_new[i];
- bi.bi_parent = 0;
+ bi.bi_parent = NULL;
bi.bi_position = 0;
leaf_insert_into_buf (&bi, item_pos - n + snum[i] - 1, ih, body, zeros_num);
@@ -927,7 +927,7 @@ static int balance_leaf (struct tree_balance * tb,
/* Paste given directory entry to directory item */
bi.tb = tb;
bi.bi_bh = S_new[i];
- bi.bi_parent = 0;
+ bi.bi_parent = NULL;
bi.bi_position = 0;
leaf_paste_in_buffer (&bi, 0, pos_in_item - entry_count + sbytes[i] - 1,
tb->insert_size[0], body,zeros_num);
@@ -965,7 +965,7 @@ static int balance_leaf (struct tree_balance * tb,
/* Append part of body into S_new[0] */
bi.tb = tb;
bi.bi_bh = S_new[i];
- bi.bi_parent = 0;
+ bi.bi_parent = NULL;
bi.bi_position = 0;
if ( n_rem > zeros_num ) {
@@ -1021,7 +1021,7 @@ static int balance_leaf (struct tree_balance * tb,
/* paste into item */
bi.tb = tb;
bi.bi_bh = S_new[i];
- bi.bi_parent = 0;
+ bi.bi_parent = NULL;
bi.bi_position = 0;
leaf_paste_in_buffer(&bi, item_pos - n + snum[i], pos_in_item, tb->insert_size[0], body, zeros_num);
@@ -1196,11 +1196,11 @@ struct buffer_head * get_FEB (struct tree_balance * tb)
bi.tb = tb;
bi.bi_bh = first_b = tb->FEB[i];
- bi.bi_parent = 0;
+ bi.bi_parent = NULL;
bi.bi_position = 0;
make_empty_node (&bi);
set_buffer_uptodate(first_b);
- tb->FEB[i] = 0;
+ tb->FEB[i] = NULL;
tb->used[i] = first_b;
return(first_b);
diff --git a/fs/reiserfs/file.c b/fs/reiserfs/file.c
index 363072cc4e51..f52b701fc2a1 100644
--- a/fs/reiserfs/file.c
+++ b/fs/reiserfs/file.c
@@ -832,7 +832,7 @@ int reiserfs_prepare_file_region_for_write(
struct item_head *ih = NULL; // pointer to item head that we are going to deal with
struct buffer_head *itembuf=NULL; // Buffer head that contains items that we are going to deal with
INITIALIZE_PATH(path); // path to item, that we are going to deal with.
- __u32 * item=0; // pointer to item we are going to deal with
+ __u32 * item=NULL; // pointer to item we are going to deal with
int item_pos=-1; /* Position in indirect item */
diff --git a/fs/reiserfs/fix_node.c b/fs/reiserfs/fix_node.c
index 032201b088bf..649e32a5eb62 100644
--- a/fs/reiserfs/fix_node.c
+++ b/fs/reiserfs/fix_node.c
@@ -2445,12 +2445,12 @@ int fix_nodes (int n_op_mode,
reiserfs_restore_prepared_buffer(p_s_tb->tb_sb, p_s_tb->CFR[i]);
}
- brelse (p_s_tb->L[i]);p_s_tb->L[i] = 0;
- brelse (p_s_tb->R[i]);p_s_tb->R[i] = 0;
- brelse (p_s_tb->FL[i]);p_s_tb->FL[i] = 0;
- brelse (p_s_tb->FR[i]);p_s_tb->FR[i] = 0;
- brelse (p_s_tb->CFL[i]);p_s_tb->CFL[i] = 0;
- brelse (p_s_tb->CFR[i]);p_s_tb->CFR[i] = 0;
+ brelse (p_s_tb->L[i]);p_s_tb->L[i] = NULL;
+ brelse (p_s_tb->R[i]);p_s_tb->R[i] = NULL;
+ brelse (p_s_tb->FL[i]);p_s_tb->FL[i] = NULL;
+ brelse (p_s_tb->FR[i]);p_s_tb->FR[i] = NULL;
+ brelse (p_s_tb->CFL[i]);p_s_tb->CFL[i] = NULL;
+ brelse (p_s_tb->CFR[i]);p_s_tb->CFR[i] = NULL;
}
if (wait_tb_buffers_run) {
diff --git a/fs/reiserfs/ibalance.c b/fs/reiserfs/ibalance.c
index 3df6dda7d776..5b9dee2ac2ae 100644
--- a/fs/reiserfs/ibalance.c
+++ b/fs/reiserfs/ibalance.c
@@ -922,7 +922,7 @@ int balance_internal (struct tree_balance * tb, /* tree_balance structure */
if ( tb->blknum[h] != 1 )
- reiserfs_panic(0, "balance_internal: One new node required for creating the new root");
+ reiserfs_panic(NULL, "balance_internal: One new node required for creating the new root");
/* S[h] = empty buffer from the list FEB. */
tbSh = get_FEB (tb);
blkh = B_BLK_HEAD(tbSh);
@@ -964,7 +964,7 @@ int balance_internal (struct tree_balance * tb, /* tree_balance structure */
dest_bi.tb = tb;
dest_bi.bi_bh = S_new;
- dest_bi.bi_parent = 0;
+ dest_bi.bi_parent = NULL;
dest_bi.bi_position = 0;
src_bi.tb = tb;
src_bi.bi_bh = tbSh;
diff --git a/fs/reiserfs/inode.c b/fs/reiserfs/inode.c
index ce47e0c4f9cd..335e006236ff 100644
--- a/fs/reiserfs/inode.c
+++ b/fs/reiserfs/inode.c
@@ -556,7 +556,7 @@ int reiserfs_get_block (struct inode * inode, sector_t block,
INITIALIZE_PATH(path);
int pos_in_item;
struct cpu_key key;
- struct buffer_head * bh, * unbh = 0;
+ struct buffer_head * bh, * unbh = NULL;
struct item_head * ih, tmp_ih;
__u32 * item;
int done;
@@ -1394,7 +1394,7 @@ struct inode * reiserfs_iget (struct super_block * s, const struct cpu_key * key
if (comp_short_keys (INODE_PKEY (inode), key) || is_bad_inode (inode)) {
/* either due to i/o error or a stale NFS handle */
iput (inode);
- inode = 0;
+ inode = NULL;
}
return inode;
}
@@ -1558,13 +1558,13 @@ static int reiserfs_new_directory (struct reiserfs_transaction_handle *th,
old type (ITEM_VERSION_1). Do not set key (second arg is 0), it
is done by reiserfs_new_inode */
if (old_format_only (sb)) {
- make_le_item_head (ih, 0, KEY_FORMAT_3_5, DOT_OFFSET, TYPE_DIRENTRY, EMPTY_DIR_SIZE_V1, 2);
+ make_le_item_head (ih, NULL, KEY_FORMAT_3_5, DOT_OFFSET, TYPE_DIRENTRY, EMPTY_DIR_SIZE_V1, 2);
make_empty_dir_item_v1 (body, ih->ih_key.k_dir_id, ih->ih_key.k_objectid,
INODE_PKEY (dir)->k_dir_id,
INODE_PKEY (dir)->k_objectid );
} else {
- make_le_item_head (ih, 0, KEY_FORMAT_3_5, DOT_OFFSET, TYPE_DIRENTRY, EMPTY_DIR_SIZE, 2);
+ make_le_item_head (ih, NULL, KEY_FORMAT_3_5, DOT_OFFSET, TYPE_DIRENTRY, EMPTY_DIR_SIZE, 2);
make_empty_dir_item (body, ih->ih_key.k_dir_id, ih->ih_key.k_objectid,
INODE_PKEY (dir)->k_dir_id,
@@ -1606,7 +1606,7 @@ static int reiserfs_new_symlink (struct reiserfs_transaction_handle *th,
le32_to_cpu (ih->ih_key.k_objectid),
1, TYPE_DIRECT, 3/*key length*/);
- make_le_item_head (ih, 0, KEY_FORMAT_3_5, 1, TYPE_DIRECT, item_len, 0/*free_space*/);
+ make_le_item_head (ih, NULL, KEY_FORMAT_3_5, 1, TYPE_DIRECT, item_len, 0/*free_space*/);
/* look for place in the tree for new item */
retval = search_item (sb, &key, path);
@@ -1701,7 +1701,7 @@ int reiserfs_new_inode (struct reiserfs_transaction_handle *th,
REISERFS_I(inode)->i_prealloc_block = 0;
REISERFS_I(inode)->i_prealloc_count = 0;
REISERFS_I(inode)->i_trans_id = 0;
- REISERFS_I(inode)->i_jl = 0;
+ REISERFS_I(inode)->i_jl = NULL;
REISERFS_I(inode)->i_attrs =
REISERFS_I(dir)->i_attrs & REISERFS_INHERIT_MASK;
sd_attrs_to_i_attrs( REISERFS_I(inode) -> i_attrs, inode );
@@ -1710,9 +1710,9 @@ int reiserfs_new_inode (struct reiserfs_transaction_handle *th,
init_rwsem (&REISERFS_I(inode)->xattr_sem);
if (old_format_only (sb))
- make_le_item_head (&ih, 0, KEY_FORMAT_3_5, SD_OFFSET, TYPE_STAT_DATA, SD_V1_SIZE, MAX_US_INT);
+ make_le_item_head (&ih, NULL, KEY_FORMAT_3_5, SD_OFFSET, TYPE_STAT_DATA, SD_V1_SIZE, MAX_US_INT);
else
- make_le_item_head (&ih, 0, KEY_FORMAT_3_6, SD_OFFSET, TYPE_STAT_DATA, SD_SIZE, MAX_US_INT);
+ make_le_item_head (&ih, NULL, KEY_FORMAT_3_6, SD_OFFSET, TYPE_STAT_DATA, SD_SIZE, MAX_US_INT);
/* key to search for correct place for new stat data */
_make_cpu_key (&key, KEY_FORMAT_3_6, le32_to_cpu (ih.ih_key.k_dir_id),
diff --git a/fs/reiserfs/item_ops.c b/fs/reiserfs/item_ops.c
index 7ad205848939..c315edbb2187 100644
--- a/fs/reiserfs/item_ops.c
+++ b/fs/reiserfs/item_ops.c
@@ -549,7 +549,7 @@ static int direntry_create_vi (struct virtual_node * vn,
if (l + IH_SIZE != vi->vi_item_len +
((is_affected && (vn->vn_mode == M_PASTE || vn->vn_mode == M_CUT)) ? insert_size : 0) ) {
- reiserfs_panic (0, "vs-8025: set_entry_sizes: (mode==%c, insert_size==%d), invalid length of directory item",
+ reiserfs_panic (NULL, "vs-8025: set_entry_sizes: (mode==%c, insert_size==%d), invalid length of directory item",
vn->vn_mode, insert_size);
}
}
diff --git a/fs/reiserfs/lbalance.c b/fs/reiserfs/lbalance.c
index b1cef222ab8b..2406608fc5cd 100644
--- a/fs/reiserfs/lbalance.c
+++ b/fs/reiserfs/lbalance.c
@@ -49,7 +49,7 @@ static void leaf_copy_dir_entries (struct buffer_info * dest_bi, struct buffer_h
deh_location( &(deh[from + copy_count - 1]));
} else {
copy_records_len = 0;
- records = 0;
+ records = NULL;
}
/* when copy last to first, dest buffer can contain 0 items */
@@ -145,7 +145,7 @@ static int leaf_copy_boundary_item (struct buffer_info * dest_bi, struct buffer_
else {
if (bytes_or_entries == ih_item_len(ih) && is_indirect_le_ih(ih))
if (get_ih_free_space (ih))
- reiserfs_panic (0, "vs-10020: leaf_copy_boundary_item: "
+ reiserfs_panic (NULL, "vs-10020: leaf_copy_boundary_item: "
"last unformatted node must be filled entirely (%h)",
ih);
}
@@ -552,13 +552,13 @@ static void leaf_define_dest_src_infos (int shift_mode, struct tree_balance * tb
src_bi->bi_position = PATH_H_B_ITEM_ORDER (tb->tb_path, 0);
dest_bi->tb = tb;
dest_bi->bi_bh = Snew;
- dest_bi->bi_parent = 0;
+ dest_bi->bi_parent = NULL;
dest_bi->bi_position = 0;
*first_last = LAST_TO_FIRST;
break;
default:
- reiserfs_panic (0, "vs-10250: leaf_define_dest_src_infos: shift type is unknown (%d)", shift_mode);
+ reiserfs_panic (NULL, "vs-10250: leaf_define_dest_src_infos: shift type is unknown (%d)", shift_mode);
}
RFALSE( src_bi->bi_bh == 0 || dest_bi->bi_bh == 0,
"vs-10260: mode==%d, source (%p) or dest (%p) buffer is initialized incorrectly",
@@ -595,7 +595,7 @@ int leaf_shift_left (struct tree_balance * tb, int shift_num, int shift_bytes)
int i;
/* move shift_num (and shift_bytes bytes) items from S[0] to left neighbor L[0] */
- i = leaf_move_items (LEAF_FROM_S_TO_L, tb, shift_num, shift_bytes, 0);
+ i = leaf_move_items (LEAF_FROM_S_TO_L, tb, shift_num, shift_bytes, NULL);
if ( shift_num ) {
if (B_NR_ITEMS (S0) == 0) { /* number of items in S[0] == 0 */
@@ -648,7 +648,7 @@ int leaf_shift_right(
int ret_value;
/* move shift_num (and shift_bytes) items from S[0] to right neighbor R[0] */
- ret_value = leaf_move_items (LEAF_FROM_S_TO_R, tb, shift_num, shift_bytes, 0);
+ ret_value = leaf_move_items (LEAF_FROM_S_TO_R, tb, shift_num, shift_bytes, NULL);
/* replace rkey in CFR[0] by the 0-th key from R[0] */
if (shift_num) {
@@ -829,7 +829,7 @@ void leaf_paste_in_buffer (struct buffer_info * bi, int affected_item_num,
#ifdef CONFIG_REISERFS_CHECK
if (zeros_number > paste_size) {
print_cur_tb ("10177");
- reiserfs_panic ( 0, "vs-10177: leaf_paste_in_buffer: ero number == %d, paste_size == %d",
+ reiserfs_panic ( NULL, "vs-10177: leaf_paste_in_buffer: ero number == %d, paste_size == %d",
zeros_number, paste_size);
}
#endif /* CONFIG_REISERFS_CHECK */
diff --git a/fs/reiserfs/namei.c b/fs/reiserfs/namei.c
index 48eb7986166f..fb17ab491bd5 100644
--- a/fs/reiserfs/namei.c
+++ b/fs/reiserfs/namei.c
@@ -331,7 +331,7 @@ static struct dentry * reiserfs_lookup (struct inode * dir, struct dentry * dent
return ERR_PTR(-ENAMETOOLONG);
reiserfs_write_lock(dir->i_sb);
- de.de_gen_number_bit_string = 0;
+ de.de_gen_number_bit_string = NULL;
retval = reiserfs_find_entry (dir, dentry->d_name.name, dentry->d_name.len, &path_to_entry, &de);
pathrelse (&path_to_entry);
if (retval == NAME_FOUND) {
@@ -384,7 +384,7 @@ struct dentry *reiserfs_get_parent(struct dentry *child)
if (dir->i_nlink == 0) {
return ERR_PTR(-ENOENT);
}
- de.de_gen_number_bit_string = 0;
+ de.de_gen_number_bit_string = NULL;
reiserfs_write_lock(dir->i_sb);
retval = reiserfs_find_entry (dir, "..", 2, &path_to_entry, &de);
@@ -607,7 +607,7 @@ static int reiserfs_create (struct inode * dir, struct dentry *dentry, int mode,
reiserfs_write_lock_xattrs (dir->i_sb);
journal_begin(&th, dir->i_sb, jbegin_count) ;
- retval = reiserfs_new_inode (&th, dir, mode, 0, 0/*i_size*/, dentry, inode);
+ retval = reiserfs_new_inode (&th, dir, mode, NULL, 0/*i_size*/, dentry, inode);
if (locked)
reiserfs_write_unlock_xattrs (dir->i_sb);
@@ -668,7 +668,7 @@ static int reiserfs_mknod (struct inode * dir, struct dentry *dentry, int mode,
journal_begin(&th, dir->i_sb, jbegin_count) ;
- retval = reiserfs_new_inode (&th, dir, mode, 0, 0/*i_size*/, dentry, inode);
+ retval = reiserfs_new_inode (&th, dir, mode, NULL, 0/*i_size*/, dentry, inode);
if (locked)
reiserfs_write_unlock_xattrs (dir->i_sb);
@@ -737,7 +737,7 @@ static int reiserfs_mkdir (struct inode * dir, struct dentry *dentry, int mode)
*/
INC_DIR_INODE_NLINK(dir)
- retval = reiserfs_new_inode (&th, dir, mode, 0/*symlink*/,
+ retval = reiserfs_new_inode (&th, dir, mode, NULL/*symlink*/,
old_format_only (dir->i_sb) ?
EMPTY_DIR_SIZE_V1 : EMPTY_DIR_SIZE,
dentry, inode);
@@ -805,7 +805,7 @@ static int reiserfs_rmdir (struct inode * dir, struct dentry *dentry)
reiserfs_write_lock(dir->i_sb);
journal_begin(&th, dir->i_sb, jbegin_count) ;
- de.de_gen_number_bit_string = 0;
+ de.de_gen_number_bit_string = NULL;
if ( (retval = reiserfs_find_entry (dir, dentry->d_name.name, dentry->d_name.len, &path, &de)) == NAME_NOT_FOUND) {
retval = -ENOENT;
goto end_rmdir;
@@ -886,7 +886,7 @@ static int reiserfs_unlink (struct inode * dir, struct dentry *dentry)
reiserfs_write_lock(dir->i_sb);
journal_begin(&th, dir->i_sb, jbegin_count) ;
- de.de_gen_number_bit_string = 0;
+ de.de_gen_number_bit_string = NULL;
if ( (retval = reiserfs_find_entry (dir, dentry->d_name.name, dentry->d_name.len, &path, &de)) == NAME_NOT_FOUND) {
retval = -ENOENT;
goto end_unlink;
@@ -1093,13 +1093,13 @@ static int entry_points_to_object (const char * name, int len, struct reiserfs_d
if (inode) {
if (!de_visible (de->de_deh + de->de_entry_num))
- reiserfs_panic (0, "vs-7042: entry_points_to_object: entry must be visible");
+ reiserfs_panic (NULL, "vs-7042: entry_points_to_object: entry must be visible");
return (de->de_objectid == inode->i_ino) ? 1 : 0;
}
/* this must be added hidden entry */
if (de_visible (de->de_deh + de->de_entry_num))
- reiserfs_panic (0, "vs-7043: entry_points_to_object: entry must be visible");
+ reiserfs_panic (NULL, "vs-7043: entry_points_to_object: entry must be visible");
return 1;
}
@@ -1149,7 +1149,7 @@ static int reiserfs_rename (struct inode * old_dir, struct dentry *old_dentry,
// make sure, that oldname still exists and points to an object we
// are going to rename
- old_de.de_gen_number_bit_string = 0;
+ old_de.de_gen_number_bit_string = NULL;
reiserfs_write_lock(old_dir->i_sb);
retval = reiserfs_find_entry (old_dir, old_dentry->d_name.name, old_dentry->d_name.len,
&old_entry_path, &old_de);
@@ -1180,7 +1180,7 @@ static int reiserfs_rename (struct inode * old_dir, struct dentry *old_dentry,
/* directory is renamed, its parent directory will be changed,
** so find ".." entry
*/
- dot_dot_de.de_gen_number_bit_string = 0;
+ dot_dot_de.de_gen_number_bit_string = NULL;
retval = reiserfs_find_entry (old_inode, "..", 2, &dot_dot_entry_path, &dot_dot_de);
pathrelse (&dot_dot_entry_path);
if (retval != NAME_FOUND) {
@@ -1232,7 +1232,7 @@ static int reiserfs_rename (struct inode * old_dir, struct dentry *old_dentry,
reiserfs_prepare_for_journal(old_inode->i_sb, old_de.de_bh, 1) ;
// look for new name by reiserfs_find_entry
- new_de.de_gen_number_bit_string = 0;
+ new_de.de_gen_number_bit_string = NULL;
retval = reiserfs_find_entry (new_dir, new_dentry->d_name.name, new_dentry->d_name.len,
&new_entry_path, &new_de);
// reiserfs_add_entry should not return IO_ERROR, because it is called with essentially same parameters from
diff --git a/fs/reiserfs/prints.c b/fs/reiserfs/prints.c
index 450208848aef..95217062f071 100644
--- a/fs/reiserfs/prints.c
+++ b/fs/reiserfs/prints.c
@@ -631,8 +631,8 @@ void store_print_tb (struct tree_balance * tb)
tbSh = PATH_H_PBUFFER (tb->tb_path, h);
tbFh = PATH_H_PPARENT (tb->tb_path, h);
} else {
- tbSh = 0;
- tbFh = 0;
+ tbSh = NULL;
+ tbFh = NULL;
}
sprintf (print_tb_buf + strlen (print_tb_buf),
"* %d * %3lld(%2d) * %3lld(%2d) * %3lld(%2d) * %5lld * %5lld * %5lld * %5lld * %5lld *\n",
@@ -695,10 +695,10 @@ static void check_leaf_block_head (struct buffer_head * bh)
blkh = B_BLK_HEAD (bh);
nr = blkh_nr_item(blkh);
if ( nr > (bh->b_size - BLKH_SIZE) / IH_SIZE)
- reiserfs_panic (0, "vs-6010: check_leaf_block_head: invalid item number %z", bh);
+ reiserfs_panic (NULL, "vs-6010: check_leaf_block_head: invalid item number %z", bh);
if ( blkh_free_space(blkh) >
bh->b_size - BLKH_SIZE - IH_SIZE * nr )
- reiserfs_panic (0, "vs-6020: check_leaf_block_head: invalid free space %z", bh);
+ reiserfs_panic (NULL, "vs-6020: check_leaf_block_head: invalid free space %z", bh);
}
@@ -708,14 +708,14 @@ static void check_internal_block_head (struct buffer_head * bh)
blkh = B_BLK_HEAD (bh);
if (!(B_LEVEL (bh) > DISK_LEAF_NODE_LEVEL && B_LEVEL (bh) <= MAX_HEIGHT))
- reiserfs_panic (0, "vs-6025: check_internal_block_head: invalid level %z", bh);
+ reiserfs_panic (NULL, "vs-6025: check_internal_block_head: invalid level %z", bh);
if (B_NR_ITEMS (bh) > (bh->b_size - BLKH_SIZE) / IH_SIZE)
- reiserfs_panic (0, "vs-6030: check_internal_block_head: invalid item number %z", bh);
+ reiserfs_panic (NULL, "vs-6030: check_internal_block_head: invalid item number %z", bh);
if (B_FREE_SPACE (bh) !=
bh->b_size - BLKH_SIZE - KEY_SIZE * B_NR_ITEMS (bh) - DC_SIZE * (B_NR_ITEMS (bh) + 1))
- reiserfs_panic (0, "vs-6040: check_internal_block_head: invalid free space %z", bh);
+ reiserfs_panic (NULL, "vs-6040: check_internal_block_head: invalid free space %z", bh);
}
diff --git a/fs/reiserfs/procfs.c b/fs/reiserfs/procfs.c
index b9f5be9d86ab..950998419d3e 100644
--- a/fs/reiserfs/procfs.c
+++ b/fs/reiserfs/procfs.c
@@ -591,7 +591,7 @@ void reiserfs_proc_unregister_global( const char *name )
int reiserfs_proc_info_global_init( void )
{
if( proc_info_root == NULL ) {
- proc_info_root = proc_mkdir( proc_info_root_name, 0 );
+ proc_info_root = proc_mkdir(proc_info_root_name, NULL);
if( proc_info_root ) {
proc_info_root -> owner = THIS_MODULE;
} else {
@@ -608,7 +608,7 @@ int reiserfs_proc_info_global_done( void )
{
if ( proc_info_root != NULL ) {
proc_info_root = NULL;
- remove_proc_entry( proc_info_root_name, 0 );
+ remove_proc_entry(proc_info_root_name, NULL);
}
return 0;
}
diff --git a/fs/reiserfs/stree.c b/fs/reiserfs/stree.c
index 768b36f336ee..497b2f371b0d 100644
--- a/fs/reiserfs/stree.c
+++ b/fs/reiserfs/stree.c
@@ -1306,7 +1306,7 @@ int reiserfs_delete_item (struct reiserfs_transaction_handle *th,
copy_item_head(&s_ih, PATH_PITEM_HEAD(p_s_path));
s_del_balance.insert_size[0] = n_del_size;
- n_ret_value = fix_nodes(M_DELETE, &s_del_balance, NULL, 0);
+ n_ret_value = fix_nodes(M_DELETE, &s_del_balance, NULL, NULL);
if ( n_ret_value != REPEAT_SEARCH )
break;
@@ -1446,14 +1446,14 @@ void reiserfs_delete_solid_item (struct reiserfs_transaction_handle *th,
}
quota_cut_bytes = ih_item_len(PATH_PITEM_HEAD(&path)) ;
- retval = fix_nodes (M_DELETE, &tb, NULL, 0);
+ retval = fix_nodes (M_DELETE, &tb, NULL, NULL);
if (retval == REPEAT_SEARCH) {
PROC_INFO_INC( th -> t_super, delete_solid_item_restarted );
continue;
}
if (retval == CARRY_ON) {
- do_balance (&tb, 0, 0, M_DELETE);
+ do_balance (&tb, NULL, NULL, M_DELETE);
if (inode) { /* Should we count quota for item? (we don't count quotas for save-links) */
#ifdef REISERQUOTA_DEBUG
reiserfs_debug (th->t_super, "reiserquota delete_solid_item(): freeing %u id=%u type=%c", quota_cut_bytes, inode->i_uid, key2type(key));
@@ -1587,7 +1587,7 @@ static void indirect_to_direct_roll_back (struct reiserfs_transaction_handle *th
"vs-5616: appended bytes found");
PATH_LAST_POSITION (path) --;
- removed = reiserfs_delete_item (th, path, &tail_key, inode, 0/*unbh not needed*/);
+ removed = reiserfs_delete_item (th, path, &tail_key, inode, NULL/*unbh not needed*/);
RFALSE( removed <= 0 || removed > tail_len,
"vs-5617: there was tail %d bytes, removed item length %d bytes",
tail_len, removed);
@@ -1677,7 +1677,7 @@ int reiserfs_cut_from_item (struct reiserfs_transaction_handle *th,
s_cut_balance.insert_size[0] = n_cut_size;
- n_ret_value = fix_nodes(c_mode, &s_cut_balance, NULL, 0);
+ n_ret_value = fix_nodes(c_mode, &s_cut_balance, NULL, NULL);
if ( n_ret_value != REPEAT_SEARCH )
break;
@@ -1935,7 +1935,7 @@ static void check_research_for_paste (struct path * path,
if (le_ih_k_offset (found_ih) + op_bytes_number (found_ih, get_last_bh (path)->b_size) !=
cpu_key_k_offset (p_s_key) ||
op_bytes_number (found_ih, get_last_bh (path)->b_size) != pos_in_item (path))
- reiserfs_panic (0, "PAP-5720: check_research_for_paste: "
+ reiserfs_panic (NULL, "PAP-5720: check_research_for_paste: "
"found direct item %h or position (%d) does not match to key %K",
found_ih, pos_in_item (path), p_s_key);
}
@@ -1943,7 +1943,7 @@ static void check_research_for_paste (struct path * path,
if (le_ih_k_offset (found_ih) + op_bytes_number (found_ih, get_last_bh (path)->b_size) != cpu_key_k_offset (p_s_key) ||
I_UNFM_NUM (found_ih) != pos_in_item (path) ||
get_ih_free_space (found_ih) != 0)
- reiserfs_panic (0, "PAP-5730: check_research_for_paste: "
+ reiserfs_panic (NULL, "PAP-5730: check_research_for_paste: "
"found indirect item (%h) or position (%d) does not match to key (%K)",
found_ih, pos_in_item (path), p_s_key);
}
diff --git a/fs/reiserfs/super.c b/fs/reiserfs/super.c
index 3bed8d0e7a31..5ce9d7d51610 100644
--- a/fs/reiserfs/super.c
+++ b/fs/reiserfs/super.c
@@ -734,7 +734,7 @@ static int reiserfs_parse_options (struct super_block * s, char * options, /* st
if (c == 'r') {
char * p;
- p = 0;
+ p = NULL;
/* "resize=NNN" */
*blocks = simple_strtoul (arg, &p, 0);
if (*p != '\0') {
@@ -745,7 +745,7 @@ static int reiserfs_parse_options (struct super_block * s, char * options, /* st
}
if ( c == 'c' ) {
- char *p = 0;
+ char *p = NULL;
unsigned long val = simple_strtoul (arg, &p, 0);
/* commit=NNN (time in seconds) */
if ( *p != '\0' || val >= (unsigned int)-1) {
@@ -755,7 +755,7 @@ static int reiserfs_parse_options (struct super_block * s, char * options, /* st
}
if ( c == 'w' ) {
- char *p=0;
+ char *p=NULL;
int val = simple_strtoul (arg, &p, 0);
if ( *p != '\0') {
diff --git a/fs/reiserfs/tail_conversion.c b/fs/reiserfs/tail_conversion.c
index bbc0e5045b24..0d8a6a6113cc 100644
--- a/fs/reiserfs/tail_conversion.c
+++ b/fs/reiserfs/tail_conversion.c
@@ -223,7 +223,7 @@ int indirect2direct (struct reiserfs_transaction_handle *th,
/* Set direct item header to insert. */
- make_le_item_head (&s_ih, 0, get_inode_item_key_version (p_s_inode), pos1 + 1,
+ make_le_item_head (&s_ih, NULL, get_inode_item_key_version (p_s_inode), pos1 + 1,
TYPE_DIRECT, round_tail_len, 0xffff/*ih_free_space*/);
/* we want a pointer to the first byte of the tail in the page.
diff --git a/fs/sysv/inode.c b/fs/sysv/inode.c
index 960da9b041a4..2be44b7a9f74 100644
--- a/fs/sysv/inode.c
+++ b/fs/sysv/inode.c
@@ -233,12 +233,12 @@ static struct buffer_head * sysv_update_inode(struct inode * inode)
if (!ino || ino > sbi->s_ninodes) {
printk("Bad inode number on dev %s: %d is out of range\n",
inode->i_sb->s_id, ino);
- return 0;
+ return NULL;
}
raw_inode = sysv_raw_inode(sb, ino, &bh);
if (!raw_inode) {
printk("unable to read i-node block\n");
- return 0;
+ return NULL;
}
raw_inode->i_mode = cpu_to_fs16(sbi, inode->i_mode);
diff --git a/include/linux/capi.h b/include/linux/capi.h
index 501ea6d59ae6..fdebaaa9f66e 100644
--- a/include/linux/capi.h
+++ b/include/linux/capi.h
@@ -77,7 +77,7 @@ typedef struct capi_profile {
typedef struct capi_manufacturer_cmd {
unsigned long cmd;
- void *data;
+ void __user *data;
} capi_manufacturer_cmd;
/*
diff --git a/include/linux/dvb/osd.h b/include/linux/dvb/osd.h
index 0d8143960a19..5ccf27457e1b 100644
--- a/include/linux/dvb/osd.h
+++ b/include/linux/dvb/osd.h
@@ -101,7 +101,7 @@ typedef struct osd_cmd_s {
int x1;
int y1;
int color;
- void *data;
+ void __user *data;
} osd_cmd_t;
diff --git a/include/linux/dvb/video.h b/include/linux/dvb/video.h
index 09a4286fb02b..8fb2eb336336 100644
--- a/include/linux/dvb/video.h
+++ b/include/linux/dvb/video.h
@@ -100,7 +100,7 @@ struct video_status {
struct video_still_picture {
- char *iFrame; /* pointer to a single iframe in memory */
+ char __user *iFrame; /* pointer to a single iframe in memory */
int32_t size;
};
diff --git a/include/linux/isdnif.h b/include/linux/isdnif.h
index 823e516b14a2..7a4eacd77cb2 100644
--- a/include/linux/isdnif.h
+++ b/include/linux/isdnif.h
@@ -502,26 +502,18 @@ typedef struct {
* Parameters:
* u_char pointer data
* int length of data
- * int Flag: 0 = Call form Kernel-Space (use memcpy,
- * no schedule allowed)
- * 1 = Data is in User-Space (use memcpy_fromfs,
- * may schedule)
* int driverId
* int local channel-number (0 ...)
*/
- int (*writecmd)(const u_char*, int, int, int, int);
+ int (*writecmd)(const u_char __user *, int, int, int);
/* Read raw Status replies
* u_char pointer data (volatile)
* int length of buffer
- * int Flag: 0 = Call form Kernel-Space (use memcpy,
- * no schedule allowed)
- * 1 = Data is in User-Space (use memcpy_fromfs,
- * may schedule)
* int driverId
* int local channel-number (0 ...)
*/
- int (*readstat)(u_char*, int, int, int, int);
+ int (*readstat)(u_char __user *, int, int, int);
char id[20];
} isdn_if;
diff --git a/include/linux/kernelcapi.h b/include/linux/kernelcapi.h
index 1d4b1b15d0b8..891bb2cf0aa8 100644
--- a/include/linux/kernelcapi.h
+++ b/include/linux/kernelcapi.h
@@ -81,7 +81,7 @@ u16 capi20_get_manufacturer(u32 contr, u8 buf[CAPI_MANUFACTURER_LEN]);
u16 capi20_get_version(u32 contr, struct capi_version *verp);
u16 capi20_get_serial(u32 contr, u8 serial[CAPI_SERIAL_LEN]);
u16 capi20_get_profile(u32 contr, struct capi_profile *profp);
-int capi20_manufacturer(unsigned int cmd, void *data);
+int capi20_manufacturer(unsigned int cmd, void __user *data);
/* temporary hack XXX */
void capi20_set_callback(struct capi20_appl *ap,
diff --git a/include/linux/pkt_sched.h b/include/linux/pkt_sched.h
index a0654045d9d8..d98d8cfcd08d 100644
--- a/include/linux/pkt_sched.h
+++ b/include/linux/pkt_sched.h
@@ -100,34 +100,6 @@ struct tc_prio_qopt
__u8 priomap[TC_PRIO_MAX+1]; /* Map: logical priority -> PRIO band */
};
-/* CSZ section */
-
-struct tc_csz_qopt
-{
- int flows; /* Maximal number of guaranteed flows */
- unsigned char R_log; /* Fixed point position for round number */
- unsigned char delta_log; /* Log of maximal managed time interval */
- __u8 priomap[TC_PRIO_MAX+1]; /* Map: logical priority -> CSZ band */
-};
-
-struct tc_csz_copt
-{
- struct tc_ratespec slice;
- struct tc_ratespec rate;
- struct tc_ratespec peakrate;
- __u32 limit;
- __u32 buffer;
- __u32 mtu;
-};
-
-enum
-{
- TCA_CSZ_UNSPEC,
- TCA_CSZ_PARMS,
- TCA_CSZ_RTAB,
- TCA_CSZ_PTAB,
-};
-
/* TBF section */
struct tc_tbf_qopt
@@ -437,6 +409,6 @@ struct tc_netem_qopt
__u32 loss; /* random packet loss (0=none ~0=100%) */
__u32 gap; /* re-ordering gap (0 for delay all) */
__u32 duplicate; /* random packet dup (0=none ~0=100%) */
- __u32 rate; /* maximum transmit rate (bytes/sec) */
+ __u32 jitter; /* random jitter in latency (us) */
};
#endif
diff --git a/include/linux/reiserfs_fs.h b/include/linux/reiserfs_fs.h
index 813868e0eb62..ad6b8bd97822 100644
--- a/include/linux/reiserfs_fs.h
+++ b/include/linux/reiserfs_fs.h
@@ -81,7 +81,7 @@ void reiserfs_warning (struct super_block *s, const char * fmt, ...);
/** always check a condition and panic if it's false. */
#define RASSERT( cond, format, args... ) \
if( !( cond ) ) \
- reiserfs_panic( 0, "reiserfs[%i]: assertion " #cond " failed at " \
+ reiserfs_panic( NULL, "reiserfs[%i]: assertion " #cond " failed at " \
__FILE__ ":%i:%s: " format "\n", \
in_interrupt() ? -1 : current -> pid, __LINE__ , __FUNCTION__ , ##args )
diff --git a/include/linux/videodev.h b/include/linux/videodev.h
index cfcf6f1cd0e2..0800884ef67c 100644
--- a/include/linux/videodev.h
+++ b/include/linux/videodev.h
@@ -222,7 +222,7 @@ struct video_window
__u32 width,height; /* Its size */
__u32 chromakey;
__u32 flags;
- struct video_clip *clips; /* Set only */
+ struct video_clip __user *clips; /* Set only */
int clipcount;
#define VIDEO_WINDOW_INTERLACE 1
#define VIDEO_WINDOW_CHROMAKEY 16 /* Overlay by chromakey */
diff --git a/include/linux/videodev2.h b/include/linux/videodev2.h
index ab8727d92739..076dd41d5b6e 100644
--- a/include/linux/videodev2.h
+++ b/include/linux/videodev2.h
@@ -433,9 +433,9 @@ struct v4l2_window
struct v4l2_rect w;
enum v4l2_field field;
__u32 chromakey;
- struct v4l2_clip *clips;
+ struct v4l2_clip __user *clips;
__u32 clipcount;
- void *bitmap;
+ void __user *bitmap;
};
diff --git a/include/linux/videotext.h b/include/linux/videotext.h
index 78faf6afea70..ab778ef2544f 100644
--- a/include/linux/videotext.h
+++ b/include/linux/videotext.h
@@ -71,7 +71,7 @@ typedef struct
int pgbuf; /* buffer where page will be stored */
int start; /* start of requested part of page */
int end; /* end of requested part of page */
- void *buffer; /* pointer to beginning of destination buffer */
+ void __user *buffer; /* pointer to beginning of destination buffer */
}
vtx_pagereq_t;
diff --git a/include/linux/xfrm.h b/include/linux/xfrm.h
index 79b5ab2a7b21..2e22a996f623 100644
--- a/include/linux/xfrm.h
+++ b/include/linux/xfrm.h
@@ -135,6 +135,11 @@ enum {
XFRM_MSG_POLEXPIRE,
#define XFRM_MSG_POLEXPIRE XFRM_MSG_POLEXPIRE
+ XFRM_MSG_FLUSHSA,
+#define XFRM_MSG_FLUSHSA XFRM_MSG_FLUSHSA
+ XFRM_MSG_FLUSHPOLICY,
+#define XFRM_MSG_FLUSHPOLICY XFRM_MSG_FLUSHPOLICY
+
XFRM_MSG_MAX
};
@@ -242,6 +247,10 @@ struct xfrm_user_polexpire {
__u8 hard;
};
+struct xfrm_usersa_flush {
+ __u8 proto;
+};
+
#define XFRMGRP_ACQUIRE 1
#define XFRMGRP_EXPIRE 2
diff --git a/include/media/saa7146_vv.h b/include/media/saa7146_vv.h
index 60cd29e52f2d..de5672cdec02 100644
--- a/include/media/saa7146_vv.h
+++ b/include/media/saa7146_vv.h
@@ -184,7 +184,7 @@ struct saa7146_use_ops {
int(*open)(struct saa7146_dev *, struct file *);
void (*release)(struct saa7146_dev *, struct file *);
void (*irq_done)(struct saa7146_dev *, unsigned long status);
- ssize_t (*read)(struct file *, char *, size_t, loff_t *);
+ ssize_t (*read)(struct file *, char __user *, size_t, loff_t *);
};
/* from saa7146_fops.c */
diff --git a/include/media/video-buf.h b/include/media/video-buf.h
index 17b2ae290f13..3c17bdf0b790 100644
--- a/include/media/video-buf.h
+++ b/include/media/video-buf.h
@@ -226,10 +226,10 @@ int videobuf_streamoff(struct file *file, struct videobuf_queue *q);
int videobuf_read_start(struct file *file, struct videobuf_queue *q);
void videobuf_read_stop(struct file *file, struct videobuf_queue *q);
ssize_t videobuf_read_stream(struct file *file, struct videobuf_queue *q,
- char *data, size_t count, loff_t *ppos,
+ char __user *data, size_t count, loff_t *ppos,
int vbihack);
ssize_t videobuf_read_one(struct file *file, struct videobuf_queue *q,
- char *data, size_t count, loff_t *ppos);
+ char __user *data, size_t count, loff_t *ppos);
unsigned int videobuf_poll_stream(struct file *file,
struct videobuf_queue *q,
poll_table *wait);
diff --git a/include/net/bluetooth/l2cap.h b/include/net/bluetooth/l2cap.h
index d420305ff256..bcbf4411bf69 100644
--- a/include/net/bluetooth/l2cap.h
+++ b/include/net/bluetooth/l2cap.h
@@ -176,6 +176,14 @@ struct l2cap_info_rsp {
__u8 data[0];
} __attribute__ ((packed));
+/* info type */
+#define L2CAP_IT_CL_MTU 0x0001
+#define L2CAP_IT_FEAT_MASK 0x0002
+
+/* info result */
+#define L2CAP_IR_SUCCESS 0x0000
+#define L2CAP_IR_NOTSUPP 0x0001
+
/* ----- L2CAP connections ----- */
struct l2cap_chan_list {
struct sock *head;
diff --git a/include/net/dst.h b/include/net/dst.h
index 5cdc6c2b4326..33fd86690d18 100644
--- a/include/net/dst.h
+++ b/include/net/dst.h
@@ -149,7 +149,9 @@ void dst_release(struct dst_entry * dst)
{
if (dst) {
if (atomic_read(&dst->__refcnt) < 1)
- printk(dst_underflow_bug_msg, dst, current_text_addr());
+ printk(dst_underflow_bug_msg,
+ atomic_read(&dst->__refcnt),
+ dst, current_text_addr());
atomic_dec(&dst->__refcnt);
}
}
diff --git a/include/net/pkt_act.h b/include/net/pkt_act.h
index 6baa9614f56c..09b899d87629 100644
--- a/include/net/pkt_act.h
+++ b/include/net/pkt_act.h
@@ -252,7 +252,7 @@ tcf_hash_create(struct tc_st *parm, struct rtattr *est, struct tc_action *a, int
}
spin_lock_init(&p->lock);
- p->stats.lock = &p->lock;
+ p->stats_lock = &p->lock;
p->index = parm->index ? : tcf_hash_new_index();
p->tm.install = jiffies;
p->tm.lastuse = jiffies;
diff --git a/include/net/sock.h b/include/net/sock.h
index 4dcba49115ba..0b94438d5403 100644
--- a/include/net/sock.h
+++ b/include/net/sock.h
@@ -917,25 +917,8 @@ static inline void sock_graft(struct sock *sk, struct socket *parent)
write_unlock_bh(&sk->sk_callback_lock);
}
-static inline int sock_i_uid(struct sock *sk)
-{
- int uid;
-
- read_lock(&sk->sk_callback_lock);
- uid = sk->sk_socket ? SOCK_INODE(sk->sk_socket)->i_uid : 0;
- read_unlock(&sk->sk_callback_lock);
- return uid;
-}
-
-static inline unsigned long sock_i_ino(struct sock *sk)
-{
- unsigned long ino;
-
- read_lock(&sk->sk_callback_lock);
- ino = sk->sk_socket ? SOCK_INODE(sk->sk_socket)->i_ino : 0;
- read_unlock(&sk->sk_callback_lock);
- return ino;
-}
+extern int sock_i_uid(struct sock *sk);
+extern unsigned long sock_i_ino(struct sock *sk);
static inline struct dst_entry *
__sk_dst_get(struct sock *sk)
@@ -1219,7 +1202,7 @@ static inline struct page *sk_stream_alloc_page(struct sock *sk)
/*
* Default write policy as shown to user space via poll/select/SIGIO
*/
-static inline int sock_writeable(struct sock *sk)
+static inline int sock_writeable(const struct sock *sk)
{
return atomic_read(&sk->sk_wmem_alloc) < (sk->sk_sndbuf / 2);
}
@@ -1229,17 +1212,17 @@ static inline int gfp_any(void)
return in_softirq() ? GFP_ATOMIC : GFP_KERNEL;
}
-static inline long sock_rcvtimeo(struct sock *sk, int noblock)
+static inline long sock_rcvtimeo(const struct sock *sk, int noblock)
{
return noblock ? 0 : sk->sk_rcvtimeo;
}
-static inline long sock_sndtimeo(struct sock *sk, int noblock)
+static inline long sock_sndtimeo(const struct sock *sk, int noblock)
{
return noblock ? 0 : sk->sk_sndtimeo;
}
-static inline int sock_rcvlowat(struct sock *sk, int waitall, int len)
+static inline int sock_rcvlowat(const struct sock *sk, int waitall, int len)
{
return (waitall ? len : min_t(int, sk->sk_rcvlowat, len)) ? : 1;
}
diff --git a/include/net/tcp.h b/include/net/tcp.h
index 48a484b57bc3..6c033d3db177 100644
--- a/include/net/tcp.h
+++ b/include/net/tcp.h
@@ -272,20 +272,20 @@ static __inline__ int tw_del_dead_node(struct tcp_tw_bucket *tw)
#define tcptw_sk(__sk) ((struct tcp_tw_bucket *)(__sk))
-static inline const u32 tcp_v4_rcv_saddr(const struct sock *sk)
+static inline u32 tcp_v4_rcv_saddr(const struct sock *sk)
{
return likely(sk->sk_state != TCP_TIME_WAIT) ?
inet_sk(sk)->rcv_saddr : tcptw_sk(sk)->tw_rcv_saddr;
}
#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE)
-static inline const struct in6_addr *__tcp_v6_rcv_saddr(const struct sock *sk)
+static inline struct in6_addr *__tcp_v6_rcv_saddr(const struct sock *sk)
{
return likely(sk->sk_state != TCP_TIME_WAIT) ?
&inet6_sk(sk)->rcv_saddr : &tcptw_sk(sk)->tw_v6_rcv_saddr;
}
-static inline const struct in6_addr *tcp_v6_rcv_saddr(const struct sock *sk)
+static inline struct in6_addr *tcp_v6_rcv_saddr(const struct sock *sk)
{
return sk->sk_family == AF_INET6 ? __tcp_v6_rcv_saddr(sk) : NULL;
}
diff --git a/include/net/xfrm.h b/include/net/xfrm.h
index c36a3aed38c2..6bb10bde3fc2 100644
--- a/include/net/xfrm.h
+++ b/include/net/xfrm.h
@@ -818,6 +818,7 @@ extern void xfrm_replay_advance(struct xfrm_state *x, u32 seq);
extern int xfrm_check_selectors(struct xfrm_state **x, int n, struct flowi *fl);
extern int xfrm_state_check(struct xfrm_state *x, struct sk_buff *skb);
extern int xfrm4_rcv(struct sk_buff *skb);
+extern int xfrm4_output(struct sk_buff **pskb);
extern int xfrm4_tunnel_register(struct xfrm_tunnel *handler);
extern int xfrm4_tunnel_deregister(struct xfrm_tunnel *handler);
extern int xfrm4_tunnel_check_size(struct sk_buff *skb);
diff --git a/net/bluetooth/l2cap.c b/net/bluetooth/l2cap.c
index 298a25fb3d35..cc323a7f0b84 100644
--- a/net/bluetooth/l2cap.c
+++ b/net/bluetooth/l2cap.c
@@ -57,7 +57,7 @@
#define BT_DBG(D...)
#endif
-#define VERSION "2.2"
+#define VERSION "2.3"
static struct proto_ops l2cap_sock_ops;
@@ -718,8 +718,7 @@ fail:
return err;
}
-static int l2cap_sock_sendmsg(struct kiocb *iocb, struct socket *sock,
- struct msghdr *msg, size_t len)
+static int l2cap_sock_sendmsg(struct kiocb *iocb, struct socket *sock, struct msghdr *msg, size_t len)
{
struct sock *sk = sock->sk;
int err = 0;
@@ -1444,7 +1443,7 @@ static inline int l2cap_connect_rsp(struct l2cap_conn *conn, struct l2cap_cmd_hd
struct l2cap_conn_rsp *rsp = (struct l2cap_conn_rsp *) data;
u16 scid, dcid, result, status;
struct sock *sk;
- char req[128];
+ u8 req[128];
scid = __le16_to_cpu(rsp->scid);
dcid = __le16_to_cpu(rsp->dcid);
@@ -1481,7 +1480,7 @@ static inline int l2cap_config_req(struct l2cap_conn *conn, struct l2cap_cmd_hdr
{
struct l2cap_conf_req *req = (struct l2cap_conf_req *) data;
u16 dcid, flags;
- u8 rsp[64];
+ u8 rsp[64];
struct sock *sk;
int result;
@@ -1633,6 +1632,35 @@ static inline int l2cap_disconnect_rsp(struct l2cap_conn *conn, struct l2cap_cmd
return 0;
}
+static inline int l2cap_info_req(struct l2cap_conn *conn, struct l2cap_cmd_hdr *cmd, u8 *data)
+{
+ struct l2cap_info_req *req = (struct l2cap_info_req *) data;
+ struct l2cap_info_rsp rsp;
+ u16 type;
+
+ type = __le16_to_cpu(req->type);
+
+ BT_DBG("type 0x%4.4x", type);
+
+ rsp.type = __cpu_to_le16(type);
+ rsp.result = __cpu_to_le16(L2CAP_IR_NOTSUPP);
+ l2cap_send_rsp(conn, cmd->ident, L2CAP_INFO_RSP, sizeof(rsp), &rsp);
+ return 0;
+}
+
+static inline int l2cap_info_rsp(struct l2cap_conn *conn, struct l2cap_cmd_hdr *cmd, u8 *data)
+{
+ struct l2cap_info_rsp *rsp = (struct l2cap_info_rsp *) data;
+ u16 type, result;
+
+ type = __le16_to_cpu(rsp->type);
+ result = __le16_to_cpu(rsp->result);
+
+ BT_DBG("type 0x%4.4x result 0x%2.2x", type, result);
+
+ return 0;
+}
+
static inline void l2cap_sig_channel(struct l2cap_conn *conn, struct sk_buff *skb)
{
u8 *data = skb->data;
@@ -1657,6 +1685,10 @@ static inline void l2cap_sig_channel(struct l2cap_conn *conn, struct sk_buff *sk
}
switch (cmd.code) {
+ case L2CAP_COMMAND_REJ:
+ /* FIXME: We should process this */
+ break;
+
case L2CAP_CONN_REQ:
err = l2cap_connect_req(conn, &cmd, data);
break;
@@ -1681,17 +1713,19 @@ static inline void l2cap_sig_channel(struct l2cap_conn *conn, struct sk_buff *sk
err = l2cap_disconnect_rsp(conn, &cmd, data);
break;
- case L2CAP_COMMAND_REJ:
- /* FIXME: We should process this */
- break;
-
case L2CAP_ECHO_REQ:
l2cap_send_rsp(conn, cmd.ident, L2CAP_ECHO_RSP, cmd.len, data);
break;
case L2CAP_ECHO_RSP:
+ break;
+
case L2CAP_INFO_REQ:
+ err = l2cap_info_req(conn, &cmd, data);
+ break;
+
case L2CAP_INFO_RSP:
+ err = l2cap_info_rsp(conn, &cmd, data);
break;
default:
@@ -1704,7 +1738,7 @@ static inline void l2cap_sig_channel(struct l2cap_conn *conn, struct sk_buff *sk
struct l2cap_cmd_rej rej;
BT_DBG("error %d", err);
- /* FIXME: Map err to a valid reason. */
+ /* FIXME: Map err to a valid reason */
rej.reason = __cpu_to_le16(0);
l2cap_send_rsp(conn, cmd.ident, L2CAP_COMMAND_REJ, sizeof(rej), &rej);
}
@@ -1737,7 +1771,7 @@ static inline int l2cap_data_channel(struct l2cap_conn *conn, u16 cid, struct sk
/* If socket recv buffers overflows we drop data here
* which is *bad* because L2CAP has to be reliable.
* But we don't have any other choice. L2CAP doesn't
- * provide flow control mechanism */
+ * provide flow control mechanism. */
if (!sock_queue_rcv_skb(sk, skb))
goto done;
@@ -2210,7 +2244,7 @@ EXPORT_SYMBOL(l2cap_load);
module_init(l2cap_init);
module_exit(l2cap_exit);
-MODULE_AUTHOR("Maxim Krasnyansky <maxk@qualcomm.com>");
+MODULE_AUTHOR("Maxim Krasnyansky <maxk@qualcomm.com>, Marcel Holtmann <marcel@holtmann.org>");
MODULE_DESCRIPTION("Bluetooth L2CAP ver " VERSION);
MODULE_VERSION(VERSION);
MODULE_LICENSE("GPL");
diff --git a/net/bridge/br_device.c b/net/bridge/br_device.c
index b7e6adc0bd9b..e91f80f972ff 100644
--- a/net/bridge/br_device.c
+++ b/net/bridge/br_device.c
@@ -89,6 +89,15 @@ static int br_dev_stop(struct net_device *dev)
return 0;
}
+static int br_change_mtu(struct net_device *dev, int new_mtu)
+{
+ if ((new_mtu < 68) || new_mtu > br_min_mtu(dev->priv))
+ return -EINVAL;
+
+ dev->mtu = new_mtu;
+ return 0;
+}
+
static int br_dev_accept_fastpath(struct net_device *dev, struct dst_entry *dst)
{
return -1;
@@ -105,6 +114,7 @@ void br_dev_setup(struct net_device *dev)
dev->hard_start_xmit = br_dev_xmit;
dev->open = br_dev_open;
dev->set_multicast_list = br_dev_set_multicast_list;
+ dev->change_mtu = br_change_mtu;
dev->destructor = free_netdev;
SET_MODULE_OWNER(dev);
dev->stop = br_dev_stop;
diff --git a/net/bridge/br_forward.c b/net/bridge/br_forward.c
index 1589763867d0..fd5fa75a3525 100644
--- a/net/bridge/br_forward.c
+++ b/net/bridge/br_forward.c
@@ -23,6 +23,7 @@ static inline int should_deliver(const struct net_bridge_port *p,
const struct sk_buff *skb)
{
if (skb->dev == p->dev ||
+ skb->len > p->dev->mtu ||
p->state != BR_STATE_FORWARDING)
return 0;
diff --git a/net/bridge/br_if.c b/net/bridge/br_if.c
index 6bb2ed24718f..092d45163644 100644
--- a/net/bridge/br_if.c
+++ b/net/bridge/br_if.c
@@ -295,6 +295,24 @@ int br_del_bridge(const char *name)
return ret;
}
+int br_min_mtu(const struct net_bridge *br)
+{
+ const struct net_bridge_port *p;
+ int mtu = 0;
+
+ ASSERT_RTNL();
+
+ if (list_empty(&br->port_list))
+ mtu = 1500;
+ else {
+ list_for_each_entry(p, &br->port_list, list) {
+ if (!mtu || p->dev->mtu < mtu)
+ mtu = p->dev->mtu;
+ }
+ }
+ return mtu;
+}
+
/* called with RTNL */
int br_add_if(struct net_bridge *br, struct net_device *dev)
{
@@ -328,6 +346,8 @@ int br_add_if(struct net_bridge *br, struct net_device *dev)
if ((br->dev->flags & IFF_UP) && (dev->flags & IFF_UP))
br_stp_enable_port(p);
spin_unlock_bh(&br->lock);
+
+ br->dev->mtu = br_min_mtu(br);
}
return err;
diff --git a/net/bridge/br_notify.c b/net/bridge/br_notify.c
index c59335e3b49b..5c88a71b85e3 100644
--- a/net/bridge/br_notify.c
+++ b/net/bridge/br_notify.c
@@ -47,6 +47,10 @@ static int br_device_event(struct notifier_block *unused, unsigned long event, v
spin_unlock_bh(&br->lock);
break;
+ case NETDEV_CHANGEMTU:
+ br->dev->mtu = br_min_mtu(br);
+ break;
+
case NETDEV_DOWN:
if (br->dev->flags & IFF_UP) {
spin_lock_bh(&br->lock);
diff --git a/net/bridge/br_private.h b/net/bridge/br_private.h
index 7cfb82b76252..1064d4c68c24 100644
--- a/net/bridge/br_private.h
+++ b/net/bridge/br_private.h
@@ -168,6 +168,7 @@ extern int br_add_if(struct net_bridge *br,
struct net_device *dev);
extern int br_del_if(struct net_bridge *br,
struct net_device *dev);
+extern int br_min_mtu(const struct net_bridge *br);
/* br_input.c */
extern int br_handle_frame_finish(struct sk_buff *skb);
diff --git a/net/core/sock.c b/net/core/sock.c
index 64937e857ddc..420fc7c54f2e 100644
--- a/net/core/sock.c
+++ b/net/core/sock.c
@@ -711,6 +711,27 @@ void sock_rfree(struct sk_buff *skb)
atomic_sub(skb->truesize, &sk->sk_rmem_alloc);
}
+
+int sock_i_uid(struct sock *sk)
+{
+ int uid;
+
+ read_lock(&sk->sk_callback_lock);
+ uid = sk->sk_socket ? SOCK_INODE(sk->sk_socket)->i_uid : 0;
+ read_unlock(&sk->sk_callback_lock);
+ return uid;
+}
+
+unsigned long sock_i_ino(struct sock *sk)
+{
+ unsigned long ino;
+
+ read_lock(&sk->sk_callback_lock);
+ ino = sk->sk_socket ? SOCK_INODE(sk->sk_socket)->i_ino : 0;
+ read_unlock(&sk->sk_callback_lock);
+ return ino;
+}
+
/*
* Allocate a skb from the socket's send buffer.
*/
@@ -1379,6 +1400,8 @@ EXPORT_SYMBOL(sock_rmalloc);
EXPORT_SYMBOL(sock_setsockopt);
EXPORT_SYMBOL(sock_wfree);
EXPORT_SYMBOL(sock_wmalloc);
+EXPORT_SYMBOL(sock_i_uid);
+EXPORT_SYMBOL(sock_i_ino);
#ifdef CONFIG_SYSCTL
EXPORT_SYMBOL(sysctl_optmem_max);
EXPORT_SYMBOL(sysctl_rmem_max);
diff --git a/net/ipv4/Kconfig b/net/ipv4/Kconfig
index 0bb1b88081de..de00c668c98c 100644
--- a/net/ipv4/Kconfig
+++ b/net/ipv4/Kconfig
@@ -196,8 +196,7 @@ config NET_IPIP
can be useful if you want to make your (or some other) machine
appear on a different network than it physically is, or to use
mobile-IP facilities (allowing laptops to seamlessly move between
- networks without changing their IP addresses; check out
- <http://anchor.cs.binghamton.edu/~mobileip/LJ/index.html>).
+ networks without changing their IP addresses).
Saying Y to this option will produce two modules ( = code which can
be inserted in and removed from the running kernel whenever you
diff --git a/net/ipv4/Makefile b/net/ipv4/Makefile
index 5412b1caa989..8289a1d95e91 100644
--- a/net/ipv4/Makefile
+++ b/net/ipv4/Makefile
@@ -23,4 +23,5 @@ obj-$(CONFIG_IP_PNP) += ipconfig.o
obj-$(CONFIG_NETFILTER) += netfilter/
obj-$(CONFIG_IP_VS) += ipvs/
-obj-$(CONFIG_XFRM) += xfrm4_policy.o xfrm4_state.o xfrm4_input.o xfrm4_tunnel.o
+obj-$(CONFIG_XFRM) += xfrm4_policy.o xfrm4_state.o xfrm4_input.o \
+ xfrm4_tunnel.o xfrm4_output.o
diff --git a/net/ipv4/ah4.c b/net/ipv4/ah4.c
index 9bf3a5975181..8c16b71c3932 100644
--- a/net/ipv4/ah4.c
+++ b/net/ipv4/ah4.c
@@ -67,52 +67,24 @@ static int ah_output(struct sk_buff **pskb)
char buf[60];
} tmp_iph;
- if ((*pskb)->ip_summed == CHECKSUM_HW) {
- err = skb_checksum_help(pskb, 0);
- if (err)
- goto error_nolock;
- }
+ top_iph = (*pskb)->nh.iph;
+ iph = &tmp_iph.iph;
- spin_lock_bh(&x->lock);
- err = xfrm_state_check(x, *pskb);
- if (err)
- goto error;
+ iph->tos = top_iph->tos;
+ iph->ttl = top_iph->ttl;
+ iph->frag_off = top_iph->frag_off;
+ iph->daddr = top_iph->daddr;
- iph = (*pskb)->nh.iph;
- if (x->props.mode) {
- err = xfrm4_tunnel_check_size(*pskb);
+ if (top_iph->ihl != 5) {
+ memcpy(iph+1, top_iph+1, top_iph->ihl*4 - sizeof(struct iphdr));
+ err = ip_clear_mutable_options(top_iph, &top_iph->daddr);
if (err)
goto error;
- top_iph = (struct iphdr*)skb_push(*pskb, x->props.header_len);
- top_iph->ihl = 5;
- top_iph->version = 4;
- top_iph->tos = iph->tos;
- if (x->props.flags & XFRM_STATE_NOECN)
- IP_ECN_clear(top_iph);
- top_iph->frag_off = iph->frag_off & ~htons(IP_MF|IP_OFFSET);
- if (!(iph->frag_off&htons(IP_DF)))
- __ip_select_ident(top_iph, dst, 0);
- top_iph->ttl = iph->ttl;
- top_iph->saddr = x->props.saddr.a4;
- top_iph->daddr = x->id.daddr.a4;
- memcpy(&tmp_iph, top_iph, 20);
- memset(&(IPCB(*pskb)->opt), 0, sizeof(struct ip_options));
- ah = (struct ip_auth_hdr*)(top_iph+1);
- ah->nexthdr = IPPROTO_IPIP;
- } else {
- memcpy(&tmp_iph, (*pskb)->data, iph->ihl*4);
- top_iph = (struct iphdr*)skb_push(*pskb, x->props.header_len);
- memcpy(top_iph, &tmp_iph, iph->ihl*4);
- if (top_iph->ihl != 5) {
- err = ip_clear_mutable_options(top_iph, &top_iph->daddr);
- if (err)
- goto error;
- }
- ah = (struct ip_auth_hdr*)((char*)top_iph+iph->ihl*4);
- ah->nexthdr = iph->protocol;
}
- iph = &tmp_iph.iph;
+ ah = (struct ip_auth_hdr *)((char *)top_iph+top_iph->ihl*4);
+ ah->nexthdr = top_iph->protocol;
+
top_iph->tos = 0;
top_iph->tot_len = htons((*pskb)->len);
top_iph->frag_off = 0;
@@ -128,31 +100,19 @@ static int ah_output(struct sk_buff **pskb)
ah->spi = x->id.spi;
ah->seq_no = htonl(++x->replay.oseq);
ahp->icv(ahp, *pskb, ah->auth_data);
+
top_iph->tos = iph->tos;
top_iph->ttl = iph->ttl;
top_iph->frag_off = iph->frag_off;
- if (!x->props.mode) {
- top_iph->daddr = iph->daddr;
- if (iph->ihl != 5)
- memcpy(top_iph+1, iph+1, iph->ihl*4 - sizeof(struct iphdr));
- }
- ip_send_check(top_iph);
+ top_iph->daddr = iph->daddr;
+ if (top_iph->ihl != 5)
+ memcpy(top_iph+1, iph+1, top_iph->ihl*4 - sizeof(struct iphdr));
- (*pskb)->nh.raw = (*pskb)->data;
+ ip_send_check(top_iph);
- x->curlft.bytes += (*pskb)->len;
- x->curlft.packets++;
- spin_unlock_bh(&x->lock);
- if (((*pskb)->dst = dst_pop(dst)) == NULL) {
- err = -EHOSTUNREACH;
- goto error_nolock;
- }
- return NET_XMIT_BYPASS;
+ err = 0;
error:
- spin_unlock_bh(&x->lock);
-error_nolock:
- kfree_skb(*pskb);
return err;
}
diff --git a/net/ipv4/esp4.c b/net/ipv4/esp4.c
index e6173aff1312..5dd38d2d4837 100644
--- a/net/ipv4/esp4.c
+++ b/net/ipv4/esp4.c
@@ -23,7 +23,7 @@ int esp_output(struct sk_buff **pskb)
int err;
struct dst_entry *dst = (*pskb)->dst;
struct xfrm_state *x = dst->xfrm;
- struct iphdr *iph, *top_iph;
+ struct iphdr *top_iph;
struct ip_esp_hdr *esph;
struct crypto_tfm *tfm;
struct esp_data *esp;
@@ -32,32 +32,9 @@ int esp_output(struct sk_buff **pskb)
int clen;
int alen;
int nfrags;
- union {
- struct iphdr iph;
- char buf[60];
- } tmp_iph;
-
- if ((*pskb)->ip_summed == CHECKSUM_HW) {
- err = skb_checksum_help(pskb, 0);
- if (err)
- goto error_nolock;
- }
-
- spin_lock_bh(&x->lock);
- err = xfrm_state_check(x, *pskb);
- if (err)
- goto error;
- if (x->props.mode) {
- err = xfrm4_tunnel_check_size(*pskb);
- if (err)
- goto error;
- } else {
- /* Strip IP header in transport mode. Save it. */
- iph = (*pskb)->nh.iph;
- memcpy(&tmp_iph, iph, iph->ihl*4);
- __skb_pull(*pskb, iph->ihl*4);
- }
+ /* Strip IP+ESP header. */
+ __skb_pull(*pskb, (*pskb)->h.raw - (*pskb)->data);
/* Now skb is pure payload to encrypt */
err = -ENOMEM;
@@ -85,35 +62,11 @@ int esp_output(struct sk_buff **pskb)
*(u8*)(trailer->tail + clen-(*pskb)->len - 2) = (clen - (*pskb)->len)-2;
pskb_put(*pskb, trailer, clen - (*pskb)->len);
- iph = (*pskb)->nh.iph;
- if (x->props.mode) {
- top_iph = (struct iphdr*)skb_push(*pskb, x->props.header_len);
- esph = (struct ip_esp_hdr*)(top_iph+1);
- *(u8*)(trailer->tail - 1) = IPPROTO_IPIP;
- top_iph->ihl = 5;
- top_iph->version = 4;
- top_iph->tos = iph->tos; /* DS disclosed */
- if (x->props.flags & XFRM_STATE_NOECN)
- IP_ECN_clear(top_iph);
- top_iph->tot_len = htons((*pskb)->len + alen);
- top_iph->frag_off = iph->frag_off&htons(IP_DF);
- if (!(top_iph->frag_off))
- ip_select_ident(top_iph, dst, NULL);
- top_iph->ttl = iph->ttl; /* TTL disclosed */
- top_iph->check = 0;
- top_iph->saddr = x->props.saddr.a4;
- top_iph->daddr = x->id.daddr.a4;
- memset(&(IPCB(*pskb)->opt), 0, sizeof(struct ip_options));
- } else {
- esph = (struct ip_esp_hdr*)skb_push(*pskb, x->props.header_len);
- top_iph = (struct iphdr*)skb_push(*pskb, iph->ihl*4);
- memcpy(top_iph, &tmp_iph, iph->ihl*4);
- iph = &tmp_iph.iph;
- top_iph->tot_len = htons((*pskb)->len + alen);
- top_iph->check = 0;
- top_iph->frag_off = iph->frag_off;
- *(u8*)(trailer->tail - 1) = iph->protocol;
- }
+ __skb_push(*pskb, (*pskb)->data - (*pskb)->nh.raw);
+ top_iph = (*pskb)->nh.iph;
+ esph = (struct ip_esp_hdr *)((*pskb)->nh.raw + top_iph->ihl*4);
+ top_iph->tot_len = htons((*pskb)->len + alen);
+ *(u8*)(trailer->tail - 1) = top_iph->protocol;
/* this is non-NULL only with UDP Encapsulation */
if (x->encap) {
@@ -124,7 +77,7 @@ int esp_output(struct sk_buff **pskb)
uh = (struct udphdr *)esph;
uh->source = encap->encap_sport;
uh->dest = encap->encap_dport;
- uh->len = htons((*pskb)->len + alen - sizeof(struct iphdr));
+ uh->len = htons((*pskb)->len + alen - top_iph->ihl*4);
uh->check = 0;
switch (encap->encap_type) {
@@ -176,21 +129,9 @@ int esp_output(struct sk_buff **pskb)
ip_send_check(top_iph);
- (*pskb)->nh.raw = (*pskb)->data;
-
- x->curlft.bytes += (*pskb)->len;
- x->curlft.packets++;
- spin_unlock_bh(&x->lock);
- if (((*pskb)->dst = dst_pop(dst)) == NULL) {
- err = -EHOSTUNREACH;
- goto error_nolock;
- }
- return NET_XMIT_BYPASS;
+ err = 0;
error:
- spin_unlock_bh(&x->lock);
-error_nolock:
- kfree_skb(*pskb);
return err;
}
diff --git a/net/ipv4/ip_output.c b/net/ipv4/ip_output.c
index 51b3b465a006..770eeeece875 100644
--- a/net/ipv4/ip_output.c
+++ b/net/ipv4/ip_output.c
@@ -498,10 +498,6 @@ int ip_fragment(struct sk_buff *skb, int (*output)(struct sk_buff*))
skb_headroom(frag) < hlen)
goto slow_path;
- /* Correct socket ownership. */
- if (frag->sk == NULL && skb->sk)
- goto slow_path;
-
/* Partially cloned skb? */
if (skb_shared(frag))
goto slow_path;
@@ -1113,12 +1109,10 @@ int ip_push_pending_frames(struct sock *sk)
tail_skb = &(tmp_skb->next);
skb->len += tmp_skb->len;
skb->data_len += tmp_skb->len;
-#if 0 /* Logically correct, but useless work, ip_fragment() will have to undo */
skb->truesize += tmp_skb->truesize;
__sock_put(tmp_skb->sk);
tmp_skb->destructor = NULL;
tmp_skb->sk = NULL;
-#endif
}
/* Unless user demanded real pmtu discovery (IP_PMTUDISC_DO), we allow
diff --git a/net/ipv4/ipcomp.c b/net/ipv4/ipcomp.c
index 2831d2c00e7e..5604b253bc3e 100644
--- a/net/ipv4/ipcomp.c
+++ b/net/ipv4/ipcomp.c
@@ -121,28 +121,6 @@ out:
return err;
}
-static void ipcomp_tunnel_encap(struct xfrm_state *x, struct sk_buff *skb)
-{
- struct dst_entry *dst = skb->dst;
- struct iphdr *iph, *top_iph;
-
- iph = skb->nh.iph;
- top_iph = (struct iphdr *)skb_push(skb, sizeof(struct iphdr));
- top_iph->ihl = 5;
- top_iph->version = 4;
- top_iph->tos = iph->tos;
- top_iph->tot_len = htons(skb->len);
- if (!(iph->frag_off&htons(IP_DF)))
- __ip_select_ident(top_iph, dst, 0);
- top_iph->ttl = iph->ttl;
- top_iph->check = 0;
- top_iph->saddr = x->props.saddr.a4;
- top_iph->daddr = x->id.daddr.a4;
- top_iph->frag_off = iph->frag_off&~htons(IP_MF|IP_OFFSET);
- memset(&(IPCB(skb)->opt), 0, sizeof(struct ip_options));
- skb->nh.raw = skb->data;
-}
-
static int ipcomp_output(struct sk_buff **pskb)
{
int err;
@@ -153,39 +131,17 @@ static int ipcomp_output(struct sk_buff **pskb)
struct ipcomp_data *ipcd = x->data;
int hdr_len = 0;
- if ((*pskb)->ip_summed == CHECKSUM_HW) {
- err = skb_checksum_help(pskb, 0);
- if (err)
- goto error_nolock;
- }
-
- spin_lock_bh(&x->lock);
- err = xfrm_state_check(x, *pskb);
- if (err)
- goto error;
-
- if (x->props.mode) {
- err = xfrm4_tunnel_check_size(*pskb);
- if (err)
- goto error;
- } else {
- /* Don't bother compressing */
- iph = (*pskb)->nh.iph;
- hdr_len = iph->ihl * 4;
- }
+ iph = (*pskb)->nh.iph;
+ iph->tot_len = htons((*pskb)->len);
+ hdr_len = iph->ihl * 4;
if (((*pskb)->len - hdr_len) < ipcd->threshold) {
+ /* Don't bother compressing */
if (x->props.mode) {
- ipcomp_tunnel_encap(x, *pskb);
- iph = (*pskb)->nh.iph;
- iph->protocol = IPPROTO_IPIP;
ip_send_check(iph);
}
goto out_ok;
}
- if (x->props.mode)
- ipcomp_tunnel_encap(x, *pskb);
-
if ((skb_is_nonlinear(*pskb) || skb_cloned(*pskb)) &&
skb_linearize(*pskb, GFP_ATOMIC) != 0) {
err = -ENOMEM;
@@ -197,7 +153,6 @@ static int ipcomp_output(struct sk_buff **pskb)
if (err == -EMSGSIZE) {
if (x->props.mode) {
iph = (*pskb)->nh.iph;
- iph->protocol = IPPROTO_IPIP;
ip_send_check(iph);
}
goto out_ok;
@@ -207,36 +162,19 @@ static int ipcomp_output(struct sk_buff **pskb)
/* Install ipcomp header, convert into ipcomp datagram. */
iph = (*pskb)->nh.iph;
- if (x->props.mode && (x->props.flags & XFRM_STATE_NOECN))
- IP_ECN_clear(iph);
iph->tot_len = htons((*pskb)->len);
- iph->check = 0;
ipch = (struct ip_comp_hdr *)((char *)iph + iph->ihl * 4);
- ipch->nexthdr = x->props.mode ? IPPROTO_IPIP : iph->protocol;
+ ipch->nexthdr = iph->protocol;
ipch->flags = 0;
ipch->cpi = htons((u16 )ntohl(x->id.spi));
iph->protocol = IPPROTO_COMP;
ip_send_check(iph);
- (*pskb)->nh.raw = (*pskb)->data;
out_ok:
- x->curlft.bytes += (*pskb)->len;
- x->curlft.packets++;
- spin_unlock_bh(&x->lock);
-
- if (((*pskb)->dst = dst_pop(dst)) == NULL) {
- err = -EHOSTUNREACH;
- goto error_nolock;
- }
- err = NET_XMIT_BYPASS;
+ err = 0;
-out_exit:
- return err;
error:
- spin_unlock_bh(&x->lock);
-error_nolock:
- kfree_skb(*pskb);
- goto out_exit;
+ return err;
}
static void ipcomp4_err(struct sk_buff *skb, u32 info)
diff --git a/net/ipv4/ipmr.c b/net/ipv4/ipmr.c
index e3a5793a748a..faede83b4d05 100644
--- a/net/ipv4/ipmr.c
+++ b/net/ipv4/ipmr.c
@@ -109,7 +109,9 @@ static int ip_mr_forward(struct sk_buff *skb, struct mfc_cache *cache, int local
static int ipmr_cache_report(struct sk_buff *pkt, vifi_t vifi, int assert);
static int ipmr_fill_mroute(struct sk_buff *skb, struct mfc_cache *c, struct rtmsg *rtm);
+#ifdef CONFIG_IP_PIMSM_V2
static struct net_protocol pim_protocol;
+#endif
static struct timer_list ipmr_expire_timer;
@@ -1702,7 +1704,7 @@ static struct file_operations ipmr_vif_fops = {
.open = ipmr_vif_open,
.read = seq_read,
.llseek = seq_lseek,
- .release = seq_release,
+ .release = seq_release_private,
};
struct ipmr_mfc_iter {
@@ -1737,6 +1739,9 @@ static struct mfc_cache *ipmr_mfc_seq_idx(struct ipmr_mfc_iter *it, loff_t pos)
static void *ipmr_mfc_seq_start(struct seq_file *seq, loff_t *pos)
{
+ struct ipmr_mfc_iter *it = seq->private;
+ it->cache = NULL;
+ it->ct = 0;
return *pos ? ipmr_mfc_seq_idx(seq->private, *pos - 1)
: SEQ_START_TOKEN;
}
@@ -1846,7 +1851,6 @@ static int ipmr_mfc_open(struct inode *inode, struct file *file)
if (rc)
goto out_kfree;
- memset(s, 0, sizeof(*s));
seq = file->private_data;
seq->private = s;
out:
@@ -1862,7 +1866,7 @@ static struct file_operations ipmr_mfc_fops = {
.open = ipmr_mfc_open,
.read = seq_read,
.llseek = seq_lseek,
- .release = seq_release,
+ .release = seq_release_private,
};
#endif
diff --git a/net/ipv4/netfilter/ipt_LOG.c b/net/ipv4/netfilter/ipt_LOG.c
index 0f1b881da992..b79962e225f7 100644
--- a/net/ipv4/netfilter/ipt_LOG.c
+++ b/net/ipv4/netfilter/ipt_LOG.c
@@ -76,7 +76,7 @@ static void dump_packet(const struct ipt_log_info *info,
printk("FRAG:%u ", ntohs(iph.frag_off) & IP_OFFSET);
if ((info->logflags & IPT_LOG_IPOPT)
- && iph.ihl * 4 != sizeof(struct iphdr)) {
+ && iph.ihl * 4 > sizeof(struct iphdr)) {
unsigned char opt[4 * 15 - sizeof(struct iphdr)];
unsigned int i, optsize;
@@ -143,7 +143,7 @@ static void dump_packet(const struct ipt_log_info *info,
printk("URGP=%u ", ntohs(tcph.urg_ptr));
if ((info->logflags & IPT_LOG_TCPOPT)
- && tcph.doff * 4 != sizeof(struct tcphdr)) {
+ && tcph.doff * 4 > sizeof(struct tcphdr)) {
unsigned char opt[4 * 15 - sizeof(struct tcphdr)];
unsigned int i, optsize;
diff --git a/net/ipv4/netfilter/ipt_ULOG.c b/net/ipv4/netfilter/ipt_ULOG.c
index b041d28e7eac..c352df54aa1f 100644
--- a/net/ipv4/netfilter/ipt_ULOG.c
+++ b/net/ipv4/netfilter/ipt_ULOG.c
@@ -217,6 +217,10 @@ static void ipt_ulog_packet(unsigned int hooknum,
pm = NLMSG_DATA(nlh);
+ /* We might not have a timestamp, get one */
+ if (skb->stamp.tv_sec == 0)
+ do_gettimeofday((struct timeval *)&skb->stamp);
+
/* copy hook, prefix, timestamp, payload, etc. */
pm->data_len = copy_len;
pm->timestamp_sec = skb->stamp.tv_sec;
diff --git a/net/ipv4/route.c b/net/ipv4/route.c
index 46aeef6fa4e1..5d2cf030ea44 100644
--- a/net/ipv4/route.c
+++ b/net/ipv4/route.c
@@ -432,7 +432,7 @@ static struct file_operations rt_cpu_seq_fops = {
.open = rt_cpu_seq_open,
.read = seq_read,
.llseek = seq_lseek,
- .release = seq_release_private,
+ .release = seq_release,
};
#endif /* CONFIG_PROC_FS */
diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c
index 1fbe1edbba7b..98212fab242e 100644
--- a/net/ipv4/tcp_output.c
+++ b/net/ipv4/tcp_output.c
@@ -682,17 +682,32 @@ u32 __tcp_select_window(struct sock *sk)
if (free_space > tp->rcv_ssthresh)
free_space = tp->rcv_ssthresh;
- /* Get the largest window that is a nice multiple of mss.
- * Window clamp already applied above.
- * If our current window offering is within 1 mss of the
- * free space we just keep it. This prevents the divide
- * and multiply from happening most of the time.
- * We also don't do any window rounding when the free space
- * is too small.
+ /* Don't do rounding if we are using window scaling, since the
+ * scaled window will not line up with the MSS boundary anyway.
*/
window = tp->rcv_wnd;
- if (window <= free_space - mss || window > free_space)
- window = (free_space/mss)*mss;
+ if (tp->rcv_wscale) {
+ window = free_space;
+
+ /* Advertise enough space so that it won't get scaled away.
+ * Import case: prevent zero window announcement if
+ * 1<<rcv_wscale > mss.
+ */
+ if (((window >> tp->rcv_wscale) << tp->rcv_wscale) != window)
+ window = (((window >> tp->rcv_wscale) + 1)
+ << tp->rcv_wscale);
+ } else {
+ /* Get the largest window that is a nice multiple of mss.
+ * Window clamp already applied above.
+ * If our current window offering is within 1 mss of the
+ * free space we just keep it. This prevents the divide
+ * and multiply from happening most of the time.
+ * We also don't do any window rounding when the free space
+ * is too small.
+ */
+ if (window <= free_space - mss || window > free_space)
+ window = (free_space/mss)*mss;
+ }
return window;
}
diff --git a/net/ipv4/xfrm4_output.c b/net/ipv4/xfrm4_output.c
new file mode 100644
index 000000000000..f65ec865a9a6
--- /dev/null
+++ b/net/ipv4/xfrm4_output.c
@@ -0,0 +1,120 @@
+/*
+ * xfrm4_output.c - Common IPsec encapsulation code for IPv4.
+ * Copyright (c) 2004 Herbert Xu <herbert@gondor.apana.org.au>
+ *
+ * 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.
+ */
+
+#include <linux/skbuff.h>
+#include <linux/spinlock.h>
+#include <net/inet_ecn.h>
+#include <net/ip.h>
+#include <net/xfrm.h>
+
+/* Add encapsulation header.
+ *
+ * In transport mode, the IP header will be moved forward to make space
+ * for the encapsulation header.
+ *
+ * In tunnel mode, the top IP header will be constructed per RFC 2401.
+ * The following fields in it shall be filled in by x->type->output:
+ * tot_len
+ * check
+ *
+ * On exit, skb->h will be set to the start of the payload to be processed
+ * by x->type->output and skb->nh will be set to the top IP header.
+ */
+static void xfrm4_encap(struct sk_buff *skb)
+{
+ struct dst_entry *dst = skb->dst;
+ struct xfrm_state *x = dst->xfrm;
+ struct iphdr *iph, *top_iph;
+
+ iph = skb->nh.iph;
+ skb->h.ipiph = iph;
+
+ skb->nh.raw = skb_push(skb, x->props.header_len);
+ top_iph = skb->nh.iph;
+
+ if (!x->props.mode) {
+ skb->h.raw += iph->ihl*4;
+ memmove(top_iph, iph, iph->ihl*4);
+ return;
+ }
+
+ top_iph->ihl = 5;
+ top_iph->version = 4;
+
+ /* DS disclosed */
+ top_iph->tos = INET_ECN_encapsulate(iph->tos, iph->tos);
+ if (x->props.flags & XFRM_STATE_NOECN)
+ IP_ECN_clear(top_iph);
+
+ top_iph->frag_off = iph->frag_off & htons(IP_DF);
+ if (!top_iph->frag_off)
+ __ip_select_ident(top_iph, dst, 0);
+
+ /* TTL disclosed */
+ top_iph->ttl = iph->ttl;
+
+ top_iph->saddr = x->props.saddr.a4;
+ top_iph->daddr = x->id.daddr.a4;
+ top_iph->protocol = IPPROTO_IPIP;
+
+ memset(&(IPCB(skb)->opt), 0, sizeof(struct ip_options));
+}
+
+int xfrm4_output(struct sk_buff **pskb)
+{
+ struct sk_buff *skb = *pskb;
+ struct dst_entry *dst = skb->dst;
+ struct xfrm_state *x = dst->xfrm;
+ int err;
+
+ if (skb->ip_summed == CHECKSUM_HW) {
+ err = skb_checksum_help(pskb, 0);
+ skb = *pskb;
+ if (err)
+ goto error_nolock;
+ }
+
+ spin_lock_bh(&x->lock);
+ err = xfrm_state_check(x, skb);
+ if (err)
+ goto error;
+
+ if (x->props.mode) {
+ err = xfrm4_tunnel_check_size(skb);
+ if (err)
+ goto error;
+ }
+
+ xfrm4_encap(skb);
+
+ err = x->type->output(pskb);
+ skb = *pskb;
+ if (err)
+ goto error;
+
+ x->curlft.bytes += skb->len;
+ x->curlft.packets++;
+
+ spin_unlock_bh(&x->lock);
+
+ if (!(skb->dst = dst_pop(dst))) {
+ err = -EHOSTUNREACH;
+ goto error_nolock;
+ }
+ err = NET_XMIT_BYPASS;
+
+out_exit:
+ return err;
+error:
+ spin_unlock_bh(&x->lock);
+error_nolock:
+ kfree_skb(skb);
+ goto out_exit;
+}
diff --git a/net/ipv4/xfrm4_policy.c b/net/ipv4/xfrm4_policy.c
index a05bd39a72c6..3aacce604561 100644
--- a/net/ipv4/xfrm4_policy.c
+++ b/net/ipv4/xfrm4_policy.c
@@ -139,7 +139,7 @@ __xfrm4_bundle_create(struct xfrm_policy *policy, struct xfrm_state **xfrm, int
/* Copy neighbout for reachability confirmation */
dst_prev->neighbour = neigh_clone(rt->u.dst.neighbour);
dst_prev->input = rt->u.dst.input;
- dst_prev->output = dst_prev->xfrm->type->output;
+ dst_prev->output = xfrm4_output;
if (rt->peer)
atomic_inc(&rt->peer->refcnt);
x->u.rt.peer = rt->peer;
diff --git a/net/ipv4/xfrm4_tunnel.c b/net/ipv4/xfrm4_tunnel.c
index 5a7ed8e13d63..0999f9e956bb 100644
--- a/net/ipv4/xfrm4_tunnel.c
+++ b/net/ipv4/xfrm4_tunnel.c
@@ -36,52 +36,13 @@ out:
static int ipip_output(struct sk_buff **pskb)
{
struct sk_buff *skb = *pskb;
- struct dst_entry *dst = skb->dst;
- struct xfrm_state *x = dst->xfrm;
- struct iphdr *iph, *top_iph;
- int tos, err;
-
- if ((err = xfrm4_tunnel_check_size(skb)) != 0)
- goto error_nolock;
-
+ struct iphdr *iph;
+
iph = skb->nh.iph;
+ iph->tot_len = htons(skb->len);
+ ip_send_check(iph);
- spin_lock_bh(&x->lock);
-
- tos = iph->tos;
-
- top_iph = (struct iphdr *) skb_push(skb, x->props.header_len);
- top_iph->ihl = 5;
- top_iph->version = 4;
- top_iph->tos = INET_ECN_encapsulate(tos, iph->tos);
- top_iph->tot_len = htons(skb->len);
- top_iph->frag_off = iph->frag_off & ~htons(IP_MF|IP_OFFSET);
- if (!(iph->frag_off & htons(IP_DF)))
- __ip_select_ident(top_iph, dst, 0);
- top_iph->ttl = iph->ttl;
- top_iph->protocol = IPPROTO_IPIP;
- top_iph->check = 0;
- top_iph->saddr = x->props.saddr.a4;
- top_iph->daddr = x->id.daddr.a4;
- memset(&(IPCB(skb)->opt), 0, sizeof(struct ip_options));
- ip_send_check(top_iph);
-
- skb->nh.raw = skb->data;
- x->curlft.bytes += skb->len;
- x->curlft.packets++;
-
- spin_unlock_bh(&x->lock);
-
- if ((skb->dst = dst_pop(dst)) == NULL) {
- kfree_skb(skb);
- err = -EHOSTUNREACH;
- goto error_nolock;
- }
- return NET_XMIT_BYPASS;
-
-error_nolock:
- kfree_skb(skb);
- return err;
+ return 0;
}
static int ipip_xfrm_rcv(struct xfrm_state *x, struct xfrm_decap_state *decap, struct sk_buff *skb)
diff --git a/net/ipv6/ipcomp6.c b/net/ipv6/ipcomp6.c
index d129078f0b8f..5abb89b9c1d9 100644
--- a/net/ipv6/ipcomp6.c
+++ b/net/ipv6/ipcomp6.c
@@ -123,7 +123,7 @@ static int ipcomp6_output(struct sk_buff **pskb)
int err;
struct dst_entry *dst = (*pskb)->dst;
struct xfrm_state *x = dst->xfrm;
- struct ipv6hdr *tmp_iph = NULL, *iph, *top_iph;
+ struct ipv6hdr *iph, *top_iph;
int hdr_len = 0;
struct ipv6_comp_hdr *ipch;
struct ipcomp_data *ipcd = x->data;
@@ -193,19 +193,11 @@ static int ipcomp6_output(struct sk_buff **pskb)
if ((dlen + sizeof(struct ipv6_comp_hdr)) >= plen) {
goto out_ok;
}
- memcpy(start, scratch, dlen);
- pskb_trim(*pskb, hdr_len+dlen);
+ memcpy(start + sizeof(struct ip_comp_hdr), scratch, dlen);
+ pskb_trim(*pskb, hdr_len + dlen + sizeof(struct ip_comp_hdr));
/* insert ipcomp header and replace datagram */
- tmp_iph = kmalloc(hdr_len, GFP_ATOMIC);
- if (!tmp_iph) {
- err = -ENOMEM;
- goto error;
- }
- memcpy(tmp_iph, (*pskb)->nh.raw, hdr_len);
- top_iph = (struct ipv6hdr*)skb_push(*pskb, sizeof(struct ipv6_comp_hdr));
- memcpy(top_iph, tmp_iph, hdr_len);
- kfree(tmp_iph);
+ top_iph = (*pskb)->nh.ipv6h;
if (x->props.mode && (x->props.flags & XFRM_STATE_NOECN))
IP6_ECN_clear(top_iph);
@@ -358,7 +350,7 @@ static int ipcomp6_init_state(struct xfrm_state *x, void *args)
goto error;
memset(ipcd, 0, sizeof(*ipcd));
- x->props.header_len = sizeof(struct ipv6_comp_hdr);
+ x->props.header_len = 0;
if (x->props.mode)
x->props.header_len += sizeof(struct ipv6hdr);
diff --git a/net/irda/discovery.c b/net/irda/discovery.c
index b549d02b67f0..645c86915d54 100644
--- a/net/irda/discovery.c
+++ b/net/irda/discovery.c
@@ -449,6 +449,6 @@ struct file_operations discovery_seq_fops = {
.open = discovery_seq_open,
.read = seq_read,
.llseek = seq_lseek,
- .release = seq_release_private,
+ .release = seq_release,
};
#endif
diff --git a/net/irda/ircomm/ircomm_core.c b/net/irda/ircomm/ircomm_core.c
index 361e8de97806..010d2b5764c1 100644
--- a/net/irda/ircomm/ircomm_core.c
+++ b/net/irda/ircomm/ircomm_core.c
@@ -62,7 +62,7 @@ static struct file_operations ircomm_proc_fops = {
.open = ircomm_seq_open,
.read = seq_read,
.llseek = seq_lseek,
- .release = seq_release_private,
+ .release = seq_release,
};
#endif /* CONFIG_PROC_FS */
diff --git a/net/irda/iriap.c b/net/irda/iriap.c
index aaa5b59bea88..7810c6da23d6 100644
--- a/net/irda/iriap.c
+++ b/net/irda/iriap.c
@@ -1093,7 +1093,7 @@ struct file_operations irias_seq_fops = {
.open = irias_seq_open,
.read = seq_read,
.llseek = seq_lseek,
- .release = seq_release_private,
+ .release = seq_release,
};
#endif /* PROC_FS */
diff --git a/net/sched/Kconfig b/net/sched/Kconfig
index c4e477502e8e..54817b8ec7f0 100644
--- a/net/sched/Kconfig
+++ b/net/sched/Kconfig
@@ -49,21 +49,6 @@ config NET_SCH_HFSC
To compile this code as a module, choose M here: the
module will be called sch_hfsc.
-config NET_SCH_CSZ
- tristate "CSZ packet scheduler"
- depends on NET_SCHED
- ---help---
- Say Y here if you want to use the Clark-Shenker-Zhang (CSZ) packet
- scheduling algorithm for some of your network devices. At the
- moment, this is the only algorithm that can guarantee service for
- real-time applications (see the top of <file:net/sched/sch_csz.c>
- for details and references about the algorithm).
-
- Note: this scheduler is currently broken.
-
- To compile this code as a module, choose M here: the
- module will be called sch_csz.
-
#tristate ' H-PFQ packet scheduler' CONFIG_NET_SCH_HPFQ
config NET_SCH_ATM
tristate "ATM pseudo-scheduler"
diff --git a/net/sched/Makefile b/net/sched/Makefile
index 895bf4b02a9d..daa437f85113 100644
--- a/net/sched/Makefile
+++ b/net/sched/Makefile
@@ -12,7 +12,6 @@ obj-$(CONFIG_NET_ACT_POLICE) += police.o
obj-$(CONFIG_NET_CLS_POLICE) += police.o
obj-$(CONFIG_NET_SCH_CBQ) += sch_cbq.o
obj-$(CONFIG_NET_SCH_HTB) += sch_htb.o
-obj-$(CONFIG_NET_SCH_CSZ) += sch_csz.o
obj-$(CONFIG_NET_SCH_HPFQ) += sch_hpfq.o
obj-$(CONFIG_NET_SCH_HFSC) += sch_hfsc.o
obj-$(CONFIG_NET_SCH_RED) += sch_red.o
diff --git a/net/sched/sch_csz.c b/net/sched/sch_csz.c
deleted file mode 100644
index d0f8d51fedf8..000000000000
--- a/net/sched/sch_csz.c
+++ /dev/null
@@ -1,1055 +0,0 @@
-/*
- * net/sched/sch_csz.c Clark-Shenker-Zhang scheduler.
- *
- * 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.
- *
- * Authors: Alexey Kuznetsov, <kuznet@ms2.inr.ac.ru>
- *
- */
-
-#include <linux/config.h>
-#include <linux/module.h>
-#include <asm/uaccess.h>
-#include <asm/system.h>
-#include <asm/bitops.h>
-#include <linux/types.h>
-#include <linux/kernel.h>
-#include <linux/jiffies.h>
-#include <linux/string.h>
-#include <linux/mm.h>
-#include <linux/socket.h>
-#include <linux/sockios.h>
-#include <linux/in.h>
-#include <linux/errno.h>
-#include <linux/interrupt.h>
-#include <linux/if_ether.h>
-#include <linux/inet.h>
-#include <linux/netdevice.h>
-#include <linux/etherdevice.h>
-#include <linux/notifier.h>
-#include <net/ip.h>
-#include <net/route.h>
-#include <linux/skbuff.h>
-#include <net/sock.h>
-#include <net/pkt_sched.h>
-
-
-/* Clark-Shenker-Zhang algorithm.
- =======================================
-
- SOURCE.
-
- David D. Clark, Scott Shenker and Lixia Zhang
- "Supporting Real-Time Applications in an Integrated Services Packet
- Network: Architecture and Mechanism".
-
- CBQ presents a flexible universal algorithm for packet scheduling,
- but it has pretty poor delay characteristics.
- Round-robin scheduling and link-sharing goals
- apparently contradict minimization of network delay and jitter.
- Moreover, correct handling of predictive flows seems to be
- impossible in CBQ.
-
- CSZ presents a more precise but less flexible and less efficient
- approach. As I understand it, the main idea is to create
- WFQ flows for each guaranteed service and to allocate
- the rest of bandwidth to dummy flow-0. Flow-0 comprises
- the predictive services and the best effort traffic;
- it is handled by a priority scheduler with the highest
- priority band allocated for predictive services, and the rest ---
- to the best effort packets.
-
- Note that in CSZ flows are NOT limited to their bandwidth. It
- is supposed that the flow passed admission control at the edge
- of the QoS network and it doesn't need further shaping. Any
- attempt to improve the flow or to shape it to a token bucket
- at intermediate hops will introduce undesired delays and raise
- jitter.
-
- At the moment CSZ is the only scheduler that provides
- true guaranteed service. Another schemes (including CBQ)
- do not provide guaranteed delay and randomize jitter.
- There is a proof (Sally Floyd), that delay
- can be estimated by a IntServ compliant formula.
- This result is true formally, but it is wrong in principle.
- It takes into account only round-robin delays,
- ignoring delays introduced by link sharing i.e. overlimiting.
- Note that temporary overlimits are inevitable because
- real links are not ideal, and the real algorithm must take this
- into account.
-
- ALGORITHM.
-
- --- Notations.
-
- $B$ is link bandwidth (bits/sec).
-
- $I$ is set of all flows, including flow $0$.
- Every flow $a \in I$ has associated bandwidth slice $r_a < 1$ and
- $\sum_{a \in I} r_a = 1$.
-
- --- Flow model.
-
- Let $m_a$ is the number of backlogged bits in flow $a$.
- The flow is {\em active}, if $m_a > 0$.
- This number is a discontinuous function of time;
- when a packet $i$ arrives:
- \[
- m_a(t_i+0) - m_a(t_i-0) = L^i,
- \]
- where $L^i$ is the length of the arrived packet.
- The flow queue is drained continuously until $m_a == 0$:
- \[
- {d m_a \over dt} = - { B r_a \over \sum_{b \in A} r_b}.
- \]
- I.e. flow rates are their allocated rates proportionally
- scaled to take all available link bandwidth. Apparently,
- it is not the only possible policy. F.e. CBQ classes
- without borrowing would be modelled by:
- \[
- {d m_a \over dt} = - B r_a .
- \]
- More complicated hierarchical bandwidth allocation
- policies are possible, but unfortunately, the basic
- flow equations have a simple solution only for proportional
- scaling.
-
- --- Departure times.
-
- We calculate the time until the last bit of packet is sent:
- \[
- E_a^i(t) = { m_a(t_i) - \delta_a(t) \over r_a },
- \]
- where $\delta_a(t)$ is number of bits drained since $t_i$.
- We have to evaluate $E_a^i$ for all queued packets,
- then find the packet with minimal $E_a^i$ and send it.
-
- This sounds good, but direct implementation of the algorithm
- is absolutely infeasible. Luckily, if flow rates
- are scaled proportionally, the equations have a simple solution.
-
- The differential equation for $E_a^i$ is
- \[
- {d E_a^i (t) \over dt } = - { d \delta_a(t) \over dt} { 1 \over r_a} =
- { B \over \sum_{b \in A} r_b}
- \]
- with initial condition
- \[
- E_a^i (t_i) = { m_a(t_i) \over r_a } .
- \]
-
- Let's introduce an auxiliary function $R(t)$:
-
- --- Round number.
-
- Consider the following model: we rotate over active flows,
- sending $r_a B$ bits from every flow, so that we send
- $B \sum_{a \in A} r_a$ bits per round, that takes
- $\sum_{a \in A} r_a$ seconds.
-
- Hence, $R(t)$ (round number) is a monotonically increasing
- linear function of time when $A$ is not changed
- \[
- { d R(t) \over dt } = { 1 \over \sum_{a \in A} r_a }
- \]
- and it is continuous when $A$ changes.
-
- The central observation is that the quantity
- $F_a^i = R(t) + E_a^i(t)/B$ does not depend on time at all!
- $R(t)$ does not depend on flow, so that $F_a^i$ can be
- calculated only once on packet arrival, and we need not
- recalculate $E$ numbers and resorting queues.
- The number $F_a^i$ is called finish number of the packet.
- It is just the value of $R(t)$ when the last bit of packet
- is sent out.
-
- Maximal finish number on flow is called finish number of flow
- and minimal one is "start number of flow".
- Apparently, flow is active if and only if $F_a \leq R$.
-
- When a packet of length $L_i$ bit arrives to flow $a$ at time $t_i$,
- we calculate $F_a^i$ as:
-
- If flow was inactive ($F_a < R$):
- $F_a^i = R(t) + {L_i \over B r_a}$
- otherwise
- $F_a^i = F_a + {L_i \over B r_a}$
-
- These equations complete the algorithm specification.
-
- It looks pretty hairy, but there is a simple
- procedure for solving these equations.
- See procedure csz_update(), that is a generalization of
- the algorithm from S. Keshav's thesis Chapter 3
- "Efficient Implementation of Fair Queuing".
-
- NOTES.
-
- * We implement only the simplest variant of CSZ,
- when flow-0 is a explicit 4band priority fifo.
- This is bad, but we need a "peek" operation in addition
- to "dequeue" to implement complete CSZ.
- I do not want to do that, unless it is absolutely
- necessary.
-
- * A primitive support for token bucket filtering
- presents itself too. It directly contradicts CSZ, but
- even though the Internet is on the globe ... :-)
- "the edges of the network" really exist.
-
- BUGS.
-
- * Fixed point arithmetic is overcomplicated, suboptimal and even
- wrong. Check it later. */
-
-
-/* This number is arbitrary */
-
-#define CSZ_GUARANTEED 16
-#define CSZ_FLOWS (CSZ_GUARANTEED+4)
-
-struct csz_head
-{
- struct csz_head *snext;
- struct csz_head *sprev;
- struct csz_head *fnext;
- struct csz_head *fprev;
-};
-
-struct csz_flow
-{
- struct csz_head *snext;
- struct csz_head *sprev;
- struct csz_head *fnext;
- struct csz_head *fprev;
-
-/* Parameters */
- struct tc_ratespec rate;
- struct tc_ratespec slice;
- u32 *L_tab; /* Lookup table for L/(B*r_a) values */
- unsigned long limit; /* Maximal length of queue */
-#ifdef CSZ_PLUS_TBF
- struct tc_ratespec peakrate;
- __u32 buffer; /* Depth of token bucket, normalized
- as L/(B*r_a) */
- __u32 mtu;
-#endif
-
-/* Variables */
-#ifdef CSZ_PLUS_TBF
- unsigned long tokens; /* Tokens number: usecs */
- psched_time_t t_tbf;
- unsigned long R_tbf;
- int throttled;
-#endif
- unsigned peeked;
- unsigned long start; /* Finish number of the first skb */
- unsigned long finish; /* Finish number of the flow */
-
- struct sk_buff_head q; /* FIFO queue */
-};
-
-#define L2R(f,L) ((f)->L_tab[(L)>>(f)->slice.cell_log])
-
-struct csz_sched_data
-{
-/* Parameters */
- unsigned char rate_log; /* fixed point position for rate;
- * really we need not it */
- unsigned char R_log; /* fixed point position for round number */
- unsigned char delta_log; /* 1<<delta_log is maximal timeout in usecs;
- * 21 <-> 2.1sec is MAXIMAL value */
-
-/* Variables */
- struct tcf_proto *filter_list;
- u8 prio2band[TC_PRIO_MAX+1];
-#ifdef CSZ_PLUS_TBF
- struct timer_list wd_timer;
- long wd_expires;
-#endif
- psched_time_t t_c; /* Time check-point */
- unsigned long R_c; /* R-number check-point */
- unsigned long rate; /* Current sum of rates of active flows */
- struct csz_head s; /* Flows sorted by "start" */
- struct csz_head f; /* Flows sorted by "finish" */
-
- struct sk_buff_head other[4];/* Predicted (0) and the best efforts
- classes (1,2,3) */
- struct csz_flow flow[CSZ_GUARANTEED]; /* Array of flows */
-};
-
-/* These routines (csz_insert_finish and csz_insert_start) are
- the most time consuming part of all the algorithm.
-
- We insert to sorted list, so that time
- is linear with respect to number of active flows in the worst case.
- Note that we have not very large number of guaranteed flows,
- so that logarithmic algorithms (heap etc.) are useless,
- they are slower than linear one when length of list <= 32.
-
- Heap would take sence if we used WFQ for best efforts
- flows, but SFQ is better choice in this case.
- */
-
-
-/* Insert flow "this" to the list "b" before
- flow with greater finish number.
- */
-
-#if 0
-/* Scan forward */
-static inline void csz_insert_finish(struct csz_head *b,
- struct csz_flow *this)
-{
- struct csz_head *f = b->fnext;
- unsigned long finish = this->finish;
-
- while (f != b) {
- if (((struct csz_flow*)f)->finish - finish > 0)
- break;
- f = f->fnext;
- }
- this->fnext = f;
- this->fprev = f->fprev;
- this->fnext->fprev = this->fprev->fnext = (struct csz_head*)this;
-}
-#else
-/* Scan backward */
-static inline void csz_insert_finish(struct csz_head *b,
- struct csz_flow *this)
-{
- struct csz_head *f = b->fprev;
- unsigned long finish = this->finish;
-
- while (f != b) {
- if (((struct csz_flow*)f)->finish - finish <= 0)
- break;
- f = f->fprev;
- }
- this->fnext = f->fnext;
- this->fprev = f;
- this->fnext->fprev = this->fprev->fnext = (struct csz_head*)this;
-}
-#endif
-
-/* Insert flow "this" to the list "b" before
- flow with greater start number.
- */
-
-static inline void csz_insert_start(struct csz_head *b,
- struct csz_flow *this)
-{
- struct csz_head *f = b->snext;
- unsigned long start = this->start;
-
- while (f != b) {
- if (((struct csz_flow*)f)->start - start > 0)
- break;
- f = f->snext;
- }
- this->snext = f;
- this->sprev = f->sprev;
- this->snext->sprev = this->sprev->snext = (struct csz_head*)this;
-}
-
-
-/* Calculate and return current round number.
- It is another time consuming part, but
- it is impossible to avoid it.
-
- It costs O(N) that make all the algorithm useful only
- to play with closest to ideal fluid model.
-
- There exist less academic, but more practical modifications,
- which might have even better characteristics (WF2Q+, HPFQ, HFSC)
- */
-
-static unsigned long csz_update(struct Qdisc *sch)
-{
- struct csz_sched_data *q = (struct csz_sched_data*)sch->data;
- struct csz_flow *a;
- unsigned long F;
- unsigned long tmp;
- psched_time_t now;
- unsigned long delay;
- unsigned long R_c;
-
- PSCHED_GET_TIME(now);
- delay = PSCHED_TDIFF(now, q->t_c);
- if (delay>>q->delta_log) {
- /* Delta is too large.
- It is possible if MTU/BW > 1<<q->delta_log
- (i.e. configuration error) or because of hardware
- fault. We have no choice...
- */
- qdisc_reset(sch);
- return 0;
- }
-
- q->t_c = now;
-
- for (;;) {
- a = (struct csz_flow*)q->f.fnext;
-
- /* No more active flows. Reset R and exit. */
- if (a == (struct csz_flow*)&q->f) {
-#ifdef CSZ_DEBUG
- if (q->rate) {
- printk("csz_update: rate!=0 on inactive csz\n");
- q->rate = 0;
- }
-#endif
- q->R_c = 0;
- return 0;
- }
-
- F = a->finish;
-
-#ifdef CSZ_DEBUG
- if (q->rate == 0) {
- printk("csz_update: rate=0 on active csz\n");
- goto do_reset;
- }
-#endif
-
- /*
- * tmp = (t - q->t_c)/q->rate;
- */
-
- tmp = ((delay<<(31-q->delta_log))/q->rate)>>(31-q->delta_log+q->R_log);
-
- tmp += q->R_c;
-
- /* OK, this flow (and all flows with greater
- finish numbers) is still active */
- if (F - tmp > 0)
- break;
-
- /* It is more not active */
-
- a->fprev->fnext = a->fnext;
- a->fnext->fprev = a->fprev;
-
- /*
- * q->t_c += (F - q->R_c)*q->rate
- */
-
- tmp = ((F-q->R_c)*q->rate)<<q->R_log;
- R_c = F;
- q->rate -= a->slice.rate;
-
- if ((long)(delay - tmp) >= 0) {
- delay -= tmp;
- continue;
- }
- delay = 0;
- }
-
- q->R_c = tmp;
- return tmp;
-}
-
-unsigned csz_classify(struct sk_buff *skb, struct csz_sched_data *q)
-{
- return CSZ_GUARANTEED;
-}
-
-static int
-csz_enqueue(struct sk_buff *skb, struct Qdisc* sch)
-{
- struct csz_sched_data *q = (struct csz_sched_data *)sch->data;
- unsigned flow_id = csz_classify(skb, q);
- unsigned long R;
- int prio = 0;
- struct csz_flow *this;
-
- if (flow_id >= CSZ_GUARANTEED) {
- prio = flow_id - CSZ_GUARANTEED;
- flow_id = 0;
- }
-
- this = &q->flow[flow_id];
- if (this->q.qlen >= this->limit || this->L_tab == NULL) {
- sch->stats.drops++;
- kfree_skb(skb);
- return NET_XMIT_DROP;
- }
-
- R = csz_update(sch);
-
- if ((long)(this->finish - R) >= 0) {
- /* It was active */
- this->finish += L2R(this,skb->len);
- } else {
- /* It is inactive; activate it */
- this->finish = R + L2R(this,skb->len);
- q->rate += this->slice.rate;
- csz_insert_finish(&q->f, this);
- }
-
- /* If this flow was empty, remember start number
- and insert it into start queue */
- if (this->q.qlen == 0) {
- this->start = this->finish;
- csz_insert_start(&q->s, this);
- }
- if (flow_id)
- skb_queue_tail(&this->q, skb);
- else
- skb_queue_tail(&q->other[prio], skb);
- sch->q.qlen++;
- sch->stats.bytes += skb->len;
- sch->stats.packets++;
- return 0;
-}
-
-static __inline__ struct sk_buff *
-skb_dequeue_best(struct csz_sched_data * q)
-{
- int i;
- struct sk_buff *skb;
-
- for (i=0; i<4; i++) {
- skb = skb_dequeue(&q->other[i]);
- if (skb) {
- q->flow[0].q.qlen--;
- return skb;
- }
- }
- return NULL;
-}
-
-static __inline__ struct sk_buff *
-skb_peek_best(struct csz_sched_data * q)
-{
- int i;
- struct sk_buff *skb;
-
- for (i=0; i<4; i++) {
- skb = skb_peek(&q->other[i]);
- if (skb)
- return skb;
- }
- return NULL;
-}
-
-#ifdef CSZ_PLUS_TBF
-
-static void csz_watchdog(unsigned long arg)
-{
- struct Qdisc *sch = (struct Qdisc*)arg;
-
- qdisc_wakeup(sch->dev);
-}
-
-static __inline__ void
-csz_move_queue(struct csz_flow *this, long delta)
-{
- this->fprev->fnext = this->fnext;
- this->fnext->fprev = this->fprev;
-
- this->start += delta;
- this->finish += delta;
-
- csz_insert_finish(this);
-}
-
-static __inline__ int csz_enough_tokens(struct csz_sched_data *q,
- struct csz_flow *this,
- struct sk_buff *skb)
-{
- long toks;
- long shift;
- psched_time_t now;
-
- PSCHED_GET_TIME(now);
-
- toks = PSCHED_TDIFF(now, t_tbf) + this->tokens - L2R(q,this,skb->len);
-
- shift = 0;
- if (this->throttled) {
- /* Remember aposteriory delay */
-
- unsigned long R = csz_update(q);
- shift = R - this->R_tbf;
- this->R_tbf = R;
- }
-
- if (toks >= 0) {
- /* Now we have enough tokens to proceed */
-
- this->tokens = toks <= this->depth ? toks : this->depth;
- this->t_tbf = now;
-
- if (!this->throttled)
- return 1;
-
- /* Flow was throttled. Update its start&finish numbers
- with delay calculated aposteriori.
- */
-
- this->throttled = 0;
- if (shift > 0)
- csz_move_queue(this, shift);
- return 1;
- }
-
- if (!this->throttled) {
- /* Flow has just been throttled; remember
- current round number to calculate aposteriori delay
- */
- this->throttled = 1;
- this->R_tbf = csz_update(q);
- }
-
- /* Move all the queue to the time when it will be allowed to send.
- We should translate time to round number, but it is impossible,
- so that we made the most conservative estimate i.e. we suppose
- that only this flow is active and, hence, R = t.
- Really toks <= R <= toks/r_a.
-
- This apriory shift in R will be adjusted later to reflect
- real delay. We cannot avoid it because of:
- - throttled flow continues to be active from the viewpoint
- of CSZ, so that it would acquire the highest priority,
- if you not adjusted start numbers.
- - Eventually, finish number would become less than round
- number and flow were declared inactive.
- */
-
- toks = -toks;
-
- /* Remember, that we should start watchdog */
- if (toks < q->wd_expires)
- q->wd_expires = toks;
-
- toks >>= q->R_log;
- shift += toks;
- if (shift > 0) {
- this->R_tbf += toks;
- csz_move_queue(this, shift);
- }
- csz_insert_start(this);
- return 0;
-}
-#endif
-
-
-static struct sk_buff *
-csz_dequeue(struct Qdisc* sch)
-{
- struct csz_sched_data *q = (struct csz_sched_data *)sch->data;
- struct sk_buff *skb;
- struct csz_flow *this;
-
-#ifdef CSZ_PLUS_TBF
- q->wd_expires = 0;
-#endif
- this = (struct csz_flow*)q->s.snext;
-
- while (this != (struct csz_flow*)&q->s) {
-
- /* First of all: unlink from start list */
- this->sprev->snext = this->snext;
- this->snext->sprev = this->sprev;
-
- if (this != &q->flow[0]) { /* Guaranteed flow */
- skb = __skb_dequeue(&this->q);
- if (skb) {
-#ifdef CSZ_PLUS_TBF
- if (this->depth) {
- if (!csz_enough_tokens(q, this, skb))
- continue;
- }
-#endif
- if (this->q.qlen) {
- struct sk_buff *nskb = skb_peek(&this->q);
- this->start += L2R(this,nskb->len);
- csz_insert_start(&q->s, this);
- }
- sch->q.qlen--;
- return skb;
- }
- } else { /* Predicted or best effort flow */
- skb = skb_dequeue_best(q);
- if (skb) {
- unsigned peeked = this->peeked;
- this->peeked = 0;
-
- if (--this->q.qlen) {
- struct sk_buff *nskb;
- unsigned dequeued = L2R(this,skb->len);
-
- /* We got not the same thing that
- peeked earlier; adjust start number
- */
- if (peeked != dequeued && peeked)
- this->start += dequeued - peeked;
-
- nskb = skb_peek_best(q);
- peeked = L2R(this,nskb->len);
- this->start += peeked;
- this->peeked = peeked;
- csz_insert_start(&q->s, this);
- }
- sch->q.qlen--;
- return skb;
- }
- }
- }
-#ifdef CSZ_PLUS_TBF
- /* We are about to return no skb.
- Schedule watchdog timer, if it occurred because of shaping.
- */
- if (q->wd_expires) {
- unsigned long delay = PSCHED_US2JIFFIE(q->wd_expires);
- if (delay == 0)
- delay = 1;
- mod_timer(&q->wd_timer, jiffies + delay);
- sch->stats.overlimits++;
- }
-#endif
- return NULL;
-}
-
-static void
-csz_reset(struct Qdisc* sch)
-{
- struct csz_sched_data *q = (struct csz_sched_data *)sch->data;
- int i;
-
- for (i=0; i<4; i++)
- skb_queue_purge(&q->other[i]);
-
- for (i=0; i<CSZ_GUARANTEED; i++) {
- struct csz_flow *this = q->flow + i;
- skb_queue_purge(&this->q);
- this->snext = this->sprev =
- this->fnext = this->fprev = (struct csz_head*)this;
- this->start = this->finish = 0;
- }
- q->s.snext = q->s.sprev = &q->s;
- q->f.fnext = q->f.fprev = &q->f;
- q->R_c = 0;
-#ifdef CSZ_PLUS_TBF
- PSCHED_GET_TIME(&q->t_tbf);
- q->tokens = q->depth;
- del_timer(&q->wd_timer);
-#endif
- sch->q.qlen = 0;
-}
-
-static void
-csz_destroy(struct Qdisc* sch)
-{
- struct csz_sched_data *q = (struct csz_sched_data *)sch->data;
- struct tcf_proto *tp;
-
- while ((tp = q->filter_list) != NULL) {
- q->filter_list = tp->next;
- tcf_destroy(tp);
- }
-}
-
-static int csz_init(struct Qdisc *sch, struct rtattr *opt)
-{
- struct csz_sched_data *q = (struct csz_sched_data *)sch->data;
- struct rtattr *tb[TCA_CSZ_PTAB];
- struct tc_csz_qopt *qopt;
- int i;
-
- rtattr_parse(tb, TCA_CSZ_PTAB, RTA_DATA(opt), RTA_PAYLOAD(opt));
- if (tb[TCA_CSZ_PARMS-1] == NULL ||
- RTA_PAYLOAD(tb[TCA_CSZ_PARMS-1]) < sizeof(*qopt))
- return -EINVAL;
- qopt = RTA_DATA(tb[TCA_CSZ_PARMS-1]);
-
- q->R_log = qopt->R_log;
- q->delta_log = qopt->delta_log;
- for (i=0; i<=TC_PRIO_MAX; i++) {
- if (qopt->priomap[i] >= CSZ_FLOWS)
- return -EINVAL;
- q->prio2band[i] = qopt->priomap[i];
- }
-
- for (i=0; i<4; i++)
- skb_queue_head_init(&q->other[i]);
-
- for (i=0; i<CSZ_GUARANTEED; i++) {
- struct csz_flow *this = q->flow + i;
- skb_queue_head_init(&this->q);
- this->snext = this->sprev =
- this->fnext = this->fprev = (struct csz_head*)this;
- this->start = this->finish = 0;
- }
- q->s.snext = q->s.sprev = &q->s;
- q->f.fnext = q->f.fprev = &q->f;
- q->R_c = 0;
-#ifdef CSZ_PLUS_TBF
- init_timer(&q->wd_timer);
- q->wd_timer.data = (unsigned long)sch;
- q->wd_timer.function = csz_watchdog;
-#endif
- return 0;
-}
-
-static int csz_dump(struct Qdisc *sch, struct sk_buff *skb)
-{
- struct csz_sched_data *q = (struct csz_sched_data *)sch->data;
- unsigned char *b = skb->tail;
- struct rtattr *rta;
- struct tc_csz_qopt opt;
-
- rta = (struct rtattr*)b;
- RTA_PUT(skb, TCA_OPTIONS, 0, NULL);
-
- opt.flows = CSZ_FLOWS;
- memcpy(&opt.priomap, q->prio2band, TC_PRIO_MAX+1);
- RTA_PUT(skb, TCA_CSZ_PARMS, sizeof(opt), &opt);
- rta->rta_len = skb->tail - b;
-
- return skb->len;
-
-rtattr_failure:
- skb_trim(skb, b - skb->data);
- return -1;
-}
-
-static int csz_graft(struct Qdisc *sch, unsigned long cl, struct Qdisc *new,
- struct Qdisc **old)
-{
- return -EINVAL;
-}
-
-static struct Qdisc * csz_leaf(struct Qdisc *sch, unsigned long cl)
-{
- return NULL;
-}
-
-
-static unsigned long csz_get(struct Qdisc *sch, u32 classid)
-{
- struct csz_sched_data *q = (struct csz_sched_data *)sch->data;
- unsigned long band = TC_H_MIN(classid) - 1;
-
- if (band >= CSZ_FLOWS)
- return 0;
-
- if (band < CSZ_GUARANTEED && q->flow[band].L_tab == NULL)
- return 0;
-
- return band+1;
-}
-
-static unsigned long csz_bind(struct Qdisc *sch, unsigned long parent, u32 classid)
-{
- return csz_get(sch, classid);
-}
-
-
-static void csz_put(struct Qdisc *sch, unsigned long cl)
-{
- return;
-}
-
-static int csz_change(struct Qdisc *sch, u32 handle, u32 parent, struct rtattr **tca, unsigned long *arg)
-{
- unsigned long cl = *arg;
- struct csz_sched_data *q = (struct csz_sched_data *)sch->data;
- struct rtattr *opt = tca[TCA_OPTIONS-1];
- struct rtattr *tb[TCA_CSZ_PTAB];
- struct tc_csz_copt *copt;
-
- rtattr_parse(tb, TCA_CSZ_PTAB, RTA_DATA(opt), RTA_PAYLOAD(opt));
- if (tb[TCA_CSZ_PARMS-1] == NULL ||
- RTA_PAYLOAD(tb[TCA_CSZ_PARMS-1]) < sizeof(*copt))
- return -EINVAL;
- copt = RTA_DATA(tb[TCA_CSZ_PARMS-1]);
-
- if (tb[TCA_CSZ_RTAB-1] &&
- RTA_PAYLOAD(tb[TCA_CSZ_RTAB-1]) < 1024)
- return -EINVAL;
-
- if (cl) {
- struct csz_flow *a;
- cl--;
- if (cl >= CSZ_FLOWS)
- return -ENOENT;
- if (cl >= CSZ_GUARANTEED || q->flow[cl].L_tab == NULL)
- return -EINVAL;
-
- a = &q->flow[cl];
-
- spin_lock_bh(&sch->dev->queue_lock);
-#if 0
- a->rate_log = copt->rate_log;
-#endif
-#ifdef CSZ_PLUS_TBF
- a->limit = copt->limit;
- a->rate = copt->rate;
- a->buffer = copt->buffer;
- a->mtu = copt->mtu;
-#endif
-
- if (tb[TCA_CSZ_RTAB-1])
- memcpy(a->L_tab, RTA_DATA(tb[TCA_CSZ_RTAB-1]), 1024);
-
- spin_unlock_bh(&sch->dev->queue_lock);
- return 0;
- }
- /* NI */
- return 0;
-}
-
-static int csz_delete(struct Qdisc *sch, unsigned long cl)
-{
- struct csz_sched_data *q = (struct csz_sched_data *)sch->data;
- struct csz_flow *a;
-
- cl--;
-
- if (cl >= CSZ_FLOWS)
- return -ENOENT;
- if (cl >= CSZ_GUARANTEED || q->flow[cl].L_tab == NULL)
- return -EINVAL;
-
- a = &q->flow[cl];
-
- spin_lock_bh(&sch->dev->queue_lock);
- a->fprev->fnext = a->fnext;
- a->fnext->fprev = a->fprev;
- a->sprev->snext = a->snext;
- a->snext->sprev = a->sprev;
- a->start = a->finish = 0;
- kfree(xchg(&q->flow[cl].L_tab, NULL));
- spin_unlock_bh(&sch->dev->queue_lock);
-
- return 0;
-}
-
-static int csz_dump_class(struct Qdisc *sch, unsigned long cl, struct sk_buff *skb, struct tcmsg *tcm)
-{
- struct csz_sched_data *q = (struct csz_sched_data *)sch->data;
- unsigned char *b = skb->tail;
- struct rtattr *rta;
- struct tc_csz_copt opt;
-
- tcm->tcm_handle = sch->handle|cl;
-
- cl--;
-
- if (cl > CSZ_FLOWS)
- goto rtattr_failure;
-
- if (cl < CSZ_GUARANTEED) {
- struct csz_flow *f = &q->flow[cl];
-
- if (f->L_tab == NULL)
- goto rtattr_failure;
-
- rta = (struct rtattr*)b;
- RTA_PUT(skb, TCA_OPTIONS, 0, NULL);
-
- opt.limit = f->limit;
- opt.rate = f->rate;
- opt.slice = f->slice;
- memset(&opt.peakrate, 0, sizeof(opt.peakrate));
-#ifdef CSZ_PLUS_TBF
- opt.buffer = f->buffer;
- opt.mtu = f->mtu;
-#else
- opt.buffer = 0;
- opt.mtu = 0;
-#endif
-
- RTA_PUT(skb, TCA_CSZ_PARMS, sizeof(opt), &opt);
- rta->rta_len = skb->tail - b;
- }
-
- return skb->len;
-
-rtattr_failure:
- skb_trim(skb, b - skb->data);
- return -1;
-}
-
-static void csz_walk(struct Qdisc *sch, struct qdisc_walker *arg)
-{
- struct csz_sched_data *q = (struct csz_sched_data *)sch->data;
- int prio = 0;
-
- if (arg->stop)
- return;
-
- for (prio = 0; prio < CSZ_FLOWS; prio++) {
- if (arg->count < arg->skip) {
- arg->count++;
- continue;
- }
- if (prio < CSZ_GUARANTEED && q->flow[prio].L_tab == NULL) {
- arg->count++;
- continue;
- }
- if (arg->fn(sch, prio+1, arg) < 0) {
- arg->stop = 1;
- break;
- }
- arg->count++;
- }
-}
-
-static struct tcf_proto ** csz_find_tcf(struct Qdisc *sch, unsigned long cl)
-{
- struct csz_sched_data *q = (struct csz_sched_data *)sch->data;
-
- if (cl)
- return NULL;
-
- return &q->filter_list;
-}
-
-struct Qdisc_class_ops csz_class_ops = {
- .graft = csz_graft,
- .leaf = csz_leaf,
- .get = csz_get,
- .put = csz_put,
- .change = csz_change,
- .delete = csz_delete,
- .walk = csz_walk,
- .tcf_chain = csz_find_tcf,
- .bind_tcf = csz_bind,
- .unbind_tcf = csz_put,
- .dump = csz_dump_class,
-};
-
-static struct Qdisc_ops csz_qdisc_ops = {
- .next = NULL,
- .cl_ops = &csz_class_ops,
- .id = "csz",
- .priv_size = sizeof(struct csz_sched_data),
- .enqueue = csz_enqueue,
- .dequeue = csz_dequeue,
- .requeue = NULL,
- .drop = NULL,
- .init = csz_init,
- .reset = csz_reset,
- .destroy = csz_destroy,
- .change = NULL,
- .dump = csz_dump,
- .owner = THIS_MODULE,
-};
-
-static int __init csz_module_init(void)
-{
- return register_qdisc(&csz_qdisc_ops);
-}
-static void __exit csz_module_exit(void)
-{
- unregister_qdisc(&csz_qdisc_ops);
-}
-module_init(csz_module_init)
-module_exit(csz_module_exit)
-MODULE_LICENSE("GPL");
diff --git a/net/sched/sch_netem.c b/net/sched/sch_netem.c
index ee86d4e29052..70a3e8ec8558 100644
--- a/net/sched/sch_netem.c
+++ b/net/sched/sch_netem.c
@@ -29,14 +29,16 @@
*/
struct netem_sched_data {
- struct sk_buff_head qnormal;
- struct sk_buff_head qdelay;
+ struct Qdisc *qdisc;
+ struct sk_buff_head delayed;
struct timer_list timer;
u32 latency;
u32 loss;
+ u32 limit;
u32 counter;
u32 gap;
+ u32 jitter;
};
/* Time stamp put into socket buffer control block */
@@ -44,6 +46,558 @@ struct netem_skb_cb {
psched_time_t time_to_send;
};
+/* This is the distribution table for the normal distribution produced
+ * with NISTnet tools.
+ * The entries represent a scaled inverse of the cumulative distribution
+ * function.
+ */
+#define TABLESIZE 2048
+#define TABLEFACTOR 8192
+
+static const short disttable[TABLESIZE] = {
+ -31473, -26739, -25226, -24269,
+ -23560, -22993, -22518, -22109,
+ -21749, -21426, -21133, -20865,
+ -20618, -20389, -20174, -19972,
+ -19782, -19601, -19430, -19267,
+ -19112, -18962, -18819, -18681,
+ -18549, -18421, -18298, -18178,
+ -18062, -17950, -17841, -17735,
+ -17632, -17532, -17434, -17339,
+ -17245, -17155, -17066, -16979,
+ -16894, -16811, -16729, -16649,
+ -16571, -16494, -16419, -16345,
+ -16272, -16201, -16130, -16061,
+ -15993, -15926, -15861, -15796,
+ -15732, -15669, -15607, -15546,
+ -15486, -15426, -15368, -15310,
+ -15253, -15196, -15140, -15086,
+ -15031, -14977, -14925, -14872,
+ -14821, -14769, -14719, -14669,
+ -14619, -14570, -14522, -14473,
+ -14426, -14379, -14332, -14286,
+ -14241, -14196, -14150, -14106,
+ -14062, -14019, -13976, -13933,
+ -13890, -13848, -13807, -13765,
+ -13724, -13684, -13643, -13604,
+ -13564, -13525, -13486, -13447,
+ -13408, -13370, -13332, -13295,
+ -13258, -13221, -13184, -13147,
+ -13111, -13075, -13040, -13004,
+ -12969, -12934, -12899, -12865,
+ -12830, -12796, -12762, -12729,
+ -12695, -12662, -12629, -12596,
+ -12564, -12531, -12499, -12467,
+ -12435, -12404, -12372, -12341,
+ -12310, -12279, -12248, -12218,
+ -12187, -12157, -12127, -12097,
+ -12067, -12038, -12008, -11979,
+ -11950, -11921, -11892, -11863,
+ -11835, -11806, -11778, -11750,
+ -11722, -11694, -11666, -11639,
+ -11611, -11584, -11557, -11530,
+ -11503, -11476, -11450, -11423,
+ -11396, -11370, -11344, -11318,
+ -11292, -11266, -11240, -11214,
+ -11189, -11164, -11138, -11113,
+ -11088, -11063, -11038, -11013,
+ -10988, -10964, -10939, -10915,
+ -10891, -10866, -10843, -10818,
+ -10794, -10770, -10747, -10723,
+ -10700, -10676, -10652, -10630,
+ -10606, -10583, -10560, -10537,
+ -10514, -10491, -10469, -10446,
+ -10424, -10401, -10378, -10356,
+ -10334, -10312, -10290, -10267,
+ -10246, -10224, -10202, -10180,
+ -10158, -10137, -10115, -10094,
+ -10072, -10051, -10030, -10009,
+ -9988, -9967, -9945, -9925,
+ -9904, -9883, -9862, -9842,
+ -9821, -9800, -9780, -9760,
+ -9739, -9719, -9699, -9678,
+ -9658, -9638, -9618, -9599,
+ -9578, -9559, -9539, -9519,
+ -9499, -9480, -9461, -9441,
+ -9422, -9402, -9383, -9363,
+ -9344, -9325, -9306, -9287,
+ -9268, -9249, -9230, -9211,
+ -9192, -9173, -9155, -9136,
+ -9117, -9098, -9080, -9062,
+ -9043, -9025, -9006, -8988,
+ -8970, -8951, -8933, -8915,
+ -8897, -8879, -8861, -8843,
+ -8825, -8807, -8789, -8772,
+ -8754, -8736, -8718, -8701,
+ -8683, -8665, -8648, -8630,
+ -8613, -8595, -8578, -8561,
+ -8543, -8526, -8509, -8492,
+ -8475, -8458, -8441, -8423,
+ -8407, -8390, -8373, -8356,
+ -8339, -8322, -8305, -8289,
+ -8272, -8255, -8239, -8222,
+ -8206, -8189, -8172, -8156,
+ -8140, -8123, -8107, -8090,
+ -8074, -8058, -8042, -8025,
+ -8009, -7993, -7977, -7961,
+ -7945, -7929, -7913, -7897,
+ -7881, -7865, -7849, -7833,
+ -7817, -7802, -7786, -7770,
+ -7754, -7739, -7723, -7707,
+ -7692, -7676, -7661, -7645,
+ -7630, -7614, -7599, -7583,
+ -7568, -7553, -7537, -7522,
+ -7507, -7492, -7476, -7461,
+ -7446, -7431, -7416, -7401,
+ -7385, -7370, -7356, -7340,
+ -7325, -7311, -7296, -7281,
+ -7266, -7251, -7236, -7221,
+ -7207, -7192, -7177, -7162,
+ -7148, -7133, -7118, -7104,
+ -7089, -7075, -7060, -7046,
+ -7031, -7016, -7002, -6988,
+ -6973, -6959, -6944, -6930,
+ -6916, -6901, -6887, -6873,
+ -6859, -6844, -6830, -6816,
+ -6802, -6788, -6774, -6760,
+ -6746, -6731, -6717, -6704,
+ -6690, -6675, -6661, -6647,
+ -6633, -6620, -6606, -6592,
+ -6578, -6564, -6550, -6537,
+ -6523, -6509, -6495, -6482,
+ -6468, -6454, -6441, -6427,
+ -6413, -6400, -6386, -6373,
+ -6359, -6346, -6332, -6318,
+ -6305, -6291, -6278, -6264,
+ -6251, -6238, -6224, -6211,
+ -6198, -6184, -6171, -6158,
+ -6144, -6131, -6118, -6105,
+ -6091, -6078, -6065, -6052,
+ -6039, -6025, -6012, -5999,
+ -5986, -5973, -5960, -5947,
+ -5934, -5921, -5908, -5895,
+ -5882, -5869, -5856, -5843,
+ -5830, -5817, -5804, -5791,
+ -5779, -5766, -5753, -5740,
+ -5727, -5714, -5702, -5689,
+ -5676, -5663, -5650, -5638,
+ -5625, -5612, -5600, -5587,
+ -5575, -5562, -5549, -5537,
+ -5524, -5512, -5499, -5486,
+ -5474, -5461, -5449, -5436,
+ -5424, -5411, -5399, -5386,
+ -5374, -5362, -5349, -5337,
+ -5324, -5312, -5299, -5287,
+ -5275, -5263, -5250, -5238,
+ -5226, -5213, -5201, -5189,
+ -5177, -5164, -5152, -5140,
+ -5128, -5115, -5103, -5091,
+ -5079, -5067, -5055, -5043,
+ -5030, -5018, -5006, -4994,
+ -4982, -4970, -4958, -4946,
+ -4934, -4922, -4910, -4898,
+ -4886, -4874, -4862, -4850,
+ -4838, -4826, -4814, -4803,
+ -4791, -4778, -4767, -4755,
+ -4743, -4731, -4719, -4708,
+ -4696, -4684, -4672, -4660,
+ -4649, -4637, -4625, -4613,
+ -4601, -4590, -4578, -4566,
+ -4554, -4543, -4531, -4520,
+ -4508, -4496, -4484, -4473,
+ -4461, -4449, -4438, -4427,
+ -4415, -4403, -4392, -4380,
+ -4368, -4357, -4345, -4334,
+ -4322, -4311, -4299, -4288,
+ -4276, -4265, -4253, -4242,
+ -4230, -4219, -4207, -4196,
+ -4184, -4173, -4162, -4150,
+ -4139, -4128, -4116, -4105,
+ -4094, -4082, -4071, -4060,
+ -4048, -4037, -4026, -4014,
+ -4003, -3992, -3980, -3969,
+ -3958, -3946, -3935, -3924,
+ -3913, -3901, -3890, -3879,
+ -3868, -3857, -3845, -3834,
+ -3823, -3812, -3801, -3790,
+ -3779, -3767, -3756, -3745,
+ -3734, -3723, -3712, -3700,
+ -3689, -3678, -3667, -3656,
+ -3645, -3634, -3623, -3612,
+ -3601, -3590, -3579, -3568,
+ -3557, -3545, -3535, -3524,
+ -3513, -3502, -3491, -3480,
+ -3469, -3458, -3447, -3436,
+ -3425, -3414, -3403, -3392,
+ -3381, -3370, -3360, -3348,
+ -3337, -3327, -3316, -3305,
+ -3294, -3283, -3272, -3262,
+ -3251, -3240, -3229, -3218,
+ -3207, -3197, -3185, -3175,
+ -3164, -3153, -3142, -3132,
+ -3121, -3110, -3099, -3088,
+ -3078, -3067, -3056, -3045,
+ -3035, -3024, -3013, -3003,
+ -2992, -2981, -2970, -2960,
+ -2949, -2938, -2928, -2917,
+ -2906, -2895, -2885, -2874,
+ -2864, -2853, -2842, -2832,
+ -2821, -2810, -2800, -2789,
+ -2778, -2768, -2757, -2747,
+ -2736, -2725, -2715, -2704,
+ -2694, -2683, -2673, -2662,
+ -2651, -2641, -2630, -2620,
+ -2609, -2599, -2588, -2578,
+ -2567, -2556, -2546, -2535,
+ -2525, -2515, -2504, -2493,
+ -2483, -2472, -2462, -2451,
+ -2441, -2431, -2420, -2410,
+ -2399, -2389, -2378, -2367,
+ -2357, -2347, -2336, -2326,
+ -2315, -2305, -2295, -2284,
+ -2274, -2263, -2253, -2243,
+ -2232, -2222, -2211, -2201,
+ -2191, -2180, -2170, -2159,
+ -2149, -2139, -2128, -2118,
+ -2107, -2097, -2087, -2076,
+ -2066, -2056, -2046, -2035,
+ -2025, -2014, -2004, -1994,
+ -1983, -1973, -1963, -1953,
+ -1942, -1932, -1921, -1911,
+ -1901, -1891, -1880, -1870,
+ -1860, -1849, -1839, -1829,
+ -1819, -1808, -1798, -1788,
+ -1778, -1767, -1757, -1747,
+ -1736, -1726, -1716, -1706,
+ -1695, -1685, -1675, -1665,
+ -1654, -1644, -1634, -1624,
+ -1613, -1603, -1593, -1583,
+ -1573, -1563, -1552, -1542,
+ -1532, -1522, -1511, -1501,
+ -1491, -1481, -1471, -1461,
+ -1450, -1440, -1430, -1420,
+ -1409, -1400, -1389, -1379,
+ -1369, -1359, -1348, -1339,
+ -1328, -1318, -1308, -1298,
+ -1288, -1278, -1267, -1257,
+ -1247, -1237, -1227, -1217,
+ -1207, -1196, -1186, -1176,
+ -1166, -1156, -1146, -1135,
+ -1126, -1115, -1105, -1095,
+ -1085, -1075, -1065, -1055,
+ -1044, -1034, -1024, -1014,
+ -1004, -994, -984, -974,
+ -964, -954, -944, -933,
+ -923, -913, -903, -893,
+ -883, -873, -863, -853,
+ -843, -833, -822, -812,
+ -802, -792, -782, -772,
+ -762, -752, -742, -732,
+ -722, -712, -702, -691,
+ -682, -671, -662, -651,
+ -641, -631, -621, -611,
+ -601, -591, -581, -571,
+ -561, -551, -541, -531,
+ -521, -511, -501, -491,
+ -480, -471, -460, -451,
+ -440, -430, -420, -410,
+ -400, -390, -380, -370,
+ -360, -350, -340, -330,
+ -320, -310, -300, -290,
+ -280, -270, -260, -250,
+ -240, -230, -220, -210,
+ -199, -190, -179, -170,
+ -159, -150, -139, -129,
+ -119, -109, -99, -89,
+ -79, -69, -59, -49,
+ -39, -29, -19, -9,
+ 1, 11, 21, 31,
+ 41, 51, 61, 71,
+ 81, 91, 101, 111,
+ 121, 131, 141, 152,
+ 161, 172, 181, 192,
+ 202, 212, 222, 232,
+ 242, 252, 262, 272,
+ 282, 292, 302, 312,
+ 322, 332, 342, 352,
+ 362, 372, 382, 392,
+ 402, 412, 422, 433,
+ 442, 453, 462, 473,
+ 483, 493, 503, 513,
+ 523, 533, 543, 553,
+ 563, 573, 583, 593,
+ 603, 613, 623, 633,
+ 643, 653, 664, 673,
+ 684, 694, 704, 714,
+ 724, 734, 744, 754,
+ 764, 774, 784, 794,
+ 804, 815, 825, 835,
+ 845, 855, 865, 875,
+ 885, 895, 905, 915,
+ 925, 936, 946, 956,
+ 966, 976, 986, 996,
+ 1006, 1016, 1026, 1037,
+ 1047, 1057, 1067, 1077,
+ 1087, 1097, 1107, 1117,
+ 1128, 1138, 1148, 1158,
+ 1168, 1178, 1188, 1198,
+ 1209, 1219, 1229, 1239,
+ 1249, 1259, 1269, 1280,
+ 1290, 1300, 1310, 1320,
+ 1330, 1341, 1351, 1361,
+ 1371, 1381, 1391, 1402,
+ 1412, 1422, 1432, 1442,
+ 1452, 1463, 1473, 1483,
+ 1493, 1503, 1513, 1524,
+ 1534, 1544, 1554, 1565,
+ 1575, 1585, 1595, 1606,
+ 1616, 1626, 1636, 1647,
+ 1656, 1667, 1677, 1687,
+ 1697, 1708, 1718, 1729,
+ 1739, 1749, 1759, 1769,
+ 1780, 1790, 1800, 1810,
+ 1821, 1831, 1841, 1851,
+ 1862, 1872, 1883, 1893,
+ 1903, 1913, 1923, 1934,
+ 1944, 1955, 1965, 1975,
+ 1985, 1996, 2006, 2016,
+ 2027, 2037, 2048, 2058,
+ 2068, 2079, 2089, 2099,
+ 2110, 2120, 2130, 2141,
+ 2151, 2161, 2172, 2182,
+ 2193, 2203, 2213, 2224,
+ 2234, 2245, 2255, 2265,
+ 2276, 2286, 2297, 2307,
+ 2318, 2328, 2338, 2349,
+ 2359, 2370, 2380, 2391,
+ 2401, 2412, 2422, 2433,
+ 2443, 2454, 2464, 2475,
+ 2485, 2496, 2506, 2517,
+ 2527, 2537, 2548, 2559,
+ 2569, 2580, 2590, 2601,
+ 2612, 2622, 2632, 2643,
+ 2654, 2664, 2675, 2685,
+ 2696, 2707, 2717, 2728,
+ 2738, 2749, 2759, 2770,
+ 2781, 2791, 2802, 2813,
+ 2823, 2834, 2845, 2855,
+ 2866, 2877, 2887, 2898,
+ 2909, 2919, 2930, 2941,
+ 2951, 2962, 2973, 2984,
+ 2994, 3005, 3015, 3027,
+ 3037, 3048, 3058, 3069,
+ 3080, 3091, 3101, 3113,
+ 3123, 3134, 3145, 3156,
+ 3166, 3177, 3188, 3199,
+ 3210, 3220, 3231, 3242,
+ 3253, 3264, 3275, 3285,
+ 3296, 3307, 3318, 3329,
+ 3340, 3351, 3362, 3373,
+ 3384, 3394, 3405, 3416,
+ 3427, 3438, 3449, 3460,
+ 3471, 3482, 3493, 3504,
+ 3515, 3526, 3537, 3548,
+ 3559, 3570, 3581, 3592,
+ 3603, 3614, 3625, 3636,
+ 3647, 3659, 3670, 3681,
+ 3692, 3703, 3714, 3725,
+ 3736, 3747, 3758, 3770,
+ 3781, 3792, 3803, 3814,
+ 3825, 3837, 3848, 3859,
+ 3870, 3881, 3893, 3904,
+ 3915, 3926, 3937, 3949,
+ 3960, 3971, 3983, 3994,
+ 4005, 4017, 4028, 4039,
+ 4051, 4062, 4073, 4085,
+ 4096, 4107, 4119, 4130,
+ 4141, 4153, 4164, 4175,
+ 4187, 4198, 4210, 4221,
+ 4233, 4244, 4256, 4267,
+ 4279, 4290, 4302, 4313,
+ 4325, 4336, 4348, 4359,
+ 4371, 4382, 4394, 4406,
+ 4417, 4429, 4440, 4452,
+ 4464, 4475, 4487, 4499,
+ 4510, 4522, 4533, 4545,
+ 4557, 4569, 4581, 4592,
+ 4604, 4616, 4627, 4639,
+ 4651, 4663, 4674, 4686,
+ 4698, 4710, 4722, 4734,
+ 4746, 4758, 4769, 4781,
+ 4793, 4805, 4817, 4829,
+ 4841, 4853, 4865, 4877,
+ 4889, 4900, 4913, 4925,
+ 4936, 4949, 4961, 4973,
+ 4985, 4997, 5009, 5021,
+ 5033, 5045, 5057, 5070,
+ 5081, 5094, 5106, 5118,
+ 5130, 5143, 5155, 5167,
+ 5179, 5191, 5204, 5216,
+ 5228, 5240, 5253, 5265,
+ 5278, 5290, 5302, 5315,
+ 5327, 5340, 5352, 5364,
+ 5377, 5389, 5401, 5414,
+ 5426, 5439, 5451, 5464,
+ 5476, 5489, 5502, 5514,
+ 5527, 5539, 5552, 5564,
+ 5577, 5590, 5603, 5615,
+ 5628, 5641, 5653, 5666,
+ 5679, 5691, 5704, 5717,
+ 5730, 5743, 5756, 5768,
+ 5781, 5794, 5807, 5820,
+ 5833, 5846, 5859, 5872,
+ 5885, 5897, 5911, 5924,
+ 5937, 5950, 5963, 5976,
+ 5989, 6002, 6015, 6028,
+ 6042, 6055, 6068, 6081,
+ 6094, 6108, 6121, 6134,
+ 6147, 6160, 6174, 6187,
+ 6201, 6214, 6227, 6241,
+ 6254, 6267, 6281, 6294,
+ 6308, 6321, 6335, 6348,
+ 6362, 6375, 6389, 6403,
+ 6416, 6430, 6443, 6457,
+ 6471, 6485, 6498, 6512,
+ 6526, 6540, 6554, 6567,
+ 6581, 6595, 6609, 6623,
+ 6637, 6651, 6665, 6679,
+ 6692, 6706, 6721, 6735,
+ 6749, 6763, 6777, 6791,
+ 6805, 6819, 6833, 6848,
+ 6862, 6876, 6890, 6905,
+ 6919, 6933, 6948, 6962,
+ 6976, 6991, 7005, 7020,
+ 7034, 7049, 7064, 7078,
+ 7093, 7107, 7122, 7136,
+ 7151, 7166, 7180, 7195,
+ 7210, 7225, 7240, 7254,
+ 7269, 7284, 7299, 7314,
+ 7329, 7344, 7359, 7374,
+ 7389, 7404, 7419, 7434,
+ 7449, 7465, 7480, 7495,
+ 7510, 7526, 7541, 7556,
+ 7571, 7587, 7602, 7618,
+ 7633, 7648, 7664, 7680,
+ 7695, 7711, 7726, 7742,
+ 7758, 7773, 7789, 7805,
+ 7821, 7836, 7852, 7868,
+ 7884, 7900, 7916, 7932,
+ 7948, 7964, 7981, 7997,
+ 8013, 8029, 8045, 8061,
+ 8078, 8094, 8110, 8127,
+ 8143, 8160, 8176, 8193,
+ 8209, 8226, 8242, 8259,
+ 8276, 8292, 8309, 8326,
+ 8343, 8360, 8377, 8394,
+ 8410, 8428, 8444, 8462,
+ 8479, 8496, 8513, 8530,
+ 8548, 8565, 8582, 8600,
+ 8617, 8634, 8652, 8670,
+ 8687, 8704, 8722, 8740,
+ 8758, 8775, 8793, 8811,
+ 8829, 8847, 8865, 8883,
+ 8901, 8919, 8937, 8955,
+ 8974, 8992, 9010, 9029,
+ 9047, 9066, 9084, 9103,
+ 9121, 9140, 9159, 9177,
+ 9196, 9215, 9234, 9253,
+ 9272, 9291, 9310, 9329,
+ 9349, 9368, 9387, 9406,
+ 9426, 9445, 9465, 9484,
+ 9504, 9524, 9544, 9563,
+ 9583, 9603, 9623, 9643,
+ 9663, 9683, 9703, 9723,
+ 9744, 9764, 9785, 9805,
+ 9826, 9846, 9867, 9888,
+ 9909, 9930, 9950, 9971,
+ 9993, 10013, 10035, 10056,
+ 10077, 10099, 10120, 10142,
+ 10163, 10185, 10207, 10229,
+ 10251, 10273, 10294, 10317,
+ 10339, 10361, 10384, 10406,
+ 10428, 10451, 10474, 10496,
+ 10519, 10542, 10565, 10588,
+ 10612, 10635, 10658, 10682,
+ 10705, 10729, 10752, 10776,
+ 10800, 10824, 10848, 10872,
+ 10896, 10921, 10945, 10969,
+ 10994, 11019, 11044, 11069,
+ 11094, 11119, 11144, 11169,
+ 11195, 11221, 11246, 11272,
+ 11298, 11324, 11350, 11376,
+ 11402, 11429, 11456, 11482,
+ 11509, 11536, 11563, 11590,
+ 11618, 11645, 11673, 11701,
+ 11728, 11756, 11785, 11813,
+ 11842, 11870, 11899, 11928,
+ 11957, 11986, 12015, 12045,
+ 12074, 12104, 12134, 12164,
+ 12194, 12225, 12255, 12286,
+ 12317, 12348, 12380, 12411,
+ 12443, 12475, 12507, 12539,
+ 12571, 12604, 12637, 12670,
+ 12703, 12737, 12771, 12804,
+ 12839, 12873, 12907, 12942,
+ 12977, 13013, 13048, 13084,
+ 13120, 13156, 13192, 13229,
+ 13267, 13304, 13341, 13379,
+ 13418, 13456, 13495, 13534,
+ 13573, 13613, 13653, 13693,
+ 13734, 13775, 13817, 13858,
+ 13901, 13943, 13986, 14029,
+ 14073, 14117, 14162, 14206,
+ 14252, 14297, 14343, 14390,
+ 14437, 14485, 14533, 14582,
+ 14631, 14680, 14731, 14782,
+ 14833, 14885, 14937, 14991,
+ 15044, 15099, 15154, 15210,
+ 15266, 15324, 15382, 15441,
+ 15500, 15561, 15622, 15684,
+ 15747, 15811, 15877, 15943,
+ 16010, 16078, 16148, 16218,
+ 16290, 16363, 16437, 16513,
+ 16590, 16669, 16749, 16831,
+ 16915, 17000, 17088, 17177,
+ 17268, 17362, 17458, 17556,
+ 17657, 17761, 17868, 17977,
+ 18090, 18207, 18328, 18452,
+ 18581, 18715, 18854, 18998,
+ 19149, 19307, 19472, 19645,
+ 19828, 20021, 20226, 20444,
+ 20678, 20930, 21204, 21503,
+ 21835, 22206, 22630, 23124,
+ 23721, 24478, 25529, 27316,
+};
+
+/* tabledist - return a pseudo-randomly distributed value with mean mu and
+ * std deviation sigma. Uses table lookup to approximate the desired
+ * distribution, and a uniformly-distributed pseudo-random source.
+ */
+static inline int tabledist(int mu, int sigma)
+{
+ int x;
+ int index;
+ int sigmamod, sigmadiv;
+
+ if (sigma == 0)
+ return mu;
+
+ index = (net_random() & (TABLESIZE-1));
+ sigmamod = sigma%TABLEFACTOR;
+ sigmadiv = sigma/TABLEFACTOR;
+ x = sigmamod*disttable[index];
+
+ if (x >= 0)
+ x += TABLEFACTOR/2;
+ else
+ x -= TABLEFACTOR/2;
+
+ x /= TABLEFACTOR;
+ x += sigmadiv*disttable[index];
+ x += mu;
+ return x;
+}
+
/* Enqueue packets with underlying discipline (fifo)
* but mark them with current time first.
*/
@@ -51,6 +605,8 @@ static int netem_enqueue(struct sk_buff *skb, struct Qdisc *sch)
{
struct netem_sched_data *q = (struct netem_sched_data *)sch->data;
struct netem_skb_cb *cb = (struct netem_skb_cb *)skb->cb;
+ psched_time_t now;
+ long delay;
pr_debug("netem_enqueue skb=%p @%lu\n", skb, jiffies);
@@ -60,101 +616,105 @@ static int netem_enqueue(struct sk_buff *skb, struct Qdisc *sch)
return 0; /* lie about loss so TCP doesn't know */
}
- if (q->qnormal.qlen < sch->dev->tx_queue_len) {
- PSCHED_GET_TIME(cb->time_to_send);
- PSCHED_TADD(cb->time_to_send, q->latency);
- __skb_queue_tail(&q->qnormal, skb);
- sch->q.qlen++;
- sch->stats.bytes += skb->len;
- sch->stats.packets++;
- return 0;
- }
+ /* If doing simple delay then gap == 0 so all packets
+ * go into the delayed holding queue
+ * otherwise if doing out of order only "1 out of gap"
+ * packets will be delayed.
+ */
+ if (q->counter < q->gap) {
+ int ret;
- sch->stats.drops++;
- kfree_skb(skb);
- return NET_XMIT_DROP;
+ ++q->counter;
+ ret = q->qdisc->enqueue(skb, q->qdisc);
+ if (ret)
+ sch->stats.drops++;
+ return ret;
+ }
+
+ q->counter = 0;
+
+ PSCHED_GET_TIME(now);
+ if (q->jitter)
+ delay = tabledist(q->latency, q->jitter);
+ else
+ delay = q->latency;
+
+ PSCHED_TADD2(now, delay, cb->time_to_send);
+
+ /* Always queue at tail to keep packets in order */
+ __skb_queue_tail(&q->delayed, skb);
+ sch->q.qlen++;
+ sch->stats.bytes += skb->len;
+ sch->stats.packets++;
+ return 0;
}
/* Requeue packets but don't change time stamp */
static int netem_requeue(struct sk_buff *skb, struct Qdisc *sch)
{
struct netem_sched_data *q = (struct netem_sched_data *)sch->data;
+ int ret;
- __skb_queue_head(&q->qnormal, skb);
- sch->q.qlen++;
- return 0;
+ if ((ret = q->qdisc->ops->requeue(skb, q->qdisc)) == 0)
+ sch->q.qlen++;
+
+ return ret;
}
-/*
- * Check the look aside buffer list, and see if any freshly baked buffers.
- * If head of queue is not baked, set timer.
- */
-static struct sk_buff *netem_get_delayed(struct netem_sched_data *q)
+static unsigned int netem_drop(struct Qdisc* sch)
{
- struct sk_buff *skb;
- psched_time_t now;
- long delay;
-
- skb = skb_peek(&q->qdelay);
- if (skb) {
- const struct netem_skb_cb *cb
- = (const struct netem_skb_cb *)skb->cb;
-
- PSCHED_GET_TIME(now);
- delay = PSCHED_US2JIFFIE(PSCHED_TDIFF(cb->time_to_send, now));
- pr_debug("netem_dequeue: delay queue %p@%lu %ld\n",
- skb, jiffies, delay);
-
- /* it's baked enough */
- if (delay <= 0) {
- __skb_unlink(skb, &q->qdelay);
- del_timer(&q->timer);
- return skb;
- }
+ struct netem_sched_data *q = (struct netem_sched_data *)sch->data;
+ unsigned int len;
- if (!timer_pending(&q->timer)) {
- q->timer.expires = jiffies + delay;
- add_timer(&q->timer);
- }
+ if ((len = q->qdisc->ops->drop(q->qdisc)) != 0) {
+ sch->q.qlen--;
+ sch->stats.drops++;
}
- return NULL;
+ return len;
}
/* Dequeue packet.
- * If packet needs to be held up, then put in the delay
- * queue and set timer to wakeup later.
+ * Move all packets that are ready to send from the delay holding
+ * list to the underlying qdisc, then just call dequeue
*/
static struct sk_buff *netem_dequeue(struct Qdisc *sch)
{
struct netem_sched_data *q = (struct netem_sched_data *)sch->data;
struct sk_buff *skb;
+ psched_time_t now;
- skb = netem_get_delayed(q);
- if (!skb && (skb = __skb_dequeue(&q->qnormal))) {
- /* are we doing out of order packet skip? */
- if (q->counter < q->gap) {
- pr_debug("netem_dequeue: send %p normally\n", skb);
- q->counter++;
- } else {
- /* don't send now hold for later */
- pr_debug("netem_dequeue: hold [%p]@%lu\n", skb, jiffies);
- __skb_queue_tail(&q->qdelay, skb);
- q->counter = 0;
- skb = netem_get_delayed(q);
+ PSCHED_GET_TIME(now);
+ while ((skb = skb_peek(&q->delayed)) != NULL) {
+ const struct netem_skb_cb *cb
+ = (const struct netem_skb_cb *)skb->cb;
+ long delay
+ = PSCHED_US2JIFFIE(PSCHED_TDIFF(cb->time_to_send, now));
+ pr_debug("netem_dequeue: delay queue %p@%lu %ld\n",
+ skb, jiffies, delay);
+
+ /* if more time remaining? */
+ if (delay > 0) {
+ mod_timer(&q->timer, jiffies + delay);
+ break;
}
+ __skb_unlink(skb, &q->delayed);
+
+ if (q->qdisc->enqueue(skb, q->qdisc))
+ sch->stats.drops++;
}
- if (skb)
+ skb = q->qdisc->dequeue(q->qdisc);
+ if (skb)
sch->q.qlen--;
return skb;
}
-static void netem_timer(unsigned long arg)
+static void netem_watchdog(unsigned long arg)
{
struct Qdisc *sch = (struct Qdisc *)arg;
- pr_debug("netem_timer: fired @%lu\n", jiffies);
+ pr_debug("netem_watchdog: fired @%lu\n", jiffies);
netif_schedule(sch->dev);
}
@@ -162,24 +722,63 @@ static void netem_reset(struct Qdisc *sch)
{
struct netem_sched_data *q = (struct netem_sched_data *)sch->data;
- skb_queue_purge(&q->qnormal);
- skb_queue_purge(&q->qdelay);
+ qdisc_reset(q->qdisc);
+ skb_queue_purge(&q->delayed);
sch->q.qlen = 0;
del_timer_sync(&q->timer);
}
+static int set_fifo_limit(struct Qdisc *q, int limit)
+{
+ struct rtattr *rta;
+ int ret = -ENOMEM;
+
+ rta = kmalloc(RTA_LENGTH(sizeof(struct tc_fifo_qopt)), GFP_KERNEL);
+ if (rta) {
+ rta->rta_type = RTM_NEWQDISC;
+ rta->rta_len = RTA_LENGTH(sizeof(struct tc_fifo_qopt));
+ ((struct tc_fifo_qopt *)RTA_DATA(rta))->limit = limit;
+
+ ret = q->ops->change(q, rta);
+ kfree(rta);
+ }
+ return ret;
+}
+
static int netem_change(struct Qdisc *sch, struct rtattr *opt)
{
struct netem_sched_data *q = (struct netem_sched_data *)sch->data;
struct tc_netem_qopt *qopt = RTA_DATA(opt);
+ struct Qdisc *child;
+ int ret;
- if (qopt->limit)
- sch->dev->tx_queue_len = qopt->limit;
+ if (opt->rta_len < RTA_LENGTH(sizeof(*qopt)))
+ return -EINVAL;
- q->gap = qopt->gap;
- q->loss = qopt->loss;
- q->latency = qopt->latency;
+ child = qdisc_create_dflt(sch->dev, &pfifo_qdisc_ops);
+ if (!child)
+ return -EINVAL;
+
+ ret = set_fifo_limit(child, qopt->limit);
+ if (ret) {
+ qdisc_destroy(child);
+ return ret;
+ }
+
+ sch_tree_lock(sch);
+ if (child) {
+ child = xchg(&q->qdisc, child);
+ if (child != &noop_qdisc)
+ qdisc_destroy(child);
+
+ q->latency = qopt->latency;
+ q->jitter = qopt->jitter;
+ q->limit = qopt->limit;
+ q->gap = qopt->gap;
+ q->loss = qopt->loss;
+ }
+ sch_tree_unlock(sch);
return 0;
}
@@ -191,10 +790,11 @@ static int netem_init(struct Qdisc *sch, struct rtattr *opt)
if (!opt)
return -EINVAL;
- skb_queue_head_init(&q->qnormal);
- skb_queue_head_init(&q->qdelay);
+ skb_queue_head_init(&q->delayed);
+ q->qdisc = &noop_qdisc;
+
init_timer(&q->timer);
- q->timer.function = netem_timer;
+ q->timer.function = netem_watchdog;
q->timer.data = (unsigned long) sch;
q->counter = 0;
@@ -215,6 +815,7 @@ static int netem_dump(struct Qdisc *sch, struct sk_buff *skb)
struct tc_netem_qopt qopt;
qopt.latency = q->latency;
+ qopt.jitter = q->jitter;
qopt.limit = sch->dev->tx_queue_len;
qopt.loss = q->loss;
qopt.gap = q->gap;
@@ -234,6 +835,7 @@ static struct Qdisc_ops netem_qdisc_ops = {
.enqueue = netem_enqueue,
.dequeue = netem_dequeue,
.requeue = netem_requeue,
+ .drop = netem_drop,
.init = netem_init,
.reset = netem_reset,
.destroy = netem_destroy,
diff --git a/net/sctp/inqueue.c b/net/sctp/inqueue.c
index 9bb4de3d2bff..2e83405b8be7 100644
--- a/net/sctp/inqueue.c
+++ b/net/sctp/inqueue.c
@@ -78,7 +78,7 @@ void sctp_inq_free(struct sctp_inq *queue)
struct sctp_chunk *chunk;
/* Empty the queue. */
- while ((chunk = (struct sctp_chunk *) skb_dequeue(&queue->in)))
+ while ((chunk = (struct sctp_chunk *) skb_dequeue(&queue->in)) != NULL)
sctp_chunk_free(chunk);
/* If there is a packet which is currently being worked on,
diff --git a/net/sctp/output.c b/net/sctp/output.c
index d54f915aee1d..10017a7036f2 100644
--- a/net/sctp/output.c
+++ b/net/sctp/output.c
@@ -133,7 +133,7 @@ void sctp_packet_free(struct sctp_packet *packet)
SCTP_DEBUG_PRINTK("%s: packet:%p\n", __FUNCTION__, packet);
- while ((chunk = (struct sctp_chunk *)__skb_dequeue(&packet->chunks)))
+ while ((chunk = (struct sctp_chunk *)__skb_dequeue(&packet->chunks)) != NULL)
sctp_chunk_free(chunk);
if (packet->malloced)
@@ -370,7 +370,7 @@ int sctp_packet_transmit(struct sctp_packet *packet)
* [This whole comment explains WORD_ROUND() below.]
*/
SCTP_DEBUG_PRINTK("***sctp_transmit_packet***\n");
- while ((chunk = (struct sctp_chunk *)__skb_dequeue(&packet->chunks))) {
+ while ((chunk = (struct sctp_chunk *)__skb_dequeue(&packet->chunks)) != NULL) {
if (sctp_chunk_is_data(chunk)) {
if (!chunk->has_tsn) {
@@ -511,7 +511,7 @@ err:
* will get resent or dropped later.
*/
- while ((chunk = (struct sctp_chunk *)__skb_dequeue(&packet->chunks))) {
+ while ((chunk = (struct sctp_chunk *)__skb_dequeue(&packet->chunks)) != NULL) {
if (!sctp_chunk_is_data(chunk))
sctp_chunk_free(chunk);
}
diff --git a/net/sctp/outqueue.c b/net/sctp/outqueue.c
index 02272a71c392..f3c56f136c39 100644
--- a/net/sctp/outqueue.c
+++ b/net/sctp/outqueue.c
@@ -245,7 +245,7 @@ void sctp_outq_teardown(struct sctp_outq *q)
/* Throw away unacknowledged chunks. */
list_for_each(pos, &q->asoc->peer.transport_addr_list) {
transport = list_entry(pos, struct sctp_transport, transports);
- while ((lchunk = sctp_list_dequeue(&transport->transmitted))) {
+ while ((lchunk = sctp_list_dequeue(&transport->transmitted)) != NULL) {
chunk = list_entry(lchunk, struct sctp_chunk,
transmitted_list);
/* Mark as part of a failed message. */
@@ -282,7 +282,7 @@ void sctp_outq_teardown(struct sctp_outq *q)
}
/* Throw away any leftover data chunks. */
- while ((chunk = sctp_outq_dequeue_data(q))) {
+ while ((chunk = sctp_outq_dequeue_data(q)) != NULL) {
/* Mark as send failure. */
sctp_chunk_fail(chunk, q->error);
@@ -292,7 +292,7 @@ void sctp_outq_teardown(struct sctp_outq *q)
q->error = 0;
/* Throw away any leftover control chunks. */
- while ((chunk = (struct sctp_chunk *) skb_dequeue(&q->control)))
+ while ((chunk = (struct sctp_chunk *) skb_dequeue(&q->control)) != NULL)
sctp_chunk_free(chunk);
}
@@ -681,7 +681,7 @@ int sctp_outq_flush(struct sctp_outq *q, int rtx_timeout)
*/
queue = &q->control;
- while ((chunk = (struct sctp_chunk *)skb_dequeue(queue))) {
+ while ((chunk = (struct sctp_chunk *)skb_dequeue(queue)) != NULL) {
/* Pick the right transport to use. */
new_transport = chunk->transport;
@@ -812,7 +812,7 @@ int sctp_outq_flush(struct sctp_outq *q, int rtx_timeout)
start_timer = 0;
queue = &q->out;
- while ((chunk = sctp_outq_dequeue_data(q))) {
+ while ((chunk = sctp_outq_dequeue_data(q)) != NULL) {
/* RFC 2960 6.5 Every DATA chunk MUST carry a valid
* stream identifier.
*/
@@ -866,7 +866,7 @@ int sctp_outq_flush(struct sctp_outq *q, int rtx_timeout)
SCTP_DEBUG_PRINTK("TX TSN 0x%x skb->head "
"%p skb->users %d.\n",
ntohl(chunk->subh.data_hdr->tsn),
- chunk->skb ?chunk->skb->head : 0,
+ chunk->skb ?chunk->skb->head : NULL,
chunk->skb ?
atomic_read(&chunk->skb->users) : -1);
diff --git a/net/sctp/protocol.c b/net/sctp/protocol.c
index c0d13711ea8c..15cd8adf3c84 100644
--- a/net/sctp/protocol.c
+++ b/net/sctp/protocol.c
@@ -101,7 +101,7 @@ __init int sctp_proc_init(void)
{
if (!proc_net_sctp) {
struct proc_dir_entry *ent;
- ent = proc_mkdir("net/sctp", 0);
+ ent = proc_mkdir("net/sctp", NULL);
if (ent) {
ent->owner = THIS_MODULE;
proc_net_sctp = ent;
diff --git a/net/sctp/sm_statefuns.c b/net/sctp/sm_statefuns.c
index 30849b0e16ef..4eaa1c1929f3 100644
--- a/net/sctp/sm_statefuns.c
+++ b/net/sctp/sm_statefuns.c
@@ -995,7 +995,7 @@ static int sctp_sf_check_restart_addrs(const struct sctp_association *new_asoc,
/* Search through all current addresses and make sure
* we aren't adding any new ones.
*/
- new_addr = 0;
+ new_addr = NULL;
found = 0;
list_for_each(pos, &new_asoc->peer.transport_addr_list) {
diff --git a/net/sctp/socket.c b/net/sctp/socket.c
index 1b33d4d7b574..1921e9bb5985 100644
--- a/net/sctp/socket.c
+++ b/net/sctp/socket.c
@@ -86,8 +86,6 @@
/* Forward declarations for internal helper functions. */
static int sctp_writeable(struct sock *sk);
-static inline int sctp_wspace(struct sctp_association *asoc);
-static inline void sctp_set_owner_w(struct sctp_chunk *chunk);
static void sctp_wfree(struct sk_buff *skb);
static int sctp_wait_for_sndbuf(struct sctp_association *, long *timeo_p,
size_t msg_len);
@@ -95,7 +93,8 @@ static int sctp_wait_for_packet(struct sock * sk, int *err, long *timeo_p);
static int sctp_wait_for_connect(struct sctp_association *, long *timeo_p);
static int sctp_wait_for_accept(struct sock *sk, long timeo);
static void sctp_wait_for_close(struct sock *sk, long timeo);
-static inline int sctp_verify_addr(struct sock *, union sctp_addr *, int);
+static struct sctp_af *sctp_sockaddr_af(struct sctp_opt *opt,
+ union sctp_addr *addr, int len);
static int sctp_bindx_add(struct sock *, struct sockaddr *, int);
static int sctp_bindx_rem(struct sock *, struct sockaddr *, int);
static int sctp_send_asconf_add_ip(struct sock *, struct sockaddr *, int);
@@ -111,6 +110,64 @@ static char *sctp_hmac_alg = SCTP_COOKIE_HMAC_ALG;
extern kmem_cache_t *sctp_bucket_cachep;
extern int sctp_assoc_valid(struct sock *sk, struct sctp_association *asoc);
+/* Get the sndbuf space available at the time on the association. */
+static inline int sctp_wspace(struct sctp_association *asoc)
+{
+ struct sock *sk = asoc->base.sk;
+ int amt = 0;
+
+ amt = sk->sk_sndbuf - asoc->sndbuf_used;
+ if (amt < 0)
+ amt = 0;
+ return amt;
+}
+
+/* Increment the used sndbuf space count of the corresponding association by
+ * the size of the outgoing data chunk.
+ * Also, set the skb destructor for sndbuf accounting later.
+ *
+ * Since it is always 1-1 between chunk and skb, and also a new skb is always
+ * allocated for chunk bundling in sctp_packet_transmit(), we can use the
+ * destructor in the data chunk skb for the purpose of the sndbuf space
+ * tracking.
+ */
+static inline void sctp_set_owner_w(struct sctp_chunk *chunk)
+{
+ struct sctp_association *asoc = chunk->asoc;
+ struct sock *sk = asoc->base.sk;
+
+ /* The sndbuf space is tracked per association. */
+ sctp_association_hold(asoc);
+
+ chunk->skb->destructor = sctp_wfree;
+ /* Save the chunk pointer in skb for sctp_wfree to use later. */
+ *((struct sctp_chunk **)(chunk->skb->cb)) = chunk;
+
+ asoc->sndbuf_used += SCTP_DATA_SNDSIZE(chunk);
+ sk->sk_wmem_queued += SCTP_DATA_SNDSIZE(chunk);
+}
+
+/* Verify that this is a valid address. */
+static inline int sctp_verify_addr(struct sock *sk, union sctp_addr *addr,
+ int len)
+{
+ struct sctp_af *af;
+
+ /* Verify basic sockaddr. */
+ af = sctp_sockaddr_af(sctp_sk(sk), addr, len);
+ if (!af)
+ return -EINVAL;
+
+ /* Is this a valid SCTP address? */
+ if (!af->addr_valid(addr, sctp_sk(sk)))
+ return -EINVAL;
+
+ if (!sctp_sk(sk)->pf->send_verify(sctp_sk(sk), (addr)))
+ return -EINVAL;
+
+ return 0;
+}
+
/* Look up the association by its id. If this is not a UDP-style
* socket, the ID field is always ignored.
*/
@@ -1008,7 +1065,7 @@ SCTP_STATIC int sctp_sendmsg(struct kiocb *iocb, struct sock *sk,
struct sctp_sndrcvinfo *sinfo;
struct sctp_initmsg *sinit;
sctp_assoc_t associd = NULL;
- sctp_cmsgs_t cmsgs = { 0 };
+ sctp_cmsgs_t cmsgs = { NULL };
int err;
sctp_scope_t scope;
long timeo;
@@ -4144,64 +4201,6 @@ no_packet:
return NULL;
}
-/* Verify that this is a valid address. */
-static inline int sctp_verify_addr(struct sock *sk, union sctp_addr *addr,
- int len)
-{
- struct sctp_af *af;
-
- /* Verify basic sockaddr. */
- af = sctp_sockaddr_af(sctp_sk(sk), addr, len);
- if (!af)
- return -EINVAL;
-
- /* Is this a valid SCTP address? */
- if (!af->addr_valid(addr, sctp_sk(sk)))
- return -EINVAL;
-
- if (!sctp_sk(sk)->pf->send_verify(sctp_sk(sk), (addr)))
- return -EINVAL;
-
- return 0;
-}
-
-/* Get the sndbuf space available at the time on the association. */
-static inline int sctp_wspace(struct sctp_association *asoc)
-{
- struct sock *sk = asoc->base.sk;
- int amt = 0;
-
- amt = sk->sk_sndbuf - asoc->sndbuf_used;
- if (amt < 0)
- amt = 0;
- return amt;
-}
-
-/* Increment the used sndbuf space count of the corresponding association by
- * the size of the outgoing data chunk.
- * Also, set the skb destructor for sndbuf accounting later.
- *
- * Since it is always 1-1 between chunk and skb, and also a new skb is always
- * allocated for chunk bundling in sctp_packet_transmit(), we can use the
- * destructor in the data chunk skb for the purpose of the sndbuf space
- * tracking.
- */
-static inline void sctp_set_owner_w(struct sctp_chunk *chunk)
-{
- struct sctp_association *asoc = chunk->asoc;
- struct sock *sk = asoc->base.sk;
-
- /* The sndbuf space is tracked per association. */
- sctp_association_hold(asoc);
-
- chunk->skb->destructor = sctp_wfree;
- /* Save the chunk pointer in skb for sctp_wfree to use later. */
- *((struct sctp_chunk **)(chunk->skb->cb)) = chunk;
-
- asoc->sndbuf_used += SCTP_DATA_SNDSIZE(chunk);
- sk->sk_wmem_queued += SCTP_DATA_SNDSIZE(chunk);
-}
-
/* If sndbuf has changed, wake up per association sndbuf waiters. */
static void __sctp_write_space(struct sctp_association *asoc)
{
diff --git a/net/sctp/ulpevent.c b/net/sctp/ulpevent.c
index d746321a701a..e804d6ed8c0f 100644
--- a/net/sctp/ulpevent.c
+++ b/net/sctp/ulpevent.c
@@ -48,13 +48,23 @@
#include <net/sctp/sctp.h>
#include <net/sctp/sm.h>
-static inline void sctp_ulpevent_set_owner(struct sctp_ulpevent *event,
- const struct sctp_association *asoc);
-static inline void sctp_ulpevent_release_owner(struct sctp_ulpevent *event);
static void sctp_ulpevent_receive_data(struct sctp_ulpevent *event,
struct sctp_association *asoc);
static void sctp_ulpevent_release_data(struct sctp_ulpevent *event);
+/* Stub skb destructor. */
+static void sctp_stub_rfree(struct sk_buff *skb)
+{
+/* WARNING: This function is just a warning not to use the
+ * skb destructor. If the skb is shared, we may get the destructor
+ * callback on some processor that does not own the sock_lock. This
+ * was occuring with PACKET socket applications that were monitoring
+ * our skbs. We can't take the sock_lock, because we can't risk
+ * recursing if we do really own the sock lock. Instead, do all
+ * of our rwnd manipulation while we own the sock_lock outright.
+ */
+}
+
/* Create a new sctp_ulpevent. */
struct sctp_ulpevent *sctp_ulpevent_new(int size, int msg_flags, int gfp)
{
@@ -87,6 +97,30 @@ int sctp_ulpevent_is_notification(const struct sctp_ulpevent *event)
return MSG_NOTIFICATION == (event->msg_flags & MSG_NOTIFICATION);
}
+/* Hold the association in case the msg_name needs read out of
+ * the association.
+ */
+static inline void sctp_ulpevent_set_owner(struct sctp_ulpevent *event,
+ const struct sctp_association *asoc)
+{
+ struct sk_buff *skb;
+
+ /* Cast away the const, as we are just wanting to
+ * bump the reference count.
+ */
+ sctp_association_hold((struct sctp_association *)asoc);
+ skb = sctp_event2skb(event);
+ skb->sk = asoc->base.sk;
+ event->asoc = (struct sctp_association *)asoc;
+ skb->destructor = sctp_stub_rfree;
+}
+
+/* A simple destructor to give up the reference to the association. */
+static inline void sctp_ulpevent_release_owner(struct sctp_ulpevent *event)
+{
+ sctp_association_put(event->asoc);
+}
+
/* Create and initialize an SCTP_ASSOC_CHANGE event.
*
* 5.3.1.1 SCTP_ASSOC_CHANGE
@@ -789,43 +823,6 @@ void sctp_ulpevent_read_sndrcvinfo(const struct sctp_ulpevent *event,
sizeof(struct sctp_sndrcvinfo), (void *)&sinfo);
}
-/* Stub skb destructor. */
-static void sctp_stub_rfree(struct sk_buff *skb)
-{
-/* WARNING: This function is just a warning not to use the
- * skb destructor. If the skb is shared, we may get the destructor
- * callback on some processor that does not own the sock_lock. This
- * was occuring with PACKET socket applications that were monitoring
- * our skbs. We can't take the sock_lock, because we can't risk
- * recursing if we do really own the sock lock. Instead, do all
- * of our rwnd manipulation while we own the sock_lock outright.
- */
-}
-
-/* Hold the association in case the msg_name needs read out of
- * the association.
- */
-static inline void sctp_ulpevent_set_owner(struct sctp_ulpevent *event,
- const struct sctp_association *asoc)
-{
- struct sk_buff *skb;
-
- /* Cast away the const, as we are just wanting to
- * bump the reference count.
- */
- sctp_association_hold((struct sctp_association *)asoc);
- skb = sctp_event2skb(event);
- skb->sk = asoc->base.sk;
- event->asoc = (struct sctp_association *)asoc;
- skb->destructor = sctp_stub_rfree;
-}
-
-/* A simple destructor to give up the reference to the association. */
-static inline void sctp_ulpevent_release_owner(struct sctp_ulpevent *event)
-{
- sctp_association_put(event->asoc);
-}
-
/* Do accounting for bytes received and hold a reference to the association
* for each skb.
*/
diff --git a/net/sctp/ulpqueue.c b/net/sctp/ulpqueue.c
index 0b912c87e6cd..cb99cf24455e 100644
--- a/net/sctp/ulpqueue.c
+++ b/net/sctp/ulpqueue.c
@@ -49,10 +49,10 @@
#include <net/sctp/sm.h>
/* Forward declarations for internal helpers. */
-static inline struct sctp_ulpevent * sctp_ulpq_reasm(struct sctp_ulpq *ulpq,
- struct sctp_ulpevent *);
-static inline struct sctp_ulpevent *sctp_ulpq_order(struct sctp_ulpq *,
- struct sctp_ulpevent *);
+static struct sctp_ulpevent * sctp_ulpq_reasm(struct sctp_ulpq *ulpq,
+ struct sctp_ulpevent *);
+static struct sctp_ulpevent * sctp_ulpq_order(struct sctp_ulpq *,
+ struct sctp_ulpevent *);
/* 1st Level Abstractions */
@@ -97,12 +97,12 @@ void sctp_ulpq_flush(struct sctp_ulpq *ulpq)
struct sk_buff *skb;
struct sctp_ulpevent *event;
- while ((skb = __skb_dequeue(&ulpq->lobby))) {
+ while ((skb = __skb_dequeue(&ulpq->lobby)) != NULL) {
event = sctp_skb2event(skb);
sctp_ulpevent_free(event);
}
- while ((skb = __skb_dequeue(&ulpq->reasm))) {
+ while ((skb = __skb_dequeue(&ulpq->reasm)) != NULL) {
event = sctp_skb2event(skb);
sctp_ulpevent_free(event);
}
@@ -466,8 +466,8 @@ done:
/* Helper function to reassemble chunks. Hold chunks on the reasm queue that
* need reassembling.
*/
-static inline struct sctp_ulpevent *sctp_ulpq_reasm(struct sctp_ulpq *ulpq,
- struct sctp_ulpevent *event)
+static struct sctp_ulpevent *sctp_ulpq_reasm(struct sctp_ulpq *ulpq,
+ struct sctp_ulpevent *event)
{
struct sctp_ulpevent *retval = NULL;
@@ -645,8 +645,8 @@ static inline void sctp_ulpq_store_ordered(struct sctp_ulpq *ulpq,
}
-static inline struct sctp_ulpevent *sctp_ulpq_order(struct sctp_ulpq *ulpq,
- struct sctp_ulpevent *event)
+static struct sctp_ulpevent *sctp_ulpq_order(struct sctp_ulpq *ulpq,
+ struct sctp_ulpevent *event)
{
__u16 sid, ssn;
struct sctp_stream *in;
@@ -756,7 +756,7 @@ static __u16 sctp_ulpq_renege_order(struct sctp_ulpq *ulpq, __u16 needed)
tsnmap = &ulpq->asoc->peer.tsn_map;
- while ((skb = __skb_dequeue_tail(&ulpq->lobby))) {
+ while ((skb = __skb_dequeue_tail(&ulpq->lobby)) != NULL) {
freed += skb_headlen(skb);
event = sctp_skb2event(skb);
tsn = event->tsn;
@@ -782,7 +782,7 @@ static __u16 sctp_ulpq_renege_frags(struct sctp_ulpq *ulpq, __u16 needed)
tsnmap = &ulpq->asoc->peer.tsn_map;
/* Walk backwards through the list, reneges the newest tsns. */
- while ((skb = __skb_dequeue_tail(&ulpq->reasm))) {
+ while ((skb = __skb_dequeue_tail(&ulpq->reasm)) != NULL) {
freed += skb_headlen(skb);
event = sctp_skb2event(skb);
tsn = event->tsn;
diff --git a/net/xfrm/xfrm_user.c b/net/xfrm/xfrm_user.c
index b917b5a77b35..99edfc6128a3 100644
--- a/net/xfrm/xfrm_user.c
+++ b/net/xfrm/xfrm_user.c
@@ -814,6 +814,20 @@ static int xfrm_get_policy(struct sk_buff *skb, struct nlmsghdr *nlh, void **xfr
return err;
}
+static int xfrm_flush_sa(struct sk_buff *skb, struct nlmsghdr *nlh, void **xfrma)
+{
+ struct xfrm_usersa_flush *p = NLMSG_DATA(nlh);
+
+ xfrm_state_flush(p->proto);
+ return 0;
+}
+
+static int xfrm_flush_policy(struct sk_buff *skb, struct nlmsghdr *nlh, void **xfrma)
+{
+ xfrm_policy_flush();
+ return 0;
+}
+
static const int xfrm_msg_min[(XFRM_MSG_MAX + 1 - XFRM_MSG_BASE)] = {
NLMSG_LENGTH(sizeof(struct xfrm_usersa_info)), /* NEW SA */
NLMSG_LENGTH(sizeof(struct xfrm_usersa_id)), /* DEL SA */
@@ -826,6 +840,9 @@ static const int xfrm_msg_min[(XFRM_MSG_MAX + 1 - XFRM_MSG_BASE)] = {
NLMSG_LENGTH(sizeof(struct xfrm_user_expire)), /* EXPIRE */
NLMSG_LENGTH(sizeof(struct xfrm_userpolicy_info)),/* UPD POLICY */
NLMSG_LENGTH(sizeof(struct xfrm_usersa_info)), /* UPD SA */
+ NLMSG_LENGTH(sizeof(struct xfrm_user_polexpire)), /* POLEXPIRE */
+ NLMSG_LENGTH(sizeof(struct xfrm_usersa_flush)), /* FLUSH SA */
+ NLMSG_LENGTH(0), /* FLUSH POLICY */
};
static struct xfrm_link {
@@ -849,6 +866,9 @@ static struct xfrm_link {
{},
{ .doit = xfrm_add_policy },
{ .doit = xfrm_add_sa, },
+ {},
+ { .doit = xfrm_flush_sa },
+ { .doit = xfrm_flush_policy },
};
static int xfrm_done(struct netlink_callback *cb)