* EDAC, ghes: Use BIT() macro
@ 2018-05-12 12:36 Borislav Petkov
0 siblings, 0 replies; 2+ messages in thread
From: Borislav Petkov @ 2018-05-12 12:36 UTC (permalink / raw)
To: linux-edac; +Cc: Toshi Kani, Mauro Carvalho Chehab
From: Borislav Petkov <bp@suse.de>
... for improved readability. Also, add a local mask variable for the
same reason.
No functional changes.
Signed-off-by: Borislav Petkov <bp@suse.de>
Cc: Toshi Kani <toshi.kani@hpe.com>
Cc: Mauro Carvalho Chehab <mchehab@kernel.org>
---
drivers/edac/ghes_edac.c | 27 +++++++++++++--------------
1 file changed, 13 insertions(+), 14 deletions(-)
diff --git a/drivers/edac/ghes_edac.c b/drivers/edac/ghes_edac.c
index cb8f2704ffb0..863fbf3db29f 100644
--- a/drivers/edac/ghes_edac.c
+++ b/drivers/edac/ghes_edac.c
@@ -91,6 +91,7 @@ static void ghes_edac_dmidecode(const struct dmi_header *dh, void *arg)
struct dimm_info *dimm = EDAC_DIMM_PTR(mci->layers, mci->dimms,
mci->n_layers,
dimm_fill->count, 0, 0);
+ u16 rdr_mask = BIT(7) | BIT(13);
if (entry->size == 0xffff) {
pr_info("Can't get DIMM%i size\n",
@@ -99,22 +100,21 @@ static void ghes_edac_dmidecode(const struct dmi_header *dh, void *arg)
} else if (entry->size == 0x7fff) {
dimm->nr_pages = MiB_TO_PAGES(entry->extended_size);
} else {
- if (entry->size & 1 << 15)
- dimm->nr_pages = MiB_TO_PAGES((entry->size &
- 0x7fff) << 10);
+ if (entry->size & BIT(15))
+ dimm->nr_pages = MiB_TO_PAGES((entry->size & 0x7fff) << 10);
else
dimm->nr_pages = MiB_TO_PAGES(entry->size);
}
switch (entry->memory_type) {
case 0x12:
- if (entry->type_detail & 1 << 13)
+ if (entry->type_detail & BIT(13))
dimm->mtype = MEM_RDDR;
else
dimm->mtype = MEM_DDR;
break;
case 0x13:
- if (entry->type_detail & 1 << 13)
+ if (entry->type_detail & BIT(13))
dimm->mtype = MEM_RDDR2;
else
dimm->mtype = MEM_DDR2;
@@ -123,30 +123,29 @@ static void ghes_edac_dmidecode(const struct dmi_header *dh, void *arg)
dimm->mtype = MEM_FB_DDR2;
break;
case 0x18:
- if (entry->type_detail & 1 << 12)
+ if (entry->type_detail & BIT(12))
dimm->mtype = MEM_NVDIMM;
- else if (entry->type_detail & 1 << 13)
+ else if (entry->type_detail & BIT(13))
dimm->mtype = MEM_RDDR3;
else
dimm->mtype = MEM_DDR3;
break;
case 0x1a:
- if (entry->type_detail & 1 << 12)
+ if (entry->type_detail & BIT(12))
dimm->mtype = MEM_NVDIMM;
- else if (entry->type_detail & 1 << 13)
+ else if (entry->type_detail & BIT(13))
dimm->mtype = MEM_RDDR4;
else
dimm->mtype = MEM_DDR4;
break;
default:
- if (entry->type_detail & 1 << 6)
+ if (entry->type_detail & BIT(6))
dimm->mtype = MEM_RMBS;
- else if ((entry->type_detail & ((1 << 7) | (1 << 13)))
- == ((1 << 7) | (1 << 13)))
+ else if ((entry->type_detail & rdr_mask) == rdr_mask)
dimm->mtype = MEM_RDR;
- else if (entry->type_detail & 1 << 7)
+ else if (entry->type_detail & BIT(7))
dimm->mtype = MEM_SDR;
- else if (entry->type_detail & 1 << 9)
+ else if (entry->type_detail & BIT(9))
dimm->mtype = MEM_EDO;
else
dimm->mtype = MEM_UNKNOWN;
^ permalink raw reply related [flat|nested] 2+ messages in thread
* EDAC, ghes: Use BIT() macro
@ 2018-05-14 22:10 Toshi Kani
0 siblings, 0 replies; 2+ messages in thread
From: Toshi Kani @ 2018-05-14 22:10 UTC (permalink / raw)
To: bp@alien8.de, linux-edac@vger.kernel.org; +Cc: mchehab@kernel.org
On Sat, 2018-05-12 at 14:36 +0200, Borislav Petkov wrote:
> From: Borislav Petkov <bp@suse.de>
>
> ... for improved readability. Also, add a local mask variable for the
> same reason.
>
> No functional changes.
>
> Signed-off-by: Borislav Petkov <bp@suse.de>
> Cc: Toshi Kani <toshi.kani@hpe.com>
> Cc: Mauro Carvalho Chehab <mchehab@kernel.org>
The change looks good.
Reviewed-by: Toshi Kani <toshi.kani@hpe.com>
Thanks,
-Toshi
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2018-05-14 22:10 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-05-14 22:10 EDAC, ghes: Use BIT() macro Toshi Kani
-- strict thread matches above, loose matches on Subject: below --
2018-05-12 12:36 Borislav Petkov
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).