Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1371135 > unrolled thread

[PATCH V2 01/30] bitops: add parity functions

Started byZeng Zhaoxiu <zhaoxiu.zeng@gmail.com>
First post2016-04-05 04:30 +0200
Last post2016-04-06 12:30 +0200
Articles 19 on this page of 59 — 11 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH V2 01/30] bitops: add parity functions Zeng Zhaoxiu <zhaoxiu.zeng@gmail.com> - 2016-04-05 04:30 +0200
    [PATCH V2 02/30] Include generic parity.h in some architectures'  bitops.h Zeng Zhaoxiu <zhaoxiu.zeng@gmail.com> - 2016-04-05 06:30 +0200
      [PATCH v2 02/30] Include generic parity.h in some architectures' bitops.h zengzhaoxiu@163.com - 2016-04-06 10:50 +0200
    Re: [PATCH V2 01/30] bitops: add parity functions Sam Ravnborg <sam@ravnborg.org> - 2016-04-05 21:10 +0200
      Re: [PATCH V2 01/30] bitops: add parity functions Zeng Zhaoxiu <zhaoxiu.zeng@gmail.com> - 2016-04-06 07:40 +0200
        Re: [PATCH V2 01/30] bitops: add parity functions Sam Ravnborg <sam@ravnborg.org> - 2016-04-06 10:30 +0200
      [PATCH v2 01/30] bitops: add parity functions zengzhaoxiu@163.com - 2016-04-06 10:50 +0200
    [PATCH v2 03/30] Add alpha-specific parity functions zengzhaoxiu@163.com - 2016-04-06 10:50 +0200
    [PATCH v2 05/30] Add ia64-specific parity functions zengzhaoxiu@163.com - 2016-04-06 11:00 +0200
    [PATCH v2 07/30] Add powerpc-specific parity functions zengzhaoxiu@163.com - 2016-04-06 11:10 +0200
    [PATCH v2 06/30] Add mips-specific parity functions zengzhaoxiu@163.com - 2016-04-06 11:10 +0200
      [PATCH v2 06/30] Add mips-specific parity functions zengzhaoxiu@163.com - 2016-04-06 12:30 +0200
    [PATCH v2 04/30] Add blackfin-specific parity functions zengzhaoxiu@163.com - 2016-04-06 11:10 +0200
    [PATCH v2 09/30] Add tile-specific parity functions zengzhaoxiu@163.com - 2016-04-06 11:10 +0200
      Re: [PATCH v2 09/30] Add tile-specific parity functions Chris Metcalf <cmetcalf@mellanox.com> - 2016-04-06 15:30 +0200
        Re: [PATCH v2 09/30] Add tile-specific parity functions Zeng Zhaoxiu <zhaoxiu.zeng@gmail.com> - 2016-04-07 06:00 +0200
    [PATCH v2 08/30] Add sparc-specific parity functions zengzhaoxiu@163.com - 2016-04-06 11:20 +0200
      Re: [PATCH v2 08/30] Add sparc-specific parity functions Sam Ravnborg <sam@ravnborg.org> - 2016-04-06 20:50 +0200
        Re: [PATCH v2 08/30] Add sparc-specific parity functions Zeng Zhaoxiu <zhaoxiu.zeng@gmail.com> - 2016-04-07 06:00 +0200
    [PATCH v2 10/30] Add x86-specific parity functions zengzhaoxiu@163.com - 2016-04-06 11:30 +0200
      Re: [PATCH v2 10/30] Add x86-specific parity functions Borislav Petkov <bp@suse.de> - 2016-04-06 12:20 +0200
        Re: [PATCH v2 10/30] Add x86-specific parity functions One Thousand Gnomes <gnomes@lxorguk.ukuu.org.uk> - 2016-04-06 12:40 +0200
          Re: [PATCH v2 10/30] Add x86-specific parity functions Borislav Petkov <bp@suse.de> - 2016-04-06 13:00 +0200
            Re: [PATCH v2 10/30] Add x86-specific parity functions Zeng Zhaoxiu <zhaoxiu.zeng@gmail.com> - 2016-04-07 06:00 +0200
              Re: [PATCH v2 10/30] Add x86-specific parity functions Borislav Petkov <bp@suse.de> - 2016-04-07 11:50 +0200
          Re: [PATCH v2 10/30] Add x86-specific parity functions Zeng Zhaoxiu <zhaoxiu.zeng@gmail.com> - 2016-04-11 04:50 +0200
            Re: [PATCH v2 10/30] Add x86-specific parity functions Borislav Petkov <bp@suse.de> - 2016-04-15 02:20 +0200
        Re: [PATCH v2 10/30] Add x86-specific parity functions Zeng Zhaoxiu <zhaoxiu.zeng@gmail.com> - 2016-04-07 06:00 +0200
          Re: [PATCH v2 10/30] Add x86-specific parity functions Borislav Petkov <bp@suse.de> - 2016-04-07 11:50 +0200
      Re: [PATCH v2 10/30] Add x86-specific parity functions Andi Kleen <andi@firstfloor.org> - 2016-04-06 21:50 +0200
        Re: [PATCH v2 10/30] Add x86-specific parity functions Zeng Zhaoxiu <zhaoxiu.zeng@gmail.com> - 2016-04-07 06:00 +0200
        Re: [PATCH v2 10/30] Add x86-specific parity functions Dmitry Vyukov <dvyukov@google.com> - 2016-04-07 08:40 +0200
          Re: [PATCH v2 10/30] Add x86-specific parity functions Borislav Petkov <bp@suse.de> - 2016-04-07 11:50 +0200
        Re: [PATCH v2 10/30] Add x86-specific parity functions One Thousand Gnomes <gnomes@lxorguk.ukuu.org.uk> - 2016-04-07 16:20 +0200
    [PATCH v2 11/30] sunrpc: use parity8 zengzhaoxiu@163.com - 2016-04-06 11:40 +0200
    [PATCH v2 12/30] mips: use parity functions in cerr-sb1.c zengzhaoxiu@163.com - 2016-04-06 11:40 +0200
    [PATCH v2 14/30] media: use parity8 in vivid-vbi-gen.c zengzhaoxiu@163.com - 2016-04-06 11:40 +0200
    [PATCH v2 13/30] bch: use parity32 zengzhaoxiu@163.com - 2016-04-06 11:40 +0200
    [PATCH v2 17/30] input: use parity64 in sidewinder zengzhaoxiu@163.com - 2016-04-06 11:50 +0200
    [PATCH v2 16/30] input: use parity32 in grip_mp zengzhaoxiu@163.com - 2016-04-06 11:50 +0200
    [PATCH v2 18/30] input: use parity16 in ams_delta_serio zengzhaoxiu@163.com - 2016-04-06 11:50 +0200
    [PATCH v2 19/30] scsi: use parity32 in isci's phy zengzhaoxiu@163.com - 2016-04-06 11:50 +0200
    [PATCH v2 15/30] media: use parity functions in saa7115 zengzhaoxiu@163.com - 2016-04-06 11:50 +0200
    [PATCH v2 22/30] crypto: use parity functions in qat_hal zengzhaoxiu@163.com - 2016-04-06 12:00 +0200
    [PATCH v2 21/30] mtd: use parity functions in inftlcore zengzhaoxiu@163.com - 2016-04-06 12:00 +0200
    [PATCH v2 20/30] mtd: use parity16 in ssfdc zengzhaoxiu@163.com - 2016-04-06 12:00 +0200
    [PATCH v2 23/30] mtd: use parity16 in sm_ftl zengzhaoxiu@163.com - 2016-04-06 12:10 +0200
    [PATCH v2 26/30] input: use parity8 in sa1111ps2 zengzhaoxiu@163.com - 2016-04-06 12:20 +0200
    [PATCH v2 27/30] iio: use parity32 in adxrs450 zengzhaoxiu@163.com - 2016-04-06 12:20 +0200
      Re: [PATCH v2 27/30] iio: use parity32 in adxrs450 Jonathan Cameron <jic23@kernel.org> - 2016-04-10 16:40 +0200
        Re: [PATCH v2 27/30] iio: use parity32 in adxrs450 Lars-Peter Clausen <lars@metafoo.de> - 2016-04-10 17:10 +0200
          Re: [PATCH v2 27/30] iio: use parity32 in adxrs450 Jonathan Cameron <jic23@kernel.org> - 2016-04-10 17:20 +0200
            Re: [PATCH v2 27/30] iio: use parity32 in adxrs450 Jonathan Cameron <jic23@kernel.org> - 2016-04-10 17:20 +0200
    [PATCH v2 24/30] ethernet: use parity8 in sun/niu.c zengzhaoxiu@163.com - 2016-04-06 12:20 +0200
    [PATCH v2 25/30] input: use parity8 in pcips2 zengzhaoxiu@163.com - 2016-04-06 12:20 +0200
    Re: [PATCH v2 28/30] serial: use parity32 in max3100 Greg KH <gregkh@linuxfoundation.org> - 2016-04-06 12:30 +0200
    [PATCH v2 28/30] serial: use parity32 in max3100 zengzhaoxiu@163.com - 2016-04-06 12:30 +0200
    [PATCH v2 30/30] ethernet: use parity8 in broadcom/tg3.c zengzhaoxiu@163.com - 2016-04-06 12:30 +0200
    [PATCH v2 29/30] input: use parity8 in elantech zengzhaoxiu@163.com - 2016-04-06 12:30 +0200

