Re: Xilinx: hwicap driver comments

Jiri Slaby
2008-02-07T22:40:00Z

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?