#include <linux/config.h>
#include <linux/isdn.h>
+#include <linux/delay.h>
#include "isdn_common.h"
#include "isdn_tty.h"
#ifdef CONFIG_ISDN_AUDIO
/* Prototypes */
-static int isdn_tty_edit_at(const char *, int, modem_info *, int);
-static void isdn_tty_check_esc(const u_char *, u_char, int, int *, u_long *, int);
+static int isdn_tty_edit_at(const char *, int, modem_info *);
+static void isdn_tty_check_esc(const u_char *, u_char, int, int *, u_long *);
static void isdn_tty_modem_reset_regs(modem_info *, int);
static void isdn_tty_cmd_ATA(modem_info *);
static void isdn_tty_flush_buffer(struct tty_struct *);
info->send_outstanding++;
info->msr &= ~UART_MSR_CTS;
info->lsr &= ~UART_LSR_TEMT;
- if ((tty->flags & (1 << TTY_DO_WRITE_WAKEUP)) &&
- tty->ldisc.write_wakeup)
- (tty->ldisc.write_wakeup) (tty);
- wake_up_interruptible(&tty->write_wait);
+ tty_wakeup(tty);
return;
}
if (slen < 0) {
* ^S or ^Q is sent.
*/
static int
-isdn_tty_end_vrx(const char *buf, int c, int from_user)
+isdn_tty_end_vrx(const char *buf, int c)
{
char ch;
while (c--) {
- if (from_user)
- get_user(ch, buf);
- else
- ch = *buf;
+ ch = *buf;
if ((ch != 0x11) && (ch != 0x13))
return 1;
buf++;
* - If dialing, abort dial.
*/
static int
-isdn_tty_write(struct tty_struct *tty, int from_user, const u_char * buf, int count)
+isdn_tty_write(struct tty_struct *tty, const u_char * buf, int count)
{
int c;
int total = 0;
if (isdn_tty_paranoia_check(info, tty->name, "isdn_tty_write"))
return 0;
- if (from_user)
- down(&info->write_sem);
/* See isdn_tty_senddown() */
atomic_inc(&info->xmit_lock);
while (1) {
#endif
isdn_tty_check_esc(buf, m->mdmreg[REG_ESC], c,
&(m->pluscount),
- &(m->lastplus),
- from_user);
- if (from_user)
- copy_from_user(&(info->xmit_buf[info->xmit_count]), buf, c);
- else
- memcpy(&(info->xmit_buf[info->xmit_count]), buf, c);
+ &(m->lastplus));
+ memcpy(&(info->xmit_buf[info->xmit_count]), buf, c);
#ifdef CONFIG_ISDN_AUDIO
if (info->vonline) {
int cc = isdn_tty_handleDLEdown(info, m, c);
/* If DLE decoding results in zero-transmit, but
* c originally was non-zero, do a wakeup.
*/
- if ((tty->flags & (1 << TTY_DO_WRITE_WAKEUP)) &&
- tty->ldisc.write_wakeup)
- (tty->ldisc.write_wakeup) (tty);
- wake_up_interruptible(&tty->write_wait);
+ tty_wakeup(tty);
info->msr |= UART_MSR_CTS;
info->lsr |= UART_LSR_TEMT;
}
/* Do NOT handle Ctrl-Q or Ctrl-S
* when in full-duplex audio mode.
*/
- if (isdn_tty_end_vrx(buf, c, from_user)) {
+ if (isdn_tty_end_vrx(buf, c)) {
info->vonline &= ~1;
#ifdef ISDN_DEBUG_MODEM_VOICE
printk(KERN_DEBUG
isdn_tty_modem_result(RESULT_NO_CARRIER, info);
isdn_tty_modem_hup(info, 1);
} else
- c = isdn_tty_edit_at(buf, c, info, from_user);
+ c = isdn_tty_edit_at(buf, c, info);
}
buf += c;
count -= c;
}
isdn_timer_ctrl(ISDN_TIMER_MODEMXMIT, 1);
}
- if (from_user)
- up(&info->write_sem);
return total;
}
isdn_tty_cleanup_xmit(info);
info->xmit_count = 0;
wake_up_interruptible(&tty->write_wait);
- if ((tty->flags & (1 << TTY_DO_WRITE_WAKEUP)) &&
- tty->ldisc.write_wakeup)
- (tty->ldisc.write_wakeup) (tty);
+ tty_wakeup(tty);
}
static void
}
dev->modempoll--;
isdn_tty_shutdown(info);
+
if (tty->driver->flush_buffer)
tty->driver->flush_buffer(tty);
- if (tty->ldisc.flush_buffer)
- tty->ldisc.flush_buffer(tty);
+ tty_ldisc_flush(tty);
info->tty = NULL;
info->ncarrier = 0;
tty->closing = 0;
module_put(info->owner);
if (info->blocked_open) {
- set_current_state(TASK_INTERRUPTIBLE);
- schedule_timeout(HZ/2);
+ msleep_interruptible(500);
wake_up_interruptible(&info->open_wait);
}
info->flags &= ~(ISDN_ASYNC_NORMAL_ACTIVE | ISDN_ASYNC_CLOSING);
*/
static void
isdn_tty_check_esc(const u_char * p, u_char plus, int count, int *pluscount,
- u_long *lastplus, int from_user)
+ u_long *lastplus)
{
- char cbuf[3];
-
if (plus > 127)
return;
if (count > 3) {
count = 3;
*pluscount = 0;
}
- if (from_user) {
- copy_from_user(cbuf, p, count);
- p = cbuf;
- }
while (count > 0) {
if (*(p++) == plus) {
if ((*pluscount)++) {
if ((info->flags & ISDN_ASYNC_CLOSING) || (!info->tty)) {
return;
}
- if (info->tty->ldisc.flush_buffer)
- info->tty->ldisc.flush_buffer(info->tty);
+ tty_ldisc_flush(info->tty);
if ((info->flags & ISDN_ASYNC_CHECK_CD) &&
(!((info->flags & ISDN_ASYNC_CALLOUT_ACTIVE) &&
(info->flags & ISDN_ASYNC_CALLOUT_NOHUP)))) {
* p inputbuffer
* count length of buffer
* channel index to line (minor-device)
- * user flag: buffer is in userspace
*/
static int
-isdn_tty_edit_at(const char *p, int count, modem_info * info, int user)
+isdn_tty_edit_at(const char *p, int count, modem_info * info)
{
atemu *m = &info->emu;
int total = 0;
int cnt;
for (cnt = count; cnt > 0; p++, cnt--) {
- if (user)
- get_user(c, p);
- else
- c = *p;
+ c = *p;
total++;
if (c == m->mdmreg[REG_CR] || c == m->mdmreg[REG_LF]) {
/* Separator (CR or LF) */