/* * String write routine for 3215 ttys */ static int tty3215_write(struct tty_struct * tty, int from_user, const unsigned char *buf, int count) { struct raw3215_info *raw; int length, ret; if (!tty) return 0; raw = (struct raw3215_info *) tty->driver_data; if (!from_user) { raw3215_write(raw, buf, count); return count; } ret = 0; while (count > 0) { length = count < 80 ? count : 80; length -= copy_from_user(raw->ubuffer, (const unsigned char __user *)buf, length); if (length == 0) { if (!ret) ret = -EFAULT; break; } raw3215_write(raw, raw->ubuffer, count); buf += length; count -= length; ret += length; } return ret; }
/* * String write routine for 3215 ttys */ static int tty3215_write(struct tty_struct * tty, const unsigned char *buf, int count) { struct raw3215_info *raw; int i, written; if (!tty) return 0; raw = (struct raw3215_info *) tty->driver_data; written = count; while (count > 0) { for (i = 0; i < count; i++) if (buf[i] == '\t' || buf[i] == '\n') break; raw3215_write(raw, buf, i); count -= i; buf += i; if (count > 0) { raw3215_putchar(raw, *buf); count--; buf++; } } return written; }
/* * String write routine for 3215 ttys */ static int tty3215_write(struct tty_struct * tty, const unsigned char *buf, int count) { struct raw3215_info *raw; if (!tty) return 0; raw = (struct raw3215_info *) tty->driver_data; raw3215_write(raw, buf, count); return count; }
/* * String write routine for 3215 ttys */ static int tty3215_write(struct tty_struct * tty, int from_user, const unsigned char *buf, int count) { raw3215_info *raw; int ret = 0; if (!tty) return 0; raw = (raw3215_info *) tty->driver_data; ret = raw3215_write(raw, buf, from_user, count); return ret; }
/* * Write a string to the 3215 console */ static void con3215_write(struct console *co, const char *str, unsigned int count) { struct raw3215_info *raw; int i; if (count <= 0) return; raw = raw3215[0]; /* console 3215 is the first one */ while (count > 0) { for (i = 0; i < count; i++) if (str[i] == '\t' || str[i] == '\n') break; raw3215_write(raw, str, i); count -= i; str += i; if (count > 0) { raw3215_putchar(raw, *str); count--; str++; } } }