lkml.org 
[lkml]   [2000]   [Jul]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
SubjectRe: Revertion of bad "cleanup".
Date
From
Alan Cox wrote:
[ I wrote.... ]
> > I'd say that "misc" is wrong. But my guess is that someone ran into
> > SOME problem when this was changed. Maybe it has always been like
> > this.)
>
> I'd agree misc is now wrong.

OK. That's a one-liner. Want a patch? [fiddles with the code a bit]
Aaargh. OK. Not one line. How is this?

Note the second hunk: I've been comparing "misc_open" and
"chrdev_open", to find what to do. Turns out that chrdev_open was
neglecting to fops_put when the open routine would fail. Or is this
being done somewhere else?

Does this mean that we can remove the "inc_mod_count" from the modules
alltogether?

From some testing yesterday, I was led to believe that for a serial
driver the inc_mod_count was still neccesary in the "open"
routine. However, from reading the code, I don't understand why it
isn't getting done for me......


Roger.

------------------------------------------------------------------

diff -ur linux-2.4.0-test3-pre2.clean/drivers/char/misc.c linux-2.4.0-test3-pre2.miscfix/drivers/char/misc.c
--- linux-2.4.0-test3-pre2.clean/drivers/char/misc.c Wed Jul 5 11:09:58 2000
+++ linux-2.4.0-test3-pre2.miscfix/drivers/char/misc.c Thu Jul 6 12:18:49 2000
@@ -134,8 +134,11 @@

old_fops = file->f_op;
file->f_op = fops_get(c->fops);
- if (file->f_op && file->f_op->open)
- err=file->f_op->open(inode,file);
+ if (file->f_op) {
+ err = 0;
+ if (file->f_op->open)
+ err=file->f_op->open(inode,file);
+ }
if (err) {
fops_put(file->f_op);
file->f_op = fops_get(old_fops);
diff -ur linux-2.4.0-test3-pre2.clean/fs/devices.c linux-2.4.0-test3-pre2.miscfix/fs/devices.c
--- linux-2.4.0-test3-pre2.clean/fs/devices.c Wed Jul 5 11:10:16 2000
+++ linux-2.4.0-test3-pre2.miscfix/fs/devices.c Thu Jul 6 12:17:43 2000
@@ -150,6 +150,9 @@
if (filp->f_op->open != NULL)
ret = filp->f_op->open(inode,filp);
}
+ if (ret)
+ fops_put(filp->f_op);
+
return ret;
}

------------------------------------------------------------------
--
** R.E.Wolff@BitWizard.nl ** http://www.BitWizard.nl/ ** +31-15-2137555 **
*-- BitWizard writes Linux device drivers for any device you may have! --*
* Common sense is the collection of *
****** prejudices acquired by age eighteen. -- Albert Einstein ********
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 13:57    [W:0.052 / U:0.012 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site