diff options
author | Len Brown <len.brown@intel.com> | 2004-07-31 13:06:44 -0400 |
---|---|---|
committer | Len Brown <len.brown@intel.com> | 2004-07-31 13:06:44 -0400 |
commit | 023a2af5c04653827d36d4c9892e029cd83914cf (patch) | |
tree | a90741185cfda6111fe1e97f2afbfd735f87f5ea /drivers | |
parent | 2c5a5b2c33d063afc796cf6572037bfd1410e3ab (diff) | |
parent | ed158dc1d27a3715d6788f3082fc7769d2023e4c (diff) | |
download | history-023a2af5c04653827d36d4c9892e029cd83914cf.tar.gz |
Merge intel.com:/home/lenb/bk/linux-2.6.8
into intel.com:/home/lenb/src/linux-acpi-test-2.6.8
Diffstat (limited to 'drivers')
52 files changed, 634 insertions, 709 deletions
diff --git a/drivers/base/Kconfig b/drivers/base/Kconfig index c3ae0c59baa96b..0a160b2a57514d 100644 --- a/drivers/base/Kconfig +++ b/drivers/base/Kconfig @@ -1,5 +1,14 @@ menu "Generic Driver Options" +config STANDALONE + bool "Select only drivers that don't need compile-time external firmware" if EXPERIMENTAL + default y + help + Select this option if you don't have magic firmware for drivers that + need it. + + If unsure, say Y. + config PREVENT_FIRMWARE_BUILD bool "Prevent firmware from being built" default y diff --git a/drivers/cdrom/sbpcd.c b/drivers/cdrom/sbpcd.c index 8e81cff4996681..cd33f63b97cd0d 100644 --- a/drivers/cdrom/sbpcd.c +++ b/drivers/cdrom/sbpcd.c @@ -570,7 +570,7 @@ static const char *major_name="sbpcd"; /*==========================================================================*/ -#if FUTURE +#ifdef FUTURE static DECLARE_WAIT_QUEUE_HEAD(sbp_waitq); #endif /* FUTURE */ @@ -703,7 +703,7 @@ static struct sbpcd_drive { u_char TocEnt_number; u_char TocEnt_format; /* em */ u_int TocEnt_address; -#if SAFE_MIXED +#ifdef SAFE_MIXED char has_data; #endif /* SAFE_MIXED */ u_char ored_ctl_adr; /* to detect if CDROM contains data tracks */ @@ -3176,7 +3176,7 @@ static int cc_CheckMultiSession(void) return (0); } /*==========================================================================*/ -#if FUTURE +#ifdef FUTURE static int cc_SubChanInfo(int frame, int count, u_char *buffer) /* "frame" is a RED BOOK (msf-bin) address */ { @@ -3733,7 +3733,7 @@ static int __init check_drives(void) return (0); } /*==========================================================================*/ -#if FUTURE +#ifdef FUTURE /* * obtain if requested service disturbs current audio state */ @@ -4027,7 +4027,7 @@ static int sbpcd_drive_status(struct cdrom_device_info *cdi, int slot_nr) /*==========================================================================*/ -#if FUTURE +#ifdef FUTURE /* * called always if driver gets entered * returns 0 or ERROR2 or ERROR15 @@ -4198,7 +4198,7 @@ static int sbpcd_dev_ioctl(struct cdrom_device_info *cdi, u_int cmd, case CDROMREADMODE1: msg(DBG_IOC,"ioctl: CDROMREADMODE1 requested.\n"); -#if SAFE_MIXED +#ifdef SAFE_MIXED if (current_drive->has_data>1) RETURN_UP(-EBUSY); #endif /* SAFE_MIXED */ cc_ModeSelect(CD_FRAMESIZE); @@ -4208,7 +4208,7 @@ static int sbpcd_dev_ioctl(struct cdrom_device_info *cdi, u_int cmd, case CDROMREADMODE2: /* not usable at the moment */ msg(DBG_IOC,"ioctl: CDROMREADMODE2 requested.\n"); -#if SAFE_MIXED +#ifdef SAFE_MIXED if (current_drive->has_data>1) RETURN_UP(-EBUSY); #endif /* SAFE_MIXED */ cc_ModeSelect(CD_FRAMESIZE_RAW1); @@ -4257,11 +4257,11 @@ static int sbpcd_dev_ioctl(struct cdrom_device_info *cdi, u_int cmd, if (famL_drive) RETURN_UP(-EINVAL); if (famV_drive) RETURN_UP(-EINVAL); if (famT_drive) RETURN_UP(-EINVAL); -#if SAFE_MIXED +#ifdef SAFE_MIXED if (current_drive->has_data>1) RETURN_UP(-EBUSY); #endif /* SAFE_MIXED */ if (current_drive->aud_buf==NULL) RETURN_UP(-EINVAL); - if (copy_from_user(&read_audio, (void *)arg, + if (copy_from_user(&read_audio, (void __user *)arg, sizeof(struct cdrom_read_audio))) RETURN_UP(-EFAULT); if (read_audio.nframes < 0 || read_audio.nframes>current_drive->sbp_audsiz) RETURN_UP(-EINVAL); @@ -4460,8 +4460,8 @@ static int sbpcd_dev_ioctl(struct cdrom_device_info *cdi, u_int cmd, msg(DBG_AUD,"read_audio: cc_ReadError was necessary after read: %02X\n",i); continue; } - if (copy_to_user((u_char *)read_audio.buf, - (u_char *) current_drive->aud_buf, + if (copy_to_user(read_audio.buf, + current_drive->aud_buf, read_audio.nframes * CD_FRAMESIZE_RAW)) RETURN_UP(-EFAULT); msg(DBG_AUD,"read_audio: copy_to_user done.\n"); @@ -4549,7 +4549,7 @@ static int sbpcd_audio_ioctl(struct cdrom_device_info *cdi, u_int cmd, case CDROMPLAYMSF: msg(DBG_IOC,"ioctl: CDROMPLAYMSF entered.\n"); -#if SAFE_MIXED +#ifdef SAFE_MIXED if (current_drive->has_data>1) RETURN_UP(-EBUSY); #endif /* SAFE_MIXED */ if (current_drive->audio_state==audio_playing) @@ -4584,7 +4584,7 @@ static int sbpcd_audio_ioctl(struct cdrom_device_info *cdi, u_int cmd, case CDROMPLAYTRKIND: /* Play a track. This currently ignores index. */ msg(DBG_IOC,"ioctl: CDROMPLAYTRKIND entered.\n"); -#if SAFE_MIXED +#ifdef SAFE_MIXED if (current_drive->has_data>1) RETURN_UP(-EBUSY); #endif /* SAFE_MIXED */ if (current_drive->audio_state==audio_playing) @@ -4647,7 +4647,7 @@ static int sbpcd_audio_ioctl(struct cdrom_device_info *cdi, u_int cmd, case CDROMSTOP: /* Spin down the drive */ msg(DBG_IOC,"ioctl: CDROMSTOP entered.\n"); -#if SAFE_MIXED +#ifdef SAFE_MIXED if (current_drive->has_data>1) RETURN_UP(-EBUSY); #endif /* SAFE_MIXED */ i=cc_Pause_Resume(1); @@ -4912,7 +4912,7 @@ static void do_sbpcd_request(request_queue_t * q) goto request_loop; } -#if FUTURE +#ifdef FUTURE i=prepare(0,0); /* at moment not really a hassle check, but ... */ if (i!=0) msg(DBG_INF,"\"prepare\" tells error %d -- ignored\n", i); @@ -4940,7 +4940,7 @@ static void do_sbpcd_request(request_queue_t * q) sbp_sleep(0); if (sbp_data(req) != 0) { -#if SAFE_MIXED +#ifdef SAFE_MIXED current_drive->has_data=2; /* is really a data disk */ #endif /* SAFE_MIXED */ #ifdef DEBUG_GTL @@ -5416,11 +5416,11 @@ static int sbpcd_open(struct cdrom_device_info *cdi, int purpose) if ((current_drive->ored_ctl_adr&0x40)==0) { msg(DBG_INF,"CD contains no data tracks.\n"); -#if SAFE_MIXED +#ifdef SAFE_MIXED current_drive->has_data=0; #endif /* SAFE_MIXED */ } -#if SAFE_MIXED +#ifdef SAFE_MIXED else if (current_drive->has_data<1) current_drive->has_data=1; #endif /* SAFE_MIXED */ } @@ -5455,7 +5455,7 @@ static void sbpcd_release(struct cdrom_device_info * cdi) if (p->f_eject) cc_SpinDown(); p->diskstate_flags &= ~cd_size_bit; p->open_count=0; -#if SAFE_MIXED +#ifdef SAFE_MIXED p->has_data=0; #endif /* SAFE_MIXED */ } @@ -5822,7 +5822,7 @@ int __init sbpcd_init(void) if (p->drv_id==-1) continue; switch_drive(p); -#if SAFE_MIXED +#ifdef SAFE_MIXED p->has_data=0; #endif /* SAFE_MIXED */ /* @@ -5942,7 +5942,7 @@ static int sbpcd_media_changed(struct cdrom_device_info *cdi, int disc_nr) current_drive->diskstate_flags &= ~toc_bit; /* we *don't* need invalidate here, it's done by caller */ current_drive->diskstate_flags &= ~cd_size_bit; -#if SAFE_MIXED +#ifdef SAFE_MIXED current_drive->has_data=0; #endif /* SAFE_MIXED */ diff --git a/drivers/char/Kconfig b/drivers/char/Kconfig index 963986ae9aea19..60c50c2eb1af16 100644 --- a/drivers/char/Kconfig +++ b/drivers/char/Kconfig @@ -867,7 +867,7 @@ menu "Ftape, the floppy tape device driver" config FTAPE tristate "Ftape (QIC-80/Travan) support" - depends on BROKEN_ON_SMP + depends on BROKEN_ON_SMP && (ALPHA || X86) ---help--- If you have a tape drive that is connected to your floppy controller, say Y here. diff --git a/drivers/char/epca.c b/drivers/char/epca.c index 8b838c18778a0c..854d16a39f210f 100644 --- a/drivers/char/epca.c +++ b/drivers/char/epca.c @@ -48,8 +48,8 @@ #define ENABLE_PCI #endif /* CONFIG_PCI */ -#define putUser(arg1, arg2) put_user(arg1, (unsigned long *)arg2) -#define getUser(arg1, arg2) get_user(arg1, (unsigned int *)arg2) +#define putUser(arg1, arg2) put_user(arg1, (unsigned long __user *)arg2) +#define getUser(arg1, arg2) get_user(arg1, (unsigned __user *)arg2) #ifdef ENABLE_PCI #include <linux/pci.h> @@ -218,7 +218,7 @@ static void setup_empty_event(struct tty_struct *tty, struct channel *ch); void epca_setup(char *, int *); void console_print(const char *); -static int get_termio(struct tty_struct *, struct termio *); +static int get_termio(struct tty_struct *, struct termio __user *); static int pc_write(struct tty_struct *, int, const unsigned char *, int); int pc_init(void); @@ -835,38 +835,29 @@ static int pc_write(struct tty_struct * tty, int from_user, if (bytesAvailable) { /* Begin bytesAvailable */ + /* --------------------------------------------------------------- + The below function reads data from user memory. This routine + can not be used in an interrupt routine. (Because it may + generate a page fault) It can only be called while we can the + user context is accessible. + + The prototype is : + inline void copy_from_user(void * to, const void * from, + unsigned long count); + + I also think (Check hackers guide) that optimization must + be turned ON. (Which sounds strange to me...) + + Remember copy_from_user WILL generate a page fault if the + user memory being accessed has been swapped out. This can + cause this routine to temporarily sleep while this page + fault is occurring. + + ----------------------------------------------------------------- */ - /* Can the user buffer be accessed at the moment ? */ - if (verify_area(VERIFY_READ, (char*)buf, bytesAvailable)) - bytesAvailable = 0; /* Can't do; try again later */ - else /* Evidently it can, began transmission */ - { /* Begin if area verified */ - /* --------------------------------------------------------------- - The below function reads data from user memory. This routine - can not be used in an interrupt routine. (Because it may - generate a page fault) It can only be called while we can the - user context is accessible. - - The prototype is : - inline void copy_from_user(void * to, const void * from, - unsigned long count); - - I also think (Check hackers guide) that optimization must - be turned ON. (Which sounds strange to me...) - - Remember copy_from_user WILL generate a page fault if the - user memory being accessed has been swapped out. This can - cause this routine to temporarily sleep while this page - fault is occurring. - - ----------------------------------------------------------------- */ - - if (copy_from_user(ch->tmp_buf, buf, - bytesAvailable)) - return -EFAULT; - - } /* End if area verified */ - + if (copy_from_user(ch->tmp_buf, buf, + bytesAvailable)) + return -EFAULT; } /* End bytesAvailable */ /* ------------------------------------------------------------------ @@ -1984,7 +1975,7 @@ static void post_fep_init(unsigned int crd) ch->boardnum = crd; ch->channelnum = i; ch->magic = EPCA_MAGIC; - ch->tty = 0; + ch->tty = NULL; if (shrinkmem) { @@ -2728,7 +2719,7 @@ static void receive_data(struct channel *ch) { /* Begin receive_data */ unchar *rptr; - struct termios *ts = 0; + struct termios *ts = NULL; struct tty_struct *tty; volatile struct board_chan *bc; register int dataToRead, wrapgap, bytesAvailable; @@ -2851,8 +2842,6 @@ static void receive_data(struct channel *ch) static int info_ioctl(struct tty_struct *tty, struct file * file, unsigned int cmd, unsigned long arg) { - int error; - switch (cmd) { /* Begin switch cmd */ @@ -2862,13 +2851,7 @@ static int info_ioctl(struct tty_struct *tty, struct file * file, struct digi_info di ; int brd; - getUser(brd, (unsigned int *)arg); - - if ((error = verify_area(VERIFY_WRITE, (char*)arg, sizeof(di)))) - { - printk(KERN_ERR "DIGI_GETINFO : verify area size 0x%x failed\n",sizeof(di)); - return(error); - } + getUser(brd, (unsigned int __user *)arg); if ((brd < 0) || (brd >= num_cards) || (num_cards == 0)) return (-ENODEV); @@ -2882,7 +2865,7 @@ static int info_ioctl(struct tty_struct *tty, struct file * file, di.port = boards[brd].port ; di.membase = boards[brd].membase ; - if (copy_to_user((char *)arg, &di, sizeof (di))) + if (copy_to_user((void __user *)arg, &di, sizeof (di))) return -EFAULT; break; @@ -3020,6 +3003,7 @@ static int pc_tiocmset(struct tty_struct *tty, struct file *file, epcaparam(tty,ch); memoff(ch); restore_flags(flags); + return 0; } static int pc_ioctl(struct tty_struct *tty, struct file * file, @@ -3027,12 +3011,13 @@ static int pc_ioctl(struct tty_struct *tty, struct file * file, { /* Begin pc_ioctl */ digiflow_t dflow; - int retval, error; + int retval; unsigned long flags; unsigned int mflag, mstat; unsigned char startc, stopc; volatile struct board_chan *bc; struct channel *ch = (struct channel *) tty->driver_data; + void __user *argp = (void __user *)arg; if (ch) bc = ch->brdchan; @@ -3054,13 +3039,13 @@ static int pc_ioctl(struct tty_struct *tty, struct file * file, { /* Begin switch cmd */ case TCGETS: - if (copy_to_user((struct termios *)arg, + if (copy_to_user(argp, tty->termios, sizeof(struct termios))) return -EFAULT; return(0); case TCGETA: - return get_termio(tty, (struct termio *)arg); + return get_termio(tty, argp); case TCSBRK: /* SVID version: non-zero arg --> no break */ @@ -3090,21 +3075,16 @@ static int pc_ioctl(struct tty_struct *tty, struct file * file, return 0; case TIOCGSOFTCAR: - - error = verify_area(VERIFY_WRITE, (void *) arg,sizeof(long)); - if (error) - return error; - - putUser(C_CLOCAL(tty) ? 1 : 0, - (unsigned long *) arg); + if (put_user(C_CLOCAL(tty)?1:0, (unsigned long __user *)arg)) + return -EFAULT; return 0; case TIOCSSOFTCAR: - /*RONNIE PUT VERIFY_READ (See above) check here */ { unsigned int value; - getUser(value, (unsigned int *)arg); + if (get_user(value, (unsigned __user *)argp)) + return -EFAULT; tty->termios->c_cflag = ((tty->termios->c_cflag & ~CLOCAL) | (value ? CLOCAL : 0)); @@ -3113,12 +3093,12 @@ static int pc_ioctl(struct tty_struct *tty, struct file * file, case TIOCMODG: mflag = pc_tiocmget(tty, file); - if (putUser(mflag, (unsigned int *) arg)) + if (put_user(mflag, (unsigned long __user *)argp)) return -EFAULT; break; case TIOCMODS: - if (getUser(mstat, (unsigned int *)arg)) + if (get_user(mstat, (unsigned __user *)argp)) return -EFAULT; return pc_tiocmset(tty, file, mstat, ~mstat); @@ -3141,8 +3121,7 @@ static int pc_ioctl(struct tty_struct *tty, struct file * file, break; case DIGI_GETA: - if (copy_to_user((char*)arg, &ch->digiext, - sizeof(digi_t))) + if (copy_to_user(argp, &ch->digiext, sizeof(digi_t))) return -EFAULT; break; @@ -3164,8 +3143,7 @@ static int pc_ioctl(struct tty_struct *tty, struct file * file, /* Fall Thru */ case DIGI_SETA: - if (copy_from_user(&ch->digiext, (char*)arg, - sizeof(digi_t))) + if (copy_from_user(&ch->digiext, argp, sizeof(digi_t))) return -EFAULT; if (ch->digiext.digi_flags & DIGI_ALTPIN) @@ -3209,7 +3187,7 @@ static int pc_ioctl(struct tty_struct *tty, struct file * file, memoff(ch); restore_flags(flags); - if (copy_to_user((char*)arg, &dflow, sizeof(dflow))) + if (copy_to_user(argp, &dflow, sizeof(dflow))) return -EFAULT; break; @@ -3226,7 +3204,7 @@ static int pc_ioctl(struct tty_struct *tty, struct file * file, stopc = ch->stopca; } - if (copy_from_user(&dflow, (char*)arg, sizeof(dflow))) + if (copy_from_user(&dflow, argp, sizeof(dflow))) return -EFAULT; if (dflow.startc != startc || dflow.stopc != stopc) @@ -3555,17 +3533,9 @@ static void setup_empty_event(struct tty_struct *tty, struct channel *ch) /* --------------------- Begin get_termio ----------------------- */ -static int get_termio(struct tty_struct * tty, struct termio * termio) +static int get_termio(struct tty_struct * tty, struct termio __user * termio) { /* Begin get_termio */ - int error; - - error = verify_area(VERIFY_WRITE, termio, sizeof (struct termio)); - if (error) - return error; - - kernel_termios_to_user_termio(termio, tty->termios); - - return 0; + return kernel_termios_to_user_termio(termio, tty->termios); } /* End get_termio */ /* ---------------------- Begin epca_setup -------------------------- */ void epca_setup(char *str, int *ints) diff --git a/drivers/char/esp.c b/drivers/char/esp.c index c5b01063f3462c..663a1e24fb17b8 100644 --- a/drivers/char/esp.c +++ b/drivers/char/esp.c @@ -933,7 +933,7 @@ static int startup(struct esp_struct * info) else if (request_dma(dma, "esp serial")) { free_pages((unsigned long)dma_buffer, get_order(DMA_BUFFER_SZ)); - dma_buffer = 0; + dma_buffer = NULL; info->stat_flags |= ESP_STAT_USE_PIO; } @@ -1038,13 +1038,13 @@ static void shutdown(struct esp_struct * info) free_dma(dma); free_pages((unsigned long)dma_buffer, get_order(DMA_BUFFER_SZ)); - dma_buffer = 0; + dma_buffer = NULL; } } if (info->xmit_buf) { free_page((unsigned long) info->xmit_buf); - info->xmit_buf = 0; + info->xmit_buf = NULL; } info->IER = 0; @@ -1435,12 +1435,10 @@ static void rs_unthrottle(struct tty_struct * tty) */ static int get_serial_info(struct esp_struct * info, - struct serial_struct * retinfo) + struct serial_struct __user *retinfo) { struct serial_struct tmp; - if (!retinfo) - return -EFAULT; memset(&tmp, 0, sizeof(tmp)); tmp.type = PORT_16550A; tmp.line = info->line; @@ -1459,7 +1457,7 @@ static int get_serial_info(struct esp_struct * info, } static int get_esp_config(struct esp_struct * info, - struct hayes_esp_config * retinfo) + struct hayes_esp_config __user *retinfo) { struct hayes_esp_config tmp; @@ -1479,7 +1477,7 @@ static int get_esp_config(struct esp_struct * info, } static int set_serial_info(struct esp_struct * info, - struct serial_struct * new_info) + struct serial_struct __user *new_info) { struct serial_struct new_serial; struct esp_struct old_info; @@ -1594,7 +1592,7 @@ static int set_serial_info(struct esp_struct * info, } static int set_esp_config(struct esp_struct * info, - struct hayes_esp_config * new_info) + struct hayes_esp_config __user * new_info) { struct hayes_esp_config new_config; unsigned int change_dma; @@ -1739,7 +1737,7 @@ static int set_esp_config(struct esp_struct * info, * transmit holding register is empty. This functionality * allows an RS485 driver to be written in user space. */ -static int get_lsr_info(struct esp_struct * info, unsigned int *value) +static int get_lsr_info(struct esp_struct * info, unsigned int __user *value) { unsigned char status; unsigned int result; @@ -1834,7 +1832,8 @@ static int rs_ioctl(struct tty_struct *tty, struct file * file, { struct esp_struct * info = (struct esp_struct *)tty->driver_data; struct async_icount cprev, cnow; /* kernel counter temps */ - struct serial_icounter_struct *p_cuser; /* user space */ + struct serial_icounter_struct __user *p_cuser; /* user space */ + void __user *argp = (void __user *)arg; if (serial_paranoia_check(info, tty->name, "rs_ioctl")) return -ENODEV; @@ -1850,20 +1849,18 @@ static int rs_ioctl(struct tty_struct *tty, struct file * file, switch (cmd) { case TIOCGSERIAL: - return get_serial_info(info, - (struct serial_struct *) arg); + return get_serial_info(info, argp); case TIOCSSERIAL: - return set_serial_info(info, - (struct serial_struct *) arg); + return set_serial_info(info, argp); case TIOCSERCONFIG: /* do not reconfigure after initial configuration */ return 0; case TIOCSERGWILD: - return put_user(0L, (unsigned long *) arg); + return put_user(0L, (unsigned long __user *)argp); case TIOCSERGETLSR: /* Get line status register */ - return get_lsr_info(info, (unsigned int *) arg); + return get_lsr_info(info, argp); case TIOCSERSWILD: if (!capable(CAP_SYS_ADMIN)) @@ -1917,7 +1914,7 @@ static int rs_ioctl(struct tty_struct *tty, struct file * file, cli(); cnow = info->icount; sti(); - p_cuser = (struct serial_icounter_struct *) arg; + p_cuser = argp; if (put_user(cnow.cts, &p_cuser->cts) || put_user(cnow.dsr, &p_cuser->dsr) || put_user(cnow.rng, &p_cuser->rng) || @@ -1926,9 +1923,9 @@ static int rs_ioctl(struct tty_struct *tty, struct file * file, return 0; case TIOCGHAYESESP: - return (get_esp_config(info, (struct hayes_esp_config *)arg)); + return get_esp_config(info, argp); case TIOCSHAYESESP: - return (set_esp_config(info, (struct hayes_esp_config *)arg)); + return set_esp_config(info, argp); default: return -ENOIOCTLCMD; @@ -2076,7 +2073,7 @@ static void rs_close(struct tty_struct *tty, struct file * filp) tty->ldisc.flush_buffer(tty); tty->closing = 0; info->event = 0; - info->tty = 0; + info->tty = NULL; if (info->blocked_open) { if (info->close_delay) { @@ -2144,7 +2141,7 @@ static void esp_hangup(struct tty_struct *tty) info->event = 0; info->count = 0; info->flags &= ~ASYNC_NORMAL_ACTIVE; - info->tty = 0; + info->tty = NULL; wake_up_interruptible(&info->open_wait); } @@ -2446,7 +2443,7 @@ int __init espserial_init(void) int i, offset; int region_start; struct esp_struct * info; - struct esp_struct *last_primary = 0; + struct esp_struct *last_primary = NULL; int esp[] = {0x100,0x140,0x180,0x200,0x240,0x280,0x300,0x380}; esp_driver = alloc_tty_driver(NR_PORTS); diff --git a/drivers/char/ftape/compressor/lzrw3.c b/drivers/char/ftape/compressor/lzrw3.c index a45cd2ba5af3d3..a032a0ee2a99a9 100644 --- a/drivers/char/ftape/compressor/lzrw3.c +++ b/drivers/char/ftape/compressor/lzrw3.c @@ -115,13 +115,14 @@ LOCAL void compress_decompress(UBYTE *,UBYTE *,LONG, UBYTE *, ULONG *); /* compress a block of memory, decompress a block of memory, or to identify */ /* itself. For more information, see the specification file "compress.h". */ -EXPORT void lzrw3_compress(action,wrk_mem,src_adr,src_len,dst_adr,p_dst_len) -UWORD action; /* Action to be performed. */ -UBYTE *wrk_mem; /* Address of working memory we can use. */ -UBYTE *src_adr; /* Address of input data. */ -LONG src_len; /* Length of input data. */ -UBYTE *dst_adr; /* Address to put output data. */ -void *p_dst_len; /* Address of longword for length of output data. */ +EXPORT void lzrw3_compress( + UWORD action, /* Action to be performed. */ + UBYTE *wrk_mem, /* Address of working memory we can use.*/ + UBYTE *src_adr, /* Address of input data. */ + LONG src_len, /* Length of input data. */ + UBYTE *dst_adr, /* Address to put output data. */ + void *p_dst_len /* Address of longword for length of output data.*/ +) { switch (action) { @@ -314,9 +315,7 @@ void *p_dst_len; /* Address of longword for length of output data. */ (((40543*(((*(PTR))<<8)^((*((PTR)+1))<<4)^(*((PTR)+2))))>>4) & 0xFFF) /******************************************************************************/ - -LOCAL void compress_compress - (p_wrk_mem,p_src_first,src_len,p_dst_first,p_dst_len) + /* Input : Hand over the required amount of working memory in p_wrk_mem. */ /* Input : Specify input block using p_src_first and src_len. */ /* Input : Point p_dst_first to the start of the output zone (OZ). */ @@ -326,11 +325,9 @@ LOCAL void compress_compress /* Output : Output block in Mem[p_dst_first..p_dst_first+*p_dst_len-1]. May */ /* Output : write in OZ=Mem[p_dst_first..p_dst_first+src_len+MAX_CMP_GROUP-1].*/ /* Output : Upon completion guaranteed *p_dst_len<=src_len+FLAG_BYTES. */ -UBYTE *p_wrk_mem; -UBYTE *p_src_first; -ULONG src_len; -UBYTE *p_dst_first; -LONG *p_dst_len; +LOCAL void compress_compress(UBYTE *p_wrk_mem, + UBYTE *p_src_first, ULONG src_len, + UBYTE *p_dst_first, LONG *p_dst_len) { /* p_src and p_dst step through the source and destination blocks. */ register UBYTE *p_src = p_src_first; @@ -366,8 +363,8 @@ LONG *p_dst_len; /* to the hash table entry corresponding to the second youngest literal. */ /* Note: p_h1=0=>p_h2=0 because zero values denote absence of a pending */ /* literal. The variables are initialized to zero meaning an empty "buffer". */ - UBYTE **p_h1=0; - UBYTE **p_h2=0; + UBYTE **p_h1=NULL; + UBYTE **p_h2=NULL; /* To start, we write the flag bytes. Being optimistic, we set the flag to */ /* FLAG_COMPRESS. The remaining flag bytes are zeroed so as to keep the */ @@ -488,9 +485,9 @@ LONG *p_dst_len; /* upon the arrival of extra context bytes. */ if (p_h1!=0) { - if (p_h2!=0) - {*p_h2=p_ziv-2; p_h2=0;} - *p_h1=p_ziv-1; p_h1=0; + if (p_h2) + {*p_h2=p_ziv-2; p_h2=NULL;} + *p_h1=p_ziv-1; p_h1=NULL; } /* In any case, we can update the hash table based on the current */ @@ -564,8 +561,6 @@ LONG *p_dst_len; /******************************************************************************/ -LOCAL void compress_decompress - (p_wrk_mem,p_src_first,src_len,p_dst_first,p_dst_len) /* Input : Hand over the required amount of working memory in p_wrk_mem. */ /* Input : Specify input block using p_src_first and src_len. */ /* Input : Point p_dst_first to the start of the output zone. */ @@ -576,11 +571,9 @@ LOCAL void compress_decompress /* Output : Length of output block written to *p_dst_len. */ /* Output : Output block in Mem[p_dst_first..p_dst_first+*p_dst_len-1]. */ /* Output : Writes only in Mem[p_dst_first..p_dst_first+*p_dst_len-1]. */ -UBYTE *p_wrk_mem; -UBYTE *p_src_first; -LONG src_len; -UBYTE *p_dst_first; -ULONG *p_dst_len; +LOCAL void compress_decompress( UBYTE *p_wrk_mem, + UBYTE *p_src_first, LONG src_len, + UBYTE *p_dst_first, ULONG *p_dst_len) { /* Byte pointers p_src and p_dst scan through the input and output blocks. */ register UBYTE *p_src = p_src_first+FLAG_BYTES; diff --git a/drivers/char/ftape/compressor/zftape-compress.c b/drivers/char/ftape/compressor/zftape-compress.c index 430aa0db6b3df8..874627ab1e6283 100644 --- a/drivers/char/ftape/compressor/zftape-compress.c +++ b/drivers/char/ftape/compressor/zftape-compress.c @@ -74,10 +74,10 @@ static unsigned int zftc_rd_compressed = 0; /* forward */ static int zftc_write(int *write_cnt, __u8 *dst_buf, const int seg_sz, - const __u8 *src_buf, const int req_len, + const __u8 __user *src_buf, const int req_len, const zft_position *pos, const zft_volinfo *volume); static int zftc_read(int *read_cnt, - __u8 *dst_buf, const int to_do, + __u8 __user *dst_buf, const int to_do, const __u8 *src_buf, const int seg_sz, const zft_position *pos, const zft_volinfo *volume); static int zftc_seek(unsigned int new_block_pos, @@ -539,7 +539,7 @@ static int start_new_cseg(cmpr_info *cluster, */ static int zftc_write(int *write_cnt, __u8 *dst_buf, const int seg_sz, - const __u8 *src_buf, const int req_len, + const __u8 __user *src_buf, const int req_len, const zft_position *pos, const zft_volinfo *volume) { int req_len_left = req_len; @@ -656,7 +656,7 @@ static int zftc_write(int *write_cnt, * be set to 0 */ static int zftc_read (int *read_cnt, - __u8 *dst_buf, const int to_do, + __u8 __user *dst_buf, const int to_do, const __u8 *src_buf, const int seg_sz, const zft_position *pos, const zft_volinfo *volume) { diff --git a/drivers/char/ftape/lowlevel/ftape-init.c b/drivers/char/ftape/lowlevel/ftape-init.c index 518e7042813213..17a7f0e0c148c4 100644 --- a/drivers/char/ftape/lowlevel/ftape-init.c +++ b/drivers/char/ftape/lowlevel/ftape-init.c @@ -90,7 +90,7 @@ KERN_INFO "Compiled for Linux version %s\n", UTS_RELEASE); TRACE(ft_t_info, "ftape_init @ 0x%p", ftape_init); /* Allocate the DMA buffers. They are deallocated at cleanup() time. */ -#if TESTING +#ifdef TESTING #ifdef MODULE while (ftape_set_nr_buffers(CONFIG_FT_NR_BUFFERS) < 0) { ftape_sleep(FT_SECOND/20); diff --git a/drivers/char/ftape/lowlevel/ftape-proc.c b/drivers/char/ftape/lowlevel/ftape-proc.c index 6b8844ff455c1f..1e27c908eeee35 100644 --- a/drivers/char/ftape/lowlevel/ftape-proc.c +++ b/drivers/char/ftape/lowlevel/ftape-proc.c @@ -192,7 +192,7 @@ int ftape_read_proc(char *page, char **start, off_t off, ptr += get_history_info(ptr); len = strlen(page); - *start = 0; + *start = NULL; if (off+count >= len) { *eof = 1; } else { diff --git a/drivers/char/ftape/zftape/zftape-ctl.c b/drivers/char/ftape/zftape/zftape-ctl.c index 93010ccaa85268..6c7874e5c199ec 100644 --- a/drivers/char/ftape/zftape/zftape-ctl.c +++ b/drivers/char/ftape/zftape/zftape-ctl.c @@ -1319,7 +1319,7 @@ ftmtcmd_error: /* IOCTL routine called by kernel-interface code */ -int _zft_ioctl(unsigned int command, void * arg) +int _zft_ioctl(unsigned int command, void __user * arg) { int result; union { struct mtop mtop; diff --git a/drivers/char/ftape/zftape/zftape-ctl.h b/drivers/char/ftape/zftape/zftape-ctl.h index 6c5a2532a3cc16..4141598919906a 100644 --- a/drivers/char/ftape/zftape/zftape-ctl.h +++ b/drivers/char/ftape/zftape/zftape-ctl.h @@ -52,7 +52,7 @@ extern int zft_def_idle_state(void); */ extern int _zft_open(unsigned int dev_minor, unsigned int access_mode); extern int _zft_close(void); -extern int _zft_ioctl(unsigned int command, void *arg); +extern int _zft_ioctl(unsigned int command, void __user *arg); #endif diff --git a/drivers/char/ftape/zftape/zftape-init.c b/drivers/char/ftape/zftape/zftape-init.c index 1fc5feaf992262..95666a2ebe13ed 100644 --- a/drivers/char/ftape/zftape/zftape-init.c +++ b/drivers/char/ftape/zftape/zftape-init.c @@ -88,9 +88,9 @@ static int zft_close(struct inode *ino, struct file *filep); static int zft_ioctl(struct inode *ino, struct file *filep, unsigned int command, unsigned long arg); static int zft_mmap(struct file *filep, struct vm_area_struct *vma); -static ssize_t zft_read (struct file *fp, char *buff, +static ssize_t zft_read (struct file *fp, char __user *buff, size_t req_len, loff_t *ppos); -static ssize_t zft_write(struct file *fp, const char *buff, +static ssize_t zft_write(struct file *fp, const char __user *buff, size_t req_len, loff_t *ppos); static struct file_operations zft_cdev = @@ -177,7 +177,7 @@ static int zft_ioctl(struct inode *ino, struct file *filep, old_sigmask = current->blocked; /* save mask */ sigfillset(¤t->blocked); /* This will work as long as sizeof(void *) == sizeof(long) */ - result = _zft_ioctl(command, (void *) arg); + result = _zft_ioctl(command, (void __user *) arg); current->blocked = old_sigmask; /* restore mask */ TRACE_EXIT result; } @@ -211,7 +211,7 @@ static int zft_mmap(struct file *filep, struct vm_area_struct *vma) /* Read from floppy tape device */ -static ssize_t zft_read(struct file *fp, char *buff, +static ssize_t zft_read(struct file *fp, char __user *buff, size_t req_len, loff_t *ppos) { int result = -EIO; @@ -234,7 +234,7 @@ static ssize_t zft_read(struct file *fp, char *buff, /* Write to tape device */ -static ssize_t zft_write(struct file *fp, const char *buff, +static ssize_t zft_write(struct file *fp, const char __user *buff, size_t req_len, loff_t *ppos) { int result = -EIO; diff --git a/drivers/char/ftape/zftape/zftape-init.h b/drivers/char/ftape/zftape/zftape-init.h index 5f9ce2eef1ff83..2145892b9eea7b 100644 --- a/drivers/char/ftape/zftape/zftape-init.h +++ b/drivers/char/ftape/zftape/zftape-init.h @@ -52,10 +52,10 @@ extern const ftape_info *zft_status; /* needed for zftape-vtbl.h */ struct zft_cmpr_ops { int (*write)(int *write_cnt, __u8 *dst_buf, const int seg_sz, - const __u8 *src_buf, const int req_len, + const __u8 __user *src_buf, const int req_len, const zft_position *pos, const zft_volinfo *volume); int (*read)(int *read_cnt, - __u8 *dst_buf, const int req_len, + __u8 __user *dst_buf, const int req_len, const __u8 *src_buf, const int seg_sz, const zft_position *pos, const zft_volinfo *volume); int (*seek)(unsigned int new_block_pos, diff --git a/drivers/char/ftape/zftape/zftape-read.c b/drivers/char/ftape/zftape/zftape-read.c index 42de63254e5354..214bf03dce687b 100644 --- a/drivers/char/ftape/zftape/zftape-read.c +++ b/drivers/char/ftape/zftape/zftape-read.c @@ -154,7 +154,7 @@ int zft_fetch_segment_fraction(const unsigned int segment, void *buffer, * amount of data actually * copied to the user-buffer */ static int zft_simple_read (int *read_cnt, - __u8 *dst_buf, + __u8 __user *dst_buf, const int to_do, const __u8 *src_buf, const int seg_sz, @@ -252,7 +252,7 @@ static int check_read_access(int *req_len, * req_len: how much data should be read at most. * volume: contains information on current volume (blk_sz etc.) */ -static int empty_deblock_buf(__u8 *usr_buf, const int req_len, +static int empty_deblock_buf(__u8 __user *usr_buf, const int req_len, const __u8 *src_buf, const int seg_sz, zft_position *pos, const zft_volinfo *volume) @@ -293,7 +293,7 @@ static int empty_deblock_buf(__u8 *usr_buf, const int req_len, * use small block-sizes. The block-size may be 1kb (SECTOR_SIZE). In * this case a MTFSR 28 maybe still inside the same segment. */ -int _zft_read(char* buff, int req_len) +int _zft_read(char __user *buff, int req_len) { int req_clipped; int result = 0; diff --git a/drivers/char/ftape/zftape/zftape-read.h b/drivers/char/ftape/zftape/zftape-read.h index ad2e9dbc4f5548..42941de0c23a9e 100644 --- a/drivers/char/ftape/zftape/zftape-read.h +++ b/drivers/char/ftape/zftape/zftape-read.h @@ -48,6 +48,6 @@ extern int zft_fetch_segment_fraction(const unsigned int segment, 0, FT_SEGMENT_SIZE) /* hook for the VFS interface */ -extern int _zft_read(char* buff, int req_len); +extern int _zft_read(char __user *buff, int req_len); #endif /* _ZFTAPE_READ_H */ diff --git a/drivers/char/ftape/zftape/zftape-write.c b/drivers/char/ftape/zftape/zftape-write.c index 43129fdf0b0f00..94327b8c97b948 100644 --- a/drivers/char/ftape/zftape/zftape-write.c +++ b/drivers/char/ftape/zftape/zftape-write.c @@ -303,7 +303,7 @@ int zft_flush_buffers(void) */ static int zft_simple_write(int *cnt, __u8 *dst_buf, const int seg_sz, - const __u8 *src_buf, const int req_len, + const __u8 __user *src_buf, const int req_len, const zft_position *pos,const zft_volinfo *volume) { int space_left; @@ -379,7 +379,7 @@ static int check_write_access(int req_len, static int fill_deblock_buf(__u8 *dst_buf, const int seg_sz, zft_position *pos, const zft_volinfo *volume, - const char *usr_buf, const int req_len) + const char __user *usr_buf, const int req_len) { int cnt = 0; int result = 0; @@ -420,7 +420,7 @@ static int fill_deblock_buf(__u8 *dst_buf, const int seg_sz, /* called by the kernel-interface routine "zft_write()" */ -int _zft_write(const char* buff, int req_len) +int _zft_write(const char __user *buff, int req_len) { int result = 0; int written = 0; diff --git a/drivers/char/ftape/zftape/zftape-write.h b/drivers/char/ftape/zftape/zftape-write.h index 4a8d47687c3bee..ea887015b493d9 100644 --- a/drivers/char/ftape/zftape/zftape-write.h +++ b/drivers/char/ftape/zftape/zftape-write.h @@ -34,5 +34,5 @@ extern void zft_prevent_flush(void); /* hook for the VFS interface */ -extern int _zft_write(const char *buff, int req_len); +extern int _zft_write(const char __user *buff, int req_len); #endif /* _ZFTAPE_WRITE_H */ diff --git a/drivers/char/generic_serial.c b/drivers/char/generic_serial.c index 1f278a42e3cbdd..1027eb7c6e4c83 100644 --- a/drivers/char/generic_serial.c +++ b/drivers/char/generic_serial.c @@ -45,7 +45,7 @@ static int gs_debug; #define func_enter() gs_dprintk (GS_DEBUG_FLOW, "gs: enter %s\n", __FUNCTION__) #define func_exit() gs_dprintk (GS_DEBUG_FLOW, "gs: exit %s\n", __FUNCTION__) -#if NEW_WRITE_LOCKING +#ifdef NEW_WRITE_LOCKING #define DECL /* Nothing */ #define LOCKIT down (& port->port_write_sem); #define RELEASEIT up (&port->port_write_sem); @@ -526,7 +526,7 @@ void gs_shutdown_port (struct gs_port *port) if (port->xmit_buf) { free_page((unsigned long) port->xmit_buf); - port->xmit_buf = 0; + port->xmit_buf = NULL; } if (port->tty) @@ -767,7 +767,7 @@ void gs_close(struct tty_struct * tty, struct file * filp) port->event = 0; port->rd->close (port); port->rd->shutdown_port (port); - port->tty = 0; + port->tty = NULL; if (port->blocked_open) { if (port->close_delay) { @@ -967,7 +967,7 @@ int gs_init_port(struct gs_port *port) } -int gs_setserial(struct gs_port *port, struct serial_struct *sp) +int gs_setserial(struct gs_port *port, struct serial_struct __user *sp) { struct serial_struct sio; @@ -1002,7 +1002,7 @@ int gs_setserial(struct gs_port *port, struct serial_struct *sp) * Generate the serial struct info. */ -int gs_getserial(struct gs_port *port, struct serial_struct *sp) +int gs_getserial(struct gs_port *port, struct serial_struct __user *sp) { struct serial_struct sio; diff --git a/drivers/char/ip2main.c b/drivers/char/ip2main.c index d5c18535bbfae4..ac97e617a10783 100644 --- a/drivers/char/ip2main.c +++ b/drivers/char/ip2main.c @@ -203,16 +203,16 @@ static void ip2_wait_until_sent(PTTY,int); static void set_params (i2ChanStrPtr, struct termios *); static int set_modem_info(i2ChanStrPtr, unsigned int, unsigned int *); -static int get_serial_info(i2ChanStrPtr, struct serial_struct *); -static int set_serial_info(i2ChanStrPtr, struct serial_struct *); +static int get_serial_info(i2ChanStrPtr, struct serial_struct __user *); +static int set_serial_info(i2ChanStrPtr, struct serial_struct __user *); -static ssize_t ip2_ipl_read(struct file *, char *, size_t, loff_t *); -static ssize_t ip2_ipl_write(struct file *, const char *, size_t, loff_t *); +static ssize_t ip2_ipl_read(struct file *, char __user *, size_t, loff_t *); +static ssize_t ip2_ipl_write(struct file *, const char __user *, size_t, loff_t *); static int ip2_ipl_ioctl(struct inode *, struct file *, UINT, ULONG); static int ip2_ipl_open(struct inode *, struct file *); -static int DumpTraceBuffer(char *, int); -static int DumpFifoBuffer( char *, int); +static int DumpTraceBuffer(char __user *, int); +static int DumpFifoBuffer( char __user *, int); static void ip2_init_board(int); static unsigned short find_eisa_board(int); @@ -1121,7 +1121,7 @@ set_irq( int boardnum, int boardIrq ) /******************************************************************************/ static inline void -service_all_boards() +service_all_boards(void) { int i; i2eBordStrPtr pB; @@ -2082,9 +2082,10 @@ ip2_ioctl ( PTTY tty, struct file *pFile, UINT cmd, ULONG arg ) wait_queue_t wait; i2ChanStrPtr pCh = DevTable[tty->index]; struct async_icount cprev, cnow; /* kernel counter temps */ - struct serial_icounter_struct *p_cuser; /* user space */ + struct serial_icounter_struct __user *p_cuser; int rc = 0; unsigned long flags; + void __user *argp = (void __user *)arg; if ( pCh == NULL ) { return -ENODEV; @@ -2101,7 +2102,7 @@ ip2_ioctl ( PTTY tty, struct file *pFile, UINT cmd, ULONG arg ) ip2trace (CHANN, ITRC_IOCTL, 2, 1, rc ); - rc = get_serial_info(pCh, (struct serial_struct *) arg); + rc = get_serial_info(pCh, argp); if (rc) return rc; break; @@ -2110,7 +2111,7 @@ ip2_ioctl ( PTTY tty, struct file *pFile, UINT cmd, ULONG arg ) ip2trace (CHANN, ITRC_IOCTL, 3, 1, rc ); - rc = set_serial_info(pCh, (struct serial_struct *) arg); + rc = set_serial_info(pCh, argp); if (rc) return rc; break; @@ -2174,7 +2175,7 @@ ip2_ioctl ( PTTY tty, struct file *pFile, UINT cmd, ULONG arg ) ip2trace (CHANN, ITRC_IOCTL, 6, 1, rc ); - rc = put_user(C_CLOCAL(tty) ? 1 : 0, (unsigned long *) arg); + rc = put_user(C_CLOCAL(tty) ? 1 : 0, (unsigned long __user *)argp); if (rc) return rc; break; @@ -2183,7 +2184,7 @@ ip2_ioctl ( PTTY tty, struct file *pFile, UINT cmd, ULONG arg ) ip2trace (CHANN, ITRC_IOCTL, 7, 1, rc ); - rc = get_user(arg,(unsigned long *) arg); + rc = get_user(arg,(unsigned long __user *) argp); if (rc) return rc; tty->termios->c_cflag = ((tty->termios->c_cflag & ~CLOCAL) @@ -2262,7 +2263,7 @@ ip2_ioctl ( PTTY tty, struct file *pFile, UINT cmd, ULONG arg ) save_flags(flags);cli(); cnow = pCh->icount; restore_flags(flags); - p_cuser = (struct serial_icounter_struct *) arg; + p_cuser = argp; rc = put_user(cnow.cts, &p_cuser->cts); rc = put_user(cnow.dsr, &p_cuser->dsr); rc = put_user(cnow.rng, &p_cuser->rng); @@ -2311,14 +2312,9 @@ ip2_ioctl ( PTTY tty, struct file *pFile, UINT cmd, ULONG arg ) /* standard Linux serial structure. */ /******************************************************************************/ static int -get_serial_info ( i2ChanStrPtr pCh, struct serial_struct *retinfo ) +get_serial_info ( i2ChanStrPtr pCh, struct serial_struct __user *retinfo ) { struct serial_struct tmp; - int rc; - - if ( !retinfo ) { - return -EFAULT; - } memset ( &tmp, 0, sizeof(tmp) ); tmp.type = pCh->pMyBord->channelBtypes.bid_value[(pCh->port_index & (IP2_PORTS_PER_BOARD-1))/16]; @@ -2335,8 +2331,7 @@ get_serial_info ( i2ChanStrPtr pCh, struct serial_struct *retinfo ) tmp.close_delay = pCh->ClosingDelay; tmp.closing_wait = pCh->ClosingWaitTime; tmp.custom_divisor = pCh->BaudDivisor; - rc = copy_to_user(retinfo,&tmp,sizeof(*retinfo)); - return rc; + return copy_to_user(retinfo,&tmp,sizeof(*retinfo)); } /******************************************************************************/ @@ -2351,18 +2346,13 @@ get_serial_info ( i2ChanStrPtr pCh, struct serial_struct *retinfo ) /* change the IRQ, address or type of the port the ioctl fails. */ /******************************************************************************/ static int -set_serial_info( i2ChanStrPtr pCh, struct serial_struct *new_info ) +set_serial_info( i2ChanStrPtr pCh, struct serial_struct __user *new_info ) { struct serial_struct ns; int old_flags, old_baud_divisor; - if ( !new_info ) { + if (copy_from_user(&ns, new_info, sizeof (ns))) return -EFAULT; - } - - if (copy_from_user(&ns, new_info, sizeof (ns))) { - return -EFAULT; - } /* * We don't allow setserial to change IRQ, board address, type or baud @@ -2727,7 +2717,7 @@ service_it: static ssize_t -ip2_ipl_read(struct file *pFile, char *pData, size_t count, loff_t *off ) +ip2_ipl_read(struct file *pFile, char __user *pData, size_t count, loff_t *off ) { unsigned int minor = iminor(pFile->f_dentry->d_inode); int rc = 0; @@ -2760,7 +2750,7 @@ ip2_ipl_read(struct file *pFile, char *pData, size_t count, loff_t *off ) } static int -DumpFifoBuffer ( char *pData, int count ) +DumpFifoBuffer ( char __user *pData, int count ) { #ifdef DEBUG_FIFO int rc; @@ -2774,13 +2764,13 @@ DumpFifoBuffer ( char *pData, int count ) } static int -DumpTraceBuffer ( char *pData, int count ) +DumpTraceBuffer ( char __user *pData, int count ) { #ifdef IP2DEBUG_TRACE int rc; int dumpcount; int chunk; - int *pIndex = (int*)pData; + int *pIndex = (int __user *)pData; if ( count < (sizeof(int) * 6) ) { return -EIO; @@ -2836,7 +2826,7 @@ DumpTraceBuffer ( char *pData, int count ) /* */ /******************************************************************************/ static ssize_t -ip2_ipl_write(struct file *pFile, const char *pData, size_t count, loff_t *off) +ip2_ipl_write(struct file *pFile, const char __user *pData, size_t count, loff_t *off) { #ifdef IP2DEBUG_IPL printk (KERN_DEBUG "IP2IPL: write %p, %d bytes\n", pData, count ); @@ -2861,7 +2851,8 @@ ip2_ipl_ioctl ( struct inode *pInode, struct file *pFile, UINT cmd, ULONG arg ) { unsigned int iplminor = iminor(pInode); int rc = 0; - ULONG *pIndex = (ULONG*)arg; + void __user *argp = (void __user *)arg; + ULONG __user *pIndex = argp; i2eBordStrPtr pB = i2BoardPtrTable[iplminor / 4]; i2ChanStrPtr pCh; @@ -2886,9 +2877,9 @@ ip2_ipl_ioctl ( struct inode *pInode, struct file *pFile, UINT cmd, ULONG arg ) case 65: /* Board - ip2stat */ if ( pB ) { - rc = copy_to_user((char*)arg, (char*)pB, sizeof(i2eBordStr) ); + rc = copy_to_user(argp, pB, sizeof(i2eBordStr)); rc = put_user(INB(pB->i2eStatus), - (ULONG*)(arg + (ULONG)(&pB->i2eStatus) - (ULONG)pB ) ); + (ULONG __user *)(arg + (ULONG)(&pB->i2eStatus) - (ULONG)pB ) ); } else { rc = -ENODEV; } @@ -2899,7 +2890,7 @@ ip2_ipl_ioctl ( struct inode *pInode, struct file *pFile, UINT cmd, ULONG arg ) pCh = DevTable[cmd]; if ( pCh ) { - rc = copy_to_user((char*)arg, (char*)pCh, sizeof(i2ChanStr) ); + rc = copy_to_user(argp, pCh, sizeof(i2ChanStr)); } else { rc = -ENODEV; } diff --git a/drivers/char/ipmi/ipmi_si_intf.c b/drivers/char/ipmi/ipmi_si_intf.c index 2cfcda1db36907..ea330f3ff7a960 100644 --- a/drivers/char/ipmi/ipmi_si_intf.c +++ b/drivers/char/ipmi/ipmi_si_intf.c @@ -51,7 +51,7 @@ #include <linux/list.h> #include <linux/pci.h> #include <linux/ioport.h> -#include <linux/irq.h> +#include <asm/irq.h> #ifdef CONFIG_HIGH_RES_TIMERS #include <linux/hrtime.h> # if defined(schedule_next_int) diff --git a/drivers/char/isicom.c b/drivers/char/isicom.c index c609ebb964d887..e8650449f9ee80 100644 --- a/drivers/char/isicom.c +++ b/drivers/char/isicom.c @@ -90,7 +90,7 @@ static int ISILoad_ioctl(struct inode *inode, struct file *filp, unsigned int c static void isicom_tx(unsigned long _data); static void isicom_start(struct tty_struct * tty); -static unsigned char * tmp_buf = 0; +static unsigned char * tmp_buf; static DECLARE_MUTEX(tmp_buf_sem); /* baud index mappings from linux defns to isi */ @@ -132,9 +132,10 @@ static int ISILoad_ioctl(struct inode *inode, struct file *filp, unsigned long t; unsigned short word_count, base; bin_frame frame; + void __user *argp = (void __user *)arg; /* exec_record exec_rec; */ - if(get_user(card, (int *)arg)) + if(get_user(card, (int __user *)argp)) return -EFAULT; if(card < 0 || card >= BOARD_COUNT) @@ -208,13 +209,13 @@ static int ISILoad_ioctl(struct inode *inode, struct file *filp, return -EIO; } printk("-Done\n"); - return put_user(signature,(unsigned int*)arg); + return put_user(signature,(unsigned __user *)argp); case MIOCTL_LOAD_FIRMWARE: if (!capable(CAP_SYS_ADMIN)) return -EPERM; - if(copy_from_user(&frame, (void *) arg, sizeof(bin_frame))) + if(copy_from_user(&frame, argp, sizeof(bin_frame))) return -EFAULT; if (WaitTillCardIsFree(base)) @@ -257,7 +258,7 @@ static int ISILoad_ioctl(struct inode *inode, struct file *filp, if (!capable(CAP_SYS_ADMIN)) return -EPERM; - if(copy_from_user(&frame, (void *) arg, sizeof(bin_header))) + if(copy_from_user(&frame, argp, sizeof(bin_header))) return -EFAULT; if (WaitTillCardIsFree(base)) @@ -296,7 +297,7 @@ static int ISILoad_ioctl(struct inode *inode, struct file *filp, return -EIO; } - if(copy_to_user((void *) arg, &frame, sizeof(bin_frame))) + if(copy_to_user(argp, &frame, sizeof(bin_frame))) return -EFAULT; return 0; @@ -1121,7 +1122,7 @@ static void isicom_close(struct tty_struct * tty, struct file * filp) if (tty->ldisc.flush_buffer) tty->ldisc.flush_buffer(tty); tty->closing = 0; - port->tty = 0; + port->tty = NULL; if (port->blocked_open) { if (port->close_delay) { set_current_state(TASK_INTERRUPTIBLE); @@ -1334,7 +1335,7 @@ static int isicom_tiocmset(struct tty_struct *tty, struct file *file, } static int isicom_set_serial_info(struct isi_port * port, - struct serial_struct * info) + struct serial_struct __user *info) { struct serial_struct newinfo; unsigned long flags; @@ -1370,7 +1371,7 @@ static int isicom_set_serial_info(struct isi_port * port, } static int isicom_get_serial_info(struct isi_port * port, - struct serial_struct * info) + struct serial_struct __user *info) { struct serial_struct out_info; @@ -1392,6 +1393,7 @@ static int isicom_ioctl(struct tty_struct * tty, struct file * filp, unsigned int cmd, unsigned long arg) { struct isi_port * port = (struct isi_port *) tty->driver_data; + void __user *argp = (void __user *)arg; int retval; if (isicom_paranoia_check(port, tty->name, "isicom_ioctl")) @@ -1416,10 +1418,10 @@ static int isicom_ioctl(struct tty_struct * tty, struct file * filp, return 0; case TIOCGSOFTCAR: - return put_user(C_CLOCAL(tty) ? 1 : 0, (unsigned long *) arg); + return put_user(C_CLOCAL(tty) ? 1 : 0, (unsigned long __user *)argp); case TIOCSSOFTCAR: - if(get_user(arg, (unsigned long *) arg)) + if(get_user(arg, (unsigned long __user *) argp)) return -EFAULT; tty->termios->c_cflag = ((tty->termios->c_cflag & ~CLOCAL) | @@ -1427,12 +1429,10 @@ static int isicom_ioctl(struct tty_struct * tty, struct file * filp, return 0; case TIOCGSERIAL: - return isicom_get_serial_info(port, - (struct serial_struct *) arg); + return isicom_get_serial_info(port, argp); case TIOCSSERIAL: - return isicom_set_serial_info(port, - (struct serial_struct *) arg); + return isicom_set_serial_info(port, argp); default: return -ENOIOCTLCMD; @@ -1545,7 +1545,7 @@ static void isicom_hangup(struct tty_struct * tty) isicom_shutdown_port(port); port->count = 0; port->flags &= ~ASYNC_NORMAL_ACTIVE; - port->tty = 0; + port->tty = NULL; wake_up_interruptible(&port->open_wait); } diff --git a/drivers/char/istallion.c b/drivers/char/istallion.c index ba5229b7c6e3fc..4a8b7d51ecdf90 100644 --- a/drivers/char/istallion.c +++ b/drivers/char/istallion.c @@ -680,8 +680,8 @@ static int stli_portinfo(stlibrd_t *brdp, stliport_t *portp, int portnr, char *p static int stli_brdinit(stlibrd_t *brdp); static int stli_startbrd(stlibrd_t *brdp); -static ssize_t stli_memread(struct file *fp, char *buf, size_t count, loff_t *offp); -static ssize_t stli_memwrite(struct file *fp, const char *buf, size_t count, loff_t *offp); +static ssize_t stli_memread(struct file *fp, char __user *buf, size_t count, loff_t *offp); +static ssize_t stli_memwrite(struct file *fp, const char __user *buf, size_t count, loff_t *offp); static int stli_memioctl(struct inode *ip, struct file *fp, unsigned int cmd, unsigned long arg); static void stli_brdpoll(stlibrd_t *brdp, volatile cdkhdr_t *hdrp); static void stli_poll(unsigned long arg); @@ -700,14 +700,14 @@ static void stli_mkasyport(stliport_t *portp, asyport_t *pp, struct termios *tio static void stli_mkasysigs(asysigs_t *sp, int dtr, int rts); static long stli_mktiocm(unsigned long sigvalue); static void stli_read(stlibrd_t *brdp, stliport_t *portp); -static int stli_getserial(stliport_t *portp, struct serial_struct *sp); -static int stli_setserial(stliport_t *portp, struct serial_struct *sp); -static int stli_getbrdstats(combrd_t *bp); -static int stli_getportstats(stliport_t *portp, comstats_t *cp); +static int stli_getserial(stliport_t *portp, struct serial_struct __user *sp); +static int stli_setserial(stliport_t *portp, struct serial_struct __user *sp); +static int stli_getbrdstats(combrd_t __user *bp); +static int stli_getportstats(stliport_t *portp, comstats_t __user *cp); static int stli_portcmdstats(stliport_t *portp); -static int stli_clrportstats(stliport_t *portp, comstats_t *cp); -static int stli_getportstruct(unsigned long arg); -static int stli_getbrdstruct(unsigned long arg); +static int stli_clrportstats(stliport_t *portp, comstats_t __user *cp); +static int stli_getportstruct(stliport_t __user *arg); +static int stli_getbrdstruct(stlibrd_t __user *arg); static void *stli_memalloc(int len); static stlibrd_t *stli_allocbrd(void); @@ -808,7 +808,7 @@ static int __init istallion_module_init(void) { unsigned long flags; -#if DEBUG +#ifdef DEBUG printk("init_module()\n"); #endif @@ -829,7 +829,7 @@ static void __exit istallion_module_exit(void) unsigned long flags; int i, j; -#if DEBUG +#ifdef DEBUG printk("cleanup_module()\n"); #endif @@ -901,13 +901,13 @@ module_exit(istallion_module_exit); * Check for any arguments passed in on the module load command line. */ -static void stli_argbrds() +static void stli_argbrds(void) { stlconf_t conf; stlibrd_t *brdp; int nrargs, i; -#if DEBUG +#ifdef DEBUG printk("stli_argbrds()\n"); #endif @@ -975,7 +975,7 @@ static int stli_parsebrd(stlconf_t *confp, char **argp) char *sp; int nrbrdnames, i; -#if DEBUG +#ifdef DEBUG printk("stli_parsebrd(confp=%x,argp=%x)\n", (int) confp, (int) argp); #endif @@ -1025,7 +1025,7 @@ static int stli_open(struct tty_struct *tty, struct file *filp) unsigned int minordev; int brdnr, portnr, rc; -#if DEBUG +#ifdef DEBUG printk("stli_open(tty=%x,filp=%x): device=%s\n", (int) tty, (int) filp, tty->name); #endif @@ -1125,7 +1125,7 @@ static void stli_close(struct tty_struct *tty, struct file *filp) stliport_t *portp; unsigned long flags; -#if DEBUG +#ifdef DEBUG printk("stli_close(tty=%x,filp=%x)\n", (int) tty, (int) filp); #endif @@ -1210,7 +1210,7 @@ static int stli_initopen(stlibrd_t *brdp, stliport_t *portp) asyport_t aport; int rc; -#if DEBUG +#ifdef DEBUG printk("stli_initopen(brdp=%x,portp=%x)\n", (int) brdp, (int) portp); #endif @@ -1263,7 +1263,7 @@ static int stli_rawopen(stlibrd_t *brdp, stliport_t *portp, unsigned long arg, i unsigned long flags; int rc; -#if DEBUG +#ifdef DEBUG printk("stli_rawopen(brdp=%x,portp=%x,arg=%x,wait=%d)\n", (int) brdp, (int) portp, (int) arg, wait); #endif @@ -1344,7 +1344,7 @@ static int stli_rawclose(stlibrd_t *brdp, stliport_t *portp, unsigned long arg, unsigned long flags; int rc; -#if DEBUG +#ifdef DEBUG printk("stli_rawclose(brdp=%x,portp=%x,arg=%x,wait=%d)\n", (int) brdp, (int) portp, (int) arg, wait); #endif @@ -1417,7 +1417,7 @@ static int stli_cmdwait(stlibrd_t *brdp, stliport_t *portp, unsigned long cmd, v { unsigned long flags; -#if DEBUG +#ifdef DEBUG printk("stli_cmdwait(brdp=%x,portp=%x,cmd=%x,arg=%x,size=%d," "copyback=%d)\n", (int) brdp, (int) portp, (int) cmd, (int) arg, size, copyback); @@ -1461,7 +1461,7 @@ static int stli_setport(stliport_t *portp) stlibrd_t *brdp; asyport_t aport; -#if DEBUG +#ifdef DEBUG printk("stli_setport(portp=%x)\n", (int) portp); #endif @@ -1489,7 +1489,7 @@ static int stli_setport(stliport_t *portp) static void stli_delay(int len) { -#if DEBUG +#ifdef DEBUG printk("stli_delay(len=%d)\n", len); #endif if (len > 0) { @@ -1510,7 +1510,7 @@ static int stli_waitcarrier(stlibrd_t *brdp, stliport_t *portp, struct file *fil unsigned long flags; int rc, doclocal; -#if DEBUG +#ifdef DEBUG printk("stli_waitcarrier(brdp=%x,portp=%x,filp=%x)\n", (int) brdp, (int) portp, (int) filp); #endif @@ -1578,7 +1578,7 @@ static int stli_write(struct tty_struct *tty, int from_user, const unsigned char unsigned int len, stlen, head, tail, size; unsigned long flags; -#if DEBUG +#ifdef DEBUG printk("stli_write(tty=%x,from_user=%d,buf=%x,count=%d)\n", (int) tty, from_user, (int) buf, count); #endif @@ -1699,7 +1699,7 @@ static int stli_write(struct tty_struct *tty, int from_user, const unsigned char static void stli_putchar(struct tty_struct *tty, unsigned char ch) { -#if DEBUG +#ifdef DEBUG printk("stli_putchar(tty=%x,ch=%x)\n", (int) tty, (int) ch); #endif @@ -1736,7 +1736,7 @@ static void stli_flushchars(struct tty_struct *tty) unsigned char *buf, *shbuf; unsigned long flags; -#if DEBUG +#ifdef DEBUG printk("stli_flushchars(tty=%x)\n", (int) tty); #endif @@ -1827,7 +1827,7 @@ static int stli_writeroom(struct tty_struct *tty) unsigned int head, tail, len; unsigned long flags; -#if DEBUG +#ifdef DEBUG printk("stli_writeroom(tty=%x)\n", (int) tty); #endif @@ -1887,7 +1887,7 @@ static int stli_charsinbuffer(struct tty_struct *tty) unsigned int head, tail, len; unsigned long flags; -#if DEBUG +#ifdef DEBUG printk("stli_charsinbuffer(tty=%x)\n", (int) tty); #endif @@ -1927,12 +1927,12 @@ static int stli_charsinbuffer(struct tty_struct *tty) * Generate the serial struct info. */ -static int stli_getserial(stliport_t *portp, struct serial_struct *sp) +static int stli_getserial(stliport_t *portp, struct serial_struct __user *sp) { struct serial_struct sio; stlibrd_t *brdp; -#if DEBUG +#ifdef DEBUG printk("stli_getserial(portp=%x,sp=%x)\n", (int) portp, (int) sp); #endif @@ -1964,13 +1964,13 @@ static int stli_getserial(stliport_t *portp, struct serial_struct *sp) * just quietly ignore any requests to change irq, etc. */ -static int stli_setserial(stliport_t *portp, struct serial_struct *sp) +static int stli_setserial(stliport_t *portp, struct serial_struct __user *sp) { struct serial_struct sio; int rc; -#if DEBUG - printk("stli_setserial(portp=%x,sp=%x)\n", (int) portp, (int) sp); +#ifdef DEBUG + printk("stli_setserial(portp=%p,sp=%p)\n", portp, sp); #endif if (copy_from_user(&sio, sp, sizeof(struct serial_struct))) @@ -2058,8 +2058,9 @@ static int stli_ioctl(struct tty_struct *tty, struct file *file, unsigned int cm stlibrd_t *brdp; unsigned int ival; int rc; + void __user *argp = (void __user *)arg; -#if DEBUG +#ifdef DEBUG printk("stli_ioctl(tty=%x,file=%x,cmd=%x,arg=%x)\n", (int) tty, (int) file, cmd, (int) arg); #endif @@ -2086,40 +2087,32 @@ static int stli_ioctl(struct tty_struct *tty, struct file *file, unsigned int cm switch (cmd) { case TIOCGSOFTCAR: rc = put_user(((tty->termios->c_cflag & CLOCAL) ? 1 : 0), - (unsigned int *) arg); + (unsigned __user *) arg); break; case TIOCSSOFTCAR: - if ((rc = get_user(ival, (unsigned int *) arg)) == 0) + if ((rc = get_user(ival, (unsigned __user *) arg)) == 0) tty->termios->c_cflag = (tty->termios->c_cflag & ~CLOCAL) | (ival ? CLOCAL : 0); break; case TIOCGSERIAL: - if ((rc = verify_area(VERIFY_WRITE, (void *) arg, - sizeof(struct serial_struct))) == 0) - rc = stli_getserial(portp, (struct serial_struct *) arg); + rc = stli_getserial(portp, argp); break; case TIOCSSERIAL: - if ((rc = verify_area(VERIFY_READ, (void *) arg, - sizeof(struct serial_struct))) == 0) - rc = stli_setserial(portp, (struct serial_struct *)arg); + rc = stli_setserial(portp, argp); break; case STL_GETPFLAG: - rc = put_user(portp->pflag, (unsigned int *) arg); + rc = put_user(portp->pflag, (unsigned __user *)argp); break; case STL_SETPFLAG: - if ((rc = get_user(portp->pflag, (unsigned int *) arg)) == 0) + if ((rc = get_user(portp->pflag, (unsigned __user *)argp)) == 0) stli_setport(portp); break; case COM_GETPORTSTATS: - if ((rc = verify_area(VERIFY_WRITE, (void *) arg, - sizeof(comstats_t))) == 0) - rc = stli_getportstats(portp, (comstats_t *) arg); + rc = stli_getportstats(portp, argp); break; case COM_CLRPORTSTATS: - if ((rc = verify_area(VERIFY_WRITE, (void *) arg, - sizeof(comstats_t))) == 0) - rc = stli_clrportstats(portp, (comstats_t *) arg); + rc = stli_clrportstats(portp, argp); break; case TIOCSERCONFIG: case TIOCSERGWILD: @@ -2150,7 +2143,7 @@ static void stli_settermios(struct tty_struct *tty, struct termios *old) struct termios *tiosp; asyport_t aport; -#if DEBUG +#ifdef DEBUG printk("stli_settermios(tty=%x,old=%x)\n", (int) tty, (int) old); #endif @@ -2197,7 +2190,7 @@ static void stli_throttle(struct tty_struct *tty) { stliport_t *portp; -#if DEBUG +#ifdef DEBUG printk("stli_throttle(tty=%x)\n", (int) tty); #endif @@ -2222,7 +2215,7 @@ static void stli_unthrottle(struct tty_struct *tty) { stliport_t *portp; -#if DEBUG +#ifdef DEBUG printk("stli_unthrottle(tty=%x)\n", (int) tty); #endif @@ -2248,7 +2241,7 @@ static void stli_stop(struct tty_struct *tty) stliport_t *portp; asyctrl_t actrl; -#if DEBUG +#ifdef DEBUG printk("stli_stop(tty=%x)\n", (int) tty); #endif @@ -2282,7 +2275,7 @@ static void stli_start(struct tty_struct *tty) stlibrd_t *brdp; asyctrl_t actrl; -#if DEBUG +#ifdef DEBUG printk("stli_start(tty=%x)\n", (int) tty); #endif @@ -2319,7 +2312,7 @@ static void stli_dohangup(void *arg) { stliport_t *portp; -#if DEBUG +#ifdef DEBUG printk(KERN_DEBUG "stli_dohangup(portp=%x)\n", (int) arg); #endif @@ -2351,7 +2344,7 @@ static void stli_hangup(struct tty_struct *tty) stlibrd_t *brdp; unsigned long flags; -#if DEBUG +#ifdef DEBUG printk(KERN_DEBUG "stli_hangup(tty=%x)\n", (int) tty); #endif @@ -2409,7 +2402,7 @@ static void stli_flushbuffer(struct tty_struct *tty) stlibrd_t *brdp; unsigned long ftype, flags; -#if DEBUG +#ifdef DEBUG printk(KERN_DEBUG "stli_flushbuffer(tty=%x)\n", (int) tty); #endif @@ -2459,7 +2452,7 @@ static void stli_breakctl(struct tty_struct *tty, int state) long arg; /* long savestate, savetime; */ -#if DEBUG +#ifdef DEBUG printk(KERN_DEBUG "stli_breakctl(tty=%x,state=%d)\n", (int) tty, state); #endif @@ -2498,7 +2491,7 @@ static void stli_waituntilsent(struct tty_struct *tty, int timeout) stliport_t *portp; unsigned long tend; -#if DEBUG +#ifdef DEBUG printk(KERN_DEBUG "stli_waituntilsent(tty=%x,timeout=%x)\n", (int) tty, timeout); #endif @@ -2529,7 +2522,7 @@ static void stli_sendxchar(struct tty_struct *tty, char ch) stliport_t *portp; asyctrl_t actrl; -#if DEBUG +#ifdef DEBUG printk(KERN_DEBUG "stli_sendxchar(tty=%x,ch=%x)\n", (int) tty, ch); #endif @@ -2636,7 +2629,7 @@ static int stli_readproc(char *page, char **start, off_t off, int count, int *eo int curoff, maxoff; char *pos; -#if DEBUG +#ifdef DEBUG printk(KERN_DEBUG "stli_readproc(page=%x,start=%x,off=%x,count=%d,eof=%x," "data=%x\n", (int) page, (int) start, (int) off, count, (int) eof, (int) data); @@ -2712,7 +2705,7 @@ static void stli_sendcmd(stlibrd_t *brdp, stliport_t *portp, unsigned long cmd, volatile unsigned char *bits; unsigned long flags; -#if DEBUG +#ifdef DEBUG printk(KERN_DEBUG "stli_sendcmd(brdp=%x,portp=%x,cmd=%x,arg=%x,size=%d," "copyback=%d)\n", (int) brdp, (int) portp, (int) cmd, (int) arg, size, copyback); @@ -2766,7 +2759,7 @@ static inline void stli_read(stlibrd_t *brdp, stliport_t *portp) unsigned int head, tail, size; unsigned int len, stlen; -#if DEBUG +#ifdef DEBUG printk(KERN_DEBUG "stli_read(brdp=%x,portp=%d)\n", (int) brdp, (int) portp); #endif @@ -2883,7 +2876,7 @@ static inline int stli_hostcmd(stlibrd_t *brdp, stliport_t *portp) unsigned long oldsigs; int rc, donerx; -#if DEBUG +#ifdef DEBUG printk(KERN_DEBUG "stli_hostcmd(brdp=%x,channr=%d)\n", (int) brdp, channr); #endif @@ -3135,7 +3128,7 @@ static void stli_poll(unsigned long arg) static void stli_mkasyport(stliport_t *portp, asyport_t *pp, struct termios *tiosp) { -#if DEBUG +#ifdef DEBUG printk(KERN_DEBUG "stli_mkasyport(portp=%x,pp=%x,tiosp=%d)\n", (int) portp, (int) pp, (int) tiosp); #endif @@ -3258,7 +3251,7 @@ static void stli_mkasyport(stliport_t *portp, asyport_t *pp, struct termios *tio static void stli_mkasysigs(asysigs_t *sp, int dtr, int rts) { -#if DEBUG +#ifdef DEBUG printk(KERN_DEBUG "stli_mkasysigs(sp=%x,dtr=%d,rts=%d)\n", (int) sp, dtr, rts); #endif @@ -3285,7 +3278,7 @@ static long stli_mktiocm(unsigned long sigvalue) { long tiocm; -#if DEBUG +#ifdef DEBUG printk(KERN_DEBUG "stli_mktiocm(sigvalue=%x)\n", (int) sigvalue); #endif @@ -3311,7 +3304,7 @@ static inline int stli_initports(stlibrd_t *brdp) stliport_t *portp; int i, panelnr, panelport; -#if DEBUG +#ifdef DEBUG printk(KERN_DEBUG "stli_initports(brdp=%x)\n", (int) brdp); #endif @@ -3355,7 +3348,7 @@ static void stli_ecpinit(stlibrd_t *brdp) { unsigned long memconf; -#if DEBUG +#ifdef DEBUG printk(KERN_DEBUG "stli_ecpinit(brdp=%d)\n", (int) brdp); #endif @@ -3372,7 +3365,7 @@ static void stli_ecpinit(stlibrd_t *brdp) static void stli_ecpenable(stlibrd_t *brdp) { -#if DEBUG +#ifdef DEBUG printk(KERN_DEBUG "stli_ecpenable(brdp=%x)\n", (int) brdp); #endif outb(ECP_ATENABLE, (brdp->iobase + ECP_ATCONFR)); @@ -3382,7 +3375,7 @@ static void stli_ecpenable(stlibrd_t *brdp) static void stli_ecpdisable(stlibrd_t *brdp) { -#if DEBUG +#ifdef DEBUG printk(KERN_DEBUG "stli_ecpdisable(brdp=%x)\n", (int) brdp); #endif outb(ECP_ATDISABLE, (brdp->iobase + ECP_ATCONFR)); @@ -3395,7 +3388,7 @@ static char *stli_ecpgetmemptr(stlibrd_t *brdp, unsigned long offset, int line) void *ptr; unsigned char val; -#if DEBUG +#ifdef DEBUG printk(KERN_DEBUG "stli_ecpgetmemptr(brdp=%x,offset=%x)\n", (int) brdp, (int) offset); #endif @@ -3404,7 +3397,7 @@ static char *stli_ecpgetmemptr(stlibrd_t *brdp, unsigned long offset, int line) printk(KERN_ERR "STALLION: shared memory pointer=%x out of " "range at line=%d(%d), brd=%d\n", (int) offset, line, __LINE__, brdp->brdnr); - ptr = 0; + ptr = NULL; val = 0; } else { ptr = brdp->membase + (offset % ECP_ATPAGESIZE); @@ -3418,7 +3411,7 @@ static char *stli_ecpgetmemptr(stlibrd_t *brdp, unsigned long offset, int line) static void stli_ecpreset(stlibrd_t *brdp) { -#if DEBUG +#ifdef DEBUG printk(KERN_DEBUG "stli_ecpreset(brdp=%x)\n", (int) brdp); #endif @@ -3432,7 +3425,7 @@ static void stli_ecpreset(stlibrd_t *brdp) static void stli_ecpintr(stlibrd_t *brdp) { -#if DEBUG +#ifdef DEBUG printk(KERN_DEBUG "stli_ecpintr(brdp=%x)\n", (int) brdp); #endif outb(0x1, brdp->iobase); @@ -3448,7 +3441,7 @@ static void stli_ecpeiinit(stlibrd_t *brdp) { unsigned long memconf; -#if DEBUG +#ifdef DEBUG printk(KERN_DEBUG "stli_ecpeiinit(brdp=%x)\n", (int) brdp); #endif @@ -3485,7 +3478,7 @@ static char *stli_ecpeigetmemptr(stlibrd_t *brdp, unsigned long offset, int line void *ptr; unsigned char val; -#if DEBUG +#ifdef DEBUG printk(KERN_DEBUG "stli_ecpeigetmemptr(brdp=%x,offset=%x,line=%d)\n", (int) brdp, (int) offset, line); #endif @@ -3494,7 +3487,7 @@ static char *stli_ecpeigetmemptr(stlibrd_t *brdp, unsigned long offset, int line printk(KERN_ERR "STALLION: shared memory pointer=%x out of " "range at line=%d(%d), brd=%d\n", (int) offset, line, __LINE__, brdp->brdnr); - ptr = 0; + ptr = NULL; val = 0; } else { ptr = brdp->membase + (offset % ECP_EIPAGESIZE); @@ -3546,7 +3539,7 @@ static char *stli_ecpmcgetmemptr(stlibrd_t *brdp, unsigned long offset, int line printk(KERN_ERR "STALLION: shared memory pointer=%x out of " "range at line=%d(%d), brd=%d\n", (int) offset, line, __LINE__, brdp->brdnr); - ptr = 0; + ptr = NULL; val = 0; } else { ptr = brdp->membase + (offset % ECP_MCPAGESIZE); @@ -3574,7 +3567,7 @@ static void stli_ecpmcreset(stlibrd_t *brdp) static void stli_ecppciinit(stlibrd_t *brdp) { -#if DEBUG +#ifdef DEBUG printk(KERN_DEBUG "stli_ecppciinit(brdp=%x)\n", (int) brdp); #endif @@ -3591,7 +3584,7 @@ static char *stli_ecppcigetmemptr(stlibrd_t *brdp, unsigned long offset, int lin void *ptr; unsigned char val; -#if DEBUG +#ifdef DEBUG printk(KERN_DEBUG "stli_ecppcigetmemptr(brdp=%x,offset=%x,line=%d)\n", (int) brdp, (int) offset, line); #endif @@ -3600,7 +3593,7 @@ static char *stli_ecppcigetmemptr(stlibrd_t *brdp, unsigned long offset, int lin printk(KERN_ERR "STALLION: shared memory pointer=%x out of " "range at line=%d(%d), board=%d\n", (int) offset, line, __LINE__, brdp->brdnr); - ptr = 0; + ptr = NULL; val = 0; } else { ptr = brdp->membase + (offset % ECP_PCIPAGESIZE); @@ -3630,7 +3623,7 @@ static void stli_onbinit(stlibrd_t *brdp) { unsigned long memconf; -#if DEBUG +#ifdef DEBUG printk(KERN_DEBUG "stli_onbinit(brdp=%d)\n", (int) brdp); #endif @@ -3649,7 +3642,7 @@ static void stli_onbinit(stlibrd_t *brdp) static void stli_onbenable(stlibrd_t *brdp) { -#if DEBUG +#ifdef DEBUG printk(KERN_DEBUG "stli_onbenable(brdp=%x)\n", (int) brdp); #endif outb((brdp->enabval | ONB_ATENABLE), (brdp->iobase + ONB_ATCONFR)); @@ -3659,7 +3652,7 @@ static void stli_onbenable(stlibrd_t *brdp) static void stli_onbdisable(stlibrd_t *brdp) { -#if DEBUG +#ifdef DEBUG printk(KERN_DEBUG "stli_onbdisable(brdp=%x)\n", (int) brdp); #endif outb((brdp->enabval | ONB_ATDISABLE), (brdp->iobase + ONB_ATCONFR)); @@ -3671,7 +3664,7 @@ static char *stli_onbgetmemptr(stlibrd_t *brdp, unsigned long offset, int line) { void *ptr; -#if DEBUG +#ifdef DEBUG printk(KERN_DEBUG "stli_onbgetmemptr(brdp=%x,offset=%x)\n", (int) brdp, (int) offset); #endif @@ -3680,7 +3673,7 @@ static char *stli_onbgetmemptr(stlibrd_t *brdp, unsigned long offset, int line) printk(KERN_ERR "STALLION: shared memory pointer=%x out of " "range at line=%d(%d), brd=%d\n", (int) offset, line, __LINE__, brdp->brdnr); - ptr = 0; + ptr = NULL; } else { ptr = brdp->membase + (offset % ONB_ATPAGESIZE); } @@ -3692,7 +3685,7 @@ static char *stli_onbgetmemptr(stlibrd_t *brdp, unsigned long offset, int line) static void stli_onbreset(stlibrd_t *brdp) { -#if DEBUG +#ifdef DEBUG printk(KERN_DEBUG "stli_onbreset(brdp=%x)\n", (int) brdp); #endif @@ -3712,7 +3705,7 @@ static void stli_onbeinit(stlibrd_t *brdp) { unsigned long memconf; -#if DEBUG +#ifdef DEBUG printk(KERN_DEBUG "stli_onbeinit(brdp=%d)\n", (int) brdp); #endif @@ -3734,7 +3727,7 @@ static void stli_onbeinit(stlibrd_t *brdp) static void stli_onbeenable(stlibrd_t *brdp) { -#if DEBUG +#ifdef DEBUG printk(KERN_DEBUG "stli_onbeenable(brdp=%x)\n", (int) brdp); #endif outb(ONB_EIENABLE, (brdp->iobase + ONB_EICONFR)); @@ -3744,7 +3737,7 @@ static void stli_onbeenable(stlibrd_t *brdp) static void stli_onbedisable(stlibrd_t *brdp) { -#if DEBUG +#ifdef DEBUG printk(KERN_DEBUG "stli_onbedisable(brdp=%x)\n", (int) brdp); #endif outb(ONB_EIDISABLE, (brdp->iobase + ONB_EICONFR)); @@ -3757,7 +3750,7 @@ static char *stli_onbegetmemptr(stlibrd_t *brdp, unsigned long offset, int line) void *ptr; unsigned char val; -#if DEBUG +#ifdef DEBUG printk(KERN_DEBUG "stli_onbegetmemptr(brdp=%x,offset=%x,line=%d)\n", (int) brdp, (int) offset, line); #endif @@ -3766,7 +3759,7 @@ static char *stli_onbegetmemptr(stlibrd_t *brdp, unsigned long offset, int line) printk(KERN_ERR "STALLION: shared memory pointer=%x out of " "range at line=%d(%d), brd=%d\n", (int) offset, line, __LINE__, brdp->brdnr); - ptr = 0; + ptr = NULL; val = 0; } else { ptr = brdp->membase + (offset % ONB_EIPAGESIZE); @@ -3784,7 +3777,7 @@ static char *stli_onbegetmemptr(stlibrd_t *brdp, unsigned long offset, int line) static void stli_onbereset(stlibrd_t *brdp) { -#if DEBUG +#ifdef DEBUG printk(KERN_ERR "stli_onbereset(brdp=%x)\n", (int) brdp); #endif @@ -3803,7 +3796,7 @@ static void stli_onbereset(stlibrd_t *brdp) static void stli_bbyinit(stlibrd_t *brdp) { -#if DEBUG +#ifdef DEBUG printk(KERN_ERR "stli_bbyinit(brdp=%d)\n", (int) brdp); #endif @@ -3822,7 +3815,7 @@ static char *stli_bbygetmemptr(stlibrd_t *brdp, unsigned long offset, int line) void *ptr; unsigned char val; -#if DEBUG +#ifdef DEBUG printk(KERN_ERR "stli_bbygetmemptr(brdp=%x,offset=%x)\n", (int) brdp, (int) offset); #endif @@ -3831,7 +3824,7 @@ static char *stli_bbygetmemptr(stlibrd_t *brdp, unsigned long offset, int line) printk(KERN_ERR "STALLION: shared memory pointer=%x out of " "range at line=%d(%d), brd=%d\n", (int) offset, line, __LINE__, brdp->brdnr); - ptr = 0; + ptr = NULL; val = 0; } else { ptr = brdp->membase + (offset % BBY_PAGESIZE); @@ -3846,7 +3839,7 @@ static char *stli_bbygetmemptr(stlibrd_t *brdp, unsigned long offset, int line) static void stli_bbyreset(stlibrd_t *brdp) { -#if DEBUG +#ifdef DEBUG printk(KERN_DEBUG "stli_bbyreset(brdp=%x)\n", (int) brdp); #endif @@ -3865,7 +3858,7 @@ static void stli_bbyreset(stlibrd_t *brdp) static void stli_stalinit(stlibrd_t *brdp) { -#if DEBUG +#ifdef DEBUG printk(KERN_DEBUG "stli_stalinit(brdp=%d)\n", (int) brdp); #endif @@ -3879,7 +3872,7 @@ static char *stli_stalgetmemptr(stlibrd_t *brdp, unsigned long offset, int line) { void *ptr; -#if DEBUG +#ifdef DEBUG printk(KERN_DEBUG "stli_stalgetmemptr(brdp=%x,offset=%x)\n", (int) brdp, (int) offset); #endif @@ -3888,7 +3881,7 @@ static char *stli_stalgetmemptr(stlibrd_t *brdp, unsigned long offset, int line) printk(KERN_ERR "STALLION: shared memory pointer=%x out of " "range at line=%d(%d), brd=%d\n", (int) offset, line, __LINE__, brdp->brdnr); - ptr = 0; + ptr = NULL; } else { ptr = brdp->membase + (offset % STAL_PAGESIZE); } @@ -3901,7 +3894,7 @@ static void stli_stalreset(stlibrd_t *brdp) { volatile unsigned long *vecp; -#if DEBUG +#ifdef DEBUG printk(KERN_DEBUG "stli_stalreset(brdp=%x)\n", (int) brdp); #endif @@ -3926,7 +3919,7 @@ static inline int stli_initecp(stlibrd_t *brdp) char *name; int panelnr, nrports; -#if DEBUG +#ifdef DEBUG printk(KERN_DEBUG "stli_initecp(brdp=%x)\n", (int) brdp); #endif @@ -4086,7 +4079,7 @@ static inline int stli_initonb(stlibrd_t *brdp) char *name; int i; -#if DEBUG +#ifdef DEBUG printk(KERN_DEBUG "stli_initonb(brdp=%x)\n", (int) brdp); #endif @@ -4254,7 +4247,7 @@ static int stli_startbrd(stlibrd_t *brdp) stliport_t *portp; int portnr, nrdevs, i, rc; -#if DEBUG +#ifdef DEBUG printk(KERN_DEBUG "stli_startbrd(brdp=%x)\n", (int) brdp); #endif @@ -4360,7 +4353,7 @@ stli_donestartup: static int __init stli_brdinit(stlibrd_t *brdp) { -#if DEBUG +#ifdef DEBUG printk(KERN_DEBUG "stli_brdinit(brdp=%x)\n", (int) brdp); #endif @@ -4427,7 +4420,7 @@ static inline int stli_eisamemprobe(stlibrd_t *brdp) cdkonbsig_t onbsig, *onbsigp; int i, foundit; -#if DEBUG +#ifdef DEBUG printk(KERN_DEBUG "stli_eisamemprobe(brdp=%x)\n", (int) brdp); #endif @@ -4504,7 +4497,7 @@ static inline int stli_eisamemprobe(stlibrd_t *brdp) if (! foundit) { brdp->memaddr = 0; - brdp->membase = 0; + brdp->membase = NULL; printk(KERN_ERR "STALLION: failed to probe shared memory " "region for %s in EISA slot=%d\n", stli_brdnames[brdp->brdtype], (brdp->iobase >> 12)); @@ -4513,6 +4506,20 @@ static inline int stli_eisamemprobe(stlibrd_t *brdp) return(0); } +static inline int stli_getbrdnr(void) +{ + int i; + + for (i = 0; i < STL_MAXBRDS; i++) { + if (!stli_brds[i]) { + if (i >= stli_nrbrds) + stli_nrbrds = i + 1; + return i; + } + } + return -1; +} + /*****************************************************************************/ /* @@ -4525,13 +4532,13 @@ static inline int stli_eisamemprobe(stlibrd_t *brdp) * do is go probing around in the usual places hoping we can find it. */ -static inline int stli_findeisabrds() +static inline int stli_findeisabrds(void) { stlibrd_t *brdp; unsigned int iobase, eid; int i; -#if DEBUG +#ifdef DEBUG printk(KERN_DEBUG "stli_findeisabrds()\n"); #endif @@ -4599,20 +4606,6 @@ static inline int stli_findeisabrds() * Find the next available board number that is free. */ -static inline int stli_getbrdnr() -{ - int i; - - for (i = 0; (i < STL_MAXBRDS); i++) { - if (stli_brds[i] == (stlibrd_t *) NULL) { - if (i >= stli_nrbrds) - stli_nrbrds = i + 1; - return(i); - } - } - return(-1); -} - /*****************************************************************************/ #ifdef CONFIG_PCI @@ -4627,7 +4620,7 @@ static inline int stli_initpcibrd(int brdtype, struct pci_dev *devp) { stlibrd_t *brdp; -#if DEBUG +#ifdef DEBUG printk(KERN_DEBUG "stli_initpcibrd(brdtype=%d,busnr=%x,devnr=%x)\n", brdtype, dev->bus->number, dev->devfn); #endif @@ -4643,7 +4636,7 @@ static inline int stli_initpcibrd(int brdtype, struct pci_dev *devp) } brdp->brdtype = brdtype; -#if DEBUG +#ifdef DEBUG printk(KERN_DEBUG "%s(%d): BAR[]=%lx,%lx,%lx,%lx\n", __FILE__, __LINE__, pci_resource_start(devp, 0), pci_resource_start(devp, 1), @@ -4669,12 +4662,12 @@ static inline int stli_initpcibrd(int brdtype, struct pci_dev *devp) * one as it is found. */ -static inline int stli_findpcibrds() +static inline int stli_findpcibrds(void) { struct pci_dev *dev = NULL; int rc; -#if DEBUG +#ifdef DEBUG printk("stli_findpcibrds()\n"); #endif @@ -4695,7 +4688,7 @@ static inline int stli_findpcibrds() * Allocate a new board structure. Fill out the basic info in it. */ -static stlibrd_t *stli_allocbrd() +static stlibrd_t *stli_allocbrd(void) { stlibrd_t *brdp; @@ -4718,13 +4711,13 @@ static stlibrd_t *stli_allocbrd() * can find. */ -static inline int stli_initbrds() +static inline int stli_initbrds(void) { stlibrd_t *brdp, *nxtbrdp; stlconf_t *confp; int i, j; -#if DEBUG +#ifdef DEBUG printk(KERN_DEBUG "stli_initbrds()\n"); #endif @@ -4815,14 +4808,14 @@ static inline int stli_initbrds() * the slave image (and debugging :-) */ -static ssize_t stli_memread(struct file *fp, char *buf, size_t count, loff_t *offp) +static ssize_t stli_memread(struct file *fp, char __user *buf, size_t count, loff_t *offp) { unsigned long flags; void *memptr; stlibrd_t *brdp; int brdnr, size, n; -#if DEBUG +#ifdef DEBUG printk(KERN_DEBUG "stli_memread(fp=%x,buf=%x,count=%x,offp=%x)\n", (int) fp, (int) buf, count, (int) offp); #endif @@ -4869,15 +4862,15 @@ out: * the slave image (and debugging :-) */ -static ssize_t stli_memwrite(struct file *fp, const char *buf, size_t count, loff_t *offp) +static ssize_t stli_memwrite(struct file *fp, const char __user *buf, size_t count, loff_t *offp) { unsigned long flags; void *memptr; stlibrd_t *brdp; - char *chbuf; + char __user *chbuf; int brdnr, size, n; -#if DEBUG +#ifdef DEBUG printk(KERN_DEBUG "stli_memwrite(fp=%x,buf=%x,count=%x,offp=%x)\n", (int) fp, (int) buf, count, (int) offp); #endif @@ -4893,7 +4886,7 @@ static ssize_t stli_memwrite(struct file *fp, const char *buf, size_t count, lof if (fp->f_pos >= brdp->memsize) return(0); - chbuf = (char *) buf; + chbuf = (char __user *) buf; size = MIN(count, (brdp->memsize - fp->f_pos)); save_flags(flags); @@ -4923,7 +4916,7 @@ out: * Return the board stats structure to user app. */ -static int stli_getbrdstats(combrd_t *bp) +static int stli_getbrdstats(combrd_t __user *bp) { stlibrd_t *brdp; int i; @@ -5062,26 +5055,26 @@ static int stli_portcmdstats(stliport_t *portp) * what port to get stats for (used through board control device). */ -static int stli_getportstats(stliport_t *portp, comstats_t *cp) +static int stli_getportstats(stliport_t *portp, comstats_t __user *cp) { stlibrd_t *brdp; int rc; - if (portp == (stliport_t *) NULL) { + if (!portp) { if (copy_from_user(&stli_comstats, cp, sizeof(comstats_t))) return -EFAULT; portp = stli_getport(stli_comstats.brd, stli_comstats.panel, stli_comstats.port); - if (portp == (stliport_t *) NULL) - return(-ENODEV); + if (!portp) + return -ENODEV; } brdp = stli_brds[portp->brdnr]; - if (brdp == (stlibrd_t *) NULL) - return(-ENODEV); + if (!brdp) + return -ENODEV; if ((rc = stli_portcmdstats(portp)) < 0) - return(rc); + return rc; return copy_to_user(cp, &stli_comstats, sizeof(comstats_t)) ? -EFAULT : 0; @@ -5093,27 +5086,27 @@ static int stli_getportstats(stliport_t *portp, comstats_t *cp) * Clear the port stats structure. We also return it zeroed out... */ -static int stli_clrportstats(stliport_t *portp, comstats_t *cp) +static int stli_clrportstats(stliport_t *portp, comstats_t __user *cp) { stlibrd_t *brdp; int rc; - if (portp == (stliport_t *) NULL) { + if (!portp) { if (copy_from_user(&stli_comstats, cp, sizeof(comstats_t))) return -EFAULT; portp = stli_getport(stli_comstats.brd, stli_comstats.panel, stli_comstats.port); - if (portp == (stliport_t *) NULL) - return(-ENODEV); + if (!portp) + return -ENODEV; } brdp = stli_brds[portp->brdnr]; - if (brdp == (stlibrd_t *) NULL) - return(-ENODEV); + if (!brdp) + return -ENODEV; if (brdp->state & BST_STARTED) { - if ((rc = stli_cmdwait(brdp, portp, A_CLEARSTATS, 0, 0, 0)) < 0) - return(rc); + if ((rc = stli_cmdwait(brdp, portp, A_CLEARSTATS, NULL, 0, 0)) < 0) + return rc; } memset(&stli_comstats, 0, sizeof(comstats_t)); @@ -5123,7 +5116,7 @@ static int stli_clrportstats(stliport_t *portp, comstats_t *cp) if (copy_to_user(cp, &stli_comstats, sizeof(comstats_t))) return -EFAULT; - return(0); + return 0; } /*****************************************************************************/ @@ -5132,19 +5125,19 @@ static int stli_clrportstats(stliport_t *portp, comstats_t *cp) * Return the entire driver ports structure to a user app. */ -static int stli_getportstruct(unsigned long arg) +static int stli_getportstruct(stliport_t __user *arg) { stliport_t *portp; - if (copy_from_user(&stli_dummyport, (void *)arg, sizeof(stliport_t))) + if (copy_from_user(&stli_dummyport, arg, sizeof(stliport_t))) return -EFAULT; portp = stli_getport(stli_dummyport.brdnr, stli_dummyport.panelnr, stli_dummyport.portnr); - if (portp == (stliport_t *) NULL) - return(-ENODEV); - if (copy_to_user((void *) arg, portp, sizeof(stliport_t))) + if (!portp) + return -ENODEV; + if (copy_to_user(arg, portp, sizeof(stliport_t))) return -EFAULT; - return(0); + return 0; } /*****************************************************************************/ @@ -5153,20 +5146,20 @@ static int stli_getportstruct(unsigned long arg) * Return the entire driver board structure to a user app. */ -static int stli_getbrdstruct(unsigned long arg) +static int stli_getbrdstruct(stlibrd_t __user *arg) { stlibrd_t *brdp; - if (copy_from_user(&stli_dummybrd, (void *)arg, sizeof(stlibrd_t))) + if (copy_from_user(&stli_dummybrd, arg, sizeof(stlibrd_t))) return -EFAULT; if ((stli_dummybrd.brdnr < 0) || (stli_dummybrd.brdnr >= STL_MAXBRDS)) - return(-ENODEV); + return -ENODEV; brdp = stli_brds[stli_dummybrd.brdnr]; - if (brdp == (stlibrd_t *) NULL) - return(-ENODEV); - if (copy_to_user((void *) arg, brdp, sizeof(stlibrd_t))) + if (!brdp) + return -ENODEV; + if (copy_to_user(arg, brdp, sizeof(stlibrd_t))) return -EFAULT; - return(0); + return 0; } /*****************************************************************************/ @@ -5181,8 +5174,9 @@ static int stli_memioctl(struct inode *ip, struct file *fp, unsigned int cmd, un { stlibrd_t *brdp; int brdnr, rc, done; + void __user *argp = (void __user *)arg; -#if DEBUG +#ifdef DEBUG printk(KERN_DEBUG "stli_memioctl(ip=%x,fp=%x,cmd=%x,arg=%x)\n", (int) ip, (int) fp, cmd, (int) arg); #endif @@ -5195,23 +5189,23 @@ static int stli_memioctl(struct inode *ip, struct file *fp, unsigned int cmd, un switch (cmd) { case COM_GETPORTSTATS: - rc = stli_getportstats((stliport_t *)NULL, (comstats_t *)arg); + rc = stli_getportstats(NULL, argp); done++; break; case COM_CLRPORTSTATS: - rc = stli_clrportstats((stliport_t *)NULL, (comstats_t *)arg); + rc = stli_clrportstats(NULL, argp); done++; break; case COM_GETBRDSTATS: - rc = stli_getbrdstats((combrd_t *) arg); + rc = stli_getbrdstats(argp); done++; break; case COM_READPORT: - rc = stli_getportstruct(arg); + rc = stli_getportstruct(argp); done++; break; case COM_READBOARD: - rc = stli_getbrdstruct(arg); + rc = stli_getbrdstruct(argp); done++; break; } @@ -5227,7 +5221,7 @@ static int stli_memioctl(struct inode *ip, struct file *fp, unsigned int cmd, un if (brdnr >= STL_MAXBRDS) return(-ENODEV); brdp = stli_brds[brdnr]; - if (brdp == (stlibrd_t *) NULL) + if (!brdp) return(-ENODEV); if (brdp->state == 0) return(-ENODEV); diff --git a/drivers/char/moxa.c b/drivers/char/moxa.c index 7a9686df31f7ae..0e75a0dc97ebf6 100644 --- a/drivers/char/moxa.c +++ b/drivers/char/moxa.c @@ -275,8 +275,8 @@ static void MoxaPortTxDisable(int); static void MoxaPortTxEnable(int); static int MoxaPortResetBrkCnt(int); static void MoxaPortSendBreak(int, int); -static int moxa_get_serial_info(struct moxa_str *, struct serial_struct *); -static int moxa_set_serial_info(struct moxa_str *, struct serial_struct *); +static int moxa_get_serial_info(struct moxa_str *, struct serial_struct __user *); +static int moxa_set_serial_info(struct moxa_str *, struct serial_struct __user *); static void MoxaSetFifo(int port, int enable); static struct tty_operations moxa_ops = { @@ -351,13 +351,13 @@ static int __init moxa_init(void) moxaDriver->flags = TTY_DRIVER_REAL_RAW; tty_set_operations(moxaDriver, &moxa_ops); - moxaXmitBuff = 0; + moxaXmitBuff = NULL; for (i = 0, ch = moxaChannels; i < MAX_PORTS; i++, ch++) { ch->type = PORT_16550A; ch->port = i; INIT_WORK(&ch->tqueue, do_moxa_softint, ch); - ch->tty = 0; + ch->tty = NULL; ch->close_delay = 5 * HZ / 10; ch->closing_wait = 30 * HZ; ch->count = 0; @@ -622,7 +622,7 @@ static void moxa_close(struct tty_struct *tty, struct file *filp) tty->ldisc.flush_buffer(tty); tty->closing = 0; ch->event = 0; - ch->tty = 0; + ch->tty = NULL; if (ch->blocked_open) { if (ch->close_delay) { set_current_state(TASK_INTERRUPTIBLE); @@ -807,6 +807,7 @@ static int moxa_ioctl(struct tty_struct *tty, struct file *file, { struct moxa_str *ch = (struct moxa_str *) tty->driver_data; register int port; + void __user *argp = (void __user *)arg; int retval; port = PORTNO(tty); @@ -832,9 +833,9 @@ static int moxa_ioctl(struct tty_struct *tty, struct file *file, MoxaPortSendBreak(ch->port, arg); return (0); case TIOCGSOFTCAR: - return put_user(C_CLOCAL(tty) ? 1 : 0, (unsigned long *) arg); + return put_user(C_CLOCAL(tty) ? 1 : 0, (unsigned long __user *) argp); case TIOCSSOFTCAR: - if(get_user(retval, (unsigned long *) arg)) + if(get_user(retval, (unsigned long __user *) argp)) return -EFAULT; arg = retval; tty->termios->c_cflag = ((tty->termios->c_cflag & ~CLOCAL) | @@ -845,10 +846,10 @@ static int moxa_ioctl(struct tty_struct *tty, struct file *file, ch->asyncflags |= ASYNC_CHECK_CD; return (0); case TIOCGSERIAL: - return (moxa_get_serial_info(ch, (struct serial_struct *) arg)); + return moxa_get_serial_info(ch, argp); case TIOCSSERIAL: - return (moxa_set_serial_info(ch, (struct serial_struct *) arg)); + return moxa_set_serial_info(ch, argp); default: retval = MoxaDriverIoctl(cmd, arg, port); } @@ -916,7 +917,7 @@ static void moxa_hangup(struct tty_struct *tty) ch->event = 0; ch->count = 0; ch->asyncflags &= ~ASYNC_NORMAL_ACTIVE; - ch->tty = 0; + ch->tty = NULL; wake_up_interruptible(&ch->open_wait); } @@ -1163,7 +1164,7 @@ static void receive_data(struct moxa_str *ch) unsigned char *charptr, *flagptr; unsigned long flags; - ts = 0; + ts = NULL; tp = ch->tty; if (tp) ts = tp->termios; @@ -1522,10 +1523,10 @@ static void moxadelay(int); static void moxafunc(unsigned long, int, ushort); static void wait_finish(unsigned long); static void low_water_check(unsigned long); -static int moxaloadbios(int, unsigned char *, int); +static int moxaloadbios(int, unsigned char __user *, int); static int moxafindcard(int); -static int moxaload320b(int, unsigned char *, int); -static int moxaloadcode(int, unsigned char *, int); +static int moxaload320b(int, unsigned char __user *, int); +static int moxaloadcode(int, unsigned char __user *, int); static int moxaloadc218(int, unsigned long, int); static int moxaloadc320(int, unsigned long, int, int *); @@ -1575,7 +1576,7 @@ struct moxaq_str { }; struct dl_str { - char *buf; + char __user *buf; int len; int cardno; }; @@ -1601,6 +1602,7 @@ int MoxaDriverIoctl(unsigned int cmd, unsigned long arg, int port) int i; int status; int MoxaPortTxQueue(int), MoxaPortRxQueue(int); + void __user *argp = (void __user *)arg; if (port == QueryPort) { if ((cmd != MOXA_GET_CONF) && (cmd != MOXA_INIT_DRIVER) && @@ -1612,7 +1614,7 @@ int MoxaDriverIoctl(unsigned int cmd, unsigned long arg, int port) } switch (cmd) { case MOXA_GET_CONF: - if(copy_to_user((void *)arg, &moxa_boards, MAX_BOARDS * sizeof(moxa_board_conf))) + if(copy_to_user(argp, &moxa_boards, MAX_BOARDS * sizeof(moxa_board_conf))) return -EFAULT; return (0); case MOXA_INIT_DRIVER: @@ -1621,7 +1623,7 @@ int MoxaDriverIoctl(unsigned int cmd, unsigned long arg, int port) return (0); case MOXA_GETDATACOUNT: moxaLog.tick = jiffies; - if(copy_to_user((void *)arg, &moxaLog, sizeof(mon_st))) + if(copy_to_user(argp, &moxaLog, sizeof(mon_st))) return -EFAULT; return (0); case MOXA_FLUSH_QUEUE: @@ -1634,22 +1636,22 @@ int MoxaDriverIoctl(unsigned int cmd, unsigned long arg, int port) temp_queue[i].outq = MoxaPortTxQueue(i); } } - if(copy_to_user((void *)arg, temp_queue, sizeof(struct moxaq_str) * MAX_PORTS)) + if(copy_to_user(argp, temp_queue, sizeof(struct moxaq_str) * MAX_PORTS)) return -EFAULT; return (0); case MOXA_GET_OQUEUE: i = MoxaPortTxQueue(port); - return put_user(i, (unsigned long *) arg); + return put_user(i, (unsigned long __user *)argp); case MOXA_GET_IQUEUE: i = MoxaPortRxQueue(port); - return put_user(i, (unsigned long *) arg); + return put_user(i, (unsigned long __user *)argp); case MOXA_GET_MAJOR: - if(copy_to_user((void *)arg, &ttymajor, sizeof(int))) + if(copy_to_user(argp, &ttymajor, sizeof(int))) return -EFAULT; return 0; case MOXA_GET_CUMAJOR: i = 0; - if(copy_to_user((void *)arg, &i, sizeof(int))) + if(copy_to_user(argp, &i, sizeof(int))) return -EFAULT; return 0; case MOXA_GETMSTATUS: @@ -1675,7 +1677,7 @@ int MoxaDriverIoctl(unsigned int cmd, unsigned long arg, int port) else GMStatus[i].cflag = moxaChannels[i].tty->termios->c_cflag; } - if(copy_to_user((void *)arg, GMStatus, sizeof(struct mxser_mstatus) * MAX_PORTS)) + if(copy_to_user(argp, GMStatus, sizeof(struct mxser_mstatus) * MAX_PORTS)) return -EFAULT; return 0; default: @@ -1687,7 +1689,7 @@ int MoxaDriverIoctl(unsigned int cmd, unsigned long arg, int port) break; } - if(copy_from_user(&dltmp, (void *)arg, sizeof(struct dl_str))) + if(copy_from_user(&dltmp, argp, sizeof(struct dl_str))) return -EFAULT; if(dltmp.cardno < 0 || dltmp.cardno >= MAX_BOARDS) return -EINVAL; @@ -2682,12 +2684,10 @@ void MoxaPortSendBreak(int port, int ms100) } static int moxa_get_serial_info(struct moxa_str *info, - struct serial_struct *retinfo) + struct serial_struct __user *retinfo) { struct serial_struct tmp; - if (!retinfo) - return (-EFAULT); memset(&tmp, 0, sizeof(tmp)); tmp.type = info->type; tmp.line = info->port; @@ -2706,7 +2706,7 @@ static int moxa_get_serial_info(struct moxa_str *info, static int moxa_set_serial_info(struct moxa_str *info, - struct serial_struct *new_info) + struct serial_struct __user *new_info) { struct serial_struct new_serial; @@ -2795,7 +2795,7 @@ static void low_water_check(unsigned long ofsAddr) } } -static int moxaloadbios(int cardno, unsigned char *tmp, int len) +static int moxaloadbios(int cardno, unsigned char __user *tmp, int len) { unsigned long baseAddr; int i; @@ -2842,7 +2842,7 @@ static int moxafindcard(int cardno) return (0); } -static int moxaload320b(int cardno, unsigned char * tmp, int len) +static int moxaload320b(int cardno, unsigned char __user *tmp, int len) { unsigned long baseAddr; int i; @@ -2862,7 +2862,7 @@ static int moxaload320b(int cardno, unsigned char * tmp, int len) return (0); } -static int moxaloadcode(int cardno, unsigned char * tmp, int len) +static int moxaloadcode(int cardno, unsigned char __user *tmp, int len) { unsigned long baseAddr, ofsAddr; int retval, port, i; diff --git a/drivers/char/mxser.c b/drivers/char/mxser.c index 39691061aae41b..d4ba62a29ea9d0 100644 --- a/drivers/char/mxser.c +++ b/drivers/char/mxser.c @@ -357,9 +357,9 @@ static int mxser_block_til_ready(struct tty_struct *, struct file *, struct mxse static int mxser_startup(struct mxser_struct *); static void mxser_shutdown(struct mxser_struct *); static int mxser_change_speed(struct mxser_struct *, struct termios *old_termios); -static int mxser_get_serial_info(struct mxser_struct *, struct serial_struct *); -static int mxser_set_serial_info(struct mxser_struct *, struct serial_struct *); -static int mxser_get_lsr_info(struct mxser_struct *, unsigned int *); +static int mxser_get_serial_info(struct mxser_struct *, struct serial_struct __user *); +static int mxser_set_serial_info(struct mxser_struct *, struct serial_struct __user *); +static int mxser_get_lsr_info(struct mxser_struct *, unsigned int __user *); static void mxser_send_break(struct mxser_struct *, int); static int mxser_tiocmget(struct tty_struct *, struct file *); static int mxser_tiocmset(struct tty_struct *, struct file *, unsigned int, unsigned int); @@ -821,7 +821,7 @@ static void mxser_close(struct tty_struct *tty, struct file *filp) tty->ldisc.flush_buffer(tty); tty->closing = 0; info->event = 0; - info->tty = 0; + info->tty = NULL; if (info->blocked_open) { if (info->close_delay) { set_current_state(TASK_INTERRUPTIBLE); @@ -988,8 +988,9 @@ static int mxser_ioctl(struct tty_struct *tty, struct file *file, struct mxser_struct *info = (struct mxser_struct *) tty->driver_data; int retval; struct async_icount cprev, cnow; /* kernel counter temps */ - struct serial_icounter_struct *p_cuser; /* user space */ + struct serial_icounter_struct __user *p_cuser; unsigned long templ; + void __user *argp = (void __user *)arg; if (PORTNO(tty) == MXSER_PORTS) return (mxser_ioctl_special(cmd, arg)); @@ -1015,20 +1016,20 @@ static int mxser_ioctl(struct tty_struct *tty, struct file *file, mxser_send_break(info, arg ? arg * (HZ / 10) : HZ / 4); return (0); case TIOCGSOFTCAR: - return put_user(C_CLOCAL(tty) ? 1 : 0, (unsigned long *) arg); + return put_user(C_CLOCAL(tty) ? 1 : 0, (unsigned long __user *)argp); case TIOCSSOFTCAR: - if(get_user(templ, (unsigned long *) arg)) + if(get_user(templ, (unsigned long __user *) arg)) return -EFAULT; arg = templ; tty->termios->c_cflag = ((tty->termios->c_cflag & ~CLOCAL) | (arg ? CLOCAL : 0)); return (0); case TIOCGSERIAL: - return (mxser_get_serial_info(info, (struct serial_struct *) arg)); + return mxser_get_serial_info(info, argp); case TIOCSSERIAL: - return (mxser_set_serial_info(info, (struct serial_struct *) arg)); + return mxser_set_serial_info(info, argp); case TIOCSERGETLSR: /* Get line status register */ - return (mxser_get_lsr_info(info, (unsigned int *) arg)); + return mxser_get_lsr_info(info, argp); /* * Wait for any of the 4 modem inputs (DCD,RI,DSR,CTS) to change * - mask passed in arg for lines of interest @@ -1072,7 +1073,7 @@ static int mxser_ioctl(struct tty_struct *tty, struct file *file, cli(); cnow = info->icount; restore_flags(flags); - p_cuser = (struct serial_icounter_struct *) arg; + p_cuser = argp; if(put_user(cnow.cts, &p_cuser->cts)) return -EFAULT; if(put_user(cnow.dsr, &p_cuser->dsr)) @@ -1081,7 +1082,7 @@ static int mxser_ioctl(struct tty_struct *tty, struct file *file, return -EFAULT; return put_user(cnow.dcd, &p_cuser->dcd); case MOXA_HighSpeedOn: - return put_user(info->baud_base != 115200 ? 1 : 0, (int *) arg); + return put_user(info->baud_base != 115200 ? 1 : 0, (int __user *)argp); default: return (-ENOIOCTLCMD); } @@ -1091,21 +1092,22 @@ static int mxser_ioctl(struct tty_struct *tty, struct file *file, static int mxser_ioctl_special(unsigned int cmd, unsigned long arg) { int i, result, status; + void __user *argp = (void __user *)arg; switch (cmd) { case MOXA_GET_CONF: - if(copy_to_user((struct mxser_hwconf *) arg, mxsercfg, + if(copy_to_user(argp, mxsercfg, sizeof(struct mxser_hwconf) * 4)) return -EFAULT; return 0; case MOXA_GET_MAJOR: - if(copy_to_user((int *) arg, &ttymajor, sizeof(int))) + if(copy_to_user(argp, &ttymajor, sizeof(int))) return -EFAULT; return 0; case MOXA_GET_CUMAJOR: result = 0; - if(copy_to_user((int *) arg, &result, sizeof(int))) + if(copy_to_user(argp, &result, sizeof(int))) return -EFAULT; return 0; @@ -1115,9 +1117,9 @@ static int mxser_ioctl_special(unsigned int cmd, unsigned long arg) if (mxvar_table[i].base) result |= (1 << i); } - return put_user(result, (unsigned long *) arg); + return put_user(result, (unsigned long __user *) argp); case MOXA_GETDATACOUNT: - if(copy_to_user((struct mxser_log *) arg, &mxvar_log, sizeof(mxvar_log))) + if (copy_to_user(argp, &mxvar_log, sizeof(mxvar_log))) return -EFAULT; return (0); case MOXA_GETMSTATUS: @@ -1151,7 +1153,7 @@ static int mxser_ioctl_special(unsigned int cmd, unsigned long arg) else GMStatus[i].cts = 0; } - if(copy_to_user((struct mxser_mstatus *) arg, GMStatus, + if(copy_to_user(argp, GMStatus, sizeof(struct mxser_mstatus) * MXSER_PORTS)) return -EFAULT; return 0; @@ -1301,7 +1303,7 @@ void mxser_hangup(struct tty_struct *tty) info->event = 0; info->count = 0; info->flags &= ~ASYNC_NORMAL_ACTIVE; - info->tty = 0; + info->tty = NULL; wake_up_interruptible(&info->open_wait); } @@ -1317,7 +1319,7 @@ static irqreturn_t mxser_interrupt(int irq, void *dev_id, struct pt_regs *regs) int pass_counter = 0; int handled = 0; - port = 0; + port = NULL; for (i = 0; i < MXSER_BOARDS; i++) { if (dev_id == &(mxvar_table[i * MXSER_PORTS_PER_BOARD])) { port = dev_id; @@ -1665,7 +1667,7 @@ static int mxser_startup(struct mxser_struct *info) /* * and set the speed of the serial port */ - mxser_change_speed(info, 0); + mxser_change_speed(info, NULL); info->flags |= ASYNC_INITIALIZED; restore_flags(flags); @@ -1697,7 +1699,7 @@ static void mxser_shutdown(struct mxser_struct *info) */ if (info->xmit_buf) { free_page((unsigned long) info->xmit_buf); - info->xmit_buf = 0; + info->xmit_buf = NULL; } info->IER = 0; outb(0x00, info->base + UART_IER); /* disable all intrs */ @@ -2048,7 +2050,7 @@ static int mxser_change_speed(struct mxser_struct *info, * ------------------------------------------------------------ */ static int mxser_get_serial_info(struct mxser_struct *info, - struct serial_struct *retinfo) + struct serial_struct __user *retinfo) { struct serial_struct tmp; @@ -2069,7 +2071,7 @@ static int mxser_get_serial_info(struct mxser_struct *info, } static int mxser_set_serial_info(struct mxser_struct *info, - struct serial_struct *new_info) + struct serial_struct __user *new_info) { struct serial_struct new_serial; unsigned int flags; @@ -2110,7 +2112,7 @@ static int mxser_set_serial_info(struct mxser_struct *info, if (info->flags & ASYNC_INITIALIZED) { if (flags != (info->flags & ASYNC_SPD_MASK)) { - mxser_change_speed(info, 0); + mxser_change_speed(info, NULL); } } else retval = mxser_startup(info); @@ -2127,7 +2129,7 @@ static int mxser_set_serial_info(struct mxser_struct *info, * transmit holding register is empty. This functionality * allows an RS485 driver to be written in user space. */ -static int mxser_get_lsr_info(struct mxser_struct *info, unsigned int *value) +static int mxser_get_lsr_info(struct mxser_struct *info, unsigned int __user *value) { unsigned char status; unsigned int result; diff --git a/drivers/char/pcmcia/synclink_cs.c b/drivers/char/pcmcia/synclink_cs.c index 2df2f2a6a19646..cb1cfb0afd8879 100644 --- a/drivers/char/pcmcia/synclink_cs.c +++ b/drivers/char/pcmcia/synclink_cs.c @@ -854,9 +854,8 @@ static inline int mgslpc_paranoia_check(MGSLPC_INFO *info, static BOOLEAN wait_command_complete(MGSLPC_INFO *info, unsigned char channel) { int i = 0; - unsigned char status; /* wait for command completion */ - while ((status = read_reg(info, (unsigned char)(channel+STAR)) & BIT2)) { + while (read_reg(info, (unsigned char)(channel+STAR)) & BIT2) { udelay(1); if (i++ == 1000) return FALSE; diff --git a/drivers/char/riscom8.c b/drivers/char/riscom8.c index c4b51d34665565..69108ceeadeae8 100644 --- a/drivers/char/riscom8.c +++ b/drivers/char/riscom8.c @@ -1131,7 +1131,7 @@ static void rc_close(struct tty_struct * tty, struct file * filp) tty->ldisc.flush_buffer(tty); tty->closing = 0; port->event = 0; - port->tty = 0; + port->tty = NULL; if (port->blocked_open) { if (port->close_delay) { current->state = TASK_INTERRUPTIBLE; @@ -1380,7 +1380,7 @@ static inline void rc_send_break(struct riscom_port * port, unsigned long length } static inline int rc_set_serial_info(struct riscom_port * port, - struct serial_struct * newinfo) + struct serial_struct __user * newinfo) { struct serial_struct tmp; struct riscom_board *bp = port_Board(port); @@ -1427,7 +1427,7 @@ static inline int rc_set_serial_info(struct riscom_port * port, } static inline int rc_get_serial_info(struct riscom_port * port, - struct serial_struct * retinfo) + struct serial_struct __user *retinfo) { struct serial_struct tmp; struct riscom_board *bp = port_Board(port); @@ -1450,6 +1450,7 @@ static int rc_ioctl(struct tty_struct * tty, struct file * filp, { struct riscom_port *port = (struct riscom_port *)tty->driver_data; + void __user *argp = (void __user *)arg; int retval; if (rc_paranoia_check(port, tty->name, "rc_ioctl")) @@ -1472,18 +1473,18 @@ static int rc_ioctl(struct tty_struct * tty, struct file * filp, rc_send_break(port, arg ? arg*(HZ/10) : HZ/4); break; case TIOCGSOFTCAR: - return put_user(C_CLOCAL(tty) ? 1 : 0, (unsigned int *) arg); + return put_user(C_CLOCAL(tty) ? 1 : 0, (unsigned __user *)argp); case TIOCSSOFTCAR: - if (get_user(arg,(unsigned int *) arg)) + if (get_user(arg,(unsigned __user *) argp)) return -EFAULT; tty->termios->c_cflag = ((tty->termios->c_cflag & ~CLOCAL) | (arg ? CLOCAL : 0)); break; case TIOCGSERIAL: - return rc_get_serial_info(port, (struct serial_struct *) arg); + return rc_get_serial_info(port, argp); case TIOCSSERIAL: - return rc_set_serial_info(port, (struct serial_struct *) arg); + return rc_set_serial_info(port, argp); default: return -ENOIOCTLCMD; } @@ -1607,7 +1608,7 @@ static void rc_hangup(struct tty_struct * tty) port->event = 0; port->count = 0; port->flags &= ~ASYNC_NORMAL_ACTIVE; - port->tty = 0; + port->tty = NULL; wake_up_interruptible(&port->open_wait); } diff --git a/drivers/char/specialix.c b/drivers/char/specialix.c index 14ce603602e7f6..de456d01ccea2f 100644 --- a/drivers/char/specialix.c +++ b/drivers/char/specialix.c @@ -1472,7 +1472,7 @@ static void sx_close(struct tty_struct * tty, struct file * filp) tty->ldisc.flush_buffer(tty); tty->closing = 0; port->event = 0; - port->tty = 0; + port->tty = NULL; if (port->blocked_open) { if (port->close_delay) { current->state = TASK_INTERRUPTIBLE; @@ -1757,18 +1757,13 @@ static inline void sx_send_break(struct specialix_port * port, unsigned long len static inline int sx_set_serial_info(struct specialix_port * port, - struct serial_struct * newinfo) + struct serial_struct __user * newinfo) { struct serial_struct tmp; struct specialix_board *bp = port_Board(port); int change_speed; unsigned long flags; - int error; - error = verify_area(VERIFY_READ, (void *) newinfo, sizeof(tmp)); - if (error) - return error; - if (copy_from_user(&tmp, newinfo, sizeof(tmp))) return -EFAULT; @@ -1813,16 +1808,11 @@ static inline int sx_set_serial_info(struct specialix_port * port, static inline int sx_get_serial_info(struct specialix_port * port, - struct serial_struct * retinfo) + struct serial_struct __user *retinfo) { struct serial_struct tmp; struct specialix_board *bp = port_Board(port); - int error; - error = verify_area(VERIFY_WRITE, (void *) retinfo, sizeof(tmp)); - if (error) - return error; - memset(&tmp, 0, sizeof(tmp)); tmp.type = PORT_CIRRUS; tmp.line = port - sx_port; @@ -1844,8 +1834,8 @@ static int sx_ioctl(struct tty_struct * tty, struct file * filp, unsigned int cmd, unsigned long arg) { struct specialix_port *port = (struct specialix_port *)tty->driver_data; - int error; int retval; + void __user *argp = (void __user *)arg; if (sx_paranoia_check(port, tty->name, "sx_ioctl")) return -ENODEV; @@ -1867,22 +1857,20 @@ static int sx_ioctl(struct tty_struct * tty, struct file * filp, sx_send_break(port, arg ? arg*(HZ/10) : HZ/4); return 0; case TIOCGSOFTCAR: - error = verify_area(VERIFY_WRITE, (void *) arg, sizeof(long)); - if (error) - return error; - put_user(C_CLOCAL(tty) ? 1 : 0, - (unsigned long *) arg); + if (put_user(C_CLOCAL(tty)?1:0, (unsigned long __user *)argp)) + return -EFAULT; return 0; case TIOCSSOFTCAR: - get_user(arg, (unsigned long *) arg); + if (get_user(arg, (unsigned long __user *) argp)) + return -EFAULT; tty->termios->c_cflag = ((tty->termios->c_cflag & ~CLOCAL) | (arg ? CLOCAL : 0)); return 0; case TIOCGSERIAL: - return sx_get_serial_info(port, (struct serial_struct *) arg); + return sx_get_serial_info(port, argp); case TIOCSSERIAL: - return sx_set_serial_info(port, (struct serial_struct *) arg); + return sx_set_serial_info(port, argp); default: return -ENOIOCTLCMD; } @@ -2027,7 +2015,7 @@ static void sx_hangup(struct tty_struct * tty) port->event = 0; port->count = 0; port->flags &= ~ASYNC_NORMAL_ACTIVE; - port->tty = 0; + port->tty = NULL; wake_up_interruptible(&port->open_wait); } diff --git a/drivers/char/stallion.c b/drivers/char/stallion.c index 04955d41adf7eb..a0b3ba7b058649 100644 --- a/drivers/char/stallion.c +++ b/drivers/char/stallion.c @@ -504,13 +504,13 @@ static int stl_readproc(char *page, char **start, off_t off, int count, int *eof static int stl_brdinit(stlbrd_t *brdp); static int stl_initports(stlbrd_t *brdp, stlpanel_t *panelp); static int stl_mapirq(int irq, char *name); -static int stl_getserial(stlport_t *portp, struct serial_struct *sp); -static int stl_setserial(stlport_t *portp, struct serial_struct *sp); -static int stl_getbrdstats(combrd_t *bp); -static int stl_getportstats(stlport_t *portp, comstats_t *cp); -static int stl_clrportstats(stlport_t *portp, comstats_t *cp); -static int stl_getportstruct(unsigned long arg); -static int stl_getbrdstruct(unsigned long arg); +static int stl_getserial(stlport_t *portp, struct serial_struct __user *sp); +static int stl_setserial(stlport_t *portp, struct serial_struct __user *sp); +static int stl_getbrdstats(combrd_t __user *bp); +static int stl_getportstats(stlport_t *portp, comstats_t __user *cp); +static int stl_clrportstats(stlport_t *portp, comstats_t __user *cp); +static int stl_getportstruct(stlport_t __user *arg); +static int stl_getbrdstruct(stlbrd_t __user *arg); static int stl_waitcarrier(stlport_t *portp, struct file *filp); static void stl_delay(int len); static void stl_eiointr(stlbrd_t *brdp); @@ -745,7 +745,7 @@ static int __init stallion_module_init(void) { unsigned long flags; -#if DEBUG +#ifdef DEBUG printk("init_module()\n"); #endif @@ -767,7 +767,7 @@ static void __exit stallion_module_exit(void) unsigned long flags; int i, j, k; -#if DEBUG +#ifdef DEBUG printk("cleanup_module()\n"); #endif @@ -847,13 +847,13 @@ module_exit(stallion_module_exit); * Check for any arguments passed in on the module load command line. */ -static void stl_argbrds() +static void stl_argbrds(void) { stlconf_t conf; stlbrd_t *brdp; int nrargs, i; -#if DEBUG +#ifdef DEBUG printk("stl_argbrds()\n"); #endif @@ -923,7 +923,7 @@ static int stl_parsebrd(stlconf_t *confp, char **argp) char *sp; int nrbrdnames, i; -#if DEBUG +#ifdef DEBUG printk("stl_parsebrd(confp=%x,argp=%x)\n", (int) confp, (int) argp); #endif @@ -978,7 +978,7 @@ static void *stl_memalloc(int len) * Allocate a new board structure. Fill out the basic info in it. */ -static stlbrd_t *stl_allocbrd() +static stlbrd_t *stl_allocbrd(void) { stlbrd_t *brdp; @@ -1003,7 +1003,7 @@ static int stl_open(struct tty_struct *tty, struct file *filp) unsigned int minordev; int brdnr, panelnr, portnr, rc; -#if DEBUG +#ifdef DEBUG printk("stl_open(tty=%x,filp=%x): device=%s\n", (int) tty, (int) filp, tty->name); #endif @@ -1096,7 +1096,7 @@ static int stl_waitcarrier(stlport_t *portp, struct file *filp) unsigned long flags; int rc, doclocal; -#if DEBUG +#ifdef DEBUG printk("stl_waitcarrier(portp=%x,filp=%x)\n", (int) portp, (int) filp); #endif @@ -1148,7 +1148,7 @@ static void stl_close(struct tty_struct *tty, struct file *filp) stlport_t *portp; unsigned long flags; -#if DEBUG +#ifdef DEBUG printk("stl_close(tty=%x,filp=%x)\n", (int) tty, (int) filp); #endif @@ -1224,7 +1224,7 @@ static void stl_close(struct tty_struct *tty, struct file *filp) static void stl_delay(int len) { -#if DEBUG +#ifdef DEBUG printk("stl_delay(len=%d)\n", len); #endif if (len > 0) { @@ -1247,7 +1247,7 @@ static int stl_write(struct tty_struct *tty, int from_user, const unsigned char unsigned char *chbuf; char *head, *tail; -#if DEBUG +#ifdef DEBUG printk("stl_write(tty=%x,from_user=%d,buf=%x,count=%d)\n", (int) tty, from_user, (int) buf, count); #endif @@ -1324,7 +1324,7 @@ static void stl_putchar(struct tty_struct *tty, unsigned char ch) unsigned int len; char *head, *tail; -#if DEBUG +#ifdef DEBUG printk("stl_putchar(tty=%x,ch=%x)\n", (int) tty, (int) ch); #endif @@ -1362,7 +1362,7 @@ static void stl_flushchars(struct tty_struct *tty) { stlport_t *portp; -#if DEBUG +#ifdef DEBUG printk("stl_flushchars(tty=%x)\n", (int) tty); #endif @@ -1389,7 +1389,7 @@ static int stl_writeroom(struct tty_struct *tty) stlport_t *portp; char *head, *tail; -#if DEBUG +#ifdef DEBUG printk("stl_writeroom(tty=%x)\n", (int) tty); #endif @@ -1423,7 +1423,7 @@ static int stl_charsinbuffer(struct tty_struct *tty) unsigned int size; char *head, *tail; -#if DEBUG +#ifdef DEBUG printk("stl_charsinbuffer(tty=%x)\n", (int) tty); #endif @@ -1449,12 +1449,12 @@ static int stl_charsinbuffer(struct tty_struct *tty) * Generate the serial struct info. */ -static int stl_getserial(stlport_t *portp, struct serial_struct *sp) +static int stl_getserial(stlport_t *portp, struct serial_struct __user *sp) { struct serial_struct sio; stlbrd_t *brdp; -#if DEBUG +#ifdef DEBUG printk("stl_getserial(portp=%x,sp=%x)\n", (int) portp, (int) sp); #endif @@ -1490,11 +1490,11 @@ static int stl_getserial(stlport_t *portp, struct serial_struct *sp) * just quietly ignore any requests to change irq, etc. */ -static int stl_setserial(stlport_t *portp, struct serial_struct *sp) +static int stl_setserial(stlport_t *portp, struct serial_struct __user *sp) { struct serial_struct sio; -#if DEBUG +#ifdef DEBUG printk("stl_setserial(portp=%x,sp=%x)\n", (int) portp, (int) sp); #endif @@ -1567,8 +1567,9 @@ static int stl_ioctl(struct tty_struct *tty, struct file *file, unsigned int cmd stlport_t *portp; unsigned int ival; int rc; + void __user *argp = (void __user *)arg; -#if DEBUG +#ifdef DEBUG printk("stl_ioctl(tty=%x,file=%x,cmd=%x,arg=%x)\n", (int) tty, (int) file, cmd, (int) arg); #endif @@ -1590,36 +1591,26 @@ static int stl_ioctl(struct tty_struct *tty, struct file *file, unsigned int cmd switch (cmd) { case TIOCGSOFTCAR: rc = put_user(((tty->termios->c_cflag & CLOCAL) ? 1 : 0), - (unsigned int *) arg); + (unsigned __user *) argp); break; case TIOCSSOFTCAR: - if ((rc = verify_area(VERIFY_READ, (void *) arg, - sizeof(int))) == 0) { - get_user(ival, (unsigned int *) arg); - tty->termios->c_cflag = + if (get_user(ival, (unsigned int __user *) arg)) + return -EFAULT; + tty->termios->c_cflag = (tty->termios->c_cflag & ~CLOCAL) | (ival ? CLOCAL : 0); - } break; case TIOCGSERIAL: - if ((rc = verify_area(VERIFY_WRITE, (void *) arg, - sizeof(struct serial_struct))) == 0) - rc = stl_getserial(portp, (struct serial_struct *) arg); + rc = stl_getserial(portp, argp); break; case TIOCSSERIAL: - if ((rc = verify_area(VERIFY_READ, (void *) arg, - sizeof(struct serial_struct))) == 0) - rc = stl_setserial(portp, (struct serial_struct *) arg); + rc = stl_setserial(portp, argp); break; case COM_GETPORTSTATS: - if ((rc = verify_area(VERIFY_WRITE, (void *) arg, - sizeof(comstats_t))) == 0) - rc = stl_getportstats(portp, (comstats_t *) arg); + rc = stl_getportstats(portp, argp); break; case COM_CLRPORTSTATS: - if ((rc = verify_area(VERIFY_WRITE, (void *) arg, - sizeof(comstats_t))) == 0) - rc = stl_clrportstats(portp, (comstats_t *) arg); + rc = stl_clrportstats(portp, argp); break; case TIOCSERCONFIG: case TIOCSERGWILD: @@ -1643,7 +1634,7 @@ static void stl_settermios(struct tty_struct *tty, struct termios *old) stlport_t *portp; struct termios *tiosp; -#if DEBUG +#ifdef DEBUG printk("stl_settermios(tty=%x,old=%x)\n", (int) tty, (int) old); #endif @@ -1680,7 +1671,7 @@ static void stl_throttle(struct tty_struct *tty) { stlport_t *portp; -#if DEBUG +#ifdef DEBUG printk("stl_throttle(tty=%x)\n", (int) tty); #endif @@ -1702,7 +1693,7 @@ static void stl_unthrottle(struct tty_struct *tty) { stlport_t *portp; -#if DEBUG +#ifdef DEBUG printk("stl_unthrottle(tty=%x)\n", (int) tty); #endif @@ -1725,7 +1716,7 @@ static void stl_stop(struct tty_struct *tty) { stlport_t *portp; -#if DEBUG +#ifdef DEBUG printk("stl_stop(tty=%x)\n", (int) tty); #endif @@ -1747,7 +1738,7 @@ static void stl_start(struct tty_struct *tty) { stlport_t *portp; -#if DEBUG +#ifdef DEBUG printk("stl_start(tty=%x)\n", (int) tty); #endif @@ -1771,7 +1762,7 @@ static void stl_hangup(struct tty_struct *tty) { stlport_t *portp; -#if DEBUG +#ifdef DEBUG printk("stl_hangup(tty=%x)\n", (int) tty); #endif @@ -1807,7 +1798,7 @@ static void stl_flushbuffer(struct tty_struct *tty) { stlport_t *portp; -#if DEBUG +#ifdef DEBUG printk("stl_flushbuffer(tty=%x)\n", (int) tty); #endif @@ -1830,7 +1821,7 @@ static void stl_breakctl(struct tty_struct *tty, int state) { stlport_t *portp; -#if DEBUG +#ifdef DEBUG printk("stl_breakctl(tty=%x,state=%d)\n", (int) tty, state); #endif @@ -1850,7 +1841,7 @@ static void stl_waituntilsent(struct tty_struct *tty, int timeout) stlport_t *portp; unsigned long tend; -#if DEBUG +#ifdef DEBUG printk("stl_waituntilsent(tty=%x,timeout=%d)\n", (int) tty, timeout); #endif @@ -1879,7 +1870,7 @@ static void stl_sendxchar(struct tty_struct *tty, char ch) { stlport_t *portp; -#if DEBUG +#ifdef DEBUG printk("stl_sendxchar(tty=%x,ch=%x)\n", (int) tty, ch); #endif @@ -1960,7 +1951,7 @@ static int stl_readproc(char *page, char **start, off_t off, int count, int *eof int curoff, maxoff; char *pos; -#if DEBUG +#ifdef DEBUG printk("stl_readproc(page=%x,start=%x,off=%x,count=%d,eof=%x," "data=%x\n", (int) page, (int) start, (int) off, count, (int) eof, (int) data); @@ -2043,7 +2034,7 @@ static irqreturn_t stl_intr(int irq, void *dev_id, struct pt_regs *regs) int i; int handled = 0; -#if DEBUG +#ifdef DEBUG printk("stl_intr(irq=%d,regs=%x)\n", irq, (int) regs); #endif @@ -2189,7 +2180,7 @@ static void stl_offintr(void *private) portp = private; -#if DEBUG +#ifdef DEBUG printk("stl_offintr(portp=%x)\n", (int) portp); #endif @@ -2233,7 +2224,7 @@ static int __init stl_mapirq(int irq, char *name) { int rc, i; -#if DEBUG +#ifdef DEBUG printk("stl_mapirq(irq=%d,name=%s)\n", irq, name); #endif @@ -2265,7 +2256,7 @@ static int __init stl_initports(stlbrd_t *brdp, stlpanel_t *panelp) stlport_t *portp; int chipmask, i; -#if DEBUG +#ifdef DEBUG printk("stl_initports(brdp=%x,panelp=%x)\n", (int) brdp, (int) panelp); #endif @@ -2319,7 +2310,7 @@ static inline int stl_initeio(stlbrd_t *brdp) char *name; int rc; -#if DEBUG +#ifdef DEBUG printk("stl_initeio(brdp=%x)\n", (int) brdp); #endif @@ -2457,7 +2448,7 @@ static inline int stl_initech(stlbrd_t *brdp) int panelnr, banknr, i; char *name; -#if DEBUG +#ifdef DEBUG printk("stl_initech(brdp=%x)\n", (int) brdp); #endif @@ -2661,7 +2652,7 @@ static int __init stl_brdinit(stlbrd_t *brdp) { int i; -#if DEBUG +#ifdef DEBUG printk("stl_brdinit(brdp=%x)\n", (int) brdp); #endif @@ -2707,7 +2698,7 @@ static int __init stl_brdinit(stlbrd_t *brdp) * Find the next available board number that is free. */ -static inline int stl_getbrdnr() +static inline int stl_getbrdnr(void) { int i; @@ -2735,7 +2726,7 @@ static inline int stl_initpcibrd(int brdtype, struct pci_dev *devp) { stlbrd_t *brdp; -#if DEBUG +#ifdef DEBUG printk("stl_initpcibrd(brdtype=%d,busnr=%x,devnr=%x)\n", brdtype, devp->bus->number, devp->devfn); #endif @@ -2755,7 +2746,7 @@ static inline int stl_initpcibrd(int brdtype, struct pci_dev *devp) * Different Stallion boards use the BAR registers in different ways, * so set up io addresses based on board type. */ -#if DEBUG +#ifdef DEBUG printk("%s(%d): BAR[]=%x,%x,%x,%x IRQ=%x\n", __FILE__, __LINE__, pci_resource_start(devp, 0), pci_resource_start(devp, 1), pci_resource_start(devp, 2), pci_resource_start(devp, 3), devp->irq); @@ -2797,12 +2788,12 @@ static inline int stl_initpcibrd(int brdtype, struct pci_dev *devp) */ -static inline int stl_findpcibrds() +static inline int stl_findpcibrds(void) { struct pci_dev *dev = NULL; int i, rc; -#if DEBUG +#ifdef DEBUG printk("stl_findpcibrds()\n"); #endif @@ -2835,13 +2826,13 @@ static inline int stl_findpcibrds() * since the initial search and setup is too different. */ -static inline int stl_initbrds() +static inline int stl_initbrds(void) { stlbrd_t *brdp; stlconf_t *confp; int i; -#if DEBUG +#ifdef DEBUG printk("stl_initbrds()\n"); #endif @@ -2891,7 +2882,7 @@ static inline int stl_initbrds() * Return the board stats structure to user app. */ -static int stl_getbrdstats(combrd_t *bp) +static int stl_getbrdstats(combrd_t __user *bp) { stlbrd_t *brdp; stlpanel_t *panelp; @@ -2959,12 +2950,12 @@ static stlport_t *stl_getport(int brdnr, int panelnr, int portnr) * what port to get stats for (used through board control device). */ -static int stl_getportstats(stlport_t *portp, comstats_t *cp) +static int stl_getportstats(stlport_t *portp, comstats_t __user *cp) { unsigned char *head, *tail; unsigned long flags; - if (portp == (stlport_t *) NULL) { + if (!portp) { if (copy_from_user(&stl_comstats, cp, sizeof(comstats_t))) return -EFAULT; portp = stl_getport(stl_comstats.brd, stl_comstats.panel, @@ -3017,9 +3008,9 @@ static int stl_getportstats(stlport_t *portp, comstats_t *cp) * Clear the port stats structure. We also return it zeroed out... */ -static int stl_clrportstats(stlport_t *portp, comstats_t *cp) +static int stl_clrportstats(stlport_t *portp, comstats_t __user *cp) { - if (portp == (stlport_t *) NULL) { + if (!portp) { if (copy_from_user(&stl_comstats, cp, sizeof(comstats_t))) return -EFAULT; portp = stl_getport(stl_comstats.brd, stl_comstats.panel, @@ -3042,18 +3033,17 @@ static int stl_clrportstats(stlport_t *portp, comstats_t *cp) * Return the entire driver ports structure to a user app. */ -static int stl_getportstruct(unsigned long arg) +static int stl_getportstruct(stlport_t __user *arg) { stlport_t *portp; - if (copy_from_user(&stl_dummyport, (void *) arg, sizeof(stlport_t))) + if (copy_from_user(&stl_dummyport, arg, sizeof(stlport_t))) return -EFAULT; portp = stl_getport(stl_dummyport.brdnr, stl_dummyport.panelnr, stl_dummyport.portnr); - if (portp == (stlport_t *) NULL) - return(-ENODEV); - return copy_to_user((void *)arg, portp, - sizeof(stlport_t)) ? -EFAULT : 0; + if (!portp) + return -ENODEV; + return copy_to_user(arg, portp, sizeof(stlport_t)) ? -EFAULT : 0; } /*****************************************************************************/ @@ -3062,18 +3052,18 @@ static int stl_getportstruct(unsigned long arg) * Return the entire driver board structure to a user app. */ -static int stl_getbrdstruct(unsigned long arg) +static int stl_getbrdstruct(stlbrd_t __user *arg) { stlbrd_t *brdp; - if (copy_from_user(&stl_dummybrd, (void *) arg, sizeof(stlbrd_t))) + if (copy_from_user(&stl_dummybrd, arg, sizeof(stlbrd_t))) return -EFAULT; if ((stl_dummybrd.brdnr < 0) || (stl_dummybrd.brdnr >= STL_MAXBRDS)) - return(-ENODEV); + return -ENODEV; brdp = stl_brds[stl_dummybrd.brdnr]; - if (brdp == (stlbrd_t *) NULL) + if (!brdp) return(-ENODEV); - return copy_to_user((void *)arg, brdp, sizeof(stlbrd_t)) ? -EFAULT : 0; + return copy_to_user(arg, brdp, sizeof(stlbrd_t)) ? -EFAULT : 0; } /*****************************************************************************/ @@ -3087,8 +3077,9 @@ static int stl_getbrdstruct(unsigned long arg) static int stl_memioctl(struct inode *ip, struct file *fp, unsigned int cmd, unsigned long arg) { int brdnr, rc; + void __user *argp = (void __user *)arg; -#if DEBUG +#ifdef DEBUG printk("stl_memioctl(ip=%x,fp=%x,cmd=%x,arg=%x)\n", (int) ip, (int) fp, cmd, (int) arg); #endif @@ -3100,31 +3091,19 @@ static int stl_memioctl(struct inode *ip, struct file *fp, unsigned int cmd, uns switch (cmd) { case COM_GETPORTSTATS: - if ((rc = verify_area(VERIFY_WRITE, (void *) arg, - sizeof(comstats_t))) == 0) - rc = stl_getportstats((stlport_t *) NULL, - (comstats_t *) arg); + rc = stl_getportstats(NULL, argp); break; case COM_CLRPORTSTATS: - if ((rc = verify_area(VERIFY_WRITE, (void *) arg, - sizeof(comstats_t))) == 0) - rc = stl_clrportstats((stlport_t *) NULL, - (comstats_t *) arg); + rc = stl_clrportstats(NULL, argp); break; case COM_GETBRDSTATS: - if ((rc = verify_area(VERIFY_WRITE, (void *) arg, - sizeof(combrd_t))) == 0) - rc = stl_getbrdstats((combrd_t *) arg); + rc = stl_getbrdstats(argp); break; case COM_READPORT: - if ((rc = verify_area(VERIFY_WRITE, (void *) arg, - sizeof(stlport_t))) == 0) - rc = stl_getportstruct(arg); + rc = stl_getportstruct(argp); break; case COM_READBOARD: - if ((rc = verify_area(VERIFY_WRITE, (void *) arg, - sizeof(stlbrd_t))) == 0) - rc = stl_getbrdstruct(arg); + rc = stl_getbrdstruct(argp); break; default: rc = -ENOIOCTLCMD; @@ -3262,7 +3241,7 @@ static int stl_cd1400panelinit(stlbrd_t *brdp, stlpanel_t *panelp) int chipmask, i, j; int nrchips, uartaddr, ioaddr; -#if DEBUG +#ifdef DEBUG printk("stl_panelinit(brdp=%x,panelp=%x)\n", (int) brdp, (int) panelp); #endif @@ -3314,7 +3293,7 @@ static int stl_cd1400panelinit(stlbrd_t *brdp, stlpanel_t *panelp) static void stl_cd1400portinit(stlbrd_t *brdp, stlpanel_t *panelp, stlport_t *portp) { -#if DEBUG +#ifdef DEBUG printk("stl_cd1400portinit(brdp=%x,panelp=%x,portp=%x)\n", (int) brdp, (int) panelp, (int) portp); #endif @@ -3529,7 +3508,7 @@ static void stl_cd1400setport(stlport_t *portp, struct termios *tiosp) * them all up. */ -#if DEBUG +#ifdef DEBUG printk("SETPORT: portnr=%d panelnr=%d brdnr=%d\n", portp->portnr, portp->panelnr, portp->brdnr); printk(" cor1=%x cor2=%x cor3=%x cor4=%x cor5=%x\n", @@ -3594,7 +3573,7 @@ static void stl_cd1400setsignals(stlport_t *portp, int dtr, int rts) unsigned char msvr1, msvr2; unsigned long flags; -#if DEBUG +#ifdef DEBUG printk("stl_cd1400setsignals(portp=%x,dtr=%d,rts=%d)\n", (int) portp, dtr, rts); #endif @@ -3630,7 +3609,7 @@ static int stl_cd1400getsignals(stlport_t *portp) unsigned long flags; int sigs; -#if DEBUG +#ifdef DEBUG printk("stl_cd1400getsignals(portp=%x)\n", (int) portp); #endif @@ -3668,7 +3647,7 @@ static void stl_cd1400enablerxtx(stlport_t *portp, int rx, int tx) unsigned char ccr; unsigned long flags; -#if DEBUG +#ifdef DEBUG printk("stl_cd1400enablerxtx(portp=%x,rx=%d,tx=%d)\n", (int) portp, rx, tx); #endif @@ -3705,7 +3684,7 @@ static void stl_cd1400startrxtx(stlport_t *portp, int rx, int tx) unsigned char sreron, sreroff; unsigned long flags; -#if DEBUG +#ifdef DEBUG printk("stl_cd1400startrxtx(portp=%x,rx=%d,tx=%d)\n", (int) portp, rx, tx); #endif @@ -3745,7 +3724,7 @@ static void stl_cd1400disableintrs(stlport_t *portp) { unsigned long flags; -#if DEBUG +#ifdef DEBUG printk("stl_cd1400disableintrs(portp=%x)\n", (int) portp); #endif save_flags(flags); @@ -3763,7 +3742,7 @@ static void stl_cd1400sendbreak(stlport_t *portp, int len) { unsigned long flags; -#if DEBUG +#ifdef DEBUG printk("stl_cd1400sendbreak(portp=%x,len=%d)\n", (int) portp, len); #endif @@ -3792,7 +3771,7 @@ static void stl_cd1400flowctrl(stlport_t *portp, int state) struct tty_struct *tty; unsigned long flags; -#if DEBUG +#ifdef DEBUG printk("stl_cd1400flowctrl(portp=%x,state=%x)\n", (int) portp, state); #endif @@ -3857,7 +3836,7 @@ static void stl_cd1400sendflow(stlport_t *portp, int state) struct tty_struct *tty; unsigned long flags; -#if DEBUG +#ifdef DEBUG printk("stl_cd1400sendflow(portp=%x,state=%x)\n", (int) portp, state); #endif @@ -3892,7 +3871,7 @@ static void stl_cd1400flush(stlport_t *portp) { unsigned long flags; -#if DEBUG +#ifdef DEBUG printk("stl_cd1400flush(portp=%x)\n", (int) portp); #endif @@ -3922,7 +3901,7 @@ static void stl_cd1400flush(stlport_t *portp) static int stl_cd1400datastate(stlport_t *portp) { -#if DEBUG +#ifdef DEBUG printk("stl_cd1400datastate(portp=%x)\n", (int) portp); #endif @@ -3942,7 +3921,7 @@ static void stl_cd1400eiointr(stlpanel_t *panelp, unsigned int iobase) { unsigned char svrtype; -#if DEBUG +#ifdef DEBUG printk("stl_cd1400eiointr(panelp=%x,iobase=%x)\n", (int) panelp, iobase); #endif @@ -3972,7 +3951,7 @@ static void stl_cd1400echintr(stlpanel_t *panelp, unsigned int iobase) { unsigned char svrtype; -#if DEBUG +#ifdef DEBUG printk("stl_cd1400echintr(panelp=%x,iobase=%x)\n", (int) panelp, iobase); #endif @@ -4046,7 +4025,7 @@ static void stl_cd1400txisr(stlpanel_t *panelp, int ioaddr) char *head, *tail; unsigned char ioack, srer; -#if DEBUG +#ifdef DEBUG printk("stl_cd1400txisr(panelp=%x,ioaddr=%x)\n", (int) panelp, ioaddr); #endif @@ -4128,7 +4107,7 @@ static void stl_cd1400rxisr(stlpanel_t *panelp, int ioaddr) unsigned char status; char ch; -#if DEBUG +#ifdef DEBUG printk("stl_cd1400rxisr(panelp=%x,ioaddr=%x)\n", (int) panelp, ioaddr); #endif @@ -4237,7 +4216,7 @@ static void stl_cd1400mdmisr(stlpanel_t *panelp, int ioaddr) unsigned int ioack; unsigned char misr; -#if DEBUG +#ifdef DEBUG printk("stl_cd1400mdmisr(panelp=%x)\n", (int) panelp); #endif @@ -4326,7 +4305,7 @@ static int stl_sc26198panelinit(stlbrd_t *brdp, stlpanel_t *panelp) int chipmask, i; int nrchips, ioaddr; -#if DEBUG +#ifdef DEBUG printk("stl_sc26198panelinit(brdp=%x,panelp=%x)\n", (int) brdp, (int) panelp); #endif @@ -4371,7 +4350,7 @@ static int stl_sc26198panelinit(stlbrd_t *brdp, stlpanel_t *panelp) static void stl_sc26198portinit(stlbrd_t *brdp, stlpanel_t *panelp, stlport_t *portp) { -#if DEBUG +#ifdef DEBUG printk("stl_sc26198portinit(brdp=%x,panelp=%x,portp=%x)\n", (int) brdp, (int) panelp, (int) portp); #endif @@ -4548,7 +4527,7 @@ static void stl_sc26198setport(stlport_t *portp, struct termios *tiosp) * them all up. */ -#if DEBUG +#ifdef DEBUG printk("SETPORT: portnr=%d panelnr=%d brdnr=%d\n", portp->portnr, portp->panelnr, portp->brdnr); printk(" mr0=%x mr1=%x mr2=%x clk=%x\n", mr0, mr1, mr2, clk); @@ -4600,7 +4579,7 @@ static void stl_sc26198setsignals(stlport_t *portp, int dtr, int rts) unsigned char iopioron, iopioroff; unsigned long flags; -#if DEBUG +#ifdef DEBUG printk("stl_sc26198setsignals(portp=%x,dtr=%d,rts=%d)\n", (int) portp, dtr, rts); #endif @@ -4637,7 +4616,7 @@ static int stl_sc26198getsignals(stlport_t *portp) unsigned long flags; int sigs; -#if DEBUG +#ifdef DEBUG printk("stl_sc26198getsignals(portp=%x)\n", (int) portp); #endif @@ -4668,7 +4647,7 @@ static void stl_sc26198enablerxtx(stlport_t *portp, int rx, int tx) unsigned char ccr; unsigned long flags; -#if DEBUG +#ifdef DEBUG printk("stl_sc26198enablerxtx(portp=%x,rx=%d,tx=%d)\n", (int) portp, rx, tx); #endif @@ -4703,7 +4682,7 @@ static void stl_sc26198startrxtx(stlport_t *portp, int rx, int tx) unsigned char imr; unsigned long flags; -#if DEBUG +#ifdef DEBUG printk("stl_sc26198startrxtx(portp=%x,rx=%d,tx=%d)\n", (int) portp, rx, tx); #endif @@ -4739,7 +4718,7 @@ static void stl_sc26198disableintrs(stlport_t *portp) { unsigned long flags; -#if DEBUG +#ifdef DEBUG printk("stl_sc26198disableintrs(portp=%x)\n", (int) portp); #endif @@ -4758,7 +4737,7 @@ static void stl_sc26198sendbreak(stlport_t *portp, int len) { unsigned long flags; -#if DEBUG +#ifdef DEBUG printk("stl_sc26198sendbreak(portp=%x,len=%d)\n", (int) portp, len); #endif @@ -4787,7 +4766,7 @@ static void stl_sc26198flowctrl(stlport_t *portp, int state) unsigned long flags; unsigned char mr0; -#if DEBUG +#ifdef DEBUG printk("stl_sc26198flowctrl(portp=%x,state=%x)\n", (int) portp, state); #endif @@ -4859,7 +4838,7 @@ static void stl_sc26198sendflow(stlport_t *portp, int state) unsigned long flags; unsigned char mr0; -#if DEBUG +#ifdef DEBUG printk("stl_sc26198sendflow(portp=%x,state=%x)\n", (int) portp, state); #endif @@ -4899,7 +4878,7 @@ static void stl_sc26198flush(stlport_t *portp) { unsigned long flags; -#if DEBUG +#ifdef DEBUG printk("stl_sc26198flush(portp=%x)\n", (int) portp); #endif @@ -4931,7 +4910,7 @@ static int stl_sc26198datastate(stlport_t *portp) unsigned long flags; unsigned char sr; -#if DEBUG +#ifdef DEBUG printk("stl_sc26198datastate(portp=%x)\n", (int) portp); #endif @@ -4961,7 +4940,7 @@ static void stl_sc26198wait(stlport_t *portp) { int i; -#if DEBUG +#ifdef DEBUG printk("stl_sc26198wait(portp=%x)\n", (int) portp); #endif @@ -5039,7 +5018,7 @@ static void stl_sc26198txisr(stlport_t *portp) int len, stlen; char *head, *tail; -#if DEBUG +#ifdef DEBUG printk("stl_sc26198txisr(portp=%x)\n", (int) portp); #endif @@ -5100,7 +5079,7 @@ static void stl_sc26198rxisr(stlport_t *portp, unsigned int iack) struct tty_struct *tty; unsigned int len, buflen, ioaddr; -#if DEBUG +#ifdef DEBUG printk("stl_sc26198rxisr(portp=%x,iack=%x)\n", (int) portp, iack); #endif @@ -5256,7 +5235,7 @@ static void stl_sc26198otherisr(stlport_t *portp, unsigned int iack) { unsigned char cir, ipr, xisr; -#if DEBUG +#ifdef DEBUG printk("stl_sc26198otherisr(portp=%x,iack=%x)\n", (int) portp, iack); #endif diff --git a/drivers/char/sx.c b/drivers/char/sx.c index 14d68735b26e7e..1ca3d2543d75ef 100644 --- a/drivers/char/sx.c +++ b/drivers/char/sx.c @@ -1594,7 +1594,8 @@ static int sx_fw_ioctl (struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg) { int rc = 0; - int *descr = (int *)arg, i; + int __user *descr = (int __user *)arg; + int i; static struct sx_board *board = NULL; int nbytes, offset; unsigned long data; @@ -1670,7 +1671,7 @@ static int sx_fw_ioctl (struct inode *inode, struct file *filp, get_user (data, descr++); while (nbytes && data) { for (i=0;i<nbytes;i += SX_CHUNK_SIZE) { - if (copy_from_user(tmp, (char *)data + i, + if (copy_from_user(tmp, (char __user *)data+i, (i + SX_CHUNK_SIZE > nbytes) ? nbytes - i : SX_CHUNK_SIZE)) { @@ -1776,6 +1777,7 @@ static int sx_ioctl (struct tty_struct * tty, struct file * filp, { int rc; struct sx_port *port = tty->driver_data; + void __user *argp = (void __user *)arg; int ival; /* func_enter2(); */ @@ -1784,24 +1786,20 @@ static int sx_ioctl (struct tty_struct * tty, struct file * filp, switch (cmd) { case TIOCGSOFTCAR: rc = put_user(((tty->termios->c_cflag & CLOCAL) ? 1 : 0), - (unsigned int *) arg); + (unsigned __user *) argp); break; case TIOCSSOFTCAR: - if ((rc = get_user(ival, (unsigned int *) arg)) == 0) { + if ((rc = get_user(ival, (unsigned __user *) argp)) == 0) { tty->termios->c_cflag = (tty->termios->c_cflag & ~CLOCAL) | (ival ? CLOCAL : 0); } break; case TIOCGSERIAL: - if ((rc = verify_area(VERIFY_WRITE, (void *) arg, - sizeof(struct serial_struct))) == 0) - rc = gs_getserial(&port->gs, (struct serial_struct *) arg); + rc = gs_getserial(&port->gs, argp); break; case TIOCSSERIAL: - if ((rc = verify_area(VERIFY_READ, (void *) arg, - sizeof(struct serial_struct))) == 0) - rc = gs_setserial(&port->gs, (struct serial_struct *) arg); + rc = gs_setserial(&port->gs, argp); break; default: rc = -ENOIOCTLCMD; diff --git a/drivers/isdn/hardware/avm/b1.c b/drivers/isdn/hardware/avm/b1.c index daa4b55a783cd1..c87516ab20b018 100644 --- a/drivers/isdn/hardware/avm/b1.c +++ b/drivers/isdn/hardware/avm/b1.c @@ -67,14 +67,14 @@ avmcard *b1_alloc_card(int nr_controllers) card = kmalloc(sizeof(*card), GFP_KERNEL); if (!card) - return 0; + return NULL; memset(card, 0, sizeof(*card)); cinfo = kmalloc(sizeof(*cinfo) * nr_controllers, GFP_KERNEL); if (!cinfo) { kfree(card); - return 0; + return NULL; } memset(cinfo, 0, sizeof(*cinfo) * nr_controllers); @@ -753,7 +753,7 @@ avmcard_dma_alloc(char *name, struct pci_dev *pdev, long rsize, long ssize) err_kfree: kfree(p); err: - return 0; + return NULL; } void avmcard_dma_free(avmcard_dmainfo *p) diff --git a/drivers/isdn/hysdn/hycapi.c b/drivers/isdn/hysdn/hycapi.c index f5fb795650b184..4f639037f1f348 100644 --- a/drivers/isdn/hysdn/hycapi.c +++ b/drivers/isdn/hysdn/hycapi.c @@ -96,7 +96,7 @@ hycapi_remove_ctr(struct capi_ctr *ctrl) } } detach_capi_ctr(ctrl); - ctrl->driverdata = 0; + ctrl->driverdata = NULL; kfree(card->hyctrlinfo); @@ -678,7 +678,7 @@ attach the capi-driver to the kernel-capi. ***********************************************************/ -int hycapi_init() +int hycapi_init(void) { int i; for(i=0;i<CAPI_MAXAPPL;i++) { diff --git a/drivers/isdn/hysdn/hysdn_procconf.c b/drivers/isdn/hysdn/hysdn_procconf.c index 2a312dee7743fd..a0983206dcf9aa 100644 --- a/drivers/isdn/hysdn/hysdn_procconf.c +++ b/drivers/isdn/hysdn/hysdn_procconf.c @@ -89,7 +89,7 @@ process_line(struct conf_writedata *cnf) /* write conf file -> boot or send cfg line to card */ /****************************************************/ static ssize_t -hysdn_conf_write(struct file *file, const char *buf, size_t count, loff_t * off) +hysdn_conf_write(struct file *file, const char __user *buf, size_t count, loff_t * off) { struct conf_writedata *cnf; int i; @@ -209,7 +209,7 @@ hysdn_conf_write(struct file *file, const char *buf, size_t count, loff_t * off) /* read conf file -> output card info data */ /*******************************************/ static ssize_t -hysdn_conf_read(struct file *file, char *buf, size_t count, loff_t * off) +hysdn_conf_read(struct file *file, char __user *buf, size_t count, loff_t * off) { char *cp; int i; diff --git a/drivers/isdn/hysdn/hysdn_proclog.c b/drivers/isdn/hysdn/hysdn_proclog.c index 4211cd0424be15..648e032868f191 100644 --- a/drivers/isdn/hysdn/hysdn_proclog.c +++ b/drivers/isdn/hysdn/hysdn_proclog.c @@ -150,7 +150,7 @@ put_log_buffer(hysdn_card * card, char *cp) /* write log file -> set log level bits */ /****************************************/ static ssize_t -hysdn_log_write(struct file *file, const char *buf, size_t count, loff_t * off) +hysdn_log_write(struct file *file, const char __user *buf, size_t count, loff_t * off) { ulong u = 0; int found = 0; @@ -203,7 +203,7 @@ hysdn_log_write(struct file *file, const char *buf, size_t count, loff_t * off) /* read log file */ /******************/ static ssize_t -hysdn_log_read(struct file *file, char *buf, size_t count, loff_t * off) +hysdn_log_read(struct file *file, char __user *buf, size_t count, loff_t * off) { struct log_data *inf; int len; diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c index 773f9bfe78fa37..b28f29005023ea 100644 --- a/drivers/md/raid5.c +++ b/drivers/md/raid5.c @@ -55,7 +55,7 @@ */ #define RAID5_DEBUG 0 #define RAID5_PARANOIA 1 -#if RAID5_PARANOIA && CONFIG_SMP +#if RAID5_PARANOIA && defined(CONFIG_SMP) # define CHECK_DEVLOCK() if (!spin_is_locked(&conf->device_lock)) BUG() #else # define CHECK_DEVLOCK() diff --git a/drivers/md/raid6main.c b/drivers/md/raid6main.c index 714dfb2e17d253..1ad99be9c5fb5c 100644 --- a/drivers/md/raid6main.c +++ b/drivers/md/raid6main.c @@ -61,7 +61,7 @@ #define RAID6_DEBUG 0 /* Extremely verbose printk */ #define RAID6_PARANOIA 1 /* Check spinlocks */ #define RAID6_DUMPSTATE 0 /* Include stripe cache state in /proc/mdstat */ -#if RAID6_PARANOIA && CONFIG_SMP +#if RAID6_PARANOIA && defined(CONFIG_SMP) # define CHECK_DEVLOCK() if (!spin_is_locked(&conf->device_lock)) BUG() #else # define CHECK_DEVLOCK() diff --git a/drivers/net/hamradio/6pack.c b/drivers/net/hamradio/6pack.c index f5b9af0ae8a86b..e6dba5623add40 100644 --- a/drivers/net/hamradio/6pack.c +++ b/drivers/net/hamradio/6pack.c @@ -731,7 +731,7 @@ static void sixpack_close(struct tty_struct *tty) write_lock(&disc_data_lock); sp = tty->disc_data; - tty->disc_data = 0; + tty->disc_data = NULL; write_unlock(&disc_data_lock); if (sp == 0) return; @@ -750,7 +750,7 @@ static void sixpack_close(struct tty_struct *tty) unregister_netdev(sp->dev); } -static int sp_set_mac_address(struct net_device *dev, void *addr) +static int sp_set_mac_address(struct net_device *dev, void __user *addr) { return copy_from_user(dev->dev_addr, addr, AX25_ADDR_LEN) ? -EFAULT : 0; } @@ -767,16 +767,16 @@ static int sixpack_ioctl(struct tty_struct *tty, struct file *file, switch(cmd) { case SIOCGIFNAME: - err = copy_to_user((void *) arg, sp->dev->name, + err = copy_to_user((void __user *) arg, sp->dev->name, strlen(sp->dev->name) + 1) ? -EFAULT : 0; break; case SIOCGIFENCAP: - err = put_user(0, (int *)arg); + err = put_user(0, (int __user *)arg); break; case SIOCSIFENCAP: - if (get_user(tmp, (int *) arg)) { + if (get_user(tmp, (int __user *) arg)) { err = -EFAULT; break; } @@ -790,7 +790,7 @@ static int sixpack_ioctl(struct tty_struct *tty, struct file *file, break; case SIOCSIFHWADDR: - err = sp_set_mac_address(sp->dev, (void *) arg); + err = sp_set_mac_address(sp->dev, (void __user *) arg); break; /* Allow stty to read, but not set, the serial port */ diff --git a/drivers/net/hamradio/mkiss.c b/drivers/net/hamradio/mkiss.c index 4d29cf4d5249fa..c7076aa0b3c383 100644 --- a/drivers/net/hamradio/mkiss.c +++ b/drivers/net/hamradio/mkiss.c @@ -626,7 +626,7 @@ static void ax25_close(struct tty_struct *tty) unregister_netdev(ax->dev); - tty->disc_data = 0; + tty->disc_data = NULL; ax->tty = NULL; ax_free(ax); @@ -774,7 +774,7 @@ static void kiss_unesc(struct ax_disp *ax, unsigned char s) } -static int ax_set_mac_address(struct net_device *dev, void *addr) +static int ax_set_mac_address(struct net_device *dev, void __user *addr) { if (copy_from_user(dev->dev_addr, addr, AX25_ADDR_LEN)) return -EFAULT; @@ -792,7 +792,7 @@ static int ax_set_dev_mac_address(struct net_device *dev, void *addr) /* Perform I/O control on an active ax25 channel. */ -static int ax25_disp_ioctl(struct tty_struct *tty, void *file, int cmd, void *arg) +static int ax25_disp_ioctl(struct tty_struct *tty, void *file, int cmd, void __user *arg) { struct ax_disp *ax = (struct ax_disp *) tty->disc_data; unsigned int tmp; @@ -808,10 +808,10 @@ static int ax25_disp_ioctl(struct tty_struct *tty, void *file, int cmd, void *ar return 0; case SIOCGIFENCAP: - return put_user(4, (int *)arg); + return put_user(4, (int __user *)arg); case SIOCSIFENCAP: - if (get_user(tmp, (int *)arg)) + if (get_user(tmp, (int __user *)arg)) return -EFAULT; ax->mode = tmp; ax->dev->addr_len = AX25_ADDR_LEN; /* sizeof an AX.25 addr */ diff --git a/drivers/net/skfp/fplustm.c b/drivers/net/skfp/fplustm.c index 1f3b423f2635d4..76e78442fc2470 100644 --- a/drivers/net/skfp/fplustm.c +++ b/drivers/net/skfp/fplustm.c @@ -1075,7 +1075,7 @@ static struct s_fpmc* mac_get_mc_table(struct s_smc *smc, for (i = 0 ; i < 6 ; i++, p++) *p = canonical[*p] ; } - slot = 0 ; + slot = NULL; for (i = 0, tb = smc->hw.fp.mc.table ; i < FPMAX_MULTICAST ; i++, tb++){ if (!tb->n) { /* not used */ if (!del && !slot) /* if !del save first free */ diff --git a/drivers/net/skfp/hwmtm.c b/drivers/net/skfp/hwmtm.c index 8016c9ae14e127..6a74332f0e8b22 100644 --- a/drivers/net/skfp/hwmtm.c +++ b/drivers/net/skfp/hwmtm.c @@ -1981,7 +1981,7 @@ void mac_drv_clear_txd(struct s_smc *smc) { struct s_smt_tx_queue *queue ; struct s_smt_fp_txd volatile *t1 ; - struct s_smt_fp_txd volatile *t2=0 ; + struct s_smt_fp_txd volatile *t2 = NULL ; SMbuf *mb ; u_long tbctrl ; int i ; diff --git a/drivers/net/skfp/pmf.c b/drivers/net/skfp/pmf.c index e9422e654cbf9f..f2b446d8b0bffc 100644 --- a/drivers/net/skfp/pmf.c +++ b/drivers/net/skfp/pmf.c @@ -558,8 +558,8 @@ void smt_add_para(struct s_smc *smc, struct s_pcon *pcon, u_short para, { struct smt_para *pa ; const struct s_p_tab *pt ; - struct fddi_mib_m *mib_m = 0 ; - struct fddi_mib_p *mib_p = 0 ; + struct fddi_mib_m *mib_m = NULL; + struct fddi_mib_p *mib_p = NULL; int len ; int plen ; char *from ; @@ -644,7 +644,7 @@ void smt_add_para(struct s_smc *smc, struct s_pcon *pcon, u_short para, /* * check special paras */ - swap = 0 ; + swap = NULL; switch (para) { case SMT_P10F0 : case SMT_P10F1 : @@ -1091,9 +1091,9 @@ int smt_set_para(struct s_smc *smc, struct smt_para *pa, int index, int local, char c ; char *mib_addr ; struct fddi_mib *mib ; - struct fddi_mib_m *mib_m = 0 ; - struct fddi_mib_a *mib_a = 0 ; - struct fddi_mib_p *mib_p = 0 ; + struct fddi_mib_m *mib_m = NULL; + struct fddi_mib_a *mib_a = NULL; + struct fddi_mib_p *mib_p = NULL; int mac ; int path ; int port ; @@ -1533,7 +1533,7 @@ static const struct s_p_tab *smt_get_ptab(u_short para) const struct s_p_tab *pt ; for (pt = p_tab ; pt->p_num && pt->p_num != para ; pt++) ; - return(pt->p_num ? pt : 0) ; + return(pt->p_num ? pt : NULL) ; } static int smt_mib_phys(struct s_smc *smc) diff --git a/drivers/net/skfp/smt.c b/drivers/net/skfp/smt.c index 43f78c74c84537..721569b5e4a065 100644 --- a/drivers/net/skfp/smt.c +++ b/drivers/net/skfp/smt.c @@ -1701,7 +1701,7 @@ void *sm_to_para(struct s_smc *smc, struct smt_header *sm, int para) char *p ; int len ; int plen ; - void *found = 0 ; + void *found = NULL; SK_UNUSED(smc) ; @@ -1715,16 +1715,16 @@ void *sm_to_para(struct s_smc *smc, struct smt_header *sm, int para) len -= plen ; if (len < 0) { DB_SMT("SMT : sm_to_para - length error %d\n",plen,0) ; - return(0) ; + return NULL; } if ((plen & 3) && (para != SMT_P_ECHODATA)) { DB_SMT("SMT : sm_to_para - odd length %d\n",plen,0) ; - return(0) ; + return NULL; } if (found) return(found) ; } - return(0) ; + return NULL; } #if 0 diff --git a/drivers/net/skfp/smtdef.c b/drivers/net/skfp/smtdef.c index 91fa855e3300f5..5a0c8db816d819 100644 --- a/drivers/net/skfp/smtdef.c +++ b/drivers/net/skfp/smtdef.c @@ -262,7 +262,7 @@ static void smt_init_mib(struct s_smc *smc, int level) */ /* Attention: don't initialize mib pointer here! */ /* It must be initialized during phase 2 */ - smc->y[port].mib = 0 ; + smc->y[port].mib = NULL; mib->fddiSMTPORTIndexes[port] = port+INDEX_PORT ; pm->fddiPORTIndex = port+INDEX_PORT ; diff --git a/drivers/net/skfp/smtparse.c b/drivers/net/skfp/smtparse.c index 0be1158ab9a090..d5779e414dbe23 100644 --- a/drivers/net/skfp/smtparse.c +++ b/drivers/net/skfp/smtparse.c @@ -73,7 +73,7 @@ static struct s_ptab { { "SBACOMMAND",16, 0 } , { "SBAAVAILABLE",17, 1, 0, 100 } , #endif - { 0 } + { NULL } } ; /* Define maximum string size for values and keybuffer */ diff --git a/drivers/net/skfp/smttimer.c b/drivers/net/skfp/smttimer.c index a82649b3598da1..531795e98c30d2 100644 --- a/drivers/net/skfp/smttimer.c +++ b/drivers/net/skfp/smttimer.c @@ -30,9 +30,9 @@ static void timer_done(struct s_smc *smc, int restart); void smt_timer_init(struct s_smc *smc) { - smc->t.st_queue = 0 ; + smc->t.st_queue = NULL; smc->t.st_fast.tm_active = FALSE ; - smc->t.st_fast.tm_next = 0 ; + smc->t.st_fast.tm_next = NULL; hwt_init(smc) ; } @@ -75,7 +75,7 @@ void smt_timer_start(struct s_smc *smc, struct smt_timer *timer, u_long time, timer->tm_active = TRUE ; if (!smc->t.st_queue) { smc->t.st_queue = timer ; - timer->tm_next = 0 ; + timer->tm_next = NULL; timer->tm_delta = time ; hwt_start(smc,time) ; return ; @@ -141,7 +141,7 @@ static void timer_done(struct s_smc *smc, int restart) done = 1 ; } } - *last = 0 ; + *last = NULL; next = smc->t.st_queue ; smc->t.st_queue = tm ; diff --git a/drivers/net/skfp/srf.c b/drivers/net/skfp/srf.c index f5b380b95db63f..16573aca8b6268 100644 --- a/drivers/net/skfp/srf.c +++ b/drivers/net/skfp/srf.c @@ -167,7 +167,7 @@ static struct s_srf_evc *smt_get_evc(struct s_smc *smc, int code, int index) if (evc->evc_code == code && evc->evc_index == index) return(evc) ; } - return(0) ; + return NULL; } #define THRESHOLD_2 (2*TICKS_PER_SECOND) diff --git a/drivers/net/tulip/xircom_tulip_cb.c b/drivers/net/tulip/xircom_tulip_cb.c index a01cc1b09c4a79..62417cc980eb18 100644 --- a/drivers/net/tulip/xircom_tulip_cb.c +++ b/drivers/net/tulip/xircom_tulip_cb.c @@ -756,7 +756,7 @@ xircom_up(struct net_device *dev) xircom_init_ring(dev); /* Clear the tx ring */ for (i = 0; i < TX_RING_SIZE; i++) { - tp->tx_skbuff[i] = 0; + tp->tx_skbuff[i] = NULL; tp->tx_ring[i].status = 0; } @@ -904,7 +904,7 @@ static void xircom_init_ring(struct net_device *dev) /* The Tx buffer descriptor is filled in as needed, but we do need to clear the ownership bit. */ for (i = 0; i < TX_RING_SIZE; i++) { - tp->tx_skbuff[i] = 0; + tp->tx_skbuff[i] = NULL; tp->tx_ring[i].status = 0; tp->tx_ring[i].buffer2 = virt_to_bus(&tp->tx_ring[i+1]); #ifdef CARDBUS @@ -1128,7 +1128,7 @@ static irqreturn_t xircom_interrupt(int irq, void *dev_instance, struct pt_regs /* Free the original skb. */ dev_kfree_skb_irq(tp->tx_skbuff[entry]); - tp->tx_skbuff[entry] = 0; + tp->tx_skbuff[entry] = NULL; } #ifndef final_version @@ -1338,7 +1338,7 @@ xircom_close(struct net_device *dev) /* Free all the skbuffs in the Rx queue. */ for (i = 0; i < RX_RING_SIZE; i++) { struct sk_buff *skb = tp->rx_skbuff[i]; - tp->rx_skbuff[i] = 0; + tp->rx_skbuff[i] = NULL; tp->rx_ring[i].status = 0; /* Not owned by Xircom chip. */ tp->rx_ring[i].length = 0; tp->rx_ring[i].buffer1 = 0xBADF00D0; /* An invalid address. */ @@ -1349,7 +1349,7 @@ xircom_close(struct net_device *dev) for (i = 0; i < TX_RING_SIZE; i++) { if (tp->tx_skbuff[i]) dev_kfree_skb(tp->tx_skbuff[i]); - tp->tx_skbuff[i] = 0; + tp->tx_skbuff[i] = NULL; } tp->open = 0; @@ -1629,7 +1629,7 @@ static void set_rx_mode(struct net_device *dev) if (entry != 0) { /* Avoid a chip errata by prefixing a dummy entry. */ - tp->tx_skbuff[entry] = 0; + tp->tx_skbuff[entry] = NULL; tp->tx_ring[entry].length = (entry == TX_RING_SIZE - 1) ? Tx1RingWrap : 0; tp->tx_ring[entry].buffer1 = 0; @@ -1638,7 +1638,7 @@ static void set_rx_mode(struct net_device *dev) entry = tp->cur_tx++ % TX_RING_SIZE; } - tp->tx_skbuff[entry] = 0; + tp->tx_skbuff[entry] = NULL; /* Put the setup frame on the Tx list. */ if (entry == TX_RING_SIZE - 1) tx_flags |= Tx1RingWrap; /* Wrap ring. */ diff --git a/drivers/net/wan/sbni.c b/drivers/net/wan/sbni.c index d0dd8974536141..8b1ef3e690217d 100644 --- a/drivers/net/wan/sbni.c +++ b/drivers/net/wan/sbni.c @@ -1578,7 +1578,7 @@ calc_crc32( u32 crc, u8 *p, u32 len ) register u32 _crc; _crc = crc; - __asm __volatile ( + __asm__ __volatile__ ( "xorl %%ebx, %%ebx\n" "movl %2, %%esi\n" "movl %3, %%ecx\n" diff --git a/drivers/video/aty/aty128fb.c b/drivers/video/aty/aty128fb.c index bd907297c46141..1c7bcd80f4ba0e 100644 --- a/drivers/video/aty/aty128fb.c +++ b/drivers/video/aty/aty128fb.c @@ -2149,7 +2149,7 @@ static int aty128fb_ioctl(struct inode *inode, struct file *file, u_int cmd, case FBIO_ATY128_SET_MIRROR: if (par->chip_gen != rage_M3) return -EINVAL; - rc = get_user(value, (__u32*)arg); + rc = get_user(value, (__u32 __user *)arg); if (rc) return rc; par->lcd_on = (value & 0x01) != 0; @@ -2163,7 +2163,7 @@ static int aty128fb_ioctl(struct inode *inode, struct file *file, u_int cmd, if (par->chip_gen != rage_M3) return -EINVAL; value = (par->crt_on << 1) | par->lcd_on; - return put_user(value, (__u32*)arg); + return put_user(value, (__u32 __user *)arg); } #endif return -EINVAL; diff --git a/drivers/video/aty/atyfb_base.c b/drivers/video/aty/atyfb_base.c index a655884f432aa8..37177becebcba8 100644 --- a/drivers/video/aty/atyfb_base.c +++ b/drivers/video/aty/atyfb_base.c @@ -1037,7 +1037,7 @@ static int atyfb_ioctl(struct inode *inode, struct file *file, u_int cmd, fbtyp.fb_cmsize = info->cmap.len; fbtyp.fb_size = info->fix.smem_len; if (copy_to_user - ((struct fbtype *) arg, &fbtyp, sizeof(fbtyp))) + ((struct fbtype __user *) arg, &fbtyp, sizeof(fbtyp))) return -EFAULT; break; #endif /* __sparc__ */ diff --git a/drivers/video/cg14.c b/drivers/video/cg14.c index 40d28baf46c200..e0fc4c02c3bf80 100644 --- a/drivers/video/cg14.c +++ b/drivers/video/cg14.c @@ -278,7 +278,7 @@ static int cg14_ioctl(struct inode *inode, struct file *file, unsigned int cmd, { struct cg14_par *par = (struct cg14_par *) info->par; struct cg14_regs *regs = par->regs; - struct mdi_cfginfo kmdi, *mdii; + struct mdi_cfginfo kmdi, __user *mdii; unsigned long flags; int cur_mode, mode, ret = 0; @@ -301,13 +301,13 @@ static int cg14_ioctl(struct inode *inode, struct file *file, unsigned int cmd, kmdi.mdi_size = par->ramsize; spin_unlock_irqrestore(&par->lock, flags); - mdii = (struct mdi_cfginfo *) arg; + mdii = (struct mdi_cfginfo __user *) arg; if (copy_to_user(mdii, &kmdi, sizeof(kmdi))) ret = -EFAULT; break; case MDI_SET_PIXELMODE: - if (get_user(mode, (int *) arg)) { + if (get_user(mode, (int __user *) arg)) { ret = -EFAULT; break; } diff --git a/drivers/video/matrox/matroxfb_base.h b/drivers/video/matrox/matroxfb_base.h index 152dde87c558e0..18938f11936d95 100644 --- a/drivers/video/matrox/matroxfb_base.h +++ b/drivers/video/matrox/matroxfb_base.h @@ -217,21 +217,21 @@ static inline void mga_memcpy_toio(vaddr_t va, unsigned int offs, const void* sr #ifdef MEMCPYTOIO_WORKS memcpy_toio(va.vaddr + offs, src, len); #elif defined(MEMCPYTOIO_WRITEL) -#define srcd ((const u_int32_t*)src) if (offs & 3) { while (len >= 4) { - mga_writel(va, offs, get_unaligned(srcd++)); + mga_writel(va, offs, get_unaligned((u32 *)src)); offs += 4; len -= 4; + src += 4; } } else { while (len >= 4) { - mga_writel(va, offs, *srcd++); + mga_writel(va, offs, *(u32 *)src); offs += 4; len -= 4; + src += 4; } } -#undef srcd if (len) { u_int32_t tmp; diff --git a/drivers/video/sbuslib.c b/drivers/video/sbuslib.c index eeeb462d3376a9..3820d7e6286576 100644 --- a/drivers/video/sbuslib.c +++ b/drivers/video/sbuslib.c @@ -93,7 +93,7 @@ int sbusfb_ioctl_helper(unsigned long cmd, unsigned long arg, { switch(cmd) { case FBIOGTYPE: { - struct fbtype *f = (struct fbtype *) arg; + struct fbtype __user *f = (struct fbtype __user *) arg; if (put_user(type, &f->fb_type) || __put_user(info->var.yres, &f->fb_height) || @@ -105,10 +105,12 @@ int sbusfb_ioctl_helper(unsigned long cmd, unsigned long arg, return 0; } case FBIOPUTCMAP_SPARC: { - struct fbcmap *c = (struct fbcmap *) arg; + struct fbcmap __user *c = (struct fbcmap __user *) arg; struct fb_cmap cmap; u16 red, green, blue; - unsigned char *ured, *ugreen, *ublue; + unsigned char __user *ured; + unsigned char __user *ugreen; + unsigned char __user *ublue; int index, count, i; if (get_user(index, &c->index) || @@ -139,8 +141,10 @@ int sbusfb_ioctl_helper(unsigned long cmd, unsigned long arg, return 0; } case FBIOGETCMAP_SPARC: { - struct fbcmap *c = (struct fbcmap *) arg; - unsigned char *ured, *ugreen, *ublue; + struct fbcmap __user *c = (struct fbcmap __user *) arg; + unsigned char __user *ured; + unsigned char __user *ugreen; + unsigned char __user *ublue; struct fb_cmap *cmap = &info->cmap; int index, count, i; |