lkml.org 
[lkml]   [2005]   [May]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 3/8] ppc64: add a watchdog driver for rtas
Arnd Bergmann wrote:
> On Dinsdag 17 Mai 2005 22:40, Nathan Lynch wrote:
> > Arnd Bergmann wrote:
> > > +static volatile int wdrtas_miscdev_open = 0;
> > ...
> > > +static int
> > > +wdrtas_open(struct inode *inode, struct file *file)
> > > +{
> > > + /* only open once */
> > > + if (xchg(&wdrtas_miscdev_open,1))
> > > + return -EBUSY;
> >
> > The volatile and xchg strike me as an obscure method for ensuring only
> > one process at a time can open this file. Any reason a semaphore
> > couldn't be used?
>
> A semaphore would also be the wrong approach since we don't want
> processes to block but instead to fail opening the watchdog twice.

I should have been more explicit. What I had in mind was using
down_trylock and returning -EBUSY if it failed.

Nathan
-
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: 2005-05-18 17:48    [W:0.051 / U:6.844 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site