Page 3 of 3 — ← Prev page 1 2 [3]


#1372344 — [PATCH v2 18/30] input: use parity16 in ams_delta_serio

Fromzengzhaoxiu@163.com
Date2016-04-06 11:50 +0200
Subject[PATCH v2 18/30] input: use parity16 in ams_delta_serio
Message-ID<rkSg2-1O6-23@gated-at.bofh.it>
In reply to#1371135
From: Zhaoxiu Zeng <zhaoxiu.zeng@gmail.com>

Signed-off-by: Zhaoxiu Zeng <zhaoxiu.zeng@gmail.com>
---
 drivers/input/serio/ams_delta_serio.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/drivers/input/serio/ams_delta_serio.c b/drivers/input/serio/ams_delta_serio.c
index 45887e3..85459b3 100644
--- a/drivers/input/serio/ams_delta_serio.c
+++ b/drivers/input/serio/ams_delta_serio.c
@@ -48,13 +48,9 @@ static int check_data(int data)
 				data);
 		return SERIO_FRAME;
 	}
-	/* calculate the parity */
-	for (i = 1; i < 10; i++) {
-		if (data & (1 << i))
-			parity++;
-	}
 	/* it should be odd */
-	if (!(parity & 0x01)) {
+	parity = parity16(data & 0x3fe);
+	if (!parity) {
 		dev_warn(&ams_delta_serio->dev,
 				"paritiy check failed, data=0x%X parity=0x%X\n",
 				data, parity);
-- 
2.5.0

[toc] | [prev] | [next] | [standalone]


#1372345 — [PATCH v2 19/30] scsi: use parity32 in isci's phy

Fromzengzhaoxiu@163.com
Date2016-04-06 11:50 +0200
Subject[PATCH v2 19/30] scsi: use parity32 in isci's phy
Message-ID<rkSg2-1O6-21@gated-at.bofh.it>
In reply to#1371135
From: Zhaoxiu Zeng <zhaoxiu.zeng@gmail.com>

Signed-off-by: Zhaoxiu Zeng <zhaoxiu.zeng@gmail.com>
---
 drivers/scsi/isci/phy.c | 15 +--------------
 1 file changed, 1 insertion(+), 14 deletions(-)

diff --git a/drivers/scsi/isci/phy.c b/drivers/scsi/isci/phy.c
index cb87b2e..a06aff6 100644
--- a/drivers/scsi/isci/phy.c
+++ b/drivers/scsi/isci/phy.c
@@ -122,8 +122,6 @@ sci_phy_link_layer_initialization(struct isci_phy *iphy,
 	int phy_idx = iphy->phy_index;
 	struct sci_phy_cap phy_cap;
 	u32 phy_configuration;
-	u32 parity_check = 0;
-	u32 parity_count = 0;
 	u32 llctl, link_rate;
 	u32 clksm_value = 0;
 	u32 sp_timeouts = 0;
@@ -225,18 +223,7 @@ sci_phy_link_layer_initialization(struct isci_phy *iphy,
 	/* The SAS specification indicates that the phy_capabilities that
 	 * are transmitted shall have an even parity.  Calculate the parity.
 	 */
-	parity_check = phy_cap.all;
-	while (parity_check != 0) {
-		if (parity_check & 0x1)
-			parity_count++;
-		parity_check >>= 1;
-	}
-
-	/* If parity indicates there are an odd number of bits set, then
-	 * set the parity bit to 1 in the phy capabilities.
-	 */
-	if ((parity_count % 2) != 0)
-		phy_cap.parity = 1;
+	phy_cap.parity = parity32(phy_cap.all);
 
 	writel(phy_cap.all, &llr->phy_capabilities);
 
-- 
2.5.0

[toc] | [prev] | [next] | [standalone]


#1372346 — [PATCH v2 15/30] media: use parity functions in saa7115

Fromzengzhaoxiu@163.com
Date2016-04-06 11:50 +0200
Subject[PATCH v2 15/30] media: use parity functions in saa7115
Message-ID<rkSg2-1O6-25@gated-at.bofh.it>
In reply to#1371135
From: Zhaoxiu Zeng <zhaoxiu.zeng@gmail.com>

Signed-off-by: Zhaoxiu Zeng <zhaoxiu.zeng@gmail.com>
---
 drivers/media/i2c/saa7115.c | 17 ++---------------
 1 file changed, 2 insertions(+), 15 deletions(-)

diff --git a/drivers/media/i2c/saa7115.c b/drivers/media/i2c/saa7115.c
index d2a1ce2..4c22df8 100644
--- a/drivers/media/i2c/saa7115.c
+++ b/drivers/media/i2c/saa7115.c
@@ -672,15 +672,6 @@ static const unsigned char saa7115_init_misc[] = {
 	0x00, 0x00
 };
 
-static int saa711x_odd_parity(u8 c)
-{
-	c ^= (c >> 4);
-	c ^= (c >> 2);
-	c ^= (c >> 1);
-
-	return c & 1;
-}
-
 static int saa711x_decode_vps(u8 *dst, u8 *p)
 {
 	static const u8 biphase_tbl[] = {
@@ -733,7 +724,6 @@ static int saa711x_decode_wss(u8 *p)
 	static const int wss_bits[8] = {
 		0, 0, 0, 1, 0, 1, 1, 1
 	};
-	unsigned char parity;
 	int wss = 0;
 	int i;
 
@@ -745,11 +735,8 @@ static int saa711x_decode_wss(u8 *p)
 			return -1;
 		wss |= b2 << i;
 	}
-	parity = wss & 15;
-	parity ^= parity >> 2;
-	parity ^= parity >> 1;
 
-	if (!(parity & 1))
+	if (!parity4(wss))
 		return -1;
 
 	return wss;
@@ -1235,7 +1222,7 @@ static int saa711x_decode_vbi_line(struct v4l2_subdev *sd, struct v4l2_decode_vb
 		vbi->type = V4L2_SLICED_TELETEXT_B;
 		break;
 	case 4:
-		if (!saa711x_odd_parity(p[0]) || !saa711x_odd_parity(p[1]))
+		if (!parity8(p[0]) || !parity8(p[1]))
 			return 0;
 		vbi->type = V4L2_SLICED_CAPTION_525;
 		break;
-- 
2.5.0

[toc] | [prev] | [next] | [standalone]


#1372348 — [PATCH v2 22/30] crypto: use parity functions in qat_hal

Fromzengzhaoxiu@163.com
Date2016-04-06 12:00 +0200
Subject[PATCH v2 22/30] crypto: use parity functions in qat_hal
Message-ID<rkSpI-1RZ-13@gated-at.bofh.it>
In reply to#1371135
From: Zhaoxiu Zeng <zhaoxiu.zeng@gmail.com>

Signed-off-by: Zhaoxiu Zeng <zhaoxiu.zeng@gmail.com>
---
 drivers/crypto/qat/qat_common/qat_hal.c | 32 ++++++++++----------------------
 1 file changed, 10 insertions(+), 22 deletions(-)

diff --git a/drivers/crypto/qat/qat_common/qat_hal.c b/drivers/crypto/qat/qat_common/qat_hal.c
index 1e480f1..318558f 100644
--- a/drivers/crypto/qat/qat_common/qat_hal.c
+++ b/drivers/crypto/qat/qat_common/qat_hal.c
@@ -546,17 +546,6 @@ static void qat_hal_disable_ctx(struct icp_qat_fw_loader_handle *handle,
 	qat_hal_wr_ae_csr(handle, ae, CTX_ENABLES, ctx);
 }
 
-static uint64_t qat_hal_parity_64bit(uint64_t word)
-{
-	word ^= word >> 1;
-	word ^= word >> 2;
-	word ^= word >> 4;
-	word ^= word >> 8;
-	word ^= word >> 16;
-	word ^= word >> 32;
-	return word & 1;
-}
-
 static uint64_t qat_hal_set_uword_ecc(uint64_t uword)
 {
 	uint64_t bit0_mask = 0xff800007fffULL, bit1_mask = 0x1f801ff801fULL,
@@ -566,13 +555,13 @@ static uint64_t qat_hal_set_uword_ecc(uint64_t uword)
 
 	/* clear the ecc bits */
 	uword &= ~(0x7fULL << 0x2C);
-	uword |= qat_hal_parity_64bit(bit0_mask & uword) << 0x2C;
-	uword |= qat_hal_parity_64bit(bit1_mask & uword) << 0x2D;
-	uword |= qat_hal_parity_64bit(bit2_mask & uword) << 0x2E;
-	uword |= qat_hal_parity_64bit(bit3_mask & uword) << 0x2F;
-	uword |= qat_hal_parity_64bit(bit4_mask & uword) << 0x30;
-	uword |= qat_hal_parity_64bit(bit5_mask & uword) << 0x31;
-	uword |= qat_hal_parity_64bit(bit6_mask & uword) << 0x32;
+	uword |= (uint64_t)parity64(bit0_mask & uword) << 0x2C;
+	uword |= (uint64_t)parity64(bit1_mask & uword) << 0x2D;
+	uword |= (uint64_t)parity64(bit2_mask & uword) << 0x2E;
+	uword |= (uint64_t)parity64(bit3_mask & uword) << 0x2F;
+	uword |= (uint64_t)parity64(bit4_mask & uword) << 0x30;
+	uword |= (uint64_t)parity64(bit5_mask & uword) << 0x31;
+	uword |= (uint64_t)parity64(bit6_mask & uword) << 0x32;
 	return uword;
 }
 
@@ -853,15 +842,14 @@ void qat_hal_wr_umem(struct icp_qat_fw_loader_handle *handle,
 	uaddr |= UA_ECS;
 	qat_hal_wr_ae_csr(handle, ae, USTORE_ADDRESS, uaddr);
 	for (i = 0; i < words_num; i++) {
-		unsigned int uwrd_lo, uwrd_hi, tmp;
+		unsigned int uwrd_lo, uwrd_hi;
 
 		uwrd_lo = ((data[i] & 0xfff0000) << 4) | (0x3 << 18) |
 			  ((data[i] & 0xff00) << 2) |
 			  (0x3 << 8) | (data[i] & 0xff);
 		uwrd_hi = (0xf << 4) | ((data[i] & 0xf0000000) >> 28);
-		uwrd_hi |= (hweight32(data[i] & 0xffff) & 0x1) << 8;
-		tmp = ((data[i] >> 0x10) & 0xffff);
-		uwrd_hi |= (hweight32(tmp) & 0x1) << 9;
+		uwrd_hi |= parity16(data[i]) << 8;
+		uwrd_hi |= parity16(data[i] >> 16) << 9;
 		qat_hal_wr_ae_csr(handle, ae, USTORE_DATA_LOWER, uwrd_lo);
 		qat_hal_wr_ae_csr(handle, ae, USTORE_DATA_UPPER, uwrd_hi);
 	}
-- 
2.5.0

[toc] | [prev] | [next] | [standalone]


#1372351 — [PATCH v2 21/30] mtd: use parity functions in inftlcore

Fromzengzhaoxiu@163.com
Date2016-04-06 12:00 +0200
Subject[PATCH v2 21/30] mtd: use parity functions in inftlcore
Message-ID<rkSpI-1RZ-23@gated-at.bofh.it>
In reply to#1371135
From: Zhaoxiu Zeng <zhaoxiu.zeng@gmail.com>

Signed-off-by: Zhaoxiu Zeng <zhaoxiu.zeng@gmail.com>
---
 drivers/mtd/inftlcore.c | 17 ++++-------------
 1 file changed, 4 insertions(+), 13 deletions(-)

diff --git a/drivers/mtd/inftlcore.c b/drivers/mtd/inftlcore.c
index b66b541..8c9457b 100644
--- a/drivers/mtd/inftlcore.c
+++ b/drivers/mtd/inftlcore.c
@@ -457,15 +457,6 @@ static u16 INFTL_makefreeblock(struct INFTLrecord *inftl, unsigned pendingblock)
 	return INFTL_foldchain(inftl, LongestChain, pendingblock);
 }
 
-static int nrbits(unsigned int val, int bitcount)
-{
-	int i, total = 0;
-
-	for (i = 0; (i < bitcount); i++)
-		total += (((0x1 << i) & val) ? 1 : 0);
-	return total;
-}
-
 /*
  * INFTL_findwriteunit: Return the unit number into which we can write
  *                      for this block. Make it available if it isn't already.
@@ -593,10 +584,10 @@ hitused:
 		if (prev_block < inftl->nb_blocks)
 			prev_block -= inftl->firstEUN;
 
-		parity = (nrbits(thisVUC, 16) & 0x1) ? 0x1 : 0;
-		parity |= (nrbits(prev_block, 16) & 0x1) ? 0x2 : 0;
-		parity |= (nrbits(anac, 8) & 0x1) ? 0x4 : 0;
-		parity |= (nrbits(nacs, 8) & 0x1) ? 0x8 : 0;
+		parity  = parity16(thisVUC);
+		parity |= parity16(prev_block) << 1;
+		parity |= parity8(anac) << 2;
+		parity |= parity8(nacs) << 3;
 
 		oob.u.a.virtualUnitNo = cpu_to_le16(thisVUC);
 		oob.u.a.prevUnitNo = cpu_to_le16(prev_block);
-- 
2.5.0

[toc] | [prev] | [next] | [standalone]


#1372354 — [PATCH v2 20/30] mtd: use parity16 in ssfdc

Fromzengzhaoxiu@163.com
Date2016-04-06 12:00 +0200
Subject[PATCH v2 20/30] mtd: use parity16 in ssfdc
Message-ID<rkSpJ-1RZ-31@gated-at.bofh.it>
In reply to#1371135
From: Zhaoxiu Zeng <zhaoxiu.zeng@gmail.com>

The original get_parity return even parity of the input number. So
hweight of "block_address & 0x7ff" must be odd if block_address is valid.

This patch use parity16, and rearrange the code.

Signed-off-by: Zhaoxiu Zeng <zhaoxiu.zeng@gmail.com>
---
 drivers/mtd/ssfdc.c | 31 ++++++++-----------------------
 1 file changed, 8 insertions(+), 23 deletions(-)

diff --git a/drivers/mtd/ssfdc.c b/drivers/mtd/ssfdc.c
index daf82ba..1d55f15 100644
--- a/drivers/mtd/ssfdc.c
+++ b/drivers/mtd/ssfdc.c
@@ -182,24 +182,10 @@ static int read_raw_oob(struct mtd_info *mtd, loff_t offs, uint8_t *buf)
 	return 0;
 }
 
-/* Parity calculator on a word of n bit size */
-static int get_parity(int number, int size)
-{
- 	int k;
-	int parity;
-
-	parity = 1;
-	for (k = 0; k < size; k++) {
-		parity += (number >> k);
-		parity &= 1;
-	}
-	return parity;
-}
-
 /* Read and validate the logical block address field stored in the OOB */
 static int get_logical_address(uint8_t *oob_buf)
 {
-	int block_address, parity;
+	int block_address;
 	int offset[2] = {6, 11}; /* offset of the 2 address fields within OOB */
 	int j;
 	int ok = 0;
@@ -215,18 +201,17 @@ static int get_logical_address(uint8_t *oob_buf)
 
 		/* Check for the signature bits in the address field (MSBits) */
 		if ((block_address & ~0x7FF) == 0x1000) {
-			parity = block_address & 0x01;
 			block_address &= 0x7FF;
-			block_address >>= 1;
 
-			if (get_parity(block_address, 10) != parity) {
-				pr_debug("SSFDC_RO: logical address field%d"
-					"parity error(0x%04X)\n", j+1,
-					block_address);
-			} else {
-				ok = 1;
+			ok = parity16(block_address);
+			if (ok) {
+				block_address >>= 1;
 				break;
 			}
+
+			pr_debug("SSFDC_RO: logical address field%d"
+				"parity error(0x%04X)\n", j+1,
+				block_address);
 		}
 	}
 
-- 
2.5.0

[toc] | [prev] | [next] | [standalone]


#1372359 — [PATCH v2 23/30] mtd: use parity16 in sm_ftl

Fromzengzhaoxiu@163.com
Date2016-04-06 12:10 +0200
Subject[PATCH v2 23/30] mtd: use parity16 in sm_ftl
Message-ID<rkSzq-2dL-61@gated-at.bofh.it>
In reply to#1371135
From: Zhaoxiu Zeng <zhaoxiu.zeng@gmail.com>

Signed-off-by: Zhaoxiu Zeng <zhaoxiu.zeng@gmail.com>
---
 drivers/mtd/sm_ftl.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/mtd/sm_ftl.c b/drivers/mtd/sm_ftl.c
index b096f8b..345ff1a 100644
--- a/drivers/mtd/sm_ftl.c
+++ b/drivers/mtd/sm_ftl.c
@@ -136,7 +136,7 @@ static int sm_get_lba(uint8_t *lba)
 		return -2;
 
 	/* check parity - endianness doesn't matter */
-	if (hweight16(*(uint16_t *)lba) & 1)
+	if (parity16(*(uint16_t *)lba))
 		return -2;
 
 	return (lba[1] >> 1) | ((lba[0] & 0x07) << 7);
@@ -183,8 +183,7 @@ static void sm_write_lba(struct sm_oob *oob, uint16_t lba)
 	tmp[0] = 0x10 | ((lba >> 7) & 0x07);
 	tmp[1] = (lba << 1) & 0xFF;
 
-	if (hweight16(*(uint16_t *)tmp) & 0x01)
-		tmp[1] |= 1;
+	tmp[1] |= parity16(*(uint16_t *)tmp);
 
 	oob->lba_copy1[0] = oob->lba_copy2[0] = tmp[0];
 	oob->lba_copy1[1] = oob->lba_copy2[1] = tmp[1];
-- 
2.5.0

[toc] | [prev] | [next] | [standalone]


#1372362 — [PATCH v2 26/30] input: use parity8 in sa1111ps2

Fromzengzhaoxiu@163.com
Date2016-04-06 12:20 +0200
Subject[PATCH v2 26/30] input: use parity8 in sa1111ps2
Message-ID<rkSJ4-2ho-1@gated-at.bofh.it>
In reply to#1371135
From: Zhaoxiu Zeng <zhaoxiu.zeng@gmail.com>

Signed-off-by: Zhaoxiu Zeng <zhaoxiu.zeng@gmail.com>
---
 drivers/input/serio/sa1111ps2.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/input/serio/sa1111ps2.c b/drivers/input/serio/sa1111ps2.c
index b3e6889..324b193 100644
--- a/drivers/input/serio/sa1111ps2.c
+++ b/drivers/input/serio/sa1111ps2.c
@@ -74,7 +74,7 @@ static irqreturn_t ps2_rxint(int irq, void *dev_id)
 
 		scancode = sa1111_readl(ps2if->base + PS2DATA) & 0xff;
 
-		if (hweight8(scancode) & 1)
+		if (parity8(scancode))
 			flag ^= SERIO_PARITY;
 
 		serio_interrupt(ps2if->io, scancode, flag);
-- 
2.5.0

[toc] | [prev] | [next] | [standalone]


#1372366 — [PATCH v2 27/30] iio: use parity32 in adxrs450

Fromzengzhaoxiu@163.com
Date2016-04-06 12:20 +0200
Subject[PATCH v2 27/30] iio: use parity32 in adxrs450
Message-ID<rkSJ4-2ho-15@gated-at.bofh.it>
In reply to#1371135
From: Zhaoxiu Zeng <zhaoxiu.zeng@gmail.com>

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

diff --git a/drivers/iio/gyro/adxrs450.c b/drivers/iio/gyro/adxrs450.c
index a330d42..307f55b 100644
--- a/drivers/iio/gyro/adxrs450.c
+++ b/drivers/iio/gyro/adxrs450.c
@@ -109,7 +109,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))
+	if (!parity32(tx))
 		tx |= ADXRS450_P;
 
 	st->tx = cpu_to_be32(tx);
@@ -145,7 +145,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))
+	if (!parity32(tx))
 		tx |= ADXRS450_P;
 
 	st->tx = cpu_to_be32(tx);
-- 
2.5.0

[toc] | [prev] | [next] | [standalone]


#1374794 — Re: [PATCH v2 27/30] iio: use parity32 in adxrs450

FromJonathan Cameron <jic23@kernel.org>
Date2016-04-10 16:40 +0200
SubjectRe: [PATCH v2 27/30] iio: use parity32 in adxrs450
Message-ID<rmoGR-6sx-5@gated-at.bofh.it>
In reply to#1372366
On 06/04/16 11:16, zengzhaoxiu@163.com wrote:
> From: Zhaoxiu Zeng <zhaoxiu.zeng@gmail.com>
> 
> Signed-off-by: Zhaoxiu Zeng <zhaoxiu.zeng@gmail.com>
Applied to the togreg branch of iio.git as you seem to have addressed
Lars' comments.

Thanks,

Jonathan
> ---
>  drivers/iio/gyro/adxrs450.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/iio/gyro/adxrs450.c b/drivers/iio/gyro/adxrs450.c
> index a330d42..307f55b 100644
> --- a/drivers/iio/gyro/adxrs450.c
> +++ b/drivers/iio/gyro/adxrs450.c
> @@ -109,7 +109,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))
> +	if (!parity32(tx))
>  		tx |= ADXRS450_P;
>  
>  	st->tx = cpu_to_be32(tx);
> @@ -145,7 +145,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))
> +	if (!parity32(tx))
>  		tx |= ADXRS450_P;
>  
>  	st->tx = cpu_to_be32(tx);
> 

