lkml.org 
[lkml]   [2007]   [Oct]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [2.4 patch] Port of adutux driver from 2.6 kernel to 2.4.
On Tue, 16 Oct 2007 16:54:49 +0300, Vitaliy Ivanov <vitalivanov@gmail.com> wrote:

> Again, comments are welcomed.

It looks like you misunderstood why a static lock protects open counts.
This is done so you do not need to worry about in-structure lock which
can be freed together with the structure. Look at this:

> +static int adu_release_internal(struct adu_device *dev)
> +{
> + /* lock this device */
> + down(&dev->sem);
> + /* decrement our usage count for the device */
> + --dev->open_count;
> + if (dev->open_count <= 0) {
> + adu_abort_transfers(dev);
> + dev->open_count = 0;
> + }
> + /* unlock this device */
> + up(&dev->sem);

The dev->sem is entirely unnecessary here. Every time you use
open_count, it's protected by minor_table_mutex. The name is a litte
unfortunate, feel free to rename it.

This is probably a problem in 2.6 as well. I don't know why people keep
writing these things. Someone at Ontrak needs to look into it.

-- Pete
-
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: 2007-10-16 19:55    [W:0.152 / U:0.228 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site