Re: Xilinx: hwicap driver comments

From: Jiri Slaby
Date: Thu Feb 07 2008 - 17:40:02 EST


On 02/07/2008 11:31 PM, Stephen Neuendorffer wrote:
Few comments I have:
- release f_op retval is silently ignored, I guess you will get your
device into
undefined state when the first function fails (esp. when you interrupt
the sem)

Hmm.. hadn't realized that. I'm open to suggestions on how to do this
better. The real reason why the synchronization is there is to make
sure that only one client is using the device at a time, using the
is_open flag.

just mutex_lock(); that need not be interrupted.

- semaphores are deprecated
- class_device_create is deprecated

What is preferred?

device_create(); and pass the struct device as a parent when you are at it. Otherwise it will be in /sys/*/virtual/* I suppose.

- don't understand this:
memcpy(kbuf, drvdata->read_buffer, bytes_remaining);
drvdata->read_buffer_in_use = bytes_remaining;
free_page((unsigned long)kbuf);

The physical device only generates/accepts complete words, the intention
is to account for the possibility that a read does not read complete
words, and to fulfill the read whenever possible.
It's arguable that read() and write() should not accept or return
partial words, I suppose

OK, but why are you copying anything to buffer which you free 2 lines below?
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/