lkml.org 
[lkml]   [2008]   [Aug]   [26]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH][resubmit] TPM: update char dev BKL pushdown
Quoting Alan Cox (alan@lxorguk.ukuu.org.uk):
> > + atomic_set(&chip->is_open, 1);
> > + get_device(chip->dev); /* protect from chip disappearing */
>
> Why not just use test_and_set_bit() ? You seem to be abusing atomic_t to
> achieve this.

Good point. Or heck just make it a simple flag. Earlier I thought there
was a place where driver_lock was taken just to do num_opens--, and so
replacing the int num_opens with an atomic_t seemed worthwhile. But since
is_open is a boolean and now seems to be always protected by driver_lock,
a flag seems best.

-serge


\
 
 \ /
  Last update: 2008-08-27 05:23    [W:0.119 / U:0.228 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site