Re: [RFC/RFT] Raw access to serio ports (1/2)

Andrew Morton
2004-06-02T07:37:11Z

Dmitry Torokhov <dtor_core@ameritech.net> wrote:
>
> Hi,
>
> Below is an implementation of rawdev driver.

Yes, it does appear that we need the feature, thanks.

> Comments?

They're the thingies inside /* and */. Your patch is refreshingly free of
them ;)

> +static ssize_t rawdev_write(struct file *file, const char *buffer, size_t count, loff_t *ppos)
> +{
> + struct rawdev_list *list = file->private_data;
> + ssize_t written = 0;
> + int retval;
> + unsigned char c;
> +
> + retval = down_interruptible(&rawdev_sem);
> + if (retval)
> + return retval;
> +
> + if (!list->rawdev->serio) {
> + retval = -ENODEV;
> + goto out;
> + }

The return values here are mucked up - this function returns `written'.

> + if (count > 32)
> + count = 32;

Why? (Don't tell me - add a comment!)