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;
}
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;
*/
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;
}
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;
}
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;
}
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;
* 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;
unsigned int set, unsigned int clear)
{
struct esp_struct * info = (struct esp_struct *)tty->driver_data;
- unsigned int arg;
if (serial_paranoia_check(info, tty->name, __FUNCTION__))
return -ENODEV;
{
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;
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))
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) ||
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;
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) {
info->event = 0;
info->count = 0;
info->flags &= ~ASYNC_NORMAL_ACTIVE;
- info->tty = 0;
+ info->tty = NULL;
wake_up_interruptible(&info->open_wait);
}
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);