/* These are the file operation function for user access to /dev/keypad  */
static ssize_t keypad_read(struct file *file, char *buf, size_t count, loff_t *ppos)
/* These are the file operation function for user access to /dev/keypad  */
static ssize_t keypad_read(struct file *file, char *buf, size_t count, loff_t *ppos)
{
	unsigned i = *ppos;
	char *tmp = buf;
	if (keypad_buflen == 0) {
		if (file->f_flags & O_NONBLOCK)
			return -EAGAIN;
		interruptible_sleep_on(&keypad_read_wait);
		if (signal_pending(current))
			return -EINTR;
	}
	for (; count-- > 0 && (keypad_buflen > 0); ++i, ++tmp, --keypad_buflen) {
		put_user(keypad_buffer[keypad_start], tmp);
		keypad_start = (keypad_start + 1) % KEYPAD_BUFFER;
	}
	*ppos = i;
	return tmp - buf;
}