lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20100312182209.GB8736@core.coreip.homeip.net>
Date:	Fri, 12 Mar 2010 10:22:09 -0800
From:	Dmitry Torokhov <dmitry.torokhov@...il.com>
To:	florian@...kler.org
Cc:	"John W. Linville" <linville@...driver.com>,
	Marcel Holtmann <marcel@...tmann.org>,
	Henrique de Moraes Holschuh <hmh@....eng.br>,
	Johannes Berg <johannes@...solutions.net>,
	linux-wireless@...r.kernel.org,
	Randy Dunlap <rdunlap@...otime.net>,
	Alan Jenkins <alan-jenkins@...fmail.co.uk>,
	linux-kernel@...r.kernel.org, linux-doc@...r.kernel.org
Subject: Re: [PATCH 2/2] enhance sysfs rfkill interface

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

> +
> +	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-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