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


Groups > linux.kernel > #1566685

Re: edac/i7300_edac.c:307: strange macro ?

From Borislav Petkov <bp@alien8.de>
Newsgroups linux.kernel
Subject Re: edac/i7300_edac.c:307: strange macro ?
Date 2017-01-25 16:40 +0100
Message-ID <t3xPY-3w9-11@gated-at.bofh.it> (permalink)
References <sYA25-4n7-5@gated-at.bofh.it> <sYA25-4n7-3@gated-at.bofh.it> <t3up4-1i3-41@gated-at.bofh.it> <t3up4-1i3-39@gated-at.bofh.it> <t3xPY-3w9-13@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Wed, Jan 25, 2017 at 12:04:04PM +0000, David Binderman wrote:
> You'll have a very long wait to get a linux patch from me.
> 
> I am happy for someone else to invent a patch.

Ah ok, I thought you wanted to give it a try and would want me to help
you with it. :-)

Anyway, here it is:

---
From: Borislav Petkov <bp@suse.de>
Date: Wed, 25 Jan 2017 16:08:27 +0100
Subject: [PATCH] EDAC, i7300: Test for the second channel properly

REDMEMB[17] is the ECC_Locator bit, which, when set, identifies the
CS[3:2] as the simbols in error. And thus the second channel.

The macro computing it was wrong so get rid of it (it was used at one
place only) and get rid of the conditional too. Generates better code
this way anyway.

Signed-off-by: Borislav Petkov <bp@suse.de>
Reported-by: David Binderman <dcb314@hotmail.com>
---
 drivers/edac/i7300_edac.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/edac/i7300_edac.c b/drivers/edac/i7300_edac.c
index 0a912bf6de00..e391f5a716be 100644
--- a/drivers/edac/i7300_edac.c
+++ b/drivers/edac/i7300_edac.c
@@ -304,7 +304,6 @@ static const char *ferr_global_lo_name[] = {
 #define REDMEMA		0xdc
 
 #define REDMEMB		0x7c
-  #define IS_SECOND_CH(v)	((v) * (1 << 17))
 
 #define RECMEMA		0xe0
   #define RECMEMA_BANK(v)	(((v) >> 12) & 7)
@@ -483,8 +482,9 @@ static void i7300_process_fbd_error(struct mem_ctl_info *mci)
 		pci_read_config_dword(pvt->pci_dev_16_1_fsb_addr_map,
 				     REDMEMB, &value);
 		channel = (branch << 1);
-		if (IS_SECOND_CH(value))
-			channel++;
+
+		/* Second channel ? */
+		channel += !!(value & BIT(17));
 
 		/* Clear the error bit */
 		pci_write_config_dword(pvt->pci_dev_16_1_fsb_addr_map,
-- 
2.11.0

-- 
Regards/Gruss,
    Boris.

Good mailing practices for 400: avoid top-posting and trim the reply.

Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Re: edac/i7300_edac.c:307: strange macro ? Borislav Petkov <bp@alien8.de> - 2017-01-25 13:00 +0100
  Re: edac/i7300_edac.c:307: strange macro ? Borislav Petkov <bp@alien8.de> - 2017-01-25 16:40 +0100
    Re: edac/i7300_edac.c:307: strange macro ? Mauro Carvalho Chehab <mchehab@osg.samsung.com> - 2017-01-26 10:00 +0100
      Re: edac/i7300_edac.c:307: strange macro ? Borislav Petkov <bp@alien8.de> - 2017-01-26 11:40 +0100

csiph-web