]> git.pld-linux.org Git - packages/kernel.git/blob - ir260_ircom_ioctl-2.diff
- CSZ scheduler removed from kernel tree.
[packages/kernel.git] / ir260_ircom_ioctl-2.diff
1 diff -u -p linux/include/net/irda/ircomm_tty.d5.h linux/include/net/irda/ircomm_tty.h
2 --- linux/include/net/irda/ircomm_tty.d5.h      Tue Jan 13 09:51:52 2004
3 +++ linux/include/net/irda/ircomm_tty.h Tue Jan 13 10:01:11 2004
4 @@ -122,6 +122,9 @@ void ircomm_tty_stop(struct tty_struct *
5  void ircomm_tty_check_modem_status(struct ircomm_tty_cb *self);
6  
7  extern void ircomm_tty_change_speed(struct ircomm_tty_cb *self);
8 +extern int ircomm_tty_tiocmget(struct tty_struct *tty, struct file *file);
9 +extern int ircomm_tty_tiocmset(struct tty_struct *tty, struct file *file,
10 +                              unsigned int set, unsigned int clear);
11  extern int ircomm_tty_ioctl(struct tty_struct *tty, struct file *file, 
12                             unsigned int cmd, unsigned long arg);
13  extern void ircomm_tty_set_termios(struct tty_struct *tty, 
14 diff -u -p linux/net/irda/ircomm/ircomm_tty.d5.c linux/net/irda/ircomm/ircomm_tty.c
15 --- linux/net/irda/ircomm/ircomm_tty.d5.c       Tue Jan 13 09:55:04 2004
16 +++ linux/net/irda/ircomm/ircomm_tty.c  Tue Jan 13 10:02:52 2004
17 @@ -86,7 +86,9 @@ static struct tty_operations ops = {
18         .write_room      = ircomm_tty_write_room,
19         .chars_in_buffer = ircomm_tty_chars_in_buffer,
20         .flush_buffer    = ircomm_tty_flush_buffer,
21 -       .ioctl           = ircomm_tty_ioctl,
22 +       .ioctl           = ircomm_tty_ioctl,    /* ircomm_tty_ioctl.c */
23 +       .tiocmget        = ircomm_tty_tiocmget, /* ircomm_tty_ioctl.c */
24 +       .tiocmset        = ircomm_tty_tiocmset, /* ircomm_tty_ioctl.c */
25         .throttle        = ircomm_tty_throttle,
26         .unthrottle      = ircomm_tty_unthrottle,
27         .send_xchar      = ircomm_tty_send_xchar,
28 diff -u -p linux/net/irda/ircomm/ircomm_tty_ioctl.d5.c linux/net/irda/ircomm/ircomm_tty_ioctl.c
29 --- linux/net/irda/ircomm/ircomm_tty_ioctl.d5.c Tue Jan 13 09:54:53 2004
30 +++ linux/net/irda/ircomm/ircomm_tty_ioctl.c    Wed Jan 14 11:27:56 2004
31 @@ -190,81 +190,62 @@ void ircomm_tty_set_termios(struct tty_s
32  }
33  
34  /*
35 - * Function ircomm_tty_get_modem_info (self, value)
36 + * Function ircomm_tty_tiocmget (tty, file)
37   *
38   *    
39   *
40   */
41 -static int ircomm_tty_get_modem_info(struct ircomm_tty_cb *self, 
42 -                                    unsigned int *value)
43 +int ircomm_tty_tiocmget(struct tty_struct *tty, struct file *file)
44  {
45 +       struct ircomm_tty_cb *self = (struct ircomm_tty_cb *) tty->driver_data;
46         unsigned int result;
47  
48         IRDA_DEBUG(2, "%s()\n", __FUNCTION__ );
49  
50 +       if (tty->flags & (1 << TTY_IO_ERROR))
51 +               return -EIO;
52 +
53         result =  ((self->settings.dte & IRCOMM_RTS) ? TIOCM_RTS : 0)
54                 | ((self->settings.dte & IRCOMM_DTR) ? TIOCM_DTR : 0)
55                 | ((self->settings.dce & IRCOMM_CD)  ? TIOCM_CAR : 0)
56                 | ((self->settings.dce & IRCOMM_RI)  ? TIOCM_RNG : 0)
57                 | ((self->settings.dce & IRCOMM_DSR) ? TIOCM_DSR : 0)
58                 | ((self->settings.dce & IRCOMM_CTS) ? TIOCM_CTS : 0);
59 -
60 -       return put_user(result, value);
61 +       return result;
62  }
63  
64  /*
65 - * Function set_modem_info (driver, cmd, value)
66 + * Function ircomm_tty_tiocmset (tty, file, set, clear)
67   *
68   *    
69   *
70   */
71 -static int ircomm_tty_set_modem_info(struct ircomm_tty_cb *self, 
72 -                                    unsigned int cmd, unsigned int *value)
73 +int ircomm_tty_tiocmset(struct tty_struct *tty, struct file *file,
74 +                       unsigned int set, unsigned int clear)
75  { 
76 -       unsigned int arg;
77 -       __u8 old_rts, old_dtr;
78 +       struct ircomm_tty_cb *self = (struct ircomm_tty_cb *) tty->driver_data;
79  
80         IRDA_DEBUG(2, "%s()\n", __FUNCTION__ );
81  
82 +       if (tty->flags & (1 << TTY_IO_ERROR))
83 +               return -EIO;
84 +
85         ASSERT(self != NULL, return -1;);
86         ASSERT(self->magic == IRCOMM_TTY_MAGIC, return -1;);
87  
88 -       if (get_user(arg, value))
89 -               return -EFAULT;
90 +       if (set & TIOCM_RTS)
91 +               self->settings.dte |= IRCOMM_RTS;
92 +       if (set & TIOCM_DTR)
93 +               self->settings.dte |= IRCOMM_DTR;
94 +
95 +       if (clear & TIOCM_RTS)
96 +               self->settings.dte &= ~IRCOMM_RTS;
97 +       if (clear & TIOCM_DTR)
98 +               self->settings.dte &= ~IRCOMM_DTR;
99  
100 -       old_rts = self->settings.dte & IRCOMM_RTS;
101 -       old_dtr = self->settings.dte & IRCOMM_DTR;
102 -
103 -       switch (cmd) {
104 -       case TIOCMBIS: 
105 -               if (arg & TIOCM_RTS) 
106 -                       self->settings.dte |= IRCOMM_RTS;
107 -               if (arg & TIOCM_DTR)
108 -                       self->settings.dte |= IRCOMM_DTR;
109 -               break;
110 -               
111 -       case TIOCMBIC:
112 -               if (arg & TIOCM_RTS)
113 -                       self->settings.dte &= ~IRCOMM_RTS;
114 -               if (arg & TIOCM_DTR)
115 -                       self->settings.dte &= ~IRCOMM_DTR;
116 -               break;
117 -               
118 -       case TIOCMSET:
119 -               self->settings.dte = 
120 -                       ((self->settings.dte & ~(IRCOMM_RTS | IRCOMM_DTR))
121 -                        | ((arg & TIOCM_RTS) ? IRCOMM_RTS : 0)
122 -                        | ((arg & TIOCM_DTR) ? IRCOMM_DTR : 0));
123 -               break;
124 -               
125 -       default:
126 -               return -EINVAL;
127 -       }
128 -       
129 -       if ((self->settings.dte & IRCOMM_RTS) != old_rts)
130 +       if ((set|clear) & TIOCM_RTS)
131                 self->settings.dte |= IRCOMM_DELTA_RTS;
132 -
133 -       if ((self->settings.dte & IRCOMM_DTR) != old_dtr)
134 +       if ((set|clear) & TIOCM_DTR)
135                 self->settings.dte |= IRCOMM_DELTA_DTR;
136  
137         ircomm_param_request(self, IRCOMM_DTE, TRUE);
138 @@ -406,14 +387,6 @@ int ircomm_tty_ioctl(struct tty_struct *
139         }
140  
141         switch (cmd) {
142 -       case TIOCMGET:
143 -               ret = ircomm_tty_get_modem_info(self, (unsigned int *) arg);
144 -               break;
145 -       case TIOCMBIS:
146 -       case TIOCMBIC:
147 -       case TIOCMSET:
148 -               ret = ircomm_tty_set_modem_info(self, cmd, (unsigned int *) arg);
149 -               break;
150         case TIOCGSERIAL:
151                 ret = ircomm_tty_get_serial_info(self, (struct serial_struct *) arg);
152                 break;
This page took 0.077704 seconds and 3 git commands to generate.