[toc] | [prev] | [next] | [standalone]


#1374800 — Re: [PATCH v2 27/30] iio: use parity32 in adxrs450

FromLars-Peter Clausen <lars@metafoo.de>
Date2016-04-10 17:10 +0200
SubjectRe: [PATCH v2 27/30] iio: use parity32 in adxrs450
Message-ID<rmp9U-6X6-9@gated-at.bofh.it>
In reply to#1374794
On 04/10/2016 04:37 PM, Jonathan Cameron wrote:
> On 06/04/16 11:16, zengzhaoxiu@163.com wrote:
>> From: Zhaoxiu Zeng <zhaoxiu.zeng@gmail.com>
>>
>> Signed-off-by: Zhaoxiu Zeng <zhaoxiu.zeng@gmail.com>
> Applied to the togreg branch of iio.git as you seem to have addressed
> Lars' comments.

The whole series needs to go through the same tree since the new functions
are introduced in the beginning.

[toc] | [prev] | [next] | [standalone]


#1374802 — Re: [PATCH v2 27/30] iio: use parity32 in adxrs450

FromJonathan Cameron <jic23@kernel.org>
Date2016-04-10 17:20 +0200
SubjectRe: [PATCH v2 27/30] iio: use parity32 in adxrs450
Message-ID<rmpjz-71i-5@gated-at.bofh.it>
In reply to#1374800
On 10/04/16 15:41, Lars-Peter Clausen wrote:
> On 04/10/2016 04:37 PM, Jonathan Cameron wrote:
>> On 06/04/16 11:16, zengzhaoxiu@163.com wrote:
>>> From: Zhaoxiu Zeng <zhaoxiu.zeng@gmail.com>
>>>
>>> Signed-off-by: Zhaoxiu Zeng <zhaoxiu.zeng@gmail.com>
>> Applied to the togreg branch of iio.git as you seem to have addressed
>> Lars' comments.
> 
> The whole series needs to go through the same tree since the new functions
> are introduced in the beginning.
Yeah, I just realized that when my build test failed!

