#include <linux/stat.h>
#include <linux/proc_fs.h>
-#define cy_put_user put_user
-
static void cy_throttle (struct tty_struct *tty);
static void cy_send_xchar (struct tty_struct *tty, char ch);
(unsigned char *) 0xDA000,
(unsigned char *) 0xDC000,
(unsigned char *) 0xDE000,
- 0,0,0,0,0,0,0,0
+ NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL
};
#define NR_ISA_ADDRS (sizeof(cy_isa_addresses)/sizeof(unsigned char*))
if (info->xmit_buf){
unsigned char * temp;
temp = info->xmit_buf;
- info->xmit_buf = 0;
+ info->xmit_buf = NULL;
free_page((unsigned long) temp);
}
cy_writeb((u_long)base_addr+(CyCAR<<index), (u_char)channel);
if (info->xmit_buf){
unsigned char * temp;
temp = info->xmit_buf;
- info->xmit_buf = 0;
+ info->xmit_buf = NULL;
free_page((unsigned long) temp);
}
tty->closing = 0;
info->event = 0;
- info->tty = 0;
+ info->tty = NULL;
if (info->blocked_open) {
CY_UNLOCK(info, flags);
if (info->close_delay) {
static int
get_serial_info(struct cyclades_port * info,
- struct serial_struct * retinfo)
+ struct serial_struct __user * retinfo)
{
struct serial_struct tmp;
struct cyclades_card *cinfo = &cy_card[info->card];
static int
set_serial_info(struct cyclades_port * info,
- struct serial_struct * new_info)
+ struct serial_struct __user * new_info)
{
struct serial_struct new_serial;
struct cyclades_port old_info;
* transmit holding register is empty. This functionality
* allows an RS485 driver to be written in user space.
*/
-static int get_lsr_info(struct cyclades_port *info, unsigned int *value)
+static int get_lsr_info(struct cyclades_port *info, unsigned int __user *value)
{
int card, chip, channel, index;
unsigned char status;
/* Not supported yet */
return -EINVAL;
}
- return cy_put_user(result, (unsigned long *) value);
+ return put_user(result, (unsigned long __user *) value);
}
static int
} /* cy_break */
static int
-get_mon_info(struct cyclades_port * info, struct cyclades_monitor * mon)
+get_mon_info(struct cyclades_port * info, struct cyclades_monitor __user * mon)
{
if(copy_to_user(mon, &info->mon, sizeof(struct cyclades_monitor)))
static int
-get_threshold(struct cyclades_port * info, unsigned long *value)
+get_threshold(struct cyclades_port * info, unsigned long __user *value)
{
unsigned char *base_addr;
int card,channel,chip,index;
+ (cy_chip_offset[chip]<<index));
tmp = cy_readb(base_addr+(CyCOR3<<index)) & CyREC_FIFO;
- return cy_put_user(tmp,value);
+ return put_user(tmp,value);
} else {
// Nothing to do!
return 0;
static int
-get_default_threshold(struct cyclades_port * info, unsigned long *value)
+get_default_threshold(struct cyclades_port * info, unsigned long __user *value)
{
- return cy_put_user(info->default_threshold,value);
+ return put_user(info->default_threshold,value);
}/* get_default_threshold */
static int
-get_timeout(struct cyclades_port * info, unsigned long *value)
+get_timeout(struct cyclades_port * info, unsigned long __user *value)
{
unsigned char *base_addr;
int card,channel,chip,index;
+ (cy_chip_offset[chip]<<index));
tmp = cy_readb(base_addr+(CyRTPR<<index));
- return cy_put_user(tmp,value);
+ return put_user(tmp,value);
} else {
// Nothing to do!
return 0;
static int
-get_default_timeout(struct cyclades_port * info, unsigned long *value)
+get_default_timeout(struct cyclades_port * info, unsigned long __user *value)
{
- return cy_put_user(info->default_timeout,value);
+ return put_user(info->default_timeout,value);
}/* get_default_timeout */
/*
{
struct cyclades_port * info = (struct cyclades_port *)tty->driver_data;
struct cyclades_icount cprev, cnow; /* kernel counter temps */
- struct serial_icounter_struct *p_cuser; /* user space */
+ struct serial_icounter_struct __user *p_cuser; /* user space */
int ret_val = 0;
unsigned long flags;
+ void __user *argp = (void __user *)arg;
if (serial_paranoia_check(info, tty->name, "cy_ioctl"))
return -ENODEV;
switch (cmd) {
case CYGETMON:
- ret_val = get_mon_info(info, (struct cyclades_monitor *)arg);
+ ret_val = get_mon_info(info, argp);
break;
case CYGETTHRESH:
- ret_val = get_threshold(info, (unsigned long *)arg);
+ ret_val = get_threshold(info, argp);
break;
case CYSETTHRESH:
- ret_val = set_threshold(info, (unsigned long)arg);
+ ret_val = set_threshold(info, arg);
break;
case CYGETDEFTHRESH:
- ret_val = get_default_threshold(info, (unsigned long *)arg);
+ ret_val = get_default_threshold(info, argp);
break;
case CYSETDEFTHRESH:
- ret_val = set_default_threshold(info, (unsigned long)arg);
+ ret_val = set_default_threshold(info, arg);
break;
case CYGETTIMEOUT:
- ret_val = get_timeout(info, (unsigned long *)arg);
+ ret_val = get_timeout(info, argp);
break;
case CYSETTIMEOUT:
- ret_val = set_timeout(info, (unsigned long)arg);
+ ret_val = set_timeout(info, arg);
break;
case CYGETDEFTIMEOUT:
- ret_val = get_default_timeout(info, (unsigned long *)arg);
+ ret_val = get_default_timeout(info, argp);
break;
case CYSETDEFTIMEOUT:
- ret_val = set_default_timeout(info, (unsigned long)arg);
+ ret_val = set_default_timeout(info, arg);
break;
case CYSETRFLOW:
info->rflow = (int)arg;
ret_val = info->rtsdtr_inv;
break;
case CYGETCARDINFO:
- if (copy_to_user((void *)arg, (void *)&cy_card[info->card],
+ if (copy_to_user(argp, &cy_card[info->card],
sizeof (struct cyclades_card))) {
ret_val = -EFAULT;
break;
ret_val = info->closing_wait / (HZ/100);
break;
case TIOCGSERIAL:
- ret_val = get_serial_info(info, (struct serial_struct *) arg);
+ ret_val = get_serial_info(info, argp);
break;
case TIOCSSERIAL:
- ret_val = set_serial_info(info, (struct serial_struct *) arg);
+ ret_val = set_serial_info(info, argp);
break;
case TIOCSERGETLSR: /* Get line status register */
- ret_val = get_lsr_info(info, (unsigned int *) arg);
+ ret_val = get_lsr_info(info, argp);
break;
/*
* Wait for any of the 4 modem inputs (DCD,RI,DSR,CTS) to change
CY_LOCK(info, flags);
cnow = info->icount;
CY_UNLOCK(info, flags);
- p_cuser = (struct serial_icounter_struct *) arg;
+ p_cuser = argp;
ret_val = put_user(cnow.cts, &p_cuser->cts);
if (ret_val) return ret_val;
ret_val = put_user(cnow.dsr, &p_cuser->dsr);
#ifdef CY_DEBUG_COUNT
printk("cyc:cy_hangup (%d): setting count to 0\n", current->pid);
#endif
- info->tty = 0;
+ info->tty = NULL;
info->flags &= ~ASYNC_NORMAL_ACTIVE;
wake_up_interruptible(&info->open_wait);
} /* cy_hangup */
info->line = port;
info->chip_rev = 0;
info->flags = STD_COM_FLAGS;
- info->tty = 0;
+ info->tty = NULL;
if (mailbox == ZO_V1)
info->xmit_fifo_size = CYZ_FIFO_SIZE;
else
info->card = board;
info->line = port;
info->flags = STD_COM_FLAGS;
- info->tty = 0;
+ info->tty = NULL;
info->xmit_fifo_size = CyMAX_CHAR_FIFO;
info->cor1 = CyPARITY_NONE|Cy_1_STOP|Cy_8_BITS;
info->cor2 = CyETC;