Drive/tiny_tty/tiny_write_room()

Last-modified: 2007-09-27 (木) 14:37:56

203 :static int tiny_write_room(struct tty_struct *tty)

ttyにどれだけ書き込めるか計算する。

204 :{
205 : struct tiny_serial *tiny = tty->driver_data;
206 : int room = -EINVAL;
207 :
208 : if (!tiny)
209 : return -ENODEV;
210 :
211 : down(&tiny->sem);
212 :
213 : if (!tiny->open_count) {
214 : /* port was not opened */
215 : goto exit;
216 : }
217 :
218 : /* calculate how much room is left in the device */
219 : room = 255;
220 :
221 :exit:
222 : up(&tiny->sem);
223 : return room;
224 :}