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: <56F78ED3.8080603@gmail.com>
Date:	Sun, 27 Mar 2016 15:42:11 +0800
From:	"zhaoxiu.zeng" <zhaoxiu.zeng@...il.com>
To:	Lars-Peter Clausen <lars@...afoo.de>,
	Michael Hennerich <Michael.Hennerich@...log.com>,
	Jonathan Cameron <jic23@...nel.org>,
	Hartmut Knaack <knaack.h@....de>,
	Peter Meerwald <pmeerw@...erw.net>
Cc:	linux-kernel@...r.kernel.org, linux-iio@...r.kernel.org
Subject: [PATCH 28/31] iio: gyro: use parity32 in adxrs450.c

From: Zeng Zhaoxiu <zhaoxiu.zeng@...il.com>

Signed-off-by: Zeng Zhaoxiu <zhaoxiu.zeng@...il.com>
---
 drivers/iio/gyro/adxrs450.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/drivers/iio/gyro/adxrs450.c b/drivers/iio/gyro/adxrs450.c
index a330d42..f1f19fc20 100644
--- a/drivers/iio/gyro/adxrs450.c
+++ b/drivers/iio/gyro/adxrs450.c
@@ -108,9 +108,7 @@ static int adxrs450_spi_read_reg_16(struct iio_dev *indio_dev,
 
 	mutex_lock(&st->buf_lock);
 	tx = ADXRS450_READ_DATA | (reg_address << 17);
-
-	if (!(hweight32(tx) & 1))
-		tx |= ADXRS450_P;
+	tx |= !parity32(tx) * ADXRS450_P;
 
 	st->tx = cpu_to_be32(tx);
 	ret = spi_sync_transfer(st->us, xfers, ARRAY_SIZE(xfers));
@@ -144,9 +142,7 @@ static int adxrs450_spi_write_reg_16(struct iio_dev *indio_dev,
 
 	mutex_lock(&st->buf_lock);
 	tx = ADXRS450_WRITE_DATA | (reg_address << 17) | (val << 1);
-
-	if (!(hweight32(tx) & 1))
-		tx |= ADXRS450_P;
+	tx |= !parity32(tx) * ADXRS450_P;
 
 	st->tx = cpu_to_be32(tx);
 	ret = spi_write(st->us, &st->tx, sizeof(st->tx));
-- 
2.5.5

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