#define MOXA_GET_CUMAJOR (MOXA + 64)
#define MOXA_GETMSTATUS (MOXA + 65)
+#ifdef CONFIG_PCI
static struct pci_device_id mxser_pcibrds[] = {
{ PCI_VENDOR_ID_MOXA, PCI_DEVICE_ID_C168, PCI_ANY_ID, PCI_ANY_ID, 0, 0,
MXSER_BOARD_C168_PCI },
{ 0 }
};
MODULE_DEVICE_TABLE(pci, mxser_pcibrds);
+#endif /* CONFIG_PCI */
static int ioaddr[MXSER_BOARDS];
static int ttymajor = MXSERMAJOR;
static void mxser_getcfg(int board, struct mxser_hwconf *hwconf);
static int mxser_get_ISA_conf(int, struct mxser_hwconf *);
-static int mxser_get_PCI_conf(struct pci_dev *, int, struct mxser_hwconf *);
static void mxser_do_softint(void *);
static int mxser_open(struct tty_struct *, struct file *);
static void mxser_close(struct tty_struct *, struct file *);
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);
mxsercfg[board] = *hwconf;
}
+#ifdef CONFIG_PCI
static int mxser_get_PCI_conf(struct pci_dev *pdev, int board_type, struct mxser_hwconf *hwconf)
{
int i;
}
return (0);
}
+#endif /* CONFIG_PCI */
static struct tty_operations mxser_ops = {
.open = mxser_open,
{
struct pci_dev *pdev = NULL;
int n = (sizeof(mxser_pcibrds) / sizeof(mxser_pcibrds[0])) - 1;
- int index = 0;
for (b = 0; b < n; b++) {
while ((pdev = pci_find_device(mxser_pcibrds[b].vendor, mxser_pcibrds[b].device, pdev)))
{
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);
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));
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
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))
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);
}
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;
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:
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;
info->event = 0;
info->count = 0;
info->flags &= ~ASYNC_NORMAL_ACTIVE;
- info->tty = 0;
+ info->tty = NULL;
wake_up_interruptible(&info->open_wait);
}
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;
/*
* 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);
*/
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 */
* ------------------------------------------------------------
*/
static int mxser_get_serial_info(struct mxser_struct *info,
- struct serial_struct *retinfo)
+ struct serial_struct __user *retinfo)
{
struct serial_struct tmp;
}
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;
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);
* 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;