lkml.org 
[lkml]   [2010]   [Mar]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 2/2] enhance sysfs rfkill interface
On Fri, 12 Mar 2010 13:20:26 -0800
Dmitry Torokhov <dmitry.torokhov@gmail.com> wrote:

> On Fri, Mar 12, 2010 at 09:57:43PM +0100, Florian Mickler wrote:
> > On Fri, 12 Mar 2010 10:22:09 -0800
> > Dmitry Torokhov <dmitry.torokhov@gmail.com> wrote:
> >
> > > On Fri, Mar 12, 2010 at 07:03:08PM +0100, florian@mickler.org wrote:
> > > >
> > > > +static ssize_t rfkill_hard_show(struct device *dev,
> > > > + struct device_attribute *attr,
> > > > + char *buf)
> > > > +{
> > > > + struct rfkill *rfkill = to_rfkill(dev);
> > > > + unsigned long flags;
> > > > + u32 state;
> > > > +
> > > > + spin_lock_irqsave(&rfkill->lock, flags);
> > > > + state = rfkill->state;
> > > > + spin_unlock_irqrestore(&rfkill->lock, flags);
> > >
> > > Why exactly is this lock needed?
> >
> > The rfkill state is updated from multiple contexts... Am I overlooking
> > smth obvious here?
> >
>
> You are not updating but reading... Are you concerned about seeing
> a partial write to u32? It does not happen.
>
Hm.. You shure? On every arch that supports wireless drivers?

I've just copied that code from the old sysfs state-file handler.
So I assumed that reading partial updated state can happen... Also I
just searched a little but did not find anything, cause i didn't know
where to look. Who garantees this? Is it a gcc thing?



\
 
 \ /
  Last update: 2010-03-12 23:41    [W:0.075 / U:0.912 seconds]
©2003-2014 Jasper Spaans. Advertise on this site