Acked-by: Jonathan Cameron <jic23@kernel.org>
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-iio" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 

[toc] | [prev] | [next] | [standalone]


#1374803 — Re: [PATCH v2 27/30] iio: use parity32 in adxrs450

FromJonathan Cameron <jic23@kernel.org>
Date2016-04-10 17:20 +0200
SubjectRe: [PATCH v2 27/30] iio: use parity32 in adxrs450
Message-ID<rmpjA-71i-9@gated-at.bofh.it>
In reply to#1374802
On 10/04/16 16:13, Jonathan Cameron wrote:
> On 10/04/16 15:41, Lars-Peter Clausen wrote:
>> On 04/10/2016 04:37 PM, Jonathan Cameron wrote:
>>> On 06/04/16 11:16, zengzhaoxiu@163.com wrote:
>>>> From: Zhaoxiu Zeng <zhaoxiu.zeng@gmail.com>
>>>>
>>>> Signed-off-by: Zhaoxiu Zeng <zhaoxiu.zeng@gmail.com>
>>> Applied to the togreg branch of iio.git as you seem to have addressed
>>> Lars' comments.
>>
>> The whole series needs to go through the same tree since the new functions
>> are introduced in the beginning.
> Yeah, I just realized that when my build test failed!
> 
> Acked-by: Jonathan Cameron <jic23@kernel.org>
Backed out of the togreg branch of iio.git...

