lkml.org 
[lkml]   [2004]   [Jun]   [2]   [last100]   RSS Feed
Views: [more markup]  [less markup]  [headers]  [forward] 
 
Messages in this thread
/
FromDmitry Torokhov <>
SubjectRe: [RFC/RFT] Raw access to serio ports (1/2)
DateWed, 2 Jun 2004 02:43:09 -0500
On Wednesday 02 June 2004 02:36 am, Andrew Morton wrote:
> 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'.

Or an error code in negative notation - it's the standard practice for
read/write. Am I missing something?

> 
> > +	if (count > 32)
> > +		count = 32;
> 
> Why?  (Don't tell me - add a comment!)

I have no idea - taken from 2.4... My best guess would be it's an attempt not to
hog the device... I'll sprinkle some comments ;)

-- 
Dmitry
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 14:03    [from the cache]
©2003-2008