Re: [PATCH 2/2] enhance sysfs rfkill interface

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Mar 12, 2010 at 07:03:08PM +0100, florian@xxxxxxxxxxx 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?

> +
> +	return sprintf(buf, "%d\n", (state & RFKILL_BLOCK_HW) ? 1 : 0 );
> +}
> +
> +static ssize_t rfkill_soft_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);

And here as well...

-- 
Dmitry
--
To unsubscribe from this list: send the line "unsubscribe linux-doc" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux FS]     [Yosemite Forum]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]     [Linux Resources]

  Powered by Linux