oops and thanks Lars!
>>
>> --
>> To unsubscribe from this list: send the line "unsubscribe linux-iio" in
>> the body of a message to majordomo@vger.kernel.org
>> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>>
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-iio" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 

[toc] | [prev] | [next] | [standalone]


#1372370 — [PATCH v2 24/30] ethernet: use parity8 in sun/niu.c

Fromzengzhaoxiu@163.com
Date2016-04-06 12:20 +0200
Subject[PATCH v2 24/30] ethernet: use parity8 in sun/niu.c
Message-ID<rkSJ5-2ho-21@gated-at.bofh.it>
In reply to#1371135
From: Zhaoxiu Zeng <zhaoxiu.zeng@gmail.com>

Signed-off-by: Zhaoxiu Zeng <zhaoxiu.zeng@gmail.com>
---
 drivers/net/ethernet/sun/niu.c | 10 ++--------
 1 file changed, 2 insertions(+), 8 deletions(-)

diff --git a/drivers/net/ethernet/sun/niu.c b/drivers/net/ethernet/sun/niu.c
index 9cc4564..8c344ef 100644
--- a/drivers/net/ethernet/sun/niu.c
+++ b/drivers/net/ethernet/sun/niu.c
@@ -2742,18 +2742,12 @@ static int niu_set_alt_mac_rdc_table(struct niu *np, int idx,
 
 static u64 vlan_entry_set_parity(u64 reg_val)
 {
-	u64 port01_mask;
-	u64 port23_mask;
-
-	port01_mask = 0x00ff;
-	port23_mask = 0xff00;
-
-	if (hweight64(reg_val & port01_mask) & 1)
+	if (parity8(reg_val))
 		reg_val |= ENET_VLAN_TBL_PARITY0;
 	else
 		reg_val &= ~ENET_VLAN_TBL_PARITY0;
 
-	if (hweight64(reg_val & port23_mask) & 1)
+	if (parity8((unsigned int)reg_val >> 8))
 		reg_val |= ENET_VLAN_TBL_PARITY1;
 	else
 		reg_val &= ~ENET_VLAN_TBL_PARITY1;
-- 
2.5.0

[toc] | [prev] | [next] | [standalone]


#1372372 — [PATCH v2 25/30] input: use parity8 in pcips2

Fromzengzhaoxiu@163.com
Date2016-04-06 12:20 +0200
Subject[PATCH v2 25/30] input: use parity8 in pcips2
Message-ID<rkSJ4-2ho-17@gated-at.bofh.it>
In reply to#1371135
From: Zhaoxiu Zeng <zhaoxiu.zeng@gmail.com>

Signed-off-by: Zhaoxiu Zeng <zhaoxiu.zeng@gmail.com>
---
 drivers/input/serio/pcips2.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/input/serio/pcips2.c b/drivers/input/serio/pcips2.c
index e862c6e..a51e7f0 100644
--- a/drivers/input/serio/pcips2.c
+++ b/drivers/input/serio/pcips2.c
@@ -77,7 +77,7 @@ static irqreturn_t pcips2_interrupt(int irq, void *devid)
 
 		flag = (status & PS2_STAT_PARITY) ? 0 : SERIO_PARITY;
 
-		if (hweight8(scancode) & 1)
+		if (parity8(scancode))
 			flag ^= SERIO_PARITY;
 
 		serio_interrupt(ps2if->io, scancode, flag);
-- 
2.5.0

[toc] | [prev] | [next] | [standalone]


#1372376 — Re: [PATCH v2 28/30] serial: use parity32 in max3100

FromGreg KH <gregkh@linuxfoundation.org>
Date2016-04-06 12:30 +0200
SubjectRe: [PATCH v2 28/30] serial: use parity32 in max3100
Message-ID<rkSSK-2lx-3@gated-at.bofh.it>
In reply to#1371135
On Wed, Apr 06, 2016 at 06:18:42PM +0800, zengzhaoxiu@163.com wrote:
> From: Zhaoxiu Zeng <zhaoxiu.zeng@gmail.com>
> 
> Signed-off-by: Zhaoxiu Zeng <zhaoxiu.zeng@gmail.com>
> ---
>  drivers/tty/serial/max3100.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

I can't take patches without any changelog text :(

[toc] | [prev] | [next] | [standalone]


#1372379 — [PATCH v2 28/30] serial: use parity32 in max3100

Fromzengzhaoxiu@163.com
Date2016-04-06 12:30 +0200
Subject[PATCH v2 28/30] serial: use parity32 in max3100
Message-ID<rkSSK-2lx-5@gated-at.bofh.it>
In reply to#1371135
From: Zhaoxiu Zeng <zhaoxiu.zeng@gmail.com>

Signed-off-by: Zhaoxiu Zeng <zhaoxiu.zeng@gmail.com>
---
 drivers/tty/serial/max3100.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/tty/serial/max3100.c b/drivers/tty/serial/max3100.c
index 5c4c280..a0cc84a 100644
--- a/drivers/tty/serial/max3100.c
+++ b/drivers/tty/serial/max3100.c
@@ -155,7 +155,7 @@ static int max3100_do_parity(struct max3100_port *s, u16 c)
 	else
 		c &= 0xff;
 
-	parity = parity ^ (hweight8(c) & 1);
+	parity ^= parity8(c);
 	return parity;
 }
 
-- 
2.5.0

[toc] | [prev] | [next] | [standalone]


#1372380 — [PATCH v2 30/30] ethernet: use parity8 in broadcom/tg3.c

Fromzengzhaoxiu@163.com
Date2016-04-06 12:30 +0200
Subject[PATCH v2 30/30] ethernet: use parity8 in broadcom/tg3.c
Message-ID<rkSSK-2lx-21@gated-at.bofh.it>
In reply to#1371135
From: Zhaoxiu Zeng <zhaoxiu.zeng@gmail.com>

Signed-off-by: Zhaoxiu Zeng <zhaoxiu.zeng@gmail.com>
---
 drivers/net/ethernet/broadcom/tg3.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/drivers/net/ethernet/broadcom/tg3.c b/drivers/net/ethernet/broadcom/tg3.c
index 3010080..802a429 100644
--- a/drivers/net/ethernet/broadcom/tg3.c
+++ b/drivers/net/ethernet/broadcom/tg3.c
@@ -12939,11 +12939,7 @@ static int tg3_test_nvram(struct tg3 *tp)
 
 		err = -EIO;
 		for (i = 0; i < NVRAM_SELFBOOT_DATA_SIZE; i++) {
-			u8 hw8 = hweight8(data[i]);
-
-			if ((hw8 & 0x1) && parity[i])
-				goto out;
-			else if (!(hw8 & 0x1) && !parity[i])
+			if (parity8(data[i]) == !!parity[i])
 				goto out;
 		}
 		err = 0;
-- 
2.5.0

[toc] | [prev] | [next] | [standalone]


#1372384 — [PATCH v2 29/30] input: use parity8 in elantech

Fromzengzhaoxiu@163.com
Date2016-04-06 12:30 +0200
Subject[PATCH v2 29/30] input: use parity8 in elantech
Message-ID<rkSSL-2lx-29@gated-at.bofh.it>
In reply to#1371135
From: Zhaoxiu Zeng <zhaoxiu.zeng@gmail.com>

Remove even parity table, use parity8 instead.

Signed-off-by: Zhaoxiu Zeng <zhaoxiu.zeng@gmail.com>
---
 drivers/input/mouse/elantech.c | 10 +++-------
 drivers/input/mouse/elantech.h |  1 -
 2 files changed, 3 insertions(+), 8 deletions(-)

diff --git a/drivers/input/mouse/elantech.c b/drivers/input/mouse/elantech.c
index 78f93cf..bbb4aa6 100644
--- a/drivers/input/mouse/elantech.c
+++ b/drivers/input/mouse/elantech.c
@@ -693,9 +693,9 @@ static int elantech_packet_check_v1(struct psmouse *psmouse)
 
 	p3 = (packet[0] & 0x04) >> 2;
 
-	return etd->parity[packet[1]] == p1 &&
-	       etd->parity[packet[2]] == p2 &&
-	       etd->parity[packet[3]] == p3;
+	return parity8(packet[1]) != p1 &&
+	       parity8(packet[2]) != p2 &&
+	       parity8(packet[3]) != p3;
 }
 
 static int elantech_debounce_check_v2(struct psmouse *psmouse)
@@ -1635,10 +1635,6 @@ int elantech_init(struct psmouse *psmouse)
 
 	psmouse_reset(psmouse);
 
-	etd->parity[0] = 1;
-	for (i = 1; i < 256; i++)
-		etd->parity[i] = etd->parity[i & (i - 1)] ^ 1;
-
 	/*
 	 * Do the version query again so we can store the result
 	 */
diff --git a/drivers/input/mouse/elantech.h b/drivers/input/mouse/elantech.h
index e1cbf40..542c5d9 100644
--- a/drivers/input/mouse/elantech.h
+++ b/drivers/input/mouse/elantech.h
@@ -141,7 +141,6 @@ struct elantech_data {
 	unsigned int y_max;
 	unsigned int width;
 	struct finger_pos mt[ETP_MAX_FINGERS];
-	unsigned char parity[256];
 	int (*send_cmd)(struct psmouse *psmouse, unsigned char c, unsigned char *param);
 	void (*original_set_rate)(struct psmouse *psmouse, unsigned int rate);
 };
-- 
2.5.0

[toc] | [prev] | [standalone]


Page 3 of 3 — ← Prev page 1 2 [3]

Back to top | Article view | linux.kernel


csiph-web